{"data":[{"id":"f34e1d65-672e-4287-b3d8-733c1d1f44e7","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-3859accb2d55","reason":"retryable_provider_transport:pr_ready_timeout_budget_exhausted","status":"retryable","metrics":{"receiptBytes":27425,"releaseCount":0,"toolCallCount":9,"repeatedCallCount":4,"executorlessWaitMs":102074,"firstUsefulResultAt":"2026-09-29T01:46:32.425Z","recoveryAttemptCount":5,"ownerInterruptionCount":0},"version":null,"prNumber":4076,"terminal":false,"missionId":"3859accb-2d55-4af2-a54b-4c8c70c7e274","operation":"automatic_mission_resume","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"prReadinessMs":43977,"approvedPlanMs":0,"shipAndProveMs":0,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"3859accb-2d55-4af2-a54b-4c8c70c7e274"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2344,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:47:27.110957+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4076","receipt_type":"automatic_mission_resume","idempotency_key":"mission:3859accb-2d55-4af2-a54b-4c8c70c7e274:automatic-mission-resume:4076:repair_mission_pr_ready_retryable","mission_step_id":"a2bf3f45-018c-47a3-bbdf-74888f3942d1","command_center_event_id":"3859accb-2d55-4af2-a54b-4c8c70c7e274"},{"id":"61b96d6c-505f-40c5-856c-116fa21db5ac","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[{"path":"src/pages/crm/PcgWorkspace.tsx","content":"import {useEffect,useMemo,useState,type ComponentType} from 'react';\nimport {useMultiTenant} from '@/contexts/MultiTenantContext';import {supabase} from '@/integrations/supabase/client';import {toast} from '@/lib/notify';import {resolveTenantMediaBranding} from '@/lib/tenants/tenantMediaBranding';import {PCGCardVaultContent} from '@/pages/card-grading/PCGWorkspace';\nimport {Award,BadgeDollarSign,Boxes,Check,ChevronRight,CircleDollarSign,CreditCard,ExternalLink,FileCheck2,Menu,PackageCheck,Plus,Search,Settings,ShieldCheck,Truck,UploadCloud,Users,X} from 'lucide-react';\nimport TenantSettingsPage from '@/pages/settings/TenantSettingsPage';\ntype Submission={id:string;submission_number:string;customer_name:string|null;customer_email:string|null;customer_phone:string|null;service_tier:string;service_price:number;expected_card_count:number;status:string;delivery_method:string|null;received_at:string;due_at:string|null;tracking_in:string|null;tracking_out:string|null;notes:string|null;payment_status:string|null;payment_reference:string|null;paid_at:string|null};type Card={id:string;submission_id:string;sequence_number:number;cert_number:string|null;category:string|null;year:string|null;brand_set:string|null;player_character:string|null;card_number:string|null;card_description:string|null;autograph_present:boolean|null;variation:string|null;declared_value:number|null;grade:number|null;grade_label:string|null;status:string;front_image_url:string|null;back_image_url:string|null;slab_image_url:string|null;grader_notes:string|null;population_count:number|null};type CardDraft={category:string;year:string;brand_set:string;player_character:string;card_number:string;card_description:string;autograph_present:''|'yes'|'no';declared_value:string;grade:string;grade_label:string;cert_number:string;grader_notes:string};type DetailDraft={tracking_in:string;tracking_out:string;notes:string;payment_status:string;payment_reference:string};type Tab='today'|'vault'|'queue'|'submissions'|'certs'|'collectors'|'inventory'|'shipping'|'money'|'settings';type IconType=ComponentType<{className?:string}>;\nconst tabs:[Tab,string,IconType][]=[['today','Operations',Award],['vault','Card Vault',UploadCloud],['queue','Grading Floor',Award],['submissions','Intake',Boxes],['certs','Cert Vault',ShieldCheck],['collectors','Collectors',Users],['shipping','Fulfillment',Truck],['inventory','Card Shop',PackageCheck],['money','Stripe Desk',CircleDollarSign],['settings','Settings',Settings]];const mobilePrimary:[Tab,string,IconType][]=[['today','Ops',Award],['vault','Vault',UploadCloud],['queue','Floor',Award],['certs','Certs',ShieldCheck]];\nconst tiers={two_weeks:{label:'2 Weeks',price:12,days:14},one_week:{label:'1 Week',price:15,days:7},three_days:{label:'3 Days',price:20,days:3},same_day:{label:'Same Day',price:25,days:0}} as const;const statuses=['received','intake_imaging','authentication','grading','encapsulation','qa','ready','shipped','picked_up'] as const;const terminalStatuses=new Set(['shipped','picked_up']);const PCG_STRIPE_FALLBACK='https://buy.stripe.com/3clbJ05UQc3w9KLcBR5Ne00';const PCG_LOGO='https://images.squarespace-cdn.com/content/v1/6853034cd711cc2240276cf3/2c2615b1-2fab-4ba1-8cff-8d8e49b6b184/diamond%2Blogo.png';const PCG_STORE_IMAGE='https://images.squarespace-cdn.com/content/v1/6853034cd711cc2240276cf3/83d3ec70-169f-4d22-8916-15e422fb0e52/IMG_8156%2B%281%29.jpeg';const PCG_CARD_IMAGE='https://images.squarespace-cdn.com/content/v1/6853034cd711cc2240276cf3/7fd5d898-1ff3-4bc2-9f7d-c7f2f2d6ee07/IMG_8111.jpg';const pretty=(value:string)=>value.replaceAll('_',' ').replace(/\\b\\w/g,char=>char.toUpperCase());const inputClass='w-full border border-white/[0.10] bg-black/45 px-3.5 py-3 text-sm text-white outline-none transition placeholder:text-white/28 focus:border-[#d8bb78]/55';const panelClass='border border-white/[0.08] bg-[#09090a]/88';\nfunction cardToDraft(card:Card):CardDraft{return{category:card.category||'',year:card.year||'',brand_set:card.brand_set||'',player_character:card.player_character||'',card_number:card.card_number||'',card_description:card.card_description||card.variation||'',autograph_present:card.autograph_present==null?'':card.autograph_present?'yes':'no',declared_value:card.declared_value==null?'':String(card.declared_value),grade:card.grade==null?'':String(card.grade),grade_label:card.grade_label||'',cert_number:card.cert_number||'',grader_notes:card.grader_notes||''}}function slaMeta(sub:Submission){if(!sub.due_at||terminalStatuses.has(sub.status))return{label:terminalStatuses.has(sub.status)?pretty(sub.status):'No due date',tone:'text-white/42 border-white/10'};const diff=new Date(sub.due_at).getTime()-Date.now();const days=Math.ceil(diff/86400000);if(diff<0)return{label:`${Math.abs(days)}d overdue`,tone:'text-rose-300 border-rose-400/25'};if(days===0)return{label:'Due today',tone:'text-amber-200 border-amber-300/25'};if(days<=2)return{label:`Due in ${days}d`,tone:'text-amber-200 border-amber-300/25'};return{label:`Due ${new Date(sub.due_at).toLocaleDateString()}`,tone:'text-white/46 border-white/10'}}\nexport default function PcgWorkspace({initialTab='today',embedded=false,initialVaultMode='overview'}:{initialTab?:Tab;embedded?:boolean;initialVaultMode?:'overview'|'single'|'batch'|'growth'}={}){const{activeTenant}=useMultiTenant();const tenantId=activeTenant?.id;const settings=((activeTenant as any)?.settings||{}) as Record<string,unknown>;const mediaBranding=useMemo(()=>resolveTenantMediaBranding(activeTenant as any),[activeTenant]);const workspaceBackground=mediaBranding.backgroundUrl||String(settings.background_image_url||settings.backgroundImageUrl||'').trim();const stripePaymentLink=String(settings.stripe_payment_link||PCG_STRIPE_FALLBACK);const stripeSyncConnected=String(settings.stripe_sync_status||'not_connected')==='connected';const[tab,setTab]=useState<Tab>(initialTab);useEffect(()=>{setTab(initialTab)},[initialTab]);const[subs,setSubs]=useState<Submission[]>([]);const[cards,setCards]=useState<Card[]>([]);const[loading,setLoading]=useState(true);const[showNew,setShowNew]=useState(false);const[showMore,setShowMore]=useState(false);const[selectedId,setSelectedId]=useState<string|null>(null);const[query,setQuery]=useState('');const[statusFilter,setStatusFilter]=useState('all');const[certQuery,setCertQuery]=useState('');const[busy,setBusy]=useState(false);const[cardDrafts,setCardDrafts]=useState<Record<string,CardDraft>>({});const[detailDraft,setDetailDraft]=useState<DetailDraft>({tracking_in:'',tracking_out:'',notes:'',payment_status:'unverified',payment_reference:''});const[form,setForm]=useState({name:'',email:'',phone:'',tier:'two_weeks',cardCount:'1',delivery:'walk_in',notes:''});const selectedTier=tiers[form.tier as keyof typeof tiers]||tiers.two_weeks;const selectedCardCount=Math.max(1,Math.min(100000,Number(form.cardCount)||1));const expectedTotal=selectedCardCount*selectedTier.price;const openStripe=()=>window.open(stripePaymentLink,'_blank','noopener,noreferrer');\nasync function load(){if(!tenantId)return;setLoading(true);const[s,c]=await Promise.all([(supabase as any).from('card_grading_submissions').select('*').eq('tenant_id',tenantId).order('created_at',{ascending:false}),(supabase as any).from('card_grading_cards').select('*').eq('tenant_id',tenantId).order('sequence_number',{ascending:true})]);if(s.error)toast.error(s.error.message);if(c.error)toast.error(c.error.message);setSubs((s.data||[]) as Submission[]);setCards((c.data||[]) as Card[]);setLoading(false)}useEffect(()=>{void load()},[tenantId]);\nconst orderCardCount=(sub:Submission)=>Math.max(Number(sub.expected_card_count||0),cards.filter(card=>card.submission_id===sub.id).length);const counts=useMemo(()=>Object.fromEntries(statuses.map(status=>[status,subs.filter(item=>item.status===status).length])),[subs]);const openSubs=subs.filter(item=>!terminalStatuses.has(item.status));const overdue=openSubs.filter(item=>item.due_at&&new Date(item.due_at)<new Date()).length;const dueSoon=openSubs.filter(item=>item.due_at&&new Date(item.due_at)>=new Date()&&new Date(item.due_at).getTime()-Date.now()<=2*86400000).length;const serviceValue=subs.reduce((sum,item)=>sum+Number(item.service_price||0)*orderCardCount(item),0);const prioritySubs=[...openSubs].sort((a,b)=>(a.due_at?new Date(a.due_at).getTime():Number.MAX_SAFE_INTEGER)-(b.due_at?new Date(b.due_at).getTime():Number.MAX_SAFE_INTEGER)).slice(0,6);const filteredSubs=subs.filter(item=>{const hay=`${item.submission_number} ${item.customer_name||''} ${item.customer_email||''} ${item.customer_phone||''}`.toLowerCase();return(!query||hay.includes(query.toLowerCase()))&&(statusFilter==='all'||item.status===statusFilter)});const filteredCards=cards.filter(card=>!certQuery||`${card.cert_number||''} ${card.year||''} ${card.brand_set||''} ${card.player_character||''} ${card.card_description||card.variation||''} ${card.card_number||''}`.toLowerCase().includes(certQuery.toLowerCase()));const selected=subs.find(item=>item.id===selectedId)||null;const selectedCards=selected?cards.filter(card=>card.submission_id===selected.id):[];const selectedTotal=selected?orderCardCount(selected)*Number(selected.service_price||0):0;\nfunction openSubmission(sub:Submission){setSelectedId(sub.id);setDetailDraft({tracking_in:sub.tracking_in||'',tracking_out:sub.tracking_out||'',notes:sub.notes||'',payment_status:sub.payment_status||'unverified',payment_reference:sub.payment_reference||''});const next:Record<string,CardDraft>={};cards.filter(card=>card.submission_id===sub.id).forEach(card=>{next[card.id]=cardToDraft(card)});setCardDrafts(next)}\nasync function createSubmission(){if(!tenantId)return;if(!form.name.trim()){toast.error('Customer name is required.');return}const count=selectedCardCount,tier=selectedTier,now=new Date(),due=new Date(now);due.setDate(due.getDate()+tier.days);const submissionNumber=`PCG-${now.getFullYear()}-${String(Date.now()).slice(-7)}`;setBusy(true);const{data,error}=await(supabase as any).from('card_grading_submissions').insert({tenant_id:tenantId,submission_number:submissionNumber,customer_name:form.name.trim(),customer_email:form.email.trim()||null,customer_phone:form.phone.trim()||null,service_tier:form.tier,service_price:tier.price,expected_card_count:count,status:'received',payment_status:'unverified',delivery_method:form.delivery,notes:form.notes.trim()||null,received_at:now.toISOString(),due_at:due.toISOString()}).select('*').single();if(error||!data){toast.error(error?.message||'Unable to create submission');setBusy(false);return}toast.success(`${submissionNumber} created for ${count.toLocaleString()} card${count===1?'':'s'}. Add the actual cards through Card Vault intake.`);setShowNew(false);setForm({name:'',email:'',phone:'',tier:'two_weeks',cardCount:'1',delivery:'walk_in',notes:''});await load();setBusy(false)}\nfunction transitionIssue(sub:Submission,nextStatus:string,ownCards:Card[]){if(nextStatus==='authentication'){if(!ownCards.length)return 'Add cards before authentication.';const missing=ownCards.filter(card=>!card.front_image_url&&!card.back_image_url&&!card.slab_image_url).length;return missing?(missing+' card'+(missing===1?' needs':'s need')+' a saved intake image before authentication.'):''}if(nextStatus==='encapsulation'){const missing=ownCards.filter(card=>card.grade==null).length;return missing?(missing+' card'+(missing===1?' needs':'s need')+' a saved grade before encapsulation.'):''}if(nextStatus==='qa'){const missingGrade=ownCards.filter(card=>card.grade==null).length,missingCert=ownCards.filter(card=>!String(card.cert_number||'').trim()).length;return missingGrade||missingCert?('Save '+(missingGrade?(missingGrade+' missing grade'+(missingGrade===1?'':'s')):'')+(missingGrade&&missingCert?' and ':'')+(missingCert?(missingCert+' missing cert number'+(missingCert===1?'':'s')):'')+' before QA.'):''}if(nextStatus==='ready'){const missing=ownCards.filter(card=>card.grade==null||!String(card.cert_number||'').trim()||(!card.slab_image_url&&!card.front_image_url&&!card.back_image_url)).length;return missing?(missing+' card'+(missing===1?' is':'s are')+' missing saved grade, cert, or customer-visible imagery.'):''}if(nextStatus==='shipped'&&!String(sub.tracking_out||'').trim())return 'Save outbound tracking before marking this order shipped.';return ''}async function advanceBatch(nextStatus:string){if(!tenantId||!selected)return;const issue=transitionIssue(selected,nextStatus,selectedCards);if(issue){toast.error(issue);return}setBusy(true);const{error}=await(supabase as any).rpc('advance_pcg_grading_submission',{p_tenant_id:tenantId,p_submission_id:selected.id,p_status:nextStatus});if(error)toast.error(error.message||'Unable to advance submission');else{toast.success(`${selected.submission_number} moved to ${pretty(nextStatus)}.`);await load()}setBusy(false)}\nasync function saveSubmissionDetails(){if(!tenantId||!selected)return;setBusy(true);const manual=detailDraft.payment_status==='manually_verified';const{error}=await(supabase as any).from('card_grading_submissions').update({tracking_in:detailDraft.tracking_in.trim()||null,tracking_out:detailDraft.tracking_out.trim()||null,notes:detailDraft.notes.trim()||null,payment_status:detailDraft.payment_status,payment_reference:detailDraft.payment_reference.trim()||null,paid_at:manual?(selected.paid_at||new Date().toISOString()):null,updated_at:new Date().toISOString()}).eq('tenant_id',tenantId).eq('id',selected.id);if(error)toast.error(error.message);else{toast.success('Submission details saved.');await load()}setBusy(false)}\nasync function saveCard(card:Card){if(!tenantId)return;const draft=cardDrafts[card.id];if(!draft)return;setBusy(true);const grade=draft.grade.trim()===''?null:Number(draft.grade);const declared=draft.declared_value.trim()===''?null:Number(draft.declared_value);if(grade!=null&&(Number.isNaN(grade)||grade<0||grade>10)){toast.error('Grade must be between 0 and 10.');setBusy(false);return}const{error}=await(supabase as any).from('card_grading_cards').update({category:draft.category.trim()||null,year:draft.year.trim()||null,brand_set:draft.brand_set.trim()||null,player_character:draft.player_character.trim()||null,card_number:draft.card_number.trim()||null,card_description:draft.card_description.trim()||null,autograph_present:draft.autograph_present===''?null:draft.autograph_present==='yes',variation:draft.card_description.trim()||null,declared_value:declared,grade,grade_label:draft.grade_label.trim()||null,cert_number:draft.cert_number.trim()||null,grader_notes:draft.grader_notes.trim()||null,updated_at:new Date().toISOString()}).eq('tenant_id',tenantId).eq('id',card.id);if(error)toast.error(error.message);else{toast.success(`Card #${card.sequence_number} saved.`);await load()}setBusy(false)}\nconst metric=(label:string,value:string|number,sub:string)=><div className=\"py-3 sm:border-l sm:border-white/[0.08] sm:px-5 first:sm:border-l-0 first:sm:pl-0\"><div className=\"text-[9px] font-black uppercase tracking-[.18em] text-[#d0ae61]\">{label}</div><div className=\"mt-1 text-3xl font-black tracking-[-.04em]\">{value}</div><div className=\"mt-1 text-[11px] text-white/36\">{sub}</div></div>;\nconst empty=(title:string,copy:string,action?:()=>void,actionLabel?:string)=><div className=\"border border-dashed border-white/[0.10] bg-black/30 p-9 text-center\"><FileCheck2 className=\"mx-auto h-6 w-6 text-[#d8bb78]\"/><div className=\"mt-4 text-lg font-black\">{title}</div><p className=\"mx-auto mt-2 max-w-md text-sm leading-6 text-white/38\">{copy}</p>{action&&<button onClick={action} className=\"mt-5 bg-[#d8bb78] px-5 py-2.5 text-sm font-black text-black\">{actionLabel}</button>}</div>;\nconst row=(sub:Submission)=>{const cardCount=cards.filter(card=>card.submission_id===sub.id).length;const expected=Math.max(Number(sub.expected_card_count||0),cardCount);const payment=sub.payment_status==='manually_verified'?'Paid':sub.payment_status==='waived'?'Waived':'Unverified';return <button key={sub.id} onClick={()=>openSubmission(sub)} className=\"group grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-4 border-b border-white/[0.07] px-1 py-4 text-left transition last:border-b-0 hover:bg-white/[0.025]\"><div className=\"min-w-0\"><div className=\"flex flex-wrap items-center gap-2\"><span className=\"text-xs font-black tracking-wide text-[#e4c47b]\">{sub.submission_number}</span><span className=\"text-[9px] font-black uppercase tracking-[.12em] text-white/32\">{pretty(sub.status)}</span></div><div className=\"mt-1.5 truncate text-base font-black\">{sub.customer_name||'Collector not named'}</div><div className=\"mt-1 flex flex-wrap gap-x-4 text-xs text-white/34\"><span>{expected>cardCount?`${cardCount.toLocaleString()} / ${expected.toLocaleString()} cards ingested`:`${cardCount.toLocaleString()} card${cardCount===1?'':'s'}`}</span><span>{tiers[sub.service_tier as keyof typeof tiers]?.label||pretty(sub.service_tier)}</span><span>{payment}</span></div></div><div className=\"flex items-center gap-2\"><span className={`border px-2.5 py-1 text-[10px] font-black ${slaMeta(sub).tone}`}>{slaMeta(sub).label}</span><ChevronRight className=\"h-4 w-4 text-white/18\"/></div></button>};\nconst renderList=(heading:string,eyebrow:string,source:Submission[])=><section><div className=\"mb-6 flex flex-col gap-4 border-b border-white/[0.08] pb-5 xl:flex-row xl:items-end xl:justify-between\"><div><div className=\"text-[10px] font-black uppercase tracking-[.20em] text-[#d0ae61]\">{eyebrow}</div><h1 className=\"mt-2 text-4xl font-black tracking-[-.045em] sm:text-5xl\">{heading}</h1><p className=\"mt-2 text-sm text-white/38\">Open a batch to grade cards, verify payment, update tracking or move it forward.</p></div><button onClick={()=>setShowNew(true)} className=\"inline-flex items-center justify-center gap-2 bg-[#d8bb78] px-5 py-3 text-sm font-black text-black\"><Plus className=\"h-4 w-4\"/>New submission</button></div><div className=\"mb-5 grid gap-2 sm:grid-cols-[1fr_220px]\"><div className=\"relative\"><Search className=\"absolute left-4 top-3.5 h-4 w-4 text-white/28\"/><input value={query} onChange={event=>setQuery(event.target.value)} placeholder=\"Search submission or collector\" className={`${inputClass} pl-11`}/></div><select value={statusFilter} onChange={event=>setStatusFilter(event.target.value)} className={inputClass}><option value=\"all\">Every grading stage</option>{statuses.map(status=><option key={status} value={status}>{pretty(status)}</option>)}</select></div>{source.length?<div className=\"border-y border-white/[0.08]\">{source.map(row)}</div>:empty('The floor is clear','Create a grading submission and it enters the PCG floor immediately.',()=>setShowNew(true),'Start intake')}</section>;\nconst brandName=activeTenant?.company_dba_name||activeTenant?.company_legal_name||activeTenant?.name||'Prestigious Card Grading';\nreturn <div data-pcg-mode-workspace-background={workspaceBackground||'solid'} className=\"relative min-h-screen overflow-x-hidden bg-[#050506] text-white\" style={{backgroundImage:workspaceBackground?`linear-gradient(108deg,rgba(4,4,5,.98) 0%,rgba(4,4,5,.91) 35%,rgba(4,4,5,.68) 70%,rgba(4,4,5,.88) 100%),url(\"${workspaceBackground}\")`:undefined,backgroundSize:'cover',backgroundPosition:mediaBranding.backgroundPosition||'center',backgroundRepeat:'no-repeat',backgroundAttachment:'fixed'}}><div className=\"pointer-events-none fixed inset-0 bg-[radial-gradient(circle_at_78%_15%,rgba(216,187,120,.10),transparent_28rem)]\"/>\n{!embedded?<header className=\"fixed inset-x-0 top-0 z-50 h-16 border-b border-white/[0.07] bg-[#070708]/90 backdrop-blur-xl\"><div className=\"flex h-full items-center gap-3 px-4 sm:px-6\"><div className=\"grid h-9 w-9 place-items-center border border-[#d8bb78]/20 bg-[#d8bb78]/[0.06]\"><img src={PCG_LOGO} alt=\"PCG\" className=\"h-full w-full object-contain p-1\"/></div><div className=\"min-w-0\"><div className=\"truncate text-sm font-black tracking-tight\">{brandName}</div><div className=\"hidden text-[9px] font-bold uppercase tracking-[.17em] text-white/30 sm:block\">Owner grading operations</div></div><div className=\"ml-auto flex items-center gap-3\"><span className=\"hidden text-xs font-semibold text-white/32 md:inline\">{openSubs.length} active batches</span><button onClick={()=>setShowNew(true)} className=\"inline-flex h-9 items-center gap-2 bg-[#d8bb78] px-3.5 text-xs font-black text-black\"><Plus className=\"h-4 w-4\"/>New intake</button></div></div></header>:null}\n<aside className=\"fixed bottom-0 left-0 top-16 z-40 hidden w-[230px] border-r border-white/[0.07] bg-black/58 px-4 py-5 backdrop-blur-xl lg:flex lg:flex-col\"><div className=\"px-2\"><div className=\"text-[9px] font-black uppercase tracking-[.20em] text-[#d0ae61]\">PCG Operations</div><div className=\"mt-2 text-sm leading-5 text-white/40\">Grading, vault, collectors and fulfillment.</div></div><nav className=\"mt-7 space-y-1\">{tabs.map(([id,label,Icon])=><button key={id} onClick={()=>setTab(id)} className={`flex h-11 w-full items-center gap-3 px-3 text-left text-sm font-bold transition ${tab===id?'bg-white/[0.07] text-white shadow-[inset_2px_0_0_#d8bb78]':'text-white/40 hover:bg-white/[0.035] hover:text-white/80'}`}><Icon className={`h-[17px] w-[17px] ${tab===id?'text-[#d8bb78]':'text-white/30'}`}/><span className=\"flex-1\">{label}</span>{id==='queue'&&openSubs.length?<span className=\"text-[10px] font-black text-[#d8bb78]\">{openSubs.length}</span>:null}</button>)}</nav><div className=\"mt-auto border-t border-white/[0.07] px-2 pt-4\"><div className=\"text-[9px] font-black uppercase tracking-[.17em] text-white/25\">Prestigious Card Grading</div><div className=\"mt-2 text-xs leading-5 text-white/36\">14170 US Highway 1<br/>Sebastian, FL 32958</div></div></aside>\n<main className={`relative z-10 min-h-screen px-4 pb-24 sm:px-6 lg:ml-[230px] lg:px-8 lg:pb-10 xl:px-10 ${embedded?'pt-4 sm:pt-6':'pt-20'}`}>{loading?<div className=\"grid min-h-[70vh] place-items-center\"><div className=\"text-center\"><img src={PCG_LOGO} alt=\"PCG\" className=\"mx-auto h-16 w-16 object-contain opacity-70\"/><div className=\"mt-4 text-[10px] font-black uppercase tracking-[.22em] text-[#d0ae61]\">Opening PCG operations…</div></div></div>:<>\n{tab==='today'?<><section className=\"border-b border-white/[0.08] pb-7 pt-3\"><div className=\"flex flex-col gap-7 xl:flex-row xl:items-end xl:justify-between\"><div className=\"max-w-3xl\"><div className=\"text-[10px] font-black uppercase tracking-[.22em] text-[#d0ae61]\">Anthony's owner workspace</div><h1 className=\"mt-3 text-[42px] font-black leading-[.94] tracking-[-.055em] sm:text-[62px]\">PCG Operations</h1><p className=\"mt-4 max-w-2xl text-sm leading-6 text-white/42\">Move grading work, ingest collections, certify finished cards and keep fulfillment honest from one operating surface.</p></div><div className=\"grid w-full max-w-xl grid-cols-2 gap-px border border-white/[0.08] bg-white/[0.08] sm:grid-cols-3\"><button onClick={()=>setShowNew(true)} className=\"bg-[#09090a]/94 p-4 text-left\"><Plus className=\"h-5 w-5 text-[#d8bb78]\"/><div className=\"mt-5 text-sm font-black\">New submission</div><div className=\"mt-1 text-[11px] text-white/30\">Receive grading work</div></button><button onClick={()=>setTab('vault')} className=\"bg-[#09090a]/94 p-4 text-left\"><UploadCloud className=\"h-5 w-5 text-[#d8bb78]\"/><div className=\"mt-5 text-sm font-black\">Card Vault</div><div className=\"mt-1 text-[11px] text-white/30\">Single + mass upload</div></button><button onClick={()=>setTab('queue')} className=\"col-span-2 bg-[#09090a]/94 p-4 text-left sm:col-span-1\"><Award className=\"h-5 w-5 text-[#d8bb78]\"/><div className=\"mt-5 text-sm font-black\">Grading Floor</div><div className=\"mt-1 text-[11px] text-white/30\">Work the live queue</div></button></div></div><div className=\"mt-8 grid sm:grid-cols-2 xl:grid-cols-4\">{metric('Batches on floor',openSubs.length,'Active submissions')}{metric('Cards in house',cards.filter(card=>!terminalStatuses.has(card.status)).length,'Individual cards')}{metric('SLA attention',overdue+dueSoon,overdue?`${overdue} overdue · ${dueSoon} due soon`:`${dueSoon} due within 48 hours`)}{metric('Recorded work',`$${serviceValue.toFixed(0)}`,stripeSyncConnected?'Stripe sync connected':'Stripe sync not connected')}</div></section><div className=\"mt-8 grid gap-8 xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,.8fr)]\"><section><div className=\"mb-3 flex items-end justify-between\"><div><div className=\"text-[9px] font-black uppercase tracking-[.19em] text-[#d0ae61]\">Priority work</div><h2 className=\"mt-1 text-2xl font-black\">Next on the grading bench</h2></div><button onClick={()=>setTab('queue')} className=\"text-xs font-black text-[#d8bb78]\">Full floor →</button></div><div className=\"border-y border-white/[0.08]\">{prioritySubs.length?prioritySubs.map(row):empty('The bench is clear','No grading batches need attention right now.',()=>setShowNew(true),'Start intake')}</div></section><section className=\"border-l border-white/[0.08] xl:pl-7\"><div className=\"text-[9px] font-black uppercase tracking-[.19em] text-[#d0ae61]\">Stage pressure</div><h2 className=\"mt-1 text-2xl font-black\">Where the cards are</h2><div className=\"mt-5 divide-y divide-white/[0.07]\">{statuses.map((status,index)=><button key={status} onClick={()=>{setStatusFilter(status);setTab('queue')}} className=\"grid w-full grid-cols-[28px_1fr_auto] items-center gap-3 py-3 text-left\"><span className=\"text-[9px] font-black text-white/18\">{String(index+1).padStart(2,'0')}</span><span className=\"text-xs font-bold text-white/48\">{pretty(status)}</span><span className=\"text-base font-black\">{counts[status]||0}</span></button>)}</div></section></div></>:null}\n{tab==='vault'?<PCGCardVaultContent initialMode={initialVaultMode}/>:null}{tab==='queue'?renderList('Grading Floor','Live PCG pipeline',filteredSubs.filter(item=>!terminalStatuses.has(item.status))):null}{tab==='submissions'?renderList('Intake Ledger','Every submission',filteredSubs):null}{tab==='shipping'?renderList('Fulfillment','Ready · shipped · pickup',filteredSubs.filter(item=>['ready','shipped','picked_up'].includes(item.status)||Boolean(item.tracking_in)||Boolean(item.tracking_out))):null}\n{tab==='certs'?<section><div className=\"border-b border-white/[0.08] pb-5\"><div className=\"text-[10px] font-black uppercase tracking-[.20em] text-[#d0ae61]\">Authentication · certification</div><h1 className=\"mt-2 text-4xl font-black sm:text-5xl\">Cert Vault</h1></div><div className=\"relative mt-5 max-w-2xl\"><Search className=\"absolute left-4 top-3.5 h-4 w-4 text-white/28\"/><input value={certQuery} onChange={event=>setCertQuery(event.target.value)} placeholder=\"Search the PCG cert vault\" className={`${inputClass} pl-11`}/></div>{filteredCards.length?<div className=\"mt-6 grid grid-cols-2 gap-px overflow-hidden border border-white/[0.07] bg-white/[0.07] sm:grid-cols-3 xl:grid-cols-4\">{filteredCards.map(card=>{const image=card.slab_image_url||card.front_image_url||PCG_CARD_IMAGE;return <button key={card.id} onClick={()=>{const sub=subs.find(item=>item.id===card.submission_id);if(sub)openSubmission(sub)}} className=\"bg-[#09090a]/96 p-3 text-left\"><div className=\"relative aspect-[3/4] overflow-hidden bg-black\"><img src={image} alt=\"Graded card\" className=\"h-full w-full object-cover opacity-82\"/>{card.grade!=null?<div className=\"absolute right-2 top-2 bg-black/80 px-2 py-1 text-xs font-black text-[#e8cc8d]\">{card.grade}</div>:null}</div><div className=\"pt-3\"><div className=\"text-sm font-black leading-tight\">{[card.year,card.brand_set,card.player_character,card.card_description||card.variation,card.card_number?`#${card.card_number}`:null].filter(Boolean).join(' · ')||`Card #${card.sequence_number}`}</div><div className=\"mt-1 text-[10px] text-white/30\">{card.cert_number||'Cert pending'}</div></div></button>})}</div>:<div className=\"mt-6\">{empty('The vault is empty','Cert records appear here as grading records are completed.')}</div>}</section>:null}\n{tab==='collectors'?<section><div className=\"border-b border-white/[0.08] pb-5\"><div className=\"text-[10px] font-black uppercase tracking-[.20em] text-[#d0ae61]\">Collectors</div><h1 className=\"mt-2 text-4xl font-black sm:text-5xl\">Collector Book</h1></div>{subs.some(item=>item.customer_name)?<div className=\"mt-6 border-y border-white/[0.08]\">{Array.from(new Map(subs.filter(item=>item.customer_name).map(item=>[item.customer_name,item])).values()).map(sub=>{const related=subs.filter(item=>item.customer_name===sub.customer_name);const relatedCards=cards.filter(card=>related.some(item=>item.id===card.submission_id));return <button key={sub.customer_name!} onClick={()=>openSubmission(related[0])} className=\"grid w-full grid-cols-[1fr_auto_auto] items-center gap-4 border-b border-white/[0.07] px-1 py-4 text-left\"><div><div className=\"font-black\">{sub.customer_name}</div><div className=\"mt-1 text-xs text-white/32\">{sub.customer_email||sub.customer_phone||'Contact info not captured'}</div></div><div className=\"text-right\"><div className=\"text-lg font-black\">{related.length}</div><div className=\"text-[9px] text-white/25\">SUBMISSIONS</div></div><div className=\"text-right\"><div className=\"text-lg font-black text-[#d8bb78]\">{relatedCards.length}</div><div className=\"text-[9px] text-white/25\">CARDS</div></div></button>})}</div>:empty('No collectors yet','Collectors appear automatically when a grading submission is received.',()=>setShowNew(true),'Start first intake')}</section>:null}\n{tab==='inventory'?<section><div className=\"border-b border-white/[0.08] pb-5\"><div className=\"text-[10px] font-black uppercase tracking-[.20em] text-[#d0ae61]\">Retail floor</div><h1 className=\"mt-2 text-4xl font-black sm:text-5xl\">Card Shop</h1></div><div className=\"relative mt-6 min-h-[420px] overflow-hidden border border-white/[0.08] bg-[#09090a]\"><img src={PCG_STORE_IMAGE} alt=\"PCG card shop\" className=\"absolute inset-0 h-full w-full object-cover opacity-24\"/><div className=\"absolute inset-0 bg-[linear-gradient(90deg,#070708_0%,rgba(7,7,8,.95)_48%,rgba(7,7,8,.50)_100%)]\"/><div className=\"relative max-w-2xl p-7 sm:p-10\"><div className=\"text-[10px] font-black uppercase tracking-[.20em] text-[#d0ae61]\">Sebastian storefront</div><h2 className=\"mt-3 text-3xl font-black sm:text-5xl\">Sports. Pokémon. Graded cards.</h2><p className=\"mt-4 text-sm leading-6 text-white/42\">Marketplace inventory sync is not connected, so KnockLaunch will not invent stock or balances.</p><div className=\"mt-6 flex gap-2\"><a href=\"https://www.whatnot.com/user/theslabguys\" target=\"_blank\" rel=\"noreferrer\" className=\"inline-flex items-center gap-2 bg-white px-5 py-3 text-sm font-black text-black\">Whatnot <ExternalLink className=\"h-4 w-4\"/></a><a href=\"https://www.ebay.com/sch/i.html?_ssn=theslabguys\" target=\"_blank\" rel=\"noreferrer\" className=\"inline-flex items-center gap-2 border border-white/10 bg-black/45 px-5 py-3 text-sm font-black\">eBay <ExternalLink className=\"h-4 w-4\"/></a></div></div></div></section>:null}\n{tab==='settings'?<TenantSettingsPage/>:null}\n{tab==='money'?<section><div className=\"border-b border-white/[0.08] pb-5\"><div className=\"text-[10px] font-black uppercase tracking-[.20em] text-[#d0ae61]\">Payments</div><h1 className=\"mt-2 text-4xl font-black sm:text-5xl\">Stripe Desk</h1></div><div className=\"mt-6 grid gap-8 xl:grid-cols-[1.15fr_.85fr]\"><section><div className=\"flex items-center justify-between border-b border-white/[0.08] pb-4\"><div className=\"flex items-center gap-3\"><CreditCard className=\"h-5 w-5 text-[#635bff]\"/><div><div className=\"text-sm font-black\">Stripe hosted checkout</div><div className=\"text-xs text-white/30\">PCG grading payments</div></div></div><span className={stripeSyncConnected?'text-xs font-black text-emerald-300':'text-xs font-black text-amber-200'}>{stripeSyncConnected?'Data sync connected':'Data sync not connected'}</span></div><div className=\"mt-8 text-[10px] font-black uppercase tracking-[.18em] text-white/30\">Recorded grading service value</div><div className=\"mt-2 text-5xl font-black sm:text-6xl\">${serviceValue.toFixed(2)}</div><p className=\"mt-3 text-sm leading-6 text-white/38\">This is grading work recorded in KnockLaunch, not a claimed Stripe balance unless sync is authenticated.</p><button onClick={openStripe} className=\"mt-7 inline-flex items-center gap-2 bg-white px-5 py-3 text-sm font-black text-black\">Open PCG Stripe checkout <ExternalLink className=\"h-4 w-4\"/></button></section><section className=\"border-l border-white/[0.08] xl:pl-7\"><div className=\"text-[10px] font-black uppercase tracking-[.18em] text-[#d0ae61]\">Grading menu</div><div className=\"mt-5 divide-y divide-white/[0.07]\">{Object.entries(tiers).map(([id,tier])=><div key={id} className=\"flex items-center justify-between py-4\"><div><div className=\"font-black\">{tier.label}</div><div className=\"text-xs text-white/28\">Per card · no up-charges</div></div><div className=\"text-2xl font-black text-[#d8bb78]\">${tier.price}</div></div>)}</div></section></div></section>:null}</>}</main>\n<nav className=\"fixed inset-x-3 bottom-3 z-50 grid grid-cols-5 border border-white/[0.09] bg-[#09090a]/95 p-1.5 shadow-2xl backdrop-blur-xl lg:hidden\">{mobilePrimary.map(([id,label,Icon])=><button key={id} onClick={()=>{setTab(id);setShowMore(false)}} className={`flex flex-col items-center gap-1 px-1 py-2 text-[9px] font-black ${tab===id?'bg-white/[0.07] text-white':'text-white/38'}`}><Icon className={`h-[18px] w-[18px] ${tab===id?'text-[#d8bb78]':'text-white/28'}`}/><span>{label}</span></button>)}<button onClick={()=>setShowMore(true)} className=\"flex flex-col items-center gap-1 px-1 py-2 text-[9px] font-black text-white/38\"><Menu className=\"h-[18px] w-[18px] text-white/28\"/>More</button></nav>\n{showMore?<div className=\"fixed inset-0 z-[70] bg-black/74 lg:hidden\" onMouseDown={event=>{if(event.currentTarget===event.target)setShowMore(false)}}><div className=\"absolute inset-x-0 bottom-0 border-t border-white/[0.10] bg-[#0b0b0c] p-4\"><div className=\"mb-4 text-[9px] font-black uppercase tracking-[.18em] text-[#d0ae61]\">More PCG tools</div><div className=\"grid grid-cols-2 gap-px border border-white/[0.08] bg-white/[0.08]\">{tabs.filter(([id])=>!mobilePrimary.some(([primary])=>primary===id)).map(([id,label,Icon])=><button key={id} onClick={()=>{setTab(id);setShowMore(false)}} className=\"flex items-center gap-3 bg-[#09090a] px-4 py-3 text-sm font-bold\"><Icon className=\"h-4 w-4 text-[#d8bb78]\"/>{label}</button>)}</div><button onClick={()=>setShowMore(false)} className=\"mt-3 w-full border border-white/[0.08] py-3 text-sm font-bold text-white/45\">Close</button></div></div>:null}\n{showNew?<div className=\"fixed inset-0 z-[80] grid place-items-center overflow-y-auto bg-black/82 p-4 backdrop-blur-md\" onMouseDown={event=>{if(event.currentTarget===event.target)setShowNew(false)}}><div className=\"w-full max-w-2xl border border-white/[0.10] bg-[#09090a]\"><div className=\"flex items-center justify-between border-b border-white/[0.08] p-5\"><div><div className=\"text-[9px] font-black uppercase tracking-[.18em] text-[#d0ae61]\">Grading intake</div><h2 className=\"mt-1 text-2xl font-black\">Receive cards into PCG</h2></div><button onClick={()=>setShowNew(false)} className=\"border border-white/10 p-2 text-white/35\"><X className=\"h-5 w-5\"/></button></div><div className=\"p-5\"><div className=\"grid gap-3 sm:grid-cols-2\"><input value={form.name} onChange={event=>setForm({...form,name:event.target.value})} placeholder=\"Collector name\" className={inputClass}/><input value={form.email} onChange={event=>setForm({...form,email:event.target.value})} placeholder=\"Email\" className={inputClass}/><input value={form.phone} onChange={event=>setForm({...form,phone:event.target.value})} placeholder=\"Phone\" className={inputClass}/><input value={form.cardCount} onChange={event=>setForm({...form,cardCount:event.target.value})} type=\"number\" min=\"1\" max=\"100000\" placeholder=\"Expected card count\" className={inputClass}/><select value={form.tier} onChange={event=>setForm({...form,tier:event.target.value})} className={inputClass}>{Object.entries(tiers).map(([id,tier])=><option key={id} value={id}>{tier.label} · ${tier.price}/card</option>)}</select><select value={form.delivery} onChange={event=>setForm({...form,delivery:event.target.value})} className={inputClass}><option value=\"walk_in\">Walk-in</option><option value=\"mail_in\">Mail-in</option><option value=\"ship_back\">Ship back</option><option value=\"pickup\">Pickup</option></select><textarea value={form.notes} onChange={event=>setForm({...form,notes:event.target.value})} placeholder=\"Submission notes\" className={`${inputClass} min-h-24 sm:col-span-2`}/></div><div className=\"mt-4 flex items-end justify-between border-t border-white/[0.08] pt-4\"><div><div className=\"text-[9px] font-black uppercase tracking-[.15em] text-[#d0ae61]\">Expected grading total</div><div className=\"mt-1 text-3xl font-black\">${expectedTotal.toFixed(2)}</div></div><div className=\"text-right text-xs text-white/30\">{selectedCardCount} card{selectedCardCount===1?'':'s'} × ${selectedTier.price}</div></div><div className=\"mt-5 grid gap-2 sm:grid-cols-2\"><button onClick={openStripe} className=\"inline-flex items-center justify-center gap-2 border border-white/10 px-4 py-3 font-black\"><CreditCard className=\"h-4 w-4\"/>Collect in Stripe</button><button disabled={busy} onClick={()=>void createSubmission()} className=\"bg-[#d8bb78] px-4 py-3 font-black text-black disabled:opacity-50\">{busy?'Creating…':'Create submission'}</button></div><p className=\"mt-3 text-center text-xs text-white/28\">Creating the submission never marks it paid.</p></div></div></div>:null}\n{selected?<div className=\"fixed inset-0 z-[80] bg-black/72\" onMouseDown={event=>{if(event.currentTarget===event.target)setSelectedId(null)}}><aside className=\"absolute inset-y-0 right-0 w-full max-w-3xl overflow-y-auto border-l border-white/10 bg-[#09090a] p-4 pb-24 sm:p-6\"><div className=\"flex items-start justify-between gap-4 border-b border-white/[0.08] pb-4\"><div><div className=\"text-[9px] font-black uppercase tracking-[.17em] text-[#d0ae61]\">Submission workbench</div><h2 className=\"mt-1 text-2xl font-black\">{selected.submission_number}</h2><div className=\"mt-1 text-sm text-white/34\">{selected.customer_name||'Collector not named'} · {selectedCards.length.toLocaleString()} ingested / {orderCardCount(selected).toLocaleString()} expected · ${selectedTotal.toFixed(2)}</div></div><button onClick={()=>setSelectedId(null)} className=\"border border-white/10 p-2 text-white/35\"><X className=\"h-5 w-5\"/></button></div><section className={`${panelClass} mt-4 p-4`}><div className=\"text-[9px] font-black uppercase tracking-[.16em] text-[#d0ae61]\">Grading stage</div><div className=\"mt-4 flex flex-wrap gap-2\">{statuses.map(status=><div key={status} className={`border px-2.5 py-1 text-[9px] font-black ${selected.status===status?'border-[#d8bb78]/45 text-[#e8cc8d]':'border-white/10 text-white/28'}`}>{pretty(status)}</div>)}</div><div className=\"mt-4\">{(()=>{const index=statuses.indexOf(selected.status as any);const next=index>=0&&index<statuses.length-1?statuses[index+1]:null;const issue=next?transitionIssue(selected,next,selectedCards):'';return <>{terminalStatuses.has(selected.status)?<div className=\"mb-3 text-xs font-black text-emerald-300\"><Check className=\"mr-1 inline h-3.5 w-3.5\"/>Lifecycle complete</div>:next?<div className={'mb-3 text-xs leading-5 '+(issue?'text-amber-200':'text-emerald-300')}>{issue||<>Ready to advance to {pretty(next)}.</>}</div>:null}{next&&!terminalStatuses.has(selected.status)&&selected.status!=='ready'?<button disabled={busy||Boolean(issue)} onClick={()=>void advanceBatch(next)} className=\"inline-flex items-center gap-2 bg-[#d8bb78] px-4 py-2.5 text-sm font-black text-black\">Advance to {pretty(next)} <ChevronRight className=\"h-4 w-4\"/></button>:null}{selected.status==='ready'?<><button disabled={busy||Boolean(transitionIssue(selected,'shipped',selectedCards))} onClick={()=>void advanceBatch('shipped')} className=\"bg-[#d8bb78] px-4 py-2.5 text-sm font-black text-black disabled:cursor-not-allowed disabled:opacity-35\">Mark shipped</button><button disabled={busy} onClick={()=>void advanceBatch('picked_up')} className=\"ml-2 border border-white/10 px-4 py-2.5 text-sm font-black\">Mark picked up</button></>:null}</>})()}</div></section><section className={`${panelClass} mt-4 p-4`}><div className=\"flex items-center justify-between\"><div className=\"text-[9px] font-black uppercase tracking-[.16em] text-[#d0ae61]\">Collector & payment</div><BadgeDollarSign className=\"h-5 w-5 text-[#d8bb78]\"/></div><div className=\"mt-4 grid gap-3 sm:grid-cols-2\"><select value={detailDraft.payment_status} onChange={event=>setDetailDraft({...detailDraft,payment_status:event.target.value})} className={inputClass}><option value=\"unverified\">Payment not verified</option><option value=\"manually_verified\">Manually verified paid</option><option value=\"waived\">Waived</option><option value=\"refunded\">Refunded</option></select><input value={detailDraft.payment_reference} onChange={event=>setDetailDraft({...detailDraft,payment_reference:event.target.value})} placeholder=\"Reference / Stripe receipt ID\" className={inputClass}/></div><button onClick={openStripe} className=\"mt-3 inline-flex items-center gap-2 text-sm font-black text-[#d8bb78]\"><ExternalLink className=\"h-4 w-4\"/>Open PCG Stripe checkout</button></section><section className={`${panelClass} mt-4 p-4`}><div className=\"text-[9px] font-black uppercase tracking-[.16em] text-[#d0ae61]\">Shipping & notes</div><div className=\"mt-4 grid gap-3 sm:grid-cols-2\"><input value={detailDraft.tracking_in} onChange={event=>setDetailDraft({...detailDraft,tracking_in:event.target.value})} placeholder=\"Inbound tracking\" className={inputClass}/><input value={detailDraft.tracking_out} onChange={event=>setDetailDraft({...detailDraft,tracking_out:event.target.value})} placeholder=\"Outbound tracking\" className={inputClass}/><textarea value={detailDraft.notes} onChange={event=>setDetailDraft({...detailDraft,notes:event.target.value})} placeholder=\"Submission notes\" className={`${inputClass} min-h-24 sm:col-span-2`}/></div><button disabled={busy} onClick={()=>void saveSubmissionDetails()} className=\"mt-3 bg-white px-4 py-2.5 text-sm font-black text-black\">Save submission details</button></section><section className=\"mt-6\"><div className=\"border-b border-white/[0.08] pb-3\"><div className=\"text-[9px] font-black uppercase tracking-[.16em] text-[#d0ae61]\">Cards in batch</div><h3 className=\"mt-1 text-xl font-black\">Card workbench</h3></div>{selectedCards.map(card=>{const draft=cardDrafts[card.id]||cardToDraft(card);return <div key={card.id} className=\"border-b border-white/[0.07] py-5\"><div className=\"flex items-center justify-between\"><div><div className=\"text-sm font-black\">Card #{card.sequence_number}</div><div className=\"mt-1 text-xs text-white/28\">{draft.cert_number||'Cert not assigned'} · {pretty(card.status)}</div></div>{draft.cert_number&&draft.grade?<span className=\"inline-flex items-center gap-1 text-[10px] font-black text-emerald-300\"><Check className=\"h-3 w-3\"/>Graded</span>:null}</div><div className=\"mt-4 grid gap-2 sm:grid-cols-2\"><input value={draft.category} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,category:event.target.value}})} placeholder=\"Category\" className={inputClass}/><input value={draft.year} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,year:event.target.value}})} placeholder=\"Year\" className={inputClass}/><input value={draft.brand_set} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,brand_set:event.target.value}})} placeholder=\"Set Name\" className={inputClass}/><input value={draft.player_character} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,player_character:event.target.value}})} placeholder=\"Player Name(s)\" className={inputClass}/><input value={draft.card_number} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,card_number:event.target.value}})} placeholder=\"Card #\" className={inputClass}/><input value={draft.card_description} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,card_description:event.target.value}})} placeholder=\"Card Description\" className={inputClass}/><select value={draft.autograph_present} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,autograph_present:event.target.value as CardDraft['autograph_present']}})} className={inputClass}><option value=\"\">Auto Y/N</option><option value=\"yes\">Auto Yes</option><option value=\"no\">Auto No</option></select><input value={draft.declared_value} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,declared_value:event.target.value}})} type=\"number\" placeholder=\"Declared Value\" className={inputClass}/><input value={draft.cert_number} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,cert_number:event.target.value}})} placeholder=\"PCG#/CERT#\" className={inputClass}/><input value={draft.grade} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,grade:event.target.value}})} type=\"number\" min=\"0\" max=\"10\" step=\"0.5\" placeholder=\"Grade 0–10\" className={inputClass}/><input value={draft.grade_label} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,grade_label:event.target.value}})} placeholder=\"Grade label\" className={inputClass}/><textarea value={draft.grader_notes} onChange={event=>setCardDrafts({...cardDrafts,[card.id]:{...draft,grader_notes:event.target.value}})} placeholder=\"Grader notes\" className={`${inputClass} min-h-20 sm:col-span-2`}/></div><button disabled={busy} onClick={()=>void saveCard(card)} className=\"mt-3 bg-[#d8bb78] px-4 py-2.5 text-sm font-black text-black\">Save card</button></div>})}</section></aside></div>:null}</div>}\n","expectedSha":"24e35bdde654bac8f26b657117e35a00ee6cc856"}],"branch":"ai/objective-first-repair-002d4611fa84","writes":[],"patches":[],"version":1,"approved":true,"missionId":"002d4611-fa84-4e05-8e1f-3df593076b20","repository":"noel/KnockLaunchOS","commitMessage":"PCG: scale grading order creation","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/crm/PcgWorkspace.tsx"],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"002d4611-fa84-4e05-8e1f-3df593076b20","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/crm/PcgWorkspace.tsx"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"d0ea2842b2b8959a04b43e7348a92c3ee3b37ebe030a39b2e639ceb6a75836d0","replayCount":0,"serializedBytes":47344},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:49:48.767314+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:002d4611-fa84-4e05-8e1f-3df593076b20:repository-mutation-intent:d0ea2842b2b8959a04b43e7348a92c3ee3b37ebe030a39b2e639ceb6a75836d0:0","mission_step_id":"2cc3bd6c-75a3-477f-979e-b1efbe6b0c88","command_center_event_id":"002d4611-fa84-4e05-8e1f-3df593076b20"},{"id":"c5e76e66-6abc-481e-ba36-9085846ad1f9","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in release.","nextAction":{"lane":"production-release-conductor","action":"reconcile_release","reason":"merged_source_requires_release_proof","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"release\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"source_lineage_merged_pr_authoritative\",\"status\":\"waiting\",\"proofGate\":\"forgejo_merged_pr_is_authoritative_source_lineage\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_release\",\"lane\":\"production-release-conductor\",\"reason\":\"merged_source_requires_release_proof\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_release\",\"recoveryOwner\":\"production-release-conductor\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"runtime\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"release\",\"deadlineAt\":\"2026-09-29T04:46:30.562772+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-3859accb2d55\",\"prNumber\":4076,\"sourceSha\":\"07d9ebfbbf41bcd52a9be264a5ead540627ce676\",\"deploymentId\":\"forgejo-main-07d9ebfbbf41\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:49:52.690632+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:3859accb-2d55-4af2-a54b-4c8c70c7e274:owner-progress-heartbeat:119376439","mission_step_id":"a2bf3f45-018c-47a3-bbdf-74888f3942d1","command_center_event_id":"3859accb-2d55-4af2-a54b-4c8c70c7e274"},{"id":"7e652cc8-a7e6-41d1-9690-4418f8eb9f02","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","supabase-migrations/live":"success"},"mainSha":"9d27ca370f1d02085d8f4d1239b8fe3fa138eb58","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","supabase-migrations/live"],"sourceSha":"9d27ca370f1d02085d8f4d1239b8fe3fa138eb58","releaseState":"verified","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":false,"onrunner":false,"migrations":true,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"migrations":"success"},"requestContractHash":"95bddba768d5a6c8af8110f7d8c830c395785e8f6bf5e6d81fffb43a21dd7e98","forgejoWorkflowProof":{"runId":12832,"source":"signed_push_receipt","status":"success","results":{},"conclusion":"success","targetStates":{"migrations":"success"},"targetJobCount":6,"observedTargetStates":{"migrations":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:47:47.372549+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"9d27ca370f1d02085d8f4d1239b8fe3fa138eb58","external_id":"forgejo-main-9d27ca370f1d","receipt_type":"canonical_release_status","idempotency_key":"mission:b9c5e425-5e8e-48ce-9da0-580281621123:forgejo-release-status:9d27ca370f1d02085d8f4d1239b8fe3fa138eb58:verified:forgejo-main/source=success|forgejo-release/workflow=success|supabase-migrations/live=success","mission_step_id":"f465b07b-11ed-446b-9a22-a43fc8df26bc","command_center_event_id":"b9c5e425-5e8e-48ce-9da0-580281621123"},{"id":"d3de0469-59dd-4b04-a742-d8d8f421ba6c","source":"cc-execution","status":"source_resolution_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":null,"reason":null,"status":"source_resolution_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.61.0-mission-freedom-provider-gateway","prNumber":null,"terminal":false,"missionId":"002d4611-fa84-4e05-8e1f-3df593076b20","operation":"execute_mission","proofGate":"repair_mission_source_resolution_required","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1218,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":364,"providerAuthMs":0,"ledgerPrepareMs":364,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":364,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":364,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Supply exact sourceTargets on the same mission; planner guesses cannot replace missing mission scope.","receiptRef":{"mode":"full","missionId":"002d4611-fa84-4e05-8e1f-3df593076b20"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1177,"likelyAffectedFiles":[],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:49:24.119786+00:00","proof_gate":"repair_mission_source_resolution_required","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:002d4611-fa84-4e05-8e1f-3df593076b20:execute_mission:repair_mission_source_resolution_required:current-generation","mission_step_id":"ea94e8a4-b648-4a8a-bde5-a3a7d127c925","command_center_event_id":"002d4611-fa84-4e05-8e1f-3df593076b20"},{"id":"494a7b0a-c5c4-4c98-bf41-1c7d39b96be9","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-3859accb2d55","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":29011,"releaseCount":0,"toolCallCount":10,"repeatedCallCount":5,"executorlessWaitMs":147105,"firstUsefulResultAt":"2026-09-29T01:46:32.425Z","recoveryAttemptCount":6,"ownerInterruptionCount":0},"version":null,"prNumber":4076,"terminal":false,"missionId":"3859accb-2d55-4af2-a54b-4c8c70c7e274","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"07d9ebfbbf41bcd52a9be264a5ead540627ce676","timingsMs":{"prReadinessMs":10504,"approvedPlanMs":0,"shipAndProveMs":2662,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"3859accb-2d55-4af2-a54b-4c8c70c7e274"},"performance":null,"deploymentId":"forgejo-main-07d9ebfbbf41","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":false,"onrunner":false,"migrations":false,"ccExecution":true,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1987,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:49:26.287684+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4076","receipt_type":"automatic_mission_resume","idempotency_key":"mission:3859accb-2d55-4af2-a54b-4c8c70c7e274:automatic-mission-resume:4076:canonical_release_reconciliation_pending","mission_step_id":"a2bf3f45-018c-47a3-bbdf-74888f3942d1","command_center_event_id":"3859accb-2d55-4af2-a54b-4c8c70c7e274"},{"id":"978682c0-3f4f-4a7c-9c2b-8204003deb17","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-002d4611fa84","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":1695,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T01:49:24.092Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.61.0-mission-freedom-provider-gateway","prNumber":null,"terminal":false,"missionId":"002d4611-fa84-4e05-8e1f-3df593076b20","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1244,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":226,"providerAuthMs":0,"ledgerPrepareMs":226,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":226,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":226,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"002d4611-fa84-4e05-8e1f-3df593076b20"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3310,"likelyAffectedFiles":["src/pages/crm/PcgWorkspace.tsx"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:49:29.565726+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:002d4611-fa84-4e05-8e1f-3df593076b20:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"ea94e8a4-b648-4a8a-bde5-a3a7d127c925","command_center_event_id":"002d4611-fa84-4e05-8e1f-3df593076b20"},{"id":"57c380e4-5087-4597-b010-ed6935bca97a","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-3859accb2d55","prNumber":4076,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"07d9ebfbbf41bcd52a9be264a5ead540627ce676","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:49:35.067696+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"07d9ebfbbf41bcd52a9be264a5ead540627ce676","external_id":"4076","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:3859accb-2d55-4af2-a54b-4c8c70c7e274:merged-pr:4076:07d9ebfbbf41bcd52a9be264a5ead540627ce676","mission_step_id":"8e7b44bd-0f3a-4abb-b3fb-f2e99beb6a00","command_center_event_id":"3859accb-2d55-4af2-a54b-4c8c70c7e274"},{"id":"294fd693-bd87-4695-b550-e763323369b1","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[{"path":"src/pages/owner/KnockLaunchPortfolio.tsx","content":"import React from 'react';\nimport { Link, Navigate, useLocation, useNavigate } from 'react-router-dom';\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport {\n  AlertTriangle,\n  ArrowLeft,\n  CheckCircle2,\n  CircleDollarSign,\n  ExternalLink,\n  Gauge,\n  Link2,\n  RefreshCw,\n  Route,\n  Search,\n  Users,\n  WalletCards,\n} from 'lucide-react';\nimport { Badge } from '@/components/ui/badge';\nimport { Button } from '@/components/ui/button';\nimport { Input } from '@/components/ui/input';\nimport { useMultiTenant, type Tenant } from '@/contexts/MultiTenantContext';\nimport { getTenantDashboardPathForTenant } from '@/lib/tenantUtils';\nimport { canonicalTenantRouteSlugForIdentity } from '@/routes/verticalRouteRegistry';\nimport {\n  buildTenantApplicationWorkspacePath,\n  getApplicationBySlug,\n  getTenantApplicationScopeFromSettings,\n} from '@/config/applicationCapabilityRegistry';\nimport {\n  EMPTY_PORTFOLIO_DATA,\n  PORTFOLIO_SALES_STAGES,\n  PORTFOLIO_STAGE_LABELS,\n  loadKnockLaunchPortfolioData,\n  relationshipStage,\n  savePortfolioRelationship,\n  savePortfolioOnboardingReadiness,\n  type PortfolioData,\n  type PortfolioOnboardingItemState,\n  type PortfolioOnboardingStatus,\n  type PortfolioRelationship,\n  type PortfolioSalesStage,\n} from '@/lib/owner/knockLaunchPortfolioData';\nimport {\n  OwnerMetric,\n  OwnerSectionTitle,\n  OwnerWorkspaceShell,\n  formatOwnerDateTime,\n  formatOwnerMoney,\n  ownerTenantLabel,\n} from './KnockLaunchOSShared';\n\ntype PortfolioSection = 'command' | 'portfolio' | 'readiness' | 'revenue';\ntype MatrixState = 'good' | 'attention' | 'missing' | 'unknown';\ntype OnboardingItemSpec = { id: string; label: string; detail: string; systemKey?: string };\ntype OnboardingGroupSpec = { id: string; label: string; description: string; items: OnboardingItemSpec[] };\n\nconst ONBOARDING_STATUS_LABELS: Record<PortfolioOnboardingStatus,string> = {\n  not_started: 'Not started',\n  in_progress: 'In progress',\n  waiting_on_client: 'Waiting on client',\n  blocked: 'Blocked',\n  done: 'Done',\n  not_applicable: 'N/A',\n};\n\nconst ONBOARDING_GROUPS: OnboardingGroupSpec[] = [\n  { id:'commercial', label:'Commercial & authority', description:'Know exactly who can approve the work, what success means, and what is being sold.', items:[\n    {id:'decision_maker_confirmed',label:'Decision maker / owner authority confirmed',detail:'Identify the person who can approve scope, access, billing, and launch.'},\n    {id:'business_workflows_captured',label:'Current workflows captured',detail:'Document how the business actually operates today, including pain points and workarounds.'},\n    {id:'scope_success_criteria',label:'Scope & success criteria agreed',detail:'Define what KNOCKLAUNCH must replace, improve, or automate.'},\n    {id:'pricing_terms_confirmed',label:'Pricing & billing terms confirmed',detail:'Retainer, project price, revenue share, cadence, or other commercial terms are explicit.'},\n    {id:'proposal_contract_accepted',label:'Proposal / agreement accepted',detail:'Commercial approval is recorded before production cutover.'},\n  ]},\n  { id:'access', label:'Access & source systems', description:'Collect the keys before migration day so access does not become the launch blocker.', items:[\n    {id:'primary_admin_access',label:'Primary business admin access',detail:'Owner/admin access to the systems that currently run the business.'},\n    {id:'website_cms_access',label:'Website / CMS access',detail:'Squarespace, WordPress, Shopify, Wix, or other current website access.'},\n    {id:'domain_dns_access',label:'Domain registrar / DNS access',detail:'Ability to inspect and later change DNS without guessing.'},\n    {id:'payment_processor_access',label:'Payment processor access',detail:'Stripe, Square, PayPal, or other processor access for migration and testing.'},\n    {id:'email_workspace_access',label:'Email / Workspace access',detail:'Google Workspace, Zoho, Microsoft 365, or other business-mail authority.'},\n    {id:'accounting_access',label:'Accounting access',detail:'QuickBooks or other accounting source when in scope; mark N/A when it is not required.'},\n    {id:'legacy_exports_collected',label:'Legacy exports collected',detail:'CSV, XLSX, XML, database exports, customer lists, orders, catalog/card data, and other source files.'},\n  ]},\n  { id:'migration', label:'Data migration', description:'Make migration repeatable, reconcilable, and safe to rerun before any destructive cutover.', items:[\n    {id:'source_inventory_complete',label:'Source-data inventory complete',detail:'Every source system and dataset is accounted for.'},\n    {id:'field_mapping_complete',label:'Field mapping approved',detail:'Legacy fields map cleanly into canonical KNOCKLAUNCH records.'},\n    {id:'migration_dry_run',label:'Dry-run import completed',detail:'Stage and analyze the import without changing canonical production records.'},\n    {id:'duplicate_review',label:'Duplicates / exceptions reviewed',detail:'Resolve duplicate identities, missing fields, and manual-review rows.'},\n    {id:'media_migration',label:'Media migration completed',detail:'Move master images/files to the tenant-owned storage plan when required.'},\n    {id:'final_data_import',label:'Final canonical import completed',detail:'Commit validated records only after the dry run is clean.'},\n    {id:'reconciliation_complete',label:'Source-to-KNOCKLAUNCH reconciliation complete',detail:'Counts, identifiers, money, statuses, and sample records agree with the legacy source.'},\n  ]},\n  { id:'workspace', label:'KNOCKLAUNCH workspace', description:'Core tenant shell and operating applications should be usable before launch.', items:[\n    {id:'workspace_created',label:'Tenant workspace created',detail:'Canonical tenant exists and is authorized.',systemKey:'workspace_created'},\n    {id:'branding_ready',label:'Branding & identity ready',detail:'Logo/brand identity is present and usable.',systemKey:'branding_ready'},\n    {id:'routes_ready',label:'Canonical routes verified',detail:'Tenant routes resolve to the intended app family.',systemKey:'routes_ready'},\n    {id:'apps_ready',label:'Required applications configured',detail:'The tenant has its intended KNOCKLAUNCH application set.',systemKey:'apps_ready'},\n    {id:'email_connected',label:'Business email connected',detail:'Mail provider is connected and ready for operational messages.',systemKey:'email_connected'},\n    {id:'calendar_connected',label:'Calendar connected',detail:'Calendar connection is ready when the business workflow requires it.',systemKey:'calendar_connected'},\n    {id:'payments_connected',label:'Payments connected',detail:'Payment provider is connected when the tenant needs payment capability.',systemKey:'payments_connected'},\n    {id:'proposals_ready',label:'Proposal / e-sign capability ready',detail:'Proposal profile or proposal workflow is production-ready when required.',systemKey:'proposals_ready'},\n  ]},\n  { id:'website', label:'Website & domain cutover', description:'Never use DNS as the first test. Prove the replacement in parallel, then cut over with rollback.', items:[\n    {id:'current_site_identified',label:'Current website source identified',detail:'The current public website and owner system are known.',systemKey:'current_site_identified'},\n    {id:'dns_inventory_captured',label:'DNS inventory captured',detail:'A/CNAME/MX/TXT/verification/nameserver records are documented before changes.'},\n    {id:'new_site_approved',label:'New KNOCKLAUNCH site approved',detail:'The replacement public site is content-complete and owner-approved.'},\n    {id:'cloudflare_zone_ready',label:'Cloudflare zone / route ready',detail:'The custom domain is prepared for KNOCKLAUNCH production routing.'},\n    {id:'redirects_mapped',label:'Legacy redirects mapped',detail:'Important old URLs, search links, and public record pages keep working after cutover.'},\n    {id:'parallel_validation',label:'Parallel-run validation completed',detail:'New site is proven while the old site still remains available.'},\n    {id:'domain_cutover',label:'Domain cutover completed',detail:'Web traffic points to KNOCKLAUNCH only after the replacement is proven.'},\n    {id:'email_dns_verified',label:'Email DNS preserved & verified',detail:'MX/TXT/DKIM/SPF/verification records still work after DNS authority changes.'},\n    {id:'ssl_live_verified',label:'SSL + public host verified',detail:'Apex and www resolve securely to the intended production site.'},\n  ]},\n  { id:'customer', label:'Customer experience', description:'Make sure the client and their customers can actually use what was built.', items:[\n    {id:'wmp_ready',label:'WhatsMyProgress ready or intentionally N/A',detail:'Customer progress portal has a real route when the business needs it.',systemKey:'wmp_ready'},\n    {id:'bmd_ready',label:'BookMeDirectly ready or intentionally N/A',detail:'Booking flow has a real route when the business needs it.',systemKey:'bmd_ready'},\n    {id:'client_users_invited',label:'Client users invited',detail:'Owner/staff accounts exist with the correct permissions.'},\n    {id:'quick_tour_ready',label:'Quick Tour / onboarding guidance ready',detail:'The owner can understand the intended workflow without Noel standing beside them.'},\n  ]},\n  { id:'launch', label:'Launch & handoff', description:'Prove the boring but critical things before declaring a tenant live.', items:[\n    {id:'desktop_mobile_qa',label:'Desktop + mobile QA completed',detail:'Core routes, navigation, forms, and long-list behavior are usable on both.'},\n    {id:'payment_test',label:'Payment test completed',detail:'A safe test proves the intended payment path when payments are in scope.'},\n    {id:'email_test',label:'Email / notification test completed',detail:'Critical messages reach the intended mailbox and fail clearly when prerequisites are missing.'},\n    {id:'rollback_plan',label:'Rollback / fallback plan recorded',detail:'Know how to reverse domain, data, or provider changes if launch fails.'},\n    {id:'owner_signoff',label:'Business owner signoff',detail:'The client agrees the replacement is ready to become operational.'},\n    {id:'post_launch_monitoring',label:'Post-launch monitoring window complete',detail:'Watch the tenant after cutover and close remaining regressions before calling onboarding complete.'},\n  ]},\n];\n\nconst ONBOARDING_STATUS_SET = new Set<PortfolioOnboardingStatus>(Object.keys(ONBOARDING_STATUS_LABELS) as PortfolioOnboardingStatus[]);\nconst onboardingMatrixDefault = (state: MatrixState): PortfolioOnboardingStatus => state === 'good' ? 'done' : state === 'attention' ? 'in_progress' : 'not_started';\n\nfunction summarizeOnboarding(items: Record<string,PortfolioOnboardingItemState>) {\n  const values = Object.values(items);\n  const applicable = values.filter((item) => item.status !== 'not_applicable');\n  const done = applicable.filter((item) => item.status === 'done').length;\n  const blocked = applicable.filter((item) => item.status === 'blocked').length;\n  const waiting = applicable.filter((item) => item.status === 'waiting_on_client').length;\n  const inProgress = applicable.filter((item) => item.status === 'in_progress').length;\n  const remaining = Math.max(0, applicable.length - done);\n  return {\n    total: applicable.length,\n    done,\n    blocked,\n    waiting,\n    inProgress,\n    remaining,\n    progress: applicable.length ? Math.round(done / applicable.length * 100) : 100,\n  };\n}\n\nfunction onboardingTone(status: PortfolioOnboardingStatus) {\n  if (status === 'done') return 'border-emerald-300/20 bg-emerald-300/[0.07] text-emerald-100';\n  if (status === 'blocked') return 'border-rose-300/20 bg-rose-300/[0.07] text-rose-100';\n  if (status === 'waiting_on_client') return 'border-amber-300/20 bg-amber-300/[0.07] text-amber-100';\n  if (status === 'in_progress') return 'border-sky-300/20 bg-sky-300/[0.07] text-sky-100';\n  return 'border-white/[0.08] bg-white/[0.025] text-white/40';\n}\n\nconst DAY = 86_400_000;\nconst object = (value: unknown): Record<string, any> => value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, any> : {};\nconst token = (value: unknown) => String(value || '').trim().toLowerCase().replace(/[\\s_]+/g, '-');\nconst number = (value: unknown) => {\n  const parsed = Number(value || 0);\n  return Number.isFinite(parsed) ? parsed : 0;\n};\nconst configuredUrl = (...values: unknown[]) => values.map((value) => String(value || '').trim()).find((value) => /^https?:\\/\\//i.test(value) || value.startsWith('/')) || '';\nconst toTime = (value: unknown) => {\n  const date = value ? new Date(String(value)) : null;\n  return date && !Number.isNaN(date.getTime()) ? date.getTime() : 0;\n};\nconst daysSince = (value: unknown) => {\n  const time = toTime(value);\n  return time ? Math.max(0, Math.floor((Date.now() - time) / DAY)) : null;\n};\nconst isPast = (value: unknown) => {\n  const time = toTime(value);\n  return Boolean(time && time < Date.now());\n};\nconst isPaidInvoice = (invoice: any) => Boolean(invoice?.paid_at) || ['paid', 'complete', 'completed', 'succeeded'].includes(token(invoice?.status));\nconst connectionHealthy = (status: unknown) => ['active', 'connected', 'configured', 'ready', 'verified', 'healthy', 'enabled'].includes(token(status));\nconst classNames = (...values: Array<string | false | null | undefined>) => values.filter(Boolean).join(' ');\n\nfunction maxDate(values: unknown[]) {\n  const time = Math.max(0, ...values.map(toTime));\n  return time ? new Date(time).toISOString() : null;\n}\n\nfunction publicSurfaces(tenant: Tenant) {\n  const settings = object(tenant.settings);\n  const publicSurfaces = object(settings.public_surfaces);\n  const publicPresence = object(settings.public_presence);\n  const presenceBmd = object(publicPresence.bookmedirectly);\n  const presenceWmp = object(publicPresence.whatsmyprogress);\n  const publicSite = object(settings.public_site);\n  const website = configuredUrl(\n    (tenant as any).company_website,\n    settings.website,\n    settings.website_url,\n    settings.public_site_url,\n    publicSite.url,\n    publicSite.website_url,\n    publicSurfaces.website,\n    publicSurfaces.site,\n    publicSurfaces.customer_site,\n  );\n  const bmd = configuredUrl(\n    presenceBmd.url,\n    settings.canonical_booking_route,\n    settings.book_me_directly_url,\n    settings.bmd_url,\n    publicSurfaces.book_me_directly,\n    publicSurfaces.bmd,\n  );\n  const wmp = configuredUrl(\n    presenceWmp.url,\n    settings.canonical_public_route,\n    settings.whatsmyprogress_url,\n    settings.wmp_url,\n    publicSurfaces.whatsmyprogress,\n    publicSurfaces.wmp,\n    publicSurfaces.progress,\n  );\n  const publicPresenceRequired = publicPresence.required === true;\n  return {\n    website: { url: website, required: settings.public_site_required === true || settings.website_required === true || settings.public_site_enabled === true, status: website ? (settings.public_site_enabled === true ? 'enabled' : 'configured') : '' },\n    bmd: { url: bmd, required: publicPresenceRequired || settings.book_me_directly_required === true || settings.bmd_required === true, status: String(presenceBmd.status || (bmd ? 'configured' : '')) },\n    wmp: { url: wmp, required: publicPresenceRequired || settings.whatsmyprogress_required === true || settings.wmp_required === true, status: String(presenceWmp.status || (wmp ? 'configured' : '')) },\n  };\n}\n\nfunction deriveTenant(tenant: Tenant, data: PortfolioData) {\n  const id = String(tenant.id);\n  const settings = object(tenant.settings);\n  const readiness = object(settings.tenant_readiness);\n  const domains = object(readiness.domains);\n  const relationship = data.relationships.find((row) => row.tenant_id === id) || null;\n  const relationshipState = relationshipStage(relationship);\n  const metadata = object(relationship?.metadata);\n  const checks = data.readinessChecks.filter((row) => String(row.tenant_id) === id);\n  const badChecks = checks.filter((row) => !['healthy', 'ready', 'passed', 'pass', 'ok', 'complete', 'completed'].includes(token(row.status)));\n  const missing = Array.isArray(readiness.missing) ? readiness.missing.map(String).filter(Boolean) : [];\n  const domainGaps = Object.entries(domains)\n    .filter(([, value]) => object(value).healthy === false)\n    .map(([key, value]) => String(object(value).detail || key.replace(/_/g, ' ') + ' needs attention'));\n  const gaps = [...new Set([...missing, ...domainGaps, ...badChecks.map((row) => String(row.detail || row.check_key || 'Readiness check needs attention'))])];\n  const hasReadiness = Object.keys(readiness).length > 0 || checks.length > 0;\n  const health = readiness.healthy === true && badChecks.length === 0\n    ? 'healthy'\n    : hasReadiness\n      ? 'needs_attention'\n      : 'unknown';\n  const slug = canonicalTenantRouteSlugForIdentity(tenant);\n  const workspace = getTenantDashboardPathForTenant(tenant);\n  const surfaces = publicSurfaces(tenant);\n\n  const persistedApps = data.applications.filter((row) => String(row.tenant_id) === id && row.enabled !== false);\n  const scopedApps = getTenantApplicationScopeFromSettings(settings).applicationIds;\n  const appIds = [...new Set([...persistedApps.map((row) => String(row.application_id || '')).filter(Boolean), ...scopedApps])];\n  const appRoutes = appIds.map((applicationId) => {\n    const app = getApplicationBySlug(applicationId);\n    if (!app || app.audience !== 'tenant-user') return null;\n    const path = buildTenantApplicationWorkspacePath(String(tenant.tenant_type || 'MISC'), String(tenant.company_slug || ''), app.slug);\n    return path ? { id: app.id, label: app.label, path } : null;\n  }).filter(Boolean) as Array<{ id: string; label: string; path: string }>;\n\n  const credentials = data.providerCredentials.filter((row) => String(row.tenant_id) === id);\n  const calendars = data.calendarConnections.filter((row) => String(row.tenant_id) === id);\n  const mail = data.mailContinuity.find((row) => String(row.tenant_id) === id) || null;\n  const invoices = data.invoices.filter((row) => String(row.tenant_org_id) === id);\n  const paidInvoices = invoices.filter(isPaidInvoice);\n  const unpaidInvoices = invoices.filter((invoice) => !isPaidInvoice(invoice));\n  const overdueInvoices = unpaidInvoices.filter((invoice) => invoice.due_date && isPast(invoice.due_date));\n  const proposalProfiles = data.proposalProfiles.filter((row) => String(row.tenant_id) === id);\n  const proposals = data.proposals.filter((row) => String(row.tenant_id) === id);\n  const relationshipProposals = data.relationshipProposals.filter((row) => String(row.tenant_id) === id);\n  const receivables = data.receivables.filter((row) => String(row.tenant_id) === id);\n  const activity = data.activitySummary.find((row) => String(row.tenant_id) === id) || null;\n  const presence = data.activityPresence.filter((row) => String(row.tenant_id) === id);\n  const accesses = data.lastAccess.filter((row) => String(row.tenant_id) === id);\n  const lastAccessAt = maxDate(accesses.map((row) => row.last_accessed_at));\n  const lastActivityAt = maxDate([activity?.last_activity_at, lastAccessAt, ...presence.map((row) => row.last_seen_at)]);\n  const activityAge = daysSince(lastActivityAt);\n  const adoption = activityAge === null ? 'no_data' : activityAge <= 3 ? 'active' : activityAge <= 14 ? 'recent' : 'stale';\n\n  const emailCredential = credentials.find((row) => /mail|gmail|google|zoho/i.test(String(row.provider || '')));\n  const paymentCredential = credentials.find((row) => /stripe|square|paddle|payment/i.test(String(row.provider || '')));\n  const mailHealthy = mail?.mailbox_ready === true || connectionHealthy(emailCredential?.credential_status);\n  const mailAttention = Boolean(mail && (mail.last_error || mail.mailbox_ready === false)) || Boolean(emailCredential && !connectionHealthy(emailCredential.credential_status));\n  const calendarHealthy = calendars.some((row) => row.enabled !== false && connectionHealthy(row.status));\n  const paymentHealthy = connectionHealthy(paymentCredential?.credential_status) || invoices.some((invoice) => Boolean(invoice.payment_provider));\n  const proposalHealthy = proposalProfiles.some((profile) => ['active', 'ready', 'production'].includes(token(profile.status))) || proposals.length > 0;\n\n  const invoiced = invoices.reduce((sum, invoice) => sum + number(invoice.amount), 0);\n  const paid = paidInvoices.reduce((sum, invoice) => sum + number(invoice.amount), 0);\n  const outstanding = unpaidInvoices.reduce((sum, invoice) => sum + number(invoice.amount), 0);\n  const overdue = overdueInvoices.reduce((sum, invoice) => sum + number(invoice.amount), 0);\n  const estimatedDealValue = number(metadata.estimated_deal_value);\n  const contractedValue = number(metadata.contracted_value);\n  const billingCadence = String(metadata.billing_cadence || 'none');\n  const monthlyRecurring = billingCadence === 'weekly'\n    ? contractedValue * 52 / 12\n    : billingCadence === 'monthly'\n      ? contractedValue\n      : billingCadence === 'annual'\n        ? contractedValue / 12\n        : 0;\n\n  const routeCheckBad = badChecks.some((row) => /route|routing/i.test(String(row.check_key || '') + ' ' + String(row.detail || '')));\n  const brandingDomain = object(domains.branding);\n  const workspaceMatrix: MatrixState = health === 'healthy' ? 'good' : health === 'needs_attention' ? 'attention' : 'unknown';\n  const brandingMatrix: MatrixState = brandingDomain.healthy === true || Boolean(tenant.company_logo_url)\n    ? 'good'\n    : brandingDomain.healthy === false || !tenant.company_logo_url\n      ? 'attention'\n      : 'unknown';\n  const routeMatrix: MatrixState = slug && !routeCheckBad && object(domains.routing).healthy !== false ? 'good' : 'attention';\n  const appMatrix: MatrixState = appIds.length ? 'good' : 'attention';\n  const surfaceMatrix = (surface: { url: string; required: boolean }): MatrixState => surface.url ? 'good' : surface.required ? 'attention' : 'missing';\n  const emailMatrix: MatrixState = mailHealthy ? 'good' : mailAttention ? 'attention' : 'missing';\n  const calendarMatrix: MatrixState = calendarHealthy ? 'good' : calendars.length ? 'attention' : 'missing';\n  const paymentMatrix: MatrixState = paymentHealthy ? 'good' : appIds.some((app) => ['payments', 'billing', 'invoices'].includes(app)) ? 'attention' : 'missing';\n  const proposalMatrix: MatrixState = proposalHealthy ? 'good' : appIds.includes('proposals') ? 'attention' : 'missing';\n  const onboardingContainer = object(metadata.onboarding_readiness);\n  const savedOnboardingItems = object(onboardingContainer.items);\n  const systemDefaults: Record<string,PortfolioOnboardingStatus> = {\n    workspace_created: 'done',\n    branding_ready: onboardingMatrixDefault(brandingMatrix),\n    routes_ready: onboardingMatrixDefault(routeMatrix),\n    apps_ready: onboardingMatrixDefault(appMatrix),\n    current_site_identified: surfaces.website.url ? 'done' : 'not_started',\n    email_connected: onboardingMatrixDefault(emailMatrix),\n    calendar_connected: onboardingMatrixDefault(calendarMatrix),\n    payments_connected: onboardingMatrixDefault(paymentMatrix),\n    proposals_ready: onboardingMatrixDefault(proposalMatrix),\n    wmp_ready: surfaces.wmp.url ? 'done' : surfaces.wmp.required ? 'in_progress' : 'not_applicable',\n    bmd_ready: surfaces.bmd.url ? 'done' : surfaces.bmd.required ? 'in_progress' : 'not_applicable',\n  };\n  const systemSignals: Record<string,string> = {\n    workspace_created: 'System: tenant workspace exists',\n    branding_ready: 'System: ' + (brandingMatrix === 'good' ? 'branding ready' : brandingMatrix === 'attention' ? 'branding needs attention' : 'branding not proven'),\n    routes_ready: 'System: ' + (routeMatrix === 'good' ? 'routes ready' : 'route readiness needs attention'),\n    apps_ready: 'System: ' + (appMatrix === 'good' ? appIds.length + ' app(s) configured' : 'application set needs attention'),\n    current_site_identified: surfaces.website.url ? 'System: current website recorded' : 'System: no website recorded',\n    email_connected: 'System: ' + (emailMatrix === 'good' ? 'mail ready' : emailMatrix === 'attention' ? 'mail needs attention' : 'mail not configured'),\n    calendar_connected: 'System: ' + (calendarMatrix === 'good' ? 'calendar ready' : calendarMatrix === 'attention' ? 'calendar needs attention' : 'calendar not configured'),\n    payments_connected: 'System: ' + (paymentMatrix === 'good' ? 'payments ready' : paymentMatrix === 'attention' ? 'payments need attention' : 'payments not configured'),\n    proposals_ready: 'System: ' + (proposalMatrix === 'good' ? 'proposal capability ready' : proposalMatrix === 'attention' ? 'proposal capability needs attention' : 'proposal capability not configured'),\n    wmp_ready: surfaces.wmp.url ? 'System: WMP route recorded' : surfaces.wmp.required ? 'System: WMP required but missing' : 'System: WMP not required',\n    bmd_ready: surfaces.bmd.url ? 'System: BMD route recorded' : surfaces.bmd.required ? 'System: BMD required but missing' : 'System: BMD not required',\n  };\n  const onboardingItems: Record<string,PortfolioOnboardingItemState> = {};\n  for (const group of ONBOARDING_GROUPS) {\n    for (const item of group.items) {\n      const saved = object(savedOnboardingItems[item.id]);\n      const savedStatus = ONBOARDING_STATUS_SET.has(saved.status as PortfolioOnboardingStatus) ? saved.status as PortfolioOnboardingStatus : null;\n      onboardingItems[item.id] = {\n        status: savedStatus || systemDefaults[item.id] || 'not_started',\n        note: String(saved.note || ''),\n        updated_at: saved.updated_at ? String(saved.updated_at) : undefined,\n      };\n    }\n  }\n  const onboardingSummary = summarizeOnboarding(onboardingItems);\n\n  return {\n    tenant,\n    id,\n    slug,\n    workspace,\n    relationship,\n    stage: relationshipState.stage,\n    confirmed: relationshipState.confirmed,\n    metadata,\n    health,\n    gaps,\n    checks,\n    domains,\n    surfaces,\n    appIds,\n    appRoutes,\n    credentials,\n    calendars,\n    mail,\n    invoices,\n    paidInvoices,\n    unpaidInvoices,\n    overdueInvoices,\n    proposalProfiles,\n    proposals,\n    relationshipProposals,\n    receivables,\n    activity,\n    presence,\n    lastAccessAt,\n    lastActivityAt,\n    adoption,\n    activityAge,\n    invoiced,\n    paid,\n    outstanding,\n    overdue,\n    estimatedDealValue,\n    contractedValue,\n    billingCadence,\n    monthlyRecurring,\n    onboarding: { items: onboardingItems, summary: onboardingSummary, systemSignals, updatedAt: String(onboardingContainer.updated_at || '') },\n    matrix: {\n      workspace: workspaceMatrix,\n      branding: brandingMatrix,\n      routes: routeMatrix,\n      apps: appMatrix,\n      website: surfaceMatrix(surfaces.website),\n      bmd: surfaceMatrix(surfaces.bmd),\n      wmp: surfaceMatrix(surfaces.wmp),\n      email: emailMatrix,\n      calendar: calendarMatrix,\n      payments: paymentMatrix,\n      proposals: proposalMatrix,\n    },\n  };\n}\n\nfunction MatrixCell({ state }: { state: MatrixState }) {\n  const label = state === 'good' ? 'Ready' : state === 'attention' ? 'Attention' : state === 'missing' ? 'Not configured' : 'Unknown';\n  return <span className={classNames(\n    'inline-flex min-w-[92px] items-center justify-center rounded-full border px-2.5 py-1 text-[10px] font-semibold',\n    state === 'good' && 'border-emerald-300/15 bg-emerald-300/[0.07] text-emerald-100',\n    state === 'attention' && 'border-amber-300/15 bg-amber-300/[0.07] text-amber-100',\n    state === 'missing' && 'border-white/[0.08] bg-white/[0.025] text-white/35',\n    state === 'unknown' && 'border-white/[0.08] bg-white/[0.025] text-white/30',\n  )}>{label}</span>;\n}\n\nfunction SurfaceCard({ label, surface }: { label: string; surface: { url: string; required: boolean; status?: string } }) {\n  return <div className=\"border border-white/[0.08] bg-white/[0.025] p-4\">\n    <div className=\"flex items-center justify-between gap-3\">\n      <div>\n        <div className=\"text-[10px] font-bold uppercase tracking-[0.18em] text-white/30\">{label}</div>\n        <div className=\"mt-1 text-sm font-semibold text-white\">{surface.url ? (surface.status ? surface.status.replace(/_/g, ' ') : 'Configured') : surface.required ? 'Required · missing' : 'Not configured'}</div>\n      </div>\n      {surface.url ? <a href={surface.url} target={surface.url.startsWith('http') ? '_blank' : undefined} rel=\"noreferrer\" className=\"inline-flex h-9 items-center gap-1.5 rounded-lg border border-white/10 px-3 text-xs text-white/65 hover:bg-white/[0.05]\"><ExternalLink className=\"h-3.5 w-3.5\" />Open</a> : null}\n    </div>\n    {surface.url ? <div className=\"mt-2 truncate text-[11px] text-white/35\">{surface.url}</div> : <div className=\"mt-2 text-[11px] text-white/28\">No live link is claimed until one exists in canonical tenant settings.</div>}\n  </div>;\n}\n\nfunction Dossier({ row, refresh, switchTenant }: { row: ReturnType<typeof deriveTenant>; refresh: () => Promise<unknown>; switchTenant: (tenantId: string) => Promise<void> }) {\n  const navigate = useNavigate();\n  const queryClient = useQueryClient();\n  const [stage, setStage] = React.useState<PortfolioSalesStage>(row.stage);\n  const [nextAction, setNextAction] = React.useState(row.relationship?.next_action || '');\n  const [dueDate, setDueDate] = React.useState(row.relationship?.next_action_due_at ? new Date(row.relationship.next_action_due_at).toISOString().slice(0, 10) : '');\n  const [estimatedValue, setEstimatedValue] = React.useState(String(row.estimatedDealValue || ''));\n  const [contractedValue, setContractedValue] = React.useState(String(row.contractedValue || ''));\n  const [cadence, setCadence] = React.useState<'none' | 'one_time' | 'weekly' | 'monthly' | 'annual'>((['none', 'one_time', 'weekly', 'monthly', 'annual'].includes(row.billingCadence) ? row.billingCadence : 'none') as any);\n  const [onboardingItems, setOnboardingItems] = React.useState<Record<string,PortfolioOnboardingItemState>>(row.onboarding.items);\n  const onboardingSummary = React.useMemo(() => summarizeOnboarding(onboardingItems), [onboardingItems]);\n\n  React.useEffect(() => {\n    setStage(row.stage);\n    setNextAction(row.relationship?.next_action || '');\n    setDueDate(row.relationship?.next_action_due_at ? new Date(row.relationship.next_action_due_at).toISOString().slice(0, 10) : '');\n    setEstimatedValue(String(row.estimatedDealValue || ''));\n    setContractedValue(String(row.contractedValue || ''));\n    setCadence((['none', 'one_time', 'weekly', 'monthly', 'annual'].includes(row.billingCadence) ? row.billingCadence : 'none') as any);\n    setOnboardingItems(row.onboarding.items);\n  }, [row.id, row.stage, row.relationship?.next_action, row.relationship?.next_action_due_at, row.estimatedDealValue, row.contractedValue, row.billingCadence, row.onboarding.updatedAt]);\n\n  const save = useMutation({\n    mutationFn: () => savePortfolioRelationship({\n      tenantId: row.id,\n      stage,\n      nextAction,\n      nextActionDueDate: dueDate,\n      estimatedDealValue: number(estimatedValue),\n      contractedValue: number(contractedValue),\n      billingCadence: cadence,\n      existing: row.relationship as PortfolioRelationship | null,\n    }),\n    onSuccess: async () => {\n      await queryClient.invalidateQueries({ queryKey: ['knocklaunch', 'portfolio'] });\n      await refresh();\n    },\n  });\n\n  const saveOnboarding = useMutation({\n    mutationFn: () => savePortfolioOnboardingReadiness({\n      tenantId: row.id,\n      items: onboardingItems,\n      existing: row.relationship as PortfolioRelationship | null,\n    }),\n    onSuccess: async () => {\n      await queryClient.invalidateQueries({ queryKey: ['knocklaunch', 'portfolio'] });\n      await refresh();\n    },\n  });\n  const updateOnboardingItem = (itemId: string, patch: Partial<PortfolioOnboardingItemState>) => {\n    setOnboardingItems((current) => ({\n      ...current,\n      [itemId]: {\n        ...(current[itemId] || { status: 'not_started' as PortfolioOnboardingStatus }),\n        ...patch,\n        updated_at: new Date().toISOString(),\n      },\n    }));\n  };\n\n  const openWorkspace = async () => {\n    await switchTenant(row.id);\n    window.location.assign(row.workspace);\n  };\n\n  return <OwnerWorkspaceShell\n    title={ownerTenantLabel(row.tenant)}\n    subtitle=\"Owner portfolio dossier · relationship, readiness, public surfaces, money, adoption, connections, apps, and routes.\"\n    eyebrow=\"KNOCKLAUNCH OS · Tenant dossier\"\n    actions={<><Button variant=\"outline\" className=\"border-white/10 bg-white/[0.03] text-white hover:bg-white/[0.07]\" onClick={() => navigate('/knock-launch-os/portfolio')}><ArrowLeft className=\"mr-2 h-4 w-4\" />Portfolio</Button><Button className=\"bg-emerald-300 text-emerald-950 hover:bg-emerald-200\" onClick={() => void openWorkspace()}>Open workspace</Button></>}\n  >\n    <section className=\"grid border-y border-white/[0.08] sm:grid-cols-2 xl:grid-cols-7\">\n      <OwnerMetric label=\"Relationship\" value={row.confirmed ? PORTFOLIO_STAGE_LABELS[row.stage] : 'Needs classification'} detail={row.confirmed ? 'Owner-confirmed commercial state' : 'Legacy status is not treated as client truth'} />\n      <OwnerMetric label=\"Workspace\" value={row.health === 'healthy' ? 'Healthy' : row.health === 'needs_attention' ? 'Attention' : 'Unknown'} detail={row.gaps.length ? String(row.gaps.length) + ' open gap(s)' : 'No derived gaps'} />\n      <OwnerMetric label=\"Onboarding\" value={String(row.onboarding.summary.progress) + '%'} detail={row.onboarding.summary.blocked ? String(row.onboarding.summary.blocked) + ' blocked' : row.onboarding.summary.waiting ? String(row.onboarding.summary.waiting) + ' waiting on client' : String(row.onboarding.summary.remaining) + ' remaining'} />\n      <OwnerMetric label=\"Last activity\" value={row.lastActivityAt ? formatOwnerDateTime(row.lastActivityAt) : 'No data'} detail={row.adoption === 'stale' ? 'Adoption is stale' : row.adoption === 'active' ? 'Recently active' : 'Usage signal'} />\n      <OwnerMetric label=\"Invoiced\" value={formatOwnerMoney(row.invoiced)} detail={formatOwnerMoney(row.outstanding) + ' outstanding'} />\n      <OwnerMetric label=\"Pipeline\" value={formatOwnerMoney(row.estimatedDealValue)} detail=\"Owner-entered estimated deal value\" />\n      <OwnerMetric label=\"Apps\" value={String(row.appIds.length)} detail={String(row.appRoutes.length) + ' canonical routes'} />\n    </section>\n\n    <section className=\"space-y-4\">\n      <OwnerSectionTitle title=\"Relationship & next move\" description=\"Commercial lifecycle is deliberately separate from technical tenant status. Changes here become the owner-confirmed source for this portfolio.\" />\n      <div className=\"grid gap-4 border border-white/[0.08] bg-white/[0.025] p-4 lg:grid-cols-4\">\n        <label className=\"space-y-1.5\"><span className=\"text-[10px] font-bold uppercase tracking-[0.16em] text-white/35\">Sales stage</span><select value={stage} onChange={(event) => setStage(event.target.value as PortfolioSalesStage)} className=\"min-h-11 w-full border border-white/10 bg-[#0b130e] px-3 text-sm text-white\">{PORTFOLIO_SALES_STAGES.map((value) => <option key={value} value={value}>{PORTFOLIO_STAGE_LABELS[value]}</option>)}</select></label>\n        <label className=\"space-y-1.5 lg:col-span-2\"><span className=\"text-[10px] font-bold uppercase tracking-[0.16em] text-white/35\">Next action</span><Input value={nextAction} onChange={(event) => setNextAction(event.target.value)} placeholder=\"Call, send proposal, finish WMP…\" className=\"border-white/10 bg-black/20 text-white\" /></label>\n        <label className=\"space-y-1.5\"><span className=\"text-[10px] font-bold uppercase tracking-[0.16em] text-white/35\">Due date</span><Input type=\"date\" value={dueDate} onChange={(event) => setDueDate(event.target.value)} className=\"border-white/10 bg-black/20 text-white\" /></label>\n        <label className=\"space-y-1.5\"><span className=\"text-[10px] font-bold uppercase tracking-[0.16em] text-white/35\">Estimated deal value</span><Input type=\"number\" min=\"0\" value={estimatedValue} onChange={(event) => setEstimatedValue(event.target.value)} className=\"border-white/10 bg-black/20 text-white\" /></label>\n        <label className=\"space-y-1.5\"><span className=\"text-[10px] font-bold uppercase tracking-[0.16em] text-white/35\">Contract value</span><Input type=\"number\" min=\"0\" value={contractedValue} onChange={(event) => setContractedValue(event.target.value)} className=\"border-white/10 bg-black/20 text-white\" /></label>\n        <label className=\"space-y-1.5\"><span className=\"text-[10px] font-bold uppercase tracking-[0.16em] text-white/35\">Billing cadence</span><select value={cadence} onChange={(event) => setCadence(event.target.value as any)} className=\"min-h-11 w-full border border-white/10 bg-[#0b130e] px-3 text-sm text-white\"><option value=\"none\">Not set</option><option value=\"one_time\">One-time</option><option value=\"weekly\">Weekly</option><option value=\"monthly\">Monthly</option><option value=\"annual\">Annual</option></select></label>\n        <div className=\"flex items-end\"><Button disabled={save.isPending} onClick={() => save.mutate()} className=\"min-h-11 w-full bg-emerald-300 text-emerald-950 hover:bg-emerald-200\">{save.isPending ? 'Saving…' : 'Save relationship'}</Button></div>\n        {save.isError ? <div className=\"lg:col-span-4 text-xs text-amber-200\">Could not save relationship: {save.error instanceof Error ? save.error.message : 'unknown error'}</div> : null}\n      </div>\n    </section>\n\n    <section className=\"space-y-5\" data-owner-onboarding-readiness=\"true\">\n      <OwnerSectionTitle\n        title=\"Onboarding & migration readiness\"\n        description=\"One durable checklist from prospect to cutover. Process status is owner-controlled; system signals show what KNOCKLAUNCH can already verify.\"\n        action={<Button disabled={saveOnboarding.isPending} onClick={() => saveOnboarding.mutate()} className=\"bg-emerald-300 text-emerald-950 hover:bg-emerald-200\">{saveOnboarding.isPending ? 'Saving…' : 'Save onboarding'}</Button>}\n      />\n      <div className=\"grid gap-px overflow-hidden border border-white/[0.08] bg-white/[0.08] sm:grid-cols-2 xl:grid-cols-5\">\n        <div className=\"bg-[#09100c] p-4\"><div className=\"text-[9px] font-bold uppercase tracking-[0.18em] text-white/30\">Complete</div><div className=\"mt-1 text-3xl font-semibold text-white\">{onboardingSummary.progress}%</div><div className=\"mt-1 text-xs text-white/35\">{onboardingSummary.done} of {onboardingSummary.total} applicable</div></div>\n        <div className=\"bg-[#09100c] p-4\"><div className=\"text-[9px] font-bold uppercase tracking-[0.18em] text-white/30\">Remaining</div><div className=\"mt-1 text-3xl font-semibold text-white\">{onboardingSummary.remaining}</div><div className=\"mt-1 text-xs text-white/35\">Open onboarding steps</div></div>\n        <div className=\"bg-[#09100c] p-4\"><div className=\"text-[9px] font-bold uppercase tracking-[0.18em] text-amber-300/60\">Waiting</div><div className=\"mt-1 text-3xl font-semibold text-amber-100\">{onboardingSummary.waiting}</div><div className=\"mt-1 text-xs text-white/35\">Waiting on client</div></div>\n        <div className=\"bg-[#09100c] p-4\"><div className=\"text-[9px] font-bold uppercase tracking-[0.18em] text-rose-300/60\">Blocked</div><div className=\"mt-1 text-3xl font-semibold text-rose-100\">{onboardingSummary.blocked}</div><div className=\"mt-1 text-xs text-white/35\">Needs intervention</div></div>\n        <div className=\"bg-[#09100c] p-4 sm:col-span-2 xl:col-span-1\"><div className=\"text-[9px] font-bold uppercase tracking-[0.18em] text-sky-300/60\">In progress</div><div className=\"mt-1 text-3xl font-semibold text-sky-100\">{onboardingSummary.inProgress}</div><div className=\"mt-1 text-xs text-white/35\">Actively moving</div></div>\n      </div>\n      <div className=\"h-2 overflow-hidden rounded-full bg-white/[0.06]\"><div className=\"h-full rounded-full bg-emerald-300 transition-all\" style={{width: onboardingSummary.progress + '%'}} /></div>\n      <div className=\"space-y-3\">\n        {ONBOARDING_GROUPS.map((group, groupIndex) => {\n          const groupItems = group.items.map((item) => ({ spec: item, state: onboardingItems[item.id] || {status:'not_started' as PortfolioOnboardingStatus} }));\n          const groupSummary = summarizeOnboarding(Object.fromEntries(groupItems.map(({spec,state}) => [spec.id,state])));\n          return <details key={group.id} open={groupIndex === 0 || groupSummary.blocked > 0 || groupSummary.waiting > 0} className=\"group border border-white/[0.08] bg-white/[0.02]\">\n            <summary className=\"flex cursor-pointer list-none items-center gap-4 px-4 py-4\">\n              <div className=\"min-w-0 flex-1\"><div className=\"text-sm font-semibold text-white\">{group.label}</div><div className=\"mt-1 text-xs leading-5 text-white/35\">{group.description}</div></div>\n              <div className=\"shrink-0 text-right\"><div className=\"text-lg font-semibold text-white\">{groupSummary.progress}%</div><div className=\"text-[10px] text-white/30\">{groupSummary.done}/{groupSummary.total}</div></div>\n            </summary>\n            <div className=\"border-t border-white/[0.07]\">\n              {groupItems.map(({spec,state}) => {\n                const systemSignal = row.onboarding.systemSignals[spec.id] || '';\n                return <div key={spec.id} className=\"grid gap-3 border-b border-white/[0.05] p-4 last:border-b-0 lg:grid-cols-[minmax(0,1.5fr)_190px_minmax(220px,1fr)] lg:items-center\">\n                  <div className=\"min-w-0\"><div className=\"flex flex-wrap items-center gap-2\"><div className=\"text-sm font-semibold text-white/90\">{spec.label}</div><span className={classNames('inline-flex rounded-full border px-2 py-0.5 text-[9px] font-semibold', onboardingTone(state.status))}>{ONBOARDING_STATUS_LABELS[state.status]}</span></div><div className=\"mt-1 text-xs leading-5 text-white/35\">{spec.detail}</div>{systemSignal ? <div className=\"mt-1.5 text-[10px] font-semibold text-emerald-200/45\">{systemSignal}</div> : null}</div>\n                  <select value={state.status} onChange={(event) => updateOnboardingItem(spec.id,{status:event.target.value as PortfolioOnboardingStatus})} className=\"min-h-10 w-full border border-white/10 bg-[#0b130e] px-3 text-xs font-semibold text-white\">\n                    {Object.entries(ONBOARDING_STATUS_LABELS).map(([value,label]) => <option key={value} value={value}>{label}</option>)}\n                  </select>\n                  <Input value={state.note || ''} onChange={(event) => updateOnboardingItem(spec.id,{note:event.target.value})} placeholder=\"Note / dependency / who has the ball…\" className=\"border-white/10 bg-black/20 text-xs text-white\" />\n                </div>;\n              })}\n            </div>\n          </details>;\n        })}\n      </div>\n      {saveOnboarding.isError ? <div className=\"text-xs text-amber-200\">Could not save onboarding: {saveOnboarding.error instanceof Error ? saveOnboarding.error.message : 'unknown error'}</div> : null}\n      {saveOnboarding.isSuccess ? <div className=\"text-xs text-emerald-200/70\">Onboarding readiness saved.</div> : null}\n    </section>\n\n    <section className=\"space-y-4\">\n      <OwnerSectionTitle title=\"Workspace health\" description=\"Canonical readiness only. Missing or degraded facts are surfaced; viewing this page never repairs a tenant automatically.\" />\n      <div className=\"grid gap-3 lg:grid-cols-3\">\n        <div className=\"border border-white/[0.08] bg-white/[0.025] p-4\"><div className=\"flex items-center gap-2 text-sm font-semibold\"><Gauge className=\"h-4 w-4 text-emerald-300\" />Workspace</div><div className=\"mt-3\"><MatrixCell state={row.matrix.workspace} /></div><p className=\"mt-3 text-xs leading-5 text-white/38\">{row.gaps.length ? row.gaps.slice(0, 4).join(' · ') : 'No derived readiness gaps.'}</p></div>\n        <div className=\"border border-white/[0.08] bg-white/[0.025] p-4\"><div className=\"flex items-center gap-2 text-sm font-semibold\"><Route className=\"h-4 w-4 text-emerald-300\" />Routing</div><div className=\"mt-3\"><MatrixCell state={row.matrix.routes} /></div><p className=\"mt-3 text-xs text-white/38\">{row.workspace}</p></div>\n        <div className=\"border border-white/[0.08] bg-white/[0.025] p-4\"><div className=\"flex items-center gap-2 text-sm font-semibold\"><Link2 className=\"h-4 w-4 text-emerald-300\" />Connections</div><div className=\"mt-3 text-2xl font-semibold\">{row.credentials.length + row.calendars.length + (row.mail ? 1 : 0)}</div><p className=\"mt-1 text-xs text-white/38\">Provider, calendar, and mail connection records</p></div>\n      </div>\n      {row.gaps.length ? <div className=\"flex flex-wrap gap-2\">{row.gaps.map((gap) => <Badge key={gap} variant=\"outline\" className=\"border-amber-300/15 bg-amber-300/[0.05] text-amber-100/80\">{gap}</Badge>)}</div> : null}\n    </section>\n\n    <section className=\"space-y-4\">\n      <OwnerSectionTitle title=\"Public surfaces\" description=\"Website, BookMeDirectly, and WhatsMyProgress stay distinct. Missing links are never fabricated.\" />\n      <div className=\"grid gap-3 lg:grid-cols-3\"><SurfaceCard label=\"Customer website\" surface={row.surfaces.website} /><SurfaceCard label=\"BookMeDirectly\" surface={row.surfaces.bmd} /><SurfaceCard label=\"WhatsMyProgress\" surface={row.surfaces.wmp} /></div>\n    </section>\n\n    <section className=\"grid gap-8 xl:grid-cols-2\">\n      <div className=\"space-y-4\">\n        <OwnerSectionTitle title=\"Connections\" description=\"Sanitized provider state only. Credential references and secrets never render here.\" />\n        <div className=\"space-y-2\">\n          {row.mail ? <div className=\"flex items-center justify-between border border-white/[0.08] bg-white/[0.025] p-3 text-sm\"><span>Mail continuity</span><span className=\"text-white/45\">{row.mail.mailbox_ready ? 'Mailbox ready' : row.mail.last_error ? 'Needs attention' : String(row.mail.provider_verification_status || 'Not ready')}</span></div> : null}\n          {row.calendars.map((connection: any) => <div key={connection.id} className=\"flex items-center justify-between border border-white/[0.08] bg-white/[0.025] p-3 text-sm\"><span>{connection.display_name || connection.provider || 'Calendar'}</span><span className=\"text-white/45\">{connection.enabled === false ? 'Disabled' : connection.status || 'Unknown'}</span></div>)}\n          {row.credentials.map((credential: any) => <div key={credential.id} className=\"flex items-center justify-between border border-white/[0.08] bg-white/[0.025] p-3 text-sm\"><span>{credential.provider || 'Provider'}</span><span className=\"text-white/45\">{credential.credential_status || 'Unknown'}</span></div>)}\n          {!row.mail && !row.calendars.length && !row.credentials.length ? <div className=\"border border-white/[0.08] bg-white/[0.025] p-4 text-sm text-white/35\">No connection records are configured.</div> : null}\n        </div>\n      </div>\n      <div className=\"space-y-4\">\n        <OwnerSectionTitle title=\"Revenue & adoption\" description=\"Actual invoice/activity facts plus owner-entered commercial value.\" />\n        <div className=\"grid grid-cols-2 border border-white/[0.08]\">\n          <OwnerMetric label=\"Paid invoices\" value={formatOwnerMoney(row.paid)} detail={String(row.paidInvoices.length) + ' paid'} />\n          <OwnerMetric label=\"Outstanding\" value={formatOwnerMoney(row.outstanding)} detail={row.overdue ? formatOwnerMoney(row.overdue) + ' overdue' : 'No overdue balance'} />\n          <OwnerMetric label=\"Activity events\" value={String(number(row.activity?.activity_count))} detail={row.lastActivityAt ? 'Last ' + formatOwnerDateTime(row.lastActivityAt) : 'No recorded activity'} />\n          <OwnerMetric label=\"Active now\" value={String(row.presence.length)} detail={row.lastAccessAt ? 'Last access ' + formatOwnerDateTime(row.lastAccessAt) : 'No access record'} />\n        </div>\n      </div>\n    </section>\n\n    <section className=\"space-y-4\">\n      <OwnerSectionTitle title=\"Applications & canonical routes\" description=\"Enabled tenant applications resolved through the platform application registry.\" action={<Button asChild variant=\"outline\" className=\"border-white/10 bg-white/[0.03] text-white hover:bg-white/[0.07]\"><Link to=\"/knock-launch-os/routes\">Global route directory</Link></Button>} />\n      <div className=\"grid gap-2 md:grid-cols-2 xl:grid-cols-3\">\n        {row.appRoutes.map((route) => <a key={route.id} href={route.path} className=\"group flex items-center justify-between gap-3 border border-white/[0.08] bg-white/[0.025] p-3 hover:bg-white/[0.05]\"><div><div className=\"text-sm font-semibold\">{route.label}</div><div className=\"mt-1 truncate text-[10px] text-white/30\">{route.path}</div></div><ExternalLink className=\"h-4 w-4 text-white/25 group-hover:text-emerald-300\" /></a>)}\n        {!row.appRoutes.length ? <div className=\"border border-white/[0.08] bg-white/[0.025] p-4 text-sm text-white/35\">No canonical application routes resolved for this tenant.</div> : null}\n      </div>\n    </section>\n  </OwnerWorkspaceShell>;\n}\n\nexport default function KnockLaunchPortfolio() {\n  const location = useLocation();\n  const { memberships, effectiveRole, hasGodModeAnywhere, isLoading, switchTenant } = useMultiTenant();\n  const platformAuthority = effectiveRole === 'GodMode' || hasGodModeAnywhere();\n  const [section, setSection] = React.useState<PortfolioSection>('command');\n  const [query, setQuery] = React.useState('');\n  const [stageFilter, setStageFilter] = React.useState('all');\n  const [healthFilter, setHealthFilter] = React.useState('all');\n  const [typeFilter, setTypeFilter] = React.useState('all');\n  const [gapsOnly, setGapsOnly] = React.useState(false);\n\n  const tenants = React.useMemo(() => {\n    const found = memberships.map((membership) => membership.tenant).filter((tenant): tenant is Tenant => Boolean(tenant?.id));\n    return [...new Map(found.map((tenant) => [String(tenant.id), tenant] as const)).values()];\n  }, [memberships]);\n  const tenantIds = React.useMemo(() => tenants.map((tenant) => String(tenant.id)), [tenants]);\n  const portfolioQuery = useQuery({\n    queryKey: ['knocklaunch', 'portfolio', tenantIds.join(',')],\n    queryFn: () => loadKnockLaunchPortfolioData(tenantIds),\n    enabled: platformAuthority && !isLoading && tenantIds.length > 0,\n    staleTime: 30_000,\n  });\n  const data = portfolioQuery.data || EMPTY_PORTFOLIO_DATA;\n  const rows = React.useMemo(() => tenants.map((tenant) => deriveTenant(tenant, data)), [tenants, data]);\n\n  if (isLoading) return <OwnerWorkspaceShell title=\"Clients\" subtitle=\"Verifying owner access and loading the client portfolio.\" eyebrow=\"KNOCKLAUNCH OS\"><div data-knocklaunch-portfolio-loading=\"true\" className=\"flex min-h-[320px] items-center justify-center border-y border-white/[0.08] bg-white/[0.02]\"><div className=\"flex items-center gap-3 text-sm text-white/55\"><RefreshCw className=\"h-4 w-4 animate-spin text-emerald-300\" />Verifying owner access…</div></div></OwnerWorkspaceShell>;\n  if (!platformAuthority) return <Navigate to=\"/select-tenant\" replace />;\n\n  const selectedId = location.pathname.toLowerCase().startsWith('/knock-launch-os/portfolio/')\n    ? location.pathname.split('/').filter(Boolean).slice(2).join('/')\n    : '';\n  if (selectedId) {\n    const selected = rows.find((row) => row.id.toLowerCase() === selectedId.toLowerCase());\n    if (!selected) return <OwnerWorkspaceShell title=\"Tenant not found\" subtitle=\"This portfolio dossier does not resolve to an authorized tenant.\"><Button asChild variant=\"outline\" className=\"border-white/10 bg-white/[0.03] text-white\"><Link to=\"/knock-launch-os/portfolio\"><ArrowLeft className=\"mr-2 h-4 w-4\" />Back to portfolio</Link></Button></OwnerWorkspaceShell>;\n    return <Dossier row={selected} refresh={() => portfolioQuery.refetch()} switchTenant={switchTenant} />;\n  }\n\n  const stageCounts = PORTFOLIO_SALES_STAGES.reduce<Record<string, number>>((acc, stage) => {\n    acc[stage] = rows.filter((row) => row.confirmed && row.stage === stage).length;\n    return acc;\n  }, {});\n  const unclassified = rows.filter((row) => !row.confirmed).length;\n  const totalGaps = rows.reduce((sum, row) => sum + row.gaps.length, 0);\n  const needsAttention = rows.filter((row) => row.health === 'needs_attention').length;\n  const pipeline = rows.filter((row) => !['active_client', 'paused', 'lost'].includes(row.stage)).reduce((sum, row) => sum + row.estimatedDealValue, 0);\n  const monthlyRecurring = rows.reduce((sum, row) => sum + row.monthlyRecurring, 0);\n  const invoiced = rows.reduce((sum, row) => sum + row.invoiced, 0);\n  const paid = rows.reduce((sum, row) => sum + row.paid, 0);\n  const outstanding = rows.reduce((sum, row) => sum + row.outstanding, 0);\n  const overdue = rows.reduce((sum, row) => sum + row.overdue, 0);\n\n  const needs = rows.flatMap((row) => {\n    const items: Array<{ key: string; priority: number; category: string; title: string; detail: string; tenant: string; href: string }> = [];\n    const href = '/knock-launch-os/portfolio/' + row.id;\n    if (row.overdueInvoices.length) items.push({ key: row.id + ':overdue', priority: 5, category: 'Money', title: String(row.overdueInvoices.length) + ' overdue invoice(s)', detail: formatOwnerMoney(row.overdue) + ' overdue', tenant: ownerTenantLabel(row.tenant), href });\n    if (row.onboarding.summary.blocked) items.push({ key: row.id + ':onboarding-blocked', priority: 7, category: 'Onboarding', title: String(row.onboarding.summary.blocked) + ' onboarding step(s) blocked', detail: String(row.onboarding.summary.progress) + '% complete', tenant: ownerTenantLabel(row.tenant), href });\n    else if (row.onboarding.summary.waiting) items.push({ key: row.id + ':onboarding-waiting', priority: 28, category: 'Onboarding', title: String(row.onboarding.summary.waiting) + ' step(s) waiting on client', detail: String(row.onboarding.summary.progress) + '% complete', tenant: ownerTenantLabel(row.tenant), href });\n    if (row.health === 'needs_attention') items.push({ key: row.id + ':health', priority: 10, category: 'Health', title: String(row.gaps.length || 1) + ' workspace item(s) need attention', detail: row.gaps.slice(0, 2).join(' · ') || 'Readiness check requires review', tenant: ownerTenantLabel(row.tenant), href });\n    if (row.relationship?.next_action && row.relationship.next_action_due_at && isPast(row.relationship.next_action_due_at)) items.push({ key: row.id + ':followup', priority: 15, category: 'Follow-up', title: row.relationship.next_action, detail: 'Due ' + formatOwnerDateTime(row.relationship.next_action_due_at), tenant: ownerTenantLabel(row.tenant), href });\n    if (row.mail?.last_error || (row.mail && row.mail.mailbox_ready === false)) items.push({ key: row.id + ':mail', priority: 20, category: 'Connection', title: 'Mail needs attention', detail: String(row.mail.last_error || row.mail.activation_reason || 'Mailbox is not ready'), tenant: ownerTenantLabel(row.tenant), href });\n    const badProvider = row.credentials.find((credential: any) => !connectionHealthy(credential.credential_status));\n    if (badProvider) items.push({ key: row.id + ':provider:' + badProvider.id, priority: 25, category: 'Connection', title: String(badProvider.provider || 'Provider') + ' is not ready', detail: String(badProvider.credential_status || 'Unknown connection state'), tenant: ownerTenantLabel(row.tenant), href });\n    if (row.confirmed && row.stage === 'active_client' && row.adoption === 'stale') items.push({ key: row.id + ':adoption', priority: 30, category: 'Adoption', title: 'Client activity is stale', detail: row.activityAge === null ? 'No activity signal' : String(row.activityAge) + ' days since activity', tenant: ownerTenantLabel(row.tenant), href });\n    const latestRelationshipProposal = [...row.relationshipProposals].sort((a, b) => toTime(b.sent_at || b.updated_at) - toTime(a.sent_at || a.updated_at))[0];\n    if (latestRelationshipProposal && ['sent', 'viewed'].includes(token(latestRelationshipProposal.status)) && daysSince(latestRelationshipProposal.sent_at || latestRelationshipProposal.updated_at)! >= 3 && !row.relationship?.next_action) {\n      items.push({ key: row.id + ':proposal', priority: 40, category: 'Sales', title: 'Proposal follow-up', detail: String(latestRelationshipProposal.title || latestRelationshipProposal.status || 'Proposal is awaiting action'), tenant: ownerTenantLabel(row.tenant), href });\n    }\n    if (!row.confirmed) items.push({ key: row.id + ':classify', priority: 60, category: 'Sales', title: 'Classify relationship', detail: 'Legacy tenant status is not treated as commercial truth.', tenant: ownerTenantLabel(row.tenant), href });\n    return items;\n  }).sort((a, b) => a.priority - b.priority || a.tenant.localeCompare(b.tenant));\n\n  const filtered = rows.filter((row) => {\n    const haystack = [ownerTenantLabel(row.tenant), row.tenant.company_slug, row.tenant.tenant_type, PORTFOLIO_STAGE_LABELS[row.stage]].join(' ').toLowerCase();\n    if (query && !haystack.includes(query.trim().toLowerCase())) return false;\n    if (stageFilter !== 'all' && row.stage !== stageFilter) return false;\n    if (healthFilter === 'healthy' && row.health !== 'healthy') return false;\n    if (healthFilter === 'attention' && row.health !== 'needs_attention') return false;\n    if (typeFilter !== 'all' && String(row.tenant.tenant_type) !== typeFilter) return false;\n    if (gapsOnly && !row.gaps.length) return false;\n    return true;\n  });\n  const types = [...new Set(rows.map((row) => String(row.tenant.tenant_type || 'Unknown')))].sort();\n\n  const sections: Array<{ id: PortfolioSection; label: string }> = [\n    { id: 'command', label: 'What needs me' },\n    { id: 'portfolio', label: 'Clients' },\n    { id: 'readiness', label: 'Readiness matrix' },\n    { id: 'revenue', label: 'Revenue' },\n  ];\n\n  return <OwnerWorkspaceShell\n    title=\"Clients\"\n    subtitle=\"One owner workspace for prospects, clients, health, public surfaces, routes, connections, revenue, adoption, and the next thing that actually needs your attention.\"\n    eyebrow=\"KNOCKLAUNCH OS\"\n    actions={<><Button variant=\"outline\" className=\"border-white/10 bg-white/[0.03] text-white hover:bg-white/[0.07]\" onClick={() => void portfolioQuery.refetch()} disabled={portfolioQuery.isFetching}><RefreshCw className={classNames('mr-2 h-4 w-4', portfolioQuery.isFetching && 'animate-spin')} />Refresh</Button><Button asChild variant=\"outline\" className=\"border-white/10 bg-white/[0.03] text-white hover:bg-white/[0.07]\"><Link to=\"/knock-launch-os/routes\">Routes</Link></Button></>}\n  >\n    <section className=\"grid border-y border-white/[0.08] sm:grid-cols-2 xl:grid-cols-7\">\n      <OwnerMetric label=\"Businesses\" value={String(rows.length)} detail=\"Authorized tenant fleet\" />\n      <OwnerMetric label=\"Active clients\" value={String(stageCounts.active_client || 0)} detail=\"Owner-confirmed only\" />\n      <OwnerMetric label=\"Prospects\" value={String(rows.filter((row) => row.confirmed && !['active_client', 'paused', 'lost', 'onboarding'].includes(row.stage)).length)} detail={String(unclassified) + ' still unclassified'} />\n      <OwnerMetric label=\"Onboarding\" value={String(stageCounts.onboarding || 0)} detail=\"Won / implementation\" />\n      <OwnerMetric label=\"Needs attention\" value={String(needsAttention)} detail={String(totalGaps) + ' readiness gaps'} />\n      <OwnerMetric label=\"Pipeline\" value={formatOwnerMoney(pipeline)} detail=\"Owner-entered estimates\" />\n      <OwnerMetric label=\"Monthly recurring\" value={formatOwnerMoney(monthlyRecurring)} detail=\"Normalized confirmed contracts\" />\n    </section>\n\n    {data.errors.length ? <div className=\"flex items-start gap-3 border border-amber-300/15 bg-amber-300/[0.05] p-4 text-sm text-amber-100/85\"><AlertTriangle className=\"mt-0.5 h-4 w-4 shrink-0\" /><div><div className=\"font-semibold\">Some optional portfolio metrics are unavailable.</div><div className=\"mt-1 text-xs text-amber-100/55\">The portfolio remains usable; affected domains are isolated. {data.errors.slice(0, 3).join(' · ')}</div></div></div> : null}\n\n    <section className=\"flex gap-1 overflow-x-auto border-b border-white/[0.08] pb-2\">\n      {sections.map((item) => <button key={item.id} type=\"button\" onClick={() => setSection(item.id)} className={classNames('min-h-10 shrink-0 border-b-2 px-3 text-xs font-semibold transition', section === item.id ? 'border-emerald-300 text-white' : 'border-transparent text-white/38 hover:text-white/70')}>{item.label}</button>)}\n    </section>\n\n    {section === 'command' ? <section className=\"space-y-7\">\n      <OwnerSectionTitle title=\"What needs me\" description=\"Only owner-actionable items, ordered by consequence. Technical noise stays out unless it changes something you need to do.\" action={<Badge variant=\"outline\" className=\"border-white/10 text-white/55\">{needs.length} open</Badge>} />\n      <div className=\"grid gap-3 xl:grid-cols-2\">\n        {needs.slice(0, 14).map((item) => <Link key={item.key} to={item.href} className=\"group border border-white/[0.08] bg-white/[0.025] p-4 transition hover:border-emerald-300/15 hover:bg-white/[0.045]\"><div className=\"flex items-start justify-between gap-4\"><div><div className=\"text-[9px] font-bold uppercase tracking-[0.18em] text-emerald-300/50\">{item.category}</div><div className=\"mt-1 text-sm font-semibold text-white\">{item.title}</div><div className=\"mt-1 text-xs text-white/38\">{item.tenant} · {item.detail}</div></div><ExternalLink className=\"mt-1 h-4 w-4 shrink-0 text-white/20 group-hover:text-emerald-300\" /></div></Link>)}\n        {!needs.length ? <div className=\"border border-emerald-300/10 bg-emerald-300/[0.04] p-5 text-sm text-emerald-100\"><CheckCircle2 className=\"mb-2 h-5 w-5\" />Nothing in the current portfolio is asking for owner action.</div> : null}\n      </div>\n      <div className=\"grid gap-8 xl:grid-cols-2\">\n        <div className=\"space-y-4\"><OwnerSectionTitle title=\"Client adoption pulse\" description=\"Facts from activity, access, proposals, invoices, and application use.\" /><div className=\"space-y-2\">{[...rows].sort((a, b) => toTime(b.lastActivityAt) - toTime(a.lastActivityAt)).slice(0, 8).map((row) => <Link key={row.id} to={'/knock-launch-os/portfolio/' + row.id} className=\"flex items-center justify-between gap-4 border border-white/[0.08] bg-white/[0.025] p-3\"><div className=\"min-w-0\"><div className=\"truncate text-sm font-semibold\">{ownerTenantLabel(row.tenant)}</div><div className=\"mt-1 truncate text-[11px] text-white/35\">{row.lastActivityAt ? 'Last activity ' + formatOwnerDateTime(row.lastActivityAt) : 'No activity signal'}</div></div><Badge variant=\"outline\" className={classNames('shrink-0', row.adoption === 'stale' ? 'border-amber-300/15 text-amber-100' : 'border-emerald-300/15 text-emerald-100')}>{row.adoption.replace('_', ' ')}</Badge></Link>)}</div></div>\n        <div className=\"space-y-4\"><OwnerSectionTitle title=\"Money pulse\" description=\"Invoice reality, not forecast theater.\" /><div className=\"grid grid-cols-2 border border-white/[0.08]\"><OwnerMetric label=\"Invoiced\" value={formatOwnerMoney(invoiced)} /><OwnerMetric label=\"Paid\" value={formatOwnerMoney(paid)} /><OwnerMetric label=\"Outstanding\" value={formatOwnerMoney(outstanding)} /><OwnerMetric label=\"Overdue\" value={formatOwnerMoney(overdue)} /></div></div>\n      </div>\n    </section> : null}\n\n    {section === 'portfolio' ? <section className=\"space-y-5\">\n      <OwnerSectionTitle title=\"Portfolio directory\" description=\"Commercial state, technical health, surfaces, connections, money, and adoption in one compact row.\" />\n      <div className=\"grid gap-2 border border-white/[0.08] bg-white/[0.02] p-3 md:grid-cols-6\">\n        <div className=\"relative md:col-span-2\"><Search className=\"pointer-events-none absolute left-3 top-3.5 h-4 w-4 text-white/25\" /><Input value={query} onChange={(event) => setQuery(event.target.value)} placeholder=\"Search tenants…\" className=\"border-white/10 bg-black/20 pl-9 text-white\" /></div>\n        <select value={stageFilter} onChange={(event) => setStageFilter(event.target.value)} className=\"min-h-10 border border-white/10 bg-[#0b130e] px-3 text-sm text-white\"><option value=\"all\">All stages</option>{PORTFOLIO_SALES_STAGES.map((stage) => <option key={stage} value={stage}>{PORTFOLIO_STAGE_LABELS[stage]}</option>)}</select>\n        <select value={healthFilter} onChange={(event) => setHealthFilter(event.target.value)} className=\"min-h-10 border border-white/10 bg-[#0b130e] px-3 text-sm text-white\"><option value=\"all\">All health</option><option value=\"healthy\">Healthy</option><option value=\"attention\">Needs attention</option></select>\n        <select value={typeFilter} onChange={(event) => setTypeFilter(event.target.value)} className=\"min-h-10 border border-white/10 bg-[#0b130e] px-3 text-sm text-white\"><option value=\"all\">All types</option>{types.map((value) => <option key={value} value={value}>{value}</option>)}</select>\n        <label className=\"flex min-h-10 items-center gap-2 px-2 text-xs text-white/55\"><input type=\"checkbox\" checked={gapsOnly} onChange={(event) => setGapsOnly(event.target.checked)} /> Gaps only</label>\n      </div>\n      <div className=\"space-y-2\">\n        {filtered.map((row) => <Link key={row.id} to={'/knock-launch-os/portfolio/' + row.id} className=\"group grid gap-3 border border-white/[0.08] bg-white/[0.025] p-4 transition hover:border-emerald-300/15 hover:bg-white/[0.045] lg:grid-cols-[minmax(0,2fr)_repeat(5,minmax(110px,1fr))] lg:items-center\">\n          <div className=\"min-w-0\"><div className=\"flex flex-wrap items-center gap-2\"><div className=\"truncate text-sm font-semibold text-white\">{ownerTenantLabel(row.tenant)}</div><Badge variant=\"outline\" className={classNames('border-white/10', row.confirmed ? 'text-emerald-100' : 'text-amber-100')}>{row.confirmed ? PORTFOLIO_STAGE_LABELS[row.stage] : 'Needs classification'}</Badge></div><div className=\"mt-1 truncate text-[11px] text-white/32\">{row.tenant.tenant_type} · {row.slug || 'route missing'} · {row.appIds.length} apps</div></div>\n          <div><div className=\"text-[9px] uppercase tracking-[0.15em] text-white/25\">Health</div><div className=\"mt-1 text-xs text-white/65\">{row.health === 'healthy' ? 'Healthy' : row.health === 'needs_attention' ? String(row.gaps.length) + ' gap(s)' : 'Unknown'}</div></div>\n          <div><div className=\"text-[9px] uppercase tracking-[0.15em] text-white/25\">Onboarding</div><div className=\"mt-1 text-xs text-white/65\">{row.onboarding.summary.progress}% · {row.onboarding.summary.blocked ? row.onboarding.summary.blocked + ' blocked' : row.onboarding.summary.waiting ? row.onboarding.summary.waiting + ' waiting' : row.onboarding.summary.remaining + ' remaining'}</div></div>\n          <div><div className=\"text-[9px] uppercase tracking-[0.15em] text-white/25\">Last activity</div><div className=\"mt-1 text-xs text-white/65\">{row.lastActivityAt ? formatOwnerDateTime(row.lastActivityAt) : 'No data'}</div></div>\n          <div><div className=\"text-[9px] uppercase tracking-[0.15em] text-white/25\">Outstanding</div><div className=\"mt-1 text-xs text-white/65\">{formatOwnerMoney(row.outstanding)}</div></div>\n          <div><div className=\"text-[9px] uppercase tracking-[0.15em] text-white/25\">Next move</div><div className=\"mt-1 truncate text-xs text-white/65\">{row.relationship?.next_action || (row.confirmed ? 'No next action set' : 'Classify relationship')}</div></div>\n        </Link>)}\n        {!filtered.length ? <div className=\"border border-white/[0.08] bg-white/[0.025] p-8 text-center text-sm text-white/35\">No tenants match these filters.</div> : null}\n      </div>\n    </section> : null}\n\n    {section === 'readiness' ? <section className=\"space-y-5\">\n      <OwnerSectionTitle title=\"Client readiness matrix\" description=\"A fleet-wide gap map. Gray means not configured or not required; amber means an expected or foundational capability needs attention.\" />\n      <div className=\"overflow-x-auto border border-white/[0.08]\">\n        <table className=\"min-w-[1500px] w-full border-collapse text-left\">\n          <thead className=\"bg-white/[0.025] text-[9px] uppercase tracking-[0.15em] text-white/30\"><tr><th className=\"sticky left-0 z-10 bg-[#09100c] px-4 py-3\">Tenant</th>{['Onboarding','Workspace','Branding','Routes','Apps','Website','BMD','WMP','Email','Calendar','Payments','Proposals'].map((label) => <th key={label} className=\"px-3 py-3\">{label}</th>)}</tr></thead>\n          <tbody>{rows.map((row) => <tr key={row.id} className=\"border-t border-white/[0.06]\"><td className=\"sticky left-0 z-10 bg-[#07100b] px-4 py-3\"><Link to={'/knock-launch-os/portfolio/' + row.id} className=\"text-sm font-semibold text-white hover:text-emerald-200\">{ownerTenantLabel(row.tenant)}</Link><div className=\"mt-1 text-[10px] text-white/28\">{row.tenant.tenant_type}</div></td><td className=\"px-3 py-3\"><div className=\"min-w-[110px]\"><div className=\"text-sm font-semibold text-white\">{row.onboarding.summary.progress}%</div><div className=\"mt-1 text-[10px] text-white/32\">{row.onboarding.summary.blocked ? row.onboarding.summary.blocked + ' blocked' : row.onboarding.summary.waiting ? row.onboarding.summary.waiting + ' waiting' : row.onboarding.summary.remaining + ' remaining'}</div><div className=\"mt-2 h-1.5 overflow-hidden rounded-full bg-white/[0.06]\"><div className=\"h-full rounded-full bg-emerald-300\" style={{width: row.onboarding.summary.progress + '%'}} /></div></div></td>{(['workspace','branding','routes','apps','website','bmd','wmp','email','calendar','payments','proposals'] as const).map((key) => <td key={key} className=\"px-3 py-3\"><MatrixCell state={row.matrix[key]} /></td>)}</tr>)}</tbody>\n        </table>\n      </div>\n    </section> : null}\n\n    {section === 'revenue' ? <section className=\"space-y-7\">\n      <OwnerSectionTitle title=\"Revenue command center\" description=\"Invoice totals are actual recorded money. Pipeline and recurring value come only from owner-confirmed relationship metadata.\" />\n      <div className=\"grid border-y border-white/[0.08] sm:grid-cols-2 xl:grid-cols-6\">\n        <OwnerMetric label=\"Pipeline\" value={formatOwnerMoney(pipeline)} detail=\"Prospect estimates\" />\n        <OwnerMetric label=\"Monthly recurring\" value={formatOwnerMoney(monthlyRecurring)} detail=\"Normalized confirmed contracts\" />\n        <OwnerMetric label=\"Invoiced\" value={formatOwnerMoney(invoiced)} />\n        <OwnerMetric label=\"Paid\" value={formatOwnerMoney(paid)} />\n        <OwnerMetric label=\"Outstanding\" value={formatOwnerMoney(outstanding)} />\n        <OwnerMetric label=\"Overdue\" value={formatOwnerMoney(overdue)} />\n      </div>\n      <div className=\"overflow-x-auto border border-white/[0.08]\"><table className=\"min-w-[960px] w-full text-left\"><thead className=\"bg-white/[0.025] text-[9px] uppercase tracking-[0.15em] text-white/30\"><tr><th className=\"px-4 py-3\">Tenant</th><th className=\"px-4 py-3\">Stage</th><th className=\"px-4 py-3\">Pipeline</th><th className=\"px-4 py-3\">Recurring / mo</th><th className=\"px-4 py-3\">Invoiced</th><th className=\"px-4 py-3\">Paid</th><th className=\"px-4 py-3\">Outstanding</th><th className=\"px-4 py-3\">Overdue</th></tr></thead><tbody>{rows.map((row) => <tr key={row.id} className=\"border-t border-white/[0.06] text-sm\"><td className=\"px-4 py-3\"><Link to={'/knock-launch-os/portfolio/' + row.id} className=\"font-semibold text-white hover:text-emerald-200\">{ownerTenantLabel(row.tenant)}</Link></td><td className=\"px-4 py-3 text-white/55\">{row.confirmed ? PORTFOLIO_STAGE_LABELS[row.stage] : 'Unclassified'}</td><td className=\"px-4 py-3 text-white/65\">{formatOwnerMoney(row.estimatedDealValue)}</td><td className=\"px-4 py-3 text-white/65\">{formatOwnerMoney(row.monthlyRecurring)}</td><td className=\"px-4 py-3 text-white/65\">{formatOwnerMoney(row.invoiced)}</td><td className=\"px-4 py-3 text-white/65\">{formatOwnerMoney(row.paid)}</td><td className=\"px-4 py-3 text-white/65\">{formatOwnerMoney(row.outstanding)}</td><td className=\"px-4 py-3 text-white/65\">{formatOwnerMoney(row.overdue)}</td></tr>)}</tbody></table></div>\n    </section> : null}\n  </OwnerWorkspaceShell>;\n}\n","expectedSha":"5df79f7b932b41dd27c3d726b57033960f0dd6ae"},{"path":"src/lib/owner/knockLaunchPortfolioData.ts","content":"import { supabase } from '@/integrations/supabase/client';\n\ntype PortfolioRelationClient = {\n  from: (relation: string) => any;\n};\n\n// These owner/admin portfolio relations are protected by existing RLS and are\n// live in production, but several are newer than the repo's checked-in Database\n// type. Keep the escape hatch isolated to this adapter instead of weakening the\n// canonical Supabase client type across the application.\nconst portfolioDb = supabase as unknown as PortfolioRelationClient;\n\nexport const PORTFOLIO_SALES_STAGES = [\n  'lead',\n  'qualified',\n  'demo_scheduled',\n  'demo_completed',\n  'proposal_sent',\n  'considering',\n  'negotiating',\n  'won',\n  'onboarding',\n  'active_client',\n  'paused',\n  'lost',\n] as const;\n\nexport type PortfolioSalesStage = typeof PORTFOLIO_SALES_STAGES[number];\n\nexport const PORTFOLIO_ONBOARDING_STATUSES = ['not_started','in_progress','waiting_on_client','blocked','done','not_applicable'] as const;\nexport type PortfolioOnboardingStatus = typeof PORTFOLIO_ONBOARDING_STATUSES[number];\nexport type PortfolioOnboardingItemState = {\n  status: PortfolioOnboardingStatus;\n  note?: string;\n  updated_at?: string;\n};\n\nexport const PORTFOLIO_STAGE_LABELS: Record<PortfolioSalesStage, string> = {\n  lead: 'Lead',\n  qualified: 'Qualified',\n  demo_scheduled: 'Demo scheduled',\n  demo_completed: 'Demo completed',\n  proposal_sent: 'Proposal sent',\n  considering: 'Considering',\n  negotiating: 'Negotiating',\n  won: 'Won',\n  onboarding: 'Onboarding',\n  active_client: 'Active client',\n  paused: 'Paused',\n  lost: 'Lost',\n};\n\nexport type PortfolioRelationship = {\n  id?: string;\n  tenant_id: string;\n  relationship_status: string | null;\n  key_contacts?: unknown;\n  last_meaningful_contact_at?: string | null;\n  next_action?: string | null;\n  next_action_due_at?: string | null;\n  notes?: string | null;\n  metadata?: Record<string, unknown> | null;\n  updated_at?: string | null;\n};\n\nexport type PortfolioData = {\n  relationships: PortfolioRelationship[];\n  relationshipProposals: any[];\n  receivables: any[];\n  activitySummary: any[];\n  activityPresence: any[];\n  lastAccess: any[];\n  invoices: any[];\n  readinessChecks: any[];\n  calendarConnections: any[];\n  providerCredentials: any[];\n  mailContinuity: any[];\n  applications: any[];\n  proposalProfiles: any[];\n  proposals: any[];\n  subscriptions: any[];\n  errors: string[];\n};\n\nexport const EMPTY_PORTFOLIO_DATA: PortfolioData = {\n  relationships: [],\n  relationshipProposals: [],\n  receivables: [],\n  activitySummary: [],\n  activityPresence: [],\n  lastAccess: [],\n  invoices: [],\n  readinessChecks: [],\n  calendarConnections: [],\n  providerCredentials: [],\n  mailContinuity: [],\n  applications: [],\n  proposalProfiles: [],\n  proposals: [],\n  subscriptions: [],\n  errors: [],\n};\n\nconst cleanIds = (tenantIds: string[]) => [...new Set(tenantIds.map((id) => String(id || '').trim()).filter(Boolean))];\n\nexport async function loadKnockLaunchPortfolioData(tenantIds: string[]): Promise<PortfolioData> {\n  const ids = cleanIds(tenantIds);\n  if (!ids.length) return EMPTY_PORTFOLIO_DATA;\n\n  const results = await Promise.all([\n    portfolioDb.from('owner_tenant_relationships').select('id,tenant_id,relationship_status,key_contacts,last_meaningful_contact_at,next_action,next_action_due_at,notes,metadata,updated_at').in('tenant_id', ids),\n    portfolioDb.from('owner_relationship_proposals').select('id,relationship_id,tenant_id,title,status,sent_at,viewed_at,accepted_at,declined_at,terms_summary,canonical_proposal_id,updated_at').in('tenant_id', ids),\n    portfolioDb.from('owner_receivables').select('id,relationship_id,tenant_id,earning_lane,currency,gross_basis,collected_basis,expected_amount,earned_amount,paid_amount,due_date,stage,next_action,next_action_due_at,paid_at,updated_at').in('tenant_id', ids),\n    portfolioDb.from('business_tenant_activity_summary').select('tenant_id,tenant_name,activity_count,tracked_contacts,attributed_contacts,last_activity_at,collected_revenue').in('tenant_id', ids),\n    portfolioDb.from('user_activity_presence').select('tenant_id,user_id,current_path,current_label,device_family,last_seen_at').in('tenant_id', ids),\n    portfolioDb.from('v_active_tenant_users').select('tenant_id,user_id,last_accessed_at').in('tenant_id', ids),\n    portfolioDb.from('invoices').select('id,tenant_org_id,amount,status,due_date,paid_at,sent_at,created_at,payment_provider,payment_provider_status,source_proposal_id').in('tenant_org_id', ids),\n    portfolioDb.from('tenant_readiness_checks').select('tenant_id,check_key,status,detail,updated_at').in('tenant_id', ids),\n    portfolioDb.from('calendar_connections').select('id,tenant_id,provider,display_name,status,enabled,read_only,last_synced_at,last_sync_error').in('tenant_id', ids),\n    portfolioDb.from('tenant_provider_credentials').select('id,tenant_id,provider,credential_status,last_verified_at,verification_notes').in('tenant_id', ids),\n    portfolioDb.from('tenant_mail_continuity').select('id,tenant_id,provider_verification_status,mailbox_ready,mail_launched,desired_mode,effective_mode,activation_reason,degraded_since,recovered_at,last_provider_reconciled_at,last_mail_reconciled_at,last_error').in('tenant_id', ids),\n    portfolioDb.from('tenant_applications').select('tenant_id,application_id,enabled,installed_at,bootstrap_version,updated_at').in('tenant_id', ids),\n    portfolioDb.from('proposal_profiles').select('id,tenant_id,profile_key,status,renderer_key,version,updated_at').in('tenant_id', ids),\n    portfolioDb.from('proposals').select('id,tenant_id,status,total_amount,deposit_amount,balance_amount,sent_at,accepted_at,declined_at,paid_at,created_at,updated_at').in('tenant_id', ids),\n    portfolioDb.from('tenant_subscriptions').select('tenant_id,plan_id,status,current_period_start,current_period_end,billing_cycle,seat_count,cancel_at_period_end,updated_at').in('tenant_id', ids),\n  ]);\n\n  const errors: string[] = [];\n  const take = <T,>(label: string, result: any): T[] => {\n    if (result?.error) {\n      errors.push(label + ': ' + String(result.error.message || 'unavailable'));\n      return [];\n    }\n    return Array.isArray(result?.data) ? result.data as T[] : [];\n  };\n\n  return {\n    relationships: take<PortfolioRelationship>('relationships', results[0]),\n    relationshipProposals: take<any>('relationship proposals', results[1]),\n    receivables: take<any>('receivables', results[2]),\n    activitySummary: take<any>('activity summary', results[3]),\n    activityPresence: take<any>('activity presence', results[4]),\n    lastAccess: take<any>('last access', results[5]),\n    invoices: take<any>('invoices', results[6]),\n    readinessChecks: take<any>('readiness checks', results[7]),\n    calendarConnections: take<any>('calendar connections', results[8]),\n    providerCredentials: take<any>('provider credentials', results[9]),\n    mailContinuity: take<any>('mail continuity', results[10]),\n    applications: take<any>('applications', results[11]),\n    proposalProfiles: take<any>('proposal profiles', results[12]),\n    proposals: take<any>('proposals', results[13]),\n    subscriptions: take<any>('subscriptions', results[14]),\n    errors,\n  };\n}\n\nconst stageStatus = (stage: PortfolioSalesStage) => {\n  if (stage === 'paused') return 'paused';\n  if (stage === 'lost') return 'closed';\n  if (stage === 'won' || stage === 'onboarding' || stage === 'active_client') return 'active';\n  return 'prospect';\n};\n\nexport function relationshipStage(relationship?: PortfolioRelationship | null): { stage: PortfolioSalesStage; confirmed: boolean } {\n  const metadata = relationship?.metadata && typeof relationship.metadata === 'object' ? relationship.metadata as Record<string, unknown> : {};\n  const raw = String(metadata.sales_stage || '').trim().toLowerCase();\n  const stage = PORTFOLIO_SALES_STAGES.includes(raw as PortfolioSalesStage)\n    ? raw as PortfolioSalesStage\n    : relationship?.relationship_status === 'paused'\n      ? 'paused'\n      : relationship?.relationship_status === 'closed' || relationship?.relationship_status === 'archived'\n        ? 'lost'\n        : 'lead';\n  return { stage, confirmed: metadata.portfolio_confirmed === true };\n}\n\nexport async function savePortfolioRelationship(input: {\n  tenantId: string;\n  stage: PortfolioSalesStage;\n  nextAction: string;\n  nextActionDueDate: string;\n  estimatedDealValue: number;\n  contractedValue: number;\n  billingCadence: 'none' | 'one_time' | 'weekly' | 'monthly' | 'annual';\n  existing?: PortfolioRelationship | null;\n}) {\n  const previousMetadata = input.existing?.metadata && typeof input.existing.metadata === 'object'\n    ? input.existing.metadata as Record<string, unknown>\n    : {};\n  const metadata = {\n    ...previousMetadata,\n    portfolio_confirmed: true,\n    sales_stage: input.stage,\n    estimated_deal_value: Number.isFinite(input.estimatedDealValue) ? input.estimatedDealValue : 0,\n    contracted_value: Number.isFinite(input.contractedValue) ? input.contractedValue : 0,\n    billing_cadence: input.billingCadence,\n    portfolio_updated_at: new Date().toISOString(),\n  };\n  const due = input.nextActionDueDate\n    ? new Date(input.nextActionDueDate + 'T12:00:00').toISOString()\n    : null;\n  const payload = {\n    tenant_id: input.tenantId,\n    relationship_status: stageStatus(input.stage),\n    next_action: input.nextAction.trim() || null,\n    next_action_due_at: due,\n    metadata,\n    updated_at: new Date().toISOString(),\n  };\n  const { data, error } = await portfolioDb\n    .from('owner_tenant_relationships')\n    .upsert(payload, { onConflict: 'tenant_id' })\n    .select('id,tenant_id,relationship_status,key_contacts,last_meaningful_contact_at,next_action,next_action_due_at,notes,metadata,updated_at')\n    .single();\n  if (error) throw error;\n  return data as PortfolioRelationship;\n}\n\n\nconst onboardingStatusSet = new Set<string>(PORTFOLIO_ONBOARDING_STATUSES);\n\nexport async function savePortfolioOnboardingReadiness(input: {\n  tenantId: string;\n  items: Record<string, PortfolioOnboardingItemState>;\n  existing?: PortfolioRelationship | null;\n}) {\n  const previousMetadata = input.existing?.metadata && typeof input.existing.metadata === 'object'\n    ? input.existing.metadata as Record<string, unknown>\n    : {};\n  const previousOnboarding = previousMetadata.onboarding_readiness && typeof previousMetadata.onboarding_readiness === 'object'\n    ? previousMetadata.onboarding_readiness as Record<string, unknown>\n    : {};\n  const now = new Date().toISOString();\n  const items = Object.fromEntries(Object.entries(input.items || {}).map(([key, value]) => {\n    const raw = value && typeof value === 'object' ? value : ({ status: 'not_started' } as PortfolioOnboardingItemState);\n    const status = onboardingStatusSet.has(String(raw.status)) ? raw.status : 'not_started';\n    return [key, {\n      status,\n      note: String(raw.note || '').trim().slice(0, 600),\n      updated_at: raw.updated_at || now,\n    }];\n  }));\n  const metadata = {\n    ...previousMetadata,\n    onboarding_readiness: {\n      ...previousOnboarding,\n      version: 1,\n      items,\n      updated_at: now,\n    },\n  };\n  const payload = {\n    tenant_id: input.tenantId,\n    relationship_status: input.existing?.relationship_status || 'prospect',\n    metadata,\n    updated_at: now,\n  };\n  const { data, error } = await portfolioDb\n    .from('owner_tenant_relationships')\n    .upsert(payload, { onConflict: 'tenant_id' })\n    .select('id,tenant_id,relationship_status,key_contacts,last_meaningful_contact_at,next_action,next_action_due_at,notes,metadata,updated_at')\n    .single();\n  if (error) throw error;\n  return data as PortfolioRelationship;\n}\n","expectedSha":"6573f4340e0bc019e26a92d5b4eba267de508659"}],"branch":"ai/objective-first-repair-1624bf069219","writes":[],"patches":[],"version":1,"approved":true,"missionId":"1624bf06-9219-4eb4-9af9-892545fbe187","repository":"noel/KnockLaunchOS","commitMessage":"KNOCKLAUNCH OS: add onboarding readiness checklists","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/owner/KnockLaunchPortfolio.tsx","src/lib/owner/knockLaunchPortfolioData.ts"],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"1624bf06-9219-4eb4-9af9-892545fbe187","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/owner/KnockLaunchPortfolio.tsx","src/lib/owner/knockLaunchPortfolioData.ts"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"9acf448b5aae252211211097d898fcd2be8a75c1e2457b977d1db3ee8b345fc0","replayCount":0,"serializedBytes":86526},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:06:59.320919+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:1624bf06-9219-4eb4-9af9-892545fbe187:repository-mutation-intent:9acf448b5aae252211211097d898fcd2be8a75c1e2457b977d1db3ee8b345fc0:0","mission_step_id":"e47b07cb-fd98-484d-9925-42de377e8829","command_center_event_id":"1624bf06-9219-4eb4-9af9-892545fbe187"},{"id":"9bd2f0a8-1efb-46a7-b5d4-fdf6858ad705","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-002d4611fa84","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":51058,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":0,"executorlessWaitMs":24610,"firstUsefulResultAt":"2026-09-29T01:49:24.092Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.61.0-mission-freedom-provider-gateway","prNumber":4077,"terminal":false,"missionId":"002d4611-fa84-4e05-8e1f-3df593076b20","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3811,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":579,"missionSetupMs":347,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":347,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":347,"repositoryMutationMs":3232,"repositoryProviderMs":3232,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":1996,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":347,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1236},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"002d4611-fa84-4e05-8e1f-3df593076b20"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3738,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:49:53.725343+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4077","receipt_type":"execute_mission","idempotency_key":"mission:002d4611-fa84-4e05-8e1f-3df593076b20:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"2cc3bd6c-75a3-477f-979e-b1efbe6b0c88","command_center_event_id":"002d4611-fa84-4e05-8e1f-3df593076b20"},{"id":"4cd89f80-4f39-4f1f-b4ff-7a909a850308","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-002d4611fa84","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":53148,"releaseCount":0,"toolCallCount":4,"repeatedCallCount":0,"executorlessWaitMs":29602,"firstUsefulResultAt":"2026-09-29T01:49:24.092Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":null,"prNumber":4077,"terminal":false,"missionId":"002d4611-fa84-4e05-8e1f-3df593076b20","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"4aa4fd8a98645eb4abb4503e1e073c2f6cee374c","timingsMs":{"prReadinessMs":648,"approvedPlanMs":0,"shipAndProveMs":2661,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"002d4611-fa84-4e05-8e1f-3df593076b20"},"performance":null,"deploymentId":"forgejo-main-4aa4fd8a9864","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1805,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:50:35.671401+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4077","receipt_type":"automatic_mission_resume","idempotency_key":"mission:002d4611-fa84-4e05-8e1f-3df593076b20:automatic-mission-resume:4077:canonical_release_reconciliation_pending","mission_step_id":"c79639d5-294c-442e-99f0-68298ae097a0","command_center_event_id":"002d4611-fa84-4e05-8e1f-3df593076b20"},{"id":"304bd5a8-58a8-4d88-8469-87777945221b","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","frontend-cloudflare/live":"pending"},"mainSha":"4aa4fd8a98645eb4abb4503e1e073c2f6cee374c","missing":[],"pending":["forgejo-release/workflow","frontend-cloudflare/live"],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"4aa4fd8a98645eb4abb4503e1e073c2f6cee374c","releaseState":"pending","sourceInMain":true,"compareStatus":"identical","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{},"requestContractHash":"15fafd345cf3f0f49ac22fc2c022a6e265f5199270ac2b4d173fb2e02e0afb03","forgejoWorkflowProof":{"error":"workflow_run_id_missing","runId":null},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:50:36.575374+00:00","proof_gate":"canonical_release_pending","source_sha":"4aa4fd8a98645eb4abb4503e1e073c2f6cee374c","external_id":"forgejo-main-4aa4fd8a9864","receipt_type":"canonical_release_status","idempotency_key":"mission:002d4611-fa84-4e05-8e1f-3df593076b20:forgejo-release-status:4aa4fd8a98645eb4abb4503e1e073c2f6cee374c:pending:forgejo-main/source=success|forgejo-release/workflow=pending|frontend-cloudflare/live=pending","mission_step_id":"e3b74d63-d2ec-4da7-ad7b-6a11459c8aac","command_center_event_id":"002d4611-fa84-4e05-8e1f-3df593076b20"},{"id":"8a171dea-8c61-44c2-b594-3da8c6274831","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-91a318dd1345","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"91a318dd-1345-4443-8984-a3fcdfe24a7a","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1151,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":424,"providerAuthMs":0,"ledgerPrepareMs":424,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":424,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":424,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"91a318dd-1345-4443-8984-a3fcdfe24a7a"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":4223,"likelyAffectedFiles":["supabase/migrations/20260929015000_pcg_legacy_import_center.sql"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:50:58.947993+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:91a318dd-1345-4443-8984-a3fcdfe24a7a:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"e21635d7-d447-4064-94b0-8469f2a4a9ed","command_center_event_id":"91a318dd-1345-4443-8984-a3fcdfe24a7a"},{"id":"19473de3-c21e-42f1-a6a6-2259b0f80ce3","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-91a318dd1345","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":8194,"releaseCount":0,"toolCallCount":2,"repeatedCallCount":0,"executorlessWaitMs":15731,"firstUsefulResultAt":"2026-09-29T01:50:58.921Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":4078,"terminal":false,"missionId":"91a318dd-1345-4443-8984-a3fcdfe24a7a","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3570,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":548,"missionSetupMs":239,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":239,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":239,"repositoryMutationMs":3022,"repositoryProviderMs":3022,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":1878,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":239,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1144},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"91a318dd-1345-4443-8984-a3fcdfe24a7a"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3279,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T01:51:19.039149+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4078","receipt_type":"execute_mission","idempotency_key":"mission:91a318dd-1345-4443-8984-a3fcdfe24a7a:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"de1d02b3-f9f1-4650-aac4-e43a2e01ecb5","command_center_event_id":"91a318dd-1345-4443-8984-a3fcdfe24a7a"},{"id":"ab852567-493f-43d8-8df9-922387d155b8","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-91a318dd1345","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":10285,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":0,"executorlessWaitMs":20075,"firstUsefulResultAt":"2026-09-29T01:50:58.921Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":null,"prNumber":4078,"terminal":false,"missionId":"91a318dd-1345-4443-8984-a3fcdfe24a7a","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"79548f09bc599ba57396ecf850c3057728c87898","timingsMs":{"prReadinessMs":111,"approvedPlanMs":0,"shipAndProveMs":456,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"91a318dd-1345-4443-8984-a3fcdfe24a7a"},"performance":null,"deploymentId":"forgejo-main-79548f09bc59","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":false,"onrunner":false,"migrations":true,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1924,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:00:05.881255+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4078","receipt_type":"automatic_mission_resume","idempotency_key":"mission:91a318dd-1345-4443-8984-a3fcdfe24a7a:automatic-mission-resume:4078:canonical_release_reconciliation_pending","mission_step_id":"a11f21b7-0eec-4d54-867c-62e3344dd0d3","command_center_event_id":"91a318dd-1345-4443-8984-a3fcdfe24a7a"},{"id":"61a46e59-af25-459d-baee-c99ee5037570","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","supabase-migrations/live":"success"},"mainSha":"79548f09bc599ba57396ecf850c3057728c87898","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","supabase-migrations/live"],"sourceSha":"79548f09bc599ba57396ecf850c3057728c87898","releaseState":"verified","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":false,"onrunner":false,"migrations":true,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"migrations":"success"},"requestContractHash":"6770530d8d869fc36e4e0d2bc54370991e4702c420b5c0b02575cb5ed79770b7","forgejoWorkflowProof":{"url":"https://git.knocklaunch.app/noel/KnockLaunchOS/actions/runs/12838","runId":12838,"status":"success","sourceSha":"79548f09bc599ba57396ecf850c3057728c87898","conclusion":null,"failedJobs":[],"diagnostics":null,"exactSource":true,"targetStates":{"migrations":"success"},"targetJobCount":6,"observedTargetStates":{"migrations":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:00:07.293898+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"79548f09bc599ba57396ecf850c3057728c87898","external_id":"forgejo-main-79548f09bc59","receipt_type":"canonical_release_status","idempotency_key":"mission:91a318dd-1345-4443-8984-a3fcdfe24a7a:forgejo-release-status:79548f09bc599ba57396ecf850c3057728c87898:verified:forgejo-main/source=success|forgejo-release/workflow=success|supabase-migrations/live=success","mission_step_id":"1ea1465e-0bdf-4983-b5e5-60967a538c26","command_center_event_id":"91a318dd-1345-4443-8984-a3fcdfe24a7a"},{"id":"4df71dd9-304a-4c07-a2dc-e05e57a7c197","source":"durable-mission-ledger","status":"verified","payload":{"sourceSha":"79548f09bc599ba57396ecf850c3057728c87898","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"staging-ledger","satisfied":true,"statement":"PCG has durable tenant-scoped import batch and row staging tables that preserve raw source, normalized data, duplicate/import decisions, counts, and canonical links.","proofConditionIds":["schema-live"]},{"id":"safe-dry-run","satisfied":true,"statement":"The staging schema supports dry-run/review workflows without mutating existing PCG cards or submissions.","proofConditionIds":["schema-live"]}],"satisfied":true,"constraints":[{"id":"additive","satisfied":true,"statement":"Schema is additive only and does not modify existing PCG card or submission rows.","proofConditionIds":["schema-live"]},{"id":"tenant-rls","satisfied":true,"statement":"Both tables use tenant-scoped RLS equivalent to existing PCG tables.","proofConditionIds":["schema-live"]},{"id":"no-visual","satisfied":true,"statement":"No visual proof is required for this schema-only change.","proofConditionIds":["schema-live"]},{"id":"capability-completeness","satisfied":true,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["schema-live"]},{"id":"atomic-capability-lifecycle","satisfied":true,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["schema-live"]}],"contractHash":"6770530d8d869fc36e4e0d2bc54370991e4702c420b5c0b02575cb5ed79770b7","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"schema-live","kind":"runtime","evidence":{"reason":null,"satisfied":true,"releaseState":"verified","missingTargets":[],"disallowedTargets":[],"migrationRequired":false,"releaseTargetStates":{"migrations":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["migrations"],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"migrationReleaseVerified":null,"releaseRequestContractHash":"6770530d8d869fc36e4e0d2bc54370991e4702c420b5c0b02575cb5ed79770b7"},"required":true,"satisfied":true}],"validationErrors":[],"pendingProofKinds":[],"activeReleaseTargets":["migrations"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:00:08.920547+00:00","proof_gate":"request_contract_terminal_verified","source_sha":"79548f09bc599ba57396ecf850c3057728c87898","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:91a318dd-1345-4443-8984-a3fcdfe24a7a:request-contract:6770530d8d869fc36e4e0d2bc54370991e4702c420b5c0b02575cb5ed79770b7:79548f09bc599ba57396ecf850c3057728c87898:verified:","mission_step_id":"1ea1465e-0bdf-4983-b5e5-60967a538c26","command_center_event_id":"91a318dd-1345-4443-8984-a3fcdfe24a7a"},{"id":"311afbd9-775b-473a-b434-c3d1e8f86ece","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[{"path":"supabase/functions/pcg-legacy-import/index.ts","content":"import {serve} from \"https://deno.land/std@0.190.0/http/server.ts\";\nimport {createClient} from \"https://esm.sh/@supabase/supabase-js@2.45.0\";\n\nexport const FUNCTION_VERSION=\"1.0.0-pcg-legacy-import\";\nconst SUPABASE_URL=Deno.env.get(\"SUPABASE_URL\")||\"\";\nconst SERVICE_ROLE=Deno.env.get(\"SUPABASE_SERVICE_ROLE_KEY\")||\"\";\nconst cors={\"Access-Control-Allow-Origin\":\"*\",\"Access-Control-Allow-Headers\":\"authorization, content-type, x-client-info, apikey\",\"Access-Control-Allow-Methods\":\"GET, POST, OPTIONS\"};\nconst json=(body:unknown,status=200)=>new Response(JSON.stringify(body),{status,headers:{...cors,\"Content-Type\":\"application/json\",\"Cache-Control\":\"no-store\"}});\nconst clean=(value:unknown)=>String(value??\"\").trim();\nconst numberValue=(value:unknown)=>{const text=clean(value).replace(/[$,]/g,\"\");if(!text)return null;const n=Number(text);return Number.isFinite(n)?n:null};\nconst intValue=(value:unknown)=>{const n=numberValue(value);return n==null?null:Math.trunc(n)};\nconst boolValue=(value:unknown)=>{const text=clean(value).toLowerCase();if(!text)return null;if([\"1\",\"true\",\"yes\",\"y\",\"autograph\",\"signed\"].includes(text))return true;if([\"0\",\"false\",\"no\",\"n\"].includes(text))return false;return null};\nconst keyName=(value:string)=>value.toLowerCase().replace(/[^a-z0-9]+/g,\"\");\nconst bytesToHex=(bytes:Uint8Array)=>Array.from(bytes).map(value=>value.toString(16).padStart(2,\"0\")).join(\"\");\nasync function sha256(value:string){return bytesToHex(new Uint8Array(await crypto.subtle.digest(\"SHA-256\",new TextEncoder().encode(value))))}\nconst SOURCE_TYPES=new Set([\"csv\",\"website\",\"google_drive\",\"manual\"]);\n\nfunction rawIndex(raw:Record<string,unknown>){const out=new Map<string,unknown>();for(const[key,value]of Object.entries(raw||{}))out.set(keyName(key),value);return out}\nfunction mapped(raw:Record<string,unknown>,mapping:Record<string,unknown>,canonical:string,aliases:string[]){\n  const direct=clean(mapping?.[canonical]);\n  if(direct&&Object.prototype.hasOwnProperty.call(raw,direct))return raw[direct];\n  const index=rawIndex(raw);\n  if(direct&&index.has(keyName(direct)))return index.get(keyName(direct));\n  for(const alias of aliases){const value=index.get(keyName(alias));if(value!==undefined&&clean(value)!==\"\")return value}\n  return null;\n}\nfunction normalizeRow(raw:Record<string,unknown>,mapping:Record<string,unknown>){\n  const v=(name:string,aliases:string[])=>mapped(raw,mapping,name,aliases);\n  const normalized:Record<string,unknown>={\n    cert_number:clean(v(\"cert_number\",[\"cert\",\"cert number\",\"certificate\",\"certificate number\",\"certification\",\"certification number\",\"pcg number\",\"pcg #\",\"pcg#\"])),\n    year:clean(v(\"year\",[\"year\"])),\n    brand_set:clean(v(\"brand_set\",[\"set\",\"brand\",\"brand set\",\"set name\",\"product\"])),\n    player_character:clean(v(\"player_character\",[\"player\",\"athlete\",\"subject\",\"character\",\"player name\",\"name\"])),\n    card_number:clean(v(\"card_number\",[\"card number\",\"card #\",\"card#\",\"card no\",\"card_no\"])),\n    variation:clean(v(\"variation\",[\"variation\",\"variant\",\"parallel\"])),\n    grade:numberValue(v(\"grade\",[\"grade\",\"numeric grade\",\"final grade\"])),\n    grade_label:clean(v(\"grade_label\",[\"grade label\",\"condition\",\"grade name\"])),\n    category:clean(v(\"category\",[\"category\",\"sport\",\"type\"])),\n    declared_value:numberValue(v(\"declared_value\",[\"declared value\",\"value\",\"estimated value\"])),\n    card_description:clean(v(\"card_description\",[\"description\",\"card description\",\"title\"])),\n    autograph_present:boolValue(v(\"autograph_present\",[\"autograph\",\"auto\",\"signed\"])),\n    population_count:intValue(v(\"population_count\",[\"population\",\"pop\",\"pop count\",\"population count\"])),\n    front_image_url:clean(v(\"front_image_url\",[\"front image\",\"front image url\",\"front_image_url\",\"image\",\"image url\"])),\n    back_image_url:clean(v(\"back_image_url\",[\"back image\",\"back image url\",\"back_image_url\"])),\n    slab_image_url:clean(v(\"slab_image_url\",[\"slab image\",\"slab image url\",\"slab_image_url\",\"graded image\"])),\n    submission_number:clean(v(\"submission_number\",[\"submission\",\"submission number\",\"order\",\"order number\",\"invoice\",\"invoice number\"])),\n    customer_name:clean(v(\"customer_name\",[\"customer\",\"customer name\",\"collector\",\"collector name\"])),\n    customer_email:clean(v(\"customer_email\",[\"email\",\"customer email\",\"collector email\"])),\n    customer_phone:clean(v(\"customer_phone\",[\"phone\",\"customer phone\",\"collector phone\"])),\n    external_key:clean(v(\"external_key\",[\"id\",\"legacy id\",\"external id\",\"record id\",\"item id\"])),\n    source_url:clean(v(\"source_url\",[\"url\",\"page url\",\"source url\",\"legacy url\",\"product url\"])),\n    legacy_created_at:clean(v(\"legacy_created_at\",[\"created at\",\"date\",\"created\",\"graded date\",\"date graded\"]))\n  };\n  for(const[key,value]of Object.entries(normalized))if(value===\"\"||value===null)delete normalized[key];\n  return normalized;\n}\nasync function stableImportKey(batch:any,normalized:Record<string,unknown>,rowNumber:number){\n  const cert=clean(normalized.cert_number).toLowerCase();\n  if(cert)return\"legacy:cert:\"+cert;\n  const external=clean(normalized.external_key).toLowerCase();\n  if(external)return\"legacy:\"+clean(batch.source_type).toLowerCase()+\":external:\"+external;\n  const identity=[\n    clean(normalized.year).toLowerCase(),clean(normalized.brand_set).toLowerCase(),clean(normalized.player_character).toLowerCase(),\n    clean(normalized.card_number).toLowerCase(),clean(normalized.variation).toLowerCase(),clean(normalized.grade),\n    clean(normalized.source_url).toLowerCase()\n  ].join(\"|\");\n  if(identity.replace(/\\|/g,\"\"))return\"legacy:fingerprint:\"+await sha256(identity);\n  return\"legacy:batch:\"+batch.id+\":row:\"+rowNumber;\n}\nasync function requirePcgOwner(req:Request,admin:any,tenantId:string){\n  const auth=clean(req.headers.get(\"Authorization\"));if(!auth.startsWith(\"Bearer \"))return{ok:false as const,status:401,error:\"Please sign in again.\"};\n  const{data,error}=await admin.auth.getUser(auth.slice(7));if(error||!data.user?.id)return{ok:false as const,status:401,error:\"Please sign in again.\"};\n  const userId=data.user.id;\n  const[{data:systemAdmin},{data:membership},{data:tenant,error:tenantError}]=await Promise.all([\n    admin.rpc(\"is_system_admin\",{_user_id:userId}),\n    admin.from(\"security_active_user_tenant_memberships\").select(\"is_owner,status\").eq(\"user_id\",userId).eq(\"tenant_id\",tenantId).maybeSingle(),\n    admin.from(\"tenants\").select(\"company_slug,name,settings\").eq(\"id\",tenantId).maybeSingle()\n  ]);\n  if(tenantError)throw tenantError;\n  const slug=clean(tenant?.company_slug).toLowerCase(),settings=(tenant?.settings||{}) as Record<string,unknown>;\n  const isPcg=slug===\"pcg\"||slug===\"prestigious-card-grading\"||clean(settings.routing_family).toUpperCase()===\"CARD_GRADING_OPS\"||clean(settings.workspace_type).toLowerCase()===\"card_grading\"||clean(tenant?.name).toLowerCase().includes(\"prestigious card grading\");\n  if(!isPcg)return{ok:false as const,status:403,error:\"This migration tool is reserved for the PCG workspace.\"};\n  if(systemAdmin===true||membership?.status===\"active\"&&membership?.is_owner===true)return{ok:true as const,userId};\n  return{ok:false as const,status:403,error:\"PCG migration requires the tenant owner or a platform administrator.\"};\n}\nasync function getBatch(admin:any,batchId:string){\n  const{data,error}=await admin.from(\"pcg_import_batches\").select(\"*\").eq(\"id\",batchId).maybeSingle();if(error)throw error;if(!data)throw new Error(\"Migration batch not found.\");return data\n}\nasync function counts(admin:any,batchId:string){\n  const totalQ=admin.from(\"pcg_import_rows\").select(\"id\",{count:\"exact\",head:true}).eq(\"batch_id\",batchId);\n  const validQ=admin.from(\"pcg_import_rows\").select(\"id\",{count:\"exact\",head:true}).eq(\"batch_id\",batchId).eq(\"validation_status\",\"valid\");\n  const dupQ=admin.from(\"pcg_import_rows\").select(\"id\",{count:\"exact\",head:true}).eq(\"batch_id\",batchId).eq(\"validation_status\",\"duplicate\");\n  const reviewQ=admin.from(\"pcg_import_rows\").select(\"id\",{count:\"exact\",head:true}).eq(\"batch_id\",batchId).eq(\"validation_status\",\"review\");\n  const errorQ=admin.from(\"pcg_import_rows\").select(\"id\",{count:\"exact\",head:true}).eq(\"batch_id\",batchId).eq(\"validation_status\",\"error\");\n  const importedQ=admin.from(\"pcg_import_rows\").select(\"id\",{count:\"exact\",head:true}).eq(\"batch_id\",batchId).not(\"canonical_card_id\",\"is\",null);\n  const[t,v,d,r,e,i]=await Promise.all([totalQ,validQ,dupQ,reviewQ,errorQ,importedQ]);\n  for(const item of[t,v,d,r,e,i])if(item.error)throw item.error;\n  return{total_rows:t.count||0,valid_rows:v.count||0,duplicate_rows:d.count||0,review_rows:r.count||0,error_rows:e.count||0,imported_rows:i.count||0}\n}\nasync function refreshBatch(admin:any,batchId:string,status?:string){\n  const c=await counts(admin,batchId);const patch:any={...c,updated_at:new Date().toISOString()};if(status)patch.status=status;\n  const{data,error}=await admin.from(\"pcg_import_batches\").update(patch).eq(\"id\",batchId).select(\"*\").single();if(error)throw error;return data\n}\nasync function createBatch(admin:any,tenantId:string,userId:string,body:any){\n  const sourceType=clean(body.source_type).toLowerCase();if(!SOURCE_TYPES.has(sourceType))return json({ok:false,error:\"Choose csv, website, google_drive, or manual as the migration source.\"},400);\n  const fingerprint=clean(body.source_fingerprint);\n  if(fingerprint){const{data:existing}=await admin.from(\"pcg_import_batches\").select(\"*\").eq(\"tenant_id\",tenantId).eq(\"source_fingerprint\",fingerprint).neq(\"status\",\"cancelled\").order(\"created_at\",{ascending:false}).limit(1).maybeSingle();if(existing)return json({ok:true,batch:existing,deduped:true})}\n  const{data,error}=await admin.from(\"pcg_import_batches\").insert({tenant_id:tenantId,source_type:sourceType,source_label:clean(body.source_label)||null,source_url:clean(body.source_url)||null,status:\"draft\",dry_run:true,source_fingerprint:fingerprint||null,mapping:body.mapping&&typeof body.mapping===\"object\"?body.mapping:{},summary:{},created_by:userId}).select(\"*\").single();\n  if(error)throw error;return json({ok:true,batch:data,deduped:false})\n}\nasync function stageRows(admin:any,batch:any,body:any){\n  const rows=Array.isArray(body.rows)?body.rows:[];if(!rows.length)return json({ok:false,error:\"No migration rows were supplied.\"},400);if(rows.length>500)return json({ok:false,error:\"Stage at most 500 rows per request.\"},400);\n  const start=Math.max(1,Number(body.start_row)||1),mapping=(batch.mapping||{}) as Record<string,unknown>;\n  const staged=await Promise.all(rows.map(async(rawValue:any,index:number)=>{const raw=rawValue&&typeof rawValue===\"object\"&&!Array.isArray(rawValue)?rawValue:{};const rowNumber=start+index;const normalized=normalizeRow(raw,mapping);const importKey=await stableImportKey(batch,normalized,rowNumber);return{batch_id:batch.id,tenant_id:batch.tenant_id,row_number:rowNumber,external_key:clean(normalized.external_key)||null,import_key:importKey,source_url:clean(normalized.source_url)||null,raw_payload:raw,normalized_payload:normalized,validation_status:\"pending\",planned_action:\"pending\",canonical_submission_id:null,canonical_card_id:null,error_text:null,updated_at:new Date().toISOString()}}));\n  const{error}=await admin.from(\"pcg_import_rows\").upsert(staged,{onConflict:\"batch_id,row_number\"});if(error)throw error;\n  const refreshed=await refreshBatch(admin,batch.id,\"analyzing\");return json({ok:true,batch:refreshed,staged:staged.length,next_row:start+staged.length})\n}\nasync function analyzeBatch(admin:any,batch:any,body:any){\n  const start=Math.max(1,Number(body.start_row)||1),limit=Math.min(500,Math.max(1,Number(body.limit)||500));\n  const{data:rows,error}=await admin.from(\"pcg_import_rows\").select(\"*\").eq(\"batch_id\",batch.id).gte(\"row_number\",start).order(\"row_number\",{ascending:true}).limit(limit);if(error)throw error;\n  if(!rows?.length){const refreshed=await refreshBatch(admin,batch.id,\"ready\");return json({ok:true,batch:refreshed,done:true,next_row:start})}\n  const certs=[...new Set(rows.map((row:any)=>clean(row.normalized_payload?.cert_number)).filter(Boolean))];\n  const keys=[...new Set(rows.map((row:any)=>clean(row.import_key)).filter(Boolean))];\n  const certMap=new Map<string,string>(),keyMap=new Map<string,string>();\n  if(certs.length){const{data,error:cardError}=await admin.from(\"card_grading_cards\").select(\"id,cert_number\").eq(\"tenant_id\",batch.tenant_id).in(\"cert_number\",certs);if(cardError)throw cardError;for(const card of cardError?[]:(data||[]))certMap.set(clean(card.cert_number),card.id)}\n  if(keys.length){const{data,error:cardError}=await admin.from(\"card_grading_cards\").select(\"id,import_key\").eq(\"tenant_id\",batch.tenant_id).in(\"import_key\",keys);if(cardError)throw cardError;for(const card of cardError?[]:(data||[]))keyMap.set(clean(card.import_key),card.id)}\n  const updates=rows.map((row:any)=>{const n=row.normalized_payload||{},cert=clean(n.cert_number),existing=cert&&certMap.get(cert)||keyMap.get(clean(row.import_key))||null;let validation=\"valid\",action=\"create\",errorText=null;\n    const identity=Boolean(cert||clean(n.external_key)||clean(n.player_character)&&(clean(n.year)||clean(n.brand_set)||clean(n.card_number)));\n    if(existing){validation=\"duplicate\";action=\"skip_duplicate\"}\n    else if(!identity){validation=\"review\";action=\"review\";errorText=\"Needs cert/external ID or enough card identity (player plus year, set, or card number).\"}\n    return{...row,validation_status:validation,planned_action:action,canonical_card_id:existing,error_text:errorText,updated_at:new Date().toISOString()}\n  });\n  const{error:upsertError}=await admin.from(\"pcg_import_rows\").upsert(updates,{onConflict:\"id\"});if(upsertError)throw upsertError;\n  const next=Number(rows[rows.length-1].row_number)+1;\n  const{count:remaining,error:remainError}=await admin.from(\"pcg_import_rows\").select(\"id\",{count:\"exact\",head:true}).eq(\"batch_id\",batch.id).eq(\"validation_status\",\"pending\");if(remainError)throw remainError;\n  const refreshed=await refreshBatch(admin,batch.id,(remaining||0)===0?\"ready\":\"analyzing\");return json({ok:true,batch:refreshed,done:(remaining||0)===0,next_row:next,analyzed:rows.length})\n}\nasync function ensureArchiveSubmission(admin:any,batch:any,normalized:any,cache:Map<string,string>){\n  const requested=clean(normalized.submission_number),key=requested||\"__batch__\";if(cache.has(key))return cache.get(key)!;\n  const submissionNumber=requested||(\"MIG-\"+batch.id.slice(0,8).toUpperCase());\n  const{data:existing,error:findError}=await admin.from(\"card_grading_submissions\").select(\"id\").eq(\"tenant_id\",batch.tenant_id).eq(\"submission_number\",submissionNumber).maybeSingle();if(findError)throw findError;\n  if(existing?.id){cache.set(key,existing.id);return existing.id}\n  const createdAt=clean(normalized.legacy_created_at);const receivedAt=createdAt&&!Number.isNaN(Date.parse(createdAt))?new Date(createdAt).toISOString():new Date().toISOString();\n  const{data,error}=await admin.from(\"card_grading_submissions\").insert({tenant_id:batch.tenant_id,submission_number:submissionNumber,customer_name:clean(normalized.customer_name)||\"Legacy PCG Database\",customer_email:clean(normalized.customer_email)||null,customer_phone:clean(normalized.customer_phone)||null,service_tier:\"inventory\",service_price:0,expected_card_count:0,status:\"picked_up\",payment_status:\"waived\",delivery_method:\"pickup\",notes:\"Legacy migration: \"+(clean(batch.source_label)||batch.id),received_at:receivedAt,due_at:receivedAt}).select(\"id\").single();if(error)throw error;cache.set(key,data.id);return data.id\n}\nasync function commitBatch(admin:any,batch:any,body:any){\n  if(clean(body.confirm)!==\"IMPORT\")return json({ok:false,error:\"Type IMPORT to confirm canonical migration writes.\"},409);\n  if(![\"ready\",\"importing\",\"completed_with_errors\"].includes(clean(batch.status)))return json({ok:false,error:\"Analyze the migration batch before committing it.\"},409);\n  const limit=Math.min(100,Math.max(1,Number(body.limit)||100));\n  const{data:rows,error}=await admin.from(\"pcg_import_rows\").select(\"*\").eq(\"batch_id\",batch.id).eq(\"validation_status\",\"valid\").eq(\"planned_action\",\"create\").is(\"canonical_card_id\",null).order(\"row_number\",{ascending:true}).limit(limit);if(error)throw error;\n  if(!rows?.length){const c=await counts(admin,batch.id);const status=c.error_rows||c.review_rows?\"completed_with_errors\":\"completed\";const refreshed=await refreshBatch(admin,batch.id,status);return json({ok:true,batch:refreshed,done:true,committed:0})}\n  await admin.from(\"pcg_import_batches\").update({status:\"importing\",dry_run:false,updated_at:new Date().toISOString()}).eq(\"id\",batch.id);\n  const submissionCache=new Map<string,string>(),touched=new Set<string>();let committed=0,duplicates=0;\n  for(const row of rows){const n=row.normalized_payload||{},cert=clean(n.cert_number),importKey=clean(row.import_key);\n    let existing:any=null;\n    if(cert){const q=await admin.from(\"card_grading_cards\").select(\"id,submission_id\").eq(\"tenant_id\",batch.tenant_id).eq(\"cert_number\",cert).maybeSingle();if(q.error)throw q.error;existing=q.data}\n    if(!existing&&importKey){const q=await admin.from(\"card_grading_cards\").select(\"id,submission_id\").eq(\"tenant_id\",batch.tenant_id).eq(\"import_key\",importKey).maybeSingle();if(q.error)throw q.error;existing=q.data}\n    if(existing?.id){await admin.from(\"pcg_import_rows\").update({validation_status:\"duplicate\",planned_action:\"skip_duplicate\",canonical_card_id:existing.id,canonical_submission_id:existing.submission_id,error_text:null,updated_at:new Date().toISOString()}).eq(\"id\",row.id);duplicates++;continue}\n    const submissionId=await ensureArchiveSubmission(admin,batch,n,submissionCache);touched.add(submissionId);\n    const metadata:any={legacy_import:{batch_id:batch.id,row_id:row.id,source_type:batch.source_type,source_label:batch.source_label||null,source_url:row.source_url||null,external_key:row.external_key||null}};\n    if(clean(n.front_image_url)||clean(n.back_image_url)||clean(n.slab_image_url))metadata.image_storage=\"legacy_external\";\n    const payload:any={tenant_id:batch.tenant_id,submission_id:submissionId,sequence_number:Number(n.sequence_number)||Number(row.row_number)||1,cert_number:cert||null,category:clean(n.category)||null,year:clean(n.year)||null,brand_set:clean(n.brand_set)||null,player_character:clean(n.player_character)||null,card_number:clean(n.card_number)||null,variation:clean(n.variation)||null,declared_value:numberValue(n.declared_value),grade:numberValue(n.grade),grade_label:clean(n.grade_label)||null,status:\"picked_up\",front_image_url:clean(n.front_image_url)||null,back_image_url:clean(n.back_image_url)||null,slab_image_url:clean(n.slab_image_url)||null,grader_notes:null,population_count:intValue(n.population_count),import_key:importKey,metadata,is_demo:false,card_description:clean(n.card_description)||null,autograph_present:boolValue(n.autograph_present)};\n    const{data:card,error:cardError}=await admin.from(\"card_grading_cards\").insert(payload).select(\"id\").single();if(cardError)throw cardError;\n    await admin.from(\"pcg_import_rows\").update({canonical_submission_id:submissionId,canonical_card_id:card.id,error_text:null,updated_at:new Date().toISOString()}).eq(\"id\",row.id);committed++\n  }\n  for(const submissionId of touched){const[{count,error:countError},{data:sub,error:subError}]=await Promise.all([admin.from(\"card_grading_cards\").select(\"id\",{count:\"exact\",head:true}).eq(\"tenant_id\",batch.tenant_id).eq(\"submission_id\",submissionId),admin.from(\"card_grading_submissions\").select(\"expected_card_count\").eq(\"tenant_id\",batch.tenant_id).eq(\"id\",submissionId).single()]);if(countError)throw countError;if(subError)throw subError;const actual=count||0;if(actual>Number(sub.expected_card_count||0)){const u=await admin.from(\"card_grading_submissions\").update({expected_card_count:actual,updated_at:new Date().toISOString()}).eq(\"id\",submissionId);if(u.error)throw u.error}}\n  const{count:remaining,error:remainingError}=await admin.from(\"pcg_import_rows\").select(\"id\",{count:\"exact\",head:true}).eq(\"batch_id\",batch.id).eq(\"validation_status\",\"valid\").eq(\"planned_action\",\"create\").is(\"canonical_card_id\",null);if(remainingError)throw remainingError;\n  const c=await counts(admin,batch.id);const status=(remaining||0)>0?\"importing\":(c.error_rows||c.review_rows?\"completed_with_errors\":\"completed\");const refreshed=await refreshBatch(admin,batch.id,status);\n  return json({ok:true,batch:refreshed,done:(remaining||0)===0,committed,duplicates})\n}\nasync function batchStatus(admin:any,batch:any,body:any){\n  const start=Math.max(1,Number(body.start_row)||1),limit=Math.min(100,Math.max(1,Number(body.limit)||25));\n  const{data,error}=await admin.from(\"pcg_import_rows\").select(\"*\").eq(\"batch_id\",batch.id).gte(\"row_number\",start).order(\"row_number\",{ascending:true}).limit(limit);if(error)throw error;return json({ok:true,batch,rows:data||[],next_row:data?.length?Number(data[data.length-1].row_number)+1:start})\n}\n\nserve(async req=>{\n  if(req.method===\"OPTIONS\")return new Response(null,{headers:cors});\n  const url=new URL(req.url);if(req.method===\"GET\"&&url.pathname.endsWith(\"/health\"))return json({ok:true,service:\"pcg-legacy-import\",version:FUNCTION_VERSION,phases:[\"stage\",\"analyze\",\"commit\"],commit_confirmation:\"IMPORT\",max_stage_rows:500,max_commit_rows:100});\n  if(req.method!==\"POST\")return json({ok:false,error:\"Method not allowed\"},405);\n  const admin=createClient(SUPABASE_URL,SERVICE_ROLE);\n  try{\n    const body=await req.json().catch(()=>({})),action=clean(body.action),tenantId=clean(body.tenant_id);\n    if(!tenantId)return json({ok:false,error:\"tenant_id is required.\"},400);\n    const auth=await requirePcgOwner(req,admin,tenantId);if(!auth.ok)return json({ok:false,error:auth.error},auth.status);\n    if(action===\"create_batch\")return createBatch(admin,tenantId,auth.userId,body);\n    const batchId=clean(body.batch_id);if(!batchId)return json({ok:false,error:\"batch_id is required.\"},400);\n    const batch=await getBatch(admin,batchId);if(batch.tenant_id!==tenantId)return json({ok:false,error:\"Migration batch tenant mismatch.\"},403);\n    if(action===\"stage_rows\")return stageRows(admin,batch,body);\n    if(action===\"analyze_batch\")return analyzeBatch(admin,batch,body);\n    if(action===\"commit_batch\")return commitBatch(admin,batch,body);\n    if(action===\"batch_status\")return batchStatus(admin,batch,body);\n    return json({ok:false,error:\"Unknown migration action.\"},400);\n  }catch(error){console.error(\"[pcg-legacy-import]\",error);return json({ok:false,error:error instanceof Error?error.message:\"PCG migration failed.\"},500)}\n});\n"},{"path":"supabase/config.toml","content":"project_id = \"ymntrajfubicyxwwdxxa\"\n\n[functions]\n  [functions.console-ops]\n    # Session and current platform-admin authority are checked inside the function.\n    verify_jwt = false\n  [functions.qr-suite]\n    verify_jwt = false\n  [functions.owner-seo-audit]\n    # Private Knock Launch OS owner tool. The function validates the bearer and requires the authenticated user to match the fixed personal tenant owner_id before scanning the fixed hostname allowlist.\n    verify_jwt = false\n  [functions.owner-search-console]\n    # Private Knock Launch OS owner Search Console tool. OAuth/data authorization is enforced in-function against the fixed personal tenant owner and fixed web-property allowlist.\n    verify_jwt = false\n  [functions.activity-timeline]\n    verify_jwt = false\n  [functions.admin]\n    verify_jwt = true\n  [functions.admin-create-user]\n    verify_jwt = true\n  [functions.admin-impersonate]\n    verify_jwt = true\n  [functions.admin-leads]\n    verify_jwt = true\n  [functions.admin-operations]\n    verify_jwt = true\n  [functions.admin-reset-password]\n    verify_jwt = false\n  [functions.admin-status]\n    verify_jwt = true\n  [functions.admin-tenant-preview]\n    verify_jwt = true\n  [functions.admin-tenant-mode-image-upload]\n    # Authenticated MODES media mutation. The function validates the Bearer JWT and tenant authority in-function before service-role writes.\n    verify_jwt = false\n  [functions.aerial-orders]\n    verify_jwt = true\n  [functions.agreement-sign]\n    verify_jwt = false\n  [functions.agreements]\n    verify_jwt = true\n  [functions.analytics-engine]\n    verify_jwt = false\n  [functions.ai-respond]\n    verify_jwt = false\n  [functions.auto-unlock-document-scan]\n    # Public 321 Auto Unlock document scan. The function rate-limits and only returns confidence-gated intake fields; it performs no database or storage writes.\n    verify_jwt = false\n  [functions.auto-unlock-intake]\n    # Public 321 Auto Unlock intake. Server-validates identity/authority selections, creates an awaiting-signature request, and prepares the existing KnockLaunch e-sign agreement.\n    verify_jwt = false\n  [functions.whatsmyprogress-waitlist]\n    # Public WhatsMyProgress.com launch waitlist. The function enforces allowed origins, validation, rate limits, dedupe, and fixed tenant binding internally.\n    verify_jwt = false\n  [functions.roof-damage-analysis]\n    # Authenticated tenant-user inspection analysis. The function validates the bearer and tenant membership internally before service-role reads or writes.\n    verify_jwt = false\n  [functions.cc-agent]\n    verify_jwt = false\n  [functions.cc-tools]\n    verify_jwt = false\n  [functions.cc-action-logs]\n    verify_jwt = false\n  [functions.cc-deploy-request]\n    verify_jwt = false\n  [functions.cc-deploy-controller]\n    verify_jwt = false\n  [functions.cc-notify-owner]\n    verify_jwt = false\n  [functions.command-center-autopilot]\n    verify_jwt = false\n  [functions.apopka-search]\n    verify_jwt = false\n  [functions.appointments-operations]\n    verify_jwt = false\n  [functions.audit-fix-leads]\n    verify_jwt = true\n  [functions.auth-email-hook]\n    verify_jwt = false\n  [functions.auth-login]\n    verify_jwt = false\n  [functions.auth-operations]\n    verify_jwt = false\n  [functions.background-enrich]\n    verify_jwt = false\n  [functions.batch-document-upload]\n    # Authenticated tenant-scoped upload. Function additionally proves active membership/role\n    # before using service-role storage/database writes.\n    verify_jwt = true\n  [functions.batch-photo-commit]\n    verify_jwt = false\n  [functions.brevard-bass-search]\n    verify_jwt = false\n  [functions.bulk-enrich-permits]\n    verify_jwt = false\n  [functions.bulk-geocode]\n    verify_jwt = false\n  [functions.calls]\n    verify_jwt = true\n  [functions.calls-manage]\n    verify_jwt = false\n  [functions.call-session-status]\n    verify_jwt = false\n  [functions.initiate-call]\n    # Authenticated CRM click-to-call. The function also validates the bearer token internally.\n    verify_jwt = true\n  [functions.canvassing-doors]\n    verify_jwt = true\n  [functions.cape-canaveral-bsa-search]\n    verify_jwt = false\n  [functions.check-global-pool]\n    verify_jwt = true\n  [functions.claim-global-lead]\n    verify_jwt = true\n  [functions.claim-lead]\n    verify_jwt = true\n  [functions.clermont-energov-search]\n    verify_jwt = false\n  [functions.cocoa-beach-opengov-search]\n    verify_jwt = false\n  [functions.cocoa-citizenserve-search]\n    verify_jwt = false\n  [functions.communication-hub]\n    verify_jwt = false\n  [functions.communication-setup-request]\n    # Authenticated workspace setup request. The function re-validates the bearer and tenant membership before service-role writes.\n    verify_jwt = true\n  [functions.compile-leads]\n    verify_jwt = false\n  [functions.config-manage]\n    verify_jwt = true\n  [functions.contacts]\n    # Contacts validates Supabase user JWTs or exact single-use Capability Layer leases in-function.\n    verify_jwt = false\n  [functions.calendar-domain]\n    # Native Calendar validates Supabase user JWTs or exact single-use Capability Layer leases in-function.\n    verify_jwt = false\n  [functions.crm-ai]\n    verify_jwt = false\n  [functions.customer-portal]\n    verify_jwt = false\n  [functions.shared-claims]\n    # Cross-tenant claim collaboration requires an authenticated bearer JWT.\n    verify_jwt = true\n  [functions.daytona-beach-ims-search]\n    verify_jwt = false\n  [functions.deland-accela-search]\n    verify_jwt = false\n  [functions.deltona-citizenserve-search]\n    verify_jwt = false\n  [functions.dialogue-operations]\n    verify_jwt = false\n  [functions.dnc-operations]\n    verify_jwt = false\n  [functions.documents]\n    verify_jwt = false\n  [functions.document-request-public]\n    verify_jwt = false\n  [functions.lawn-care-service-request]\n    # Public customer intake. The function performs its own validation and only\n    # writes through the service-role client after resolving an active tenant.\n    verify_jwt = false\n  [functions.mobile-vendor-event-request]\n    # Public event intake. The function validates required fields and resolves\n    # an active mobile-vendor tenant before any service-role write.\n    verify_jwt = false\n  [functions.entertainment-fanbase]\n    # Mixed auth: public fan join is validated in-function; owner/admin cockpit actions\n    # authenticate the bearer and prove tenant authority before service-role access.\n    verify_jwt = false\n  [functions.mobile-vendor-growth]\n    # Public club join/unsubscribe are validated in-function; owner loyalty and\n    # campaign actions authenticate the bearer and prove tenant authority.\n    verify_jwt = false\n  [functions.mobile-vendor-loyalty-member]\n    # Customer OTP/session actions self-authorize with hashed member sessions;\n    # owner review actions authenticate bearer and tenant authority in-function.\n    verify_jwt = false\n  [functions.mobile-vendor-email-intelligence]\n    # Provider-agnostic inbound email ingestion. The function authenticates a\n    # provider webhook secret or a tenant bearer token before service-role access.\n    verify_jwt = false\n  [functions.opportunity-radar]\n    # The function performs its own bearer/service authorization and exposes\n    # an anonymous /health endpoint for canonical runtime proof.\n    verify_jwt = false\n  [functions.drive-import]\n    verify_jwt = true\n  [functions.drive-operations]\n    verify_jwt = false\n  [functions.drive-sync]\n    verify_jwt = true\n  [functions.duplicate-management]\n    verify_jwt = false\n  [functions.edgewater-bsa-search]\n    verify_jwt = false\n  [functions.emergency-reset]\n    verify_jwt = false\n  [functions.extract-for-contact]\n    verify_jwt = false\n  [functions.field-operations]\n    verify_jwt = false\n  [functions.fill-pdf-form]\n    verify_jwt = true\n  [functions.flagler-beach-bsa-search]\n    verify_jwt = false\n  [functions.followups-operations]\n    verify_jwt = false\n  [functions.fort-pierce-legacy-arcgis]\n    verify_jwt = false\n  [functions.gas-proxy]\n    verify_jwt = true\n  [functions.generate-roof-report]\n    verify_jwt = true\n  [functions.generate-pa-claim-review]\n    # Authenticated PA report generation. The function validates the bearer token,\n    # tenant membership, and feature entitlement internally before service-role access.\n    verify_jwt = false\n  [functions.geocode]\n    verify_jwt = false\n  [functions.global-unassigned-leads]\n    verify_jwt = true\n  [functions.health-check]\n    verify_jwt = false\n  [functions.import-noaa-storms]\n    verify_jwt = false\n  [functions.ims-search]\n    verify_jwt = false\n  [functions.indian-river-search]\n    verify_jwt = false\n  [functions.invoices]\n    verify_jwt = true\n  [functions.jobs]\n    verify_jwt = true\n  [functions.kissimmee-accela-search]\n    verify_jwt = false\n  [functions.lakeland-accela-search]\n    verify_jwt = false\n  [functions.lead-auto-repair]\n    verify_jwt = true\n  [functions.lead-bulk-cleanup]\n    verify_jwt = true\n  [functions.lead-duplicate-detection]\n    verify_jwt = true\n  [functions.lead-quality-scan]\n    verify_jwt = true\n  [functions.leads]\n    verify_jwt = true\n  [functions.leads-add]\n    verify_jwt = false\n  [functions.leads-claim]\n    verify_jwt = false\n  [functions.leads-list]\n    verify_jwt = false\n  [functions.leads-outcome]\n    verify_jwt = false\n  [functions.leesburg-etrakit-search]\n    verify_jwt = false\n  [functions.marion-county-energov-search]\n    verify_jwt = false\n  [functions.mark-document-request-uploaded]\n    verify_jwt = false\n  [functions.melbourne-energov-search]\n    verify_jwt = false\n  [functions.new-smyrna-beach-energov-search]\n    verify_jwt = false\n  [functions.ocala-energov-search]\n    verify_jwt = false\n  [functions.ormond-beach-energov-search]\n    verify_jwt = false\n  [functions.palm-coast-energov-search]\n    verify_jwt = false\n  [functions.parse-hail-intel]\n    verify_jwt = false\n  [functions.permits-import]\n    verify_jwt = false\n  [functions.photos]\n    verify_jwt = true\n  [functions.tenant-photo-studio]\n    verify_jwt = false\n  [functions.pipeline-automation]\n    verify_jwt = false\n  [functions.pipelines-manage]\n    verify_jwt = true\n  [functions.port-orange-smartgov-search]\n    verify_jwt = false\n  [functions.process-email-queue]\n    verify_jwt = true\n  [functions.process-lead-batch]\n    verify_jwt = true\n  [functions.property-discovery]\n    verify_jwt = false\n  [functions.property-enrichment]\n    verify_jwt = false\n  [functions.property-lookup]\n    verify_jwt = true\n  [functions.recent-storms-in-bounds]\n    verify_jwt = false\n  [functions.release-lead]\n    verify_jwt = true\n  [functions.repair-unassigned-pool]\n    verify_jwt = true\n  [functions.rockledge-bsa-search]\n    verify_jwt = false\n  [functions.roof-ai-detection]\n    verify_jwt = false\n  [functions.roof-edge-detection]\n    verify_jwt = false\n  [functions.roof-estimator]\n    verify_jwt = false\n  [functions.roof-operations]\n    verify_jwt = false\n  [functions.satellite-beach-bsa-search]\n    verify_jwt = false\n  [functions.scrape-spc-storms]\n    verify_jwt = false\n  [functions.security-operations]\n    # Mixed public/private security endpoint: anonymous access is restricted in-function to\n    # login lockout telemetry; all session, alert, permission, and admin actions authenticate\n    # the bearer and enforce self/tenant/platform scope before service-role access.\n    verify_jwt = false\n  [functions.seminole-parcel-sync]\n    verify_jwt = false\n  [functions.seminole-search]\n    verify_jwt = false\n  [functions.send-email]\n    verify_jwt = true\n  [functions.self-serve-demo]\n    # Public demo discovery/capture. Bounds website scanning, rejects private-network targets, and never provisions production tenants or executes outbound automation.\n    verify_jwt = false\n  [functions.submit-demo-request]\n    # Public intake validates and rate-limits input in-function; all privileged writes use the service role server-side.\n    verify_jwt = false\n  [functions.zoho-mail]\n    # OAuth callback is public; all tenant actions authenticate the bearer and tenant authority inside the function.\n    verify_jwt = false\n  [functions.capability-router]\n    # Capability Router authenticates Supabase user JWTs and verified cc-execution bearers in-function so delegated execution can reach its lease gate.\n    verify_jwt = false\n  [functions.application-api]\n    # Application API supports public catalog/customer-token reads plus tenant-user and delegated Command Center execution; authorization is enforced in-function.\n    verify_jwt = false\n  [functions.mail360]\n    # Legacy function retained only for rollback history; active tenant email uses zoho-mail.\n    verify_jwt = true\n  [functions.pcg-google-drive-media]\n    # Mixed access: upload requires an authenticated tenant member; signed image GET/HEAD validates an HMAC and PCG Drive ownership in-function.\n    verify_jwt = false\n\n  [functions.pcg-legacy-import]\n    # PCG owner/admin migration tool. Bearer authentication, PCG tenant identity, dry-run staging, and explicit commit confirmation are enforced in-function.\n    verify_jwt = false\n\n  [functions.pcg-commerce-webhook]\n    # PCG commerce provider callbacks authenticate with a dedicated high-entropy channel secret in-function.\n    verify_jwt = false\n  [functions.mail360-webhook]\n    # Mail360 provider callbacks authenticate with the dedicated high-entropy webhook secret in-function.\n    verify_jwt = false\n  [functions.send-invitation]\n    verify_jwt = false\n  [functions.accept-invitation]\n    # Public inspection is token-scoped; acceptance validates the bearer JWT inside the function.\n    verify_jwt = false\n  [functions.send-sms]\n    verify_jwt = true\n  [functions.sequence-executor]\n    verify_jwt = false\n  [functions.signup-manage]\n    verify_jwt = false\n  [functions.sms-webhook]\n    verify_jwt = false\n  [functions.st-augustine-energov-search]\n    verify_jwt = false\n  [functions.st-cloud-etrakit-search]\n    verify_jwt = false\n  [functions.st-johns-county-energov-search]\n    verify_jwt = false\n  [functions.storm-data-proxy]\n    verify_jwt = false\n  [functions.storm-lookup]\n    verify_jwt = false\n  [functions.tenant-context]\n    # Authenticated tenant-context lookup; live runtime already enforces gateway JWT.\n    verify_jwt = true\n  [functions.tenant-manage]\n    verify_jwt = true\n  [functions.tenant-search]\n    verify_jwt = false\n  [functions.territory-tools]\n    verify_jwt = true\n  [functions.titusville-bsa-search]\n    verify_jwt = false\n  [functions.unified-enrich]\n    verify_jwt = false\n  [functions.universal-extractor]\n    verify_jwt = false\n  [functions.user-roles-manage]\n    verify_jwt = true\n  [functions.user-whoami]\n    verify_jwt = true\n  [functions.verify-admin]\n    verify_jwt = false\n  [functions.view-config-manage]\n    verify_jwt = true\n  [functions.web-search-storms]\n    verify_jwt = false\n  [functions.west-melbourne-bsa-search]\n    verify_jwt = false\n  [functions.winter-haven-energov-search]\n    verify_jwt = false\n  [functions.workflows]\n    verify_jwt = true\n  [functions.workflows-manage]\n    verify_jwt = true\n  [functions.workspace-operations]\n    verify_jwt = false\n  [functions.send-transactional-email]\n    verify_jwt = true\n  [functions.preview-transactional-email]\n    verify_jwt = false\n  [functions.handle-email-unsubscribe]\n    verify_jwt = false\n  [functions.handle-email-suppression]\n    verify_jwt = false\n  [functions.academy-roleplay]\n    verify_jwt = true\n  [functions.academy-sync-from-workflow]\n    verify_jwt = true\n  [functions.create-checkout]\n    verify_jwt = false\n  [functions.get-stripe-price]\n    verify_jwt = false\n  [functions.payments-webhook]\n    verify_jwt = false\n  [functions.finance-reports]\n    # Mixed auth: owner/admin actions validate the Supabase bearer in-function;\n    # scheduled dispatch validates the existing cc-execution machine bearer.\n    verify_jwt = false\n  [functions.finance-square]\n    # Square OAuth callback and payment webhook are public provider callbacks;\n    # owner actions authenticate the bearer and tenant authority inside the function.\n    verify_jwt = false\n  [functions.tenant-provider-connections]\n    # OAuth callbacks are public provider redirects; every tenant action validates\n    # the bearer and tenant owner/platform-admin authority inside the function.\n    verify_jwt = false\n\n  [functions.integrations-health]\n    verify_jwt = false\n  [functions.provision-trial-user]\n    # Legacy one-shot provisioning is restricted to signed-in platform admins.\n    verify_jwt = true\n  [functions.get-shared-storm-report]\n    verify_jwt = false\n  [functions.send-storm-report]\n    verify_jwt = true\n  [functions.twilio-amd-webhook]\n    verify_jwt = false\n  [functions.twilio-voice-webhook]\n    verify_jwt = false\n  [functions.twilio-recording-webhook]\n    verify_jwt = false\n  [functions.twilio-voicemail-webhook]\n    verify_jwt = false\n  [functions.twilio-sms-inbound-webhook]\n    verify_jwt = false\n  [functions.twilio-transcription-webhook]\n    verify_jwt = false\n  [functions.twilio-media-stream]\n    verify_jwt = false\n  [functions.compliance-daily-audit]\n    verify_jwt = false\n  [functions.twiml-bridge-confirm]\n    verify_jwt = false\n  [functions.twiml-transfer-target]\n    verify_jwt = false\n  [functions.twilio-transfer]\n    verify_jwt = true\n  [functions.twilio-transfer-complete]\n    verify_jwt = true\n  [functions.twiml-supervise]\n    verify_jwt = false\n  [functions.twilio-supervise]\n    verify_jwt = true\n  [functions.twiml-inbound-router]\n    verify_jwt = false\n  [functions.twiml-inbound-router-fallback]\n    verify_jwt = false\n  [functions.twiml-ivr-handle]\n    verify_jwt = false\n  [functions.twiml-ring-group]\n    verify_jwt = false\n  [functions.queue-callback-dispatch]\n    verify_jwt = true\n  [functions.twiml-voicemail-box]\n    verify_jwt = false\n  [functions.voicemail-recording-callback]\n    verify_jwt = false\n  [functions.analyze-voicemail]\n    verify_jwt = false\n  [functions.analyze-call-recording]\n    verify_jwt = false\n  [functions.twilio-browser-token]\n    verify_jwt = true\n  [functions.twiml-browser-dial]\n    verify_jwt = false\n  [functions.pa-lor-webhook]","expectedSha":"9262f374d249ded9e95e7b7d95a73f5398fe59cb"}],"branch":"ai/objective-first-repair-677188ce7da4","writes":[],"patches":[],"version":1,"approved":true,"missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f","repository":"noel/KnockLaunchOS","commitMessage":"PCG: add safe legacy migration engine","ownerApproved":true,"releaseIntent":null,"sourceTargets":["supabase/functions/pcg-legacy-import/index.ts","supabase/config.toml"],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f","ownerApproved":true,"releaseIntent":null,"sourceTargets":["supabase/functions/pcg-legacy-import/index.ts","supabase/config.toml"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"b7d84c50abee53f2e7ceb10b7929c448dd6cc7f8b1760ddbd0d913e187da4184","replayCount":0,"serializedBytes":43339},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:09:32.475729+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:repository-mutation-intent:b7d84c50abee53f2e7ceb10b7929c448dd6cc7f8b1760ddbd0d913e187da4184:0","mission_step_id":"8f2ff1ec-189e-4fe6-9d42-afd33bbff305","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"6df0361c-df40-4474-b3b5-8736c16d7790","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-1624bf069219","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"1624bf06-9219-4eb4-9af9-892545fbe187","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1513,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":544,"providerAuthMs":0,"ledgerPrepareMs":544,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":544,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":544,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"1624bf06-9219-4eb4-9af9-892545fbe187"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":4902,"likelyAffectedFiles":["src/pages/owner/KnockLaunchPortfolio.tsx","src/lib/owner/knockLaunchPortfolioData.ts"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:05:10.147292+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:1624bf06-9219-4eb4-9af9-892545fbe187:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"c3c00e90-986b-4a67-b56b-195220384315","command_center_event_id":"1624bf06-9219-4eb4-9af9-892545fbe187"},{"id":"7b8aad2f-d3b5-42f3-8d62-c82d6deafaea","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","frontend-cloudflare/live":"success"},"mainSha":"79548f09bc599ba57396ecf850c3057728c87898","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"4aa4fd8a98645eb4abb4503e1e073c2f6cee374c","releaseState":"verified","sourceInMain":true,"compareStatus":"known_exact_protected_main_push_history","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"frontend":"success"},"requestContractHash":"15fafd345cf3f0f49ac22fc2c022a6e265f5199270ac2b4d173fb2e02e0afb03","forgejoWorkflowProof":{"url":"https://git.knocklaunch.app/noel/KnockLaunchOS/actions/runs/12836","runId":12836,"status":"success","sourceSha":"4aa4fd8a98645eb4abb4503e1e073c2f6cee374c","conclusion":null,"failedJobs":[],"diagnostics":null,"exactSource":true,"targetStates":{"frontend":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:06:02.118728+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"4aa4fd8a98645eb4abb4503e1e073c2f6cee374c","external_id":"forgejo-main-4aa4fd8a9864","receipt_type":"canonical_release_status","idempotency_key":"mission:002d4611-fa84-4e05-8e1f-3df593076b20:forgejo-release-status:4aa4fd8a98645eb4abb4503e1e073c2f6cee374c:verified:forgejo-main/source=success|forgejo-release/workflow=success|frontend-cloudflare/live=success","mission_step_id":"677855e2-4c4a-4bf6-91d8-10392821734e","command_center_event_id":"002d4611-fa84-4e05-8e1f-3df593076b20"},{"id":"4a7a3f6c-8ea9-40ec-adf6-4c2cab257c43","source":"durable-mission-ledger","status":"verified","payload":{"sourceSha":"4aa4fd8a98645eb4abb4503e1e073c2f6cee374c","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"outcome-1","satisfied":true,"statement":"MODIFY AND DEPLOY src/pages/crm/PcgWorkspace.tsx for Prestigious Card Grading. Replace the 100-card client limit with 100000; use the live card_grading_submissions.expected_card_count field; creating a new grading submission must insert expected_card_count and MUST NOT create placeholder card_grading_cards rows; display actual ingested cards versus expected cards when different; calculate expected grading value from expected_card_count while preserving old orders by falling back to actual card rows. Do not touch any other tenant or file. Preserve existing status, payment, and grading behavior. No Visual Witness. Open one focused PR, pass Gate, squash merge, frontend release, runtime proof.","proofConditionIds":["proof-production"]}],"satisfied":true,"constraints":[{"id":"visual-content-truth","satisfied":true,"statement":"Do not present invented names, metrics, prices, dates, services, testimonials, credentials, customer records, or other unknown business facts as real. Omit unknowns or mark them clearly as placeholder/example content.","proofConditionIds":["proof-production"]},{"id":"tenant-visual-isolation","satisfied":true,"statement":"Visual work is isolated to requested tenant. Do not import another tenant's logo, colors, imagery, copy, shell, customer data, business facts, or visual identity unless explicitly requested.","proofConditionIds":["proof-production"]},{"id":"reference-visual-fidelity","satisfied":true,"statement":"The approved reference owns the material visual composition: hierarchy, major geometry, typography scale, spacing rhythm, image placement/crop, color treatment, radii, shadows/glow, and overall density. Material deviation is a failed visual acceptance, not a stylistic reinterpretation.","proofConditionIds":["proof-production"]},{"id":"responsive-visual-continuity","satisfied":true,"statement":"Responsive adaptation may reflow for the target viewport, but it must preserve information hierarchy, branding, functionality, and design language. It must not invent a second design.","proofConditionIds":["proof-production"]},{"id":"reference-visual-authority","satisfied":true,"statement":"The supplied or approved reference visual is immutable acceptance evidence. Generating another mockup, image, or concept cannot satisfy this implementation request; completion requires source implementation, deployment, and reference-matched visual proof.","proofConditionIds":["proof-production"]},{"id":"capability-completeness","satisfied":true,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["proof-production"]},{"id":"atomic-capability-lifecycle","satisfied":true,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["proof-production"]}],"contractHash":"15fafd345cf3f0f49ac22fc2c022a6e265f5199270ac2b4d173fb2e02e0afb03","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"proof-production","kind":"runtime","evidence":{"reason":null,"satisfied":true,"releaseState":"verified","missingTargets":[],"disallowedTargets":[],"migrationRequired":false,"releaseTargetStates":{"frontend":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend"],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"migrationReleaseVerified":null,"releaseRequestContractHash":"15fafd345cf3f0f49ac22fc2c022a6e265f5199270ac2b4d173fb2e02e0afb03"},"required":true,"satisfied":true}],"validationErrors":[],"pendingProofKinds":[],"activeReleaseTargets":["frontend"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:06:03.699219+00:00","proof_gate":"request_contract_terminal_verified","source_sha":"4aa4fd8a98645eb4abb4503e1e073c2f6cee374c","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:002d4611-fa84-4e05-8e1f-3df593076b20:request-contract:15fafd345cf3f0f49ac22fc2c022a6e265f5199270ac2b4d173fb2e02e0afb03:4aa4fd8a98645eb4abb4503e1e073c2f6cee374c:verified:","mission_step_id":"677855e2-4c4a-4bf6-91d8-10392821734e","command_center_event_id":"002d4611-fa84-4e05-8e1f-3df593076b20"},{"id":"540758f5-7abc-4da9-9df6-6cf532219f05","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-1624bf069219","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":88571,"releaseCount":0,"toolCallCount":2,"repeatedCallCount":0,"executorlessWaitMs":109088,"firstUsefulResultAt":"2026-09-29T02:05:10.105Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":4079,"terminal":false,"missionId":"1624bf06-9219-4eb4-9af9-892545fbe187","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":4061,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":630,"missionSetupMs":282,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":282,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":282,"repositoryMutationMs":3431,"repositoryProviderMs":3431,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":2140,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":282,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1291},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"1624bf06-9219-4eb4-9af9-892545fbe187"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3367,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:07:04.554166+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4079","receipt_type":"execute_mission","idempotency_key":"mission:1624bf06-9219-4eb4-9af9-892545fbe187:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"e47b07cb-fd98-484d-9925-42de377e8829","command_center_event_id":"1624bf06-9219-4eb4-9af9-892545fbe187"},{"id":"3830d5e7-9f27-4a92-847a-700569dbf59a","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-1624bf069219","reason":"retryable_provider_transport:forgejo_provider_read_timeout","status":"retryable","metrics":{"receiptBytes":95386,"releaseCount":0,"toolCallCount":6,"repeatedCallCount":2,"executorlessWaitMs":206133,"firstUsefulResultAt":"2026-09-29T02:05:10.105Z","recoveryAttemptCount":3,"ownerInterruptionCount":0},"version":null,"prNumber":4079,"terminal":false,"missionId":"1624bf06-9219-4eb4-9af9-892545fbe187","operation":"automatic_mission_resume","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"prReadinessMs":5582,"approvedPlanMs":0,"shipAndProveMs":0,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"1624bf06-9219-4eb4-9af9-892545fbe187"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":819,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:07:12.936966+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4079","receipt_type":"automatic_mission_resume","idempotency_key":"mission:1624bf06-9219-4eb4-9af9-892545fbe187:automatic-mission-resume:4079:repair_mission_pr_ready_retryable","mission_step_id":"638875aa-76dc-47fb-876b-9d841aaf4022","command_center_event_id":"1624bf06-9219-4eb4-9af9-892545fbe187"},{"id":"a1d7013d-2b60-4dc9-b3d6-8e8c96f5dcec","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-677188ce7da4","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1148,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":378,"providerAuthMs":0,"ledgerPrepareMs":378,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":378,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":378,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":4612,"likelyAffectedFiles":["supabase/functions/pcg-legacy-import/index.ts","supabase/config.toml"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:07:41.208918+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"bd4b52a4-718b-4ce1-ad2b-3fcc793bfad7","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"57863bd3-7b04-4d62-a5a2-894a3d8964ba","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-677188ce7da4","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":50623,"releaseCount":0,"toolCallCount":5,"repeatedCallCount":1,"executorlessWaitMs":353162,"firstUsefulResultAt":"2026-09-29T02:07:41.155Z","recoveryAttemptCount":2,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":4080,"terminal":false,"missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":5923,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":4053,"missionSetupMs":422,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":318,"ledgerReconcileMs":0,"lineageReconcileMs":104,"resolvePreflightMs":422,"repositoryMutationMs":1870,"repositoryProviderMs":1870,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":1706,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":318,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":164},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3457,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:09:37.036539+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4080","receipt_type":"execute_mission","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"8f2ff1ec-189e-4fe6-9d42-afd33bbff305","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"93e0a8c1-641d-49ae-a6e6-cb2594b7c523","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-b5ecb59b331d","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1971,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":375,"providerAuthMs":0,"ledgerPrepareMs":375,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":375,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":375,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":4504,"likelyAffectedFiles":["src/pages/card-grading/PCGLegacyMigrationCenter.tsx","src/pages/crm/PcgWorkspace.tsx"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:10:01.556282+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"aba47ebd-7ed3-4669-a237-34d83d7aca39","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"b91bf016-ff11-4849-a4bf-4a57af8a9429","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-1624bf069219","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":96966,"releaseCount":0,"toolCallCount":7,"repeatedCallCount":3,"executorlessWaitMs":212432,"firstUsefulResultAt":"2026-09-29T02:05:10.105Z","recoveryAttemptCount":4,"ownerInterruptionCount":0},"version":null,"prNumber":4079,"terminal":false,"missionId":"1624bf06-9219-4eb4-9af9-892545fbe187","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","timingsMs":{"prReadinessMs":606,"approvedPlanMs":0,"shipAndProveMs":2588,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"1624bf06-9219-4eb4-9af9-892545fbe187"},"performance":null,"deploymentId":"forgejo-main-21eccb4cf1ec","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1859,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:10:38.583968+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4079","receipt_type":"automatic_mission_resume","idempotency_key":"mission:1624bf06-9219-4eb4-9af9-892545fbe187:automatic-mission-resume:4079:canonical_release_reconciliation_pending","mission_step_id":"638875aa-76dc-47fb-876b-9d841aaf4022","command_center_event_id":"1624bf06-9219-4eb4-9af9-892545fbe187"},{"id":"5ee938e6-b5f2-4b8a-8b6a-ef4dccd9ba98","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","frontend-cloudflare/live":"pending"},"mainSha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","missing":[],"pending":["forgejo-release/workflow","frontend-cloudflare/live"],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","releaseState":"pending","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"frontend":"pending"},"requestContractHash":"b53dadfbacbc7b8632957dae6648e21a359ba93580f29acdaaf713f05f1a627d","forgejoWorkflowProof":{"url":"https://git.knocklaunch.app/noel/KnockLaunchOS/actions/runs/12841","runId":12841,"status":"running","sourceSha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","conclusion":null,"failedJobs":[],"diagnostics":null,"exactSource":true,"targetStates":{"frontend":"pending"},"targetJobCount":6,"observedTargetStates":{"frontend":"pending"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:10:39.426103+00:00","proof_gate":"canonical_release_pending","source_sha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","external_id":"forgejo-main-21eccb4cf1ec","receipt_type":"canonical_release_status","idempotency_key":"mission:1624bf06-9219-4eb4-9af9-892545fbe187:forgejo-release-status:21eccb4cf1ecb1834b549d0284ab490547afbc08:pending:forgejo-main/source=success|forgejo-release/workflow=pending|frontend-cloudflare/live=pending","mission_step_id":"eed05614-2a12-4427-b8ee-3e1d1c99c458","command_center_event_id":"1624bf06-9219-4eb4-9af9-892545fbe187"},{"id":"76248177-a2b8-4576-8717-1a3b18cac628","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-b5ecb59b331d","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":65392,"releaseCount":0,"toolCallCount":2,"repeatedCallCount":0,"executorlessWaitMs":124636,"firstUsefulResultAt":"2026-09-29T02:10:01.516Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":4081,"terminal":false,"missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":4470,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":838,"missionSetupMs":272,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":272,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":272,"repositoryMutationMs":3632,"repositoryProviderMs":3632,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":2299,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":272,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1333},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3880,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:12:11.68556+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4081","receipt_type":"execute_mission","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"8f7d34f6-a629-488d-b8b9-511186443688","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"006d50df-ca2f-4c25-9a8f-081c0ec674d1","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-b5ecb59b331d","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":67485,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":0,"executorlessWaitMs":130138,"firstUsefulResultAt":"2026-09-29T02:10:01.516Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":null,"prNumber":4081,"terminal":false,"missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","timingsMs":{"prReadinessMs":624,"approvedPlanMs":0,"shipAndProveMs":2538,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},"performance":null,"deploymentId":"forgejo-main-2cca7e306141","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1859,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:13:41.490725+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4081","receipt_type":"automatic_mission_resume","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:automatic-mission-resume:4081:canonical_release_reconciliation_pending","mission_step_id":"bfdb73a4-899f-44b4-bb2b-30bea26a09a9","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"105abbaf-fc1a-40e5-b1a9-2d9472387117","source":"durable-mission-ledger","status":"verified","payload":{"sourceSha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"outcome-1","satisfied":true,"statement":"MODIFY AND DEPLOY the KNOCKLAUNCH OS owner portfolio so every business prospect/client dossier has a persistent onboarding and migration readiness checklist. Scope only src/pages/owner/KnockLaunchPortfolio.tsx and src/lib/owner/knockLaunchPortfolioData.ts. Persist owner-controlled checklist state inside owner_tenant_relationships.metadata without a schema change, preserving all existing metadata and relationship fields. Checklist statuses: not started, in progress, waiting on client, blocked, done, not applicable, with optional notes. Cover Commercial & authority, Access & source systems, Data migration, KNOCKLAUNCH workspace, Website/domain cutover, Customer experience, and Launch/handoff. Prefill sensible system-derived defaults from existing portfolio facts for workspace/branding/routes/apps/public surfaces/connections while still showing the underlying system signal. In each tenant dossier show completion percentage, done/remaining/waiting/blocked counts, grouped editable steps, notes, and one Save onboarding button. In the fleet portfolio directory and readiness matrix show onboarding progress and blockers so the owner can see all prospects at a glance. Add onboarding blockers","proofConditionIds":["proof-production"]}],"satisfied":true,"constraints":[{"id":"capability-completeness","satisfied":true,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["proof-production"]},{"id":"atomic-capability-lifecycle","satisfied":true,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["proof-production"]}],"contractHash":"b53dadfbacbc7b8632957dae6648e21a359ba93580f29acdaaf713f05f1a627d","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"proof-production","kind":"runtime","evidence":{"reason":null,"satisfied":true,"releaseState":"verified","missingTargets":[],"disallowedTargets":[],"migrationRequired":false,"releaseTargetStates":{"frontend":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend"],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"migrationReleaseVerified":null,"releaseRequestContractHash":"b53dadfbacbc7b8632957dae6648e21a359ba93580f29acdaaf713f05f1a627d"},"required":true,"satisfied":true}],"validationErrors":[],"pendingProofKinds":[],"activeReleaseTargets":["frontend"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:16:37.369617+00:00","proof_gate":"request_contract_terminal_verified","source_sha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:1624bf06-9219-4eb4-9af9-892545fbe187:request-contract:b53dadfbacbc7b8632957dae6648e21a359ba93580f29acdaaf713f05f1a627d:21eccb4cf1ecb1834b549d0284ab490547afbc08:verified:","mission_step_id":"1feb62f4-58ca-4361-953d-6657a18f7b26","command_center_event_id":"1624bf06-9219-4eb4-9af9-892545fbe187"},{"id":"973f2865-062e-487f-be6c-e10e8eb80f1d","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-677188ce7da4","reason":"retryable_provider_transport:forgejo_provider_read_timeout","status":"retryable","metrics":{"receiptBytes":54287,"releaseCount":0,"toolCallCount":7,"repeatedCallCount":3,"executorlessWaitMs":476340,"firstUsefulResultAt":"2026-09-29T02:07:41.155Z","recoveryAttemptCount":3,"ownerInterruptionCount":0},"version":null,"prNumber":4080,"terminal":false,"missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f","operation":"automatic_mission_resume","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"prReadinessMs":5706,"approvedPlanMs":0,"shipAndProveMs":0,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":819,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:13:23.022609+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4080","receipt_type":"automatic_mission_resume","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:automatic-mission-resume:4080:repair_mission_pr_ready_retryable","mission_step_id":"808dc78e-8f7b-45c0-b928-2e58eda54df5","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"6ba168c4-60f8-4b51-b343-b3a01a22eda6","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-b5ecb59b331d","prNumber":4081,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:15:46.389583+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","external_id":"4081","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:merged-pr:4081:2cca7e306141de4a073e900e3bf8f03ab85667f7","mission_step_id":"6bc3e1f7-d76c-476d-96bd-6933957008f1","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"a6a0051c-edfc-4691-abce-227c06a4fccc","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","frontend-cloudflare/live":"pending"},"mainSha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","missing":[],"pending":["forgejo-release/workflow","frontend-cloudflare/live"],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","releaseState":"pending","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"frontend":"pending"},"requestContractHash":"f61c40bba61eac0c0b882af116764393e8901d7b435a9d51e28dc8408b1a511c","forgejoWorkflowProof":{"runId":12844,"source":"signed_push_receipt","status":"running","results":{},"conclusion":"running","targetStates":{"frontend":"pending"},"targetJobCount":6,"observedTargetStates":{"frontend":"pending"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:13:42.491261+00:00","proof_gate":"canonical_release_pending","source_sha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","external_id":"forgejo-main-2cca7e306141","receipt_type":"canonical_release_status","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:forgejo-release-status:2cca7e306141de4a073e900e3bf8f03ab85667f7:pending:forgejo-main/source=success|forgejo-release/workflow=pending|frontend-cloudflare/live=pending","mission_step_id":"6bc3e1f7-d76c-476d-96bd-6933957008f1","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"2116b98c-0336-4941-97bf-42499639586d","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-1624bf069219","prNumber":4079,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:16:35.170758+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","external_id":"4079","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:1624bf06-9219-4eb4-9af9-892545fbe187:merged-pr:4079:21eccb4cf1ecb1834b549d0284ab490547afbc08","mission_step_id":"eed05614-2a12-4427-b8ee-3e1d1c99c458","command_center_event_id":"1624bf06-9219-4eb4-9af9-892545fbe187"},{"id":"e67cd5c2-e7e1-4e73-98e7-2961ebb92385","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","frontend-cloudflare/live":"success"},"mainSha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","releaseState":"verified","sourceInMain":true,"compareStatus":"known_exact_protected_main_push_history","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"frontend":"success"},"requestContractHash":"b53dadfbacbc7b8632957dae6648e21a359ba93580f29acdaaf713f05f1a627d","forgejoWorkflowProof":{"runId":12841,"source":"signed_push_receipt","status":"success","results":{},"conclusion":"success","targetStates":{"frontend":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:16:35.974714+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"21eccb4cf1ecb1834b549d0284ab490547afbc08","external_id":"forgejo-main-21eccb4cf1ec","receipt_type":"canonical_release_status","idempotency_key":"mission:1624bf06-9219-4eb4-9af9-892545fbe187:forgejo-release-status:21eccb4cf1ecb1834b549d0284ab490547afbc08:verified:forgejo-main/source=success|forgejo-release/workflow=success|frontend-cloudflare/live=success","mission_step_id":"1feb62f4-58ca-4361-953d-6657a18f7b26","command_center_event_id":"1624bf06-9219-4eb4-9af9-892545fbe187"},{"id":"7603b321-19f8-4318-a77a-08f9c3258ad6","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-677188ce7da4","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":55867,"releaseCount":0,"toolCallCount":8,"repeatedCallCount":4,"executorlessWaitMs":482976,"firstUsefulResultAt":"2026-09-29T02:07:41.155Z","recoveryAttemptCount":4,"ownerInterruptionCount":0},"version":null,"prNumber":4080,"terminal":false,"missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","timingsMs":{"prReadinessMs":123,"approvedPlanMs":0,"shipAndProveMs":365,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},"performance":null,"deploymentId":"forgejo-main-d4b2db0be2ef","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":false,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-legacy-import"]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1998,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:17:24.377959+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4080","receipt_type":"automatic_mission_resume","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:automatic-mission-resume:4080:canonical_release_reconciliation_pending","mission_step_id":"808dc78e-8f7b-45c0-b928-2e58eda54df5","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"3ae3e62f-54c7-4725-a323-d299d102d124","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","supabase-edge-production/live":"pending"},"mainSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","missing":[],"pending":["forgejo-release/workflow","supabase-edge-production/live"],"required":["forgejo-main/source","forgejo-release/workflow","supabase-edge-production/live"],"sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","releaseState":"pending","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":false,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-legacy-import"]},"releaseTargetStates":{"supabaseEdge":"pending"},"requestContractHash":"2437d519393d3cb10abffad249fe6e346f32090611cf64b5a2b3f070d266309a","forgejoWorkflowProof":{"runId":12847,"source":"signed_push_receipt","status":"waiting","results":{},"conclusion":"waiting","targetStates":{"supabaseEdge":"pending"},"targetJobCount":6,"observedTargetStates":{"supabaseEdge":"pending"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:17:25.416949+00:00","proof_gate":"canonical_release_pending","source_sha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","external_id":"forgejo-main-d4b2db0be2ef","receipt_type":"canonical_release_status","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:forgejo-release-status:d4b2db0be2ef7626e4592ce173519923aa0fd7dc:pending:forgejo-main/source=success|forgejo-release/workflow=pending|supabase-edge-production/live=pending","mission_step_id":"573dc526-0df7-4dc2-b890-f4d1cd933106","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"45c8690e-a986-46b5-b11b-b897fc430fc9","source":"durable-mission-ledger","status":"pending","payload":{"sourceSha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"outcome-1","satisfied":false,"statement":"Add a production PCG Legacy Migration Center UI to the existing PCG Settings surface. Create src/pages/card-grading/PCGLegacyMigrationCenter.tsx and integrate it under the PCG settings tab in src/pages/crm/PcgWorkspace.tsx. The UI must accept CSV files, parse quoted CSV safely in-browser, compute a SHA-256 source fingerprint, create/reuse a migration batch through pcg-legacy-import, stage rows in chunks, run chunked analysis to completion, show batch history and reconciliation counts (source, valid, duplicates, review, errors, imported), show a normalized preview including cert/year/set/player/card/grade and planned action, and require typing IMPORT before chunked commit. It must clearly explain that upload/analyze is a dry run and canonical writes happen only on explicit commit. It must preserve old source/image URLs and state that master image copying to Anthony's Google Drive is a separate prerequisite-backed migration step. PCG only, no other tenant changes, no Visual Witness. One focused PR, Gate, squash merge, frontend release, runtime proof.","proofConditionIds":["proof-production"]}],"satisfied":false,"constraints":[{"id":"visual-content-truth","satisfied":false,"statement":"Do not present invented names, metrics, prices, dates, services, testimonials, credentials, customer records, or other unknown business facts as real. Omit unknowns or mark them clearly as placeholder/example content.","proofConditionIds":["proof-production"]},{"id":"tenant-visual-isolation","satisfied":false,"statement":"Visual work is isolated to requested tenant. Do not import another tenant's logo, colors, imagery, copy, shell, customer data, business facts, or visual identity unless explicitly requested.","proofConditionIds":["proof-production"]},{"id":"reference-visual-fidelity","satisfied":false,"statement":"The approved reference owns the material visual composition: hierarchy, major geometry, typography scale, spacing rhythm, image placement/crop, color treatment, radii, shadows/glow, and overall density. Material deviation is a failed visual acceptance, not a stylistic reinterpretation.","proofConditionIds":["proof-production"]},{"id":"responsive-visual-continuity","satisfied":false,"statement":"Responsive adaptation may reflow for the target viewport, but it must preserve information hierarchy, branding, functionality, and design language. It must not invent a second design.","proofConditionIds":["proof-production"]},{"id":"reference-visual-authority","satisfied":false,"statement":"The supplied or approved reference visual is immutable acceptance evidence. Generating another mockup, image, or concept cannot satisfy this implementation request; completion requires source implementation, deployment, and reference-matched visual proof.","proofConditionIds":["proof-production"]},{"id":"capability-completeness","satisfied":false,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["proof-production"]},{"id":"atomic-capability-lifecycle","satisfied":false,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["proof-production"]}],"contractHash":"f61c40bba61eac0c0b882af116764393e8901d7b435a9d51e28dc8408b1a511c","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"proof-production","kind":"runtime","evidence":{"reason":"missing_required_release_targets:migrations","satisfied":false,"releaseState":"verified","missingTargets":["migrations"],"disallowedTargets":[],"migrationRequired":true,"releaseTargetStates":{"frontend":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend"],"allowedReleaseTargets":[],"requiredReleaseTargets":["migrations"],"migrationReleaseVerified":false,"releaseRequestContractHash":"f61c40bba61eac0c0b882af116764393e8901d7b435a9d51e28dc8408b1a511c"},"required":true,"satisfied":false}],"validationErrors":[],"pendingProofKinds":["runtime"],"activeReleaseTargets":["frontend"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:17:33.04392+00:00","proof_gate":"request_contract_pending","source_sha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:request-contract:f61c40bba61eac0c0b882af116764393e8901d7b435a9d51e28dc8408b1a511c:2cca7e306141de4a073e900e3bf8f03ab85667f7:pending:runtime","mission_step_id":"6f970439-427c-4820-bff0-5cf19b3a1712","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"c1cab07c-b4bc-4902-823b-f538fdd10ccc","source":"cc-execution","status":"deployment_dispatched","payload":{"ok":true,"jobId":null,"phase":"runtime_proof","branch":"ai/objective-first-repair-b5ecb59b331d","reason":null,"status":"deployment_dispatched","metrics":{"receiptBytes":97388,"releaseCount":0,"toolCallCount":18,"repeatedCallCount":8,"executorlessWaitMs":581691,"firstUsefulResultAt":"2026-09-29T02:10:01.516Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":4081,"terminal":false,"missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c","operation":"execute_mission","proofGate":"canonical_release_dispatched","sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":2133,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":89,"approvedPlanMs":0,"missionSetupMs":297,"providerAuthMs":0,"shipAndProveMs":1471,"ledgerPrepareMs":297,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":297,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":297,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},"performance":null,"deploymentId":"forgejo-main-d4b2db0be2ef","releaseState":"verified","workflowRunId":12848,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2774,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:19:51.597508+00:00","proof_gate":"canonical_release_dispatched","source_sha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","external_id":"forgejo-main-d4b2db0be2ef","receipt_type":"execute_mission","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:execute_mission:canonical_release_dispatched:current-generation","mission_step_id":"6bc3e1f7-d76c-476d-96bd-6933957008f1","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"cb8294d4-9bca-41b0-bbe7-6f2a7bdde361","source":"durable-mission-ledger","status":"pending","payload":{"sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"outcome-1","satisfied":false,"statement":"Add a production PCG Legacy Migration Center UI to the existing PCG Settings surface. Create src/pages/card-grading/PCGLegacyMigrationCenter.tsx and integrate it under the PCG settings tab in src/pages/crm/PcgWorkspace.tsx. The UI must accept CSV files, parse quoted CSV safely in-browser, compute a SHA-256 source fingerprint, create/reuse a migration batch through pcg-legacy-import, stage rows in chunks, run chunked analysis to completion, show batch history and reconciliation counts (source, valid, duplicates, review, errors, imported), show a normalized preview including cert/year/set/player/card/grade and planned action, and require typing IMPORT before chunked commit. It must clearly explain that upload/analyze is a dry run and canonical writes happen only on explicit commit. It must preserve old source/image URLs and state that master image copying to Anthony's Google Drive is a separate prerequisite-backed migration step. PCG only, no other tenant changes, no Visual Witness. One focused PR, Gate, squash merge, frontend release, runtime proof.","proofConditionIds":["proof-production"]}],"satisfied":false,"constraints":[{"id":"visual-content-truth","satisfied":false,"statement":"Do not present invented names, metrics, prices, dates, services, testimonials, credentials, customer records, or other unknown business facts as real. Omit unknowns or mark them clearly as placeholder/example content.","proofConditionIds":["proof-production"]},{"id":"tenant-visual-isolation","satisfied":false,"statement":"Visual work is isolated to requested tenant. Do not import another tenant's logo, colors, imagery, copy, shell, customer data, business facts, or visual identity unless explicitly requested.","proofConditionIds":["proof-production"]},{"id":"reference-visual-fidelity","satisfied":false,"statement":"The approved reference owns the material visual composition: hierarchy, major geometry, typography scale, spacing rhythm, image placement/crop, color treatment, radii, shadows/glow, and overall density. Material deviation is a failed visual acceptance, not a stylistic reinterpretation.","proofConditionIds":["proof-production"]},{"id":"responsive-visual-continuity","satisfied":false,"statement":"Responsive adaptation may reflow for the target viewport, but it must preserve information hierarchy, branding, functionality, and design language. It must not invent a second design.","proofConditionIds":["proof-production"]},{"id":"reference-visual-authority","satisfied":false,"statement":"The supplied or approved reference visual is immutable acceptance evidence. Generating another mockup, image, or concept cannot satisfy this implementation request; completion requires source implementation, deployment, and reference-matched visual proof.","proofConditionIds":["proof-production"]},{"id":"capability-completeness","satisfied":false,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["proof-production"]},{"id":"atomic-capability-lifecycle","satisfied":false,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["proof-production"]}],"contractHash":"f61c40bba61eac0c0b882af116764393e8901d7b435a9d51e28dc8408b1a511c","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"proof-production","kind":"runtime","evidence":{"reason":"missing_required_release_targets:migrations","satisfied":false,"releaseState":"verified","missingTargets":["migrations"],"disallowedTargets":[],"migrationRequired":true,"releaseTargetStates":{"frontend":"pending"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend"],"allowedReleaseTargets":[],"requiredReleaseTargets":["migrations"],"migrationReleaseVerified":false,"releaseRequestContractHash":"f61c40bba61eac0c0b882af116764393e8901d7b435a9d51e28dc8408b1a511c"},"required":true,"satisfied":false}],"validationErrors":[],"pendingProofKinds":["runtime"],"activeReleaseTargets":["frontend"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:19:41.352295+00:00","proof_gate":"request_contract_pending","source_sha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:request-contract:f61c40bba61eac0c0b882af116764393e8901d7b435a9d51e28dc8408b1a511c:d4b2db0be2ef7626e4592ce173519923aa0fd7dc:pending:runtime","mission_step_id":"6f970439-427c-4820-bff0-5cf19b3a1712","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"a3d57f7a-e177-406c-87a0-f26aceba8ffd","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","frontend-cloudflare/live":"success"},"mainSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","releaseState":"verified","sourceInMain":true,"compareStatus":"known_exact_protected_main_push_history","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"frontend":"success"},"requestContractHash":"f61c40bba61eac0c0b882af116764393e8901d7b435a9d51e28dc8408b1a511c","forgejoWorkflowProof":{"runId":12844,"source":"signed_push_receipt","status":"success","results":{},"conclusion":"success","targetStates":{"frontend":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:17:31.234457+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"2cca7e306141de4a073e900e3bf8f03ab85667f7","external_id":"forgejo-main-2cca7e306141","receipt_type":"canonical_release_status","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:forgejo-release-status:2cca7e306141de4a073e900e3bf8f03ab85667f7:verified:forgejo-main/source=success|forgejo-release/workflow=success|frontend-cloudflare/live=success","mission_step_id":"6f970439-427c-4820-bff0-5cf19b3a1712","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"50e488d4-be83-4f6b-89be-9ac0f7e3aafb","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"release","branch":"ai/objective-first-repair-677188ce7da4","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":60292,"releaseCount":0,"toolCallCount":12,"repeatedCallCount":5,"executorlessWaitMs":585393,"firstUsefulResultAt":"2026-09-29T02:07:41.155Z","recoveryAttemptCount":4,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":4080,"terminal":false,"missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f","operation":"execute_mission","proofGate":"canonical_release_reconciliation_pending","sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1226,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":105,"approvedPlanMs":0,"missionSetupMs":243,"providerAuthMs":0,"shipAndProveMs":651,"ledgerPrepareMs":243,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":243,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":243,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},"performance":null,"deploymentId":"forgejo-main-d4b2db0be2ef","releaseState":"pending","workflowRunId":12847,"releaseTargets":{"frontend":false,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-legacy-import"]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2888,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:18:03.774666+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","external_id":"forgejo-main-d4b2db0be2ef","receipt_type":"execute_mission","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:execute_mission:canonical_release_reconciliation_pending:current-generation","mission_step_id":"573dc526-0df7-4dc2-b890-f4d1cd933106","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"69b846fb-6944-41c9-808c-d3e5e6fd78a2","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-677188ce7da4","prNumber":4080,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:17:22.498565+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","external_id":"4080","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:merged-pr:4080:d4b2db0be2ef7626e4592ce173519923aa0fd7dc","mission_step_id":"808dc78e-8f7b-45c0-b928-2e58eda54df5","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"6f511558-f594-46f3-a9d1-e40886f02430","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","supabase-edge-production/live":"success"},"mainSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","supabase-edge-production/live"],"sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","releaseState":"verified","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":false,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-legacy-import"]},"releaseTargetStates":{"supabaseEdge":"success"},"requestContractHash":"2437d519393d3cb10abffad249fe6e346f32090611cf64b5a2b3f070d266309a","forgejoWorkflowProof":{"runId":12847,"source":"signed_push_receipt","status":"success","results":{},"conclusion":"success","targetStates":{"supabaseEdge":"success"},"targetJobCount":6,"observedTargetStates":{"supabaseEdge":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:19:35.677739+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","external_id":"forgejo-main-d4b2db0be2ef","receipt_type":"canonical_release_status","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:forgejo-release-status:d4b2db0be2ef7626e4592ce173519923aa0fd7dc:verified:forgejo-main/source=success|forgejo-release/workflow=success|supabase-edge-production/live=success","mission_step_id":"8a67cdcb-60e9-4c8f-8678-63e80d415626","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"115ed7a5-7c68-41ba-ac8c-1ad4f5806cd2","source":"durable-mission-ledger","status":"verified","payload":{"sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"safe-engine","satisfied":true,"statement":"PCG has a tenant-owner-only staged migration engine with create, stage, analyze, commit, and reconciliation phases.","proofConditionIds":["runtime"]},{"id":"idempotent-import","satisfied":true,"statement":"The engine uses stable import keys and cert-number rechecks so repeated legacy imports classify duplicates instead of duplicating canonical cards.","proofConditionIds":["runtime"]},{"id":"archive-behavior","satisfied":true,"statement":"Committed historical legacy cards land in terminal archived PCG submissions and retain source/image provenance without entering active grading work.","proofConditionIds":["runtime"]}],"satisfied":true,"constraints":[{"id":"no-delete","satisfied":true,"statement":"The engine never deletes existing PCG cards/submissions during migration.","proofConditionIds":["runtime"]},{"id":"explicit-commit","satisfied":true,"statement":"Canonical writes require explicit IMPORT confirmation after analysis.","proofConditionIds":["runtime"]},{"id":"pcg-owner-only","satisfied":true,"statement":"Migration actions require an authenticated PCG tenant owner or platform admin; health may remain public.","proofConditionIds":["runtime"]},{"id":"scope","satisfied":true,"statement":"Only supabase/functions/pcg-legacy-import/index.ts and supabase/config.toml may change.","proofConditionIds":["runtime"]},{"id":"capability-completeness","satisfied":true,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["runtime"]},{"id":"atomic-capability-lifecycle","satisfied":true,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["runtime"]}],"contractHash":"2437d519393d3cb10abffad249fe6e346f32090611cf64b5a2b3f070d266309a","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"runtime","kind":"runtime","evidence":{"reason":null,"satisfied":true,"releaseState":"verified","missingTargets":[],"disallowedTargets":[],"migrationRequired":false,"releaseTargetStates":{"supabaseEdge":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["supabaseEdge"],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"migrationReleaseVerified":null,"releaseRequestContractHash":"2437d519393d3cb10abffad249fe6e346f32090611cf64b5a2b3f070d266309a"},"required":true,"satisfied":true}],"validationErrors":[],"pendingProofKinds":[],"activeReleaseTargets":["supabaseEdge"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:19:37.069875+00:00","proof_gate":"request_contract_terminal_verified","source_sha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:677188ce-7da4-4ef0-9a08-05fac5bf238f:request-contract:2437d519393d3cb10abffad249fe6e346f32090611cf64b5a2b3f070d266309a:d4b2db0be2ef7626e4592ce173519923aa0fd7dc:verified:","mission_step_id":"8a67cdcb-60e9-4c8f-8678-63e80d415626","command_center_event_id":"677188ce-7da4-4ef0-9a08-05fac5bf238f"},{"id":"11abface-49a2-435a-9597-559b388647a8","source":"cc-execution","status":"recorded","payload":{"requestContract":{"valid":true,"intent":{"evidence":[],"confidence":null,"compilation":{"stages":["owner_intent","conversation_context","scope","live_state","mutation_authority","affected_systems","dependencies","risk_and_blast_radius","execution_tactics","required_proof","release_plan","recovery_plan"],"version":2,"explicit":true,"objective":"Add and deploy a platform-wide KNOCKLAUNCH tenant media primitive so every canonical tenant has WMP profile/photo and BMD profile/photo uploader options in the shared Universal Profile/Settings experience. Reuse the existing tenant-scoped media/storage and authorization model; add preview, upload/replace, remove/reset; fall back to existing tenant avatar/logo when empty without overwriting custom media; persist with strict tenant isolation; expose on desktop/mobile for MODES and route-based tenants without CRM bleed; wire WMP consumers and any canonical BMD consumer to the shared slots; if no canonical BMD app exists, do not invent one, only expose the BMD slot through the shared media contract; extend bootstrap/health/self-heal non-destructively; add contract coverage for inheritance, isolation, authorization, fallback and non-destructive bootstrap; preserve existing branding, uploads and routing; one focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile for desktop and mobile.","proofKinds":["runtime","visual"],"adaptiveDomains":["intent","tenant_route_role_viewport","urgency_deadline","dependency_scope","risk_blast_radius","runner_capacity","queue_active_work","provider_failure_circuits","qa_scope","retry_recovery","release_ownership","proof_depth"],"expansionPolicy":"later_stages_may_only_narrow_or_expand_with_machine_readable_dependency_evidence","dynamicStatePolicy":"live_state_may_change_execution_tactics_but_never_owner_outcome_or_explicit_constraints","dynamicRefreshStages":["preflight","gate","release","runtime_proof"],"adaptiveCompilerVersion":"paul-adaptive-objective-v1","inheritedContextBlockingAuthority":false},"rawUtterance":"Add and deploy a platform-wide KNOCKLAUNCH tenant media primitive so every canonical tenant has WMP profile/photo and BMD profile/photo uploader options in the shared Universal Profile/Settings experience. Reuse the existing tenant-scoped media/storage and authorization model; add preview, upload/replace, remove/reset; fall back to existing tenant avatar/logo when empty without overwriting custom media; persist with strict tenant isolation; expose on desktop/mobile for MODES and route-based tenants without CRM bleed; wire WMP consumers and any canonical BMD consumer to the shared slots; if no canonical BMD app exists, do not invent one, only expose the BMD slot through the shared media contract; extend bootstrap/health/self-heal non-destructively; add contract coverage for inheritance, isolation, authorization, fallback and non-destructive bootstrap; preserve existing branding, uploads and routing; one focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile for desktop and mobile.","wordingChanged":false,"canonicalIntent":"Add and deploy a platform-wide KNOCKLAUNCH tenant media primitive so every canonical tenant has WMP profile/photo and BMD profile/photo uploader options in the shared Universal Profile/Settings experience. Reuse the existing tenant-scoped media/storage and authorization model; add preview, upload/replace, remove/reset; fall back to existing tenant avatar/logo when empty without overwriting custom media; persist with strict tenant isolation; expose on desktop/mobile for MODES and route-based tenants without CRM bleed; wire WMP consumers and any canonical BMD consumer to the shared slots; if no canonical BMD app exists, do not invent one, only expose the BMD slot through the shared media contract; extend bootstrap/health/self-heal non-destructively; add contract coverage for inheritance, isolation, authorization, fallback and non-destructive bootstrap; preserve existing branding, uploads and routing; one focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile for desktop and mobile.","resolutionStatus":"exact","uniqueResolution":true,"clarificationRequired":false},"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Add and deploy a platform-wide KNOCKLAUNCH tenant media primitive so every canonical tenant has WMP profile/photo and BMD profile/photo uploader options in the shared Universal Profile/Settings experience. Reuse the existing tenant-scoped media/storage and authorization model; add preview, upload/replace, remove/reset; fall back to existing tenant avatar/logo when empty without overwriting custom media; persist with strict tenant isolation; expose on desktop/mobile for MODES and route-based tenants without CRM bleed; wire WMP consumers and any canonical BMD consumer to the shared slots; if no canonical BMD app exists, do not invent one, only expose the BMD slot through the shared media contract; extend bootstrap/health/self-heal non-destructively; add contract coverage for inheritance, isolation, authorization, fallback and non-destructive bootstrap; preserve existing branding, uploads and routing; one focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile for desktop and mobile.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-production","proof-visual"]}],"objective":"Add and deploy a platform-wide KNOCKLAUNCH tenant media primitive so every canonical tenant has WMP profile/photo and BMD profile/photo uploader options in the shared Universal Profile/Settings experience. Reuse the existing tenant-scoped media/storage and authorization model; add preview, upload/replace, remove/reset; fall back to existing tenant avatar/logo when empty without overwriting custom media; persist with strict tenant isolation; expose on desktop/mobile for MODES and route-based tenants without CRM bleed; wire WMP consumers and any canonical BMD consumer to the shared slots; if no canonical BMD app exists, do not invent one, only expose the BMD slot through the shared media contract; extend bootstrap/health/self-heal non-destructively; add contract coverage for inheritance, isolation, authorization, fallback and non-destructive bootstrap; preserve existing branding, uploads and routing; one focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile for desktop and mobile.","constraints":[{"id":"shared-primitive-only","statement":"Implement through the existing shared tenant media/profile primitive; do not create tenant-specific hacks or a second media library.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-production"]},{"id":"non-destructive-bootstrap","statement":"Existing tenant branding and custom media must be preserved; empty WMP/BMD slots may fall back but bootstrap must not overwrite custom values.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-production"]},{"id":"no-new-bmd-route","statement":"If there is no canonical BMD application in current main, do not invent a new BMD route or product surface.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-production"]},{"id":"capability-completeness","statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","provenance":{"reason":null,"source":"hard_safety_invariant","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-production"]},{"id":"atomic-capability-lifecycle","statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","provenance":{"reason":null,"source":"hard_safety_invariant","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-production"]}],"adaptivePolicy":{"risk":{"tier":"high","blastRadius":"sensitive"},"proof":{"requiredKinds":["runtime","visual"],"visualProofScope":"broad","interactionRequired":true,"runtimeProofRequired":true},"scope":{"route":"/pcg/settings?section=profile","roleRef":null,"tenantRef":null,"sourceTargets":["src/PrivateAppShell.tsx","config/contracts/PREHISTORIC-001-TENANT-MEDIA.json","src/__tests__/contracts/prehistoric-001-tenant-media.contract.test.ts","config/capabilities/tenant-brand-character.json","config/capabilities/tenant-type-platform-primitive.json","config/capabilities/tenant-workspace-experience.json","config/capabilities/tenant-workspace-ui-contract-v2.json","config/capabilities/tenant-bootstrap.json","config/capabilities/tenant-activation-certification.json","config/capabilities/tenant-website-assets-settings.json","config/capabilities/wmp-mission-control.json"]},"dynamic":{"variables":["main_and_runtime_lineage","runner_capacity","queue_and_active_work","provider_health","failure_clusters_and_circuits","release_target_state","current_pr_and_gate_state"],"refreshStages":["preflight","gate","release","runtime_proof"],"refreshMayChange":["runner_selection","parallelism","retry_path","qa_depth","release_recovery","proof_timing"],"refreshMayNotChange":["owner_outcome","explicit_no_go_constraints","tenant_identity","credential_boundary","hard_safety_invariants"]},"urgency":{"priority":"normal","deadlineSignals":[],"deadlineExplicit":false},"version":"paul-adaptive-objective-v1","recovery":{"transient":"one_bounded_retry_then_alternate_eligible_pool_or_provider_path","deterministic":"repair_source_or_contract_do_not_blind_rerun","mutationDependencyFailure":"prerequisite_required_or_targeted_recovery_never_invent","readOnlyDependencyFailure":"degrade_to_available_grounded_context_and_keep_conversation_alive"},"unknowns":["tenant","deadline"],"authority":{"outcome":"current_explicit_owner_request","tactics":"live_prime_truth","unknownPolicy":"preserve_unknown_never_invent","historicalContext":"advisory_unless_current_request_confirms"},"execution":{"mutation":true,"concurrency":"serialize_overlapping_mutations","scopePolicy":"start_bounded_expand_only_with_machine_readable_dependency_evidence","staleStatePolicy":"refresh_dynamic_state_before_irreversible_or_acceptance_stage","conversationIsolation":true,"ownerOutcomeMayBeChangedByAdaptation":false},"experience":{"visual":true,"viewports":["desktop","mobile"],"behavioral":true,"visualProofScope":"broad"},"dependencies":{"requiredDomains":["frontend","backend_runtime","schema_data_storage","authentication_authorization","provider_configuration","release_ownership","live_production_proof"],"capabilityDomains":["frontend","backend_runtime","schema_data_storage","authentication_authorization","provider_configuration","prerequisite_loading_empty_error_states","release_ownership","live_production_proof"],"releaseTargetHints":["frontend"]},"inputSignals":{"rawUtterance":"Add and deploy a platform-wide KNOCKLAUNCH tenant media primitive so every canonical tenant has WMP profile/photo and BMD profile/photo uploader options in the shared Universal Profile/Settings experience. Reuse the existing tenant-scoped media/storage and authorization model; add preview, upload/replace, remove/reset; fall back to existing tenant avatar/logo when empty without overwriting custom media; persist with strict tenant isolation; expose on desktop/mobile for MODES and route-based tenants without CRM bleed; wire WMP consumers and any canonical BMD consumer to the shared slots; if no canonical BMD app exists, do not invent one, only expose the BMD slot through the shared media contract; extend bootstrap/health/self-heal non-destructively; add contract coverage for inheritance, isolation, authorization, fallback and non-destructive bootstrap; preserve existing branding, uploads and routing; one focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile for desktop and mobile.","canonicalIntent":"Add and deploy a platform-wide KNOCKLAUNCH tenant media primitive so every canonical tenant has WMP profile/photo and BMD profile/photo uploader options in the shared Universal Profile/Settings experience. Reuse the existing tenant-scoped media/storage and authorization model; add preview, upload/replace, remove/reset; fall back to existing tenant avatar/logo when empty without overwriting custom media; persist with strict tenant isolation; expose on desktop/mobile for MODES and route-based tenants without CRM bleed; wire WMP consumers and any canonical BMD consumer to the shared slots; if no canonical BMD app exists, do not invent one, only expose the BMD slot through the shared media contract; extend bootstrap/health/self-heal non-destructively; add contract coverage for inheritance, isolation, authorization, fallback and non-destructive bootstrap; preserve existing branding, uploads and routing; one focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile for desktop and mobile.","conversationContextPresent":false}},"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-production","kind":"runtime","claim":"The shared WMP/BMD tenant media slots are deployed and available through the canonical tenant Profile/Settings system with tenant isolation, fallback, and non-destructive bootstrap.","route":"/pcg/settings?section=profile","roleRef":null,"userRef":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"requireCapacityAdmissible":false,"expectedWatchdogPolicyVersion":null,"minConsecutiveHealthyHeartbeats":1,"requirePositiveMemoryAttribution":false,"requireMemoryAdmissionPressureFalse":false},{"id":"proof-visual","kind":"visual","claim":"The WMP profile/photo and BMD profile/photo controls render and are usable on the representative PCG tenant Profile/Settings surface on desktop and mobile.","route":"/pcg/settings?section=profile","roleRef":null,"userRef":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"requireCapacityAdmissible":false,"expectedWatchdogPolicyVersion":null,"minConsecutiveHealthyHeartbeats":1,"requirePositiveMemoryAttribution":false,"requireMemoryAdmissionPressureFalse":false}],"validationErrors":[],"capabilityManifest":{"id":"Add-and-deploy-a-platform-wide-KNOCKLAUNCH-tenant-media-primitive-so-every-canonical-tenant-has-WMP-","driftPolicy":"exact_manifest_source_release_dependency_or_runtime_identity_mismatch_is_nonterminal","proofLedger":"command_center_mission_ledger_request_contract_hash_bound","schemaVersion":1,"releaseTargets":[],"lifecycleStates":["prepare","deploy","verify","activate"],"activationPolicy":"dependencies_and_claim_matched_live_proof_before_exposure","dependencyDomains":["frontend","backend_runtime","schema_data_storage","authentication_authorization","provider_configuration","prerequisite_loading_empty_error_states","release_ownership","live_production_proof"],"prerequisitePolicy":"expected_unavailable_dependencies_are_prerequisite_required_not_runtime_failures","compatibilityWindow":["N","N-1"],"failureIsolationPolicy":"quarantine_or_rollback_affected_capability_only_preserve_unrelated_working_capabilities","canaryProofConditionIds":["proof-production"]},"capabilityCompleteness":{"domains":["frontend","backend_runtime","schema_data_storage","authentication_authorization","provider_configuration","prerequisite_loading_empty_error_states","release_ownership","live_production_proof"],"required":true,"prerequisitePolicy":"expected_unavailable_dependencies_are_prerequisite_states_not_runtime_failures"}},"requestContractHash":"b896d59bbce2a5af08f0932844b8a4dbb4cb43fcc1f6ce825f8c741a693a45ea","requestContractRevision":2,"previousRequestContractHash":"af0d6be3e8cb6b2d4237ca7ed2bb14842e4ad50c3afcf81b9eab5251038d34a1"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:20:52.967394+00:00","proof_gate":"request_contract_revision_recorded","source_sha":null,"external_id":null,"receipt_type":"request_contract_revision","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:request-contract:b896d59bbce2a5af08f0932844b8a4dbb4cb43fcc1f6ce825f8c741a693a45ea","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"8940fc86-4fb7-4ee1-bce7-5656e4f235c7","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"runtime_proof","branch":"ai/objective-first-repair-b5ecb59b331d","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":85348,"releaseCount":0,"toolCallCount":14,"repeatedCallCount":5,"executorlessWaitMs":453738,"firstUsefulResultAt":"2026-09-29T02:10:01.516Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":4081,"terminal":false,"missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c","operation":"execute_mission","proofGate":"canonical_release_reconciliation_pending","sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1251,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":113,"approvedPlanMs":0,"missionSetupMs":243,"providerAuthMs":0,"shipAndProveMs":677,"ledgerPrepareMs":243,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":243,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":243,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},"performance":null,"deploymentId":"forgejo-main-d4b2db0be2ef","releaseState":"verified","workflowRunId":12847,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2805,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:18:01.460129+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","external_id":"forgejo-main-d4b2db0be2ef","receipt_type":"execute_mission","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:execute_mission:canonical_release_reconciliation_pending:current-generation","mission_step_id":"6bc3e1f7-d76c-476d-96bd-6933957008f1","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"bf344443-1adf-4151-85a9-f04092c1db93","source":"cc-execution","status":"source_resolution_required","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-0c9214aed67b","reason":null,"status":"source_resolution_required","metrics":{"receiptBytes":6119,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":1,"executorlessWaitMs":48001,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"execute_mission","proofGate":"repair_mission_source_resolution_required","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1222,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":326,"providerAuthMs":0,"ledgerPrepareMs":326,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":326,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":326,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Supply exact sourceTargets on the same mission; planner guesses cannot replace missing mission scope.","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime","visual"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1176,"likelyAffectedFiles":[],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:20:23.550905+00:00","proof_gate":"repair_mission_source_resolution_required","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:execute_mission:repair_mission_source_resolution_required:current-generation","mission_step_id":"162b58af-8e87-4a7f-b741-4212ab04212a","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"7a0b0ea8-ed9c-489f-ab79-5259f97c1064","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-d8028b7a80b7","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"d8028b7a-80b7-44a7-bd61-1f210843326b","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1259,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":434,"providerAuthMs":0,"ledgerPrepareMs":434,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":434,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":434,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"d8028b7a-80b7-44a7-bd61-1f210843326b"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":5418,"likelyAffectedFiles":["supabase/functions/pcg-google-drive-media/index.ts","supabase/functions/pcg-legacy-import/index.ts","src/pages/card-grading/PCGLegacyMigrationCenter.tsx"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:20:58.225622+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"efbf3e36-6e27-40a7-b257-616dcffb95f7","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"b01a938b-b054-4ddf-9048-7d520e6ecfd5","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-d8028b7a80b7","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":73437,"releaseCount":0,"toolCallCount":2,"repeatedCallCount":0,"executorlessWaitMs":79676,"firstUsefulResultAt":"2026-09-29T02:20:58.194Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":4082,"terminal":false,"missionId":"d8028b7a-80b7-44a7-bd61-1f210843326b","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3785,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":690,"missionSetupMs":356,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":356,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":356,"repositoryMutationMs":3095,"repositoryProviderMs":3095,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":2020,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":356,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1075},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"d8028b7a-80b7-44a7-bd61-1f210843326b"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3531,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:22:23.083834+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4082","receipt_type":"execute_mission","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"d6b68e24-f932-45f3-8f5f-cb3e5da4e478","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"693b8ab9-f692-4aee-aa8b-40342b378251","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-5596752e68e1","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1232,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":507,"providerAuthMs":0,"ledgerPrepareMs":507,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":507,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":507,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":5172,"likelyAffectedFiles":["supabase/functions/pcg-customer-progress/index.ts","src/pages/card-grading/PCGPublicSite.tsx","src/routes/publicRoutes.tsx"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:24:30.055015+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:5596752e-68e1-43eb-b3eb-c883cdd77f75:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"11c23b3e-bc74-4f84-8d51-c72f84a06200","command_center_event_id":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},{"id":"2ed0ff06-c88c-4e3d-b727-2ba3b991066f","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"aeb8e92b-8af3-4b8a-bb3c-1904e265be47","objective":"Continue exact existing PR #4073 by applying only the supplied anchored edits from locally validated commit b600cabeb94eb2a92bcb1ad2cb088874661a81c2 to branch ai/objective-first-repair-e3478acfa504. Do not create a replacement PR or broaden scope.","sourceSha":"b87fa77a0c8dd82aabaa3e3f1411a62e96d7976d","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"anchored_edits":[{"path":".forgejo/workflows/knocklaunch.yml","edits":[{"new_content":"        required: false\n        default: \"false\"\n        type: string\n      release_frontend:\n        description: Release frontend when affected\n        required: false","old_content":"        required: false\n        default: \"false\"\n        type: string\n      release_onrunner:\n        description: Release Render OnRunner when affected\n        required: false\n        default: \"false\"\n        type: string\n      release_frontend:\n        description: Release frontend when affected\n        required: false"},{"new_content":"jobs:\n  release-plan:\n    name: Delivery / Maintenance Plan\n    if: ${{ github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.event.inputs.operation == 'release-main' && (github.event.inputs.release_cc_execution == 'true' || github.event.inputs.release_frontend == 'true' || github.event.inputs.release_supabase_edge == 'true' || github.event.inputs.supabase_edge_reconcile == 'true' || github.event.inputs.release_migrations == 'true')) }}\n    runs-on: docker-8g\n    container:\n      image: node:22.18.0-bookworm","old_content":"jobs:\n  release-plan:\n    name: Delivery / Maintenance Plan\n    if: ${{ github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.event.inputs.operation == 'release-main' && (github.event.inputs.release_cc_execution == 'true' || github.event.inputs.release_onrunner == 'true' || github.event.inputs.release_frontend == 'true' || github.event.inputs.release_supabase_edge == 'true' || github.event.inputs.supabase_edge_reconcile == 'true' || github.event.inputs.release_migrations == 'true')) }}\n    runs-on: docker-8g\n    container:\n      image: node:22.18.0-bookworm"},{"new_content":"      changed_paths_b64: ${{ steps.plan.outputs.changed_paths_b64 }}\n      release_cc_execution: ${{ steps.plan.outputs.release_cc_execution }}\n      release_cc_execution_heavy: ${{ steps.plan.outputs.release_cc_execution_heavy }}\n      release_frontend: ${{ steps.plan.outputs.release_frontend }}\n      release_supabase_edge: ${{ steps.plan.outputs.release_supabase_edge }}\n      supabase_edge_reconcile: ${{ steps.plan.outputs.supabase_edge_reconcile }}","old_content":"      changed_paths_b64: ${{ steps.plan.outputs.changed_paths_b64 }}\n      release_cc_execution: ${{ steps.plan.outputs.release_cc_execution }}\n      release_cc_execution_heavy: ${{ steps.plan.outputs.release_cc_execution_heavy }}\n      release_onrunner: ${{ steps.plan.outputs.release_onrunner }}\n      release_frontend: ${{ steps.plan.outputs.release_frontend }}\n      release_supabase_edge: ${{ steps.plan.outputs.release_supabase_edge }}\n      supabase_edge_reconcile: ${{ steps.plan.outputs.supabase_edge_reconcile }}"},{"new_content":"          const frontendPath = /^(?:src\\/(?!__tests__\\/contracts\\/)|public\\/|index\\.html$|package(?:-lock)?\\.json$|vite\\.config\\.|tsconfig|tailwind\\.config\\.|postcss\\.config\\.|components\\.json$|wrangler\\.toml$|scripts\\/cloudflare-native-(?!version-deploy\\.mjs$)|scripts\\/validate-cloudflare-native-public-env\\.mjs$|config\\/cloudflare-native-frontend-build\\.json$)/;\n          const targets = {\n            ccExecution: paths.some((path) => (path.startsWith(\"workers/cc-execution/\") && !path.startsWith(\"workers/cc-execution/test/\")) || path === \"config/control-plane-capabilities.json\" || path.startsWith(\"scripts/visual-witness-hosted-runner/\")),\n            frontend: paths.some((path) => frontendPath.test(path)),\n            supabaseEdge: paths.some((path) => path.startsWith(\"supabase/functions/\") || path === \"scripts/reconcile-supabase-edge-registry.mjs\"),\n            migrations: paths.some((path) => path.startsWith(\"supabase/migrations/\")),","old_content":"          const frontendPath = /^(?:src\\/(?!__tests__\\/contracts\\/)|public\\/|index\\.html$|package(?:-lock)?\\.json$|vite\\.config\\.|tsconfig|tailwind\\.config\\.|postcss\\.config\\.|components\\.json$|wrangler\\.toml$|scripts\\/cloudflare-native-(?!version-deploy\\.mjs$)|scripts\\/validate-cloudflare-native-public-env\\.mjs$|config\\/cloudflare-native-frontend-build\\.json$)/;\n          const targets = {\n            ccExecution: paths.some((path) => (path.startsWith(\"workers/cc-execution/\") && !path.startsWith(\"workers/cc-execution/test/\")) || path === \"config/control-plane-capabilities.json\" || path.startsWith(\"scripts/visual-witness-hosted-runner/\")),\n            onrunner: false,\n            frontend: paths.some((path) => frontendPath.test(path)),\n            supabaseEdge: paths.some((path) => path.startsWith(\"supabase/functions/\") || path === \"scripts/reconcile-supabase-edge-registry.mjs\"),\n            migrations: paths.some((path) => path.startsWith(\"supabase/migrations/\")),"},{"new_content":"            changed_paths_b64: Buffer.from(paths.join(\"\\n\"), \"utf8\").toString(\"base64\"),\n            release_cc_execution: String(targets.ccExecution),\n            release_cc_execution_heavy: String(ccExecutionHeavy),\n            release_frontend: String(targets.frontend),\n            release_supabase_edge: String(targets.supabaseEdge),\n            supabase_edge_reconcile: String(supabaseEdgeReconcile),","old_content":"            changed_paths_b64: Buffer.from(paths.join(\"\\n\"), \"utf8\").toString(\"base64\"),\n            release_cc_execution: String(targets.ccExecution),\n            release_cc_execution_heavy: String(ccExecutionHeavy),\n            release_onrunner: String(targets.onrunner),\n            release_frontend: String(targets.frontend),\n            release_supabase_edge: String(targets.supabaseEdge),\n            supabase_edge_reconcile: String(supabaseEdgeReconcile),"},{"new_content":"          EVENT_CHANGED_PATHS_B64: ${{ steps.event_plan.outputs.changed_paths_b64 }}\n          EVENT_RELEASE_CC_EXECUTION: ${{ steps.event_plan.outputs.release_cc_execution }}\n          EVENT_RELEASE_CC_EXECUTION_HEAVY: ${{ steps.event_plan.outputs.release_cc_execution_heavy }}\n          EVENT_RELEASE_FRONTEND: ${{ steps.event_plan.outputs.release_frontend }}\n          EVENT_RELEASE_SUPABASE_EDGE: ${{ steps.event_plan.outputs.release_supabase_edge }}\n          EVENT_SUPABASE_EDGE_RECONCILE: ${{ steps.event_plan.outputs.supabase_edge_reconcile }}","old_content":"          EVENT_CHANGED_PATHS_B64: ${{ steps.event_plan.outputs.changed_paths_b64 }}\n          EVENT_RELEASE_CC_EXECUTION: ${{ steps.event_plan.outputs.release_cc_execution }}\n          EVENT_RELEASE_CC_EXECUTION_HEAVY: ${{ steps.event_plan.outputs.release_cc_execution_heavy }}\n          EVENT_RELEASE_ONRUNNER: ${{ steps.event_plan.outputs.release_onrunner }}\n          EVENT_RELEASE_FRONTEND: ${{ steps.event_plan.outputs.release_frontend }}\n          EVENT_RELEASE_SUPABASE_EDGE: ${{ steps.event_plan.outputs.release_supabase_edge }}\n          EVENT_SUPABASE_EDGE_RECONCILE: ${{ steps.event_plan.outputs.supabase_edge_reconcile }}"},{"new_content":"          INPUT_SOURCE_SHA: ${{ github.event.inputs.source_sha }}\n          INPUT_CHANGED_PATHS_B64: ${{ github.event.inputs.changed_paths_b64 }}\n          INPUT_RELEASE_CC_EXECUTION: ${{ github.event.inputs.release_cc_execution }}\n          INPUT_RELEASE_FRONTEND: ${{ github.event.inputs.release_frontend }}\n          INPUT_RELEASE_SUPABASE_EDGE: ${{ github.event.inputs.release_supabase_edge }}\n          INPUT_SUPABASE_EDGE_RECONCILE: ${{ github.event.inputs.supabase_edge_reconcile }}","old_content":"          INPUT_SOURCE_SHA: ${{ github.event.inputs.source_sha }}\n          INPUT_CHANGED_PATHS_B64: ${{ github.event.inputs.changed_paths_b64 }}\n          INPUT_RELEASE_CC_EXECUTION: ${{ github.event.inputs.release_cc_execution }}\n          INPUT_RELEASE_ONRUNNER: ${{ github.event.inputs.release_onrunner }}\n          INPUT_RELEASE_FRONTEND: ${{ github.event.inputs.release_frontend }}\n          INPUT_RELEASE_SUPABASE_EDGE: ${{ github.event.inputs.release_supabase_edge }}\n          INPUT_SUPABASE_EDGE_RECONCILE: ${{ github.event.inputs.supabase_edge_reconcile }}"},{"new_content":"              \"changed_paths_b64=$EVENT_CHANGED_PATHS_B64\" \\\n              \"release_cc_execution=$EVENT_RELEASE_CC_EXECUTION\" \\\n              \"release_cc_execution_heavy=$EVENT_RELEASE_CC_EXECUTION_HEAVY\" \\\n              \"release_frontend=$EVENT_RELEASE_FRONTEND\" \\\n              \"release_supabase_edge=$EVENT_RELEASE_SUPABASE_EDGE\" \\\n              \"supabase_edge_reconcile=$EVENT_SUPABASE_EDGE_RECONCILE\" \\","old_content":"              \"changed_paths_b64=$EVENT_CHANGED_PATHS_B64\" \\\n              \"release_cc_execution=$EVENT_RELEASE_CC_EXECUTION\" \\\n              \"release_cc_execution_heavy=$EVENT_RELEASE_CC_EXECUTION_HEAVY\" \\\n              \"release_onrunner=false\" \\\n              \"release_frontend=$EVENT_RELEASE_FRONTEND\" \\\n              \"release_supabase_edge=$EVENT_RELEASE_SUPABASE_EDGE\" \\\n              \"supabase_edge_reconcile=$EVENT_SUPABASE_EDGE_RECONCILE\" \\"},{"new_content":"              \"changed_paths_b64=\" \\\n              \"release_cc_execution=false\" \\\n              \"release_cc_execution_heavy=false\" \\\n              \"release_frontend=false\" \\\n              \"release_supabase_edge=true\" \\\n              \"supabase_edge_reconcile=true\" \\","old_content":"              \"changed_paths_b64=\" \\\n              \"release_cc_execution=false\" \\\n              \"release_cc_execution_heavy=false\" \\\n              \"release_onrunner=false\" \\\n              \"release_frontend=false\" \\\n              \"release_supabase_edge=true\" \\\n              \"supabase_edge_reconcile=true\" \\"},{"new_content":"              \"changed_paths_b64=${INPUT_CHANGED_PATHS_B64:-}\" \\\n              \"release_cc_execution=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_cc_execution_heavy=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_frontend=${INPUT_RELEASE_FRONTEND:-false}\" \\\n              \"release_supabase_edge=${INPUT_RELEASE_SUPABASE_EDGE:-false}\" \\\n              \"supabase_edge_reconcile=${INPUT_SUPABASE_EDGE_RECONCILE:-false}\" \\","old_content":"              \"changed_paths_b64=${INPUT_CHANGED_PATHS_B64:-}\" \\\n              \"release_cc_execution=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_cc_execution_heavy=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_onrunner=false\" \\\n              \"release_frontend=${INPUT_RELEASE_FRONTEND:-false}\" \\\n              \"release_supabase_edge=${INPUT_RELEASE_SUPABASE_EDGE:-false}\" \\\n              \"supabase_edge_reconcile=${INPUT_SUPABASE_EDGE_RECONCILE:-false}\" \\"},{"new_content":"            '/scripts/validate-windows-repository-paths.mjs' \\\n            '/scripts/validate-windows-repository-paths.test.mjs' \\\n            '/scripts/validate-control-plane-restore-point.mjs' \\\n            '/scripts/validate-release-architecture.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\\n            '/scripts/validate-capability-manifests.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\","old_content":"            '/scripts/validate-windows-repository-paths.mjs' \\\n            '/scripts/validate-windows-repository-paths.test.mjs' \\\n            '/scripts/validate-control-plane-restore-point.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\\n            '/scripts/validate-capability-manifests.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\"},{"new_content":"            config/control-plane-capabilities.json\n            config/control-plane-restore-point.json\n            scripts/validate-control-plane-restore-point.mjs\n            scripts/validate-release-architecture.mjs\n            src/__tests__/contracts/control-plane-restore-point.contract.test.ts\n            workers/cc-execution/src/index-release-fast-lane.js\n            workers/cc-execution/src/entrypoint-owner-status.js","old_content":"            config/control-plane-capabilities.json\n            config/control-plane-restore-point.json\n            scripts/validate-control-plane-restore-point.mjs\n            src/__tests__/contracts/control-plane-restore-point.contract.test.ts\n            workers/cc-execution/src/index-release-fast-lane.js\n            workers/cc-execution/src/entrypoint-owner-status.js"},{"new_content":"          node scripts/release-event-native-plan.test.mjs\n          node scripts/reconcile-supabase-edge-registry.test.mjs\n          node scripts/validate-control-plane-restore-point.mjs\n          node scripts/validate-release-architecture.mjs\n          echo \"Hard safety: canonical control-plane restore point contract passed.\"\n\n          # Runtime parseability is a hard safety invariant, not optional domain QA.","old_content":"          node scripts/release-event-native-plan.test.mjs\n          node scripts/reconcile-supabase-edge-registry.test.mjs\n          node scripts/validate-control-plane-restore-point.mjs\n          echo \"Hard safety: canonical control-plane restore point contract passed.\"\n\n          # Runtime parseability is a hard safety invariant, not optional domain QA."}]},{"path":"config/control-plane-capabilities.json","edits":[{"new_content":"  \"authority\": \"live_runtime\",\n  \"purpose\": \"Bootstrap capability resolution without duplicating or freezing the live tool inventory.\",\n  \"repository\": \"noel/KnockLaunchOS\",\n  \"canonicalArchitectureRestorePoint\": \"config/system-restore-points/golden-restore-2026-09-25-1005Z.json\",\n  \"runtime\": {\n    \"healthEndpoint\": \"https://cc-execution.knocklaunch.app/health\",\n    \"openApiEndpoint\": \"https://cc-execution.knocklaunch.app/openapi.json\",","old_content":"  \"authority\": \"live_runtime\",\n  \"purpose\": \"Bootstrap capability resolution without duplicating or freezing the live tool inventory.\",\n  \"repository\": \"noel/KnockLaunchOS\",\n  \"canonicalArchitectureRestorePoint\": \"config/control-plane-restore-point.json\",\n  \"runtime\": {\n    \"healthEndpoint\": \"https://cc-execution.knocklaunch.app/health\",\n    \"openApiEndpoint\": \"https://cc-execution.knocklaunch.app/openapi.json\","},{"new_content":"    \"verification\": {\n      \"visualWitnessAutomatic\": false,\n      \"visualWitnessPolicy\": \"claim_matched_after_repair\",\n      \"visualWitnessCapacityRoutingPolicy\": \"laptop_first_then_virtual_then_paul_capacity_pool\",\n      \"visualWitnessReleaseValidationPolicy\": \"cold_start_aware_v1_plus_n_minus_one_capacity_pool\",\n      \"visualWitnessInteractiveNoProgressLeaseMs\": 30000,\n      \"visualWitnessNonVisualInteractionCapturePolicy\": \"executable_interaction_diagnostics_without_screenshot_unless_visual_claim\",","old_content":"    \"verification\": {\n      \"visualWitnessAutomatic\": false,\n      \"visualWitnessPolicy\": \"claim_matched_after_repair\",\n      \"visualWitnessCapacityRoutingPolicy\": \"virtual_first_then_render_burst_when_virtual_saturated_or_unavailable\",\n      \"visualWitnessRenderColdStartCostMs\": 60000,\n      \"visualWitnessRenderColdStartPolicy\": \"provider_specific_activation_cost_never_global_witness_timeout\",\n      \"visualWitnessReleaseValidationPolicy\": \"cold_start_aware_v1_plus_n_minus_one_capacity_pool\",\n      \"visualWitnessInteractiveNoProgressLeaseMs\": 30000,\n      \"visualWitnessNonVisualInteractionCapturePolicy\": \"executable_interaction_diagnostics_without_screenshot_unless_visual_claim\","},{"new_content":"    \"visualWitnessExplicitViewportPolicy\": \"explicit_viewport_selection_is_authoritative_across_adaptive_escalation_restart_replay_and_lane_failover_mobile_only_never_silently_expands_to_desktop\",\n    \"visualWitnessRestartReplayPolicy\": \"process_restart_replay_is_bounded_one_per_attempt_slot_and_already_completed_verified_attempts_terminalize_without_replay\",\n    \"visualWitnessDurabilityGatePolicy\": \"hosted_runner_check_executes_test_glob_and_mission_supervisor_durability_contract_guards_terminal_precedence_source_binding_restart_terminalization_and_explicit_viewports\",\n    \"deterministicMissionSupervisorPrimitivePolicy\": \"cloudflare_minute_cron_rehydrates_owner_active_durable_missions_through_the_same_mission_status_deterministic_state_machine_used_interactively_one_transition_brain_no_parallel_recovery_orchestrator\",\n    \"ownerMissionProgressPolicy\": \"durable_mission_receipts_are_the_canonical_owner_progress_journal_mission_status_returns_latestProgress_and_bounded_recentProgress_with_monotonic_timestamp_sequences_phase_owner_safe_message_next_action_or_blocker_ownerCheckpoint_remains_backward_compatible\",\n    \"ownerMissionProgressRecentLimit\": 8,","old_content":"    \"visualWitnessExplicitViewportPolicy\": \"explicit_viewport_selection_is_authoritative_across_adaptive_escalation_restart_replay_and_lane_failover_mobile_only_never_silently_expands_to_desktop\",\n    \"visualWitnessRestartReplayPolicy\": \"process_restart_replay_is_bounded_one_per_attempt_slot_and_already_completed_verified_attempts_terminalize_without_replay\",\n    \"visualWitnessDurabilityGatePolicy\": \"hosted_runner_check_executes_test_glob_and_mission_supervisor_durability_contract_guards_terminal_precedence_source_binding_restart_terminalization_and_explicit_viewports\",\n    \"onrunnerOnlyExactRuntimeProofPolicy\": \"when_onrunner_is_the_only_affected_release_target_exact_healthy_live_onrunner_source_identity_is_authoritative_over_an_interrupted_enclosing_workflow_receipt_mixed_release_targets_remain_fail_closed\",\n    \"deterministicMissionSupervisorPrimitivePolicy\": \"cloudflare_minute_cron_rehydrates_owner_active_durable_missions_through_the_same_mission_status_deterministic_state_machine_used_interactively_one_transition_brain_no_parallel_recovery_orchestrator\",\n    \"ownerMissionProgressPolicy\": \"durable_mission_receipts_are_the_canonical_owner_progress_journal_mission_status_returns_latestProgress_and_bounded_recentProgress_with_monotonic_timestamp_sequences_phase_owner_safe_message_next_action_or_blocker_ownerCheckpoint_remains_backward_compatible\",\n    \"ownerMissionProgressRecentLimit\": 8,"},{"new_content":"      \"contracts\": \"^src/__tests__/contracts/\",\n      \"buildCritical\": \"^(package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|index\\\\.html$|wrangler\\\\.toml$|scripts/cloudflare-native-|scripts/validate-cloudflare-native-public-env\\\\.mjs$|config/cloudflare-native-frontend-build\\\\.json$|src/(main|App)\\\\.[cm]?[tj]sx?$|src/(index|App)\\\\.css$)\",\n      \"ccExecution\": \"^(?:workers/cc-execution/|scripts/visual-witness-hosted-runner/)\",\n      \"supabaseEdge\": \"^supabase/functions/\",\n      \"migrations\": \"^supabase/migrations/\",\n      \"controlPlane\": \"^(config/control-plane-capabilities\\\\.json$|\\\\.forgejo/workflows/|workers/cc-execution/)\"","old_content":"      \"contracts\": \"^src/__tests__/contracts/\",\n      \"buildCritical\": \"^(package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|index\\\\.html$|wrangler\\\\.toml$|scripts/cloudflare-native-|scripts/validate-cloudflare-native-public-env\\\\.mjs$|config/cloudflare-native-frontend-build\\\\.json$|src/(main|App)\\\\.[cm]?[tj]sx?$|src/(index|App)\\\\.css$)\",\n      \"ccExecution\": \"^(?:workers/cc-execution/|scripts/visual-witness-hosted-runner/)\",\n      \"onrunner\": \"^scripts/visual-witness-hosted-runner/\",\n      \"supabaseEdge\": \"^supabase/functions/\",\n      \"migrations\": \"^supabase/migrations/\",\n      \"controlPlane\": \"^(config/control-plane-capabilities\\\\.json$|\\\\.forgejo/workflows/|workers/cc-execution/)\""},{"new_content":"        \"releaseOwner\": \"forgejo_runner_direct_affected_targets\",\n        \"proof\": \"immutable_cc_execution_runtime_identity\"\n      },\n      \"frontend\": {\n        \"pathPattern\": \"^(?:src/(?!__tests__/contracts/)|public/|index\\\\.html$|package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|components\\\\.json$|wrangler\\\\.toml$)\",\n        \"checks\": [\"impact_typecheck\", \"frontend_contracts\", \"build_when_critical\", \"knocklaunch_gate\"],","old_content":"        \"releaseOwner\": \"forgejo_runner_direct_affected_targets\",\n        \"proof\": \"immutable_cc_execution_runtime_identity\"\n      },\n      \"onrunner\": {\n        \"pathPattern\": \"^scripts/visual-witness-hosted-runner/\",\n        \"checks\": [\"visual_witness_runner_syntax\", \"immutable_image_build\", \"knocklaunch_gate\"],\n        \"releaseOwner\": \"forgejo_runner_direct_render_onrunner\",\n        \"proof\": \"render_onrunner_ready_exact_source_commit\"\n      },\n      \"frontend\": {\n        \"pathPattern\": \"^(?:src/(?!__tests__/contracts/)|public/|index\\\\.html$|package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|components\\\\.json$|wrangler\\\\.toml$)\",\n        \"checks\": [\"impact_typecheck\", \"frontend_contracts\", \"build_when_critical\", \"knocklaunch_gate\"],"}]},{"path":"scripts/release-event-native-plan.test.mjs","edits":[{"new_content":"const frontendVersionDeploy = fs.readFileSync(\"scripts/cloudflare-native-version-deploy.mjs\", \"utf8\");\nassert.match(frontendVersionDeploy, /frontend_candidate_source_mismatch/,\n  \"exact-source zero-traffic canary mismatch guard must remain fail-closed\");\nassert.doesNotMatch(workflow, /release_onrunner/, \"retired OnRunner release input must stay absent\");\nassert.match(workflow, /github\\.event\\.inputs\\.release_frontend == 'true'.*github\\.event\\.inputs\\.release_supabase_edge == 'true'.*github\\.event\\.inputs\\.release_migrations == 'true'/s, \"remaining mixed targets retain planning\");\nassert.match(workflow, /release-cc-execution:[\\s\\S]*?if: \\$\\{\\{ always\\(\\) && \\(\\(github\\.event_name == 'workflow_dispatch'[\\s\\S]*?github\\.event\\.inputs\\.release_cc_execution == 'true'[\\s\\S]*?needs\\.release-plan\\.outputs\\.release_cc_execution == 'true'/, \"cc-execution dispatch must run through skipped release-plan dependency\");\nassert.match(workflow, /REQUESTED_SOURCE_SHA: \\$\\{\\{ github\\.event_name == 'workflow_dispatch' && github\\.event\\.inputs\\.source_sha \\|\\| needs\\.release-plan\\.outputs\\.source_sha \\}\\}/, \"cc-execution dispatch must use authoritative source_sha input\");\nassert.doesNotMatch(workflow, /'\\/config\\/' \\\\\\n\\s*'\\/workers\\/cc-execution\\/' \\\\\\n\\s*'\\/scripts\\/' \\\\\\n\\s*'\\/supabase\\/functions\\/'/, \"Gate sparse baseline must not hydrate unrelated operational trees unconditionally\");","old_content":"const frontendVersionDeploy = fs.readFileSync(\"scripts/cloudflare-native-version-deploy.mjs\", \"utf8\");\nassert.match(frontendVersionDeploy, /frontend_candidate_source_mismatch/,\n  \"exact-source zero-traffic canary mismatch guard must remain fail-closed\");\nassert.match(workflow, /github\\.event\\.inputs\\.release_onrunner == 'true'.*github\\.event\\.inputs\\.release_frontend == 'true'.*github\\.event\\.inputs\\.release_supabase_edge == 'true'.*github\\.event\\.inputs\\.release_migrations == 'true'/s, \"cc-execution-only dispatch must skip release-plan while mixed targets retain planning\");\nassert.match(workflow, /release-cc-execution:[\\s\\S]*?if: \\$\\{\\{ always\\(\\) && \\(\\(github\\.event_name == 'workflow_dispatch'[\\s\\S]*?github\\.event\\.inputs\\.release_cc_execution == 'true'[\\s\\S]*?needs\\.release-plan\\.outputs\\.release_cc_execution == 'true'/, \"cc-execution dispatch must run through skipped release-plan dependency\");\nassert.match(workflow, /REQUESTED_SOURCE_SHA: \\$\\{\\{ github\\.event_name == 'workflow_dispatch' && github\\.event\\.inputs\\.source_sha \\|\\| needs\\.release-plan\\.outputs\\.source_sha \\}\\}/, \"cc-execution dispatch must use authoritative source_sha input\");\nassert.doesNotMatch(workflow, /'\\/config\\/' \\\\\\n\\s*'\\/workers\\/cc-execution\\/' \\\\\\n\\s*'\\/scripts\\/' \\\\\\n\\s*'\\/supabase\\/functions\\/'/, \"Gate sparse baseline must not hydrate unrelated operational trees unconditionally\");"},{"new_content":"  assert.deepEqual(decoded, [...new Set(paths)].sort());\n  const expected = releaseTargetsFromChangedPaths(paths);\n  assert.equal(outputs.release_cc_execution, String(expected.ccExecution));\n  assert.equal(Object.prototype.hasOwnProperty.call(outputs, \"release_onrunner\"), false);\n  assert.equal(outputs.release_frontend, String(expected.frontend));\n  assert.equal(outputs.release_supabase_edge, String(expected.supabaseEdge));\n  assert.equal(outputs.supabase_edge_reconcile, String(paths.includes(\"scripts/reconcile-supabase-edge-registry.mjs\")));","old_content":"  assert.deepEqual(decoded, [...new Set(paths)].sort());\n  const expected = releaseTargetsFromChangedPaths(paths);\n  assert.equal(outputs.release_cc_execution, String(expected.ccExecution));\n  assert.equal(outputs.release_onrunner, String(expected.onrunner));\n  assert.equal(outputs.release_frontend, String(expected.frontend));\n  assert.equal(outputs.release_supabase_edge, String(expected.supabaseEdge));\n  assert.equal(outputs.supabase_edge_reconcile, String(paths.includes(\"scripts/reconcile-supabase-edge-registry.mjs\")));"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"The exact supplied edits are committed to existing PR #4073 with no unrelated changes.","proofConditionIds":["proof-live"]}],"objective":"Continue exact existing PR #4073 by applying only the supplied anchored edits from locally validated commit b600cabeb94eb2a92bcb1ad2cb088874661a81c2 to branch ai/objective-first-repair-e3478acfa504. Do not create a replacement PR or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504; do not create a replacement PR.","proofConditionIds":["proof-live"]},{"id":"exact-scope","statement":"Apply only supplied anchored edits to the supplied source targets.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"After canonical Gate, squash merge, and affected releases, current live authority is Forgejo-native and retired release authority remains absent.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"The exact supplied edits are committed to existing PR #4073 with no unrelated changes.","proofConditionIds":["proof-live"]}],"objective":"Continue exact existing PR #4073 by applying only the supplied anchored edits from locally validated commit b600cabeb94eb2a92bcb1ad2cb088874661a81c2 to branch ai/objective-first-repair-e3478acfa504. Do not create a replacement PR or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504; do not create a replacement PR.","proofConditionIds":["proof-live"]},{"id":"exact-scope","statement":"Apply only supplied anchored edits to the supplied source targets.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"After canonical Gate, squash merge, and affected releases, current live authority is Forgejo-native and retired release authority remains absent.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"controlPlaneMaintenanceReason":"Owner-authorized exact continuation of existing repository authority decruft PR #4073."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"controlPlaneMaintenanceReason":"Owner-authorized exact continuation of existing repository authority decruft PR #4073."},"recovery":false,"fingerprint":"af55da5d92e51ae01db6ca79f60fb034c3f60dccd877b19397e84f4353c9f349","replayCount":0,"serializedBytes":29952},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:25:27.840111+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:aeb8e92b-8af3-4b8a-bb3c-1904e265be47:repository-mutation-intent:af55da5d92e51ae01db6ca79f60fb034c3f60dccd877b19397e84f4353c9f349:0","mission_step_id":"fca3b145-0c04-4294-a067-39a0ea64508e","command_center_event_id":"aeb8e92b-8af3-4b8a-bb3c-1904e265be47"},{"id":"ad78fbd2-6c52-4db7-aab9-b251fa723510","source":"cc-execution","status":"blocked","payload":{"ok":false,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":"control_plane_maintenance_base_sha_mismatch","status":"blocked","metrics":{"receiptBytes":30099,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:25:27.777Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"aeb8e92b-8af3-4b8a-bb3c-1904e265be47","operation":"execute_mission","proofGate":"repair_mission_execution_blocked","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":105,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":105,"missionSetupMs":223,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":223,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":223,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":223,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"aeb8e92b-8af3-4b8a-bb3c-1904e265be47"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1482,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:25:28.959124+00:00","proof_gate":"repair_mission_execution_blocked","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:aeb8e92b-8af3-4b8a-bb3c-1904e265be47:execute_mission:repair_mission_execution_blocked:current-generation","mission_step_id":"fca3b145-0c04-4294-a067-39a0ea64508e","command_center_event_id":"aeb8e92b-8af3-4b8a-bb3c-1904e265be47"},{"id":"c419d598-aacc-4e6d-b0c8-7112a4ad35ef","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[{"path":"supabase/functions/pcg-customer-progress/index.ts","content":"import {serve} from \"https://deno.land/std@0.168.0/http/server.ts\";\nimport {createClient} from \"https://esm.sh/@supabase/supabase-js@2\";\n\nexport const FUNCTION_VERSION='1.2.0-pcg-public-site-cert-lookup';\nconst cors={'Access-Control-Allow-Origin':'*','Access-Control-Allow-Headers':'authorization, x-client-info, apikey, content-type','Access-Control-Allow-Methods':'GET, POST, OPTIONS'};\nconst json=(body:unknown,status=200)=>new Response(JSON.stringify(body),{status,headers:{...cors,'Content-Type':'application/json','Cache-Control':'no-store'}});\nconst normalize=(v:unknown)=>String(v||'').trim();\nconst modeFor=(status:string)=>['received','intake_imaging'].includes(status)?'received':['authentication','grading','encapsulation','qa'].includes(status)?'grading':status==='ready'?'completed':['shipped','picked_up','delivered','closed'].includes(status)?'mailed':'received';\nconst safeCard=(card:any)=>({id:card.id,cert_number:card.cert_number||null,year:card.year||null,brand_set:card.brand_set||null,player_character:card.player_character||null,card_number:card.card_number||null,variation:card.variation||null,card_description:card.card_description||card.variation||null,autograph_present:card.autograph_present??null,grade:card.grade??null,grade_label:card.grade_label||null,front_image_url:card.front_image_url||null,back_image_url:card.back_image_url||null,slab_image_url:card.slab_image_url||null,population_count:card.population_count??null});\nasync function resolvePcg(supabase:any,tenantSlug:string){\n  if(!tenantSlug)return null;\n  const{data:tenant,error}=await supabase.from('tenants').select('id,company_slug,company_dba_name,company_legal_name,name,company_logo_url,company_phone,company_email,company_address,company_mailing_address,status,is_active,settings').eq('company_slug',tenantSlug).maybeSingle();\n  if(error)throw error;\n  const settings=(tenant?.settings||{}) as Record<string,any>;\n  const identity=[tenant?.company_slug,tenant?.company_dba_name,tenant?.company_legal_name,tenant?.name].filter(Boolean).join(' ').toLowerCase();\n  const pcg=Boolean(tenant?.id)&&(tenant?.is_active!==false)&&String(tenant?.status||'active').toLowerCase()!=='deleted'&&(tenantSlug==='pcg'||String(settings.workspace_type||'').toLowerCase()==='card_grading'||String(settings.routing_family||'').toUpperCase()==='CARD_GRADING_OPS'||identity.includes('prestigious card grading'));\n  return pcg?{tenant,settings}:null\n}\nserve(async(req)=>{\n  if(req.method==='OPTIONS')return new Response(null,{headers:cors});\n  const url=new URL(req.url);\n  if(req.method==='GET'&&url.pathname.endsWith('/health'))return json({ok:true,service:'pcg-customer-progress',version:FUNCTION_VERSION,public_actions:['public_profile','cert_lookup','legacy_path_lookup'],progress_contract:'order+email'});\n  if(req.method!=='POST')return json({ok:false,error:'Method not allowed'},405);\n  try{\n    const body=await req.json().catch(()=>({})),action=normalize(body.action).toLowerCase();\n    const tenantSlug=normalize(body.tenant_slug||'pcg').toLowerCase();\n    const supabase=createClient(Deno.env.get('SUPABASE_URL')||'',Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')||'');\n    const resolved=await resolvePcg(supabase,tenantSlug);\n    if(!resolved)return json({ok:false,error:action==='cert_lookup'?'We could not verify that PCG certification.':'We could not match that PCG record.'},200);\n    const{tenant,settings}=resolved;\n    if(action==='public_profile'){\n      const presence=(settings.public_presence||{}) as Record<string,any>,media=(settings.media_branding||{}) as Record<string,any>;\n      const paymentActive=String(settings.payment_processor_status||'').toLowerCase()==='external_payment_link_active';\n      return json({ok:true,data:{company_name:tenant.company_legal_name||tenant.company_dba_name||tenant.name||'Prestigious Card Grading LLC',short_name:tenant.company_dba_name||'PCG',logo_url:tenant.company_logo_url||null,background_url:media.hero_background_url||settings.background_image_url||settings.backgroundImageUrl||null,phone:tenant.company_phone||null,email:tenant.company_email||null,address:tenant.company_address||tenant.company_mailing_address||null,grading_services:Array.isArray(settings.grading_services)?settings.grading_services:[],no_upcharges:settings.no_upcharges===true,booking_url:presence?.bookmedirectly?.url||settings.canonical_booking_route||null,progress_url:presence?.whatsmyprogress?.url||settings.canonical_public_route||null,payment_url:paymentActive?settings.stripe_payment_link||null:null,public_cert_lookup:settings.public_cert_lookup!==false}});\n    }\n    if(action==='cert_lookup'){\n      const cert=normalize(body.cert_number).toUpperCase();if(!cert||cert.length>80)return json({ok:false,error:'Enter a PCG certification number.'},200);\n      const{data:card,error}=await supabase.from('card_grading_cards').select('id,cert_number,year,brand_set,player_character,card_number,variation,card_description,autograph_present,grade,grade_label,front_image_url,back_image_url,slab_image_url,population_count').eq('tenant_id',tenant.id).ilike('cert_number',cert).maybeSingle();\n      if(error)throw error;if(!card?.id)return json({ok:false,error:'No PCG card matched that certification number.'},200);\n      return json({ok:true,data:{card:safeCard(card)}});\n    }\n    if(action==='legacy_path_lookup'){\n      const raw=normalize(body.path||body.source_url);if(!raw||raw.length>800)return json({ok:false,error:'Legacy card link not found.'},200);\n      let path=raw;try{const parsed=new URL(raw,'https://www.pcgslab.com');path=parsed.pathname}catch{}\n      if(!path.startsWith('/'))path='/'+path;\n      const candidates=['https://www.pcgslab.com'+path,'https://pcgslab.com'+path];\n      const{data:row,error}=await supabase.from('pcg_import_rows').select('canonical_card_id').eq('tenant_id',tenant.id).in('source_url',candidates).not('canonical_card_id','is',null).limit(1).maybeSingle();\n      if(error)throw error;if(!row?.canonical_card_id)return json({ok:false,error:'Legacy card link not found.'},200);\n      const{data:card,error:cardError}=await supabase.from('card_grading_cards').select('id,cert_number,year,brand_set,player_character,card_number,variation,card_description,autograph_present,grade,grade_label,front_image_url,back_image_url,slab_image_url,population_count').eq('tenant_id',tenant.id).eq('id',row.canonical_card_id).maybeSingle();\n      if(cardError)throw cardError;if(!card?.id)return json({ok:false,error:'Legacy card link not found.'},200);\n      return json({ok:true,data:{card:safeCard(card)}});\n    }\n    const submissionNumber=normalize(body.submission_number).toUpperCase(),email=normalize(body.email).toLowerCase();\n    if(!submissionNumber||!email||!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email))return json({ok:false,error:'Enter your order number and the email used for the order.'},200);\n    const{submission}= {submission:(await supabase.from('card_grading_submissions').select('id,submission_number,customer_name,customer_email,service_tier,status,received_at,due_at,tracking_out,payment_status,delivery_method').eq('tenant_id',tenant.id).eq('submission_number',submissionNumber).ilike('customer_email',email).maybeSingle()).data};\n    if(!submission?.id)return json({ok:false,error:'We could not match that order and email.'},200);\n    const{data:cards,error:cardsError}=await supabase.from('card_grading_cards').select('id,sequence_number,cert_number,year,brand_set,player_character,card_number,card_description,autograph_present,variation,grade,grade_label,status,front_image_url,back_image_url,slab_image_url').eq('tenant_id',tenant.id).eq('submission_id',submission.id).order('sequence_number',{ascending:true});\n    if(cardsError)throw cardsError;\n    return json({ok:true,data:{tenant:{company_name:tenant.company_dba_name||tenant.company_legal_name||tenant.name||'Prestigious Card Grading',company_slug:tenant.company_slug,logo_url:tenant.company_logo_url||null},order:{submission_number:submission.submission_number,customer_name:submission.customer_name||'Collector',service_tier:submission.service_tier,status:submission.status,mode:modeFor(String(submission.status||'')),received_at:submission.received_at,due_at:submission.due_at,tracking_out:submission.tracking_out||null,payment_status:submission.payment_status||null,delivery_method:submission.delivery_method||null},cards:(cards||[]).map((card:any)=>({id:card.id,sequence_number:card.sequence_number,cert_number:card.cert_number||null,year:card.year||null,brand_set:card.brand_set||null,player_character:card.player_character||null,card_number:card.card_number||null,card_description:card.card_description||card.variation||null,autograph_present:card.autograph_present??null,grade:card.grade??null,grade_label:card.grade_label||null,status:card.status,front_image_url:card.front_image_url||null,back_image_url:card.back_image_url||null,slab_image_url:card.slab_image_url||null}))}});\n  }catch(error){console.error('[pcg-customer-progress]',error);return json({ok:false,error:'PCG is temporarily unavailable. Please try again.'},500)}\n});","expectedSha":"996862070b6a06a417aef90e1298c1427cc36a3f"},{"path":"src/pages/card-grading/PCGPublicSite.tsx","content":"import {FormEvent,useEffect,useMemo,useState,type ReactNode} from 'react';\nimport {ArrowRight,Clock3,CreditCard,ExternalLink,MapPin,PackageCheck,Phone,Search,ShieldCheck,Sparkles,Store,Truck,type LucideIcon} from 'lucide-react';\nimport {Link} from 'react-router-dom';\nimport {supabase} from '@/integrations/supabase/client';\nimport video0 from './pcgHeroVideoChunk0';\nimport video1 from './pcgHeroVideoChunk1';\nimport video2 from './pcgHeroVideoChunk2';\n\nconst HERO_VIDEO=`data:video/mp4;base64,${video0}${video1}${video2}`;\ntype PCGPublicPage='home'|'grading'|'verify'|'submit'|'shop'|'contact';\ntype Service={id?:string;label?:string;days?:number;price_per_card?:number};\ntype Profile={company_name:string;short_name:string;logo_url:string|null;background_url:string|null;phone:string|null;email:string|null;address:string|null;grading_services:Service[];no_upcharges:boolean;booking_url:string|null;progress_url:string|null;payment_url:string|null;public_cert_lookup:boolean};\ntype Card={id:string;cert_number:string|null;year:string|null;brand_set:string|null;player_character:string|null;card_number:string|null;variation:string|null;card_description:string|null;autograph_present:boolean|null;grade:number|null;grade_label:string|null;front_image_url:string|null;back_image_url:string|null;slab_image_url:string|null;population_count:number|null};\nconst BASE='/prestigious-card-grading';\nconst FALLBACK_LOGO='https://ymntrajfubicyxwwdxxa.supabase.co/functions/v1/tenant-media-library?mode=asset&id=d663baad-dc59-4e01-817d-f53cf79c27a1&variant=thumb';\nconst FALLBACK_ADDRESS='14170 US Highway 1 · Sebastian, FL 32958';\nconst NAV:[string,string][]=[['Home',BASE],['Grading',`${BASE}/grading`],['Verify Cert',`${BASE}/verify`],['Submit',`${BASE}/submit`],['Shop',`${BASE}/shop`],['Contact',`${BASE}/contact`]];\nconst HOME_FEATURES:[LucideIcon,string,string][]=[[ShieldCheck,'Consistent grading','Defined standards, authentication workflow, encapsulation and QA.'],[Clock3,'Fast turnaround','Multiple service tiers from standard turnaround through same-day grading.'],[CreditCard,'No up-charges','Straightforward per-card pricing from PCG’s canonical grading menu.']];\nconst SUBMIT_STEPS:[LucideIcon,string,string][]=[[PackageCheck,'1. Choose service','Select the turnaround that fits your collection.'],[ShieldCheck,'2. Protect each card','Package cards securely for drop-off or shipment.'],[Truck,'3. Mail or visit','Ship to or visit the Sebastian PCG shop.'],[CreditCard,'4. Complete checkout','Use the current PCG submission or secure payment link when available.']];\nconst PAGE_TITLES:Record<PCGPublicPage,string>={home:'Prestigious Card Grading | Sebastian, Florida',grading:'Grading Standards | Prestigious Card Grading',verify:'Verify a PCG Certification | Prestigious Card Grading',submit:'Start a Submission | Prestigious Card Grading',shop:'Card Shop | Prestigious Card Grading',contact:'Contact | Prestigious Card Grading'};\nfunction money(value:unknown){const n=Number(value);return Number.isFinite(n)?'$'+n.toFixed(n%1?2:0):'—'}\n\nfunction Frame({page,profile,children}:{page:PCGPublicPage;profile:Profile|null;children:ReactNode}){\n  useEffect(()=>{const previous=document.title;document.title=PAGE_TITLES[page];return()=>{document.title=previous}},[page]);\n  const logo=profile?.logo_url||FALLBACK_LOGO,phone=profile?.phone||'833-472-4752',email=profile?.email||'tony@pcgslab.com',address=profile?.address||FALLBACK_ADDRESS;\n  return <main className=\"min-h-screen bg-[#050506] text-white\"><header className=\"sticky top-0 z-50 border-b border-white/[0.09] bg-[#060607]/90 backdrop-blur-xl\"><div className=\"mx-auto flex h-20 max-w-7xl items-center gap-4 px-4 sm:px-6 lg:px-8\"><Link to={BASE} className=\"flex min-w-0 items-center gap-3\"><span className=\"grid h-11 w-11 shrink-0 place-items-center overflow-hidden rounded-xl border border-[#d8bb78]/25 bg-[#d8bb78]/[0.07]\"><img src={logo} alt=\"PCG\" className=\"h-full w-full object-contain p-1\"/></span><span className=\"hidden md:block\"><span className=\"block text-sm font-black\">Prestigious Card Grading</span><span className=\"mt-0.5 block text-[9px] font-bold uppercase tracking-[.18em] text-[#d8bb78]\">Sebastian · Florida</span></span></Link><nav className=\"ml-auto flex items-center gap-1 overflow-x-auto text-[11px] font-bold sm:text-xs\">{NAV.map(([label,to])=><Link key={to} to={to} className=\"whitespace-nowrap rounded-full px-3 py-2 text-white/55 transition hover:bg-white/[0.06] hover:text-white\">{label}</Link>)}</nav></div></header>{children}<footer className=\"border-t border-white/[0.08] bg-black/30\"><div className=\"mx-auto grid max-w-7xl gap-8 px-5 py-10 sm:px-6 md:grid-cols-3 lg:px-8\"><div><img src={logo} alt=\"PCG\" className=\"h-14 w-14 object-contain\"/><div className=\"mt-3 text-sm font-black\">{profile?.company_name||'Prestigious Card Grading LLC'}</div><p className=\"mt-2 max-w-sm text-xs leading-5 text-white/42\">Professional trading-card grading, authentication and collector services.</p></div><div className=\"text-xs leading-6 text-white/48\"><div className=\"font-black uppercase tracking-[.16em] text-[#d8bb78]\">Visit</div><div className=\"mt-2\">{address}</div></div><div className=\"text-xs leading-6 text-white/48\"><div className=\"font-black uppercase tracking-[.16em] text-[#d8bb78]\">Contact</div><a href={'tel:'+phone.replace(/[^+\\d]/g,'')} className=\"mt-2 block hover:text-white\">{phone}</a><a href={'mailto:'+email} className=\"block hover:text-white\">{email}</a></div></div></footer></main>\n}\nfunction ServiceGrid({profile}:{profile:Profile|null}){const services=profile?.grading_services||[];return <div className=\"grid gap-px overflow-hidden border border-white/[0.09] bg-white/[0.09] sm:grid-cols-2 lg:grid-cols-4\">{services.length?services.map(service=><div key={service.id||service.label} className=\"bg-[#0a0a0b] p-6\"><div className=\"text-[10px] font-black uppercase tracking-[.17em] text-white/34\">{service.label||'Grading'}</div><div className=\"mt-2 text-4xl font-black text-[#e4c77f]\">{money(service.price_per_card)}</div><div className=\"mt-1 text-xs text-white/38\">per card{service.days===0?' · same day':service.days?(' · '+service.days+' day'+(service.days===1?'':'s')):''}</div></div>):<div className=\"col-span-full bg-[#0a0a0b] p-6 text-sm text-white/45\">Grading service pricing is being loaded from PCG.</div>}</div>}\n\nfunction Home({profile}:{profile:Profile|null}){const bg=profile?.background_url;return <Frame page=\"home\" profile={profile}><section className=\"relative isolate overflow-hidden border-b border-white/[0.08]\">{bg?<img src={bg} alt=\"\" aria-hidden=\"true\" className=\"absolute inset-0 -z-30 h-full w-full object-cover\"/>:null}<div className=\"absolute inset-0 -z-20 bg-[linear-gradient(90deg,rgba(4,4,5,.98)_0%,rgba(4,4,5,.90)_48%,rgba(4,4,5,.68)_100%)]\"/><div className=\"mx-auto grid min-h-[520px] max-w-7xl items-center gap-10 px-5 py-14 sm:px-6 lg:grid-cols-[minmax(0,1fr)_minmax(420px,.92fr)] lg:px-8\"><div><div className=\"inline-flex items-center gap-2 text-[10px] font-black uppercase tracking-[.22em] text-[#d8bb78]\"><Sparkles className=\"h-4 w-4\"/>Prestigious Card Grading</div><h1 className=\"mt-5 max-w-3xl text-5xl font-black leading-[.9] tracking-[-.055em] sm:text-7xl\">Cards deserve a grade you can trust.</h1><p className=\"mt-6 max-w-xl text-base leading-7 text-white/62 sm:text-lg\">Professional trading-card grading, authentication, premium slabs and fast turnaround with transparent per-card pricing.</p><div className=\"mt-8 flex flex-wrap gap-3\"><Link to={`${BASE}/submit`} className=\"inline-flex items-center gap-2 bg-[#d8bb78] px-6 py-3.5 text-sm font-black text-black\">Start a submission <ArrowRight className=\"h-4 w-4\"/></Link><Link to={`${BASE}/verify`} className=\"inline-flex items-center gap-2 border border-white/15 bg-black/35 px-6 py-3.5 text-sm font-black\">Verify a PCG cert</Link></div></div><div className=\"relative mx-auto w-full max-w-[720px] overflow-hidden rounded-[26px] border border-white/12 bg-black/75 shadow-[0_30px_90px_rgba(0,0,0,.58)]\"><div className=\"aspect-video\"><video src={HERO_VIDEO} autoPlay muted loop playsInline preload=\"metadata\" className=\"h-full w-full object-cover motion-reduce:hidden\"/><div className=\"absolute inset-0 ring-1 ring-inset ring-[#d8bb78]/10\"/></div></div></div></section><section className=\"mx-auto max-w-7xl px-5 py-12 sm:px-6 lg:px-8\"><ServiceGrid profile={profile}/><div className=\"mt-12 grid gap-8 lg:grid-cols-3\">{HOME_FEATURES.map(([Icon,title,copy])=><article key={title} className=\"border-t border-white/[0.09] pt-6\"><Icon className=\"h-6 w-6 text-[#d8bb78]\"/><h2 className=\"mt-5 text-xl font-black\">{title}</h2><p className=\"mt-2 text-sm leading-6 text-white/42\">{copy}</p></article>)}</div><div className=\"mt-12 flex flex-wrap gap-3\">{profile?.progress_url?<a href={profile.progress_url} className=\"bg-white px-5 py-3 text-sm font-black text-black\">Check grading progress</a>:null}{profile?.booking_url?<a href={profile.booking_url} className=\"border border-white/15 px-5 py-3 text-sm font-black\">Start a submission</a>:null}</div></section></Frame>}\nfunction Grading({profile}:{profile:Profile|null}){return <Frame page=\"grading\" profile={profile}><section className=\"mx-auto max-w-7xl px-5 py-16 sm:px-6 lg:px-8\"><div className=\"max-w-3xl\"><div className=\"text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\">PCG grading standards</div><h1 className=\"mt-3 text-5xl font-black tracking-[-.05em] sm:text-6xl\">Clear standards. Real turnaround choices.</h1><p className=\"mt-5 text-base leading-7 text-white/48\">PCG evaluates card condition through a structured grading and quality-control workflow.</p></div><div className=\"mt-10\"><ServiceGrid profile={profile}/></div><div className=\"mt-12 grid gap-10 lg:grid-cols-2\"><section><div className=\"text-[10px] font-black uppercase tracking-[.17em] text-[#d8bb78]\">Common categories</div><div className=\"mt-4 flex flex-wrap gap-2\">{['Sports','Pokémon','One Piece','Lorcana','Disney','Marvel','Magic: The Gathering'].map(item=><span key={item} className=\"border border-white/10 bg-white/[0.035] px-4 py-2 text-xs font-bold text-white/64\">{item}</span>)}</div></section><section className=\"border-l border-white/[0.08] lg:pl-8\"><div className=\"text-[10px] font-black uppercase tracking-[.17em] text-[#d8bb78]\">Grade guide</div><div className=\"mt-4 divide-y divide-white/[0.08]\">{[['10','Exceptional presentation with virtually no visible handling flaws.'],['9','Mint presentation with only minor imperfections on close inspection.'],['8','Near mint-mint condition with light imperfections.'],['7','Near mint condition with more noticeable but limited wear.']].map(([grade,copy])=><div key={grade} className=\"py-5\"><div className=\"text-lg font-black\">PCG {grade}</div><p className=\"mt-1 text-sm leading-6 text-white/42\">{copy}</p></div>)}</div></section></div></section></Frame>}\nfunction Verify({profile}:{profile:Profile|null}){const[cert,setCert]=useState('');const[card,setCard]=useState<Card|null>(null);const[busy,setBusy]=useState(false);const[error,setError]=useState('');async function submit(event:FormEvent){event.preventDefault();if(!cert.trim()||busy)return;setBusy(true);setError('');setCard(null);try{const{data, error:fnError}=await supabase.functions.invoke('pcg-customer-progress',{body:{action:'cert_lookup',tenant_slug:'pcg',cert_number:cert.trim()}});if(fnError||!data?.ok)throw new Error(data?.error||fnError?.message||'Certification lookup failed.');setCard(data.data.card)}catch(e){setError(e instanceof Error?e.message:String(e))}finally{setBusy(false)}}const image=card?.slab_image_url||card?.front_image_url||card?.back_image_url;return <Frame page=\"verify\" profile={profile}><section className=\"mx-auto max-w-5xl px-5 py-16 sm:px-6 lg:px-8\"><div className=\"max-w-3xl\"><div className=\"text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\">PCG certification</div><h1 className=\"mt-3 text-5xl font-black tracking-[-.05em] sm:text-6xl\">Verify the slab.</h1><p className=\"mt-4 text-base text-white/48\">Enter the PCG certification number printed on the label.</p></div><form onSubmit={submit} className=\"mt-8 grid gap-3 sm:grid-cols-[1fr_auto]\"><input value={cert} onChange={event=>setCert(event.target.value)} placeholder=\"PCG certification number\" className=\"h-14 border border-white/12 bg-white/[.04] px-4 text-lg font-bold outline-none focus:border-[#d8bb78]/55\"/><button disabled={busy||!cert.trim()} className=\"inline-flex h-14 items-center justify-center gap-2 bg-[#d8bb78] px-6 font-black text-black disabled:opacity-40\"><Search className=\"h-4 w-4\"/>{busy?'Checking…':'Verify'}</button></form>{error?<div className=\"mt-5 border border-amber-300/20 bg-amber-300/[.05] p-4 text-sm text-amber-100\">{error}</div>:null}{card?<div className=\"mt-8 grid gap-6 border border-white/[.09] bg-white/[.035] p-5 sm:p-7 md:grid-cols-[minmax(220px,.7fr)_1.3fr]\">{image?<img src={image} alt=\"Verified PCG graded card\" className=\"max-h-[520px] w-full object-contain\"/>:<div className=\"grid min-h-72 place-items-center border border-white/10 text-sm text-white/30\">No public card image</div>}<div><div className=\"text-[10px] font-black uppercase tracking-[.18em] text-emerald-300\">Verified PCG record</div><div className=\"mt-3 text-5xl font-black text-[#d8bb78]\">{card.grade??'—'}</div><div className=\"mt-1 text-xs uppercase tracking-[.15em] text-white/35\">{card.grade_label||'PCG grade'}</div><h2 className=\"mt-6 text-2xl font-black\">{[card.year,card.brand_set,card.player_character].filter(Boolean).join(' · ')||'PCG graded card'}</h2><div className=\"mt-4 space-y-2 text-sm text-white/52\"><div><span className=\"text-white/28\">Cert</span> · {card.cert_number}</div>{card.card_number?<div><span className=\"text-white/28\">Card #</span> · {card.card_number}</div>:null}{card.variation?<div><span className=\"text-white/28\">Variation</span> · {card.variation}</div>:null}{card.population_count!=null?<div><span className=\"text-white/28\">Population</span> · {card.population_count}</div>:null}</div></div></div>:null}</section></Frame>}\nfunction Submit({profile}:{profile:Profile|null}){const booking=profile?.booking_url,payment=profile?.payment_url;return <Frame page=\"submit\" profile={profile}><section className=\"mx-auto max-w-7xl px-5 py-16 sm:px-6 lg:px-8\"><div className=\"grid gap-12 lg:grid-cols-[.9fr_1.1fr]\"><div><div className=\"text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\">Start a submission</div><h1 className=\"mt-3 text-5xl font-black tracking-[-.05em] sm:text-6xl\">Get your cards onto the PCG bench.</h1><p className=\"mt-5 max-w-xl text-base leading-7 text-white/48\">Choose your turnaround, prepare the cards securely, and use PCG's current submission channel for drop-off or mail-in grading.</p><div className=\"mt-8 flex flex-wrap gap-3\">{booking?<a href={booking} className=\"inline-flex items-center gap-2 bg-[#d8bb78] px-6 py-3.5 text-sm font-black text-black\">Start submission <ExternalLink className=\"h-4 w-4\"/></a>:null}{payment?<a href={payment} target=\"_blank\" rel=\"noreferrer\" className=\"inline-flex items-center gap-2 border border-white/15 px-6 py-3.5 text-sm font-black\">Secure checkout <ExternalLink className=\"h-4 w-4\"/></a>:null}</div></div><div className=\"grid gap-px overflow-hidden border border-white/[0.09] bg-white/[0.09] sm:grid-cols-2\">{SUBMIT_STEPS.map(([Icon,title,copy])=><article key={title} className=\"bg-[#0a0a0b] p-6\"><Icon className=\"h-6 w-6 text-[#d8bb78]\"/><h2 className=\"mt-5 text-lg font-black\">{title}</h2><p className=\"mt-2 text-sm leading-6 text-white/42\">{copy}</p></article>)}</div></div><div className=\"mt-12 border border-[#d8bb78]/20 bg-[#d8bb78]/[0.055] p-6\"><div className=\"text-[10px] font-black uppercase tracking-[.17em] text-[#d8bb78]\">Mail / drop-off</div><div className=\"mt-3 text-xl font-black\">Prestigious Card Grading</div><div className=\"mt-2 text-sm text-white/55\">{profile?.address||FALLBACK_ADDRESS}</div></div></section></Frame>}\nfunction Shop({profile}:{profile:Profile|null}){return <Frame page=\"shop\" profile={profile}><section className=\"mx-auto max-w-7xl px-5 py-20 sm:px-6 lg:px-8\"><div className=\"flex items-center gap-2 text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\"><Store className=\"h-4 w-4\"/>Sebastian storefront</div><h1 className=\"mt-4 max-w-3xl text-5xl font-black tracking-[-.05em] sm:text-7xl\">Grading and collecting under one roof.</h1><p className=\"mt-5 max-w-xl text-base leading-7 text-white/55\">Visit the PCG storefront for graded cards, packs and collector inventory alongside the grading operation.</p><Link to={`${BASE}/contact`} className=\"mt-8 inline-flex bg-white px-5 py-3 text-sm font-black text-black\">Visit PCG</Link></section></Frame>}\nfunction Contact({profile}:{profile:Profile|null}){const phone=profile?.phone||'833-472-4752',email=profile?.email||'tony@pcgslab.com';return <Frame page=\"contact\" profile={profile}><section className=\"mx-auto max-w-7xl px-5 py-16 sm:px-6 lg:px-8\"><div className=\"max-w-3xl\"><div className=\"text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\">Contact PCG</div><h1 className=\"mt-3 text-5xl font-black tracking-[-.05em] sm:text-6xl\">Questions, drop-offs, mail-ins — PCG is here.</h1></div><div className=\"mt-10 grid gap-px overflow-hidden border border-white/[0.09] bg-white/[0.09] md:grid-cols-3\">{[[MapPin,'Location',profile?.address||FALLBACK_ADDRESS],[Phone,'Phone',phone],[ShieldCheck,'Customer portal','Track a grading order securely through WhatsMyProgress.']].map(([Icon,title,copy]:any)=><article key={title} className=\"bg-[#0a0a0b] p-6\"><Icon className=\"h-6 w-6 text-[#d8bb78]\"/><h2 className=\"mt-5 text-lg font-black\">{title}</h2><p className=\"mt-2 text-sm leading-6 text-white/48\">{copy}</p></article>)}</div><div className=\"mt-8 flex flex-wrap gap-3\"><a href={'tel:'+phone.replace(/[^+\\d]/g,'')} className=\"bg-[#d8bb78] px-6 py-3.5 text-sm font-black text-black\">Call PCG</a><a href={'mailto:'+email} className=\"border border-white/15 px-6 py-3.5 text-sm font-black\">Email PCG</a>{profile?.progress_url?<a href={profile.progress_url} className=\"border border-white/15 px-6 py-3.5 text-sm font-black\">Check progress</a>:null}</div></section></Frame>}\nexport default function PCGPublicSite({page='home'}:{page?:PCGPublicPage}){const[profile,setProfile]=useState<Profile|null>(null);const[loading,setLoading]=useState(true);useEffect(()=>{let cancelled=false;void supabase.functions.invoke('pcg-customer-progress',{body:{action:'public_profile',tenant_slug:'pcg'}}).then(({data})=>{if(!cancelled&&data?.ok)setProfile(data.data||null)}).finally(()=>{if(!cancelled)setLoading(false)});return()=>{cancelled=true}},[]);const fallback=useMemo<Profile|null>(()=>profile,[profile]);if(loading&&!fallback)return <main className=\"grid min-h-screen place-items-center bg-[#050506] text-white\"><div className=\"text-center\"><img src={FALLBACK_LOGO} alt=\"PCG\" className=\"mx-auto h-16 w-16 animate-pulse object-contain\"/><div className=\"mt-4 text-xs font-black uppercase tracking-[.2em] text-[#d8bb78]\">Loading PCG</div></div></main>;if(page==='grading')return <Grading profile={fallback}/>;if(page==='verify')return <Verify profile={fallback}/>;if(page==='submit')return <Submit profile={fallback}/>;if(page==='shop')return <Shop profile={fallback}/>;if(page==='contact')return <Contact profile={fallback}/>;return <Home profile={fallback}/>;}","expectedSha":"1521a84029eabfefa1045c271b69316f5b6a3c6a"},{"path":"src/routes/publicRoutes.tsx","content":"/**\n * Public Routes Configuration\n * Login + signup + customer-facing public pages — every page is React.lazy.\n * Keeping these eager bundled SignAgreement, AgreementVerification, and the\n * customer portal into the initial chunk for every authenticated user.\n * KNOCKLAUNCH_CHANGE_STAMP: 2026-08-11T21:42:00Z — ai/big-papis-mobile-vendor-20260811 — Big Papi mobile vendor\n */\n\nimport React, { Suspense } from 'react';\nimport { Navigate, Route, useParams } from 'react-router-dom';\nimport PublicRoute from '@/components/PublicRoute';\nimport { UniversalLoadingScreen } from '@/components/ui/universal-loading-screen';\nimport { lazyWithRetry } from '@/lib/lazyWithRetry';\nimport AuthShell from '@/shells/auth/AuthShell';\nimport BuilderShell from '@/shells/builder/BuilderShell';\nimport CustomerPortalShell from '@/shells/customer-portal/CustomerPortalShell';\nimport FieldMobileShell from '@/shells/field-mobile/FieldMobileShell';\nimport UtilityShell from '@/shells/utility/UtilityShell';\nimport { useAuth } from '@/contexts/AuthContext';\nimport { MultiTenantProvider, type MultiTenantPreviewSeed, type Tenant } from '@/contexts/MultiTenantContext';\nimport { GodModePageOverrideRuntime } from '@/components/godmode/GodModePageOverrideRuntime';\nimport { supabase } from '@/integrations/supabase/client';\nimport { isPlatformAdmin } from '@/lib/auth/platformAdmins';\nimport { verifyServerAdminAuthority } from '@/lib/auth/serverAdminAuthority';\nimport { APPLICATION_CAPABILITY_REGISTRY, getTenantApplicationBySlug, getTenantApplicationByStandaloneHost, getTenantApplicationLoginAliases } from '@/config/applicationCapabilityRegistry';\n\nconst Login = lazyWithRetry(() => import('@/pages/Login'));\nconst OAuthLogin = lazyWithRetry(() => import('@/pages/auth/OAuthLogin'));\nconst Signup = lazyWithRetry(() => import('@/pages/Signup'));\nconst MultiTenantSignup = lazyWithRetry(() => import('@/pages/MultiTenantSignup'));\nconst SignupVerify = lazyWithRetry(() => import('@/pages/SignupVerify'));\nimport SignAgreement from '@/pages/SignAgreement';\nconst AgreementVerification = lazyWithRetry(() => import('@/pages/AgreementVerification'));\nconst CustomerPortalPage = lazyWithRetry(() => import('@/components/portal/CustomerPortalPage'));\nconst WhatsMyProgressPortalPage = lazyWithRetry(() => import('@/pages/portal/WhatsMyProgressPortalPage'));\nconst Unsubscribe = lazyWithRetry(() => import('@/pages/Unsubscribe'));\nconst Pricing = lazyWithRetry(() => import('@/pages/Pricing'));\nconst TrialSignup = lazyWithRetry(() => import('@/pages/TrialSignup'));\nconst DocumentUploadPortal = lazyWithRetry(() => import('@/pages/DocumentUploadPortal'));\nconst StormReportViewer = lazyWithRetry(() => import('@/pages/StormReportViewer'));\nconst HomeownerStormReportPortal = lazyWithRetry(() => import('@/pages/HomeownerStormReportPortal'));\nconst MobileCallControlPage = lazyWithRetry(() => import('@/pages/mobile/MobileCallControlPage'));\nconst SceTarpingEmergencyHelp = lazyWithRetry(() => import('@/pages/SceTarpingEmergencyHelp'));\nconst RoofHelpLandingPage = lazyWithRetry(() => import('@/pages/RoofHelpLandingPage'));\nconst RoofHelpResourcePage = lazyWithRetry(() => import('@/pages/RoofHelpResourcePage'));\nconst BuildSource = lazyWithRetry(() => import('@/pages/BuildSource'));\nconst InteractionProof = lazyWithRetry(() => import('@/pages/InteractionProof')); \nconst TenantQuickSetup = lazyWithRetry(() => import('@/pages/TenantQuickSetup'));\nconst BuildMyDemo = lazyWithRetry(() => import('@/pages/BuildMyDemo'));\nconst RoofBuilderStudio = lazyWithRetry(() => import('@/pages/RoofBuilderStudio'));\nconst RoofWebsiteMockLab = lazyWithRetry(() => import('@/pages/RoofWebsiteMockLab'));\nconst RoofPublicAssetEngine = lazyWithRetry(() => import('@/pages/RoofPublicAssetEngine'));\nconst RoofBuilderImplementationMap = lazyWithRetry(() => import('@/pages/RoofBuilderImplementationMap'));\nconst RoofBuilderAdminPreview = lazyWithRetry(() => import('@/pages/RoofBuilderAdminPreview'));\nconst RoofBuilderSalesIntelligence = lazyWithRetry(() => import('@/pages/RoofBuilderSalesIntelligence'));\nconst StatePhotoDocsPublicPreview = lazyWithRetry(() => import('@/pages/StatePhotoDocsPublicPreview'));\nconst LawnCareServiceRequest = lazyWithRetry(() => import('@/pages/lawn-care/LawnCareServiceRequest'));\nconst SeasideBookingProfile = lazyWithRetry(() => import('@/pages/seaside/SeasideBookingProfile'));\nconst BigPapisPublic = lazyWithRetry(() => import('@/pages/mobile-vendor/BigPapisPublicWithVideoBackground'));\nconst BigPapisBookingReferralPage = lazyWithRetry(() => import('@/pages/mobile-vendor/BigPapisBookingReferralPage'));\nconst TranzformerAutoDetailingPublic = lazyWithRetry(() => import('@/pages/auto-detailing/TranzformerAutoDetailingPublic'));\nconst AutoUnlockPublic = lazyWithRetry(() => import('@/pages/auto-lockout/AutoUnlockPublic')); \nconst CafeQsrPublic = lazyWithRetry(() => import('@/pages/cafe-qsr/ThirstyPandaPublic'));\nconst ShortTermRentalPublic = lazyWithRetry(() => import('@/pages/rental/ShortTermRentalPublic'));\nconst MapboxSmokeLawn = lazyWithRetry(() => import('@/pages/MapboxSmokeLawn'));\nconst QRRedirectPage = lazyWithRetry(() => import('@/pages/QRRedirectPage'));\nconst BookMeDirectlyPublicPage = lazyWithRetry(() => import('@/pages/book-me-directly/BookMeDirectlyPublicPage'));\nconst TenantPublicWebsitePage = lazyWithRetry(() => import('@/pages/public/TenantPublicWebsitePage'));\nconst PCGPublicSite = lazyWithRetry(() => import('@/pages/card-grading/PCGPublicSite'));\n\nconst Fallback = () => {\n  const hostname = typeof window === 'undefined' ? '' : window.location.hostname;\n  if (hostname === 'bigpapiscoquitoiceys.com' || hostname === 'www.bigpapiscoquitoiceys.com') return null;\n  if (ROOF_HELP_FINDER_HOSTS.has(hostname)) {\n    return (\n      <div className=\"flex min-h-screen items-center justify-center overflow-hidden bg-[#07110e] px-6\">\n        <div className=\"flex flex-col items-center text-center\">\n          <img\n            src=\"https://pub-dff1261603f24e1cb9f9c24801e4a94b.r2.dev/6880eaa9-6f59-4631-8b97-d303c0540735.png\"\n            alt=\"Roof Help Finder\"\n            className=\"w-[min(82vw,520px)] animate-pulse object-contain drop-shadow-[0_18px_50px_rgba(0,0,0,0.45)]\"\n          />\n          <div className=\"mt-6 h-1.5 w-36 overflow-hidden rounded-full bg-white/10\">\n            <div className=\"h-full w-2/3 animate-pulse rounded-full bg-[#b9e3c7]\" />\n          </div>\n        </div>\n      </div>\n    );\n  }\n  return <UniversalLoadingScreen title=\"Loading KNOCKLAUNCH\" subtitle=\"Preparing your workspace.\" />;\n};\nconst PortalFallback = () => (\n  <div className=\"flex min-h-screen items-center justify-center bg-transparent px-5\">\n    <div className=\"w-full max-w-sm rounded-3xl bg-white p-8 text-center shadow-2xl\">\n      <img src=\"/tenant-logos/encore-public-adjusters.png\" alt=\"Encore Public Adjusters\" className=\"mx-auto h-32 w-auto object-contain\" />\n      <p className=\"mt-5 text-lg font-semibold text-slate-900\">Loading your claim portal now.</p>\n      <div className=\"mx-auto mt-5 h-1.5 w-40 overflow-hidden rounded-full bg-slate-100\">\n        <div className=\"h-full w-2/3 animate-pulse rounded-full bg-sky-700\" />\n      </div>\n    </div>\n  </div>\n);\nfunction WhatsMyProgressFallback() {\n  const { tenantSlug } = useParams();\n  const tenantName = String(tenantSlug || 'your company').replace(/[-_]+/g, ' ').replace(/\\b\\w/g, (letter) => letter.toUpperCase());\n  return (\n    <div className=\"grid min-h-screen place-items-center bg-[#090b0f] px-6 text-white\">\n      <div className=\"w-full max-w-md rounded-[2rem] border border-white/10 bg-white/[0.055] p-8 text-center shadow-2xl backdrop-blur-xl\">\n        <div className=\"mx-auto h-12 w-12 animate-pulse rounded-2xl bg-white/10\" />\n        <p className=\"mt-5 text-xs font-bold uppercase tracking-[0.22em] text-white/40\">Secure customer portal</p>\n        <p className=\"mt-2 text-xl font-semibold\">Opening {tenantName}</p>\n        <div className=\"mx-auto mt-6 h-1.5 w-40 overflow-hidden rounded-full bg-white/10\"><div className=\"h-full w-2/3 animate-pulse rounded-full bg-[#dc2634]\" /></div>\n      </div>\n    </div>\n  );\n}\nconst S = (node: React.ReactNode) => <Suspense fallback={<Fallback />}>{node}</Suspense>;\nconst P = (node: React.ReactNode) => <Suspense fallback={<PortalFallback />}>{node}</Suspense>;\nconst W = (node: React.ReactNode) => <Suspense fallback={<WhatsMyProgressFallback />}>{node}</Suspense>;\nconst BIG_PAPIS_PUBLIC_HOSTS = new Set(['bigpapiscoquitoiceys.com', 'www.bigpapiscoquitoiceys.com']);\nconst ROOF_HELP_FINDER_HOSTS = new Set(['roofhelpfinder.com', 'www.roofhelpfinder.com']);\nconst ROOF_HELP_MARKET_SLUGS = ['palm-bay', 'melbourne', 'west-melbourne', 'malabar', 'grant-valkaria', 'indialantic', 'melbourne-beach', 'satellite-beach', 'indian-harbour-beach', 'palm-shores', 'rockledge', 'viera', 'suntree', 'cocoa', 'cocoa-beach', 'merritt-island', 'cape-canaveral', 'port-st-john', 'titusville', 'mims'] as const;\n\nfunction PublicTenantLiveEditBridge({ tenantSlug, children }: { tenantSlug: string; children: React.ReactNode }) {\n  const { user, loading } = useAuth();\n  const [seed, setSeed] = React.useState<MultiTenantPreviewSeed | null>(null);\n\n  React.useEffect(() => {\n    let cancelled = false;\n    if (loading || !user) {\n      setSeed(null);\n      return () => { cancelled = true; };\n    }\n\n    void (async () => {\n      const tenantResult = await (supabase as any)\n        .from('tenants')\n        .select('*')\n        .eq('company_slug', tenantSlug)\n        .eq('status', 'active')\n        .maybeSingle();\n      if (cancelled || tenantResult.error || !tenantResult.data?.id) {\n        if (!cancelled) setSeed(null);\n        return;\n      }\n\n      const tenant = tenantResult.data as Tenant;\n      const accessResult = await (supabase as any)\n        .from('user_tenant_access')\n        .select('effective_role,is_owner,membership_status')\n        .eq('user_id', user.id)\n        .eq('tenant_id', tenant.id)\n        .maybeSingle();\n      const platformAdmin = isPlatformAdmin(user.email) || await verifyServerAdminAuthority(user.id).catch(() => false);\n      if (cancelled) return;\n\n      const access = accessResult.data as { effective_role?: string | null; is_owner?: boolean | null; membership_status?: string | null } | null;\n      const effectiveRole = String(access?.effective_role || '');\n      const tenantEditor = access?.membership_status === 'active'\n        && (Boolean(access?.is_owner) || ['Owner', 'Tenant Owner', 'Admin'].includes(effectiveRole));\n      if (!platformAdmin && !tenantEditor) {\n        setSeed(null);\n        return;\n      }\n\n      setSeed({\n        tenant,\n        role: platformAdmin ? 'GodMode' : (effectiveRole || 'Owner'),\n        userId: user.id,\n      });\n    })();\n\n    return () => { cancelled = true; };\n  }, [loading, tenantSlug, user?.email, user?.id]);\n\n  if (!seed) return <>{children}</>;\n  return (\n    <MultiTenantProvider previewSeed={seed}>\n      <GodModePageOverrideRuntime />\n      {children}\n    </MultiTenantProvider>\n  );\n}\n\nfunction ApplicationLoginRoute({ appSlug }: { appSlug: string }) {\n  const app = getTenantApplicationBySlug(appSlug);\n  if (!app) return <Navigate to=\"/login\" replace />;\n  return <AuthShell><PublicRoute><Login /></PublicRoute></AuthShell>;\n}\n\nfunction LegacySignAgreementTokenRoute() {\n  const { token } = useParams();\n  const normalizedToken = String(token || '').trim();\n  return normalizedToken ? <Navigate to={`/sign-agreement?token=${encodeURIComponent(normalizedToken)}`} replace /> : <Navigate to=\"/sign-agreement\" replace />;\n}\n\nfunction PublicRootRoute() {\n  const hostname = typeof window === 'undefined' ? '' : window.location.hostname;\n  const standaloneHostApp = getTenantApplicationByStandaloneHost(hostname);\n  if (standaloneHostApp?.loginPath) return <Navigate to={standaloneHostApp.loginPath} replace />;\n  if (ROOF_HELP_FINDER_HOSTS.has(hostname)) return <RoofHelpLandingPage />;\n  if (BIG_PAPIS_PUBLIC_HOSTS.has(hostname)) {\n    return (\n      <PublicTenantLiveEditBridge tenantSlug=\"big-papis\">\n        <BigPapisPublic />\n      </PublicTenantLiveEditBridge>\n    );\n  }\n\n  return <AuthShell><PublicRoute><Login /></PublicRoute></AuthShell>;\n}\n\nfunction BigPapisCustomDomainRoute({ internalPath, hash }: { internalPath: string; hash: string }) {\n  const hostname = typeof window === 'undefined' ? '' : window.location.hostname;\n  if (!BIG_PAPIS_PUBLIC_HOSTS.has(hostname)) return <Navigate to={internalPath} replace />;\n  return <Navigate to={`/#${hash}`} replace />;\n}\n\nfunction BigPapisCustomDomainReferralRoute() {\n  const hostname = typeof window === 'undefined' ? '' : window.location.hostname;\n  if (!BIG_PAPIS_PUBLIC_HOSTS.has(hostname)) return <Navigate to=\"/big-papis/referrals\" replace />;\n  return <BigPapisBookingReferralPage />;\n}\n\ntype ByChefApPage = 'home' | 'where' | 'book';\ntype ByChefApScheduleEvent = { id: string; event_name: string; event_date: string; venue?: string | null; city?: string | null };\n\nfunction ByChefApPublic({ page = 'home' }: { page?: ByChefApPage }) {\n  const [brand, setBrand] = React.useState<any>(null);\n  const [schedule, setSchedule] = React.useState<ByChefApScheduleEvent[]>([]);\n  const [loadingSchedule, setLoadingSchedule] = React.useState(true);\n  const [submitting, setSubmitting] = React.useState(false);\n  const [sent, setSent] = React.useState(false);\n  const [error, setError] = React.useState<string | null>(null);\n  const [form, setForm] = React.useState({ service: 'Catering', date: '', time: '', location: '', guests: '', name: '', phone: '', email: '', notes: '' });\n\n  React.useEffect(() => {\n    let cancelled = false;\n    Promise.all([\n      supabase.functions.invoke('mobile-vendor-event-request', { body: { action: 'public_config', tenant_slug: 'bychefap' } }),\n      supabase.functions.invoke('mobile-vendor-event-request', { body: { action: 'public_schedule', tenant_slug: 'bychefap' } }),\n    ]).then(([brandResult, scheduleResult]) => {\n      if (cancelled) return;\n      if (!brandResult.error && brandResult.data?.ok) setBrand(brandResult.data.public_config || null);\n      if (!scheduleResult.error && scheduleResult.data?.ok) setSchedule(scheduleResult.data.public_schedule || []);\n    }).catch(() => {}).finally(() => { if (!cancelled) setLoadingSchedule(false); });\n    return () => { cancelled = true; };\n  }, []);\n\n  React.useEffect(() => {\n    const previous = document.title;\n    document.title = 'BYCHEFAP | Palm Bay Private Chef, Catering & Events';\n    return () => { document.title = previous; };\n  }, []);\n\n  const logoUrl = String(brand?.company_logo_url || brand?.logo_url || '').trim();\n  const inputClass = 'min-h-12 w-full rounded-2xl border border-black/10 bg-white px-4 text-sm text-[#151515] outline-none focus:border-black/40 focus:ring-2 focus:ring-black/10';\n\n  const submitRequest = async (event: React.FormEvent) => {\n    event.preventDefault();\n    if (submitting) return;\n    setSubmitting(true);\n    setError(null);\n    try {\n      const result = await supabase.functions.invoke('mobile-vendor-event-request', {\n        body: {\n          tenant_slug: 'bychefap', event_type: form.service, event_date: form.date, preferred_time: form.time,\n          location: form.location, guests: form.guests,\n          setup: form.service === 'Food Truck / Events' ? 'Food truck' : form.service,\n          service_style: form.service, indoor_outdoor: 'Mixed / unsure', flavors: [],\n          customer_name: form.name, phone: form.phone, email: form.email, notes: form.notes,\n          landing_path: `${window.location.pathname}${window.location.search}`,\n          referrer: document.referrer || null,\n          utm_source: new URLSearchParams(window.location.search).get('utm_source'),\n          utm_medium: new URLSearchParams(window.location.search).get('utm_medium'),\n          utm_campaign: new URLSearchParams(window.location.search).get('utm_campaign'),\n          utm_content: new URLSearchParams(window.location.search).get('utm_content'),\n        },\n      });\n      if (result.error || !result.data?.ok) {\n        setError(typeof result.data?.error === 'string' ? result.data.error : 'We could not save your request. Please try again.');\n        return;\n      }\n      setSent(true);\n    } catch {\n      setError('We could not save your request. Please try again.');\n    } finally {\n      setSubmitting(false);\n    }\n  };\n\n  return (\n    <main className=\"min-h-screen bg-[#f3f0e9] text-[#111]\">\n      <header className=\"sticky top-0 z-20 border-b border-black/10 bg-[#f3f0e9]/95 backdrop-blur\">\n        <div className=\"mx-auto flex max-w-6xl items-center justify-between gap-4 px-4 py-3 sm:px-6\">\n          <a href=\"/bychefap\" className=\"flex items-center gap-3\" aria-label=\"BYCHEFAP home\">\n            {logoUrl ? <img src={logoUrl} alt=\"BYCHEFAP\" className=\"h-12 w-12 object-contain\" /> : <span className=\"grid h-11 w-11 place-items-center rounded-full border-2 border-black text-sm font-black\">AP</span>}\n            <span className=\"text-sm font-black tracking-[0.2em]\">BYCHEFAP</span>\n          </a>\n          <nav className=\"flex items-center gap-1 text-xs font-bold sm:gap-2 sm:text-sm\">\n            <a href=\"/crm/MOBILE_VENDOR/bychefap/dashboard\" className=\"rounded-full bg-black px-4 py-2.5 text-white\">Open My Workspace</a>\n            <a href=\"/crm/login\" className=\"rounded-full border border-black/20 px-4 py-2.5 hover:bg-black/5\">Sign In</a>\n          </nav>\n        </div>\n      </header>\n\n      {page === 'home' && <>\n        <section className=\"mx-auto grid min-h-[72vh] max-w-6xl items-center gap-10 px-5 py-16 md:grid-cols-[0.9fr_1.1fr] md:px-8\">\n          <div>\n            <div className=\"mb-5 text-xs font-black uppercase tracking-[0.28em] text-black/50\">Palm Bay · Brevard County · Florida</div>\n            <h1 className=\"max-w-3xl text-5xl font-black leading-[0.92] tracking-[-0.055em] sm:text-7xl\">CHEF. CATERING. TRUCK. <span className=\"text-black/45\">ONE BRAND.</span></h1>\n            <p className=\"mt-7 max-w-xl text-lg leading-8 text-black/65\">Private chef experiences, catered events, and food-truck appearances by Chef AP.</p>\n            <div className=\"mt-8 flex flex-wrap gap-3\"><a href=\"/bychefap/book\" className=\"rounded-full bg-black px-6 py-3.5 text-sm font-black text-white\">Plan an event</a><a href=\"/bychefap/where\" className=\"rounded-full border border-black/20 px-6 py-3.5 text-sm font-black\">Find the truck</a></div>\n          </div>\n          <div className=\"flex items-center justify-center\">{logoUrl ? <img src={logoUrl} alt=\"BYCHEFAP AP logo\" className=\"w-full max-w-[520px] object-contain drop-shadow-2xl\" /> : <div className=\"grid aspect-square w-full max-w-[440px] place-items-center rounded-full border-[12px] border-black text-[8rem] font-black\">AP</div>}</div>\n        </section>\n        <section className=\"border-y border-black/10 bg-white/55\"><div className=\"mx-auto grid max-w-6xl gap-px bg-black/10 md:grid-cols-3\">{[\n          ['Private Chef','Intimate dinners and custom in-home experiences.'],\n          ['Catering','Weddings, celebrations, corporate events and more.'],\n          ['Food Truck / Events','Public appearances, festivals and booked mobile service.'],\n        ].map(([title,copy]) => <a key={title} href=\"/bychefap/book\" className=\"bg-[#f3f0e9] p-7 transition hover:bg-white\"><div className=\"text-xl font-black\">{title}</div><p className=\"mt-2 text-sm leading-6 text-black/60\">{copy}</p></a>)}</div></section>\n      </>}\n\n      {page === 'where' && <section className=\"mx-auto max-w-5xl px-5 py-14 sm:px-8\">\n        <div className=\"text-xs font-black uppercase tracking-[0.28em] text-black/45\">Public appearances</div>\n        <h1 className=\"mt-3 text-5xl font-black tracking-[-0.05em] sm:text-6xl\">WHERE IS CHEF AP?</h1>\n        <p className=\"mt-4 max-w-2xl text-black/60\">Food-truck stops and public events show here automatically when Chef AP marks an event public.</p>\n        <div className=\"mt-10 grid gap-3\">{loadingSchedule ? <div className=\"rounded-3xl border border-black/10 bg-white p-6 font-bold\">Loading upcoming stops…</div> : schedule.length ? schedule.map((item) => <article key={item.id} className=\"grid gap-2 rounded-3xl border border-black/10 bg-white p-6 sm:grid-cols-[150px_1fr_auto] sm:items-center\"><div className=\"text-sm font-black\">{new Date(`${item.event_date}T12:00:00`).toLocaleDateString(undefined,{month:'short',day:'numeric',weekday:'short'})}</div><div><div className=\"text-lg font-black\">{item.event_name}</div><div className=\"mt-1 text-sm text-black/55\">{[item.venue,item.city].filter(Boolean).join(' · ') || 'Brevard County'}</div></div><a href=\"/bychefap/book\" className=\"text-sm font-black underline underline-offset-4\">Book Chef AP</a></article>) : <div className=\"rounded-3xl border border-black/10 bg-white p-7\"><div className=\"text-xl font-black\">No public stop posted yet.</div><p className=\"mt-2 text-sm text-black/55\">Check back soon — or book Chef AP for your own event.</p></div>}</div>\n      </section>}\n\n      {page === 'book' && <section className=\"mx-auto grid max-w-6xl gap-10 px-5 py-14 md:grid-cols-[0.8fr_1.2fr] md:px-8\">\n        <div><div className=\"text-xs font-black uppercase tracking-[0.28em] text-black/45\">Start a booking</div><h1 className=\"mt-3 text-5xl font-black tracking-[-0.05em] sm:text-6xl\">LET'S FEED PEOPLE.</h1><p className=\"mt-5 max-w-md text-base leading-7 text-black/60\">Tell Chef AP what you're planning. Your request goes straight into the BYCHEFAP event pipeline.</p><div className=\"mt-8 space-y-2 text-sm font-bold text-black/65\"><div>Private Chef</div><div>Catering</div><div>Food Truck / Events</div></div></div>\n        {sent ? <div className=\"rounded-[2rem] bg-black p-8 text-white\"><div className=\"text-xs font-black uppercase tracking-[0.25em] text-white/50\">Request received</div><div className=\"mt-3 text-3xl font-black\">Chef AP has it.</div><p className=\"mt-3 text-white/65\">Your event request is now in the BYCHEFAP booking pipeline.</p></div> : <form onSubmit={submitRequest} className=\"grid gap-3 rounded-[2rem] border border-black/10 bg-white p-5 shadow-xl shadow-black/5 sm:p-7\">\n          <div className=\"grid grid-cols-3 gap-2\">{['Private Chef','Catering','Food Truck / Events'].map((service) => <button key={service} type=\"button\" onClick={() => setForm((current) => ({...current,service}))} className={`min-h-12 rounded-2xl px-2 text-xs font-black ${form.service === service ? 'bg-black text-white' : 'bg-black/5 text-black'}`}>{service}</button>)}</div>\n          <div className=\"grid gap-3 sm:grid-cols-2\"><input required aria-label=\"Event date\" type=\"date\" className={inputClass} value={form.date} onChange={(e)=>setForm({...form,date:e.target.value})}/><input aria-label=\"Preferred time\" type=\"time\" className={inputClass} value={form.time} onChange={(e)=>setForm({...form,time:e.target.value})}/></div>\n          <div className=\"grid gap-3 sm:grid-cols-2\"><input required placeholder=\"Event location\" className={inputClass} value={form.location} onChange={(e)=>setForm({...form,location:e.target.value})}/><input required placeholder=\"Expected guests\" className={inputClass} value={form.guests} onChange={(e)=>setForm({...form,guests:e.target.value})}/></div>\n          <input required placeholder=\"Your name\" className={inputClass} value={form.name} onChange={(e)=>setForm({...form,name:e.target.value})}/>\n          <div className=\"grid gap-3 sm:grid-cols-2\"><input required placeholder=\"Phone\" type=\"tel\" className={inputClass} value={form.phone} onChange={(e)=>setForm({...form,phone:e.target.value})}/><input required placeholder=\"Email\" type=\"email\" className={inputClass} value={form.email} onChange={(e)=>setForm({...form,email:e.target.value})}/></div>\n          <textarea placeholder=\"Menu ideas, venue details, dietary needs, anything Chef AP should know…\" className={`${inputClass} min-h-28 py-3`} value={form.notes} onChange={(e)=>setForm({...form,notes:e.target.value})}/>\n          {error ? <div className=\"rounded-2xl bg-red-50 p-3 text-sm font-bold text-red-700\">{error}</div> : null}\n          <button disabled={submitting} type=\"submit\" className=\"rounded-2xl bg-black px-5 py-4 text-sm font-black text-white disabled:opacity-50\">{submitting ? 'Saving request…' : 'Send booking request'}</button>\n        </form>}\n      </section>}\n      <footer className=\"border-t border-black/10 px-5 py-8 text-center text-xs font-bold tracking-[0.18em] text-black/40\">BYCHEFAP · PALM BAY, FLORIDA</footer>\n    </main>\n  );\n}\n\nfunction LegacyLawnCareTenantRedirect() {\n  const params = useParams();\n  const tenantSlug = String(params.tenantSlug || '').trim();\n  const splat = String(params['*'] || '').replace(/^\\/+|\\/+$/g, '');\n  const suffix = splat ? `/${splat}` : '';\n  return <Navigate to={`/${tenantSlug}${suffix}`} replace />;\n}\n\nfunction LawnCarePublicBookingRoute() {\n  const params = useParams();\n  const tenantSlug = String(params.tenantSlug || '').trim().toLowerCase();\n  if (tenantSlug.includes('seaside') || tenantSlug.includes('davey') || tenantSlug === 'book-seaside' || tenantSlug === 'bookseaside') {\n    return <Navigate to=\"/seaside-lawns/book\" replace />;\n  }\n  return <LawnCareServiceRequest />;\n}\n\nfunction LegacyLawnCarePortalRedirect() {\n  const params = useParams();\n  const tenantSlug = String(params.companyName || '').trim().toLowerCase();\n  return <Navigate to={`/lawn-care/${tenantSlug}/book`} replace />;\n}\n\nfunction ExternalPublicApplicationRoute({ url, label }: { url: string; label: string }) {\n  React.useEffect(() => {\n    if (typeof window !== 'undefined') window.location.replace(url);\n  }, [url]);\n  return <div className=\"grid min-h-dvh place-items-center bg-background px-6 text-center text-sm text-muted-foreground\">Opening {label}…</div>;\n}\n\nexport const publicRoutes = (\n  <>\n    <Route path=\"/__knocklaunch/source\" element={S(<UtilityShell utility=\"source-marker\"><BuildSource /></UtilityShell>)} />\n    <Route path=\"/__knocklaunch/interaction\" element={S(<UtilityShell utility=\"interaction-proof\"><InteractionProof /></UtilityShell>)} />\n    <Route path=\"/__knocklaunch/interaction/destination\" element={S(<UtilityShell utility=\"interaction-proof\"><InteractionProof /></UtilityShell>)} />\n    <Route path=\"/__mapbox-smoke/lawn\" element={S(<UtilityShell utility=\"smoke\"><MapboxSmokeLawn /></UtilityShell>)} />\n    <Route path=\"/q/:shortCode\" element={S(<UtilityShell utility=\"redirect\"><QRRedirectPage /></UtilityShell>)} />\n\n    <Route path=\"/\" element={S(<PublicRootRoute />)} />\n    <Route path=\"/book-me-directly\" element={S(<BookMeDirectlyPublicPage />)} />\n    <Route path=\"/book-me-directly/:tenantSlug\" element={S(<BookMeDirectlyPublicPage />)} />\n    <Route path=\"/site/:tenantSlug\" element={S(<TenantPublicWebsitePage />)} />\n    <Route path=\"/site/:tenantSlug/book\" element={S(<BookMeDirectlyPublicPage />)} />\n    <Route path=\"/la-vista-del-mar\" element={S(<PublicTenantLiveEditBridge tenantSlug=\"la-vista-del-mar\"><ShortTermRentalPublic /></PublicTenantLiveEditBridge>)} />\n    <Route path=\"/auth\" element={S(<AuthShell><OAuthLogin /></AuthShell>)} />\n    <Route path=\"/crm/login\" element={S(<AuthShell><PublicRoute><Login /></PublicRoute></AuthShell>)} />\n    <Route path=\"/login\" element={S(<AuthShell><PublicRoute><Login /></PublicRoute></AuthShell>)} />\n    {APPLICATION_CAPABILITY_REGISTRY.filter((app) => app.audience === 'tenant-user' && app.slug !== 'crm').map((app) => (\n      <Route key={app.id} path={`/${app.slug}/login`} element={S(<ApplicationLoginRoute appSlug={app.slug} />)} />\n    ))}\n    {getTenantApplicationLoginAliases().map((alias) => (\n      <Route key={`app-login-alias-${alias.slug}`} path={alias.loginPath} element={S(<ApplicationLoginRoute appSlug={alias.slug} />)} />\n    ))}\n    {APPLICATION_CAPABILITY_REGISTRY.filter((app) => app.audience === 'customer-public' && Boolean(app.externalUrl)).map((app) => (\n      <Route key={`public-app-${app.id}`} path={app.standalonePath} element={<ExternalPublicApplicationRoute url={String(app.externalUrl)} label={app.label} />} />\n    ))}\n\n    <Route path=\"/signup\" element={S(<AuthShell><PublicRoute><Signup /></PublicRoute></AuthShell>)} />\n    <Route path=\"/signup-multitenant\" element={S(<AuthShell><PublicRoute><MultiTenantSignup /></PublicRoute></AuthShell>)} />\n    <Route path=\"/signup-verify\" element={S(<AuthShell><SignupVerify /></AuthShell>)} />\n    <Route path=\"/sign-agreement\" element={S(<CustomerPortalShell surface=\"agreement\"><SignAgreement /></CustomerPortalShell>)} />\n    <Route path=\"/sign-agreement/:token\" element={<LegacySignAgreementTokenRoute />} />\n    <Route path=\"/agreement-verification\" element={S(<CustomerPortalShell surface=\"agreement\"><AgreementVerification /></CustomerPortalShell>)} />\n    <Route path=\"/tenant-quick-setup\" element={S(<AuthShell mode=\"tenant-selection\"><TenantQuickSetup /></AuthShell>)} />\n    <Route path=\"/demo\" element={S(<BuildMyDemo />)} />\n    <Route path=\"/build-my-demo\" element={S(<BuildMyDemo />)} />\n\n    <Route path=\"/portal/:token\" element={P(<CustomerPortalShell><CustomerPortalPage /></CustomerPortalShell>)} />\n    <Route path=\"/:tenantSlug/p/:token\" element={W(<CustomerPortalShell><WhatsMyProgressPortalPage /></CustomerPortalShell>)} />\n    <Route path=\"/portal/storm-report/:token\" element={S(<CustomerPortalShell surface=\"report\"><StormReportViewer /></CustomerPortalShell>)} />\n    <Route path=\"/report/:publicToken\" element={S(<CustomerPortalShell surface=\"report\"><HomeownerStormReportPortal /></CustomerPortalShell>)} />\n\n    <Route path=\"/sce-tarping\" element={S(<SceTarpingEmergencyHelp />)} />\n    <Route path=\"/sce-tarping/emergency-help\" element={S(<SceTarpingEmergencyHelp />)} />\n    <Route path=\"/emergency-tarping\" element={S(<SceTarpingEmergencyHelp />)} />\n    <Route path=\"/roof-leak-help\" element={S(<RoofHelpResourcePage />)} />\n    <Route path=\"/storm-damage-roof-help\" element={S(<RoofHelpResourcePage />)} />\n    <Route path=\"/emergency-roof-tarp-help\" element={S(<RoofHelpResourcePage />)} />\n    <Route path=\"/roof-insurance-claim-help\" element={S(<RoofHelpResourcePage />)} />\n    <Route path=\"/roof-inspection-replacement-help\" element={S(<RoofHelpResourcePage />)} />\n    <Route path=\"/brevard-roof-help-guide\" element={S(<RoofHelpResourcePage />)} />\n    <Route path=\"/brevard-august-26-2026-storm-roof-help\" element={S(<RoofHelpResourcePage />)} />\n    {ROOF_HELP_MARKET_SLUGS.map((marketSlug) => (\n      <React.Fragment key={marketSlug}>\n        <Route path={`/${marketSlug}`} element={S(<RoofHelpLandingPage />)} />\n        <Route path={`/${marketSlug}/:serviceSlug`} element={S(<RoofHelpLandingPage />)} />\n      </React.Fragment>\n    ))}\n    <Route path=\"/unsubscribe\" element={S(<Unsubscribe />)} />\n    <Route path=\"/pricing\" element={S(<Pricing />)} />\n    <Route path=\"/trial\" element={S(<AuthShell><TrialSignup /></AuthShell>)} />\n\n    <Route path=\"/prestigious-card-grading\" element={S(<PCGPublicSite />)} />\n    <Route path=\"/prestigious-card-grading/grading\" element={S(<PCGPublicSite page=\"grading\" />)} />\n    <Route path=\"/prestigious-card-grading/verify\" element={S(<PCGPublicSite page=\"verify\" />)} />\n    <Route path=\"/prestigious-card-grading/submit\" element={S(<PCGPublicSite page=\"submit\" />)} />\n    <Route path=\"/prestigious-card-grading/shop\" element={S(<PCGPublicSite page=\"shop\" />)} />\n    <Route path=\"/prestigious-card-grading/contact\" element={S(<PCGPublicSite page=\"contact\" />)} />\n\n    <Route path=\"/bychefap\" element={S(<ByChefApPublic />)} />\n    <Route path=\"/bychefap/where\" element={S(<ByChefApPublic page=\"where\" />)} />\n    <Route path=\"/bychefap/events\" element={<Navigate to=\"/bychefap/where\" replace />} />\n    <Route path=\"/bychefap/book\" element={S(<ByChefApPublic page=\"book\" />)} />\n\n    <Route path=\"/big-papis\" element={S(<PublicTenantLiveEditBridge tenantSlug=\"big-papis\"><BigPapisPublic /></PublicTenantLiveEditBridge>)} />\n    <Route path=\"/big-papis/where\" element={<Navigate to=\"/big-papis#where\" replace />} />\n    <Route path=\"/big-papis/find\" element={<Navigate to=\"/big-papis#where\" replace />} />\n    <Route path=\"/big-papis/flavors\" element={<Navigate to=\"/big-papis#flavors\" replace />} />\n    <Route path=\"/big-papis/fundraising\" element={<Navigate to=\"/big-papis#fundraising\" replace />} />\n    <Route path=\"/big-papis/events\" element={<Navigate to=\"/big-papis#where\" replace />} />\n    <Route path=\"/big-papis/loyalty\" element={<Navigate to=\"/big-papis#next-stop-club\" replace />} />\n    <Route path=\"/big-papis/book\" element={<Navigate to=\"/big-papis#book\" replace />} />\n    <Route path=\"/big-papis/referrals\" element={S(<BigPapisBookingReferralPage />)} />\n    <Route path=\"/big-papis/refer\" element={<Navigate to=\"/big-papis/referrals\" replace />} />\n    <Route path=\"/where\" element={S(<BigPapisCustomDomainRoute internalPath=\"/big-papis#where\" hash=\"where\" />)} />\n    <Route path=\"/find\" element={S(<BigPapisCustomDomainRoute internalPath=\"/big-papis#where\" hash=\"where\" />)} />\n    <Route path=\"/flavors\" element={S(<BigPapisCustomDomainRoute internalPath=\"/big-papis#flavors\" hash=\"flavors\" />)} />\n    <Route path=\"/fundraising\" element={S(<BigPapisCustomDomainRoute internalPath=\"/big-papis#fundraising\" hash=\"fundraising\" />)} />\n    <Route path=\"/events\" element={S(<BigPapisCustomDomainRoute internalPath=\"/big-papis#where\" hash=\"where\" />)} />\n    <Route path=\"/loyalty\" element={S(<BigPapisCustomDomainRoute internalPath=\"/big-papis#next-stop-club\" hash=\"next-stop-club\" />)} />\n    <Route path=\"/book\" element={S(<BigPapisCustomDomainRoute internalPath=\"/big-papis#book\" hash=\"book\" />)} />\n    <Route path=\"/referrals\" element={S(<BigPapisCustomDomainReferralRoute />)} />\n    <Route path=\"/refer\" element={<Navigate to=\"/referrals\" replace />} />\n    <Route path=\"/big-papis-coquito-iceys\" element={<Navigate to=\"/big-papis\" replace />} />\n    <Route path=\"/tranzformer-auto-detailing\" element={S(<PublicTenantLiveEditBridge tenantSlug=\"tranzformer-auto-detailing\"><TranzformerAutoDetailingPublic /></PublicTenantLiveEditBridge>)} />\n    <Route path=\"/321-auto-unlock\" element={S(<PublicTenantLiveEditBridge tenantSlug=\"321-auto-unlock\"><AutoUnlockPublic /></PublicTenantLiveEditBridge>)} />\n    <Route path=\"/cafe-qsr\" element={S(<PublicTenantLiveEditBridge tenantSlug=\"cafe-qsr\"><CafeQsrPublic /></PublicTenantLiveEditBridge>)} />\n\n    <Route path=\"/davey\" element={<Navigate to=\"/seaside-lawns/book\" replace />} />\n    <Route path=\"/seaside\" element={<Navigate to=\"/seaside-lawns/book\" replace />} />\n    <Route path=\"/book-seaside\" element={<Navigate to=\"/seaside-lawns/book\" replace />} />\n    <Route path=\"/book/:tenantSlug\" element={S(<LawnCarePublicBookingRoute />)} />\n    <Route path=\"/bookseaside\" element={<Navigate to=\"/seaside-lawns/book\" replace />} />\n    <Route path=\"/seaside/book\" element={<Navigate to=\"/seaside-lawns/book\" replace />} />\n    <Route path=\"/seaside-lawns/book\" element={S(<SeasideBookingProfile />)} />\n    <Route path=\"/crm/:tenantType/:companyName/lawn-care/portal\" element={<LegacyLawnCarePortalRedirect />} />\n    <Route path=\"/lawn-care/:tenantSlug/book\" element={S(<LawnCarePublicBookingRoute />)} />\n    <Route path=\"/lawn-care/:tenantSlug\" element={<LegacyLawnCareTenantRedirect />} />\n    <Route path=\"/lawn-care/:tenantSlug/*\" element={<LegacyLawnCareTenantRedirect />} />\n    <Route path=\"/davey/book\" element={<Navigate to=\"/seaside-lawns/book\" replace />} />\n    <Route path=\"/davey-lawn-care/book\" element={<Navigate to=\"/seaside-lawns/book\" replace />} />\n\n    <Route path=\"/roof-builder\" element={S(<BuilderShell><RoofBuilderStudio /></BuilderShell>)} />\n    <Route path=\"/roof-builder/:tenantSlug\" element={S(<BuilderShell><RoofBuilderStudio /></BuilderShell>)} />\n    <Route path=\"/roof-builder/:tenantSlug/mock-lab\" element={S(<BuilderShell tool=\"mock-lab\"><RoofWebsiteMockLab /></BuilderShell>)} />\n    <Route path=\"/roof-builder/:tenantSlug/asset-engine\" element={S(<BuilderShell tool=\"asset-engine\"><RoofPublicAssetEngine /></BuilderShell>)} />\n    <Route path=\"/roof-builder/:tenantSlug/implementation\" element={S(<BuilderShell tool=\"implementation\"><RoofBuilderImplementationMap /></BuilderShell>)} />\n    <Route path=\"/roof-builder/:tenantSlug/admin-preview\" element={S(<BuilderShell><RoofBuilderAdminPreview /></BuilderShell>)} />\n    <Route path=\"/roof-builder/:tenantSlug/sales-intelligence\" element={S(<BuilderShell><RoofBuilderSalesIntelligence /></BuilderShell>)} />\n    <Route path=\"/roof-builder/:tenantSlug/state-photo-docs\" element={S(<BuilderShell tool=\"public-preview\"><StatePhotoDocsPublicPreview /></BuilderShell>)} />\n    <Route path=\"/misc-photo-report\" element={S(<BuilderShell tool=\"public-preview\"><StatePhotoDocsPublicPreview /></BuilderShell>)} />\n    <Route path=\"/misc-photo-report/:tenantSlug\" element={S(<BuilderShell tool=\"public-preview\"><StatePhotoDocsPublicPreview /></BuilderShell>)} />\n    <Route path=\"/misc\" element={<Navigate to=\"/misc-photo-report\" replace />} />\n    <Route path=\"/josh\" element={<Navigate to=\"/misc-photo-report\" replace />} />\n    <Route path=\"/thejosj\" element={<Navigate to=\"/misc-photo-report\" replace />} />\n\n    <Route path=\"/documents/upload/:token\" element={S(<CustomerPortalShell surface=\"document-upload\"><DocumentUploadPortal /></CustomerPortalShell>)} />\n    <Route path=\"/m/call/:sessionId\" element={S(<FieldMobileShell mode=\"call-control\"><MobileCallControlPage /></FieldMobileShell>)} />\n  </>\n);","expectedSha":"a855d2d1ccb8155b8ff402375acfaf0bfcec850b"}],"branch":"ai/objective-first-repair-5596752e68e1","writes":[],"patches":[],"version":1,"approved":true,"missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75","repository":"noel/KnockLaunchOS","commitMessage":"PCG: ship public preview and cert verification","ownerApproved":true,"releaseIntent":null,"sourceTargets":["supabase/functions/pcg-customer-progress/index.ts","src/pages/card-grading/PCGPublicSite.tsx","src/routes/publicRoutes.tsx"],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75","ownerApproved":true,"releaseIntent":null,"sourceTargets":["supabase/functions/pcg-customer-progress/index.ts","src/pages/card-grading/PCGPublicSite.tsx","src/routes/publicRoutes.tsx"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"4d4568b721bf1c4a6ad7294d3b0d1985e579f56eeba3629bf89584b24fc43ea8","replayCount":0,"serializedBytes":68820},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:26:33.407127+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:5596752e-68e1-43eb-b3eb-c883cdd77f75:repository-mutation-intent:4d4568b721bf1c4a6ad7294d3b0d1985e579f56eeba3629bf89584b24fc43ea8:0","mission_step_id":"38f82569-902f-41a8-9fda-640984a6c55a","command_center_event_id":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},{"id":"bb8ddff5-92dc-4788-80c8-a99f96a05a4d","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in runtime proof.","nextAction":{"lane":"cc-execution","action":"reconcile_request_contract","reason":"release_verified_contract_pending","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"runtime_proof\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"execute_mission\",\"status\":\"deployment_dispatched\",\"proofGate\":\"canonical_release_dispatched\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_request_contract\",\"lane\":\"cc-execution\",\"reason\":\"release_verified_contract_pending\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_request_contract\",\"recoveryOwner\":\"cc-execution\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"proof-production\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"visual_proof\",\"deadlineAt\":\"2026-09-29T06:09:59.148796+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-b5ecb59b331d\",\"prNumber\":4081,\"sourceSha\":\"d4b2db0be2ef7626e4592ce173519923aa0fd7dc\",\"deploymentId\":\"forgejo-main-d4b2db0be2ef\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:27:07.746094+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:owner-progress-heartbeat:119376588","mission_step_id":"bfdb73a4-899f-44b4-bb2b-30bea26a09a9","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"0609dc3d-00a1-4c4c-bbf6-97f446f9f8ff","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"0dde2831-ef1b-4181-9180-0ba17d7af831","objective":"Apply exact repository-authority decruft batch 1 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to protected main d4b2db0be2ef7626e4592ce173519923aa0fd7dc; do not create another PR or broaden scope.","sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"workstreamKey":"repo-decruft-pr4073-batch1-d4b2","anchored_edits":[{"path":".forgejo/workflows/knocklaunch.yml","edits":[{"new_content":"        required: false\n        default: \"false\"\n        type: string\n      release_frontend:\n        description: Release frontend when affected\n        required: false","old_content":"        required: false\n        default: \"false\"\n        type: string\n      release_onrunner:\n        description: Release Render OnRunner when affected\n        required: false\n        default: \"false\"\n        type: string\n      release_frontend:\n        description: Release frontend when affected\n        required: false"},{"new_content":"jobs:\n  release-plan:\n    name: Delivery / Maintenance Plan\n    if: ${{ github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.event.inputs.operation == 'release-main' && (github.event.inputs.release_cc_execution == 'true' || github.event.inputs.release_frontend == 'true' || github.event.inputs.release_supabase_edge == 'true' || github.event.inputs.supabase_edge_reconcile == 'true' || github.event.inputs.release_migrations == 'true')) }}\n    runs-on: docker-8g\n    container:\n      image: node:22.18.0-bookworm","old_content":"jobs:\n  release-plan:\n    name: Delivery / Maintenance Plan\n    if: ${{ github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.event.inputs.operation == 'release-main' && (github.event.inputs.release_cc_execution == 'true' || github.event.inputs.release_onrunner == 'true' || github.event.inputs.release_frontend == 'true' || github.event.inputs.release_supabase_edge == 'true' || github.event.inputs.supabase_edge_reconcile == 'true' || github.event.inputs.release_migrations == 'true')) }}\n    runs-on: docker-8g\n    container:\n      image: node:22.18.0-bookworm"},{"new_content":"      changed_paths_b64: ${{ steps.plan.outputs.changed_paths_b64 }}\n      release_cc_execution: ${{ steps.plan.outputs.release_cc_execution }}\n      release_cc_execution_heavy: ${{ steps.plan.outputs.release_cc_execution_heavy }}\n      release_frontend: ${{ steps.plan.outputs.release_frontend }}\n      release_supabase_edge: ${{ steps.plan.outputs.release_supabase_edge }}\n      supabase_edge_reconcile: ${{ steps.plan.outputs.supabase_edge_reconcile }}","old_content":"      changed_paths_b64: ${{ steps.plan.outputs.changed_paths_b64 }}\n      release_cc_execution: ${{ steps.plan.outputs.release_cc_execution }}\n      release_cc_execution_heavy: ${{ steps.plan.outputs.release_cc_execution_heavy }}\n      release_onrunner: ${{ steps.plan.outputs.release_onrunner }}\n      release_frontend: ${{ steps.plan.outputs.release_frontend }}\n      release_supabase_edge: ${{ steps.plan.outputs.release_supabase_edge }}\n      supabase_edge_reconcile: ${{ steps.plan.outputs.supabase_edge_reconcile }}"},{"new_content":"          const frontendPath = /^(?:src\\/(?!__tests__\\/contracts\\/)|public\\/|index\\.html$|package(?:-lock)?\\.json$|vite\\.config\\.|tsconfig|tailwind\\.config\\.|postcss\\.config\\.|components\\.json$|wrangler\\.toml$|scripts\\/cloudflare-native-(?!version-deploy\\.mjs$)|scripts\\/validate-cloudflare-native-public-env\\.mjs$|config\\/cloudflare-native-frontend-build\\.json$)/;\n          const targets = {\n            ccExecution: paths.some((path) => (path.startsWith(\"workers/cc-execution/\") && !path.startsWith(\"workers/cc-execution/test/\")) || path === \"config/control-plane-capabilities.json\" || path.startsWith(\"scripts/visual-witness-hosted-runner/\")),\n            frontend: paths.some((path) => frontendPath.test(path)),\n            supabaseEdge: paths.some((path) => path.startsWith(\"supabase/functions/\") || path === \"scripts/reconcile-supabase-edge-registry.mjs\"),\n            migrations: paths.some((path) => path.startsWith(\"supabase/migrations/\")),","old_content":"          const frontendPath = /^(?:src\\/(?!__tests__\\/contracts\\/)|public\\/|index\\.html$|package(?:-lock)?\\.json$|vite\\.config\\.|tsconfig|tailwind\\.config\\.|postcss\\.config\\.|components\\.json$|wrangler\\.toml$|scripts\\/cloudflare-native-(?!version-deploy\\.mjs$)|scripts\\/validate-cloudflare-native-public-env\\.mjs$|config\\/cloudflare-native-frontend-build\\.json$)/;\n          const targets = {\n            ccExecution: paths.some((path) => (path.startsWith(\"workers/cc-execution/\") && !path.startsWith(\"workers/cc-execution/test/\")) || path === \"config/control-plane-capabilities.json\" || path.startsWith(\"scripts/visual-witness-hosted-runner/\")),\n            onrunner: false,\n            frontend: paths.some((path) => frontendPath.test(path)),\n            supabaseEdge: paths.some((path) => path.startsWith(\"supabase/functions/\") || path === \"scripts/reconcile-supabase-edge-registry.mjs\"),\n            migrations: paths.some((path) => path.startsWith(\"supabase/migrations/\")),"},{"new_content":"            changed_paths_b64: Buffer.from(paths.join(\"\\n\"), \"utf8\").toString(\"base64\"),\n            release_cc_execution: String(targets.ccExecution),\n            release_cc_execution_heavy: String(ccExecutionHeavy),\n            release_frontend: String(targets.frontend),\n            release_supabase_edge: String(targets.supabaseEdge),\n            supabase_edge_reconcile: String(supabaseEdgeReconcile),","old_content":"            changed_paths_b64: Buffer.from(paths.join(\"\\n\"), \"utf8\").toString(\"base64\"),\n            release_cc_execution: String(targets.ccExecution),\n            release_cc_execution_heavy: String(ccExecutionHeavy),\n            release_onrunner: String(targets.onrunner),\n            release_frontend: String(targets.frontend),\n            release_supabase_edge: String(targets.supabaseEdge),\n            supabase_edge_reconcile: String(supabaseEdgeReconcile),"},{"new_content":"          EVENT_CHANGED_PATHS_B64: ${{ steps.event_plan.outputs.changed_paths_b64 }}\n          EVENT_RELEASE_CC_EXECUTION: ${{ steps.event_plan.outputs.release_cc_execution }}\n          EVENT_RELEASE_CC_EXECUTION_HEAVY: ${{ steps.event_plan.outputs.release_cc_execution_heavy }}\n          EVENT_RELEASE_FRONTEND: ${{ steps.event_plan.outputs.release_frontend }}\n          EVENT_RELEASE_SUPABASE_EDGE: ${{ steps.event_plan.outputs.release_supabase_edge }}\n          EVENT_SUPABASE_EDGE_RECONCILE: ${{ steps.event_plan.outputs.supabase_edge_reconcile }}","old_content":"          EVENT_CHANGED_PATHS_B64: ${{ steps.event_plan.outputs.changed_paths_b64 }}\n          EVENT_RELEASE_CC_EXECUTION: ${{ steps.event_plan.outputs.release_cc_execution }}\n          EVENT_RELEASE_CC_EXECUTION_HEAVY: ${{ steps.event_plan.outputs.release_cc_execution_heavy }}\n          EVENT_RELEASE_ONRUNNER: ${{ steps.event_plan.outputs.release_onrunner }}\n          EVENT_RELEASE_FRONTEND: ${{ steps.event_plan.outputs.release_frontend }}\n          EVENT_RELEASE_SUPABASE_EDGE: ${{ steps.event_plan.outputs.release_supabase_edge }}\n          EVENT_SUPABASE_EDGE_RECONCILE: ${{ steps.event_plan.outputs.supabase_edge_reconcile }}"},{"new_content":"          INPUT_SOURCE_SHA: ${{ github.event.inputs.source_sha }}\n          INPUT_CHANGED_PATHS_B64: ${{ github.event.inputs.changed_paths_b64 }}\n          INPUT_RELEASE_CC_EXECUTION: ${{ github.event.inputs.release_cc_execution }}\n          INPUT_RELEASE_FRONTEND: ${{ github.event.inputs.release_frontend }}\n          INPUT_RELEASE_SUPABASE_EDGE: ${{ github.event.inputs.release_supabase_edge }}\n          INPUT_SUPABASE_EDGE_RECONCILE: ${{ github.event.inputs.supabase_edge_reconcile }}","old_content":"          INPUT_SOURCE_SHA: ${{ github.event.inputs.source_sha }}\n          INPUT_CHANGED_PATHS_B64: ${{ github.event.inputs.changed_paths_b64 }}\n          INPUT_RELEASE_CC_EXECUTION: ${{ github.event.inputs.release_cc_execution }}\n          INPUT_RELEASE_ONRUNNER: ${{ github.event.inputs.release_onrunner }}\n          INPUT_RELEASE_FRONTEND: ${{ github.event.inputs.release_frontend }}\n          INPUT_RELEASE_SUPABASE_EDGE: ${{ github.event.inputs.release_supabase_edge }}\n          INPUT_SUPABASE_EDGE_RECONCILE: ${{ github.event.inputs.supabase_edge_reconcile }}"},{"new_content":"              \"changed_paths_b64=$EVENT_CHANGED_PATHS_B64\" \\\n              \"release_cc_execution=$EVENT_RELEASE_CC_EXECUTION\" \\\n              \"release_cc_execution_heavy=$EVENT_RELEASE_CC_EXECUTION_HEAVY\" \\\n              \"release_frontend=$EVENT_RELEASE_FRONTEND\" \\\n              \"release_supabase_edge=$EVENT_RELEASE_SUPABASE_EDGE\" \\\n              \"supabase_edge_reconcile=$EVENT_SUPABASE_EDGE_RECONCILE\" \\","old_content":"              \"changed_paths_b64=$EVENT_CHANGED_PATHS_B64\" \\\n              \"release_cc_execution=$EVENT_RELEASE_CC_EXECUTION\" \\\n              \"release_cc_execution_heavy=$EVENT_RELEASE_CC_EXECUTION_HEAVY\" \\\n              \"release_onrunner=false\" \\\n              \"release_frontend=$EVENT_RELEASE_FRONTEND\" \\\n              \"release_supabase_edge=$EVENT_RELEASE_SUPABASE_EDGE\" \\\n              \"supabase_edge_reconcile=$EVENT_SUPABASE_EDGE_RECONCILE\" \\"},{"new_content":"              \"changed_paths_b64=\" \\\n              \"release_cc_execution=false\" \\\n              \"release_cc_execution_heavy=false\" \\\n              \"release_frontend=false\" \\\n              \"release_supabase_edge=true\" \\\n              \"supabase_edge_reconcile=true\" \\","old_content":"              \"changed_paths_b64=\" \\\n              \"release_cc_execution=false\" \\\n              \"release_cc_execution_heavy=false\" \\\n              \"release_onrunner=false\" \\\n              \"release_frontend=false\" \\\n              \"release_supabase_edge=true\" \\\n              \"supabase_edge_reconcile=true\" \\"},{"new_content":"              \"changed_paths_b64=${INPUT_CHANGED_PATHS_B64:-}\" \\\n              \"release_cc_execution=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_cc_execution_heavy=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_frontend=${INPUT_RELEASE_FRONTEND:-false}\" \\\n              \"release_supabase_edge=${INPUT_RELEASE_SUPABASE_EDGE:-false}\" \\\n              \"supabase_edge_reconcile=${INPUT_SUPABASE_EDGE_RECONCILE:-false}\" \\","old_content":"              \"changed_paths_b64=${INPUT_CHANGED_PATHS_B64:-}\" \\\n              \"release_cc_execution=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_cc_execution_heavy=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_onrunner=false\" \\\n              \"release_frontend=${INPUT_RELEASE_FRONTEND:-false}\" \\\n              \"release_supabase_edge=${INPUT_RELEASE_SUPABASE_EDGE:-false}\" \\\n              \"supabase_edge_reconcile=${INPUT_SUPABASE_EDGE_RECONCILE:-false}\" \\"},{"new_content":"            '/scripts/validate-windows-repository-paths.mjs' \\\n            '/scripts/validate-windows-repository-paths.test.mjs' \\\n            '/scripts/validate-control-plane-restore-point.mjs' \\\n            '/scripts/validate-release-architecture.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\\n            '/scripts/validate-capability-manifests.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\","old_content":"            '/scripts/validate-windows-repository-paths.mjs' \\\n            '/scripts/validate-windows-repository-paths.test.mjs' \\\n            '/scripts/validate-control-plane-restore-point.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\\n            '/scripts/validate-capability-manifests.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\"},{"new_content":"            config/control-plane-capabilities.json\n            config/control-plane-restore-point.json\n            scripts/validate-control-plane-restore-point.mjs\n            scripts/validate-release-architecture.mjs\n            src/__tests__/contracts/control-plane-restore-point.contract.test.ts\n            workers/cc-execution/src/index-release-fast-lane.js\n            workers/cc-execution/src/entrypoint-owner-status.js","old_content":"            config/control-plane-capabilities.json\n            config/control-plane-restore-point.json\n            scripts/validate-control-plane-restore-point.mjs\n            src/__tests__/contracts/control-plane-restore-point.contract.test.ts\n            workers/cc-execution/src/index-release-fast-lane.js\n            workers/cc-execution/src/entrypoint-owner-status.js"},{"new_content":"          node scripts/release-event-native-plan.test.mjs\n          node scripts/reconcile-supabase-edge-registry.test.mjs\n          node scripts/validate-control-plane-restore-point.mjs\n          node scripts/validate-release-architecture.mjs\n          echo \"Hard safety: canonical control-plane restore point contract passed.\"\n\n          # Runtime parseability is a hard safety invariant, not optional domain QA.","old_content":"          node scripts/release-event-native-plan.test.mjs\n          node scripts/reconcile-supabase-edge-registry.test.mjs\n          node scripts/validate-control-plane-restore-point.mjs\n          echo \"Hard safety: canonical control-plane restore point contract passed.\"\n\n          # Runtime parseability is a hard safety invariant, not optional domain QA."}]},{"path":"config/control-plane-capabilities.json","edits":[{"new_content":"  \"authority\": \"live_runtime\",\n  \"purpose\": \"Bootstrap capability resolution without duplicating or freezing the live tool inventory.\",\n  \"repository\": \"noel/KnockLaunchOS\",\n  \"canonicalArchitectureRestorePoint\": \"config/system-restore-points/golden-restore-2026-09-25-1005Z.json\",\n  \"runtime\": {\n    \"healthEndpoint\": \"https://cc-execution.knocklaunch.app/health\",\n    \"openApiEndpoint\": \"https://cc-execution.knocklaunch.app/openapi.json\",","old_content":"  \"authority\": \"live_runtime\",\n  \"purpose\": \"Bootstrap capability resolution without duplicating or freezing the live tool inventory.\",\n  \"repository\": \"noel/KnockLaunchOS\",\n  \"canonicalArchitectureRestorePoint\": \"config/control-plane-restore-point.json\",\n  \"runtime\": {\n    \"healthEndpoint\": \"https://cc-execution.knocklaunch.app/health\",\n    \"openApiEndpoint\": \"https://cc-execution.knocklaunch.app/openapi.json\","},{"new_content":"    \"verification\": {\n      \"visualWitnessAutomatic\": false,\n      \"visualWitnessPolicy\": \"claim_matched_after_repair\",\n      \"visualWitnessCapacityRoutingPolicy\": \"laptop_first_then_virtual_then_paul_capacity_pool\",\n      \"visualWitnessReleaseValidationPolicy\": \"cold_start_aware_v1_plus_n_minus_one_capacity_pool\",\n      \"visualWitnessInteractiveNoProgressLeaseMs\": 30000,\n      \"visualWitnessNonVisualInteractionCapturePolicy\": \"executable_interaction_diagnostics_without_screenshot_unless_visual_claim\",","old_content":"    \"verification\": {\n      \"visualWitnessAutomatic\": false,\n      \"visualWitnessPolicy\": \"claim_matched_after_repair\",\n      \"visualWitnessCapacityRoutingPolicy\": \"virtual_first_then_render_burst_when_virtual_saturated_or_unavailable\",\n      \"visualWitnessRenderColdStartCostMs\": 60000,\n      \"visualWitnessRenderColdStartPolicy\": \"provider_specific_activation_cost_never_global_witness_timeout\",\n      \"visualWitnessReleaseValidationPolicy\": \"cold_start_aware_v1_plus_n_minus_one_capacity_pool\",\n      \"visualWitnessInteractiveNoProgressLeaseMs\": 30000,\n      \"visualWitnessNonVisualInteractionCapturePolicy\": \"executable_interaction_diagnostics_without_screenshot_unless_visual_claim\","},{"new_content":"    \"visualWitnessExplicitViewportPolicy\": \"explicit_viewport_selection_is_authoritative_across_adaptive_escalation_restart_replay_and_lane_failover_mobile_only_never_silently_expands_to_desktop\",\n    \"visualWitnessRestartReplayPolicy\": \"process_restart_replay_is_bounded_one_per_attempt_slot_and_already_completed_verified_attempts_terminalize_without_replay\",\n    \"visualWitnessDurabilityGatePolicy\": \"hosted_runner_check_executes_test_glob_and_mission_supervisor_durability_contract_guards_terminal_precedence_source_binding_restart_terminalization_and_explicit_viewports\",\n    \"deterministicMissionSupervisorPrimitivePolicy\": \"cloudflare_minute_cron_rehydrates_owner_active_durable_missions_through_the_same_mission_status_deterministic_state_machine_used_interactively_one_transition_brain_no_parallel_recovery_orchestrator\",\n    \"ownerMissionProgressPolicy\": \"durable_mission_receipts_are_the_canonical_owner_progress_journal_mission_status_returns_latestProgress_and_bounded_recentProgress_with_monotonic_timestamp_sequences_phase_owner_safe_message_next_action_or_blocker_ownerCheckpoint_remains_backward_compatible\",\n    \"ownerMissionProgressRecentLimit\": 8,","old_content":"    \"visualWitnessExplicitViewportPolicy\": \"explicit_viewport_selection_is_authoritative_across_adaptive_escalation_restart_replay_and_lane_failover_mobile_only_never_silently_expands_to_desktop\",\n    \"visualWitnessRestartReplayPolicy\": \"process_restart_replay_is_bounded_one_per_attempt_slot_and_already_completed_verified_attempts_terminalize_without_replay\",\n    \"visualWitnessDurabilityGatePolicy\": \"hosted_runner_check_executes_test_glob_and_mission_supervisor_durability_contract_guards_terminal_precedence_source_binding_restart_terminalization_and_explicit_viewports\",\n    \"onrunnerOnlyExactRuntimeProofPolicy\": \"when_onrunner_is_the_only_affected_release_target_exact_healthy_live_onrunner_source_identity_is_authoritative_over_an_interrupted_enclosing_workflow_receipt_mixed_release_targets_remain_fail_closed\",\n    \"deterministicMissionSupervisorPrimitivePolicy\": \"cloudflare_minute_cron_rehydrates_owner_active_durable_missions_through_the_same_mission_status_deterministic_state_machine_used_interactively_one_transition_brain_no_parallel_recovery_orchestrator\",\n    \"ownerMissionProgressPolicy\": \"durable_mission_receipts_are_the_canonical_owner_progress_journal_mission_status_returns_latestProgress_and_bounded_recentProgress_with_monotonic_timestamp_sequences_phase_owner_safe_message_next_action_or_blocker_ownerCheckpoint_remains_backward_compatible\",\n    \"ownerMissionProgressRecentLimit\": 8,"},{"new_content":"      \"contracts\": \"^src/__tests__/contracts/\",\n      \"buildCritical\": \"^(package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|index\\\\.html$|wrangler\\\\.toml$|scripts/cloudflare-native-|scripts/validate-cloudflare-native-public-env\\\\.mjs$|config/cloudflare-native-frontend-build\\\\.json$|src/(main|App)\\\\.[cm]?[tj]sx?$|src/(index|App)\\\\.css$)\",\n      \"ccExecution\": \"^(?:workers/cc-execution/|scripts/visual-witness-hosted-runner/)\",\n      \"supabaseEdge\": \"^supabase/functions/\",\n      \"migrations\": \"^supabase/migrations/\",\n      \"controlPlane\": \"^(config/control-plane-capabilities\\\\.json$|\\\\.forgejo/workflows/|workers/cc-execution/)\"","old_content":"      \"contracts\": \"^src/__tests__/contracts/\",\n      \"buildCritical\": \"^(package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|index\\\\.html$|wrangler\\\\.toml$|scripts/cloudflare-native-|scripts/validate-cloudflare-native-public-env\\\\.mjs$|config/cloudflare-native-frontend-build\\\\.json$|src/(main|App)\\\\.[cm]?[tj]sx?$|src/(index|App)\\\\.css$)\",\n      \"ccExecution\": \"^(?:workers/cc-execution/|scripts/visual-witness-hosted-runner/)\",\n      \"onrunner\": \"^scripts/visual-witness-hosted-runner/\",\n      \"supabaseEdge\": \"^supabase/functions/\",\n      \"migrations\": \"^supabase/migrations/\",\n      \"controlPlane\": \"^(config/control-plane-capabilities\\\\.json$|\\\\.forgejo/workflows/|workers/cc-execution/)\""},{"new_content":"        \"releaseOwner\": \"forgejo_runner_direct_affected_targets\",\n        \"proof\": \"immutable_cc_execution_runtime_identity\"\n      },\n      \"frontend\": {\n        \"pathPattern\": \"^(?:src/(?!__tests__/contracts/)|public/|index\\\\.html$|package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|components\\\\.json$|wrangler\\\\.toml$)\",\n        \"checks\": [\"impact_typecheck\", \"frontend_contracts\", \"build_when_critical\", \"knocklaunch_gate\"],","old_content":"        \"releaseOwner\": \"forgejo_runner_direct_affected_targets\",\n        \"proof\": \"immutable_cc_execution_runtime_identity\"\n      },\n      \"onrunner\": {\n        \"pathPattern\": \"^scripts/visual-witness-hosted-runner/\",\n        \"checks\": [\"visual_witness_runner_syntax\", \"immutable_image_build\", \"knocklaunch_gate\"],\n        \"releaseOwner\": \"forgejo_runner_direct_render_onrunner\",\n        \"proof\": \"render_onrunner_ready_exact_source_commit\"\n      },\n      \"frontend\": {\n        \"pathPattern\": \"^(?:src/(?!__tests__/contracts/)|public/|index\\\\.html$|package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|components\\\\.json$|wrangler\\\\.toml$)\",\n        \"checks\": [\"impact_typecheck\", \"frontend_contracts\", \"build_when_critical\", \"knocklaunch_gate\"],"}]},{"path":"scripts/release-event-native-plan.test.mjs","edits":[{"new_content":"const frontendVersionDeploy = fs.readFileSync(\"scripts/cloudflare-native-version-deploy.mjs\", \"utf8\");\nassert.match(frontendVersionDeploy, /frontend_candidate_source_mismatch/,\n  \"exact-source zero-traffic canary mismatch guard must remain fail-closed\");\nassert.doesNotMatch(workflow, /release_onrunner/, \"retired OnRunner release input must stay absent\");\nassert.match(workflow, /github\\.event\\.inputs\\.release_frontend == 'true'.*github\\.event\\.inputs\\.release_supabase_edge == 'true'.*github\\.event\\.inputs\\.release_migrations == 'true'/s, \"remaining mixed targets retain planning\");\nassert.match(workflow, /release-cc-execution:[\\s\\S]*?if: \\$\\{\\{ always\\(\\) && \\(\\(github\\.event_name == 'workflow_dispatch'[\\s\\S]*?github\\.event\\.inputs\\.release_cc_execution == 'true'[\\s\\S]*?needs\\.release-plan\\.outputs\\.release_cc_execution == 'true'/, \"cc-execution dispatch must run through skipped release-plan dependency\");\nassert.match(workflow, /REQUESTED_SOURCE_SHA: \\$\\{\\{ github\\.event_name == 'workflow_dispatch' && github\\.event\\.inputs\\.source_sha \\|\\| needs\\.release-plan\\.outputs\\.source_sha \\}\\}/, \"cc-execution dispatch must use authoritative source_sha input\");\nassert.doesNotMatch(workflow, /'\\/config\\/' \\\\\\n\\s*'\\/workers\\/cc-execution\\/' \\\\\\n\\s*'\\/scripts\\/' \\\\\\n\\s*'\\/supabase\\/functions\\/'/, \"Gate sparse baseline must not hydrate unrelated operational trees unconditionally\");","old_content":"const frontendVersionDeploy = fs.readFileSync(\"scripts/cloudflare-native-version-deploy.mjs\", \"utf8\");\nassert.match(frontendVersionDeploy, /frontend_candidate_source_mismatch/,\n  \"exact-source zero-traffic canary mismatch guard must remain fail-closed\");\nassert.match(workflow, /github\\.event\\.inputs\\.release_onrunner == 'true'.*github\\.event\\.inputs\\.release_frontend == 'true'.*github\\.event\\.inputs\\.release_supabase_edge == 'true'.*github\\.event\\.inputs\\.release_migrations == 'true'/s, \"cc-execution-only dispatch must skip release-plan while mixed targets retain planning\");\nassert.match(workflow, /release-cc-execution:[\\s\\S]*?if: \\$\\{\\{ always\\(\\) && \\(\\(github\\.event_name == 'workflow_dispatch'[\\s\\S]*?github\\.event\\.inputs\\.release_cc_execution == 'true'[\\s\\S]*?needs\\.release-plan\\.outputs\\.release_cc_execution == 'true'/, \"cc-execution dispatch must run through skipped release-plan dependency\");\nassert.match(workflow, /REQUESTED_SOURCE_SHA: \\$\\{\\{ github\\.event_name == 'workflow_dispatch' && github\\.event\\.inputs\\.source_sha \\|\\| needs\\.release-plan\\.outputs\\.source_sha \\}\\}/, \"cc-execution dispatch must use authoritative source_sha input\");\nassert.doesNotMatch(workflow, /'\\/config\\/' \\\\\\n\\s*'\\/workers\\/cc-execution\\/' \\\\\\n\\s*'\\/scripts\\/' \\\\\\n\\s*'\\/supabase\\/functions\\/'/, \"Gate sparse baseline must not hydrate unrelated operational trees unconditionally\");"},{"new_content":"  assert.deepEqual(decoded, [...new Set(paths)].sort());\n  const expected = releaseTargetsFromChangedPaths(paths);\n  assert.equal(outputs.release_cc_execution, String(expected.ccExecution));\n  assert.equal(Object.prototype.hasOwnProperty.call(outputs, \"release_onrunner\"), false);\n  assert.equal(outputs.release_frontend, String(expected.frontend));\n  assert.equal(outputs.release_supabase_edge, String(expected.supabaseEdge));\n  assert.equal(outputs.supabase_edge_reconcile, String(paths.includes(\"scripts/reconcile-supabase-edge-registry.mjs\")));","old_content":"  assert.deepEqual(decoded, [...new Set(paths)].sort());\n  const expected = releaseTargetsFromChangedPaths(paths);\n  assert.equal(outputs.release_cc_execution, String(expected.ccExecution));\n  assert.equal(outputs.release_onrunner, String(expected.onrunner));\n  assert.equal(outputs.release_frontend, String(expected.frontend));\n  assert.equal(outputs.release_supabase_edge, String(expected.supabaseEdge));\n  assert.equal(outputs.supabase_edge_reconcile, String(paths.includes(\"scripts/reconcile-supabase-edge-registry.mjs\")));"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 1 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-live"]}],"objective":"Apply exact repository-authority decruft batch 1 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to protected main d4b2db0be2ef7626e4592ce173519923aa0fd7dc; do not create another PR or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-live"]},{"id":"base-binding","statement":"Control-plane maintenance authorization is bound to protected main d4b2db0be2ef7626e4592ce173519923aa0fd7dc.","proofConditionIds":["proof-live"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"After canonical Gate, merge and affected release, live authority remains healthy and retired release authority is absent.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 1 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-live"]}],"objective":"Apply exact repository-authority decruft batch 1 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to protected main d4b2db0be2ef7626e4592ce173519923aa0fd7dc; do not create another PR or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-live"]},{"id":"base-binding","statement":"Control-plane maintenance authorization is bound to protected main d4b2db0be2ef7626e4592ce173519923aa0fd7dc.","proofConditionIds":["proof-live"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"After canonical Gate, merge and affected release, live authority remains healthy and retired release authority is absent.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"controlPlaneMaintenanceReason":"Exact owner-authorized continuation of PR #4073 bound to protected main d4b2db0be2ef7626e4592ce173519923aa0fd7dc."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"controlPlaneMaintenanceReason":"Exact owner-authorized continuation of PR #4073 bound to protected main d4b2db0be2ef7626e4592ce173519923aa0fd7dc."},"recovery":false,"fingerprint":"bb60ed1ebda07770efba42a6ce17e3defa7d7e3423814f453818638b196b2083","replayCount":0,"serializedBytes":30141},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:27:54.289078+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:0dde2831-ef1b-4181-9180-0ba17d7af831:repository-mutation-intent:bb60ed1ebda07770efba42a6ce17e3defa7d7e3423814f453818638b196b2083:0","mission_step_id":"0f2b4ad0-4d70-4ebb-abf2-7fe7a21cf2ad","command_center_event_id":"0dde2831-ef1b-4181-9180-0ba17d7af831"},{"id":"050427d9-dc07-4acb-b187-cd4c5f68f4cb","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[],"branch":"ai/objective-first-repair-3cc342e3e98e","writes":[],"patches":[],"pr_body":"Completes the remaining Mission Freedom runtime configuration without a new provider secret: PAUL external research uses the existing Workers AI binding plus the no-key Bing RSS public index, returns sources, synthesizes only from indexed evidence, and degrades to grounded snippets when model synthesis is busy.","version":1,"approved":true,"pr_title":"Mission Freedom: configure standalone PAUL research","missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e","objective":"Continue the same Mission Freedom P0 research-configuration mission. Make standalone web research live using the existing Workers AI binding plus the no-key public Bing RSS index, with grounded snippet fallback if synthesis is unavailable. Then Gate, merge, deploy cc-execution, and verify live webResearchReady=true.","repository":"noel/KnockLaunchOS","autoProgress":true,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/model-provider-gateway.js","workers/cc-execution/test/model-provider-gateway.test.js","workers/cc-execution/src/version.js"],"anchored_edits":[{"path":"workers/cc-execution/src/model-provider-gateway.js","edits":[{"new_content":"function researchProvider(env={},fallback=false,aiPrimary={}){const prefix=fallback?\"KNOCKLAUNCH_RESEARCH_FALLBACK\":\"KNOCKLAUNCH_RESEARCH\",explicitProvider=providerName(env[prefix+\"_PROVIDER\"]||\"\");if(!fallback&&!explicitProvider&&aiPrimary.provider===\"cloudflare-workers-ai\"&&aiPrimary.binding)return{role:\"research_primary\",provider:\"cloudflare-workers-ai\",model:aiPrimary.model,binding:aiPrimary.binding,transport:\"public_web_rss_plus_workers_ai\",supportsWebSearch:true,available:true};const provider=explicitProvider||(fallback?(!isOpenAI(aiPrimary.provider)&&env.OPENAI_API_KEY?\"openai\":\"\"):aiPrimary.provider),model=text(env[prefix+\"_MODEL\"]||(!fallback?env.KNOCKLAUNCH_AI_MODEL:\"\")||(isOpenAI(provider)?env.OPENAI_MODEL:\"\")||aiPrimary.model||\"gpt-5-mini\",160),apiKey=text(env[prefix+\"_API_KEY\"]||(!fallback?env.KNOCKLAUNCH_AI_API_KEY:\"\")||(isOpenAI(provider)?env.OPENAI_API_KEY:\"\")||(!fallback?aiPrimary.apiKey:\"\"),500),baseUrl=cleanBase(env[prefix+\"_BASE_URL\"]||(!fallback?env.KNOCKLAUNCH_AI_BASE_URL:\"\")||(isOpenAI(provider)?\"https://api.openai.com/v1\":\"\")||(!fallback?aiPrimary.baseUrl:\"\")),allowAnonymous=bool(env[prefix+\"_ALLOW_ANONYMOUS\"],!fallback&&aiPrimary.allowAnonymous===true),supportsWebSearch=bool(env[prefix+\"_WEB_SEARCH_ENABLED\"],isOpenAI(provider));return{role:fallback?\"research_fallback\":\"research_primary\",provider,model,apiKey,baseUrl,allowAnonymous,transport:isOpenAI(provider)?\"openai_responses_web_search\":\"openai_compatible_http\",supportsWebSearch,available:Boolean(provider&&model&&baseUrl&&(apiKey||allowAnonymous))}}","old_content":"function researchProvider(env={},fallback=false,aiPrimary={}){const prefix=fallback?\"KNOCKLAUNCH_RESEARCH_FALLBACK\":\"KNOCKLAUNCH_RESEARCH\",explicitProvider=providerName(env[prefix+\"_PROVIDER\"]||\"\"),provider=explicitProvider||(fallback?(!isOpenAI(aiPrimary.provider)&&env.OPENAI_API_KEY?\"openai\":\"\"):aiPrimary.provider),model=text(env[prefix+\"_MODEL\"]||(!fallback?env.KNOCKLAUNCH_AI_MODEL:\"\")||(isOpenAI(provider)?env.OPENAI_MODEL:\"\")||aiPrimary.model||\"gpt-5-mini\",160),apiKey=text(env[prefix+\"_API_KEY\"]||(!fallback?env.KNOCKLAUNCH_AI_API_KEY:\"\")||(isOpenAI(provider)?env.OPENAI_API_KEY:\"\")||(!fallback?aiPrimary.apiKey:\"\"),500),baseUrl=cleanBase(env[prefix+\"_BASE_URL\"]||(!fallback?env.KNOCKLAUNCH_AI_BASE_URL:\"\")||(isOpenAI(provider)?\"https://api.openai.com/v1\":\"\")||(!fallback?aiPrimary.baseUrl:\"\")),allowAnonymous=bool(env[prefix+\"_ALLOW_ANONYMOUS\"],!fallback&&aiPrimary.allowAnonymous===true),supportsWebSearch=bool(env[prefix+\"_WEB_SEARCH_ENABLED\"],isOpenAI(provider));return{role:fallback?\"research_fallback\":\"research_primary\",provider,model,apiKey,baseUrl,allowAnonymous,supportsWebSearch,available:Boolean(provider&&model&&baseUrl&&(apiKey||allowAnonymous))}}"},{"new_content":"function collectSources(payload){const out=[],seen=new Set(),push=(url,title)=>{const u=text(url,2000);if(!/^https?:\\/\\//i.test(u)||seen.has(u))return;seen.add(u);out.push({url:u,title:text(title,300)||u})};for(const item of Array.isArray(payload?.output)?payload.output:[]){if(item?.type===\"message\")for(const content of Array.isArray(item?.content)?item.content:[])for(const annotation of Array.isArray(content?.annotations)?content.annotations:[])if(annotation?.type===\"url_citation\"||annotation?.url)push(annotation?.url,annotation?.title);if(item?.type===\"web_search_call\"&&Array.isArray(item?.action?.sources))for(const source of item.action.sources)push(source?.url,source?.title)}return out.slice(0,30)}\nconst decodeXml=value=>String(value??\"\").replace(/<!\\[CDATA\\[([\\s\\S]*?)\\]\\]>/g,\"$1\").replace(/&amp;/g,\"&\").replace(/&lt;/g,\"<\").replace(/&gt;/g,\">\").replace(/&quot;/g,'\"').replace(/&#39;|&apos;/g,\"'\");\nconst stripMarkup=value=>decodeXml(value).replace(/<[^>]+>/g,\" \").replace(/\\s+/g,\" \").trim();\nfunction rssItems(xml){const out=[];for(const match of String(xml||\"\").matchAll(/<item>([\\s\\S]*?)<\\/item>/gi)){const block=match[1],tag=name=>{const found=block.match(new RegExp(`<${name}[^>]*>([\\\\s\\\\S]*?)<\\\\/${name}>`,`i`));return found?stripMarkup(found[1]):\"\"},title=tag(\"title\"),url=tag(\"link\"),description=tag(\"description\");if(/^https?:\\/\\//i.test(url))out.push({title:title||url,url,description})}return out.slice(0,8)}\nfunction researchQuery(prompt){return text(prompt,1400).replace(/^Research\\s+(?:with|using)[^:]*:\\s*/i,\"\").split(/\\nSelf-state:/i)[0].replace(/\\s+/g,\" \").trim().slice(0,500)}\nasync function publicWebRssResearch(cfg,{prompt,fetchImpl,env={}}){const query=researchQuery(prompt);if(!query)return{ok:false,status:\"prerequisite_required\",reason:\"research_query_required\",provider:cfg.provider,model:cfg.model,sources:[]};let response;try{response=await fetchImpl(`https://www.bing.com/search?q=${encodeURIComponent(query)}&format=rss`,{headers:{accept:\"application/rss+xml,text/xml;q=0.9,*/*;q=0.5\",\"user-agent\":\"KNOCKLAUNCH-PAUL/1.0\"}})}catch(error){return{ok:false,status:\"retryable\",reason:\"public_web_index_transport\",detail:text(error?.message||error,240),provider:cfg.provider,model:cfg.model,sources:[]}}if(!response.ok)return{ok:false,status:\"retryable\",reason:\"public_web_index_http_\"+response.status,provider:cfg.provider,model:cfg.model,httpStatus:response.status,sources:[]};const items=rssItems(await response.text());if(!items.length)return{ok:false,status:\"retryable\",reason:\"public_web_index_empty\",provider:cfg.provider,model:cfg.model,sources:[]};const sources=items.map(item=>({url:item.url,title:item.title})),evidence=items.map((item,index)=>`[${index+1}] ${item.title}\\n${item.description}\\n${item.url}`).join(\"\\n\\n\");let summary=\"\";try{const payload=await cfg.binding.run(cfg.model,{messages:[{role:\"system\",content:\"You are PAUL's grounded web-research synthesizer. Use only the supplied indexed evidence. Preserve source numbers like [1]. State uncertainty and never invent facts.\"},{role:\"user\",content:`Question: ${query}\\n\\nIndexed evidence:\\n${evidence}`}],stream:false,max_tokens:completionTokenCap(env),chat_template_kwargs:{enable_thinking:false}},{rejectIfBusy:true});summary=text(typeof payload===\"string\"?payload:payload?.response??payload?.result?.response??payload?.text??payload?.output_text,5000)}catch{}if(!summary)summary=items.slice(0,5).map((item,index)=>`[${index+1}] ${item.title}${item.description?` — ${item.description}`:\"\"} (${item.url})`).join(\"\\n\");return{ok:true,status:\"observed\",provider:cfg.provider,model:cfg.model,transport:cfg.transport,text:summary,sources}}\nasync function researchAttempt(cfg,{prompt,fetchImpl,env={}}){if(!cfg?.available||cfg.supportsWebSearch!==true)return{ok:false,status:\"prerequisite_required\",reason:\"research_provider_web_search_not_configured\",provider:cfg?.provider||null,model:cfg?.model||null,sources:[]};if(cfg.transport===\"public_web_rss_plus_workers_ai\")return publicWebRssResearch(cfg,{prompt,fetchImpl,env});let response;try{response=await fetchImpl(cfg.baseUrl+\"/responses\",{method:\"POST\",headers:{...authorizationHeaders(cfg),\"Content-Type\":\"application/json\"},body:JSON.stringify({model:cfg.model,input:prompt,tools:[{type:\"web_search\"}],tool_choice:\"auto\"})})}catch(error){return{ok:false,status:\"retryable\",reason:\"research_provider_transport\",detail:text(error?.message||error,240),provider:cfg.provider,model:cfg.model,sources:[]}}const payload=await response.json().catch(()=>null);if(!response.ok||!payload)return{ok:false,status:errorClass(response.status),reason:response.status===401||response.status===403?\"research_prerequisite_required\":\"research_provider_failed\",provider:cfg.provider,model:cfg.model,httpStatus:response.status,sources:[]};return{ok:true,status:\"observed\",provider:cfg.provider,model:cfg.model,text:collectOutput(payload)||\"Research completed without a text summary.\",sources:collectSources(payload)}}","old_content":"function collectSources(payload){const out=[],seen=new Set(),push=(url,title)=>{const u=text(url,2000);if(!/^https?:\\/\\//i.test(u)||seen.has(u))return;seen.add(u);out.push({url:u,title:text(title,300)||u})};for(const item of Array.isArray(payload?.output)?payload.output:[]){if(item?.type===\"message\")for(const content of Array.isArray(item?.content)?item.content:[])for(const annotation of Array.isArray(content?.annotations)?content.annotations:[])if(annotation?.type===\"url_citation\"||annotation?.url)push(annotation?.url,annotation?.title);if(item?.type===\"web_search_call\"&&Array.isArray(item?.action?.sources))for(const source of item.action.sources)push(source?.url,source?.title)}return out.slice(0,30)}\nasync function researchAttempt(cfg,{prompt,fetchImpl}){if(!cfg?.available||cfg.supportsWebSearch!==true)return{ok:false,status:\"prerequisite_required\",reason:\"research_provider_web_search_not_configured\",provider:cfg?.provider||null,model:cfg?.model||null,sources:[]};let response;try{response=await fetchImpl(cfg.baseUrl+\"/responses\",{method:\"POST\",headers:{...authorizationHeaders(cfg),\"Content-Type\":\"application/json\"},body:JSON.stringify({model:cfg.model,input:prompt,tools:[{type:\"web_search\"}],tool_choice:\"auto\"})})}catch(error){return{ok:false,status:\"retryable\",reason:\"research_provider_transport\",detail:text(error?.message||error,240),provider:cfg.provider,model:cfg.model,sources:[]}}const payload=await response.json().catch(()=>null);if(!response.ok||!payload)return{ok:false,status:errorClass(response.status),reason:response.status===401||response.status===403?\"research_prerequisite_required\":\"research_provider_failed\",provider:cfg.provider,model:cfg.model,httpStatus:response.status,sources:[]};return{ok:true,status:\"observed\",provider:cfg.provider,model:cfg.model,text:collectOutput(payload)||\"Research completed without a text summary.\",sources:collectSources(payload)}}"},{"new_content":"const result=await researchAttempt(attempts[index],{prompt,fetchImpl,env});","old_content":"const result=await researchAttempt(attempts[index],{prompt,fetchImpl});"}]},{"path":"workers/cc-execution/test/model-provider-gateway.test.js","edits":[{"new_content":"test('Workers AI failure may fall back to separately configured OpenAI API',async()=>{const AI={run:async()=>{throw Object.assign(new Error('busy'),{status:429})}},fetchImpl=async()=>response({choices:[{message:{content:'{\\\"kind\\\":\\\"chat\\\"}'}}]}),gateway=createInferenceGateway({AI,OPENAI_API_KEY:'fallback-key'},fetchImpl),result=await gateway.decide({messages:[{role:'user',content:'hello'}],responseSchema:null});assert.equal(result.provider,'openai');assert.equal(result.usedFallback,true)});\ntest('Workers AI research uses the no-key public web index and reports ready',async()=>{const rss='<?xml version=\"1.0\"?><rss><channel><item><title>Example source</title><link>https://example.com/source</link><description>Grounded external fact.</description></item></channel></rss>',calls=[],AI={run:async(model,input,options)=>{calls.push({model,input,options});return{response:'Grounded answer [1]'}}},fetchImpl=async url=>{assert.match(String(url),/^https:\\/\\/www\\.bing\\.com\\/search\\?/);return new Response(rss,{status:200,headers:{'content-type':'application/rss+xml'}})},gateway=createInferenceGateway({AI},fetchImpl),readiness=inferenceProviderReadiness({AI}),result=await gateway.research({prompt:'Research using live web sources and preserve citations: current external fact'});assert.equal(readiness.webResearchReady,true);assert.equal(readiness.researchPrimary.transport,'public_web_rss_plus_workers_ai');assert.equal(result.ok,true);assert.equal(result.provider,'cloudflare-workers-ai');assert.equal(result.sources[0].url,'https://example.com/source');assert.match(result.text,/Grounded answer/);assert.equal(calls[0].options.rejectIfBusy,true)});\ntest('Workers AI research degrades to indexed evidence when synthesis is busy',async()=>{const rss='<?xml version=\"1.0\"?><rss><channel><item><title>Fallback source</title><link>https://example.com/fallback</link><description>Verified indexed snippet.</description></item></channel></rss>',AI={run:async()=>{throw Object.assign(new Error('busy'),{status:429})}},fetchImpl=async()=>new Response(rss,{status:200,headers:{'content-type':'application/rss+xml'}}),gateway=createInferenceGateway({AI},fetchImpl),result=await gateway.research({prompt:'Research using live web sources and preserve citations: fallback test'});assert.equal(result.ok,true);assert.match(result.text,/Fallback source/);assert.equal(result.sources[0].url,'https://example.com/fallback')});","old_content":"test('Workers AI failure may fall back to separately configured OpenAI API',async()=>{const AI={run:async()=>{throw Object.assign(new Error('busy'),{status:429})}},fetchImpl=async()=>response({choices:[{message:{content:'{\\\"kind\\\":\\\"chat\\\"}'}}]}),gateway=createInferenceGateway({AI,OPENAI_API_KEY:'fallback-key'},fetchImpl),result=await gateway.decide({messages:[{role:'user',content:'hello'}],responseSchema:null});assert.equal(result.provider,'openai');assert.equal(result.usedFallback,true)});"}]},{"path":"workers/cc-execution/src/version.js","edits":[{"new_content":"export const CC_EXECUTION_VERSION = \"1.63.0-mission-freedom-web-research\";","old_content":"export const CC_EXECUTION_VERSION = \"1.62.0-mission-freedom-cloudflare-primary\";"}]}],"commit_message":"feat: complete standalone PAUL web research","implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e","ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/model-provider-gateway.js","workers/cc-execution/test/model-provider-gateway.test.js","workers/cc-execution/src/version.js"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/model-provider-gateway.js","workers/cc-execution/test/model-provider-gateway.test.js","workers/cc-execution/src/version.js"],"controlPlaneMaintenanceReason":"Owner-authorized completion of Mission Freedom standalone research configuration."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/model-provider-gateway.js","workers/cc-execution/test/model-provider-gateway.test.js","workers/cc-execution/src/version.js"],"controlPlaneMaintenanceReason":"Owner-authorized completion of Mission Freedom standalone research configuration."},"recovery":false,"fingerprint":"acede72a25df89a795fe9b45f32a027a39155cee00a5327d22f2a935f252d9b8","replayCount":0,"serializedBytes":16002},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:28:08.036326+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:repository-mutation-intent:acede72a25df89a795fe9b45f32a027a39155cee00a5327d22f2a935f252d9b8:0","mission_step_id":"b04f4319-b125-4565-9663-22c09a201269","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"4a0c9480-04de-4cc0-a1ea-e92a5038ce54","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-d8028b7a80b7","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":75529,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":0,"executorlessWaitMs":84849,"firstUsefulResultAt":"2026-09-29T02:20:58.194Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":null,"prNumber":4082,"terminal":false,"missionId":"d8028b7a-80b7-44a7-bd61-1f210843326b","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","timingsMs":{"prReadinessMs":96,"approvedPlanMs":0,"shipAndProveMs":364,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"d8028b7a-80b7-44a7-bd61-1f210843326b"},"performance":null,"deploymentId":"forgejo-main-63d0666b5d2f","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-google-drive-media","pcg-legacy-import"]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2055,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:26:44.136981+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4082","receipt_type":"automatic_mission_resume","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:automatic-mission-resume:4082:canonical_release_reconciliation_pending","mission_step_id":"e9d7e549-deb9-4d13-ae51-bb5c174bd32a","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"bb26774f-7462-498d-bb7a-4d756af8a843","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","frontend-cloudflare/live":"pending","supabase-edge-production/live":"success"},"mainSha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","missing":[],"pending":["forgejo-release/workflow","frontend-cloudflare/live"],"required":["forgejo-main/source","forgejo-release/workflow","supabase-edge-production/live","frontend-cloudflare/live"],"sourceSha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","releaseState":"pending","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-google-drive-media","pcg-legacy-import"]},"releaseTargetStates":{"frontend":"pending","supabaseEdge":"success"},"requestContractHash":"eb9ce1be253947b427f7fc9e99b4f38f686d75f021cb6bd5d83be61273a5bbe1","forgejoWorkflowProof":{"runId":12851,"source":"signed_push_receipt","status":"waiting","results":{},"conclusion":"waiting","targetStates":{"frontend":"pending","supabaseEdge":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"pending","supabaseEdge":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:26:45.292805+00:00","proof_gate":"canonical_release_pending","source_sha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","external_id":"forgejo-main-63d0666b5d2f","receipt_type":"canonical_release_status","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:forgejo-release-status:63d0666b5d2f3d03b1ebf770beb96f1fd37508e0:pending:forgejo-main/source=success|forgejo-release/workflow=pending|supabase-edge-production/live=success|frontend-cloudflare/live=pending","mission_step_id":"e9aee436-ef7e-4086-9552-10f9efc3cedc","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"87420bb7-5060-4adb-be71-2aa6e49f8f03","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-d8028b7a80b7","prNumber":4082,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:26:42.588577+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","external_id":"4082","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:merged-pr:4082:63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","mission_step_id":"e9d7e549-deb9-4d13-ae51-bb5c174bd32a","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"e07f90b4-d979-4201-861d-1c9aa63eb6a0","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-0c9214aed67b","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":9929,"releaseCount":0,"toolCallCount":5,"repeatedCallCount":3,"executorlessWaitMs":325475,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1252,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":1060,"providerAuthMs":0,"ledgerPrepareMs":1060,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":1060,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":1060,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["visual","runtime","runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":5890,"likelyAffectedFiles":["src/pages/settings/TenantSettingsPageWithWebsiteAssets.tsx","src/lib/tenantMedia.ts","src/pages/whats-my-progress/WhatsMyProgressTenantHome.tsx","src/pages/whats-my-progress/PCGWhatsMyProgressHome.tsx","src/pages/book-me-directly/BookMeDirectlyPublicPage.tsx","supabase/functions/customer-portal/index.ts","src/__tests__/contracts/prehistoric-001-tenant-media.contract.test.ts"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:20:54.662412+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"162b58af-8e87-4a7f-b741-4212ab04212a","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"31c9692f-e8fa-428b-b69a-834104f3ff40","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"c18494fd-aa07-4d65-8cb1-809efbfd0377","objective":"Apply exact repository-authority decruft batch 1 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c267479c921da9f1dea8b4b217448a4367523515. Do not create another PR or broaden scope.","sourceSha":"c267479c921da9f1dea8b4b217448a4367523515","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"workstreamKey":"repo-decruft-pr4073-batch1-c267479c921d","anchored_edits":[{"path":".forgejo/workflows/knocklaunch.yml","edits":[{"new_content":"        required: false\n        default: \"false\"\n        type: string\n      release_frontend:\n        description: Release frontend when affected\n        required: false","old_content":"        required: false\n        default: \"false\"\n        type: string\n      release_onrunner:\n        description: Release Render OnRunner when affected\n        required: false\n        default: \"false\"\n        type: string\n      release_frontend:\n        description: Release frontend when affected\n        required: false"},{"new_content":"jobs:\n  release-plan:\n    name: Delivery / Maintenance Plan\n    if: ${{ github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.event.inputs.operation == 'release-main' && (github.event.inputs.release_cc_execution == 'true' || github.event.inputs.release_frontend == 'true' || github.event.inputs.release_supabase_edge == 'true' || github.event.inputs.supabase_edge_reconcile == 'true' || github.event.inputs.release_migrations == 'true')) }}\n    runs-on: docker-8g\n    container:\n      image: node:22.18.0-bookworm","old_content":"jobs:\n  release-plan:\n    name: Delivery / Maintenance Plan\n    if: ${{ github.event_name == 'schedule' || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.event.inputs.operation == 'release-main' && (github.event.inputs.release_cc_execution == 'true' || github.event.inputs.release_onrunner == 'true' || github.event.inputs.release_frontend == 'true' || github.event.inputs.release_supabase_edge == 'true' || github.event.inputs.supabase_edge_reconcile == 'true' || github.event.inputs.release_migrations == 'true')) }}\n    runs-on: docker-8g\n    container:\n      image: node:22.18.0-bookworm"},{"new_content":"      changed_paths_b64: ${{ steps.plan.outputs.changed_paths_b64 }}\n      release_cc_execution: ${{ steps.plan.outputs.release_cc_execution }}\n      release_cc_execution_heavy: ${{ steps.plan.outputs.release_cc_execution_heavy }}\n      release_frontend: ${{ steps.plan.outputs.release_frontend }}\n      release_supabase_edge: ${{ steps.plan.outputs.release_supabase_edge }}\n      supabase_edge_reconcile: ${{ steps.plan.outputs.supabase_edge_reconcile }}","old_content":"      changed_paths_b64: ${{ steps.plan.outputs.changed_paths_b64 }}\n      release_cc_execution: ${{ steps.plan.outputs.release_cc_execution }}\n      release_cc_execution_heavy: ${{ steps.plan.outputs.release_cc_execution_heavy }}\n      release_onrunner: ${{ steps.plan.outputs.release_onrunner }}\n      release_frontend: ${{ steps.plan.outputs.release_frontend }}\n      release_supabase_edge: ${{ steps.plan.outputs.release_supabase_edge }}\n      supabase_edge_reconcile: ${{ steps.plan.outputs.supabase_edge_reconcile }}"},{"new_content":"          const frontendPath = /^(?:src\\/(?!__tests__\\/contracts\\/)|public\\/|index\\.html$|package(?:-lock)?\\.json$|vite\\.config\\.|tsconfig|tailwind\\.config\\.|postcss\\.config\\.|components\\.json$|wrangler\\.toml$|scripts\\/cloudflare-native-(?!version-deploy\\.mjs$)|scripts\\/validate-cloudflare-native-public-env\\.mjs$|config\\/cloudflare-native-frontend-build\\.json$)/;\n          const targets = {\n            ccExecution: paths.some((path) => (path.startsWith(\"workers/cc-execution/\") && !path.startsWith(\"workers/cc-execution/test/\")) || path === \"config/control-plane-capabilities.json\" || path.startsWith(\"scripts/visual-witness-hosted-runner/\")),\n            frontend: paths.some((path) => frontendPath.test(path)),\n            supabaseEdge: paths.some((path) => path.startsWith(\"supabase/functions/\") || path === \"scripts/reconcile-supabase-edge-registry.mjs\"),\n            migrations: paths.some((path) => path.startsWith(\"supabase/migrations/\")),","old_content":"          const frontendPath = /^(?:src\\/(?!__tests__\\/contracts\\/)|public\\/|index\\.html$|package(?:-lock)?\\.json$|vite\\.config\\.|tsconfig|tailwind\\.config\\.|postcss\\.config\\.|components\\.json$|wrangler\\.toml$|scripts\\/cloudflare-native-(?!version-deploy\\.mjs$)|scripts\\/validate-cloudflare-native-public-env\\.mjs$|config\\/cloudflare-native-frontend-build\\.json$)/;\n          const targets = {\n            ccExecution: paths.some((path) => (path.startsWith(\"workers/cc-execution/\") && !path.startsWith(\"workers/cc-execution/test/\")) || path === \"config/control-plane-capabilities.json\" || path.startsWith(\"scripts/visual-witness-hosted-runner/\")),\n            onrunner: false,\n            frontend: paths.some((path) => frontendPath.test(path)),\n            supabaseEdge: paths.some((path) => path.startsWith(\"supabase/functions/\") || path === \"scripts/reconcile-supabase-edge-registry.mjs\"),\n            migrations: paths.some((path) => path.startsWith(\"supabase/migrations/\")),"},{"new_content":"            changed_paths_b64: Buffer.from(paths.join(\"\\n\"), \"utf8\").toString(\"base64\"),\n            release_cc_execution: String(targets.ccExecution),\n            release_cc_execution_heavy: String(ccExecutionHeavy),\n            release_frontend: String(targets.frontend),\n            release_supabase_edge: String(targets.supabaseEdge),\n            supabase_edge_reconcile: String(supabaseEdgeReconcile),","old_content":"            changed_paths_b64: Buffer.from(paths.join(\"\\n\"), \"utf8\").toString(\"base64\"),\n            release_cc_execution: String(targets.ccExecution),\n            release_cc_execution_heavy: String(ccExecutionHeavy),\n            release_onrunner: String(targets.onrunner),\n            release_frontend: String(targets.frontend),\n            release_supabase_edge: String(targets.supabaseEdge),\n            supabase_edge_reconcile: String(supabaseEdgeReconcile),"},{"new_content":"          EVENT_CHANGED_PATHS_B64: ${{ steps.event_plan.outputs.changed_paths_b64 }}\n          EVENT_RELEASE_CC_EXECUTION: ${{ steps.event_plan.outputs.release_cc_execution }}\n          EVENT_RELEASE_CC_EXECUTION_HEAVY: ${{ steps.event_plan.outputs.release_cc_execution_heavy }}\n          EVENT_RELEASE_FRONTEND: ${{ steps.event_plan.outputs.release_frontend }}\n          EVENT_RELEASE_SUPABASE_EDGE: ${{ steps.event_plan.outputs.release_supabase_edge }}\n          EVENT_SUPABASE_EDGE_RECONCILE: ${{ steps.event_plan.outputs.supabase_edge_reconcile }}","old_content":"          EVENT_CHANGED_PATHS_B64: ${{ steps.event_plan.outputs.changed_paths_b64 }}\n          EVENT_RELEASE_CC_EXECUTION: ${{ steps.event_plan.outputs.release_cc_execution }}\n          EVENT_RELEASE_CC_EXECUTION_HEAVY: ${{ steps.event_plan.outputs.release_cc_execution_heavy }}\n          EVENT_RELEASE_ONRUNNER: ${{ steps.event_plan.outputs.release_onrunner }}\n          EVENT_RELEASE_FRONTEND: ${{ steps.event_plan.outputs.release_frontend }}\n          EVENT_RELEASE_SUPABASE_EDGE: ${{ steps.event_plan.outputs.release_supabase_edge }}\n          EVENT_SUPABASE_EDGE_RECONCILE: ${{ steps.event_plan.outputs.supabase_edge_reconcile }}"},{"new_content":"          INPUT_SOURCE_SHA: ${{ github.event.inputs.source_sha }}\n          INPUT_CHANGED_PATHS_B64: ${{ github.event.inputs.changed_paths_b64 }}\n          INPUT_RELEASE_CC_EXECUTION: ${{ github.event.inputs.release_cc_execution }}\n          INPUT_RELEASE_FRONTEND: ${{ github.event.inputs.release_frontend }}\n          INPUT_RELEASE_SUPABASE_EDGE: ${{ github.event.inputs.release_supabase_edge }}\n          INPUT_SUPABASE_EDGE_RECONCILE: ${{ github.event.inputs.supabase_edge_reconcile }}","old_content":"          INPUT_SOURCE_SHA: ${{ github.event.inputs.source_sha }}\n          INPUT_CHANGED_PATHS_B64: ${{ github.event.inputs.changed_paths_b64 }}\n          INPUT_RELEASE_CC_EXECUTION: ${{ github.event.inputs.release_cc_execution }}\n          INPUT_RELEASE_ONRUNNER: ${{ github.event.inputs.release_onrunner }}\n          INPUT_RELEASE_FRONTEND: ${{ github.event.inputs.release_frontend }}\n          INPUT_RELEASE_SUPABASE_EDGE: ${{ github.event.inputs.release_supabase_edge }}\n          INPUT_SUPABASE_EDGE_RECONCILE: ${{ github.event.inputs.supabase_edge_reconcile }}"},{"new_content":"              \"changed_paths_b64=$EVENT_CHANGED_PATHS_B64\" \\\n              \"release_cc_execution=$EVENT_RELEASE_CC_EXECUTION\" \\\n              \"release_cc_execution_heavy=$EVENT_RELEASE_CC_EXECUTION_HEAVY\" \\\n              \"release_frontend=$EVENT_RELEASE_FRONTEND\" \\\n              \"release_supabase_edge=$EVENT_RELEASE_SUPABASE_EDGE\" \\\n              \"supabase_edge_reconcile=$EVENT_SUPABASE_EDGE_RECONCILE\" \\","old_content":"              \"changed_paths_b64=$EVENT_CHANGED_PATHS_B64\" \\\n              \"release_cc_execution=$EVENT_RELEASE_CC_EXECUTION\" \\\n              \"release_cc_execution_heavy=$EVENT_RELEASE_CC_EXECUTION_HEAVY\" \\\n              \"release_onrunner=false\" \\\n              \"release_frontend=$EVENT_RELEASE_FRONTEND\" \\\n              \"release_supabase_edge=$EVENT_RELEASE_SUPABASE_EDGE\" \\\n              \"supabase_edge_reconcile=$EVENT_SUPABASE_EDGE_RECONCILE\" \\"},{"new_content":"              \"changed_paths_b64=\" \\\n              \"release_cc_execution=false\" \\\n              \"release_cc_execution_heavy=false\" \\\n              \"release_frontend=false\" \\\n              \"release_supabase_edge=true\" \\\n              \"supabase_edge_reconcile=true\" \\","old_content":"              \"changed_paths_b64=\" \\\n              \"release_cc_execution=false\" \\\n              \"release_cc_execution_heavy=false\" \\\n              \"release_onrunner=false\" \\\n              \"release_frontend=false\" \\\n              \"release_supabase_edge=true\" \\\n              \"supabase_edge_reconcile=true\" \\"},{"new_content":"              \"changed_paths_b64=${INPUT_CHANGED_PATHS_B64:-}\" \\\n              \"release_cc_execution=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_cc_execution_heavy=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_frontend=${INPUT_RELEASE_FRONTEND:-false}\" \\\n              \"release_supabase_edge=${INPUT_RELEASE_SUPABASE_EDGE:-false}\" \\\n              \"supabase_edge_reconcile=${INPUT_SUPABASE_EDGE_RECONCILE:-false}\" \\","old_content":"              \"changed_paths_b64=${INPUT_CHANGED_PATHS_B64:-}\" \\\n              \"release_cc_execution=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_cc_execution_heavy=${INPUT_RELEASE_CC_EXECUTION:-false}\" \\\n              \"release_onrunner=false\" \\\n              \"release_frontend=${INPUT_RELEASE_FRONTEND:-false}\" \\\n              \"release_supabase_edge=${INPUT_RELEASE_SUPABASE_EDGE:-false}\" \\\n              \"supabase_edge_reconcile=${INPUT_SUPABASE_EDGE_RECONCILE:-false}\" \\"},{"new_content":"            '/scripts/validate-windows-repository-paths.mjs' \\\n            '/scripts/validate-windows-repository-paths.test.mjs' \\\n            '/scripts/validate-control-plane-restore-point.mjs' \\\n            '/scripts/validate-release-architecture.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\\n            '/scripts/validate-capability-manifests.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\","old_content":"            '/scripts/validate-windows-repository-paths.mjs' \\\n            '/scripts/validate-windows-repository-paths.test.mjs' \\\n            '/scripts/validate-control-plane-restore-point.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\\n            '/scripts/validate-capability-manifests.mjs' \\\n            '/scripts/validate-stale-gate-evidence-reuse.mjs' \\"},{"new_content":"            config/control-plane-capabilities.json\n            config/control-plane-restore-point.json\n            scripts/validate-control-plane-restore-point.mjs\n            scripts/validate-release-architecture.mjs\n            src/__tests__/contracts/control-plane-restore-point.contract.test.ts\n            workers/cc-execution/src/index-release-fast-lane.js\n            workers/cc-execution/src/entrypoint-owner-status.js","old_content":"            config/control-plane-capabilities.json\n            config/control-plane-restore-point.json\n            scripts/validate-control-plane-restore-point.mjs\n            src/__tests__/contracts/control-plane-restore-point.contract.test.ts\n            workers/cc-execution/src/index-release-fast-lane.js\n            workers/cc-execution/src/entrypoint-owner-status.js"},{"new_content":"          node scripts/release-event-native-plan.test.mjs\n          node scripts/reconcile-supabase-edge-registry.test.mjs\n          node scripts/validate-control-plane-restore-point.mjs\n          node scripts/validate-release-architecture.mjs\n          echo \"Hard safety: canonical control-plane restore point contract passed.\"\n\n          # Runtime parseability is a hard safety invariant, not optional domain QA.","old_content":"          node scripts/release-event-native-plan.test.mjs\n          node scripts/reconcile-supabase-edge-registry.test.mjs\n          node scripts/validate-control-plane-restore-point.mjs\n          echo \"Hard safety: canonical control-plane restore point contract passed.\"\n\n          # Runtime parseability is a hard safety invariant, not optional domain QA."}]},{"path":"config/control-plane-capabilities.json","edits":[{"new_content":"  \"authority\": \"live_runtime\",\n  \"purpose\": \"Bootstrap capability resolution without duplicating or freezing the live tool inventory.\",\n  \"repository\": \"noel/KnockLaunchOS\",\n  \"canonicalArchitectureRestorePoint\": \"config/system-restore-points/golden-restore-2026-09-25-1005Z.json\",\n  \"runtime\": {\n    \"healthEndpoint\": \"https://cc-execution.knocklaunch.app/health\",\n    \"openApiEndpoint\": \"https://cc-execution.knocklaunch.app/openapi.json\",","old_content":"  \"authority\": \"live_runtime\",\n  \"purpose\": \"Bootstrap capability resolution without duplicating or freezing the live tool inventory.\",\n  \"repository\": \"noel/KnockLaunchOS\",\n  \"canonicalArchitectureRestorePoint\": \"config/control-plane-restore-point.json\",\n  \"runtime\": {\n    \"healthEndpoint\": \"https://cc-execution.knocklaunch.app/health\",\n    \"openApiEndpoint\": \"https://cc-execution.knocklaunch.app/openapi.json\","},{"new_content":"    \"verification\": {\n      \"visualWitnessAutomatic\": false,\n      \"visualWitnessPolicy\": \"claim_matched_after_repair\",\n      \"visualWitnessCapacityRoutingPolicy\": \"laptop_first_then_virtual_then_paul_capacity_pool\",\n      \"visualWitnessReleaseValidationPolicy\": \"cold_start_aware_v1_plus_n_minus_one_capacity_pool\",\n      \"visualWitnessInteractiveNoProgressLeaseMs\": 30000,\n      \"visualWitnessNonVisualInteractionCapturePolicy\": \"executable_interaction_diagnostics_without_screenshot_unless_visual_claim\",","old_content":"    \"verification\": {\n      \"visualWitnessAutomatic\": false,\n      \"visualWitnessPolicy\": \"claim_matched_after_repair\",\n      \"visualWitnessCapacityRoutingPolicy\": \"virtual_first_then_render_burst_when_virtual_saturated_or_unavailable\",\n      \"visualWitnessRenderColdStartCostMs\": 60000,\n      \"visualWitnessRenderColdStartPolicy\": \"provider_specific_activation_cost_never_global_witness_timeout\",\n      \"visualWitnessReleaseValidationPolicy\": \"cold_start_aware_v1_plus_n_minus_one_capacity_pool\",\n      \"visualWitnessInteractiveNoProgressLeaseMs\": 30000,\n      \"visualWitnessNonVisualInteractionCapturePolicy\": \"executable_interaction_diagnostics_without_screenshot_unless_visual_claim\","},{"new_content":"    \"visualWitnessExplicitViewportPolicy\": \"explicit_viewport_selection_is_authoritative_across_adaptive_escalation_restart_replay_and_lane_failover_mobile_only_never_silently_expands_to_desktop\",\n    \"visualWitnessRestartReplayPolicy\": \"process_restart_replay_is_bounded_one_per_attempt_slot_and_already_completed_verified_attempts_terminalize_without_replay\",\n    \"visualWitnessDurabilityGatePolicy\": \"hosted_runner_check_executes_test_glob_and_mission_supervisor_durability_contract_guards_terminal_precedence_source_binding_restart_terminalization_and_explicit_viewports\",\n    \"deterministicMissionSupervisorPrimitivePolicy\": \"cloudflare_minute_cron_rehydrates_owner_active_durable_missions_through_the_same_mission_status_deterministic_state_machine_used_interactively_one_transition_brain_no_parallel_recovery_orchestrator\",\n    \"ownerMissionProgressPolicy\": \"durable_mission_receipts_are_the_canonical_owner_progress_journal_mission_status_returns_latestProgress_and_bounded_recentProgress_with_monotonic_timestamp_sequences_phase_owner_safe_message_next_action_or_blocker_ownerCheckpoint_remains_backward_compatible\",\n    \"ownerMissionProgressRecentLimit\": 8,","old_content":"    \"visualWitnessExplicitViewportPolicy\": \"explicit_viewport_selection_is_authoritative_across_adaptive_escalation_restart_replay_and_lane_failover_mobile_only_never_silently_expands_to_desktop\",\n    \"visualWitnessRestartReplayPolicy\": \"process_restart_replay_is_bounded_one_per_attempt_slot_and_already_completed_verified_attempts_terminalize_without_replay\",\n    \"visualWitnessDurabilityGatePolicy\": \"hosted_runner_check_executes_test_glob_and_mission_supervisor_durability_contract_guards_terminal_precedence_source_binding_restart_terminalization_and_explicit_viewports\",\n    \"onrunnerOnlyExactRuntimeProofPolicy\": \"when_onrunner_is_the_only_affected_release_target_exact_healthy_live_onrunner_source_identity_is_authoritative_over_an_interrupted_enclosing_workflow_receipt_mixed_release_targets_remain_fail_closed\",\n    \"deterministicMissionSupervisorPrimitivePolicy\": \"cloudflare_minute_cron_rehydrates_owner_active_durable_missions_through_the_same_mission_status_deterministic_state_machine_used_interactively_one_transition_brain_no_parallel_recovery_orchestrator\",\n    \"ownerMissionProgressPolicy\": \"durable_mission_receipts_are_the_canonical_owner_progress_journal_mission_status_returns_latestProgress_and_bounded_recentProgress_with_monotonic_timestamp_sequences_phase_owner_safe_message_next_action_or_blocker_ownerCheckpoint_remains_backward_compatible\",\n    \"ownerMissionProgressRecentLimit\": 8,"},{"new_content":"      \"contracts\": \"^src/__tests__/contracts/\",\n      \"buildCritical\": \"^(package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|index\\\\.html$|wrangler\\\\.toml$|scripts/cloudflare-native-|scripts/validate-cloudflare-native-public-env\\\\.mjs$|config/cloudflare-native-frontend-build\\\\.json$|src/(main|App)\\\\.[cm]?[tj]sx?$|src/(index|App)\\\\.css$)\",\n      \"ccExecution\": \"^(?:workers/cc-execution/|scripts/visual-witness-hosted-runner/)\",\n      \"supabaseEdge\": \"^supabase/functions/\",\n      \"migrations\": \"^supabase/migrations/\",\n      \"controlPlane\": \"^(config/control-plane-capabilities\\\\.json$|\\\\.forgejo/workflows/|workers/cc-execution/)\"","old_content":"      \"contracts\": \"^src/__tests__/contracts/\",\n      \"buildCritical\": \"^(package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|index\\\\.html$|wrangler\\\\.toml$|scripts/cloudflare-native-|scripts/validate-cloudflare-native-public-env\\\\.mjs$|config/cloudflare-native-frontend-build\\\\.json$|src/(main|App)\\\\.[cm]?[tj]sx?$|src/(index|App)\\\\.css$)\",\n      \"ccExecution\": \"^(?:workers/cc-execution/|scripts/visual-witness-hosted-runner/)\",\n      \"onrunner\": \"^scripts/visual-witness-hosted-runner/\",\n      \"supabaseEdge\": \"^supabase/functions/\",\n      \"migrations\": \"^supabase/migrations/\",\n      \"controlPlane\": \"^(config/control-plane-capabilities\\\\.json$|\\\\.forgejo/workflows/|workers/cc-execution/)\""},{"new_content":"        \"releaseOwner\": \"forgejo_runner_direct_affected_targets\",\n        \"proof\": \"immutable_cc_execution_runtime_identity\"\n      },\n      \"frontend\": {\n        \"pathPattern\": \"^(?:src/(?!__tests__/contracts/)|public/|index\\\\.html$|package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|components\\\\.json$|wrangler\\\\.toml$)\",\n        \"checks\": [\"impact_typecheck\", \"frontend_contracts\", \"build_when_critical\", \"knocklaunch_gate\"],","old_content":"        \"releaseOwner\": \"forgejo_runner_direct_affected_targets\",\n        \"proof\": \"immutable_cc_execution_runtime_identity\"\n      },\n      \"onrunner\": {\n        \"pathPattern\": \"^scripts/visual-witness-hosted-runner/\",\n        \"checks\": [\"visual_witness_runner_syntax\", \"immutable_image_build\", \"knocklaunch_gate\"],\n        \"releaseOwner\": \"forgejo_runner_direct_render_onrunner\",\n        \"proof\": \"render_onrunner_ready_exact_source_commit\"\n      },\n      \"frontend\": {\n        \"pathPattern\": \"^(?:src/(?!__tests__/contracts/)|public/|index\\\\.html$|package\\\\.json$|package-lock\\\\.json$|vite\\\\.config\\\\.|tsconfig|tailwind\\\\.config\\\\.|postcss\\\\.config\\\\.|components\\\\.json$|wrangler\\\\.toml$)\",\n        \"checks\": [\"impact_typecheck\", \"frontend_contracts\", \"build_when_critical\", \"knocklaunch_gate\"],"}]},{"path":"scripts/release-event-native-plan.test.mjs","edits":[{"new_content":"const frontendVersionDeploy = fs.readFileSync(\"scripts/cloudflare-native-version-deploy.mjs\", \"utf8\");\nassert.match(frontendVersionDeploy, /frontend_candidate_source_mismatch/,\n  \"exact-source zero-traffic canary mismatch guard must remain fail-closed\");\nassert.doesNotMatch(workflow, /release_onrunner/, \"retired OnRunner release input must stay absent\");\nassert.match(workflow, /github\\.event\\.inputs\\.release_frontend == 'true'.*github\\.event\\.inputs\\.release_supabase_edge == 'true'.*github\\.event\\.inputs\\.release_migrations == 'true'/s, \"remaining mixed targets retain planning\");\nassert.match(workflow, /release-cc-execution:[\\s\\S]*?if: \\$\\{\\{ always\\(\\) && \\(\\(github\\.event_name == 'workflow_dispatch'[\\s\\S]*?github\\.event\\.inputs\\.release_cc_execution == 'true'[\\s\\S]*?needs\\.release-plan\\.outputs\\.release_cc_execution == 'true'/, \"cc-execution dispatch must run through skipped release-plan dependency\");\nassert.match(workflow, /REQUESTED_SOURCE_SHA: \\$\\{\\{ github\\.event_name == 'workflow_dispatch' && github\\.event\\.inputs\\.source_sha \\|\\| needs\\.release-plan\\.outputs\\.source_sha \\}\\}/, \"cc-execution dispatch must use authoritative source_sha input\");\nassert.doesNotMatch(workflow, /'\\/config\\/' \\\\\\n\\s*'\\/workers\\/cc-execution\\/' \\\\\\n\\s*'\\/scripts\\/' \\\\\\n\\s*'\\/supabase\\/functions\\/'/, \"Gate sparse baseline must not hydrate unrelated operational trees unconditionally\");","old_content":"const frontendVersionDeploy = fs.readFileSync(\"scripts/cloudflare-native-version-deploy.mjs\", \"utf8\");\nassert.match(frontendVersionDeploy, /frontend_candidate_source_mismatch/,\n  \"exact-source zero-traffic canary mismatch guard must remain fail-closed\");\nassert.match(workflow, /github\\.event\\.inputs\\.release_onrunner == 'true'.*github\\.event\\.inputs\\.release_frontend == 'true'.*github\\.event\\.inputs\\.release_supabase_edge == 'true'.*github\\.event\\.inputs\\.release_migrations == 'true'/s, \"cc-execution-only dispatch must skip release-plan while mixed targets retain planning\");\nassert.match(workflow, /release-cc-execution:[\\s\\S]*?if: \\$\\{\\{ always\\(\\) && \\(\\(github\\.event_name == 'workflow_dispatch'[\\s\\S]*?github\\.event\\.inputs\\.release_cc_execution == 'true'[\\s\\S]*?needs\\.release-plan\\.outputs\\.release_cc_execution == 'true'/, \"cc-execution dispatch must run through skipped release-plan dependency\");\nassert.match(workflow, /REQUESTED_SOURCE_SHA: \\$\\{\\{ github\\.event_name == 'workflow_dispatch' && github\\.event\\.inputs\\.source_sha \\|\\| needs\\.release-plan\\.outputs\\.source_sha \\}\\}/, \"cc-execution dispatch must use authoritative source_sha input\");\nassert.doesNotMatch(workflow, /'\\/config\\/' \\\\\\n\\s*'\\/workers\\/cc-execution\\/' \\\\\\n\\s*'\\/scripts\\/' \\\\\\n\\s*'\\/supabase\\/functions\\/'/, \"Gate sparse baseline must not hydrate unrelated operational trees unconditionally\");"},{"new_content":"  assert.deepEqual(decoded, [...new Set(paths)].sort());\n  const expected = releaseTargetsFromChangedPaths(paths);\n  assert.equal(outputs.release_cc_execution, String(expected.ccExecution));\n  assert.equal(Object.prototype.hasOwnProperty.call(outputs, \"release_onrunner\"), false);\n  assert.equal(outputs.release_frontend, String(expected.frontend));\n  assert.equal(outputs.release_supabase_edge, String(expected.supabaseEdge));\n  assert.equal(outputs.supabase_edge_reconcile, String(paths.includes(\"scripts/reconcile-supabase-edge-registry.mjs\")));","old_content":"  assert.deepEqual(decoded, [...new Set(paths)].sort());\n  const expected = releaseTargetsFromChangedPaths(paths);\n  assert.equal(outputs.release_cc_execution, String(expected.ccExecution));\n  assert.equal(outputs.release_onrunner, String(expected.onrunner));\n  assert.equal(outputs.release_frontend, String(expected.frontend));\n  assert.equal(outputs.release_supabase_edge, String(expected.supabaseEdge));\n  assert.equal(outputs.supabase_edge_reconcile, String(paths.includes(\"scripts/reconcile-supabase-edge-registry.mjs\")));"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 1 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-live"]}],"objective":"Apply exact repository-authority decruft batch 1 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c267479c921da9f1dea8b4b217448a4367523515. Do not create another PR or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-live"]},{"id":"base-binding","statement":"Control-plane maintenance authorization is bound to protected main c267479c921da9f1dea8b4b217448a4367523515.","proofConditionIds":["proof-live"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"After canonical Gate, squash merge, and affected release, live authority remains Forgejo-native and retired release authority remains absent.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 1 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-live"]}],"objective":"Apply exact repository-authority decruft batch 1 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c267479c921da9f1dea8b4b217448a4367523515. Do not create another PR or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-live"]},{"id":"base-binding","statement":"Control-plane maintenance authorization is bound to protected main c267479c921da9f1dea8b4b217448a4367523515.","proofConditionIds":["proof-live"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"After canonical Gate, squash merge, and affected release, live authority remains Forgejo-native and retired release authority remains absent.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"controlPlaneMaintenanceReason":"Exact owner-authorized continuation of PR #4073 bound to current protected main c267479c921da9f1dea8b4b217448a4367523515."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"controlPlaneMaintenanceReason":"Exact owner-authorized continuation of PR #4073 bound to current protected main c267479c921da9f1dea8b4b217448a4367523515."},"recovery":false,"fingerprint":"c08377d2715d50d4d440f4efe97e040b1a1b5d4d00d1c62ff62ab214d3002fff","replayCount":0,"serializedBytes":30229},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:00.885881+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:c18494fd-aa07-4d65-8cb1-809efbfd0377:repository-mutation-intent:c08377d2715d50d4d440f4efe97e040b1a1b5d4d00d1c62ff62ab214d3002fff:0","mission_step_id":"2d537811-b557-4e10-aa2b-7f70ce512431","command_center_event_id":"c18494fd-aa07-4d65-8cb1-809efbfd0377"},{"id":"7a694110-1e73-4163-a583-be3b1a84a657","source":"cc-execution","status":"cancelled","payload":{"cancelled":true,"missionId":"8a7bb657-b031-451c-bb29-f9c4cb54bf9c"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:32:15.431858+00:00","proof_gate":"durable_mission_cancelled","source_sha":null,"external_id":null,"receipt_type":"owner_mission_cancelled","idempotency_key":"mission:8a7bb657-b031-451c-bb29-f9c4cb54bf9c:mission-cancel:8a7bb657-b031-451c-bb29-f9c4cb54bf9c","mission_step_id":"a11adced-21be-44ee-8ea0-d8fda2695ee7","command_center_event_id":"8a7bb657-b031-451c-bb29-f9c4cb54bf9c"},{"id":"687d6aa3-8ec8-477a-a158-29701ceb220a","source":"cc-execution","status":"authorized","payload":{"paths":["src/pages/admin/AdminCloudflareOps.tsx","supabase/functions/cloudflare-ops/index.ts","workers/cc-execution/src/command-center-contracts.js","workers/cc-execution/src/entrypoint-routed.js","workers/cc-execution/src/index-autonomous-release.js","workers/cc-execution/src/index-canonical-edge-deploy.js"],"reason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f.","baseSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","issuedAt":1790649150736,"expiresAt":1790649330736,"missionId":"d31923ac-371e-4a5b-9034-e02109a06e33","authorizationId":"0a70c557-904b-475d-8d77-352d7c129052","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:32:31.022883+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:0a70c557-904b-475d-8d77-352d7c129052","mission_step_id":"30ef36d4-62f6-4cb1-bd86-8f122be69cd9","command_center_event_id":"d31923ac-371e-4a5b-9034-e02109a06e33"},{"id":"8577887d-caea-40a4-834e-ef236cb29eb8","source":"cc-execution","status":"authorized","payload":{"paths":["workers/cc-execution/src/index-controlled-deploy-gate.js","workers/cc-execution/src/index-mcp.js","workers/cc-execution/src/index-mission-control.js"],"reason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f.","baseSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","issuedAt":1790649179346,"expiresAt":1790649359346,"missionId":"7e0fa14d-6c4b-4f73-8a11-d14205162dbf","authorizationId":"7c64d411-c4d2-442f-83a4-8ac2eaf1b884","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:32:59.615025+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:7c64d411-c4d2-442f-83a4-8ac2eaf1b884","mission_step_id":"2a137bca-b3cd-4858-ba71-bd8cbe13c131","command_center_event_id":"7e0fa14d-6c4b-4f73-8a11-d14205162dbf"},{"id":"07ca7193-6a6d-4efd-bab7-241d1b48e2c3","source":"cc-execution","status":"blocked","payload":{"reason":"control_plane_maintenance_base_sha_mismatch","fingerprint":"bb60ed1ebda07770efba42a6ce17e3defa7d7e3423814f453818638b196b2083"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:27:55.204852+00:00","proof_gate":"repository_mutation_intent_deterministic_failure","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent_blocked","idempotency_key":"mission:0dde2831-ef1b-4181-9180-0ba17d7af831:repository-mutation-intent-blocked:bb60ed1ebda07770efba42a6ce17e3defa7d7e3423814f453818638b196b2083","mission_step_id":"0f2b4ad0-4d70-4ebb-abf2-7fe7a21cf2ad","command_center_event_id":"0dde2831-ef1b-4181-9180-0ba17d7af831"},{"id":"a1a11132-da5a-44c1-b4ab-69945a3c1034","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-3cc342e3e98e","reason":"retryable_provider_transport:forgejo_provider_read_timeout","status":"retryable","metrics":{"receiptBytes":22319,"releaseCount":0,"toolCallCount":5,"repeatedCallCount":0,"executorlessWaitMs":65675,"firstUsefulResultAt":"2026-09-29T02:27:18.488Z","recoveryAttemptCount":1,"ownerInterruptionCount":0},"version":null,"prNumber":4084,"terminal":false,"missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e","operation":"automatic_mission_resume","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"prReadinessMs":5541,"approvedPlanMs":0,"shipAndProveMs":0,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":819,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:28:24.183181+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4084","receipt_type":"automatic_mission_resume","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:automatic-mission-resume:4084:repair_mission_pr_ready_retryable","mission_step_id":"a8cac928-5390-46a6-8283-85760d4f185d","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"886c9812-174d-40fa-aadc-8715f3f27fbd","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in release.","nextAction":{"lane":"production-release-conductor","action":"reconcile_release","reason":"merged_source_requires_release_proof","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"release\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"source_lineage_merged_pr_authoritative\",\"status\":\"waiting\",\"proofGate\":\"forgejo_merged_pr_is_authoritative_source_lineage\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_release\",\"lane\":\"production-release-conductor\",\"reason\":\"merged_source_requires_release_proof\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_release\",\"recoveryOwner\":\"production-release-conductor\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"runtime\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"release\",\"deadlineAt\":\"2026-09-29T05:27:16.882923+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-3cc342e3e98e\",\"prNumber\":4084,\"sourceSha\":\"c267479c921da9f1dea8b4b217448a4367523515\",\"deploymentId\":\"forgejo-main-c267479c921d\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:29:15.275026+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:owner-progress-heartbeat:119376596","mission_step_id":"a8cac928-5390-46a6-8283-85760d4f185d","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"e7ba54b2-7e48-4338-815e-a7a9171c955c","source":"cc-execution","status":"cancelled","payload":{"cancelled":true,"missionId":"f1edc99e-a626-492f-8d5e-7f1bd6471b7a"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:55.44756+00:00","proof_gate":"durable_mission_cancelled","source_sha":null,"external_id":null,"receipt_type":"owner_mission_cancelled","idempotency_key":"mission:f1edc99e-a626-492f-8d5e-7f1bd6471b7a:mission-cancel:f1edc99e-a626-492f-8d5e-7f1bd6471b7a","mission_step_id":"e5065e20-c8a0-46bf-ba2d-09bfbe4e6a69","command_center_event_id":"f1edc99e-a626-492f-8d5e-7f1bd6471b7a"},{"id":"f131a388-708c-4bb8-adbe-408d7dad7dd2","source":"cc-execution","status":"complete","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":null,"status":"complete","metrics":{"receiptBytes":10730,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:36:08.119Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4073,"terminal":false,"missionId":"5250b603-7869-43e8-b3cb-1f078dbc8700","operation":"execute_mission","proofGate":"repair_mission_prepared","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":4493,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":277,"providerAuthMs":0,"ledgerPrepareMs":277,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":277,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":277,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"continue_batch_or_ship_and_prove","receiptRef":{"mode":"full","missionId":"5250b603-7869-43e8-b3cb-1f078dbc8700"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3685,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:36:13.47678+00:00","proof_gate":"repair_mission_prepared","source_sha":null,"external_id":"4073","receipt_type":"execute_mission","idempotency_key":"mission:5250b603-7869-43e8-b3cb-1f078dbc8700:execute_mission:repair_mission_prepared:current-generation","mission_step_id":"947178ab-d8e8-4309-a590-b2919db8dd95","command_center_event_id":"5250b603-7869-43e8-b3cb-1f078dbc8700"},{"id":"573e3cb7-841e-46da-a031-fd3053fd7525","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-3cc342e3e98e","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1145,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":393,"providerAuthMs":0,"ledgerPrepareMs":393,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":393,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":393,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":4159,"likelyAffectedFiles":["workers/cc-execution/src/model-provider-gateway.js","workers/cc-execution/test/model-provider-gateway.test.js","workers/cc-execution/src/version.js","config/mission-freedom-provider-cutover.json"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:27:18.522903+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"6780e6b9-9777-453f-8ae9-4c1a552687d9","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"cbea5b0f-c8ef-4309-b877-339c1c4fd7fa","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-83515a4a94d3","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1180,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":378,"providerAuthMs":0,"ledgerPrepareMs":378,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":378,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":378,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":5275,"likelyAffectedFiles":["src/pages/card-grading/PCGWorkspace.tsx"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:27:44.750257+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"d6bac8e3-510d-4530-983f-9c8540118766","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"31749c9b-ac80-4973-84c7-726e68b45905","source":"cc-execution","status":"blocked","payload":{"ok":false,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":"control_plane_maintenance_base_sha_mismatch","status":"blocked","metrics":{"receiptBytes":30288,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:27:54.263Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":null,"terminal":false,"missionId":"0dde2831-ef1b-4181-9180-0ba17d7af831","operation":"execute_mission","proofGate":"repair_mission_execution_blocked","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":96,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":96,"missionSetupMs":259,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":259,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":259,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":259,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"0dde2831-ef1b-4181-9180-0ba17d7af831"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1479,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:27:55.161511+00:00","proof_gate":"repair_mission_execution_blocked","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:0dde2831-ef1b-4181-9180-0ba17d7af831:execute_mission:repair_mission_execution_blocked:current-generation","mission_step_id":"0f2b4ad0-4d70-4ebb-abf2-7fe7a21cf2ad","command_center_event_id":"0dde2831-ef1b-4181-9180-0ba17d7af831"},{"id":"686f1bbb-93cd-4383-ab2e-b595a104998e","source":"cc-execution","status":"authorized","payload":{"paths":["workers/cc-execution/src/model-provider-gateway.js","workers/cc-execution/src/version.js","workers/cc-execution/test/model-provider-gateway.test.js"],"reason":"Owner-authorized completion of Mission Freedom standalone research configuration.","baseSha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","issuedAt":1790648888517,"expiresAt":1790649068517,"missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e","authorizationId":"84e98570-efdf-4d1a-ad17-7d114eb51e93","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:28:08.841906+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:84e98570-efdf-4d1a-ad17-7d114eb51e93","mission_step_id":"6780e6b9-9777-453f-8ae9-4c1a552687d9","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"0077f6dd-cf96-450b-bb23-e6309bb8eea6","source":"durable-mission-ledger","status":"pending","payload":{"sourceSha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"legacy-drive-copy","satisfied":false,"statement":"Imported legacy PCG card images can be copied directly from approved PCG/Squarespace HTTPS sources into Anthony's private Google Drive with stable dedupe and controlled delivery URLs.","proofConditionIds":["runtime"]},{"id":"migration-linked","satisfied":false,"statement":"Legacy image migration updates only canonical cards created by the selected import batch, preserves legacy source provenance, and is resumable in chunks.","proofConditionIds":["runtime"]},{"id":"owner-ui","satisfied":false,"statement":"Migration Center exposes truthful Google Drive image-migration progress and remains blocked when Google Workspace is not connected.","proofConditionIds":["runtime"]}],"satisfied":false,"constraints":[{"id":"allowlist","satisfied":false,"statement":"Remote image fetches are restricted to pcgslab.com, www.pcgslab.com, images.squarespace-cdn.com, and static1.squarespace.com, including every redirect hop; HTTPS only.","proofConditionIds":["runtime"]},{"id":"image-guard","satisfied":false,"statement":"Reject non-image responses and legacy source files larger than 25 MB.","proofConditionIds":["runtime"]},{"id":"no-knocklaunch-master","satisfied":false,"statement":"Do not persist legacy master image blobs in KNOCKLAUNCH or Supabase Storage.","proofConditionIds":["runtime"]},{"id":"pcg-only","satisfied":false,"statement":"No other tenant behavior changes.","proofConditionIds":["runtime"]},{"id":"no-witness","satisfied":false,"statement":"Do not run Visual Witness.","proofConditionIds":["runtime"]},{"id":"capability-completeness","satisfied":false,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["runtime"]},{"id":"atomic-capability-lifecycle","satisfied":false,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["runtime"]}],"contractHash":"eb9ce1be253947b427f7fc9e99b4f38f686d75f021cb6bd5d83be61273a5bbe1","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"runtime","kind":"runtime","evidence":{"reason":"missing_required_release_targets:migrations","satisfied":false,"releaseState":"verified","missingTargets":["migrations"],"disallowedTargets":[],"migrationRequired":true,"releaseTargetStates":{"frontend":"success","supabaseEdge":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend","supabaseEdge"],"allowedReleaseTargets":[],"requiredReleaseTargets":["migrations"],"migrationReleaseVerified":false,"releaseRequestContractHash":"eb9ce1be253947b427f7fc9e99b4f38f686d75f021cb6bd5d83be61273a5bbe1"},"required":true,"satisfied":false}],"validationErrors":[],"pendingProofKinds":["runtime"],"activeReleaseTargets":["frontend","supabaseEdge"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:28:58.220406+00:00","proof_gate":"request_contract_pending","source_sha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:request-contract:eb9ce1be253947b427f7fc9e99b4f38f686d75f021cb6bd5d83be61273a5bbe1:63d0666b5d2f3d03b1ebf770beb96f1fd37508e0:pending:runtime","mission_step_id":"592fd8b1-5de3-46ed-b7ea-2133bd338522","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"e1db2d8e-1458-4daf-96b3-e819625474f5","source":"durable-mission-ledger","status":"verified","payload":{"sourceSha":"c267479c921da9f1dea8b4b217448a4367523515","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"research-ready","satisfied":true,"statement":"PAUL external research uses a no-new-secret public web index plus the existing Workers AI binding and reports webResearchReady=true in production.","proofConditionIds":["runtime"]},{"id":"grounded-degrade","satisfied":true,"statement":"If Workers AI synthesis is busy/unavailable, research still returns grounded indexed titles/snippets/source URLs rather than failing the conversation.","proofConditionIds":["runtime"]},{"id":"no-new-paid-provider","satisfied":true,"statement":"No new paid provider account or secret is required for core chat or web research; optional OpenAI API fallback remains optional and unconfigured unless the owner later supplies an API key.","proofConditionIds":["runtime"]}],"satisfied":true,"constraints":[{"id":"grounding","satisfied":true,"statement":"Research summaries must be grounded only in fetched indexed evidence and return source URLs. Unknowns remain unknown.","proofConditionIds":["runtime"]},{"id":"safety","satisfied":true,"statement":"Preserve provider-neutral chat, deterministic write authorization, Gate, protected main, tenant isolation, and current Workers AI primary.","proofConditionIds":["runtime"]},{"id":"capability-completeness","satisfied":true,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["runtime"]},{"id":"atomic-capability-lifecycle","satisfied":true,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["runtime"]}],"contractHash":"a842068df858f95149f29960010a148b49c7cdcfde01dbaa1aae3c4094f5149c","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"runtime","kind":"runtime","evidence":{"reason":null,"satisfied":true,"releaseState":"verified","missingTargets":[],"disallowedTargets":[],"migrationRequired":false,"releaseTargetStates":{"ccExecution":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["ccExecution"],"allowedReleaseTargets":["ccExecution"],"requiredReleaseTargets":["ccExecution"],"migrationReleaseVerified":null,"releaseRequestContractHash":"a842068df858f95149f29960010a148b49c7cdcfde01dbaa1aae3c4094f5149c"},"required":true,"satisfied":true}],"validationErrors":[],"pendingProofKinds":[],"activeReleaseTargets":["ccExecution"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:29:41.914846+00:00","proof_gate":"request_contract_terminal_verified","source_sha":"c267479c921da9f1dea8b4b217448a4367523515","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:request-contract:a842068df858f95149f29960010a148b49c7cdcfde01dbaa1aae3c4094f5149c:c267479c921da9f1dea8b4b217448a4367523515:verified:","mission_step_id":"c53c02b6-638d-4a30-a95c-5757096d0503","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"8b2ace60-d333-4687-ba79-2bb4b69754f8","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[{"path":"src/pages/card-grading/PCGWorkspace.tsx","content":"import React,{useEffect,useRef,useState} from 'react';\nimport {Archive,ArrowUpRight,CheckCircle2,Database,FileSpreadsheet,ImagePlus,Layers3,Loader2,PackageCheck,PauseCircle,Radar,RefreshCw,ScanLine,ShieldCheck,UploadCloud,XCircle} from 'lucide-react';\nimport {supabase} from '@/integrations/supabase/client';\nimport {useMultiTenant} from '@/contexts/MultiTenantContext';\nimport {useToast} from '@/hooks/use-toast';\nimport {CRMShell} from '@/components/crm/CRMShell';\nimport {cn} from '@/lib/utils';\nimport PCGGrowthLab,{PCGGrowthPulse} from '@/pages/card-grading/PCGGrowthLab';\nconst DRIVE_MEDIA_FN=`${import.meta.env.VITE_SUPABASE_URL}/functions/v1/pcg-google-drive-media`;const CONCURRENCY=4;type DriveMedia={url:string;fileId:string};\ntype CsvRow=Record<string,string>;type BatchItem={key:string;front?:File;back?:File;row?:CsvRow;status:'queued'|'uploading'|'done'|'failed';error?:string};type CardForm={title:string;player:string;year:string;set:string;number:string;category:string;grader:string;grade:string;cert:string;condition:string;qty:string;cost:string;value:string;tags:string;notes:string};type StoredCard={id:string;player_character?:string|null;brand_set?:string|null;year?:string|null;card_number?:string|null;front_image_url?:string|null;grade?:number|null;cert_number?:string|null;metadata?:Record<string,unknown>|null};type SubmissionOption={id:string;submission_number:string;customer_name:string|null;status:string};type DriveState='checking'|'ready'|'missing'|'reconnect';type ExistingBatchCard={id:string;sequence_number:number;import_key:string|null;front_image_url:string|null;back_image_url:string|null};type VaultMode='overview'|'single'|'batch'|'growth';\nconst EMPTY_FORM:CardForm={title:'',player:'',year:'',set:'',number:'',category:'',grader:'',grade:'',cert:'',condition:'',qty:'1',cost:'',value:'',tags:'',notes:''};\nconst fileStem=(name:string)=>name.replace(/\\.[^.]+$/,'').replace(/[-_ ](?:front|back|obverse|reverse)$/i,'');const isBack=(name:string)=>/[-_ ](?:back|reverse)\\.[^.]+$/i.test(name);const rowValue=(row:CsvRow|undefined,...keys:string[])=>keys.map(key=>row?.[key]).find(Boolean)||'';const money=(value:string)=>{const parsed=Number((value||'').replace(/[$,]/g,''));return Number.isFinite(parsed)?parsed:null};\nconst normalizeHeader=(value:string)=>String(value||'').trim().toLowerCase().replace(/[^a-z0-9]+/g,'_').replace(/^_+|_+$/g,'');\nfunction parseDelimited(text:string){const sample=String(text||'').split(/\\r?\\n/,1)[0]||'';const delimiter=(sample.match(/\\t/g)||[]).length>(sample.match(/,/g)||[]).length?'\\t':',';const matrix:string[][]=[];let row:string[]=[];let value='';let quoted=false;for(let index=0;index<text.length;index+=1){const char=text[index];if(quoted){if(char==='\"'&&text[index+1]==='\"'){value+='\"';index+=1}else if(char==='\"'){quoted=false}else{value+=char}continue}if(char==='\"'){quoted=true;continue}if(char===delimiter){row.push(value);value='';continue}if(char==='\\n'){row.push(value);if(row.some(cell=>cell.trim()))matrix.push(row);row=[];value='';continue}if(char!=='\\r')value+=char}row.push(value);if(row.some(cell=>cell.trim()))matrix.push(row);const headerRow=matrix.shift()||[];const seen=new Map<string,number>();const headers=headerRow.map((cell,index)=>{const base=normalizeHeader(cell)||'column_'+(index+1);const count=(seen.get(base)||0)+1;seen.set(base,count);return count===1?base:base+'_'+count});const rows=matrix.map(cells=>Object.fromEntries(headers.map((header,index)=>[header,String(cells[index]??'').trim()]))) as CsvRow[];return{headers,rows,delimiter}}\nfunction parseCsv(text:string){return parseDelimited(text).rows}\nfunction pairFiles(files:File[],rows:CsvRow[]){const map=new Map<string,BatchItem>();for(const file of files.filter(item=>item.type.startsWith('image/'))){const key=fileStem(file.name);const item=map.get(key)||{key,status:'queued' as const};if(isBack(file.name))item.back=file;else if(!item.front)item.front=file;else map.set(`${key}-${map.size+1}`,{key:`${key}-${map.size+1}`,front:file,status:'queued'});map.set(key,item)}for(const item of map.values())item.row=rows.find(row=>fileStem(rowValue(row,'filename','file','front','image')).toLowerCase()===item.key.toLowerCase());return[...map.values()]}\nfunction ModeButton({active,children,onClick}:{active:boolean;children:React.ReactNode;onClick:()=>void}){return <button onClick={onClick} className={cn('rounded-full px-4 py-2 text-xs font-bold transition sm:text-sm',active?'bg-[#d8bb78] text-[#0b0b0c]':'text-white/48 hover:bg-white/[0.05] hover:text-white')}>{children}</button>}\nfunction Stat({label,value,detail,icon:Icon}:{label:string;value:string;detail:string;icon:React.ComponentType<{className?:string}>}){return <div className=\"min-w-0 py-3 sm:border-l sm:border-white/[0.08] sm:px-5 first:sm:border-l-0 first:sm:pl-0\"><div className=\"flex items-center gap-2 text-[10px] font-bold uppercase tracking-[.16em] text-white/32\"><Icon className=\"h-3.5 w-3.5 text-[#d8bb78]\"/>{label}</div><div className=\"mt-2 text-2xl font-black tracking-tight text-white\">{value}</div><div className=\"mt-1 truncate text-xs text-white/35\">{detail}</div></div>}\nfunction Field({label,value,onChange,placeholder}:{label:string;value:string;onChange:(value:string)=>void;placeholder?:string}){return <label className=\"block\"><span className=\"text-[10px] font-bold uppercase tracking-[.13em] text-white/34\">{label}</span><input value={value} onChange={event=>onChange(event.target.value)} placeholder={placeholder} className=\"mt-2 h-11 w-full border-b border-white/[0.12] bg-transparent text-sm text-white outline-none transition placeholder:text-white/18 focus:border-[#d8bb78]/65\"/></label>}\nfunction ImageTile({label,file,onFile}:{label:string;file:File|null;onFile:(file:File|null)=>void}){return <label className=\"group flex min-h-36 cursor-pointer flex-col justify-between border border-white/[0.09] bg-black/28 p-4 transition hover:border-[#d8bb78]/30 hover:bg-[#d8bb78]/[0.035]\"><input type=\"file\" accept=\"image/*\" className=\"hidden\" onChange={event=>onFile(event.target.files?.[0]||null)}/><div className=\"flex items-center justify-between\"><span className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/35\">{label}</span>{file?<CheckCircle2 className=\"h-5 w-5 text-emerald-400\"/>:<ImagePlus className=\"h-5 w-5 text-[#d8bb78]\"/>}</div><div><div className=\"truncate text-sm font-bold text-white/82\">{file?.name||`Choose ${label.toLowerCase()} image`}</div><div className=\"mt-1 text-xs text-white/28\">Private PCG card photography.</div></div></label>}\nfunction DemoCardFace({card}:{card:StoredCard}){const subject=String(card.player_character||card.brand_set||'Trading Card').replace(/^DEMO\\s*[—-]\\s*/i,'');const detail=[card.year,card.brand_set,card.card_number&&`#${card.card_number}`].filter(Boolean).join(' · ');return <div className=\"absolute inset-1.5 flex flex-col overflow-hidden rounded-[14px] border border-[#d8bb78]/45 bg-[radial-gradient(circle_at_72%_18%,rgba(216,187,120,.26),transparent_38%),linear-gradient(145deg,rgba(30,27,20,.98),rgba(7,7,8,.98)_58%,rgba(27,23,15,.98))] p-2.5 shadow-[inset_0_0_0_1px_rgba(255,255,255,.06),0_14px_32px_rgba(0,0,0,.26)]\"><div className=\"flex items-center justify-between gap-1\"><div className=\"flex items-center gap-1.5 text-[8px] font-black uppercase tracking-[.14em] text-[#ecd797]\"><ScanLine className=\"h-3 w-3\"/>PCG Demo</div><div className=\"rounded-full border border-white/10 bg-black/35 px-1.5 py-0.5 text-[7px] font-black uppercase tracking-[.08em] text-white/46\">Trading card</div></div><div className=\"my-auto grid place-items-center\"><div className=\"grid h-14 w-14 place-items-center rounded-[16px] border border-[#d8bb78]/25 bg-[#d8bb78]/[0.08] shadow-[0_0_36px_rgba(216,187,120,.10)]\"><Archive className=\"h-6 w-6 text-[#d8bb78]\"/></div></div><div><div className=\"line-clamp-2 text-sm font-black leading-tight text-white\">{subject}</div><div className=\"mt-1.5 line-clamp-2 text-[9px] font-bold uppercase tracking-[.06em] text-white/42\">{detail||card.cert_number||'PCG sample record'}</div></div></div>}\n\nexport function PCGCardVaultContent({initialMode='overview'}:{initialMode?:VaultMode}={}){const{activeTenant}=useMultiTenant();const{toast}=useToast();const tenantId=activeTenant?.id||'';const[mode,setMode]=useState<VaultMode>(initialMode);useEffect(()=>{setMode(initialMode)},[initialMode]);const[form,setForm]=useState<CardForm>(EMPTY_FORM);const[front,setFront]=useState<File|null>(null);const[reverse,setReverse]=useState<File|null>(null);const[saving,setSaving]=useState(false);const[rows,setRows]=useState<CsvRow[]>([]);const[items,setItems]=useState<BatchItem[]>([]);const[session,setSession]=useState('');const[running,setRunning]=useState(false);const[recent,setRecent]=useState<StoredCard[]>([]);const[total,setTotal]=useState(0);const[submissionOptions,setSubmissionOptions]=useState<SubmissionOption[]>([]);const[selectedSubmissionId,setSelectedSubmissionId]=useState('');const[driveState,setDriveState]=useState<DriveState>('checking');const stop=useRef(false);const done=items.filter(item=>item.status==='done').length;const failed=items.filter(item=>item.status==='failed').length;const remaining=items.filter(item=>item.status==='queued'||item.status==='failed');const progress=items.length?Math.round(((done+failed)/items.length)*100):0;const selectedSubmission=submissionOptions.find(item=>item.id===selectedSubmissionId)||null;const driveReady=driveState==='ready';\nasync function load(){if(!tenantId)return;setDriveState('checking');const[cardsResult,submissionResult,googleResult]=await Promise.all([(supabase as any).from('card_grading_cards').select('id,player_character,brand_set,year,card_number,front_image_url,grade,cert_number,metadata',{count:'exact'}).eq('tenant_id',tenantId).order('created_at',{ascending:false}).limit(12),(supabase as any).from('card_grading_submissions').select('id,submission_number,customer_name,status').eq('tenant_id',tenantId).order('created_at',{ascending:false}).limit(50),(supabase as any).from('tenant_provider_credentials').select('credential_status,metadata').eq('tenant_id',tenantId).eq('provider','google_workspace').maybeSingle()]);setRecent(cardsResult.data||[]);setTotal(Number(cardsResult.count||0));const eligible=((submissionResult.data||[]) as SubmissionOption[]).filter(item=>['received','intake_imaging','authentication','grading','encapsulation','qa'].includes(String(item.status||'')));setSubmissionOptions(eligible);setSelectedSubmissionId(current=>eligible.some(item=>item.id===current)?current:(eligible[0]?.id||''));const google=googleResult.data as any;const scopes=Array.isArray(google?.metadata?.granted_scopes)?google.metadata.granted_scopes.map((value:unknown)=>String(value)):[];setDriveState(google?.credential_status==='active'?(scopes.includes('https://www.googleapis.com/auth/drive.file')?'ready':'reconnect'):'missing')}useEffect(()=>{void load()},[tenantId]);\nasync function createSubmission(label:string){const{data,error}=await(supabase as any).from('card_grading_submissions').insert({tenant_id:tenantId,submission_number:`VAULT-${Date.now()}-${crypto.randomUUID().slice(0,6)}`,customer_name:'PCG Card Vault',service_tier:'inventory',service_price:0,status:'received',notes:label,payment_status:'unverified'}).select('id').single();if(error)throw error;return data.id}\nasync function upload(file:File,sessionKey:string,key:string,side:string,importKey:string):Promise<DriveMedia>{const{data}=await supabase.auth.getSession();if(!data.session?.access_token)throw new Error('Please sign in again.');const params=new URLSearchParams({tenant_id:tenantId,session_key:sessionKey,import_key:importKey,key,side,name:file.name,content_type:file.type||'application/octet-stream'});const response=await fetch(DRIVE_MEDIA_FN+'/upload?'+params.toString(),{method:'POST',headers:{Authorization:'Bearer '+data.session.access_token,'Content-Type':file.type||'application/octet-stream'},body:file});const payload=await response.json().catch(()=>null);if(!response.ok||!payload?.ok)throw new Error(payload?.error||'Google Drive upload failed');return{url:String(payload.url||''),fileId:String(payload.file_id||'')}}\nasync function storeCard(submissionId:string,importKey:string,frontMedia:DriveMedia|null,backMedia:DriveMedia|null,row?:CsvRow,values:Partial<CardForm>={},target?:{id?:string;sequenceNumber?:number}){const metadata={title:values.title||rowValue(row,'title','name'),grading_company:values.grader||rowValue(row,'grading_company','grader'),condition:values.condition||rowValue(row,'condition'),quantity:Number(values.qty||rowValue(row,'quantity')||1)||1,acquisition_cost:money(values.cost||rowValue(row,'acquisition_cost','cost')),estimated_value:money(values.value||rowValue(row,'estimated_value','value')),tags:String(values.tags||rowValue(row,'tags')).split(/[;,]/).map(item=>item.trim()).filter(Boolean),notes:values.notes||rowValue(row,'notes'),...(frontMedia?.fileId||backMedia?.fileId?{image_storage:'google_workspace_drive',drive_media:{provider:'google_workspace',front_file_id:frontMedia?.fileId||null,back_file_id:backMedia?.fileId||null}}:{})};const payload={tenant_id:tenantId,submission_id:submissionId,sequence_number:target?.sequenceNumber||1,category:values.category||rowValue(row,'category','sport'),year:values.year||rowValue(row,'year'),brand_set:values.set||rowValue(row,'brand_set','set','brand'),player_character:values.player||rowValue(row,'player','subject'),card_number:values.number||rowValue(row,'card_number','card_no'),declared_value:money(values.value||rowValue(row,'estimated_value','value')),grade:money(values.grade||rowValue(row,'grade')),grade_label:values.condition||rowValue(row,'condition'),cert_number:values.cert||rowValue(row,'cert_number','cert','serial'),front_image_url:frontMedia?.url||null,back_image_url:backMedia?.url||null,grader_notes:values.notes||rowValue(row,'notes')||null,status:'received',import_key:importKey,metadata};if(target?.id){const{error}=await(supabase as any).from('card_grading_cards').update(payload).eq('tenant_id',tenantId).eq('id',target.id);if(error)throw error;return}const{error}=await(supabase as any).from('card_grading_cards').upsert(payload,{onConflict:'tenant_id,import_key',ignoreDuplicates:true});if(error)throw error}\nasync function saveSingle(){if(!front&&!reverse)return toast({title:'Add at least one card image'});if(!driveReady)return toast({title:'Google Workspace Drive required',description:driveState==='reconnect'?'Reconnect Google Workspace so PCG has Drive file access.':'Connect Google Workspace before storing new PCG card images.',variant:'destructive'});setSaving(true);try{const sessionKey='single-'+crypto.randomUUID();const submissionId=await createSubmission('Single Card Vault upload');const frontMedia=front?await upload(front,sessionKey,'card','front',sessionKey):null;const backMedia=reverse?await upload(reverse,sessionKey,'card','back',sessionKey):null;await storeCard(submissionId,sessionKey,frontMedia,backMedia,undefined,form);setForm(EMPTY_FORM);setFront(null);setReverse(null);toast({title:'Card stored in PCG',description:'Master imagery is stored in the connected PCG Google Drive.'});await load()}catch(error){toast({title:'Could not save card',description:error instanceof Error?error.message:String(error),variant:'destructive'})}finally{setSaving(false)}}\nasync function runBatch(batch:BatchItem[]){if(!session||!batch.length)return;if(!selectedSubmissionId)return toast({title:'Select a grading order first',description:'Mass Intake attaches images to an existing collector order.',variant:'destructive'});if(!driveReady)return toast({title:'Google Workspace Drive required',description:driveState==='reconnect'?'Reconnect Google Workspace so PCG has Drive file access.':'Connect Google Workspace before starting image intake.',variant:'destructive'});const selected=submissionOptions.find(item=>item.id===selectedSubmissionId);if(!selected)return toast({title:'That grading order is no longer available',description:'Choose another open PCG order.',variant:'destructive'});setRunning(true);stop.current=false;let failedCount=0;try{const existingResult=await(supabase as any).from('card_grading_cards').select('id,sequence_number,import_key,front_image_url,back_image_url').eq('tenant_id',tenantId).eq('submission_id',selectedSubmissionId).order('sequence_number',{ascending:true});if(existingResult.error)throw existingResult.error;const existingCards=(existingResult.data||[]) as ExistingBatchCard[];const byImport=new Map(existingCards.filter(card=>card.import_key).map(card=>[String(card.import_key),card]));const blankSlots=existingCards.filter(card=>!card.import_key&&!card.front_image_url&&!card.back_image_url).sort((a,b)=>a.sequence_number-b.sequence_number);let nextSequence=Math.max(0,...existingCards.map(card=>Number(card.sequence_number)||0))+1;const plans=batch.map(item=>{const importKey=('pcg:'+selectedSubmissionId+':'+item.key).toLowerCase().replace(/[^a-z0-9:._-]+/g,'-');const existing=byImport.get(importKey);if(existing)return{item,importKey,existing:true,targetId:existing.id,sequenceNumber:existing.sequence_number};const slot=blankSlots.shift();return{item,importKey,existing:false,targetId:slot?.id,sequenceNumber:slot?.sequence_number||nextSequence++}});let cursor=0;const worker=async()=>{while(!stop.current){const index=cursor++;if(index>=plans.length)return;const plan=plans[index];const item=plan.item;try{setItems(current=>current.map(row=>row.key===item.key?{...row,status:'uploading',error:undefined}:row));if(!plan.existing){const frontMedia=item.front?await upload(item.front,session,item.key,'front',plan.importKey):null;const backMedia=item.back?await upload(item.back,session,item.key,'back',plan.importKey):null;await storeCard(selectedSubmissionId,plan.importKey,frontMedia,backMedia,item.row,undefined,{id:plan.targetId,sequenceNumber:plan.sequenceNumber})}setItems(current=>current.map(row=>row.key===item.key?{...row,status:'done'}:row))}catch(error){failedCount+=1;setItems(current=>current.map(row=>row.key===item.key?{...row,status:'failed',error:error instanceof Error?error.message:String(error)}:row))}}};await Promise.all(Array.from({length:Math.min(CONCURRENCY,plans.length)},worker));if(!stop.current&&failedCount===0&&selected.status==='received'){const advanced=await(supabase as any).rpc('advance_pcg_grading_submission',{p_tenant_id:tenantId,p_submission_id:selectedSubmissionId,p_status:'intake_imaging'});if(advanced.error)throw advanced.error}toast({title:stop.current?'Batch paused':failedCount?'Batch needs attention':'Order intake complete',description:failedCount?failedCount+' card'+(failedCount===1?'':'s')+' can be retried safely.':selected.submission_number+' now owns these canonical card records and Drive images.'});await load()}catch(error){toast({title:'Mass intake could not finish',description:error instanceof Error?error.message:String(error),variant:'destructive'})}finally{setRunning(false)}}const update=(key:keyof CardForm,value:string)=>setForm(current=>({...current,[key]:value}));\nreturn <div className=\"pcg-card-vault w-full text-white\"><style>{`.pcg-card-vault .text-white\\\\/18,.pcg-card-vault .text-white\\\\/24,.pcg-card-vault .text-white\\\\/28,.pcg-card-vault .text-white\\\\/30,.pcg-card-vault .text-white\\\\/32,.pcg-card-vault .text-white\\\\/34,.pcg-card-vault .text-white\\\\/35,.pcg-card-vault .text-white\\\\/36,.pcg-card-vault .text-white\\\\/38,.pcg-card-vault .text-white\\\\/42,.pcg-card-vault .text-white\\\\/44,.pcg-card-vault .text-white\\\\/48{color:rgba(255,255,255,.72)!important}`}</style><section className=\"border-b border-white/[0.08] pb-6\"><div className=\"flex flex-col gap-5 xl:flex-row xl:items-end xl:justify-between\"><div><div className=\"flex items-center gap-2 text-[10px] font-black uppercase tracking-[.19em] text-[#d8bb78]\"><ScanLine className=\"h-4 w-4\"/>PCG Card Vault</div><h1 className=\"mt-3 text-[34px] font-black leading-none tracking-[-0.045em] sm:text-[46px]\">Card Vault</h1><p className=\"mt-3 max-w-2xl text-sm leading-6 text-white/44\">Capture one card or move an entire collection into PCG. Master imagery stays in the connected PCG Google Drive.</p></div><div className=\"flex max-w-full flex-wrap items-center rounded-2xl border border-white/[0.08] bg-black/28 p-1\"><ModeButton active={mode==='overview'} onClick={()=>setMode('overview')}>Overview</ModeButton><ModeButton active={mode==='single'} onClick={()=>setMode('single')}>Single intake</ModeButton><ModeButton active={mode==='batch'} onClick={()=>setMode('batch')}>Mass intake</ModeButton><ModeButton active={mode==='growth'} onClick={()=>setMode('growth')}>Growth Lab</ModeButton></div></div><div className=\"mt-7 grid sm:grid-cols-4\"><Stat icon={Archive} label=\"Cards on file\" value={total.toLocaleString()} detail=\"Canonical PCG records\"/><Stat icon={Layers3} label=\"Current batch\" value={items.length.toLocaleString()} detail={items.length?`${done} stored so far`:'No intake running'}/><Stat icon={PackageCheck} label=\"Exceptions\" value={failed.toLocaleString()} detail={failed?'Ready to retry safely':'No failed uploads'}/><Stat icon={ShieldCheck} label=\"Storage\" value=\"Google Drive\" detail=\"PCG-owned master imagery\"/></div></section>{mode==='overview'?<PCGGrowthPulse tenantId={tenantId} onOpen={()=>setMode('growth')}/>:null}\n{mode==='overview'?<div className=\"mt-7 grid gap-7 xl:grid-cols-[minmax(0,1.15fr)_minmax(350px,.85fr)]\"><section><div className=\"mb-3 text-[10px] font-black uppercase tracking-[.17em] text-white/30\">Start an intake</div><div className=\"grid gap-px overflow-hidden border border-white/[0.08] bg-white/[0.08] sm:grid-cols-2\"><button onClick={()=>setMode('single')} className=\"group min-h-[210px] bg-[#09090a]/94 p-5 text-left transition hover:bg-[#0d0d0f]\"><div className=\"flex items-start justify-between\"><ImagePlus className=\"h-6 w-6 text-[#d8bb78]\"/><ArrowUpRight className=\"h-5 w-5 text-white/18 transition group-hover:text-[#d8bb78]\"/></div><div className=\"mt-14\"><h2 className=\"text-xl font-black tracking-tight\">Single card intake</h2><p className=\"mt-2 text-sm leading-6 text-white/38\">Front/back imagery, identity, grade, cert, value, cost, tags and notes.</p></div></button><button onClick={()=>setMode('batch')} className=\"group min-h-[210px] bg-[#09090a]/94 p-5 text-left transition hover:bg-[#0d0d0f]\"><div className=\"flex items-start justify-between\"><UploadCloud className=\"h-6 w-6 text-[#d8bb78]\"/><ArrowUpRight className=\"h-5 w-5 text-white/18 transition group-hover:text-[#d8bb78]\"/></div><div className=\"mt-14\"><h2 className=\"text-xl font-black tracking-tight\">Mass card intake</h2><p className=\"mt-2 text-sm leading-6 text-white/38\">Hundreds or thousands, front/back pairing, optional CSV, pause and safe retry.</p></div></button></div></section><section className=\"border-l border-white/[0.08] xl:pl-7\"><div className=\"flex items-center justify-between\"><div><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Storage contract</div><h2 className=\"mt-2 text-lg font-black\">Built for volume</h2></div><Database className=\"h-5 w-5 text-[#d8bb78]\"/></div><div className=\"mt-5 divide-y divide-white/[0.07]\">{[['Google Drive masters','New originals live in the connected PCG Google Workspace, not KnockLaunch storage.'],['Safe retry','Completed imports keep a stable identity.'],['Canonical records','Single and batch intake write to the same card records.']].map(([title,copy])=><div key={title} className=\"py-4 first:pt-0\"><div className=\"flex items-center gap-2 text-sm font-bold text-white/80\"><CheckCircle2 className=\"h-4 w-4 text-emerald-400\"/>{title}</div><p className=\"mt-1.5 pl-6 text-xs leading-5 text-white/32\">{copy}</p></div>)}</div></section></div>:null}\n{mode==='growth'?<div className=\"mt-7\"><PCGGrowthLab tenantId={tenantId}/></div>:null}\n{mode==='single'?<section className=\"mt-7 grid gap-7 xl:grid-cols-[minmax(0,1.35fr)_minmax(320px,.65fr)]\"><div><div className=\"border-b border-white/[0.08] pb-4\"><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Card record</div><h2 className=\"mt-2 text-xl font-black\">Identification & grading</h2></div><div className=\"mt-6 grid gap-x-7 gap-y-5 sm:grid-cols-2\"><Field label=\"Title\" value={form.title} onChange={value=>update('title',value)}/><Field label=\"Player / subject\" value={form.player} onChange={value=>update('player',value)}/><Field label=\"Year\" value={form.year} onChange={value=>update('year',value)}/><Field label=\"Set / brand\" value={form.set} onChange={value=>update('set',value)}/><Field label=\"Card number\" value={form.number} onChange={value=>update('number',value)}/><Field label=\"Sport / category\" value={form.category} onChange={value=>update('category',value)}/><Field label=\"Grading company\" value={form.grader} onChange={value=>update('grader',value)}/><Field label=\"Grade\" value={form.grade} onChange={value=>update('grade',value)}/><Field label=\"Certification / serial\" value={form.cert} onChange={value=>update('cert',value)}/><Field label=\"Condition\" value={form.condition} onChange={value=>update('condition',value)}/><Field label=\"Quantity\" value={form.qty} onChange={value=>update('qty',value)}/><Field label=\"Acquisition cost\" value={form.cost} onChange={value=>update('cost',value)} placeholder=\"$0.00\"/><Field label=\"Estimated value\" value={form.value} onChange={value=>update('value',value)} placeholder=\"$0.00\"/><Field label=\"Tags\" value={form.tags} onChange={value=>update('tags',value)} placeholder=\"rookie, refractor, auto\"/></div><label className=\"mt-6 block\"><span className=\"text-[10px] font-bold uppercase tracking-[.13em] text-white/34\">Internal notes</span><textarea value={form.notes} onChange={event=>update('notes',event.target.value)} rows={4} className=\"mt-2 w-full border border-white/[0.09] bg-black/24 p-4 text-sm leading-6 text-white outline-none focus:border-[#d8bb78]/40\"/></label></div><div className=\"self-start border-l border-white/[0.08] xl:pl-7\"><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Card imagery</div><div className=\"mt-4 grid gap-px overflow-hidden border border-white/[0.08] bg-white/[0.08]\"><ImageTile label=\"Front\" file={front} onFile={setFront}/><ImageTile label=\"Back\" file={reverse} onFile={setReverse}/></div><button onClick={()=>void saveSingle()} disabled={saving} className=\"mt-4 flex h-12 w-full items-center justify-center gap-2 bg-[#d8bb78] text-sm font-black text-[#09090a] transition hover:bg-[#e3c886] disabled:opacity-50\">{saving?<Loader2 className=\"h-4 w-4 animate-spin\"/>:<Archive className=\"h-4 w-4\"/>}{saving?'Storing card…':'Store in PCG'}</button></div></section>:null}\n{mode==='batch'?<section className=\"mt-7 space-y-5\"><div className=\"border border-white/[0.08] bg-[#09090a]/90 p-5\"><div className=\"flex flex-col gap-4 lg:flex-row lg:items-end\"><label className=\"min-w-0 flex-1\"><span className=\"text-[10px] font-black uppercase tracking-[.16em] text-[#d8bb78]\">1 · Choose the collector order</span><select value={selectedSubmissionId} onChange={event=>{setSelectedSubmissionId(event.target.value);setSession('');setRows([]);setItems([])}} disabled={running} className=\"mt-2 h-12 w-full border border-white/[0.10] bg-black/45 px-3 text-sm font-bold text-white outline-none focus:border-[#d8bb78]/55\"><option value=\"\">Select an open PCG order</option>{submissionOptions.map(option=><option key={option.id} value={option.id}>{option.submission_number} · {option.customer_name||'Collector'} · {option.status.replaceAll('_',' ')}</option>)}</select></label><div className=\"flex flex-wrap items-center gap-2 lg:justify-end\"><span className={cn('inline-flex h-10 items-center gap-2 border px-3 text-xs font-black',driveReady?'border-emerald-400/25 bg-emerald-400/[.07] text-emerald-200':'border-amber-400/25 bg-amber-400/[.07] text-amber-100')}><ShieldCheck className=\"h-4 w-4\"/>{driveState==='checking'?'Checking Drive…':driveReady?'Google Drive ready':driveState==='reconnect'?'Reconnect Google Workspace':'Google Workspace required'}</span><a href=\"?mode=received&tool=submissions\" className=\"inline-flex h-10 items-center border border-white/[0.10] px-3 text-xs font-black text-white/65\">Orders</a>{!driveReady&&driveState!=='checking'?<a href=\"?mode=received&tool=settings\" className=\"inline-flex h-10 items-center border border-[#d8bb78]/25 px-3 text-xs font-black text-[#ead49d]\">Open settings</a>:null}</div></div><p className=\"mt-3 text-xs leading-5 text-white/42\">{selectedSubmission?'Images and CSV details will become the canonical cards for '+selectedSubmission.submission_number+' · '+(selectedSubmission.customer_name||'Collector')+'. No second submission is created.':'Create or choose the customer’s grading order before loading card images.'}</p></div>{!submissionOptions.length?<div className=\"border border-dashed border-amber-300/20 bg-amber-300/[.04] p-5 text-sm text-amber-100/80\">No open PCG grading orders are available. Create the collector order from <a href=\"?mode=received&tool=submissions\" className=\"font-black text-[#ead49d] underline underline-offset-4\">Orders</a>, then return to Mass Intake.</div>:null}{driveState==='missing'||driveState==='reconnect'?<div className=\"border border-dashed border-amber-300/20 bg-amber-300/[.04] p-5\"><div className=\"text-sm font-black text-amber-100\">{driveState==='reconnect'?'Google Workspace needs Drive permission':'Connect PCG Google Workspace before image intake'}</div><p className=\"mt-1 text-xs leading-5 text-white/45\">New PCG master images are stored in Anthony’s Google Drive. Intake stays locked until that private Drive connection is ready.</p></div>:null}<div className=\"grid gap-px overflow-hidden border border-white/[0.08] bg-white/[0.08] lg:grid-cols-2\"><label className={cn('group flex min-h-[180px] flex-col justify-between bg-[#09090a]/94 p-5',selectedSubmissionId&&driveReady&&!running?'cursor-pointer':'cursor-not-allowed opacity-45')}><input type=\"file\" multiple accept=\"image/*\" disabled={!selectedSubmissionId||!driveReady||running} className=\"hidden\" onChange={event=>{if(!event.target.files)return;setSession('batch-'+crypto.randomUUID());setRows([]);setItems(pairFiles(Array.from(event.target.files),[]))}}/><UploadCloud className=\"h-6 w-6 text-[#d8bb78]\"/><div><h2 className=\"text-xl font-black\">2 · Choose the card image batch</h2><p className=\"mt-2 text-sm leading-6 text-white/36\">Front/back filenames pair automatically. The selected order owns every imported card.</p></div></label><label className={cn('group flex min-h-[180px] flex-col justify-between bg-[#09090a]/94 p-5',items.length&&!running?'cursor-pointer':'cursor-not-allowed opacity-45')}><input type=\"file\" accept=\".csv,text/csv\" disabled={!items.length||running} className=\"hidden\" onChange={event=>event.target.files?.[0]?.text().then(text=>{const parsed=parseCsv(text);setRows(parsed);setItems(current=>current.map(item=>({...item,row:parsed.find(row=>fileStem(rowValue(row,'filename','file','front','image')).toLowerCase()===item.key.toLowerCase())})))})}/><FileSpreadsheet className=\"h-6 w-6 text-[#d8bb78]\"/><div><h2 className=\"text-xl font-black\">3 · Attach CSV details <span className=\"text-white/30\">(optional)</span></h2><p className=\"mt-2 text-sm leading-6 text-white/36\">Map filenames, player, set, year and card number into those same canonical order records.</p></div></label></div><div className=\"border border-white/[0.08] bg-[#09090a]/82\"><div className=\"flex flex-col gap-4 border-b border-white/[0.07] p-5 sm:flex-row sm:items-center\"><div className=\"mr-auto\"><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Mass intake queue</div><div className=\"mt-1 text-lg font-black\">{items.length.toLocaleString()} cards <span className=\"font-medium text-white/30\">· {done} stored · {failed} failed</span></div>{selectedSubmission?<div className=\"mt-1 text-xs font-bold text-[#d8bb78]/80\">{selectedSubmission.submission_number} · {selectedSubmission.customer_name||'Collector'}</div>:null}</div>{running?<button onClick={()=>{stop.current=true}} className=\"inline-flex h-10 items-center gap-2 border border-white/[0.10] px-4 text-xs font-bold\"><PauseCircle className=\"h-4 w-4\"/>Pause intake</button>:<button disabled={!remaining.length||!selectedSubmissionId||!driveReady} onClick={()=>void runBatch(remaining)} className=\"inline-flex h-10 items-center gap-2 bg-[#d8bb78] px-4 text-xs font-black text-black disabled:opacity-35\"><UploadCloud className=\"h-4 w-4\"/>{!driveReady?'Google Drive required':!selectedSubmissionId?'Select an order':failed?'Retry remaining':'Start mass intake'}</button>}</div><div className=\"h-1 bg-white/[0.05]\"><div className=\"h-full bg-[#d8bb78]\" style={{width:`${progress}%`}}/></div><div className=\"max-h-[360px] overflow-auto p-2\">{!items.length?<div className=\"grid min-h-44 place-items-center text-center\"><div><Layers3 className=\"mx-auto h-7 w-7 text-white/16\"/><div className=\"mt-3 text-sm font-bold text-white/48\">No card batch loaded</div><div className=\"mt-1 text-xs text-white/28\">Choose an order, then load its card images.</div></div></div>:items.slice(0,2000).map((item,index)=><div key={`${item.key}-${index}`} className=\"grid grid-cols-[1fr_auto] items-center gap-3 px-3 py-2.5 text-sm\"><div className=\"min-w-0\"><div className=\"truncate font-semibold text-white/72\">{item.key}</div><div className=\"truncate text-[10px] text-white/24\">{item.front?.name}{item.back?' + back':''}</div></div>{item.status==='done'?<CheckCircle2 className=\"h-4 w-4 text-emerald-400\"/>:item.status==='failed'?<XCircle className=\"h-4 w-4 text-rose-400\"/>:item.status==='uploading'?<Loader2 className=\"h-4 w-4 animate-spin text-[#d8bb78]\"/>:<span className=\"text-[10px] text-white/24\">Queued</span>}</div>)}</div></div></section>:null}\n<section className=\"mt-8 border-t border-white/[0.08] pt-6\"><div className=\"flex items-end justify-between\"><div><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Card Vault</div><h2 className=\"mt-1 text-lg font-black\">Recently stored</h2></div><button onClick={()=>void load()} className=\"grid h-9 w-9 place-items-center border border-white/[0.08] text-white/36\"><RefreshCw className=\"h-4 w-4\"/></button></div>{recent.length?<div className=\"mt-4 grid grid-cols-2 gap-px overflow-hidden border border-white/[0.07] bg-white/[0.07] sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-8 2xl:grid-cols-9\">{recent.map(card=><article key={card.id} className=\"bg-black/48\"><div className=\"relative aspect-[3/4] overflow-hidden bg-[#080809]\">{card.metadata?.demo?<DemoCardFace card={card}/>:card.front_image_url?<img src={card.front_image_url} alt=\"\" className=\"h-full w-full object-contain p-2\"/>:<div className=\"grid h-full place-items-center\"><Archive className=\"h-7 w-7 text-white/12\"/></div>}{card.grade?<div className=\"absolute right-2 top-2 z-10 bg-black/78 px-2 py-1 text-[10px] font-black text-[#e5cd93]\">{card.grade}</div>:null}</div><div className=\"p-2.5\"><div className=\"truncate text-xs font-bold\">{card.player_character||card.brand_set||'Card'}</div><div className=\"mt-1 truncate text-[10px] text-white/30\">{[card.year,card.brand_set,card.card_number&&`#${card.card_number}`].filter(Boolean).join(' · ')||card.cert_number||'PCG record'}</div></div></article>)}</div>:<div className=\"mt-4 grid min-h-36 place-items-center border border-dashed border-white/[0.08] bg-black/20 text-center\"><div><Archive className=\"mx-auto h-7 w-7 text-white/12\"/><div className=\"mt-2 text-sm font-bold text-white/42\">The vault is ready.</div></div></div>}</section></div>}\nexport default function PCGWorkspace(){return <CRMShell><div className=\"mx-auto w-full max-w-[1500px] px-4 py-5 sm:px-6 sm:py-7 xl:px-9 xl:py-8\"><PCGCardVaultContent/></div></CRMShell>}\n","expectedSha":"925e7fcdd264ef9516a20b6c209e06b2e8fc91aa"},{"path":"src/pages/card-grading/PCGModesWorkspace.tsx","content":"import React from 'react';\nimport {ArrowLeft,ArrowRight,CheckCircle2,Clock3,CreditCard,Database,Images,PackageCheck,Truck,Users} from 'lucide-react';\nimport {useLocation,useNavigate} from 'react-router-dom';\nimport PcgWorkspace from '@/pages/crm/PcgWorkspace';\nimport {useMultiTenant} from '@/contexts/MultiTenantContext';\nimport PCGCompletionCenter from '@/pages/card-grading/PCGCompletionCenter';\nimport TenantLogo from '@/components/branding/TenantLogo';\nimport MiscAwareAccountMenu from '@/components/MiscAwareAccountMenu';\nimport {CanonicalWorkspaceSidebarTrigger} from '@/components/layout/TenantLayoutControl';\nimport {supabase} from '@/integrations/supabase/client';\nimport {PCG_WORKSPACE_BACKGROUND} from '@/assets/pcgWorkspaceBackground';\nimport {resolveTenantMediaBranding} from '@/lib/tenants/tenantMediaBranding';\nimport {tenantMediaAssetUrl} from '@/lib/tenantMedia';\nimport {getTenantModeCards} from '@/shells/modesTenantShell';\n\ntype ModeId='received'|'grading'|'completed'|'mailed';\ntype WorkspaceTab='today'|'vault'|'queue'|'submissions'|'certs'|'collectors'|'inventory'|'shipping'|'money'|'migration'|'settings';\ntype VaultMode='overview'|'single'|'batch'|'growth';\ntype ModeCounts={received:number;grading:number;completed:number;mailed:number};\ntype UnknownRecord=Record<string,any>;\n\nfunction record(value:unknown):UnknownRecord{return value&&typeof value==='object'&&!Array.isArray(value)?value as UnknownRecord:{}}\nfunction resolvePcgHeroImage(tenant:any):string{\n  const settings=record(tenant?.settings);\n  const media=record(settings.media_branding);\n  const direct=String(media.hero_background_url||'').trim();\n  const assetId=String(media.resolved_hero_asset_id||media.hero_background_asset_id||'').trim();\n  const version=String(media.resolved_hero_version||media.hero_background_version||media.updated_at||'').trim();\n  return assetId?tenantMediaAssetUrl(assetId,version||null):direct;\n}\n\nconst MODE_TAB:Record<ModeId,WorkspaceTab>={received:'vault',grading:'queue',completed:'shipping',mailed:'shipping'};\nconst TOOL_LABEL:Record<WorkspaceTab,string>={today:'Operations',vault:'Card Vault',queue:'Grading Floor',submissions:'Intake Ledger',certs:'Cert Vault',collectors:'Collectors',inventory:'Card Shop',shipping:'Fulfillment',money:'Stripe Desk',migration:'Migration',settings:'Settings'};\nconst PCG_CARD_IMAGE='https://images.squarespace-cdn.com/content/v1/6853034cd711cc2240276cf3/7fd5d898-1ff3-4bc2-9f7d-c7f2f2d6ee07/IMG_8111.jpg';\nconst PCG_STORE_IMAGE='https://images.squarespace-cdn.com/content/v1/6853034cd711cc2240276cf3/83d3ec70-169f-4d22-8916-15e422fb0e52/IMG_8156%2B%281%29.jpeg';\nconst MODES=[\n  {id:'received' as ModeId,title:'Cards Received',short:'Received',copy:'Log new orders and photograph card batches.',icon:Images,accent:'#168cff',image:PCG_CARD_IMAGE,position:'38% 45%'},\n  {id:'grading' as ModeId,title:'Grading In Process',short:'Grading',copy:'Work the live grading floor and update status.',icon:Clock3,accent:'#a83cff',image:PCG_WORKSPACE_BACKGROUND,position:'68% 52%'},\n  {id:'completed' as ModeId,title:'Completed',short:'Completed',copy:'Review grades, certs and final card images.',icon:CheckCircle2,accent:'#00e676',image:PCG_CARD_IMAGE,position:'62% 48%'},\n  {id:'mailed' as ModeId,title:'Mailed',short:'Mailed',copy:'Add tracking and manage return delivery.',icon:Truck,accent:'#ffd740',image:PCG_STORE_IMAGE,position:'76% 58%'},\n] as const;\n\nconst PCGBatchPublishingCenter=React.lazy(()=>import('@/pages/card-grading/PCGBatchPublishingCenter'));\n\nfunction isModeId(value:string|null):value is ModeId{return MODES.some(item=>item.id===value)}\nfunction isWorkspaceTab(value:string|null):value is WorkspaceTab{return Boolean(value)&&['today','vault','queue','submissions','certs','collectors','inventory','shipping','money','migration','settings'].includes(value as WorkspaceTab)}\nfunction bucket(status:string):ModeId|null{\n  if(['received','intake_imaging','authentication'].includes(status))return'received';\n  if(['grading','encapsulation','qa'].includes(status))return'grading';\n  if(status==='ready')return'completed';\n  if(['shipped','picked_up','delivered','closed'].includes(status))return'mailed';\n  return null;\n}\n\nexport default function PCGModesWorkspace(){\n  const{activeTenant}=useMultiTenant();\n  const location=useLocation();\n  const navigate=useNavigate();\n  const tenantId=activeTenant?.id||'';\n  const slug=String(activeTenant?.company_slug||'pcg').trim().toLowerCase()||'pcg';\n  const wmpUrl='https://whatsmyprogress.com/'+encodeURIComponent(slug)+'/';\n  const branding=React.useMemo(()=>resolveTenantMediaBranding(activeTenant as any),[activeTenant]);\n  const workspaceBackground=branding.backgroundUrl||PCG_WORKSPACE_BACKGROUND;\n  const heroImage=React.useMemo(()=>resolvePcgHeroImage(activeTenant)||workspaceBackground,[activeTenant,workspaceBackground]);\n  const configuredModeCards=React.useMemo(()=>getTenantModeCards(activeTenant as any),[activeTenant]);\n  const modes=React.useMemo(()=>MODES.map((entry)=>{\n    const configured=configuredModeCards.find((card)=>card.key===entry.id);\n    const x=configured?.image_position_x;\n    const y=configured?.image_position_y;\n    const assetId=String(configured?.image_asset_id||'').trim();\n    const image=assetId?tenantMediaAssetUrl(assetId):String(configured?.image_url||configured?.fallback_image_url||entry.image);\n    return {...entry,image,position:typeof x==='number'&&typeof y==='number'?`${x}% ${y}%`:entry.position};\n  }),[configuredModeCards]);\n  const searchParams=new URLSearchParams(location.search);\n  const requestedMode=searchParams.get('mode');\n  const requestedTool=searchParams.get('tool');\n  const requestedVault=searchParams.get('vault');\n  const mode=isModeId(requestedMode)?requestedMode:null;\n  const tool=isWorkspaceTab(requestedTool)?requestedTool:null;\n  const vaultMode:VaultMode=requestedVault==='batch'?'batch':requestedVault==='single'?'single':requestedVault==='growth'?'growth':'overview';\n  const[counts,setCounts]=React.useState<ModeCounts>({received:0,grading:0,completed:0,mailed:0});\n\n  React.useEffect(()=>{\n    let cancelled=false;\n    if(!tenantId)return;\n    void (supabase as any).from('card_grading_submissions').select('status').eq('tenant_id',tenantId).then(({data}:any)=>{\n      if(cancelled)return;\n      const next:ModeCounts={received:0,grading:0,completed:0,mailed:0};\n      for(const row of data||[]){const id=bucket(String(row?.status||''));if(id)next[id]+=1}\n      setCounts(next);\n    }).catch(()=>{});\n    return()=>{cancelled=true};\n  },[tenantId]);\n\n  const setMode=React.useCallback((next:ModeId|null)=>{\n    const params=new URLSearchParams(location.search);\n    if(next){params.set('mode',next);params.delete('tool');params.delete('vault')}else{params.delete('mode');params.delete('tool');params.delete('vault');params.delete('submissionId');params.delete('cardId')}\n    const search=params.toString();\n    navigate({pathname:location.pathname,search:search?'?'+search:'',hash:location.hash},{replace:false});\n  },[location.hash,location.pathname,location.search,navigate]);\n  const openTool=React.useCallback((nextMode:ModeId,nextTool:WorkspaceTab,nextVault?:VaultMode)=>{\n    const params=new URLSearchParams(location.search);\n    params.set('mode',nextMode);\n    params.set('tool',nextTool);\n    if(nextVault)params.set('vault',nextVault);else params.delete('vault');\n    params.delete('submissionId');params.delete('cardId');\n    const search=params.toString();\n    navigate({pathname:location.pathname,search:search?'?'+search:'',hash:location.hash},{replace:false});\n  },[location.hash,location.pathname,location.search,navigate]);\n\n  if(mode){\n    const current=modes.find(item=>item.id===mode)!;\n    const activeTab=tool||MODE_TAB[mode];\n    const headerLabel=tool?TOOL_LABEL[activeTab]:current.title;\n    return <div data-tenant-modes-shell=\"true\" data-tenant-id={tenantId||undefined} data-tenant-experience-family=\"modes\" data-pcg-active-mode={mode} data-pcg-mode-target={activeTab} className=\"min-h-screen bg-[#040506] text-white\">\n      <div data-pcg-mode-header=\"true\" className=\"sticky left-0 right-0 top-0 z-[65] box-border w-screen max-w-none border-b border-white/[.08] bg-[#050608]/92 px-3 py-2.5 backdrop-blur-xl sm:px-5 lg:px-7\">\n        <div className=\"flex w-full items-center gap-3\">\n          <button type=\"button\" onClick={()=>setMode(null)} aria-label=\"Back to PCG modes\" className=\"grid h-10 w-10 shrink-0 place-items-center rounded-xl border border-white/[.10] bg-white/[.04] text-white/70\"><ArrowLeft className=\"h-4 w-4\"/></button>\n          <div className=\"grid h-10 w-10 shrink-0 place-items-center overflow-hidden rounded-xl border border-[#d8bb78]/25 bg-black/50\"><TenantLogo tenant={activeTenant as any} size={40} rounded=\"lg\" fallbackVariant=\"initial\" className=\"border-0 bg-transparent\"/></div>\n          <div className=\"min-w-0\"><div className=\"truncate text-[9px] font-black uppercase tracking-[.18em] text-[#d8bb78]/70\">{tool?'PCG Tool':'PCG Mode'}</div><div className=\"truncate text-sm font-black\">{headerLabel}</div></div>\n          <div className=\"ml-auto hidden min-w-0 items-center gap-2 lg:flex\"><CanonicalWorkspaceSidebarTrigger className=\"h-10 w-[clamp(14rem,28vw,24rem)] border-white/[.10] bg-black/35 text-white/50 hover:bg-white/[.06] hover:text-white/80\"/><a href={wmpUrl} target=\"_blank\" rel=\"noreferrer\" className=\"inline-flex h-10 items-center gap-1.5 rounded-xl border border-[#d8bb78]/24 bg-[#d8bb78]/[.05] px-3 text-[10px] font-black uppercase tracking-[.1em] text-[#ead49d]\">WMP <ArrowRight className=\"h-3.5 w-3.5\"/></a></div><div className=\"ml-auto lg:ml-0\"><MiscAwareAccountMenu placement=\"inline\" avatarMode=\"tenant\" singletonKey={`pcg-mode-avatar:${tenantId||'workspace'}`} tenantShellOwner/></div>\n        </div>\n      </div>\n      {!tool&&(mode==='completed'||mode==='mailed')?<><PCGCompletionCenter mode={mode}/><React.Suspense fallback={null}><PCGBatchPublishingCenter tenantId={tenantId}/></React.Suspense></>:null}\n      <PcgWorkspace initialTab={activeTab} initialVaultMode={vaultMode} embedded/>\n    </div>\n  }\n\n  return <main data-tenant-modes-shell=\"true\" data-tenant-id={tenantId||undefined} data-tenant-experience-family=\"modes\" data-pcg-modes-workspace=\"true\" data-pcg-media-contract=\"tenant-configured\" className=\"relative min-h-dvh overflow-x-hidden pb-8 text-white\">\n    <div aria-hidden=\"true\" className=\"pointer-events-none fixed inset-0 z-0\" style={{backgroundImage:`linear-gradient(120deg,rgba(2,3,5,.54) 0%,rgba(2,3,5,.44) 42%,rgba(2,3,5,.34) 72%,rgba(2,3,5,.52) 100%),url(${JSON.stringify(workspaceBackground)})`,backgroundSize:'cover',backgroundPosition:branding.backgroundPosition||'center',backgroundRepeat:'no-repeat'}}/>\n    <header data-pcg-dashboard-header=\"true\" className=\"sticky left-0 right-0 top-0 z-[70] box-border w-screen max-w-none border-b border-white/[.08] bg-[#050608]/90 backdrop-blur-2xl\">\n      <div className=\"flex min-h-[64px] w-full items-center gap-3 px-3 sm:px-5 lg:px-7\">\n        <CanonicalWorkspaceSidebarTrigger className=\"h-10 w-[clamp(13rem,34vw,28rem)] border-white/[.10] bg-black/35 text-white/50 hover:bg-white/[.06] hover:text-white/80 max-sm:w-10 max-sm:px-0 max-sm:[&>span]:hidden\"/>\n        <div className=\"flex min-w-0 items-center gap-2.5\"><div className=\"grid h-10 w-10 shrink-0 place-items-center overflow-hidden rounded-xl border border-[#d8bb78]/24 bg-black/45\"><TenantLogo tenant={activeTenant as any} size={38} rounded=\"lg\" fallbackVariant=\"initial\" className=\"border-0 bg-transparent\"/></div><div className=\"min-w-0\"><div className=\"truncate text-[9px] font-black uppercase tracking-[.18em] text-[#d8bb78]/70\">MODES</div><div className=\"truncate text-sm font-black text-white/90\">PCG</div></div></div>\n        <div className=\"ml-auto\"><MiscAwareAccountMenu placement=\"inline\" avatarMode=\"tenant\" singletonKey={`pcg-dashboard-avatar:${tenantId||'workspace'}`} tenantShellOwner/></div>\n      </div>\n    </header>\n    <div className=\"relative z-10 mx-auto max-w-[1560px] px-3 pb-7 pt-4 sm:px-5 sm:pt-5 lg:px-7 lg:pt-6\">\n      <section className=\"relative min-h-[210px] overflow-hidden rounded-[24px] border border-[#d8bb78]/18 bg-[#08090b] shadow-[0_24px_70px_rgba(0,0,0,.40)] sm:min-h-[250px] lg:min-h-[280px]\">\n        <div className=\"absolute inset-0\" style={{backgroundImage:`linear-gradient(90deg,rgba(3,4,5,.94) 0%,rgba(3,4,5,.78) 48%,rgba(3,4,5,.28) 100%),url(${JSON.stringify(heroImage)})`,backgroundSize:'cover',backgroundPosition:'center 52%'}}/>\n        <div className=\"absolute inset-0 bg-[radial-gradient(circle_at_82%_22%,rgba(216,187,120,.18),transparent_30%)]\"/>\n        <div className=\"relative flex min-h-[210px] max-w-3xl flex-col justify-center px-5 py-6 sm:min-h-[250px] sm:px-8 lg:min-h-[280px] lg:px-10\">\n          <div className=\"flex items-center gap-3\">\n            <div className=\"grid h-11 w-11 place-items-center overflow-hidden rounded-xl border border-[#d8bb78]/28 bg-black/45 shadow-[0_0_28px_rgba(216,187,120,.12)]\"><TenantLogo tenant={activeTenant as any} size={42} rounded=\"lg\" fallbackVariant=\"initial\" className=\"border-0 bg-transparent\"/></div>\n            <div><div className=\"text-[9px] font-black uppercase tracking-[.24em] text-[#d8bb78]/72\">Prestigious Card Grading</div><div className=\"mt-0.5 text-[11px] font-bold uppercase tracking-[.13em] text-white/38\">Command Center</div></div>\n          </div>\n          <h1 className=\"mt-4 max-w-2xl text-[clamp(2.25rem,5vw,4.25rem)] font-black leading-[.9] tracking-[-.055em]\">More than grading.</h1>\n          <p className=\"mt-3 max-w-xl text-sm font-medium leading-5 text-white/52 sm:text-base\">Receive it. Grade it. Finish it. Ship it. Every card stays tied to the right customer, images, certs and tracking.</p>\n        </div>\n      </section>\n\n      <section aria-label=\"PCG order status\" className=\"mt-3 grid grid-cols-4 overflow-hidden rounded-[18px] border border-white/[.09] bg-[#08090b] shadow-[0_16px_50px_rgba(0,0,0,.26)]\">\n        {modes.map(({id,short,icon:Icon,accent})=><button key={id} type=\"button\" onClick={()=>setMode(id)} className=\"flex min-w-0 flex-col items-center justify-center gap-1 border-r border-white/[.07] px-1 py-3 text-center last:border-r-0 sm:flex-row sm:gap-2 sm:px-3\">\n          <Icon className=\"h-4 w-4 shrink-0\" style={{color:accent}}/>\n          <div className=\"min-w-0\"><div className=\"text-base font-black leading-none sm:text-lg\">{counts[id]}</div><div className=\"mt-1 truncate text-[8px] font-black uppercase tracking-[.08em] text-white/35 sm:text-[9px]\">{short}</div></div>\n        </button>)}\n      </section>\n\n      <section className=\"mt-3 grid grid-cols-2 gap-3 lg:grid-cols-4\">{modes.map(({id,title,copy,icon:Icon,accent,image,position})=><button key={id} type=\"button\" data-pcg-mode-id={id} aria-label={'Open '+title} onClick={()=>setMode(id)} className=\"group relative min-h-[220px] overflow-hidden rounded-[22px] border bg-[#07090c] text-left shadow-[0_20px_56px_rgba(0,0,0,.34)] transition duration-300 hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 sm:min-h-[270px]\" style={{borderColor:accent+'88',boxShadow:'0 0 20px '+accent+'24,0 20px 56px rgba(0,0,0,.34)'}}>\n        <div className=\"absolute inset-0 scale-[1.02] transition duration-500 group-hover:scale-[1.06]\" style={{backgroundImage:'url(\"'+image+'\")',backgroundSize:'cover',backgroundPosition:position}}/>\n        <div className=\"absolute inset-0\" style={{background:'linear-gradient(180deg,rgba(2,4,8,.12) 0%,rgba(2,4,8,.28) 43%,rgba(2,4,8,.96) 82%),radial-gradient(circle at 14% 16%,'+accent+'35,transparent 31%)'}}/>\n        <div className=\"absolute inset-0 rounded-[22px]\" style={{boxShadow:'inset 0 0 22px '+accent+'22'}}/>\n        <div className=\"relative flex min-h-[220px] flex-col p-3.5 sm:min-h-[270px] sm:p-4\">\n          <div className=\"grid h-10 w-10 place-items-center rounded-xl border border-white/15 bg-black/50 backdrop-blur-md\"><Icon className=\"h-5 w-5\" style={{color:accent}}/></div>\n          <div className=\"mt-auto\">\n            <div className=\"text-[8px] font-black uppercase tracking-[.18em] text-white/40 sm:text-[9px]\">PCG Mode</div>\n            <h2 className=\"mt-1.5 text-[1.18rem] font-black leading-[1.03] tracking-[-.035em] sm:text-2xl\">{title}</h2>\n            <p className=\"mt-2 text-[11px] leading-4 text-white/54 sm:text-xs sm:leading-5\">{copy}</p>\n            <div className=\"mt-3 flex items-center justify-between\">\n              <span className=\"text-[9px] font-black uppercase tracking-[.12em]\" style={{color:accent}}>Open</span>\n              <span className=\"grid h-8 w-8 place-items-center rounded-full border bg-black/45\" style={{borderColor:accent+'99',color:accent}}><ArrowRight className=\"h-3.5 w-3.5\"/></span>\n            </div>\n          </div>\n        </div>\n      </button>)}</section>\n\n      <section className=\"mt-3 flex items-center gap-3 rounded-[20px] border border-[#d8bb78]/20 bg-[#0a0b0d] p-4 shadow-[0_16px_50px_rgba(0,0,0,.26)]\">\n        <div className=\"grid h-11 w-11 shrink-0 place-items-center rounded-full border border-[#d8bb78]/20 bg-[#d8bb78]/[.06]\"><Users className=\"h-5 w-5 text-[#e8cc8d]\"/></div>\n        <div className=\"min-w-0 flex-1\"><div className=\"font-black\">What’s My Progress?</div><p className=\"mt-1 text-[11px] leading-4 text-white/42 sm:text-xs\">Customers see their cards, grading stage, images and tracking without calling the shop.</p></div>\n        <a href={wmpUrl} target=\"_blank\" rel=\"noreferrer\" className=\"inline-flex min-h-10 shrink-0 items-center gap-1 rounded-xl border border-[#d8bb78]/28 px-3 text-[9px] font-black uppercase tracking-[.08em] text-[#e8cc8d]\">Portal <ArrowRight className=\"h-3.5 w-3.5\"/></a>\n      </section>\n\n      <section className=\"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4\">\n        <button type=\"button\" onClick={()=>openTool('received','vault','batch')} className=\"flex min-h-11 items-center justify-center gap-2 rounded-xl border border-white/[.08] bg-white/[.025] text-[10px] font-black text-white/56\"><Images className=\"h-4 w-4 text-blue-300\"/>Batch Intake</button>\n        <button type=\"button\" onClick={()=>openTool('received','submissions')} className=\"flex min-h-11 items-center justify-center gap-2 rounded-xl border border-white/[.08] bg-white/[.025] text-[10px] font-black text-white/56\"><PackageCheck className=\"h-4 w-4 text-violet-300\"/>Orders</button>\n        <button type=\"button\" onClick={()=>openTool('completed','money')} className=\"flex min-h-11 items-center justify-center gap-2 rounded-xl border border-white/[.08] bg-white/[.025] text-[10px] font-black text-white/56\"><CreditCard className=\"h-4 w-4 text-[#d8bb78]\"/>Payments</button><button type=\"button\" onClick={()=>openTool('received','migration')} className=\"flex min-h-11 items-center justify-center gap-2 rounded-xl border border-white/[.08] bg-white/[.025] text-[10px] font-black text-white/56\"><Database className=\"h-4 w-4 text-emerald-300\"/>Migration</button>\n      </section>\n    </div>\n  </main>\n}\n","expectedSha":"abc8b6c3cb654c6acd7dc1942180dcc3bf21484d"}],"branch":"ai/objective-first-repair-ad3715ae1d45","writes":[],"patches":[],"version":1,"approved":true,"missionId":"ad3715ae-1d45-4de0-9799-35804937bcc7","repository":"noel/KnockLaunchOS","commitMessage":"PCG: consolidate legacy migration center","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/card-grading/PCGWorkspace.tsx","src/pages/card-grading/PCGModesWorkspace.tsx"],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"ad3715ae-1d45-4de0-9799-35804937bcc7","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/card-grading/PCGWorkspace.tsx","src/pages/card-grading/PCGModesWorkspace.tsx"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"d0b71d6225846bfe85da87746864fcfe3900f1a27131e6960a3901fecea3a951","replayCount":0,"serializedBytes":56899},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:38:11.375709+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:ad3715ae-1d45-4de0-9799-35804937bcc7:repository-mutation-intent:d0b71d6225846bfe85da87746864fcfe3900f1a27131e6960a3901fecea3a951:0","mission_step_id":"c0ea7fff-de4b-431d-8093-4a8b659a2d32","command_center_event_id":"ad3715ae-1d45-4de0-9799-35804937bcc7"},{"id":"98394c9e-483f-427e-9ded-5e38384dd5d2","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-3cc342e3e98e","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":18157,"releaseCount":0,"toolCallCount":2,"repeatedCallCount":0,"executorlessWaitMs":49513,"firstUsefulResultAt":"2026-09-29T02:27:18.488Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.62.0-mission-freedom-cloudflare-primary","prNumber":4084,"terminal":false,"missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":4404,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":1384,"missionSetupMs":231,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":231,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":231,"repositoryMutationMs":3020,"repositoryProviderMs":3020,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":1911,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":231,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1109},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3946,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:28:13.219362+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4084","receipt_type":"execute_mission","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"b04f4319-b125-4565-9663-22c09a201269","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"acefe8c2-8ea3-4bc6-b58d-c02ebb2e5c43","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-3cc342e3e98e","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":23898,"releaseCount":0,"toolCallCount":6,"repeatedCallCount":1,"executorlessWaitMs":71777,"firstUsefulResultAt":"2026-09-29T02:27:18.488Z","recoveryAttemptCount":2,"ownerInterruptionCount":0},"version":null,"prNumber":4084,"terminal":false,"missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"c267479c921da9f1dea8b4b217448a4367523515","timingsMs":{"prReadinessMs":569,"approvedPlanMs":0,"shipAndProveMs":2550,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"3cc342e3-e98e-4eaf-a983-1630a595655e"},"performance":null,"deploymentId":"forgejo-main-c267479c921d","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":false,"onrunner":false,"migrations":false,"ccExecution":true,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1948,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:28:46.608338+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4084","receipt_type":"automatic_mission_resume","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:automatic-mission-resume:4084:canonical_release_reconciliation_pending","mission_step_id":"a8cac928-5390-46a6-8283-85760d4f185d","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"7ce1654d-0bc4-4313-bf94-74d814ddb279","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-3cc342e3e98e","prNumber":4084,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"c267479c921da9f1dea8b4b217448a4367523515","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:28:53.690415+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"c267479c921da9f1dea8b4b217448a4367523515","external_id":"4084","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:merged-pr:4084:c267479c921da9f1dea8b4b217448a4367523515","mission_step_id":"7a18946d-4efa-44eb-a823-c2f011d77351","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"593d715e-70a0-4614-959c-eae644582ecb","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-b2470149d0a7","prNumber":4086,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:43:06.832367+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","external_id":"4086","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:b2470149-d0a7-41f7-9bcd-223d1976693a:merged-pr:4086:c484aa18d69d6cc3f197ce43c51bdc42b4e57072","mission_step_id":"e02f7b7f-41ab-43d3-84ce-4f2a0c033816","command_center_event_id":"b2470149-d0a7-41f7-9bcd-223d1976693a"},{"id":"8fff2621-0d58-4391-9432-338bda489503","source":"durable-mission-ledger","status":"verified","payload":{"sourceSha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"anon-denied","satisfied":true,"statement":"anon has no table privileges on pcg_import_batches or pcg_import_rows.","proofConditionIds":["grants-live"]},{"id":"auth-minimum","satisfied":true,"statement":"authenticated has only SELECT, INSERT, UPDATE, DELETE on both staging tables, subject to existing tenant RLS.","proofConditionIds":["grants-live"]}],"satisfied":true,"constraints":[{"id":"additive-migration-only","satisfied":true,"statement":"Only one new Supabase migration file may change; no existing schema objects or data may otherwise be modified.","proofConditionIds":["grants-live"]},{"id":"preserve-rls","satisfied":true,"statement":"Existing RLS policies remain enabled and unchanged.","proofConditionIds":["grants-live"]},{"id":"service-role","satisfied":true,"statement":"service_role access remains unchanged.","proofConditionIds":["grants-live"]},{"id":"no-visual","satisfied":true,"statement":"No visual or interaction proof is required.","proofConditionIds":["grants-live"]},{"id":"capability-completeness","satisfied":true,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["grants-live"]},{"id":"atomic-capability-lifecycle","satisfied":true,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["grants-live"]}],"contractHash":"68e690d4d12062ae459b559d00054f44eaeb138df3dd4d2cf3ef830e7fb85c40","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"grants-live","kind":"runtime","evidence":{"reason":null,"satisfied":true,"releaseState":"verified","missingTargets":[],"disallowedTargets":[],"migrationRequired":false,"releaseTargetStates":{"migrations":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["migrations"],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"migrationReleaseVerified":null,"releaseRequestContractHash":"68e690d4d12062ae459b559d00054f44eaeb138df3dd4d2cf3ef830e7fb85c40"},"required":true,"satisfied":true}],"validationErrors":[],"pendingProofKinds":[],"activeReleaseTargets":["migrations"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:43:09.429874+00:00","proof_gate":"request_contract_terminal_verified","source_sha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:b2470149-d0a7-41f7-9bcd-223d1976693a:request-contract:68e690d4d12062ae459b559d00054f44eaeb138df3dd4d2cf3ef830e7fb85c40:c484aa18d69d6cc3f197ce43c51bdc42b4e57072:verified:","mission_step_id":"78ea1042-f68d-4f4b-9d20-72b1e3e646b5","command_center_event_id":"b2470149-d0a7-41f7-9bcd-223d1976693a"},{"id":"3fb93e0d-404e-4ca0-8ae7-9c2220068797","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","frontend-cloudflare/live":"success","supabase-edge-production/live":"success"},"mainSha":"c267479c921da9f1dea8b4b217448a4367523515","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","supabase-edge-production/live","frontend-cloudflare/live"],"sourceSha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","releaseState":"verified","sourceInMain":true,"compareStatus":"known_exact_protected_main_push_history","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-google-drive-media","pcg-legacy-import"]},"releaseTargetStates":{"frontend":"success","supabaseEdge":"success"},"requestContractHash":"eb9ce1be253947b427f7fc9e99b4f38f686d75f021cb6bd5d83be61273a5bbe1","forgejoWorkflowProof":{"runId":12851,"source":"signed_push_receipt","status":"success","results":{},"conclusion":"success","targetStates":{"frontend":"success","supabaseEdge":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"success","supabaseEdge":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:28:56.936173+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"63d0666b5d2f3d03b1ebf770beb96f1fd37508e0","external_id":"forgejo-main-63d0666b5d2f","receipt_type":"canonical_release_status","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:forgejo-release-status:63d0666b5d2f3d03b1ebf770beb96f1fd37508e0:verified:forgejo-main/source=success|forgejo-release/workflow=success|supabase-edge-production/live=success|frontend-cloudflare/live=success","mission_step_id":"592fd8b1-5de3-46ed-b7ea-2133bd338522","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"54006fdc-5e4a-45a4-a998-0c1af9356c94","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","cc-execution/runtime-proof":"pending"},"mainSha":"c267479c921da9f1dea8b4b217448a4367523515","missing":[],"pending":["forgejo-release/workflow","cc-execution/runtime-proof"],"required":["forgejo-main/source","forgejo-release/workflow","cc-execution/runtime-proof"],"sourceSha":"c267479c921da9f1dea8b4b217448a4367523515","releaseState":"pending","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":false,"onrunner":false,"migrations":false,"ccExecution":true,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"ccExecution":"pending"},"requestContractHash":"a842068df858f95149f29960010a148b49c7cdcfde01dbaa1aae3c4094f5149c","forgejoWorkflowProof":{"runId":12854,"source":"signed_push_receipt","status":"running","results":{},"conclusion":"running","targetStates":{"ccExecution":"pending"},"targetJobCount":6,"observedTargetStates":{"ccExecution":"pending"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":{"liveSha":"07d9ebfbbf41bcd52a9be264a5ead540627ce676","deploymentId":"forgejo-main-07d9ebfbbf41bcd52a9be264a5ead540627ce676","compareStatus":null,"identitySource":"local_build_metadata","runtimeVersion":"1.62.0-mission-freedom-cloudflare-primary","containsSourceSha":false},"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:28:47.499878+00:00","proof_gate":"canonical_release_pending","source_sha":"c267479c921da9f1dea8b4b217448a4367523515","external_id":"forgejo-main-c267479c921d","receipt_type":"canonical_release_status","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:forgejo-release-status:c267479c921da9f1dea8b4b217448a4367523515:pending:forgejo-main/source=success|forgejo-release/workflow=pending|cc-execution/runtime-proof=pending","mission_step_id":"7a18946d-4efa-44eb-a823-c2f011d77351","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"c4864e53-8cb6-4ded-821d-64ee5ad966bb","source":"cc-execution","status":"authorized","payload":{"paths":[".forgejo/workflows/knocklaunch.yml","config/control-plane-capabilities.json","scripts/release-event-native-plan.test.mjs"],"reason":"Exact owner-authorized continuation of PR #4073 bound to current protected main c267479c921da9f1dea8b4b217448a4367523515.","baseSha":"c267479c921da9f1dea8b4b217448a4367523515","issuedAt":1790649061625,"expiresAt":1790649241625,"missionId":"c18494fd-aa07-4d65-8cb1-809efbfd0377","authorizationId":"9f26959c-902a-4b82-92bc-aeb738350ee6","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:01.912925+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"c267479c921da9f1dea8b4b217448a4367523515","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:9f26959c-902a-4b82-92bc-aeb738350ee6","mission_step_id":"2ccef6aa-add8-4aae-9324-3558ffa4f108","command_center_event_id":"c18494fd-aa07-4d65-8cb1-809efbfd0377"},{"id":"4cb52e07-050f-49ff-ab91-e8dbf07891ca","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"d31923ac-371e-4a5b-9034-e02109a06e33","objective":"Apply exact repository-authority decruft batch 3 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/admin/AdminCloudflareOps.tsx","supabase/functions/cloudflare-ops/index.ts","workers/cc-execution/src/command-center-contracts.js","workers/cc-execution/src/entrypoint-routed.js","workers/cc-execution/src/index-autonomous-release.js","workers/cc-execution/src/index-canonical-edge-deploy.js"],"workstreamKey":"repo-decruft-pr4073-batch3-c2eea2a4ff6c","anchored_edits":[{"path":"src/pages/admin/AdminCloudflareOps.tsx","edits":[{"new_content":"  const [healthUrl, setHealthUrl] = useState('https://app.knocklaunch.app');\n  const [workflowRunId, setWorkflowRunId] = useState('');\n  const [workflowFile, setWorkflowFile] = useState('');\n  const [secretWorkerName, setSecretWorkerName] = useState('knocklaunch-cc-read-proxy');\n  const [secretName, setSecretName] = useState('');\n  const [secretValue, setSecretValue] = useState('');\n  const [deleteConfirm, setDeleteConfirm] = useState('');\n  const [results, setResults] = useState<OpsResult[]>([]);","old_content":"  const [healthUrl, setHealthUrl] = useState('https://app.knocklaunch.app');\n  const [workflowRunId, setWorkflowRunId] = useState('');\n  const [workflowFile, setWorkflowFile] = useState('');\n  const [renderApiKey, setRenderApiKey] = useState('');\n  const [renderServiceId, setRenderServiceId] = useState('');\n  const [secretWorkerName, setSecretWorkerName] = useState('knocklaunch-cc-read-proxy');\n  const [secretName, setSecretName] = useState('RENDER_API_KEY');\n  const [secretValue, setSecretValue] = useState('');\n  const [deleteConfirm, setDeleteConfirm] = useState('');\n  const [results, setResults] = useState<OpsResult[]>([]);"},{"new_content":"    if (result.ok !== false) setSecretValue('');\n  }\n\n\n  async function deleteWorkerSecretFromManager() {\n    const worker = secretWorkerName.trim();","old_content":"    if (result.ok !== false) setSecretValue('');\n  }\n\n  async function writeReadProxySecret(secretNameToWrite: string, value: string, clear: () => void) {\n    const secret = value.trim();\n    if (!secret) {\n      toast({ title: `${secretNameToWrite} required`, description: 'Paste the value, then save it. It will be cleared after a successful write.', variant: 'destructive' });\n      return;\n    }\n    const result = await run('put_worker_secret', { workerName: 'knocklaunch-cc-read-proxy', secretName: secretNameToWrite, secretValue: secret });\n    if (result.ok !== false) clear();\n  }\n\n  async function deleteWorkerSecretFromManager() {\n    const worker = secretWorkerName.trim();"},{"new_content":"            <ShieldCheck className=\"h-4 w-4\" />\n            <AlertTitle>Canonical operations only</AlertTitle>\n            <AlertDescription>\n              This page does not deploy, roll back, pause routes, or revive retired browser runners. Frontend production is deployed by Cloudflare Workers Builds from main. Authenticated visual proof uses cc-execution with the owner-controlled KNOCKLAUNCH Visual Sandbox.\n            </AlertDescription>\n          </Alert>\n","old_content":"            <ShieldCheck className=\"h-4 w-4\" />\n            <AlertTitle>Canonical operations only</AlertTitle>\n            <AlertDescription>\n              This page does not deploy, roll back, pause routes, or revive retired browser runners. Frontend production is deployed by Cloudflare Workers Builds from main. Authenticated visual proof uses cc-execution with Render OnRunner profile default.\n            </AlertDescription>\n          </Alert>\n"},{"new_content":"            </CardContent>\n          </Card>\n\n          <Card>\n            <CardHeader><CardTitle className=\"text-base\">Advanced Worker Secrets Manager</CardTitle><CardDescription>Generic write, rotate, and delete controls for scoped operator maintenance.</CardDescription></CardHeader>\n            <CardContent className=\"space-y-3\">","old_content":"            </CardContent>\n          </Card>\n\n          <Card className=\"order-first border-emerald-500/30 bg-emerald-500/5\">\n            <CardHeader>\n              <CardTitle className=\"text-base\">Visual Witness Auto-Restart Setup</CardTitle>\n              <CardDescription>Configure only the canonical hosted Render service restart credentials used by cc-read-proxy during a bounded 502/524 outage.</CardDescription>\n            </CardHeader>\n            <CardContent className=\"space-y-4\">\n              <Alert><ShieldCheck className=\"h-4 w-4\" /><AlertTitle>Target locked for safety</AlertTitle><AlertDescription>Worker: <span className=\"font-mono\">knocklaunch-cc-read-proxy</span>. Values are write-only and clear after save.</AlertDescription></Alert>\n              <div className=\"rounded-lg border border-border bg-background p-3 space-y-2\">\n                <div className=\"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between\"><div><div className=\"font-mono text-xs font-semibold\">RENDER_API_KEY</div><p className=\"text-xs text-muted-foreground\">Authorizes the scoped Render restart call.</p></div><Badge variant=\"secondary\">required</Badge></div>\n                <Textarea value={renderApiKey} onChange={(event) => setRenderApiKey(event.target.value)} placeholder=\"Paste Render API key. It will be saved once, then cleared.\" className=\"min-h-[84px] font-mono text-xs\" />\n                <Button type=\"button\" className=\"w-full\" disabled={busy || !renderApiKey.trim()} onClick={() => writeReadProxySecret('RENDER_API_KEY', renderApiKey, () => setRenderApiKey(''))}>{loadingAction === 'put_worker_secret' ? <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" /> : <ShieldCheck className=\"mr-2 h-4 w-4\" />}Save Render API Key</Button>\n              </div>\n              <div className=\"rounded-lg border border-border bg-background p-3 space-y-2\">\n                <div className=\"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between\"><div><div className=\"font-mono text-xs font-semibold\">RENDER_VISUAL_WITNESS_SERVICE_ID</div><p className=\"text-xs text-muted-foreground\">Render service ID for the canonical Hosted Visual Witness service.</p></div><Badge variant=\"secondary\">required</Badge></div>\n                <Input value={renderServiceId} onChange={(event) => setRenderServiceId(event.target.value.trim())} placeholder=\"srv-...\" className=\"font-mono\" />\n                <Button type=\"button\" className=\"w-full\" disabled={busy || !renderServiceId.trim()} onClick={() => writeReadProxySecret('RENDER_VISUAL_WITNESS_SERVICE_ID', renderServiceId, () => setRenderServiceId(''))}>{loadingAction === 'put_worker_secret' ? <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" /> : <ShieldCheck className=\"mr-2 h-4 w-4\" />}Save Visual Witness Service ID</Button>\n              </div>\n              <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n                <Button type=\"button\" variant=\"outline\" disabled={busy} onClick={() => run('list_worker_secrets', { workerName: 'knocklaunch-cc-read-proxy' })}>{loadingAction === 'list_worker_secrets' ? <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" /> : <ShieldCheck className=\"mr-2 h-4 w-4\" />}Check read-proxy secrets</Button>\n                <Button type=\"button\" variant=\"secondary\" disabled={busy} onClick={() => run('get_secret_checklist')}>{loadingAction === 'get_secret_checklist' ? <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" /> : <ShieldCheck className=\"mr-2 h-4 w-4\" />}Check Cloudflare Ops config</Button>\n              </div>\n            </CardContent>\n          </Card>\n\n          <Card>\n            <CardHeader><CardTitle className=\"text-base\">Advanced Worker Secrets Manager</CardTitle><CardDescription>Generic write, rotate, and delete controls for scoped operator maintenance.</CardDescription></CardHeader>\n            <CardContent className=\"space-y-3\">"},{"new_content":"          </Card>\n\n          <Card>\n            <CardHeader><CardTitle className=\"text-base\">Frontend build status</CardTitle><CardDescription>Defaults to the native Cloudflare Workers Build on main. Enter a Forgejo workflow file or run ID only for an explicit workflow lookup.</CardDescription></CardHeader>\n            <CardContent className=\"space-y-3\">\n              <Input value={workflowFile} onChange={(event) => setWorkflowFile(event.target.value)} placeholder=\"Optional explicit workflow.yml\" />\n              <Input value={workflowRunId} onChange={(event) => setWorkflowRunId(event.target.value)} placeholder=\"Optional Forgejo Actions run ID\" />\n              <Button type=\"button\" variant=\"outline\" className=\"w-full\" disabled={busy} onClick={() => run('get_workflow_status', workflowRunId ? { runId: workflowRunId } : workflowFile.trim() ? { workflow: workflowFile } : { branch: 'main' })}>{loadingAction === 'get_workflow_status' ? <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" /> : <RefreshCw className=\"mr-2 h-4 w-4\" />}Get Frontend Status</Button>\n            </CardContent>\n          </Card>","old_content":"          </Card>\n\n          <Card>\n            <CardHeader><CardTitle className=\"text-base\">Frontend build status</CardTitle><CardDescription>Defaults to the native Cloudflare Workers Build on main. Enter a GitHub workflow file or run ID only for an explicit workflow lookup.</CardDescription></CardHeader>\n            <CardContent className=\"space-y-3\">\n              <Input value={workflowFile} onChange={(event) => setWorkflowFile(event.target.value)} placeholder=\"Optional explicit workflow.yml\" />\n              <Input value={workflowRunId} onChange={(event) => setWorkflowRunId(event.target.value)} placeholder=\"Optional GitHub Actions run ID\" />\n              <Button type=\"button\" variant=\"outline\" className=\"w-full\" disabled={busy} onClick={() => run('get_workflow_status', workflowRunId ? { runId: workflowRunId } : workflowFile.trim() ? { workflow: workflowFile } : { branch: 'main' })}>{loadingAction === 'get_workflow_status' ? <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" /> : <RefreshCw className=\"mr-2 h-4 w-4\" />}Get Frontend Status</Button>\n            </CardContent>\n          </Card>"}]},{"path":"supabase/functions/cloudflare-ops/index.ts","edits":[{"new_content":"    canonical_frontend_check: CANONICAL_FRONTEND_CHECK,\n    canonical_frontend_workflow: null,\n    canonical_browser_lane: 'cc-execution /repair/inspect-route',\n    canonical_browser_runtime: 'cc-execution -> KNOCKLAUNCH Visual Sandbox -> universal-witness.mjs',\n    canonical_browser_profile: 'default',\n    generic_worker_deploy_available: false,\n    route_mutation_available: false,","old_content":"    canonical_frontend_check: CANONICAL_FRONTEND_CHECK,\n    canonical_frontend_workflow: null,\n    canonical_browser_lane: 'cc-execution /repair/inspect-route',\n    canonical_browser_runtime: 'render-onrunner/runner-entrypoint.mjs -> universal-witness.mjs',\n    canonical_browser_profile: 'default',\n    generic_worker_deploy_available: false,\n    route_mutation_available: false,"}]},{"path":"workers/cc-execution/src/command-center-contracts.js","edits":[{"new_content":"}\n\nconst REQUEST_CONTRACT_PROOF_KINDS = new Set([\"runtime\", \"release\", \"repository\", \"scope\", \"interaction\", \"visual\", \"host_watchdog\"]);\nconst REQUEST_CONTRACT_RELEASE_TARGETS = new Set([\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"]);\nconst CAPABILITY_LIFECYCLE_STATES = Object.freeze([\"prepare\", \"deploy\", \"verify\", \"activate\"]);\nconst CAPABILITY_COMPATIBILITY_WINDOW = Object.freeze([\"N\", \"N-1\"]);\n","old_content":"}\n\nconst REQUEST_CONTRACT_PROOF_KINDS = new Set([\"runtime\", \"release\", \"repository\", \"scope\", \"interaction\", \"visual\", \"host_watchdog\"]);\nconst REQUEST_CONTRACT_RELEASE_TARGETS = new Set([\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"]);\nconst CAPABILITY_LIFECYCLE_STATES = Object.freeze([\"prepare\", \"deploy\", \"verify\", \"activate\"]);\nconst CAPABILITY_COMPATIBILITY_WINDOW = Object.freeze([\"N\", \"N-1\"]);\n"},{"new_content":"  const inputs = object(eventPayload?.inputs);\n  const enabled = (key) => inputs[key] === true || String(inputs[key] || \"\").trim().toLowerCase() === \"true\";\n  return (!targets.ccExecution || enabled(\"release_cc_execution\"))\n    && (!targets.frontend || enabled(\"release_frontend\"))\n    && (!targets.supabaseEdge || enabled(\"release_supabase_edge\"))\n    && (!targets.migrations || enabled(\"release_migrations\"));","old_content":"  const inputs = object(eventPayload?.inputs);\n  const enabled = (key) => inputs[key] === true || String(inputs[key] || \"\").trim().toLowerCase() === \"true\";\n  return (!targets.ccExecution || enabled(\"release_cc_execution\"))\n    && (!targets.onrunner || enabled(\"release_onrunner\"))\n    && (!targets.frontend || enabled(\"release_frontend\"))\n    && (!targets.supabaseEdge || enabled(\"release_supabase_edge\"))\n    && (!targets.migrations || enabled(\"release_migrations\"));"},{"new_content":"  const inputs = object(eventPayload?.inputs);\n  const targetInputs = {\n    ccExecution: \"release_cc_execution\",\n    frontend: \"release_frontend\",\n    supabaseEdge: \"release_supabase_edge\",\n    migrations: \"release_migrations\",","old_content":"  const inputs = object(eventPayload?.inputs);\n  const targetInputs = {\n    ccExecution: \"release_cc_execution\",\n    onrunner: \"release_onrunner\",\n    frontend: \"release_frontend\",\n    supabaseEdge: \"release_supabase_edge\",\n    migrations: \"release_migrations\","},{"new_content":"\nconst FORGEJO_RELEASE_TARGET_JOB_PATTERNS = Object.freeze({\n  ccExecution: /^Release cc-execution(?:\\s|$)/i,\n  frontend: /^Release frontend(?:\\s|$)/i,\n  supabaseEdge: /^Release Supabase Edge Functions(?:\\s|$)/i,\n  migrations: /^Apply Supabase migrations(?:\\s|$)/i,","old_content":"\nconst FORGEJO_RELEASE_TARGET_JOB_PATTERNS = Object.freeze({\n  ccExecution: /^Release cc-execution(?:\\s|$)/i,\n  onrunner: /^Release Render OnRunner(?:\\s|$)/i,\n  frontend: /^Release frontend(?:\\s|$)/i,\n  supabaseEdge: /^Release Supabase Edge Functions(?:\\s|$)/i,\n  migrations: /^Apply Supabase migrations(?:\\s|$)/i,"},{"new_content":"    projection: payload.projection || \"GodMode\",\n    profileRef: payload.profileRef || payload.profile || \"default\",\n    // The default authenticated tenant audit is a GodMode projection. Send the\n    // opt-out explicitly so older visual-runner builds cannot silently fall back to\n    // resolving a real tenant owner before projection.\n    tenantOwnerPreflight: payload.tenantOwnerPreflight === true,\n    scope: payload.scope || \"linked_routes\",","old_content":"    projection: payload.projection || \"GodMode\",\n    profileRef: payload.profileRef || payload.profile || \"default\",\n    // The default authenticated tenant audit is a GodMode projection. Send the\n    // opt-out explicitly so older OnRunner builds cannot silently fall back to\n    // resolving a real tenant owner before projection.\n    tenantOwnerPreflight: payload.tenantOwnerPreflight === true,\n    scope: payload.scope || \"linked_routes\","}]},{"path":"workers/cc-execution/src/entrypoint-routed.js","edits":[{"new_content":"      \"/repair/inspect-route\": {\n        post: {\n          operationId: \"ccExecutionInspectRoute\",\n          summary: \"Deployment-proof compatibility alias for the canonical resumable KNOCKLAUNCH visual-sandbox route inspection command.\",\n          security: [{ bearerAuth: [] }],\n          requestBody: {\n            required: true,","old_content":"      \"/repair/inspect-route\": {\n        post: {\n          operationId: \"ccExecutionInspectRoute\",\n          summary: \"Deployment-proof compatibility alias for the canonical resumable Render OnRunner route inspection command.\",\n          security: [{ bearerAuth: [] }],\n          requestBody: {\n            required: true,"},{"new_content":"    },\n    canonicalVisualLane: {\n      route: \"/repair/inspect-route\",\n      runtime: \"KNOCKLAUNCH Visual Sandbox\",\n      source: \"scripts/visual-witness-hosted-runner/src/universal-witness.mjs\",\n      profile: \"default\",\n      projection: \"GodMode\",","old_content":"    },\n    canonicalVisualLane: {\n      route: \"/repair/inspect-route\",\n      runtime: \"Render OnRunner\",\n      source: \"scripts/visual-witness-hosted-runner/src/universal-witness.mjs\",\n      profile: \"default\",\n      projection: \"GodMode\","},{"new_content":"      });\n    }\n    if (path === \"/openapi.json\") return json(deploymentProofOpenApi());\n    if (path === \"/action/capabilities\" && request.method === \"GET\") return json({ ok: true, status: \"live\", proofGate: \"action_capabilities_current\", runtimeVersion: VERSION, actionSchema: actionSchemaNotice(), commands: Object.entries(ACTION_COMMAND_REGISTRY).map(([command, metadata]) => ({ command, ...metadata })), canonicalVisualLane: { healthCommand: \"inspect_route_health\", startCommand: \"inspect_route_start\", statusCommand: \"inspect_route_status\", cancelCommand: \"inspect_route_cancel\", runtime: \"KNOCKLAUNCH Visual Sandbox\", source: \"scripts/visual-witness-hosted-runner/src/runner-entrypoint.mjs -> universal-witness.mjs\", profile: \"default\", projection: \"GodMode\", fallbackAllowed: false }, destructiveActionsAllowed: false });\n    if (path === \"/action/execute\" && request.method === \"POST\") return executeActionCommand(request, env, ctx);\n    if (path === \"/command-center/prove\" && request.method === \"POST\") return proveCommandCenter(request, env, ctx);\n    if (path === \"/paul/machinery-snapshot\") return commandCenterMcpWorker.fetch(request, env, ctx);","old_content":"      });\n    }\n    if (path === \"/openapi.json\") return json(deploymentProofOpenApi());\n    if (path === \"/action/capabilities\" && request.method === \"GET\") return json({ ok: true, status: \"live\", proofGate: \"action_capabilities_current\", runtimeVersion: VERSION, actionSchema: actionSchemaNotice(), commands: Object.entries(ACTION_COMMAND_REGISTRY).map(([command, metadata]) => ({ command, ...metadata })), canonicalVisualLane: { healthCommand: \"inspect_route_health\", startCommand: \"inspect_route_start\", statusCommand: \"inspect_route_status\", cancelCommand: \"inspect_route_cancel\", runtime: \"Render OnRunner\", source: \"scripts/visual-witness-hosted-runner/src/runner-entrypoint.mjs -> universal-witness.mjs\", profile: \"default\", projection: \"GodMode\", fallbackAllowed: false }, destructiveActionsAllowed: false });\n    if (path === \"/action/execute\" && request.method === \"POST\") return executeActionCommand(request, env, ctx);\n    if (path === \"/command-center/prove\" && request.method === \"POST\") return proveCommandCenter(request, env, ctx);\n    if (path === \"/paul/machinery-snapshot\") return commandCenterMcpWorker.fetch(request, env, ctx);"}]},{"path":"workers/cc-execution/src/index-autonomous-release.js","edits":[{"new_content":"\n  if (path.startsWith(CC_EXECUTION_SUPPORT_TEST_PREFIX)) return null;\n\n  if (path.startsWith(\"scripts/visual-witness-hosted-runner/\")) return \"cc-execution\";\n\n  if (\n    path.startsWith(\"src/\") ||","old_content":"\n  if (path.startsWith(CC_EXECUTION_SUPPORT_TEST_PREFIX)) return null;\n\n  if (path.startsWith(\"scripts/visual-witness-hosted-runner/\")) return \"onrunner-service\";\n\n  if (\n    path.startsWith(\"src/\") ||"}]},{"path":"workers/cc-execution/src/index-canonical-edge-deploy.js","edits":[{"new_content":"import currentWorker from \"./index-merge-queue-openapi.js\";\n\nconst VERSION = \"1.6.3-forgejo-native-deploy\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\nconst WORKFLOW_FILE = \"knocklaunch.yml\";\nconst PREFIX = \"edge-function:\";\n\nfunction json(body, status = 200) {\n  return new Response(JSON.stringify(body, null, 2), {","old_content":"import currentWorker from \"./index-merge-queue-openapi.js\";\n\nconst VERSION = \"1.6.2-render-onrunner-deploy\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\nconst WORKFLOW_FILE = \"knocklaunch.yml\";\nconst PREFIX = \"edge-function:\";\nconst RENDER_ONRUNNER_TARGET = \"render-onrunner\";\nconst RENDER_ONRUNNER_WORKFLOW = \"onrunner-service-release.yml\";\n\nfunction json(body, status = 200) {\n  return new Response(JSON.stringify(body, null, 2), {"},{"new_content":"  try {\n    const target = String(body.target || body.functionName || body.function_name || \"\").trim();\n    const deploymentId = String(body.deploymentId || body.deployment_id || body.jobId || \"\").trim();\n    const parsed = parseDeploymentId(deploymentId);\n    if (!parsed) {\n      if (target && target !== \"cc-execution\") {\n        return json({ ok: false, status: \"blocked\", proofGate: \"deploy_request_blocked\", reason: \"unsupported_deployment_target\", deploymentId: deploymentId || null, functionName: target, provider: \"forgejo\" }, 400);\n      }\n      return null;\n    }\n    const repository = normalizeRepository(body.repository || body.repo || body.requestedRepository);\n    const expectedVersion = String(body.expectedVersion || body.expected_version || \"\").trim();\n    if (!expectedVersion || expectedVersion.length > 160) throw new Error(\"expectedVersion_required\");","old_content":"  try {\n    const target = String(body.target || body.functionName || body.function_name || \"\").trim();\n    const deploymentId = String(body.deploymentId || body.deployment_id || body.jobId || \"\").trim();\n    if (target === RENDER_ONRUNNER_TARGET) {\n      return json({\n        ok: false,\n        status: \"blocked\",\n        proofGate: \"deploy_request_blocked\",\n        reason: \"render_onrunner_github_lane_retired_use_forgejo_release_supervisor\",\n        deploymentId: deploymentId || null,\n        functionName: RENDER_ONRUNNER_TARGET,\n        provider: \"forgejo\",\n      }, 410);\n    }\n    const parsed = parseDeploymentId(deploymentId);\n    if (!parsed) return null;\n    const repository = normalizeRepository(body.repository || body.repo || body.requestedRepository);\n    const expectedVersion = String(body.expectedVersion || body.expected_version || \"\").trim();\n    if (!expectedVersion || expectedVersion.length > 160) throw new Error(\"expectedVersion_required\");"},{"new_content":"  try {\n    const target = String(url.searchParams.get(\"target\") || body.target || body.functionName || body.function_name || \"\").trim();\n    const deploymentId = String(url.searchParams.get(\"deploymentId\") || url.searchParams.get(\"deployment_id\") || body.deploymentId || body.deployment_id || \"\").trim();\n    const parsed = parseDeploymentId(deploymentId);\n    if (!parsed) {\n      if (target && target !== \"cc-execution\") {\n        return json({ ok: false, status: \"blocked\", proofGate: \"deploy_status_blocked\", reason: \"unsupported_deployment_target\", deploymentId: deploymentId || null, functionName: target, provider: \"forgejo\" }, 400);\n      }\n      return null;\n    }\n    const repository = normalizeRepository(body.repository || body.repo || body.requestedRepository);\n    const payload = await forgejo(env, \"GET\", `/repos/${encRepo(repository)}/actions/runs?limit=100`);\n    const runs = (Array.isArray(payload?.workflow_runs) ? payload.workflow_runs : Array.isArray(payload?.runs) ? payload.runs : Array.isArray(payload) ? payload : []).map(mapRun);","old_content":"  try {\n    const target = String(url.searchParams.get(\"target\") || body.target || body.functionName || body.function_name || \"\").trim();\n    const deploymentId = String(url.searchParams.get(\"deploymentId\") || url.searchParams.get(\"deployment_id\") || body.deploymentId || body.deployment_id || \"\").trim();\n    if (target === RENDER_ONRUNNER_TARGET) {\n      return json({\n        ok: false,\n        status: \"blocked\",\n        proofGate: \"deploy_status_blocked\",\n        reason: \"render_onrunner_github_lane_retired_use_live_runtime_proof\",\n        deploymentId: deploymentId || null,\n        functionName: RENDER_ONRUNNER_TARGET,\n        provider: \"forgejo\",\n      }, 410);\n    }\n    const parsed = parseDeploymentId(deploymentId);\n    if (!parsed) return null;\n    const repository = normalizeRepository(body.repository || body.repo || body.requestedRepository);\n    const payload = await forgejo(env, \"GET\", `/repos/${encRepo(repository)}/actions/runs?limit=100`);\n    const runs = (Array.isArray(payload?.workflow_runs) ? payload.workflow_runs : Array.isArray(payload?.runs) ? payload.runs : Array.isArray(payload) ? payload : []).map(mapRun);"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 3 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 3 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/admin/AdminCloudflareOps.tsx","supabase/functions/cloudflare-ops/index.ts","workers/cc-execution/src/command-center-contracts.js","workers/cc-execution/src/entrypoint-routed.js","workers/cc-execution/src/index-autonomous-release.js","workers/cc-execution/src/index-canonical-edge-deploy.js"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 3 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 3 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["src/pages/admin/AdminCloudflareOps.tsx","supabase/functions/cloudflare-ops/index.ts","workers/cc-execution/src/command-center-contracts.js","workers/cc-execution/src/entrypoint-routed.js","workers/cc-execution/src/index-autonomous-release.js","workers/cc-execution/src/index-canonical-edge-deploy.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["src/pages/admin/AdminCloudflareOps.tsx","supabase/functions/cloudflare-ops/index.ts","workers/cc-execution/src/command-center-contracts.js","workers/cc-execution/src/entrypoint-routed.js","workers/cc-execution/src/index-autonomous-release.js","workers/cc-execution/src/index-canonical-edge-deploy.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"recovery":false,"fingerprint":"aae7d34bfee8bbeb61fdb25a8c9c9ba9e2577a54aaa298e8defd6c022bc725ff","replayCount":0,"serializedBytes":29287},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:32:29.987643+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:d31923ac-371e-4a5b-9034-e02109a06e33:repository-mutation-intent:aae7d34bfee8bbeb61fdb25a8c9c9ba9e2577a54aaa298e8defd6c022bc725ff:0","mission_step_id":"b12b3526-ace1-491c-8b04-d14bbda04108","command_center_event_id":"d31923ac-371e-4a5b-9034-e02109a06e33"},{"id":"7287c31c-88fc-45d0-adea-cfc27bdfad94","source":"cc-execution","status":"cancelled","payload":{"cancelled":true,"missionId":"7e0fa14d-6c4b-4f73-8a11-d14205162dbf"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:33:24.576135+00:00","proof_gate":"durable_mission_cancelled","source_sha":null,"external_id":null,"receipt_type":"owner_mission_cancelled","idempotency_key":"mission:7e0fa14d-6c4b-4f73-8a11-d14205162dbf:mission-cancel:7e0fa14d-6c4b-4f73-8a11-d14205162dbf","mission_step_id":"4050d749-8987-477a-96fd-97b37b709a60","command_center_event_id":"7e0fa14d-6c4b-4f73-8a11-d14205162dbf"},{"id":"85a032a9-b52a-4ce3-ad2e-e598dcfacc42","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-5596752e68e1","prNumber":4083,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:47:37.166543+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","external_id":"4083","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:e26bb076-6723-46b3-b6c1-0c9e1a31b85f:merged-pr:4083:d65dabe6c7655a2be9635cd1b4826696806e69b9","mission_step_id":"af6d850e-f60e-4791-9d0f-18e09026e8ee","command_center_event_id":"e26bb076-6723-46b3-b6c1-0c9e1a31b85f"},{"id":"a898f17b-e253-4e0f-8422-af3e55a0fe33","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","cc-execution/runtime-proof":"success"},"mainSha":"c267479c921da9f1dea8b4b217448a4367523515","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","cc-execution/runtime-proof"],"sourceSha":"c267479c921da9f1dea8b4b217448a4367523515","releaseState":"verified","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":false,"onrunner":false,"migrations":false,"ccExecution":true,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"ccExecution":"success"},"requestContractHash":"a842068df858f95149f29960010a148b49c7cdcfde01dbaa1aae3c4094f5149c","forgejoWorkflowProof":{"runId":12854,"source":"signed_push_receipt","status":"success","results":{},"conclusion":"success","targetStates":{"ccExecution":"success"},"targetJobCount":6,"observedTargetStates":{"ccExecution":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":{"liveSha":"c267479c921da9f1dea8b4b217448a4367523515","proofGate":"cc_execution_target_aware_runtime_identity_verified","deploymentId":"forgejo-main-c267479c921da9f1dea8b4b217448a4367523515","compareStatus":"target_job_success_runtime_verified","workflowRunId":12854,"identitySource":"canonical_release_target_job","runtimeVersion":"1.63.0-mission-freedom-web-research","workflowFailed":false,"containsSourceSha":true},"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:29:40.546723+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"c267479c921da9f1dea8b4b217448a4367523515","external_id":"forgejo-main-c267479c921d","receipt_type":"canonical_release_status","idempotency_key":"mission:3cc342e3-e98e-4eaf-a983-1630a595655e:forgejo-release-status:c267479c921da9f1dea8b4b217448a4367523515:verified:forgejo-main/source=success|forgejo-release/workflow=success|cc-execution/runtime-proof=success","mission_step_id":"c53c02b6-638d-4a30-a95c-5757096d0503","command_center_event_id":"3cc342e3-e98e-4eaf-a983-1630a595655e"},{"id":"64942e8c-f426-41a8-a0f1-9a15dad4c3e7","source":"cc-execution","status":"recorded","payload":{"requestContract":{"valid":true,"intent":{"evidence":[],"confidence":null,"compilation":{"stages":["owner_intent","conversation_context","scope","live_state","mutation_authority","affected_systems","dependencies","risk_and_blast_radius","execution_tactics","required_proof","release_plan","recovery_plan"],"version":2,"explicit":true,"objective":"Expand the platform-wide KNOCKLAUNCH public-surface media bootstrap so every canonical tenant has full, independent WMP and BMD media packs in the shared Universal Profile/Settings experience. Each surface must support: profile/logo photo, hero image, full-page background, cover/banner image, and general supporting media. Reuse the existing tenant-scoped tenant-media-library/storage and authorization model; add preview, upload/replace, remove/reset; preserve strict tenant isolation; keep WMP and BMD collections independent; use safe non-destructive fallback to existing tenant branding when a dedicated slot is empty (profile/logo -> tenant logo/avatar, background -> existing tenant/public background when available, hero/cover -> existing website/public hero when available, otherwise no broken image); never overwrite existing custom WMP/BMD media during bootstrap or repair; expose all controls on desktop/mobile in the shared Settings/Profile surface for all canonical tenant types including MODES and route-based tenants without CRM bleed; make canonical WMP and BMD public consumers resolve their dedicated media pack consistently; extend bootstrap/health/self-heal and contract coverage for inheritance, isolation, authorization, fallback, independent-surface behavior, and non-destructive repair; preserve existing branding/uploads/routes. One focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile desktop/mobile plus public WMP/BMD media resolution.","proofKinds":["visual","runtime"],"adaptiveDomains":["intent","tenant_route_role_viewport","urgency_deadline","dependency_scope","risk_blast_radius","runner_capacity","queue_active_work","provider_failure_circuits","qa_scope","retry_recovery","release_ownership","proof_depth"],"expansionPolicy":"later_stages_may_only_narrow_or_expand_with_machine_readable_dependency_evidence","dynamicStatePolicy":"live_state_may_change_execution_tactics_but_never_owner_outcome_or_explicit_constraints","dynamicRefreshStages":["preflight","gate","release","runtime_proof"],"adaptiveCompilerVersion":"paul-adaptive-objective-v1","inheritedContextBlockingAuthority":false},"rawUtterance":"Expand the platform-wide KNOCKLAUNCH public-surface media bootstrap so every canonical tenant has full, independent WMP and BMD media packs in the shared Universal Profile/Settings experience. Each surface must support: profile/logo photo, hero image, full-page background, cover/banner image, and general supporting media. Reuse the existing tenant-scoped tenant-media-library/storage and authorization model; add preview, upload/replace, remove/reset; preserve strict tenant isolation; keep WMP and BMD collections independent; use safe non-destructive fallback to existing tenant branding when a dedicated slot is empty (profile/logo -> tenant logo/avatar, background -> existing tenant/public background when available, hero/cover -> existing website/public hero when available, otherwise no broken image); never overwrite existing custom WMP/BMD media during bootstrap or repair; expose all controls on desktop/mobile in the shared Settings/Profile surface for all canonical tenant types including MODES and route-based tenants without CRM bleed; make canonical WMP and BMD public consumers resolve their dedicated media pack consistently; extend bootstrap/health/self-heal and contract coverage for inheritance, isolation, authorization, fallback, independent-surface behavior, and non-destructive repair; preserve existing branding/uploads/routes. One focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile desktop/mobile plus public WMP/BMD media resolution.","wordingChanged":false,"canonicalIntent":"Expand the platform-wide KNOCKLAUNCH public-surface media bootstrap so every canonical tenant has full, independent WMP and BMD media packs in the shared Universal Profile/Settings experience. Each surface must support: profile/logo photo, hero image, full-page background, cover/banner image, and general supporting media. Reuse the existing tenant-scoped tenant-media-library/storage and authorization model; add preview, upload/replace, remove/reset; preserve strict tenant isolation; keep WMP and BMD collections independent; use safe non-destructive fallback to existing tenant branding when a dedicated slot is empty (profile/logo -> tenant logo/avatar, background -> existing tenant/public background when available, hero/cover -> existing website/public hero when available, otherwise no broken image); never overwrite existing custom WMP/BMD media during bootstrap or repair; expose all controls on desktop/mobile in the shared Settings/Profile surface for all canonical tenant types including MODES and route-based tenants without CRM bleed; make canonical WMP and BMD public consumers resolve their dedicated media pack consistently; extend bootstrap/health/self-heal and contract coverage for inheritance, isolation, authorization, fallback, independent-surface behavior, and non-destructive repair; preserve existing branding/uploads/routes. One focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile desktop/mobile plus public WMP/BMD media resolution.","resolutionStatus":"exact","uniqueResolution":true,"clarificationRequired":false},"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Expand the platform-wide KNOCKLAUNCH public-surface media bootstrap so every canonical tenant has full, independent WMP and BMD media packs in the shared Universal Profile/Settings experience. Each surface must support: profile/logo photo, hero image, full-page background, cover/banner image, and general supporting media. Reuse the existing tenant-scoped tenant-media-library/storage and authorization model; add preview, upload/replace, remove/reset; preserve strict tenant isolation; keep WMP and BMD collections independent; use safe non-destructive fallback to existing tenant branding when a dedicated slot is empty (profile/logo -> tenant logo/avatar, background -> existing tenant/public background when available, hero/cover -> existing website/public hero when available, otherwise no broken image); never overwrite existing custom WMP/BMD media during bootstrap or repair; expose all controls on desktop/mobile in the shared Settings/Profile surface for all canonical tenant types including MODES and route-based tenants without CRM bleed; make canonical WMP and BMD public consumers resolve their dedicated media pack consistently; extend bootstrap/health/self-heal and contract coverage","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-settings","proof-wmp","proof-bmd"]}],"objective":"Expand the platform-wide KNOCKLAUNCH public-surface media bootstrap so every canonical tenant has full, independent WMP and BMD media packs in the shared Universal Profile/Settings experience. Each surface must support: profile/logo photo, hero image, full-page background, cover/banner image, and general supporting media. Reuse the existing tenant-scoped tenant-media-library/storage and authorization model; add preview, upload/replace, remove/reset; preserve strict tenant isolation; keep WMP and BMD collections independent; use safe non-destructive fallback to existing tenant branding when a dedicated slot is empty (profile/logo -> tenant logo/avatar, background -> existing tenant/public background when available, hero/cover -> existing website/public hero when available, otherwise no broken image); never overwrite existing custom WMP/BMD media during bootstrap or repair; expose all controls on desktop/mobile in the shared Settings/Profile surface for all canonical tenant types including MODES and route-based tenants without CRM bleed; make canonical WMP and BMD public consumers resolve their dedicated media pack consistently; extend bootstrap/health/self-heal and contract coverage for inheritance, isolation, authorization, fallback, independent-surface behavior, and non-destructive repair; preserve existing branding/uploads/routes. One focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile desktop/mobile plus public WMP/BMD media resolution.","constraints":[{"id":"shared-primitive-only","statement":"Use the existing tenant-media-library and shared tenant Settings/Profile primitives; do not create tenant-specific upload stacks or extra buckets.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-settings","proof-wmp","proof-bmd"]},{"id":"independent-surface-media","statement":"WMP and BMD media collections are independent; replacing or removing media for one surface must not change the other.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-wmp","proof-bmd"]},{"id":"non-destructive-bootstrap","statement":"Bootstrap and self-heal must never overwrite existing custom WMP/BMD media; fallbacks are read-time behavior only.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-settings","proof-wmp","proof-bmd"]},{"id":"visual-artifact-scope","statement":"The requested visual artifact type is authoritative: website only; must not include workspace. Do not add unrelated or mixed visual surfaces unless the owner explicitly requested them.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-settings","proof-wmp","proof-bmd"]},{"id":"visual-content-truth","statement":"Do not present invented names, metrics, prices, dates, services, testimonials, credentials, customer records, or other unknown business facts as real. Omit unknowns or mark them clearly as placeholder/example content.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-wmp","proof-bmd"]},{"id":"tenant-visual-isolation","statement":"Visual work is isolated to requested tenant. Do not import another tenant's logo, colors, imagery, copy, shell, customer data, business facts, or visual identity unless explicitly requested.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-settings","proof-wmp","proof-bmd"]},{"id":"visual-viewport-authority","statement":"The requested mobile viewport/form factor is authoritative. Do not create a mixed-device composite or add another viewport unless explicitly requested.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-settings"]},{"id":"reference-visual-fidelity","statement":"Preserve the current tenant design language and only add the requested media controls; material unrelated visual redesign is out of scope.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-settings"]},{"id":"responsive-visual-continuity","statement":"Responsive adaptation must preserve hierarchy, branding, functionality, and design language across desktop and mobile.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-settings"]},{"id":"reference-visual-authority","statement":"Completion requires deployed source implementation and live proof; mockups do not satisfy this feature request.","provenance":{"reason":null,"source":"current_request_explicit","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-settings"]},{"id":"capability-completeness","statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","provenance":{"reason":null,"source":"hard_safety_invariant","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-wmp","proof-bmd"]},{"id":"atomic-capability-lifecycle","statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","provenance":{"reason":null,"source":"hard_safety_invariant","inherited":false,"blockingAuthority":true},"proofConditionIds":["proof-wmp","proof-bmd"]}],"adaptivePolicy":{"risk":{"tier":"high","blastRadius":"sensitive"},"proof":{"requiredKinds":["visual","runtime"],"visualProofScope":"broad","interactionRequired":true,"runtimeProofRequired":true},"scope":{"route":"/pcg/settings?section=profile","roleRef":null,"tenantRef":null,"sourceTargets":["src/pages/settings/TenantSettingsPageWithWebsiteAssets.tsx","src/lib/tenantMedia.ts","src/pages/whats-my-progress/WhatsMyProgressTenantHome.tsx","src/pages/whats-my-progress/PCGWhatsMyProgressHome.tsx","src/pages/book-me-directly/BookMeDirectlyPublicPage.tsx","supabase/functions/customer-portal/index.ts","src/__tests__/contracts/prehistoric-001-tenant-media.contract.test.ts"]},"dynamic":{"variables":["main_and_runtime_lineage","runner_capacity","queue_and_active_work","provider_health","failure_clusters_and_circuits","release_target_state","current_pr_and_gate_state"],"refreshStages":["preflight","gate","release","runtime_proof"],"refreshMayChange":["runner_selection","parallelism","retry_path","qa_depth","release_recovery","proof_timing"],"refreshMayNotChange":["owner_outcome","explicit_no_go_constraints","tenant_identity","credential_boundary","hard_safety_invariants"]},"urgency":{"priority":"normal","deadlineSignals":[],"deadlineExplicit":false},"version":"paul-adaptive-objective-v1","recovery":{"transient":"one_bounded_retry_then_alternate_eligible_pool_or_provider_path","deterministic":"repair_source_or_contract_do_not_blind_rerun","mutationDependencyFailure":"prerequisite_required_or_targeted_recovery_never_invent","readOnlyDependencyFailure":"degrade_to_available_grounded_context_and_keep_conversation_alive"},"unknowns":["tenant","deadline"],"authority":{"outcome":"current_explicit_owner_request","tactics":"live_prime_truth","unknownPolicy":"preserve_unknown_never_invent","historicalContext":"advisory_unless_current_request_confirms"},"execution":{"mutation":true,"concurrency":"serialize_overlapping_mutations","scopePolicy":"start_bounded_expand_only_with_machine_readable_dependency_evidence","staleStatePolicy":"refresh_dynamic_state_before_irreversible_or_acceptance_stage","conversationIsolation":true,"ownerOutcomeMayBeChangedByAdaptation":false},"experience":{"visual":true,"viewports":["mobile","desktop"],"behavioral":true,"visualProofScope":"broad"},"dependencies":{"requiredDomains":["frontend","schema_data_storage","authentication_authorization","release_ownership","live_production_proof","backend_runtime","provider_configuration"],"capabilityDomains":["frontend","backend_runtime","schema_data_storage","authentication_authorization","provider_configuration","prerequisite_loading_empty_error_states","release_ownership","live_production_proof"],"releaseTargetHints":["frontend","supabaseEdge"]},"inputSignals":{"rawUtterance":"Expand the platform-wide KNOCKLAUNCH public-surface media bootstrap so every canonical tenant has full, independent WMP and BMD media packs in the shared Universal Profile/Settings experience. Each surface must support: profile/logo photo, hero image, full-page background, cover/banner image, and general supporting media. Reuse the existing tenant-scoped tenant-media-library/storage and authorization model; add preview, upload/replace, remove/reset; preserve strict tenant isolation; keep WMP and BMD collections independent; use safe non-destructive fallback to existing tenant branding when a dedicated slot is empty (profile/logo -> tenant logo/avatar, background -> existing tenant/public background when available, hero/cover -> existing website/public hero when available, otherwise no broken image); never overwrite existing custom WMP/BMD media during bootstrap or repair; expose all controls on desktop/mobile in the shared Settings/Profile surface for all canonical tenant types including MODES and route-based tenants without CRM bleed; make canonical WMP and BMD public consumers resolve their dedicated media pack consistently; extend bootstrap/health/self-heal and contract coverage for inheritance, isolation, authorization, fallback, independent-surface behavior, and non-destructive repair; preserve existing branding/uploads/routes. One focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile desktop/mobile plus public WMP/BMD media resolution.","canonicalIntent":"Expand the platform-wide KNOCKLAUNCH public-surface media bootstrap so every canonical tenant has full, independent WMP and BMD media packs in the shared Universal Profile/Settings experience. Each surface must support: profile/logo photo, hero image, full-page background, cover/banner image, and general supporting media. Reuse the existing tenant-scoped tenant-media-library/storage and authorization model; add preview, upload/replace, remove/reset; preserve strict tenant isolation; keep WMP and BMD collections independent; use safe non-destructive fallback to existing tenant branding when a dedicated slot is empty (profile/logo -> tenant logo/avatar, background -> existing tenant/public background when available, hero/cover -> existing website/public hero when available, otherwise no broken image); never overwrite existing custom WMP/BMD media during bootstrap or repair; expose all controls on desktop/mobile in the shared Settings/Profile surface for all canonical tenant types including MODES and route-based tenants without CRM bleed; make canonical WMP and BMD public consumers resolve their dedicated media pack consistently; extend bootstrap/health/self-heal and contract coverage for inheritance, isolation, authorization, fallback, independent-surface behavior, and non-destructive repair; preserve existing branding/uploads/routes. One focused PR, canonical Gate, squash merge, deploy affected targets, and verify production on /pcg/settings?section=profile desktop/mobile plus public WMP/BMD media resolution.","conversationContextPresent":false}},"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-settings","kind":"visual","claim":"PCG Settings shows independent WMP and BMD upload controls for profile/logo, hero, background, cover/banner, and supporting media on desktop and mobile.","route":"/pcg/settings?section=profile","roleRef":null,"userRef":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"requireCapacityAdmissible":false,"expectedWatchdogPolicyVersion":null,"minConsecutiveHealthyHeartbeats":1,"requirePositiveMemoryAttribution":false,"requireMemoryAdmissionPressureFalse":false},{"id":"proof-wmp","kind":"runtime","claim":"Canonical WMP public resolution returns and renders the dedicated tenant WMP media pack with safe fallback and tenant isolation.","route":"https://whatsmyprogress.com/pcg/","roleRef":null,"userRef":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"requireCapacityAdmissible":false,"expectedWatchdogPolicyVersion":null,"minConsecutiveHealthyHeartbeats":1,"requirePositiveMemoryAttribution":false,"requireMemoryAdmissionPressureFalse":false},{"id":"proof-bmd","kind":"runtime","claim":"Canonical BMD public resolution returns and renders the dedicated tenant BMD media pack with safe fallback and tenant isolation.","route":"https://bookmedirectly.com/pcg/","roleRef":null,"userRef":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"requireCapacityAdmissible":false,"expectedWatchdogPolicyVersion":null,"minConsecutiveHealthyHeartbeats":1,"requirePositiveMemoryAttribution":false,"requireMemoryAdmissionPressureFalse":false}],"validationErrors":[],"capabilityManifest":{"id":"Expand-the-platform-wide-KNOCKLAUNCH-public-surface-media-bootstrap-so-every-canonical-tenant-has-fu","driftPolicy":"exact_manifest_source_release_dependency_or_runtime_identity_mismatch_is_nonterminal","proofLedger":"command_center_mission_ledger_request_contract_hash_bound","schemaVersion":1,"releaseTargets":[],"lifecycleStates":["prepare","deploy","verify","activate"],"activationPolicy":"dependencies_and_claim_matched_live_proof_before_exposure","dependencyDomains":["frontend","backend_runtime","schema_data_storage","authentication_authorization","provider_configuration","prerequisite_loading_empty_error_states","release_ownership","live_production_proof"],"prerequisitePolicy":"expected_unavailable_dependencies_are_prerequisite_required_not_runtime_failures","compatibilityWindow":["N","N-1"],"failureIsolationPolicy":"quarantine_or_rollback_affected_capability_only_preserve_unrelated_working_capabilities","canaryProofConditionIds":["proof-wmp","proof-bmd"]},"capabilityCompleteness":{"domains":["frontend","backend_runtime","schema_data_storage","authentication_authorization","provider_configuration","prerequisite_loading_empty_error_states","release_ownership","live_production_proof"],"required":true,"prerequisitePolicy":"expected_unavailable_dependencies_are_prerequisite_states_not_runtime_failures"}},"requestContractHash":"62cf2fda7cfe1459943eab3d6b3169646eb6ba778c64d30f59b75e08fcf21c49","requestContractRevision":4,"previousRequestContractHash":"8ce08f113b75f77e713fc5422ecbf4fa4558712dcfd99f78ff2e351522f587e9"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:30:03.89575+00:00","proof_gate":"request_contract_revision_recorded","source_sha":null,"external_id":null,"receipt_type":"request_contract_revision","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:request-contract:62cf2fda7cfe1459943eab3d6b3169646eb6ba778c64d30f59b75e08fcf21c49","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"581c2eca-80e1-4880-b006-98b4787d784e","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-5596752e68e1","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":79309,"releaseCount":0,"toolCallCount":7,"repeatedCallCount":3,"executorlessWaitMs":327858,"firstUsefulResultAt":"2026-09-29T02:24:30.012Z","recoveryAttemptCount":4,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4083,"terminal":false,"missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3081,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":888,"missionSetupMs":297,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":191,"ledgerReconcileMs":0,"lineageReconcileMs":106,"resolvePreflightMs":297,"repositoryMutationMs":2193,"repositoryProviderMs":2193,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":2024,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":191,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":169},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3194,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:26:38.686795+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4083","receipt_type":"execute_mission","idempotency_key":"mission:5596752e-68e1-43eb-b3eb-c883cdd77f75:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"38f82569-902f-41a8-9fda-640984a6c55a","command_center_event_id":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},{"id":"971df803-9f88-4cc8-b226-71dcae65de50","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-83515a4a94d3","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":72328,"releaseCount":0,"toolCallCount":2,"repeatedCallCount":0,"executorlessWaitMs":192450,"firstUsefulResultAt":"2026-09-29T02:27:44.732Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4085,"terminal":false,"missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":5023,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":663,"missionSetupMs":369,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":369,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":369,"repositoryMutationMs":4360,"repositoryProviderMs":4360,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":2389,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":369,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1971},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3747,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:03.323904+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4085","receipt_type":"execute_mission","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"9397b175-1fb2-4877-b47c-c8446816e356","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"15bb5e19-8cd7-4a86-8fc5-6650fd613d22","source":"cc-execution","status":"release_freshness_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-83515a4a94d3","reason":null,"status":"release_freshness_reconciliation_pending","metrics":{"receiptBytes":74415,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":0,"executorlessWaitMs":198558,"firstUsefulResultAt":"2026-09-29T02:27:44.732Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":null,"prNumber":4085,"terminal":false,"missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36","operation":"automatic_mission_resume","proofGate":"canonical_release_freshness_reconciliation_pending","sourceSha":null,"timingsMs":{"prReadinessMs":752,"approvedPlanMs":0,"shipAndProveMs":615,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"refresh_regate_and_reconcile_release","receiptRef":{"mode":"full","missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":776,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:07.972925+00:00","proof_gate":"canonical_release_freshness_reconciliation_pending","source_sha":null,"external_id":"4085","receipt_type":"automatic_mission_resume","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:automatic-mission-resume:4085:canonical_release_freshness_reconciliation_pending","mission_step_id":"4d871772-da8f-4d37-b7bd-c375faf7f8d9","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"0acf5139-5699-4db3-acee-b1c658f4fb56","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in runtime proof.","nextAction":{"lane":"cc-execution","action":"reconcile_request_contract","reason":"release_verified_contract_pending","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"runtime_proof\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"execute_mission\",\"status\":\"deployment_dispatched\",\"proofGate\":\"canonical_release_dispatched\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_request_contract\",\"lane\":\"cc-execution\",\"reason\":\"release_verified_contract_pending\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_request_contract\",\"recoveryOwner\":\"cc-execution\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"proof-production\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"visual_proof\",\"deadlineAt\":\"2026-09-29T06:09:59.148796+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-b5ecb59b331d\",\"prNumber\":4081,\"sourceSha\":\"d4b2db0be2ef7626e4592ce173519923aa0fd7dc\",\"deploymentId\":\"forgejo-main-d4b2db0be2ef\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:30:05.672548+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:owner-progress-heartbeat:119376600","mission_step_id":"bfdb73a4-899f-44b4-bb2b-30bea26a09a9","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"d47fd67e-0d6f-4580-b7b6-261788dba324","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":30376,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:31:00.840Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4073,"terminal":false,"missionId":"c18494fd-aa07-4d65-8cb1-809efbfd0377","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":7903,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":5268,"missionSetupMs":335,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":335,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":335,"repositoryMutationMs":2635,"repositoryProviderMs":2635,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":2425,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":335,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":210},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"c18494fd-aa07-4d65-8cb1-809efbfd0377"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":4103,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:09.838899+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4073","receipt_type":"execute_mission","idempotency_key":"mission:c18494fd-aa07-4d65-8cb1-809efbfd0377:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"2d537811-b557-4e10-aa2b-7f70ce512431","command_center_event_id":"c18494fd-aa07-4d65-8cb1-809efbfd0377"},{"id":"6231e2ba-ace2-4058-a557-c08e0712e87b","source":"cc-execution","status":"cancelled","payload":{"cancelled":true,"missionId":"c18494fd-aa07-4d65-8cb1-809efbfd0377"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:23.81509+00:00","proof_gate":"durable_mission_cancelled","source_sha":null,"external_id":null,"receipt_type":"owner_mission_cancelled","idempotency_key":"mission:c18494fd-aa07-4d65-8cb1-809efbfd0377:mission-cancel:c18494fd-aa07-4d65-8cb1-809efbfd0377","mission_step_id":"f9972739-f663-4aaf-98f5-45de658c723c","command_center_event_id":"c18494fd-aa07-4d65-8cb1-809efbfd0377"},{"id":"bdd86561-154f-4266-b7cf-b06d6c4de763","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-83515a4a94d3","prNumber":4085,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:41.659294+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":"4085","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:merged-pr:4085:c2eea2a4ff6cec84887d9be917c3584c7c90739f","mission_step_id":"e99e38c5-0fde-43d0-ae74-a4389ff9075b","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"2486187b-15ed-45bc-8391-79de040dd72d","source":"cc-execution","status":"authorized","payload":{"paths":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"reason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f.","baseSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","issuedAt":1790649218820,"expiresAt":1790649398820,"missionId":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a","authorizationId":"84e06b2d-dc5b-4de9-88f9-5be2702e43e0","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:33:39.045695+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:84e06b2d-dc5b-4de9-88f9-5be2702e43e0","mission_step_id":"4dc13fea-6ada-4aa8-b040-be871a1a7d6d","command_center_event_id":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a"},{"id":"a62a0aec-f14e-4f84-ac4f-42c31c032895","source":"cc-execution","status":"blocked","payload":{"ok":false,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":"anchored_edit_anchor_missing:workers/cc-execution/src/version.js","status":"blocked","metrics":{"receiptBytes":26709,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:33:38.189Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a","operation":"execute_mission","proofGate":"repair_mission_execution_blocked","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1669,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":1669,"missionSetupMs":252,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":252,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":252,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":252,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1511,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:33:40.833586+00:00","proof_gate":"repair_mission_execution_blocked","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a:execute_mission:repair_mission_execution_blocked:current-generation","mission_step_id":"b727b4c8-9734-4346-909d-ddd3d49ae617","command_center_event_id":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a"},{"id":"208e34eb-2a1e-4ab1-a2c4-b09d0f9a2e21","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"1c94d54f-2a5a-4d6a-a178-a6571e9546cf","objective":"Update existing PR #4073 only. Extend config/capabilities/knocklaunch-console.json so the Console capability explicitly covers the admin/GodMode frontend surfaces and Supabase runtimes changed by this same PR. Do not create another PR, merge, release, or broaden scope.","sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["config/capabilities/knocklaunch-console.json"],"workstreamKey":"repo-decruft-pr4073-capability-manifest-d65dabe6c765","anchored_edits":[{"path":"config/capabilities/knocklaunch-console.json","edits":[{"new_content":"  \"surfaces\": [\n    \"src/pages/admin/GodModeCommandConsole.tsx\",\n    \"src/pages/admin/GptJsonConsole.tsx\",\n    \"src/pages/admin/AdminCloudflareOps.tsx\",\n    \"src/pages/godmode/components/RestorePointCard.tsx\",\n    \"src/pages/Admin.tsx\",\n    \"public/console/console.js\"\n  ],","old_content":"  \"surfaces\": [\n    \"src/pages/admin/GodModeCommandConsole.tsx\",\n    \"src/pages/Admin.tsx\",\n    \"public/console/console.js\"\n  ],"},{"new_content":"      \"supabase/functions/console-ops\",\n      \"supabase/functions/operator-respond\",\n      \"supabase/functions/command-center-autopilot\",\n      \"supabase/functions/cloudflare-ops\",\n      \"supabase/functions/_shared\",\n      \"supabase/functions/wmp-mission-control\",","old_content":"      \"supabase/functions/console-ops\",\n      \"supabase/functions/operator-respond\",\n      \"supabase/functions/_shared\",\n      \"supabase/functions/wmp-mission-control\","}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"The existing KnockLaunch Console capability manifest covers the exact frontend surfaces and Supabase runtimes changed by PR #4073.","proofConditionIds":["proof-gate"]}],"objective":"Update existing PR #4073 only. Extend config/capabilities/knocklaunch-console.json so the Console capability explicitly covers the admin/GodMode frontend surfaces and Supabase runtimes changed by this same PR. Do not create another PR, merge, release, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-gate"]},{"id":"no-ship","statement":"This mutation must not merge or release an intermediate head.","proofConditionIds":["proof-gate"]},{"id":"exact-scope","statement":"Only config/capabilities/knocklaunch-console.json may change in this mutation.","proofConditionIds":["proof-gate"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-gate","kind":"repository","claim":"Canonical KnockLaunch Gate passes capability manifest validation for the new exact PR head.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["config/capabilities/knocklaunch-console.json"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"The existing KnockLaunch Console capability manifest covers the exact frontend surfaces and Supabase runtimes changed by PR #4073.","proofConditionIds":["proof-gate"]}],"objective":"Update existing PR #4073 only. Extend config/capabilities/knocklaunch-console.json so the Console capability explicitly covers the admin/GodMode frontend surfaces and Supabase runtimes changed by this same PR. Do not create another PR, merge, release, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-gate"]},{"id":"no-ship","statement":"This mutation must not merge or release an intermediate head.","proofConditionIds":["proof-gate"]},{"id":"exact-scope","statement":"Only config/capabilities/knocklaunch-console.json may change in this mutation.","proofConditionIds":["proof-gate"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-gate","kind":"repository","claim":"Canonical KnockLaunch Gate passes capability manifest validation for the new exact PR head.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"5893e7d33bed0e90f77e5fcabd899ffa04b45e7cbd085b817906ecd1793dedb0","replayCount":0,"serializedBytes":5099},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:51:26.042649+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:1c94d54f-2a5a-4d6a-a178-a6571e9546cf:repository-mutation-intent:5893e7d33bed0e90f77e5fcabd899ffa04b45e7cbd085b817906ecd1793dedb0:0","mission_step_id":"1af51e68-6f42-499f-9afa-cfa6ac683f36","command_center_event_id":"1c94d54f-2a5a-4d6a-a178-a6571e9546cf"},{"id":"6d5be80d-2146-4e0b-b17d-5fac6c182d00","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"runtime_proof","branch":"ai/objective-first-repair-d8028b7a80b7","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":89314,"releaseCount":0,"toolCallCount":12,"repeatedCallCount":3,"executorlessWaitMs":482608,"firstUsefulResultAt":"2026-09-29T02:20:58.194Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4082,"terminal":false,"missionId":"d8028b7a-80b7-44a7-bd61-1f210843326b","operation":"execute_mission","proofGate":"canonical_release_reconciliation_pending","sourceSha":"c267479c921da9f1dea8b4b217448a4367523515","timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1309,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":104,"approvedPlanMs":0,"missionSetupMs":276,"providerAuthMs":0,"shipAndProveMs":712,"ledgerPrepareMs":276,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":276,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":276,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"d8028b7a-80b7-44a7-bd61-1f210843326b"},"performance":null,"deploymentId":"forgejo-main-c267479c921d","releaseState":"verified","workflowRunId":12854,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-google-drive-media","pcg-legacy-import"]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2967,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:30:13.659377+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":"c267479c921da9f1dea8b4b217448a4367523515","external_id":"forgejo-main-c267479c921d","receipt_type":"execute_mission","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:execute_mission:canonical_release_reconciliation_pending:current-generation","mission_step_id":"e9aee436-ef7e-4086-9552-10f9efc3cedc","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"6ea0ccce-1c67-44c2-ac3e-6f7f3997f7da","source":"cc-execution","status":"blocked","payload":{"ok":false,"jobId":null,"phase":"runtime_proof","branch":"ai/objective-first-repair-b5ecb59b331d","reason":"forgejo_release_source_not_contained_in_current_main","status":"blocked","metrics":{"receiptBytes":122628,"releaseCount":1,"toolCallCount":27,"repeatedCallCount":14,"executorlessWaitMs":1204847,"firstUsefulResultAt":"2026-09-29T02:10:01.516Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4081,"terminal":false,"missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c","operation":"execute_mission","proofGate":"canonical_release_blocked","sourceSha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":2192,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":101,"approvedPlanMs":0,"missionSetupMs":323,"providerAuthMs":0,"shipAndProveMs":1570,"ledgerPrepareMs":323,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":323,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":323,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},"performance":null,"deploymentId":"forgejo-main-d4b2db0be2ef","releaseState":"verified","workflowRunId":12848,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1422,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:30:17.52475+00:00","proof_gate":"canonical_release_blocked","source_sha":"d4b2db0be2ef7626e4592ce173519923aa0fd7dc","external_id":"forgejo-main-d4b2db0be2ef","receipt_type":"execute_mission","idempotency_key":"mission:b5ecb59b-331d-4157-8c98-ead58048fd7c:execute_mission:canonical_release_blocked:current-generation","mission_step_id":"6bc3e1f7-d76c-476d-96bd-6933957008f1","command_center_event_id":"b5ecb59b-331d-4157-8c98-ead58048fd7c"},{"id":"cce38e37-0a2f-4716-a8f5-11e6d797cf58","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[{"path":"src/pages/card-grading/PCGWorkspace.tsx","content":"import React,{useEffect,useRef,useState} from 'react';\nimport {Archive,ArrowUpRight,CheckCircle2,Database,Download,FileSpreadsheet,FileWarning,ImagePlus,Layers3,Loader2,PackageCheck,PauseCircle,Radar,RefreshCw,ScanLine,ShieldCheck,UploadCloud,XCircle} from 'lucide-react';\nimport {supabase} from '@/integrations/supabase/client';\nimport {useMultiTenant} from '@/contexts/MultiTenantContext';\nimport {useToast} from '@/hooks/use-toast';\nimport {CRMShell} from '@/components/crm/CRMShell';\nimport {cn} from '@/lib/utils';\nimport PCGGrowthLab,{PCGGrowthPulse} from '@/pages/card-grading/PCGGrowthLab';\nconst DRIVE_MEDIA_FN=`${import.meta.env.VITE_SUPABASE_URL}/functions/v1/pcg-google-drive-media`;const CONCURRENCY=4;type DriveMedia={url:string;fileId:string};\ntype CsvRow=Record<string,string>;type BatchItem={key:string;front?:File;back?:File;row?:CsvRow;status:'queued'|'uploading'|'done'|'failed';error?:string};type CardForm={title:string;player:string;year:string;set:string;number:string;category:string;grader:string;grade:string;cert:string;condition:string;qty:string;cost:string;value:string;tags:string;notes:string};type StoredCard={id:string;player_character?:string|null;brand_set?:string|null;year?:string|null;card_number?:string|null;front_image_url?:string|null;grade?:number|null;cert_number?:string|null;metadata?:Record<string,unknown>|null};type SubmissionOption={id:string;submission_number:string;customer_name:string|null;status:string};type DriveState='checking'|'ready'|'missing'|'reconnect';type ExistingBatchCard={id:string;sequence_number:number;import_key:string|null;front_image_url:string|null;back_image_url:string|null};type VaultMode='overview'|'single'|'batch'|'migration'|'growth';\nconst LEGACY_FIELD_DEFS=[\n{key:'submission_number',label:'Order / submission #',aliases:['submission_number','submission','order_number','order','order_id','submission_id','invoice_number']},\n{key:'legacy_id',label:'Legacy record ID',aliases:['legacy_id','record_id','id','card_id','item_id','entry_id']},\n{key:'customer_name',label:'Customer name',aliases:['customer_name','customer','collector_name','collector','client_name','name']},\n{key:'customer_email',label:'Customer email',aliases:['customer_email','email','collector_email','client_email']},\n{key:'customer_phone',label:'Customer phone',aliases:['customer_phone','phone','telephone','collector_phone','client_phone']},\n{key:'service_tier',label:'Service tier',aliases:['service_tier','tier','service','turnaround']},\n{key:'service_price',label:'Service price',aliases:['service_price','price','order_total','total','amount']},\n{key:'submission_status',label:'Order status',aliases:['submission_status','order_status','status','workflow_status']},\n{key:'payment_status',label:'Payment status',aliases:['payment_status','paid','payment','payment_state']},\n{key:'delivery_method',label:'Delivery method',aliases:['delivery_method','delivery','fulfillment','return_method']},\n{key:'tracking_in',label:'Inbound tracking',aliases:['tracking_in','tracking_number_in','inbound_tracking']},\n{key:'tracking_out',label:'Outbound tracking',aliases:['tracking_out','tracking_number','tracking','outbound_tracking']},\n{key:'submission_notes',label:'Order notes',aliases:['submission_notes','order_notes','customer_notes']},\n{key:'received_at',label:'Received date',aliases:['received_at','received_date','date_received','submitted_at','created_at']},\n{key:'due_at',label:'Due date',aliases:['due_at','due_date','target_date']},\n{key:'completed_at',label:'Completed date',aliases:['completed_at','completed_date','date_completed']},\n{key:'sequence_number',label:'Card sequence',aliases:['sequence_number','sequence','item_number','line_number']},\n{key:'cert_number',label:'Certification / serial',aliases:['cert_number','cert','certificate','serial','serial_number']},\n{key:'category',label:'Sport / category',aliases:['category','sport','type']},\n{key:'year',label:'Year',aliases:['year','card_year']},\n{key:'brand_set',label:'Set / brand',aliases:['brand_set','set','brand','card_set']},\n{key:'player_character',label:'Player / subject',aliases:['player_character','player','subject','character','athlete']},\n{key:'card_number',label:'Card number',aliases:['card_number','card_no','number']},\n{key:'variation',label:'Variation',aliases:['variation','variant','parallel']},\n{key:'card_description',label:'Card description',aliases:['card_description','description','title','card_title']},\n{key:'declared_value',label:'Declared / estimated value',aliases:['declared_value','estimated_value','value','card_value']},\n{key:'grade',label:'Grade',aliases:['grade','score','numeric_grade']},\n{key:'grade_label',label:'Grade label / condition',aliases:['grade_label','condition','condition_label']},\n{key:'card_status',label:'Card status',aliases:['card_status','item_status','grading_status']},\n{key:'grader_notes',label:'Card / grader notes',aliases:['grader_notes','card_notes','notes']},\n{key:'front_source',label:'Legacy front image ref',aliases:['front_source','front_image','front_image_url','front','image_front']},\n{key:'back_source',label:'Legacy back image ref',aliases:['back_source','back_image','back_image_url','back','image_back']}\n] as const;\ntype LegacyFieldKey=typeof LEGACY_FIELD_DEFS[number]['key'];type LegacyMapping=Record<LegacyFieldKey,string>;type LegacyIssue={row:number;severity:'error'|'warning';field:string;message:string};type LegacyPlan={rowNumber:number;source:CsvRow;submission:Record<string,any>;card:Record<string,any>;importKey:string;issues:LegacyIssue[];duplicate:boolean;existingSubmissionId?:string|null};type LegacyDryRun={plans:LegacyPlan[];issues:LegacyIssue[];summary:{rows:number;customers:number;submissions:number;newSubmissions:number;existingSubmissions:number;cards:number;safeCards:number;duplicates:number;conflicts:number;warnings:number;mediaRefs:number}};\nconst LEGACY_STATUS_MAP:Record<string,string>={new:'received',submitted:'received',received:'received',intake:'intake_imaging',intake_imaging:'intake_imaging',imaging:'intake_imaging',authentication:'authentication',auth:'authentication',grading:'grading',graded:'grading',encapsulation:'encapsulation',encapsulated:'encapsulation',slabbing:'encapsulation',qa:'qa',quality_assurance:'qa',ready:'ready',complete:'ready',completed:'ready',finished:'ready',shipped:'shipped',mailed:'shipped',delivered:'shipped',picked_up:'picked_up',pickup:'picked_up'};\nconst LEGACY_TIER_MAP:Record<string,string>={two_weeks:'two_weeks','2_weeks':'two_weeks','14_days':'two_weeks',one_week:'one_week','1_week':'one_week','7_days':'one_week',three_days:'three_days','3_days':'three_days',same_day:'same_day',sameday:'same_day',inventory:'inventory'};\nconst LEGACY_PAYMENT_MAP:Record<string,string>={unverified:'unverified',unpaid:'unverified',pending:'unverified',paid:'manually_verified',complete:'manually_verified',completed:'manually_verified',succeeded:'manually_verified',manually_verified:'manually_verified',waived:'waived',free:'waived',refunded:'refunded',refund:'refunded'};\nconst LEGACY_DELIVERY_MAP:Record<string,string>={walk_in:'walk_in',walkin:'walk_in',dropoff:'walk_in',drop_off:'walk_in',mail_in:'mail_in',mail:'mail_in',ship_back:'ship_back',shipping:'ship_back',shipped:'ship_back',pickup:'pickup',pick_up:'pickup'};\n\nconst EMPTY_FORM:CardForm={title:'',player:'',year:'',set:'',number:'',category:'',grader:'',grade:'',cert:'',condition:'',qty:'1',cost:'',value:'',tags:'',notes:''};\nconst fileStem=(name:string)=>name.replace(/\\.[^.]+$/,'').replace(/[-_ ](?:front|back|obverse|reverse)$/i,'');const isBack=(name:string)=>/[-_ ](?:back|reverse)\\.[^.]+$/i.test(name);const rowValue=(row:CsvRow|undefined,...keys:string[])=>keys.map(key=>row?.[key]).find(Boolean)||'';const money=(value:string)=>{const parsed=Number((value||'').replace(/[$,]/g,''));return Number.isFinite(parsed)?parsed:null};\nconst normalizeHeader=(value:string)=>String(value||'').trim().toLowerCase().replace(/[^a-z0-9]+/g,'_').replace(/^_+|_+$/g,'');const normalizeToken=(value:string)=>normalizeHeader(value);const csvEscape=(value:unknown)=>{const text=String(value??'');return /[\",\\n\\r]/.test(text)?'\"'+text.replace(/\"/g,'\"\"')+'\"':text};const stableHash=(value:string)=>{let hash=2166136261;for(let index=0;index<value.length;index+=1){hash^=value.charCodeAt(index);hash=Math.imul(hash,16777619)}return (hash>>>0).toString(36)};const slugLegacy=(value:string)=>normalizeHeader(value).replace(/_/g,'-').slice(0,64)||'record';\nfunction parseDelimited(text:string){const sample=String(text||'').split(/\\r?\\n/,1)[0]||'';const delimiter=(sample.match(/\\t/g)||[]).length>(sample.match(/,/g)||[]).length?'\\t':',';const matrix:string[][]=[];let row:string[]=[];let value='';let quoted=false;for(let index=0;index<text.length;index+=1){const char=text[index];if(quoted){if(char==='\"'&&text[index+1]==='\"'){value+='\"';index+=1}else if(char==='\"'){quoted=false}else{value+=char}continue}if(char==='\"'){quoted=true;continue}if(char===delimiter){row.push(value);value='';continue}if(char==='\\n'){row.push(value);if(row.some(cell=>cell.trim()))matrix.push(row);row=[];value='';continue}if(char!=='\\r')value+=char}row.push(value);if(row.some(cell=>cell.trim()))matrix.push(row);const headerRow=matrix.shift()||[];const seen=new Map<string,number>();const headers=headerRow.map((cell,index)=>{const base=normalizeHeader(cell)||'column_'+(index+1);const count=(seen.get(base)||0)+1;seen.set(base,count);return count===1?base:base+'_'+count});const rows=matrix.map(cells=>Object.fromEntries(headers.map((header,index)=>[header,String(cells[index]??'').trim()]))) as CsvRow[];return{headers,rows,delimiter}}\nfunction parseCsv(text:string){return parseDelimited(text).rows}\nconst emptyLegacyMapping=()=>Object.fromEntries(LEGACY_FIELD_DEFS.map(def=>[def.key,''])) as LegacyMapping;\nfunction autoLegacyMapping(headers:string[]){const mapping=emptyLegacyMapping();for(const def of LEGACY_FIELD_DEFS){const match=def.aliases.map(normalizeHeader).find(alias=>headers.includes(alias));if(match)mapping[def.key]=match}return mapping}\nfunction mapped(row:CsvRow,mapping:LegacyMapping,key:LegacyFieldKey){const source=mapping[key];return source?String(row[source]||'').trim():''}\nfunction parsedNumber(value:string){if(!value.trim())return null;const parsed=Number(value.replace(/[$,%]/g,'').replace(/,/g,''));return Number.isFinite(parsed)?parsed:Number.NaN}\nfunction parsedDate(value:string){if(!value.trim())return null;const date=new Date(value);return Number.isNaN(date.getTime())?null:date.toISOString()}\nfunction downloadClientFile(name:string,content:string,type='text/csv;charset=utf-8'){const blob=new Blob([content],{type});const url=URL.createObjectURL(blob);const anchor=document.createElement('a');anchor.href=url;anchor.download=name;document.body.appendChild(anchor);anchor.click();anchor.remove();setTimeout(()=>URL.revokeObjectURL(url),0)}\nasync function fetchTenantRowsByValues(tenantId:string,table:string,column:string,values:string[],select:string){const clean=[...new Set(values.map(value=>String(value||'').trim()).filter(Boolean))];if(!clean.length)return[] as any[];const chunks:Array<string[]>=[];for(let index=0;index<clean.length;index+=150)chunks.push(clean.slice(index,index+150));const results=await Promise.all(chunks.map(chunk=>(supabase as any).from(table).select(select).eq('tenant_id',tenantId).in(column,chunk)));const error=results.find(result=>result.error)?.error;if(error)throw error;return results.flatMap(result=>result.data||[])}\n\nfunction pairFiles(files:File[],rows:CsvRow[]){const map=new Map<string,BatchItem>();for(const file of files.filter(item=>item.type.startsWith('image/'))){const key=fileStem(file.name);const item=map.get(key)||{key,status:'queued' as const};if(isBack(file.name))item.back=file;else if(!item.front)item.front=file;else map.set(`${key}-${map.size+1}`,{key:`${key}-${map.size+1}`,front:file,status:'queued'});map.set(key,item)}for(const item of map.values())item.row=rows.find(row=>fileStem(rowValue(row,'filename','file','front','image')).toLowerCase()===item.key.toLowerCase());return[...map.values()]}\nfunction ModeButton({active,children,onClick}:{active:boolean;children:React.ReactNode;onClick:()=>void}){return <button onClick={onClick} className={cn('rounded-full px-4 py-2 text-xs font-bold transition sm:text-sm',active?'bg-[#d8bb78] text-[#0b0b0c]':'text-white/48 hover:bg-white/[0.05] hover:text-white')}>{children}</button>}\nfunction Stat({label,value,detail,icon:Icon}:{label:string;value:string;detail:string;icon:React.ComponentType<{className?:string}>}){return <div className=\"min-w-0 py-3 sm:border-l sm:border-white/[0.08] sm:px-5 first:sm:border-l-0 first:sm:pl-0\"><div className=\"flex items-center gap-2 text-[10px] font-bold uppercase tracking-[.16em] text-white/32\"><Icon className=\"h-3.5 w-3.5 text-[#d8bb78]\"/>{label}</div><div className=\"mt-2 text-2xl font-black tracking-tight text-white\">{value}</div><div className=\"mt-1 truncate text-xs text-white/35\">{detail}</div></div>}\nfunction Field({label,value,onChange,placeholder}:{label:string;value:string;onChange:(value:string)=>void;placeholder?:string}){return <label className=\"block\"><span className=\"text-[10px] font-bold uppercase tracking-[.13em] text-white/34\">{label}</span><input value={value} onChange={event=>onChange(event.target.value)} placeholder={placeholder} className=\"mt-2 h-11 w-full border-b border-white/[0.12] bg-transparent text-sm text-white outline-none transition placeholder:text-white/18 focus:border-[#d8bb78]/65\"/></label>}\nfunction ImageTile({label,file,onFile}:{label:string;file:File|null;onFile:(file:File|null)=>void}){return <label className=\"group flex min-h-36 cursor-pointer flex-col justify-between border border-white/[0.09] bg-black/28 p-4 transition hover:border-[#d8bb78]/30 hover:bg-[#d8bb78]/[0.035]\"><input type=\"file\" accept=\"image/*\" className=\"hidden\" onChange={event=>onFile(event.target.files?.[0]||null)}/><div className=\"flex items-center justify-between\"><span className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/35\">{label}</span>{file?<CheckCircle2 className=\"h-5 w-5 text-emerald-400\"/>:<ImagePlus className=\"h-5 w-5 text-[#d8bb78]\"/>}</div><div><div className=\"truncate text-sm font-bold text-white/82\">{file?.name||`Choose ${label.toLowerCase()} image`}</div><div className=\"mt-1 text-xs text-white/28\">Private PCG card photography.</div></div></label>}\nfunction DemoCardFace({card}:{card:StoredCard}){const subject=String(card.player_character||card.brand_set||'Trading Card').replace(/^DEMO\\s*[—-]\\s*/i,'');const detail=[card.year,card.brand_set,card.card_number&&`#${card.card_number}`].filter(Boolean).join(' · ');return <div className=\"absolute inset-1.5 flex flex-col overflow-hidden rounded-[14px] border border-[#d8bb78]/45 bg-[radial-gradient(circle_at_72%_18%,rgba(216,187,120,.26),transparent_38%),linear-gradient(145deg,rgba(30,27,20,.98),rgba(7,7,8,.98)_58%,rgba(27,23,15,.98))] p-2.5 shadow-[inset_0_0_0_1px_rgba(255,255,255,.06),0_14px_32px_rgba(0,0,0,.26)]\"><div className=\"flex items-center justify-between gap-1\"><div className=\"flex items-center gap-1.5 text-[8px] font-black uppercase tracking-[.14em] text-[#ecd797]\"><ScanLine className=\"h-3 w-3\"/>PCG Demo</div><div className=\"rounded-full border border-white/10 bg-black/35 px-1.5 py-0.5 text-[7px] font-black uppercase tracking-[.08em] text-white/46\">Trading card</div></div><div className=\"my-auto grid place-items-center\"><div className=\"grid h-14 w-14 place-items-center rounded-[16px] border border-[#d8bb78]/25 bg-[#d8bb78]/[0.08] shadow-[0_0_36px_rgba(216,187,120,.10)]\"><Archive className=\"h-6 w-6 text-[#d8bb78]\"/></div></div><div><div className=\"line-clamp-2 text-sm font-black leading-tight text-white\">{subject}</div><div className=\"mt-1.5 line-clamp-2 text-[9px] font-bold uppercase tracking-[.06em] text-white/42\">{detail||card.cert_number||'PCG sample record'}</div></div></div>}\n\nfunction LegacyMigrationStudio({tenantId,onImported}:{tenantId:string;onImported:()=>Promise<void>}){const{toast}=useToast();const[fileName,setFileName]=useState('');const[headers,setHeaders]=useState<string[]>([]);const[legacyRows,setLegacyRows]=useState<CsvRow[]>([]);const[mapping,setMapping]=useState<LegacyMapping>(emptyLegacyMapping());const[dryRun,setDryRun]=useState<LegacyDryRun|null>(null);const[working,setWorking]=useState(false);\nconst changeMapping=(key:LegacyFieldKey,value:string)=>{setMapping(current=>({...current,[key]:value}));setDryRun(null)};\nconst loadFile=async(file:File)=>{const text=await file.text();const parsed=parseDelimited(text);setFileName(file.name);setHeaders(parsed.headers);setLegacyRows(parsed.rows);setMapping(autoLegacyMapping(parsed.headers));setDryRun(null)};\nconst downloadTemplate=()=>downloadClientFile('pcg-legacy-migration-template.csv',LEGACY_FIELD_DEFS.map(def=>csvEscape(def.key)).join(',')+'\\n');\nconst exportIssues=()=>{if(!dryRun)return;const body=['row,severity,field,message,submission_number,cert_number,import_key',...dryRun.plans.flatMap(plan=>plan.issues.map(issue=>[issue.row,issue.severity,issue.field,issue.message,plan.submission.submission_number||'',plan.card.cert_number||'',plan.importKey].map(csvEscape).join(',')))].join('\\n');downloadClientFile('pcg-legacy-migration-report.csv',body)};\nasync function runDryRun(){if(!tenantId||!legacyRows.length)return;setWorking(true);try{const seenKeys=new Set<string>();const seenCerts=new Set<string>();const submissionFingerprints=new Map<string,string>();const plans:LegacyPlan[]=legacyRows.map((row,index)=>{const rowNumber=index+2;const issues:LegacyIssue[]=[];const legacyId=mapped(row,mapping,'legacy_id');let submissionNumber=mapped(row,mapping,'submission_number');if(!submissionNumber&&legacyId)submissionNumber='LEGACY-'+slugLegacy(legacyId).toUpperCase();if(!submissionNumber){issues.push({row:rowNumber,severity:'error',field:'submission_number',message:'Map an order/submission number or a legacy record ID.'})}const rawSubmissionStatus=mapped(row,mapping,'submission_status');const submissionStatus=rawSubmissionStatus?(LEGACY_STATUS_MAP[normalizeToken(rawSubmissionStatus)]||''): 'received';if(rawSubmissionStatus&&!submissionStatus)issues.push({row:rowNumber,severity:'error',field:'submission_status',message:'Unknown legacy order status: '+rawSubmissionStatus});const rawCardStatus=mapped(row,mapping,'card_status');const cardStatus=rawCardStatus?(LEGACY_STATUS_MAP[normalizeToken(rawCardStatus)]||''):(submissionStatus||'received');if(rawCardStatus&&!cardStatus)issues.push({row:rowNumber,severity:'error',field:'card_status',message:'Unknown legacy card status: '+rawCardStatus});const rawTier=mapped(row,mapping,'service_tier');const serviceTier=rawTier?(LEGACY_TIER_MAP[normalizeToken(rawTier)]||'inventory'):'inventory';if(rawTier&&!LEGACY_TIER_MAP[normalizeToken(rawTier)])issues.push({row:rowNumber,severity:'warning',field:'service_tier',message:'Unrecognized service tier mapped to inventory: '+rawTier});const rawPayment=mapped(row,mapping,'payment_status');const paymentStatus=rawPayment?(LEGACY_PAYMENT_MAP[normalizeToken(rawPayment)]||'unverified'):'unverified';if(rawPayment&&!LEGACY_PAYMENT_MAP[normalizeToken(rawPayment)])issues.push({row:rowNumber,severity:'warning',field:'payment_status',message:'Unrecognized payment status mapped to unverified: '+rawPayment});const rawDelivery=mapped(row,mapping,'delivery_method');const deliveryMethod=rawDelivery?(LEGACY_DELIVERY_MAP[normalizeToken(rawDelivery)]||''):'';if(rawDelivery&&!deliveryMethod)issues.push({row:rowNumber,severity:'warning',field:'delivery_method',message:'Unrecognized delivery method omitted: '+rawDelivery});const servicePrice=parsedNumber(mapped(row,mapping,'service_price'));if(Number.isNaN(servicePrice))issues.push({row:rowNumber,severity:'error',field:'service_price',message:'Service price is not a valid number.'});const declaredValue=parsedNumber(mapped(row,mapping,'declared_value'));if(Number.isNaN(declaredValue))issues.push({row:rowNumber,severity:'error',field:'declared_value',message:'Declared value is not a valid number.'});const grade=parsedNumber(mapped(row,mapping,'grade'));if(Number.isNaN(grade))issues.push({row:rowNumber,severity:'error',field:'grade',message:'Grade is not a valid number.'});const rawSequence=mapped(row,mapping,'sequence_number');const sequenceValue=rawSequence?Number(rawSequence):null;if(rawSequence&&(!Number.isInteger(sequenceValue)||Number(sequenceValue)<=0))issues.push({row:rowNumber,severity:'error',field:'sequence_number',message:'Card sequence must be a positive whole number.'});const dateFields=(['received_at','due_at','completed_at'] as const).map(key=>{const raw=mapped(row,mapping,key);const value=parsedDate(raw);if(raw&&!value)issues.push({row:rowNumber,severity:'error',field:key,message:'Invalid date: '+raw});return[key,value] as const});const dates=Object.fromEntries(dateFields) as Record<string,string|null>;const cert=mapped(row,mapping,'cert_number');const identity=[cert,mapped(row,mapping,'player_character'),mapped(row,mapping,'brand_set'),mapped(row,mapping,'year'),mapped(row,mapping,'card_number'),mapped(row,mapping,'card_description'),legacyId].filter(Boolean);if(!identity.length)issues.push({row:rowNumber,severity:'error',field:'card',message:'No usable card identity is mapped for this row.'});const importKey='legacy:'+slugLegacy(submissionNumber||legacyId||'unknown')+':'+(cert?'cert-'+slugLegacy(cert):stableHash(JSON.stringify(row)));let duplicate=false;if(seenKeys.has(importKey)){duplicate=true;issues.push({row:rowNumber,severity:'warning',field:'import_key',message:'Duplicate row inside this file; later copy will be skipped.'})}else seenKeys.add(importKey);if(cert){const certKey=cert.toLowerCase();if(seenCerts.has(certKey)){duplicate=true;issues.push({row:rowNumber,severity:'warning',field:'cert_number',message:'Duplicate certification number inside this file; later copy will be skipped.'})}else seenCerts.add(certKey)}const submission={submission_number:submissionNumber,customer_name:mapped(row,mapping,'customer_name')||null,customer_email:mapped(row,mapping,'customer_email')||null,customer_phone:mapped(row,mapping,'customer_phone')||null,service_tier:serviceTier,service_price:Number.isFinite(servicePrice as number)?servicePrice:0,status:submissionStatus||'received',payment_status:paymentStatus,delivery_method:deliveryMethod||null,tracking_in:mapped(row,mapping,'tracking_in')||null,tracking_out:mapped(row,mapping,'tracking_out')||null,notes:mapped(row,mapping,'submission_notes')||null,received_at:dates.received_at,due_at:dates.due_at,completed_at:dates.completed_at};const fingerprint=JSON.stringify([submission.customer_name,submission.customer_email,submission.customer_phone,submission.status]);if(submissionNumber){const prior=submissionFingerprints.get(submissionNumber);if(prior&&prior!==fingerprint)issues.push({row:rowNumber,severity:'error',field:'submission_number',message:'Rows for '+submissionNumber+' disagree on customer identity or order status.'});else submissionFingerprints.set(submissionNumber,fingerprint)}const card={sequence_number:sequenceValue&&Number.isInteger(sequenceValue)?sequenceValue:null,cert_number:cert||null,category:mapped(row,mapping,'category')||null,year:mapped(row,mapping,'year')||null,brand_set:mapped(row,mapping,'brand_set')||null,player_character:mapped(row,mapping,'player_character')||null,card_number:mapped(row,mapping,'card_number')||null,variation:mapped(row,mapping,'variation')||null,card_description:mapped(row,mapping,'card_description')||null,declared_value:Number.isFinite(declaredValue as number)?declaredValue:null,grade:Number.isFinite(grade as number)?grade:null,grade_label:mapped(row,mapping,'grade_label')||null,status:cardStatus||'received',grader_notes:mapped(row,mapping,'grader_notes')||null,front_source:mapped(row,mapping,'front_source')||null,back_source:mapped(row,mapping,'back_source')||null,legacy_id:legacyId||null};return{rowNumber,source:row,submission,card,importKey,issues,duplicate}});const submissionNumbers=[...new Set(plans.map(plan=>String(plan.submission.submission_number||'')).filter(Boolean))];const certs=[...new Set(plans.map(plan=>String(plan.card.cert_number||'')).filter(Boolean))];const importKeys=[...new Set(plans.map(plan=>plan.importKey).filter(Boolean))];const[existingSubmissions,existingCertCards,existingImportCards]=await Promise.all([fetchTenantRowsByValues(tenantId,'card_grading_submissions','submission_number',submissionNumbers,'id,submission_number,customer_name,customer_email,status'),fetchTenantRowsByValues(tenantId,'card_grading_cards','cert_number',certs,'id,submission_id,cert_number,import_key,player_character,brand_set,year,card_number,grade,status'),fetchTenantRowsByValues(tenantId,'card_grading_cards','import_key',importKeys,'id,submission_id,cert_number,import_key,player_character,brand_set,year,card_number,grade,status')]);const submissionMap=new Map(existingSubmissions.map((item:any)=>[String(item.submission_number),item]));const certMap=new Map(existingCertCards.filter((item:any)=>item.cert_number).map((item:any)=>[String(item.cert_number).toLowerCase(),item]));const importMap=new Map(existingImportCards.filter((item:any)=>item.import_key).map((item:any)=>[String(item.import_key),item]));for(const plan of plans){const existingSubmission=submissionMap.get(String(plan.submission.submission_number||''));plan.existingSubmissionId=existingSubmission?.id||null;if(existingSubmission){const sourceEmail=String(plan.submission.customer_email||'').toLowerCase();const existingEmail=String(existingSubmission.customer_email||'').toLowerCase();if(sourceEmail&&existingEmail&&sourceEmail!==existingEmail)plan.issues.push({row:plan.rowNumber,severity:'warning',field:'customer_email',message:'Existing order '+plan.submission.submission_number+' has a different customer email; existing order will be reused without overwrite.'})}const byCert=plan.card.cert_number?certMap.get(String(plan.card.cert_number).toLowerCase()):null;const byImport=importMap.get(plan.importKey);const existing=byCert||byImport;if(existing){const mismatches=[['player_character',plan.card.player_character],['brand_set',plan.card.brand_set],['year',plan.card.year],['card_number',plan.card.card_number]].filter(([key,value])=>value&&existing[key]&&String(value).trim().toLowerCase()!==String(existing[key]).trim().toLowerCase());if(mismatches.length){plan.issues.push({row:plan.rowNumber,severity:'error',field:byCert?'cert_number':'import_key',message:'Existing canonical card matches this identifier but has different card identity fields: '+mismatches.map(([key])=>key).join(', ')+'.'})}else{plan.duplicate=true;plan.issues.push({row:plan.rowNumber,severity:'warning',field:byCert?'cert_number':'import_key',message:'Canonical card already exists; this row will be skipped safely.'})}}}const issues=plans.flatMap(plan=>plan.issues);const safePlans=plans.filter(plan=>!plan.duplicate&&!plan.issues.some(issue=>issue.severity==='error'));const customerKeys=new Set(plans.map(plan=>String(plan.submission.customer_email||plan.submission.customer_phone||plan.submission.customer_name||'').trim().toLowerCase()).filter(Boolean));const uniqueSubmissionCount=new Set(plans.map(plan=>String(plan.submission.submission_number||'')).filter(Boolean)).size;const mediaRefs=plans.filter(plan=>plan.card.front_source||plan.card.back_source).length;setDryRun({plans,issues,summary:{rows:plans.length,customers:customerKeys.size,submissions:uniqueSubmissionCount,newSubmissions:submissionNumbers.filter(number=>!submissionMap.has(number)).length,existingSubmissions:submissionNumbers.filter(number=>submissionMap.has(number)).length,cards:plans.length,safeCards:safePlans.length,duplicates:plans.filter(plan=>plan.duplicate).length,conflicts:plans.filter(plan=>plan.issues.some(issue=>issue.severity==='error')).length,warnings:issues.filter(issue=>issue.severity==='warning').length,mediaRefs}})}catch(error){toast({title:'Migration dry run failed',description:error instanceof Error?error.message:String(error),variant:'destructive'})}finally{setWorking(false)}}\nasync function commitMigration(){if(!dryRun||dryRun.summary.conflicts>0||dryRun.summary.safeCards<1)return;setWorking(true);try{const safe=dryRun.plans.filter(plan=>!plan.duplicate&&!plan.issues.some(issue=>issue.severity==='error'));const groups=new Map<string,LegacyPlan[]>();for(const plan of safe){const key=String(plan.submission.submission_number);if(!groups.has(key))groups.set(key,[]);groups.get(key)!.push(plan)}const newSubmissionPayloads=[...groups.entries()].filter(([,plans])=>!plans[0].existingSubmissionId).map(([submissionNumber,plans])=>{const first=plans[0].submission;return{tenant_id:tenantId,submission_number:submissionNumber,customer_name:first.customer_name,customer_email:first.customer_email,customer_phone:first.customer_phone,service_tier:first.service_tier||'inventory',service_price:first.service_price||0,status:first.status||'received',delivery_method:first.delivery_method,tracking_in:first.tracking_in,tracking_out:first.tracking_out,notes:first.notes,received_at:first.received_at,due_at:first.due_at,completed_at:first.completed_at,payment_status:first.payment_status||'unverified',expected_card_count:plans.length,is_demo:false}});for(let index=0;index<newSubmissionPayloads.length;index+=100){const chunk=newSubmissionPayloads.slice(index,index+100);const result=await(supabase as any).from('card_grading_submissions').upsert(chunk,{onConflict:'tenant_id,submission_number',ignoreDuplicates:true});if(result.error)throw result.error}const submissionNumbers=[...groups.keys()];const submissionRows=await fetchTenantRowsByValues(tenantId,'card_grading_submissions','submission_number',submissionNumbers,'id,submission_number');const submissionIdMap=new Map(submissionRows.map((item:any)=>[String(item.submission_number),String(item.id)]));const submissionIds=[...submissionIdMap.values()];const existingSequences=await fetchTenantRowsByValues(tenantId,'card_grading_cards','submission_id',submissionIds,'submission_id,sequence_number');const used=new Map<string,Set<number>>();for(const item of existingSequences){const key=String(item.submission_id);if(!used.has(key))used.set(key,new Set());used.get(key)!.add(Number(item.sequence_number)||0)}const nextSeq=new Map<string,number>();for(const id of submissionIds){const values=[...(used.get(id)||new Set<number>())];nextSeq.set(id,Math.max(0,...values)+1)}const importedAt=new Date().toISOString();const cards=safe.map(plan=>{const submissionId=submissionIdMap.get(String(plan.submission.submission_number));if(!submissionId)throw new Error('Submission resolution failed for '+plan.submission.submission_number);if(!used.has(submissionId))used.set(submissionId,new Set());const usedSet=used.get(submissionId)!;let sequence=Number(plan.card.sequence_number)||0;if(sequence<1||usedSet.has(sequence)){sequence=nextSeq.get(submissionId)||1;while(usedSet.has(sequence))sequence+=1;nextSeq.set(submissionId,sequence+1)}usedSet.add(sequence);const metadata={legacy_migration:{source:'owner_upload',source_file:fileName||'legacy-export',source_row:plan.rowNumber,legacy_id:plan.card.legacy_id||null,imported_at:importedAt,front_source:plan.card.front_source||null,back_source:plan.card.back_source||null,media_status:plan.card.front_source||plan.card.back_source?'pending_google_drive':'none'}};return{tenant_id:tenantId,submission_id:submissionId,sequence_number:sequence,cert_number:plan.card.cert_number,category:plan.card.category,year:plan.card.year,brand_set:plan.card.brand_set,player_character:plan.card.player_character,card_number:plan.card.card_number,variation:plan.card.variation,card_description:plan.card.card_description,declared_value:plan.card.declared_value,grade:plan.card.grade,grade_label:plan.card.grade_label,status:plan.card.status||'received',front_image_url:null,back_image_url:null,grader_notes:plan.card.grader_notes,import_key:plan.importKey,metadata,is_demo:false}});const withCert=cards.filter(card=>card.cert_number);const withoutCert=cards.filter(card=>!card.cert_number);for(let index=0;index<withCert.length;index+=100){const result=await(supabase as any).from('card_grading_cards').upsert(withCert.slice(index,index+100),{onConflict:'tenant_id,cert_number',ignoreDuplicates:true});if(result.error)throw result.error}for(let index=0;index<withoutCert.length;index+=100){const result=await(supabase as any).from('card_grading_cards').upsert(withoutCert.slice(index,index+100),{onConflict:'tenant_id,import_key',ignoreDuplicates:true});if(result.error)throw result.error}toast({title:'Legacy migration committed',description:cards.length+' canonical card records imported safely. '+dryRun.summary.duplicates+' duplicate row(s) were left untouched.'});setDryRun(null);setLegacyRows([]);setHeaders([]);setFileName('');setMapping(emptyLegacyMapping());await onImported()}catch(error){toast({title:'Legacy migration could not commit',description:error instanceof Error?error.message:String(error),variant:'destructive'})}finally{setWorking(false)}}\nreturn <section className=\"mt-7 space-y-5\" data-pcg-legacy-migration=\"true\"><div className=\"border border-white/[0.08] bg-[#09090a]/90 p-5\"><div className=\"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between\"><div><div className=\"flex items-center gap-2 text-[10px] font-black uppercase tracking-[.17em] text-[#d8bb78]\"><Database className=\"h-4 w-4\"/>Legacy Migration Studio</div><h2 className=\"mt-2 text-2xl font-black\">Bring the old PCG history with you.</h2><p className=\"mt-2 max-w-3xl text-sm leading-6 text-white/45\">Stage a CSV or TSV export, map the columns, run a zero-write dry check, then commit only clean canonical records. Historical image references are recorded for later Google Drive migration; they are never copied into KNOCKLAUNCH storage here.</p></div><div className=\"flex flex-wrap gap-2\"><button type=\"button\" onClick={downloadTemplate} className=\"inline-flex h-10 items-center gap-2 border border-white/[0.10] px-3 text-xs font-black text-white/65\"><Download className=\"h-4 w-4\"/>CSV template</button>{dryRun?.issues.length?<button type=\"button\" onClick={exportIssues} className=\"inline-flex h-10 items-center gap-2 border border-white/[0.10] px-3 text-xs font-black text-white/65\"><FileWarning className=\"h-4 w-4\"/>Export report</button>:null}</div></div></div><label className=\"group flex min-h-[150px] cursor-pointer flex-col justify-between border border-dashed border-[#d8bb78]/25 bg-[#d8bb78]/[0.025] p-5 transition hover:bg-[#d8bb78]/[0.05]\"><input type=\"file\" accept=\".csv,.tsv,text/csv,text/tab-separated-values\" className=\"hidden\" onChange={event=>{const file=event.target.files?.[0];if(file)void loadFile(file)}}/><FileSpreadsheet className=\"h-6 w-6 text-[#d8bb78]\"/><div><div className=\"text-lg font-black\">{fileName||'Choose a legacy export'}</div><div className=\"mt-1 text-xs text-white/35\">{legacyRows.length?legacyRows.length.toLocaleString()+' data row(s) loaded · '+headers.length+' source columns detected':'CSV and TSV supported · quoted commas and quoted fields are parsed safely'}</div></div></label>{headers.length?<details open className=\"border border-white/[0.08] bg-[#09090a]/80\"><summary className=\"cursor-pointer list-none px-5 py-4\"><div className=\"text-sm font-black\">Column mapping</div><div className=\"mt-1 text-xs text-white/34\">Auto-mapped common names. Change anything that does not match Anthony’s export.</div></summary><div className=\"grid gap-3 border-t border-white/[0.07] p-4 md:grid-cols-2 xl:grid-cols-3\">{LEGACY_FIELD_DEFS.map(def=><label key={def.key} className=\"block\"><span className=\"text-[10px] font-bold uppercase tracking-[.12em] text-white/34\">{def.label}</span><select value={mapping[def.key]} onChange={event=>changeMapping(def.key,event.target.value)} className=\"mt-2 h-10 w-full border border-white/[0.10] bg-black/45 px-2 text-xs text-white\"><option value=\"\">Not mapped</option>{headers.map(header=><option key={header} value={header}>{header}</option>)}</select></label>)}</div></details>:null}<div className=\"flex flex-col gap-3 border border-white/[0.08] bg-[#09090a]/80 p-4 sm:flex-row sm:items-center\"><div className=\"mr-auto\"><div className=\"text-sm font-black\">Dry-run first. Always.</div><div className=\"mt-1 text-xs text-white/34\">Nothing writes until a clean dry-run exists and you press Commit migration.</div></div><button type=\"button\" disabled={working||!legacyRows.length} onClick={()=>void runDryRun()} className=\"inline-flex h-11 items-center justify-center gap-2 border border-[#d8bb78]/30 px-4 text-xs font-black text-[#ead49d] disabled:opacity-35\">{working?<Loader2 className=\"h-4 w-4 animate-spin\"/>:<ShieldCheck className=\"h-4 w-4\"/>}Run dry check</button><button type=\"button\" disabled={working||!dryRun||dryRun.summary.conflicts>0||dryRun.summary.safeCards<1} onClick={()=>void commitMigration()} className=\"inline-flex h-11 items-center justify-center gap-2 bg-[#d8bb78] px-4 text-xs font-black text-black disabled:opacity-35\">{working?<Loader2 className=\"h-4 w-4 animate-spin\"/>:<CheckCircle2 className=\"h-4 w-4\"/>}Commit migration</button></div>{dryRun?<><div className=\"grid gap-px overflow-hidden border border-white/[0.08] bg-white/[0.08] sm:grid-cols-2 xl:grid-cols-6\">{[['Rows',dryRun.summary.rows],['Customers',dryRun.summary.customers],['Orders',dryRun.summary.submissions],['Safe cards',dryRun.summary.safeCards],['Duplicates',dryRun.summary.duplicates],['Conflicts',dryRun.summary.conflicts]].map(([label,value])=><div key={String(label)} className=\"bg-[#09090a] p-4\"><div className=\"text-[9px] font-black uppercase tracking-[.16em] text-white/28\">{label}</div><div className=\"mt-1 text-2xl font-black\">{Number(value).toLocaleString()}</div></div>)}</div><div className={cn('border p-4 text-sm',dryRun.summary.conflicts?'border-rose-400/20 bg-rose-400/[.05] text-rose-100':'border-emerald-400/20 bg-emerald-400/[.05] text-emerald-100')}><div className=\"font-black\">{dryRun.summary.conflicts?dryRun.summary.conflicts+' row(s) must be fixed before commit':'Dry run is commit-safe'}</div><div className=\"mt-1 text-xs leading-5 text-white/55\">{dryRun.summary.newSubmissions} new order(s) · {dryRun.summary.existingSubmissions} existing order(s) reused · {dryRun.summary.warnings} warning(s) · {dryRun.summary.mediaRefs} row(s) reference legacy media that will remain pending for Google Drive migration.</div></div><div className=\"border border-white/[0.08] bg-[#09090a]/82\"><div className=\"border-b border-white/[0.07] px-4 py-3 text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Row-level preview</div><div className=\"max-h-[420px] overflow-auto\">{dryRun.plans.slice(0,1000).map(plan=>{const hasError=plan.issues.some(issue=>issue.severity==='error');return <div key={plan.rowNumber} className=\"grid gap-2 border-b border-white/[0.05] px-4 py-3 text-xs md:grid-cols-[70px_1fr_1fr_auto] md:items-center\"><div className=\"font-black text-white/45\">Row {plan.rowNumber}</div><div className=\"min-w-0\"><div className=\"truncate font-bold text-white/75\">{plan.submission.submission_number||'No order number'}</div><div className=\"truncate text-[10px] text-white/30\">{plan.submission.customer_name||plan.submission.customer_email||'Customer not mapped'}</div></div><div className=\"min-w-0\"><div className=\"truncate font-bold text-white/65\">{plan.card.player_character||plan.card.card_description||plan.card.brand_set||plan.card.cert_number||'Card'}</div><div className=\"truncate text-[10px] text-white/30\">{plan.card.cert_number?'Cert '+plan.card.cert_number:plan.importKey}</div></div><div className={cn('text-[10px] font-black uppercase tracking-[.12em]',hasError?'text-rose-300':plan.duplicate?'text-amber-300':'text-emerald-300')}>{hasError?'Conflict':plan.duplicate?'Duplicate':'Ready'}</div>{plan.issues.length?<div className=\"md:col-start-2 md:col-span-3 space-y-1\">{plan.issues.map((issue,index)=><div key={index} className={issue.severity==='error'?'text-rose-200':'text-amber-100'}>{issue.field}: {issue.message}</div>)}</div>:null}</div>})}</div></div></>:null}</section>}\n\nexport function PCGCardVaultContent({initialMode='overview'}:{initialMode?:VaultMode}={}){const{activeTenant}=useMultiTenant();const{toast}=useToast();const tenantId=activeTenant?.id||'';const[mode,setMode]=useState<VaultMode>(initialMode);useEffect(()=>{setMode(initialMode)},[initialMode]);const[form,setForm]=useState<CardForm>(EMPTY_FORM);const[front,setFront]=useState<File|null>(null);const[reverse,setReverse]=useState<File|null>(null);const[saving,setSaving]=useState(false);const[rows,setRows]=useState<CsvRow[]>([]);const[items,setItems]=useState<BatchItem[]>([]);const[session,setSession]=useState('');const[running,setRunning]=useState(false);const[recent,setRecent]=useState<StoredCard[]>([]);const[total,setTotal]=useState(0);const[submissionOptions,setSubmissionOptions]=useState<SubmissionOption[]>([]);const[selectedSubmissionId,setSelectedSubmissionId]=useState('');const[driveState,setDriveState]=useState<DriveState>('checking');const stop=useRef(false);const done=items.filter(item=>item.status==='done').length;const failed=items.filter(item=>item.status==='failed').length;const remaining=items.filter(item=>item.status==='queued'||item.status==='failed');const progress=items.length?Math.round(((done+failed)/items.length)*100):0;const selectedSubmission=submissionOptions.find(item=>item.id===selectedSubmissionId)||null;const driveReady=driveState==='ready';\nasync function load(){if(!tenantId)return;setDriveState('checking');const[cardsResult,submissionResult,googleResult]=await Promise.all([(supabase as any).from('card_grading_cards').select('id,player_character,brand_set,year,card_number,front_image_url,grade,cert_number,metadata',{count:'exact'}).eq('tenant_id',tenantId).order('created_at',{ascending:false}).limit(12),(supabase as any).from('card_grading_submissions').select('id,submission_number,customer_name,status').eq('tenant_id',tenantId).order('created_at',{ascending:false}).limit(50),(supabase as any).from('tenant_provider_credentials').select('credential_status,metadata').eq('tenant_id',tenantId).eq('provider','google_workspace').maybeSingle()]);setRecent(cardsResult.data||[]);setTotal(Number(cardsResult.count||0));const eligible=((submissionResult.data||[]) as SubmissionOption[]).filter(item=>['received','intake_imaging','authentication','grading','encapsulation','qa'].includes(String(item.status||'')));setSubmissionOptions(eligible);setSelectedSubmissionId(current=>eligible.some(item=>item.id===current)?current:(eligible[0]?.id||''));const google=googleResult.data as any;const scopes=Array.isArray(google?.metadata?.granted_scopes)?google.metadata.granted_scopes.map((value:unknown)=>String(value)):[];setDriveState(google?.credential_status==='active'?(scopes.includes('https://www.googleapis.com/auth/drive.file')?'ready':'reconnect'):'missing')}useEffect(()=>{void load()},[tenantId]);\nasync function createSubmission(label:string){const{data,error}=await(supabase as any).from('card_grading_submissions').insert({tenant_id:tenantId,submission_number:`VAULT-${Date.now()}-${crypto.randomUUID().slice(0,6)}`,customer_name:'PCG Card Vault',service_tier:'inventory',service_price:0,status:'received',notes:label,payment_status:'unverified'}).select('id').single();if(error)throw error;return data.id}\nasync function upload(file:File,sessionKey:string,key:string,side:string,importKey:string):Promise<DriveMedia>{const{data}=await supabase.auth.getSession();if(!data.session?.access_token)throw new Error('Please sign in again.');const params=new URLSearchParams({tenant_id:tenantId,session_key:sessionKey,import_key:importKey,key,side,name:file.name,content_type:file.type||'application/octet-stream'});const response=await fetch(DRIVE_MEDIA_FN+'/upload?'+params.toString(),{method:'POST',headers:{Authorization:'Bearer '+data.session.access_token,'Content-Type':file.type||'application/octet-stream'},body:file});const payload=await response.json().catch(()=>null);if(!response.ok||!payload?.ok)throw new Error(payload?.error||'Google Drive upload failed');return{url:String(payload.url||''),fileId:String(payload.file_id||'')}}\nasync function storeCard(submissionId:string,importKey:string,frontMedia:DriveMedia|null,backMedia:DriveMedia|null,row?:CsvRow,values:Partial<CardForm>={},target?:{id?:string;sequenceNumber?:number}){const metadata={title:values.title||rowValue(row,'title','name'),grading_company:values.grader||rowValue(row,'grading_company','grader'),condition:values.condition||rowValue(row,'condition'),quantity:Number(values.qty||rowValue(row,'quantity')||1)||1,acquisition_cost:money(values.cost||rowValue(row,'acquisition_cost','cost')),estimated_value:money(values.value||rowValue(row,'estimated_value','value')),tags:String(values.tags||rowValue(row,'tags')).split(/[;,]/).map(item=>item.trim()).filter(Boolean),notes:values.notes||rowValue(row,'notes'),...(frontMedia?.fileId||backMedia?.fileId?{image_storage:'google_workspace_drive',drive_media:{provider:'google_workspace',front_file_id:frontMedia?.fileId||null,back_file_id:backMedia?.fileId||null}}:{})};const payload={tenant_id:tenantId,submission_id:submissionId,sequence_number:target?.sequenceNumber||1,category:values.category||rowValue(row,'category','sport'),year:values.year||rowValue(row,'year'),brand_set:values.set||rowValue(row,'brand_set','set','brand'),player_character:values.player||rowValue(row,'player','subject'),card_number:values.number||rowValue(row,'card_number','card_no'),declared_value:money(values.value||rowValue(row,'estimated_value','value')),grade:money(values.grade||rowValue(row,'grade')),grade_label:values.condition||rowValue(row,'condition'),cert_number:values.cert||rowValue(row,'cert_number','cert','serial'),front_image_url:frontMedia?.url||null,back_image_url:backMedia?.url||null,grader_notes:values.notes||rowValue(row,'notes')||null,status:'received',import_key:importKey,metadata};if(target?.id){const{error}=await(supabase as any).from('card_grading_cards').update(payload).eq('tenant_id',tenantId).eq('id',target.id);if(error)throw error;return}const{error}=await(supabase as any).from('card_grading_cards').upsert(payload,{onConflict:'tenant_id,import_key',ignoreDuplicates:true});if(error)throw error}\nasync function saveSingle(){if(!front&&!reverse)return toast({title:'Add at least one card image'});if(!driveReady)return toast({title:'Google Workspace Drive required',description:driveState==='reconnect'?'Reconnect Google Workspace so PCG has Drive file access.':'Connect Google Workspace before storing new PCG card images.',variant:'destructive'});setSaving(true);try{const sessionKey='single-'+crypto.randomUUID();const submissionId=await createSubmission('Single Card Vault upload');const frontMedia=front?await upload(front,sessionKey,'card','front',sessionKey):null;const backMedia=reverse?await upload(reverse,sessionKey,'card','back',sessionKey):null;await storeCard(submissionId,sessionKey,frontMedia,backMedia,undefined,form);setForm(EMPTY_FORM);setFront(null);setReverse(null);toast({title:'Card stored in PCG',description:'Master imagery is stored in the connected PCG Google Drive.'});await load()}catch(error){toast({title:'Could not save card',description:error instanceof Error?error.message:String(error),variant:'destructive'})}finally{setSaving(false)}}\nasync function runBatch(batch:BatchItem[]){if(!session||!batch.length)return;if(!selectedSubmissionId)return toast({title:'Select a grading order first',description:'Mass Intake attaches images to an existing collector order.',variant:'destructive'});if(!driveReady)return toast({title:'Google Workspace Drive required',description:driveState==='reconnect'?'Reconnect Google Workspace so PCG has Drive file access.':'Connect Google Workspace before starting image intake.',variant:'destructive'});const selected=submissionOptions.find(item=>item.id===selectedSubmissionId);if(!selected)return toast({title:'That grading order is no longer available',description:'Choose another open PCG order.',variant:'destructive'});setRunning(true);stop.current=false;let failedCount=0;try{const existingResult=await(supabase as any).from('card_grading_cards').select('id,sequence_number,import_key,front_image_url,back_image_url').eq('tenant_id',tenantId).eq('submission_id',selectedSubmissionId).order('sequence_number',{ascending:true});if(existingResult.error)throw existingResult.error;const existingCards=(existingResult.data||[]) as ExistingBatchCard[];const byImport=new Map(existingCards.filter(card=>card.import_key).map(card=>[String(card.import_key),card]));const blankSlots=existingCards.filter(card=>!card.import_key&&!card.front_image_url&&!card.back_image_url).sort((a,b)=>a.sequence_number-b.sequence_number);let nextSequence=Math.max(0,...existingCards.map(card=>Number(card.sequence_number)||0))+1;const plans=batch.map(item=>{const importKey=('pcg:'+selectedSubmissionId+':'+item.key).toLowerCase().replace(/[^a-z0-9:._-]+/g,'-');const existing=byImport.get(importKey);if(existing)return{item,importKey,existing:true,targetId:existing.id,sequenceNumber:existing.sequence_number};const slot=blankSlots.shift();return{item,importKey,existing:false,targetId:slot?.id,sequenceNumber:slot?.sequence_number||nextSequence++}});let cursor=0;const worker=async()=>{while(!stop.current){const index=cursor++;if(index>=plans.length)return;const plan=plans[index];const item=plan.item;try{setItems(current=>current.map(row=>row.key===item.key?{...row,status:'uploading',error:undefined}:row));if(!plan.existing){const frontMedia=item.front?await upload(item.front,session,item.key,'front',plan.importKey):null;const backMedia=item.back?await upload(item.back,session,item.key,'back',plan.importKey):null;await storeCard(selectedSubmissionId,plan.importKey,frontMedia,backMedia,item.row,undefined,{id:plan.targetId,sequenceNumber:plan.sequenceNumber})}setItems(current=>current.map(row=>row.key===item.key?{...row,status:'done'}:row))}catch(error){failedCount+=1;setItems(current=>current.map(row=>row.key===item.key?{...row,status:'failed',error:error instanceof Error?error.message:String(error)}:row))}}};await Promise.all(Array.from({length:Math.min(CONCURRENCY,plans.length)},worker));if(!stop.current&&failedCount===0&&selected.status==='received'){const advanced=await(supabase as any).rpc('advance_pcg_grading_submission',{p_tenant_id:tenantId,p_submission_id:selectedSubmissionId,p_status:'intake_imaging'});if(advanced.error)throw advanced.error}toast({title:stop.current?'Batch paused':failedCount?'Batch needs attention':'Order intake complete',description:failedCount?failedCount+' card'+(failedCount===1?'':'s')+' can be retried safely.':selected.submission_number+' now owns these canonical card records and Drive images.'});await load()}catch(error){toast({title:'Mass intake could not finish',description:error instanceof Error?error.message:String(error),variant:'destructive'})}finally{setRunning(false)}}const update=(key:keyof CardForm,value:string)=>setForm(current=>({...current,[key]:value}));\nreturn <div className=\"pcg-card-vault w-full text-white\"><style>{`.pcg-card-vault .text-white\\\\/18,.pcg-card-vault .text-white\\\\/24,.pcg-card-vault .text-white\\\\/28,.pcg-card-vault .text-white\\\\/30,.pcg-card-vault .text-white\\\\/32,.pcg-card-vault .text-white\\\\/34,.pcg-card-vault .text-white\\\\/35,.pcg-card-vault .text-white\\\\/36,.pcg-card-vault .text-white\\\\/38,.pcg-card-vault .text-white\\\\/42,.pcg-card-vault .text-white\\\\/44,.pcg-card-vault .text-white\\\\/48{color:rgba(255,255,255,.72)!important}`}</style><section className=\"border-b border-white/[0.08] pb-6\"><div className=\"flex flex-col gap-5 xl:flex-row xl:items-end xl:justify-between\"><div><div className=\"flex items-center gap-2 text-[10px] font-black uppercase tracking-[.19em] text-[#d8bb78]\"><ScanLine className=\"h-4 w-4\"/>PCG Card Vault</div><h1 className=\"mt-3 text-[34px] font-black leading-none tracking-[-0.045em] sm:text-[46px]\">Card Vault</h1><p className=\"mt-3 max-w-2xl text-sm leading-6 text-white/44\">Capture one card or move an entire collection into PCG. Master imagery stays in the connected PCG Google Drive.</p></div><div className=\"flex max-w-full flex-wrap items-center rounded-2xl border border-white/[0.08] bg-black/28 p-1\"><ModeButton active={mode==='overview'} onClick={()=>setMode('overview')}>Overview</ModeButton><ModeButton active={mode==='single'} onClick={()=>setMode('single')}>Single intake</ModeButton><ModeButton active={mode==='batch'} onClick={()=>setMode('batch')}>Mass intake</ModeButton><ModeButton active={mode==='migration'} onClick={()=>setMode('migration')}>Legacy migration</ModeButton><ModeButton active={mode==='growth'} onClick={()=>setMode('growth')}>Growth Lab</ModeButton></div></div><div className=\"mt-7 grid sm:grid-cols-4\"><Stat icon={Archive} label=\"Cards on file\" value={total.toLocaleString()} detail=\"Canonical PCG records\"/><Stat icon={Layers3} label=\"Current batch\" value={items.length.toLocaleString()} detail={items.length?`${done} stored so far`:'No intake running'}/><Stat icon={PackageCheck} label=\"Exceptions\" value={failed.toLocaleString()} detail={failed?'Ready to retry safely':'No failed uploads'}/><Stat icon={ShieldCheck} label=\"Storage\" value=\"Google Drive\" detail=\"PCG-owned master imagery\"/></div></section>{mode==='overview'?<PCGGrowthPulse tenantId={tenantId} onOpen={()=>setMode('growth')}/>:null}\n{mode==='overview'?<div className=\"mt-7 grid gap-7 xl:grid-cols-[minmax(0,1.15fr)_minmax(350px,.85fr)]\"><section><div className=\"mb-3 text-[10px] font-black uppercase tracking-[.17em] text-white/30\">Start an intake</div><div className=\"grid gap-px overflow-hidden border border-white/[0.08] bg-white/[0.08] md:grid-cols-3\"><button onClick={()=>setMode('single')} className=\"group min-h-[210px] bg-[#09090a]/94 p-5 text-left transition hover:bg-[#0d0d0f]\"><div className=\"flex items-start justify-between\"><ImagePlus className=\"h-6 w-6 text-[#d8bb78]\"/><ArrowUpRight className=\"h-5 w-5 text-white/18 transition group-hover:text-[#d8bb78]\"/></div><div className=\"mt-14\"><h2 className=\"text-xl font-black tracking-tight\">Single card intake</h2><p className=\"mt-2 text-sm leading-6 text-white/38\">Front/back imagery, identity, grade, cert, value, cost, tags and notes.</p></div></button><button onClick={()=>setMode('batch')} className=\"group min-h-[210px] bg-[#09090a]/94 p-5 text-left transition hover:bg-[#0d0d0f]\"><div className=\"flex items-start justify-between\"><UploadCloud className=\"h-6 w-6 text-[#d8bb78]\"/><ArrowUpRight className=\"h-5 w-5 text-white/18 transition group-hover:text-[#d8bb78]\"/></div><div className=\"mt-14\"><h2 className=\"text-xl font-black tracking-tight\">Mass card intake</h2><p className=\"mt-2 text-sm leading-6 text-white/38\">Hundreds or thousands, front/back pairing, optional CSV, pause and safe retry.</p></div></button><button onClick={()=>setMode('migration')} className=\"group min-h-[210px] bg-[#09090a]/94 p-5 text-left transition hover:bg-[#0d0d0f]\"><div className=\"flex items-start justify-between\"><Database className=\"h-6 w-6 text-[#d8bb78]\"/><ArrowUpRight className=\"h-5 w-5 text-white/18 transition group-hover:text-[#d8bb78]\"/></div><div className=\"mt-14\"><h2 className=\"text-xl font-black tracking-tight\">Legacy migration</h2><p className=\"mt-2 text-sm leading-6 text-white/38\">Stage historical exports, map fields, dry-run conflicts and commit only clean canonical records.</p></div></button></div></section><section className=\"border-l border-white/[0.08] xl:pl-7\"><div className=\"flex items-center justify-between\"><div><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Storage contract</div><h2 className=\"mt-2 text-lg font-black\">Built for volume</h2></div><Database className=\"h-5 w-5 text-[#d8bb78]\"/></div><div className=\"mt-5 divide-y divide-white/[0.07]\">{[['Google Drive masters','New originals live in the connected PCG Google Workspace, not KnockLaunch storage.'],['Safe retry','Completed imports keep a stable identity.'],['Canonical records','Single and batch intake write to the same card records.']].map(([title,copy])=><div key={title} className=\"py-4 first:pt-0\"><div className=\"flex items-center gap-2 text-sm font-bold text-white/80\"><CheckCircle2 className=\"h-4 w-4 text-emerald-400\"/>{title}</div><p className=\"mt-1.5 pl-6 text-xs leading-5 text-white/32\">{copy}</p></div>)}</div></section></div>:null}\n{mode==='growth'?<div className=\"mt-7\"><PCGGrowthLab tenantId={tenantId}/></div>:null}\n{mode==='migration'?<LegacyMigrationStudio tenantId={tenantId} onImported={load}/>:null}\n{mode==='single'?<section className=\"mt-7 grid gap-7 xl:grid-cols-[minmax(0,1.35fr)_minmax(320px,.65fr)]\"><div><div className=\"border-b border-white/[0.08] pb-4\"><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Card record</div><h2 className=\"mt-2 text-xl font-black\">Identification & grading</h2></div><div className=\"mt-6 grid gap-x-7 gap-y-5 sm:grid-cols-2\"><Field label=\"Title\" value={form.title} onChange={value=>update('title',value)}/><Field label=\"Player / subject\" value={form.player} onChange={value=>update('player',value)}/><Field label=\"Year\" value={form.year} onChange={value=>update('year',value)}/><Field label=\"Set / brand\" value={form.set} onChange={value=>update('set',value)}/><Field label=\"Card number\" value={form.number} onChange={value=>update('number',value)}/><Field label=\"Sport / category\" value={form.category} onChange={value=>update('category',value)}/><Field label=\"Grading company\" value={form.grader} onChange={value=>update('grader',value)}/><Field label=\"Grade\" value={form.grade} onChange={value=>update('grade',value)}/><Field label=\"Certification / serial\" value={form.cert} onChange={value=>update('cert',value)}/><Field label=\"Condition\" value={form.condition} onChange={value=>update('condition',value)}/><Field label=\"Quantity\" value={form.qty} onChange={value=>update('qty',value)}/><Field label=\"Acquisition cost\" value={form.cost} onChange={value=>update('cost',value)} placeholder=\"$0.00\"/><Field label=\"Estimated value\" value={form.value} onChange={value=>update('value',value)} placeholder=\"$0.00\"/><Field label=\"Tags\" value={form.tags} onChange={value=>update('tags',value)} placeholder=\"rookie, refractor, auto\"/></div><label className=\"mt-6 block\"><span className=\"text-[10px] font-bold uppercase tracking-[.13em] text-white/34\">Internal notes</span><textarea value={form.notes} onChange={event=>update('notes',event.target.value)} rows={4} className=\"mt-2 w-full border border-white/[0.09] bg-black/24 p-4 text-sm leading-6 text-white outline-none focus:border-[#d8bb78]/40\"/></label></div><div className=\"self-start border-l border-white/[0.08] xl:pl-7\"><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Card imagery</div><div className=\"mt-4 grid gap-px overflow-hidden border border-white/[0.08] bg-white/[0.08]\"><ImageTile label=\"Front\" file={front} onFile={setFront}/><ImageTile label=\"Back\" file={reverse} onFile={setReverse}/></div><button onClick={()=>void saveSingle()} disabled={saving} className=\"mt-4 flex h-12 w-full items-center justify-center gap-2 bg-[#d8bb78] text-sm font-black text-[#09090a] transition hover:bg-[#e3c886] disabled:opacity-50\">{saving?<Loader2 className=\"h-4 w-4 animate-spin\"/>:<Archive className=\"h-4 w-4\"/>}{saving?'Storing card…':'Store in PCG'}</button></div></section>:null}\n{mode==='batch'?<section className=\"mt-7 space-y-5\"><div className=\"border border-white/[0.08] bg-[#09090a]/90 p-5\"><div className=\"flex flex-col gap-4 lg:flex-row lg:items-end\"><label className=\"min-w-0 flex-1\"><span className=\"text-[10px] font-black uppercase tracking-[.16em] text-[#d8bb78]\">1 · Choose the collector order</span><select value={selectedSubmissionId} onChange={event=>{setSelectedSubmissionId(event.target.value);setSession('');setRows([]);setItems([])}} disabled={running} className=\"mt-2 h-12 w-full border border-white/[0.10] bg-black/45 px-3 text-sm font-bold text-white outline-none focus:border-[#d8bb78]/55\"><option value=\"\">Select an open PCG order</option>{submissionOptions.map(option=><option key={option.id} value={option.id}>{option.submission_number} · {option.customer_name||'Collector'} · {option.status.replaceAll('_',' ')}</option>)}</select></label><div className=\"flex flex-wrap items-center gap-2 lg:justify-end\"><span className={cn('inline-flex h-10 items-center gap-2 border px-3 text-xs font-black',driveReady?'border-emerald-400/25 bg-emerald-400/[.07] text-emerald-200':'border-amber-400/25 bg-amber-400/[.07] text-amber-100')}><ShieldCheck className=\"h-4 w-4\"/>{driveState==='checking'?'Checking Drive…':driveReady?'Google Drive ready':driveState==='reconnect'?'Reconnect Google Workspace':'Google Workspace required'}</span><a href=\"?mode=received&tool=submissions\" className=\"inline-flex h-10 items-center border border-white/[0.10] px-3 text-xs font-black text-white/65\">Orders</a>{!driveReady&&driveState!=='checking'?<a href=\"?mode=received&tool=settings\" className=\"inline-flex h-10 items-center border border-[#d8bb78]/25 px-3 text-xs font-black text-[#ead49d]\">Open settings</a>:null}</div></div><p className=\"mt-3 text-xs leading-5 text-white/42\">{selectedSubmission?'Images and CSV details will become the canonical cards for '+selectedSubmission.submission_number+' · '+(selectedSubmission.customer_name||'Collector')+'. No second submission is created.':'Create or choose the customer’s grading order before loading card images.'}</p></div>{!submissionOptions.length?<div className=\"border border-dashed border-amber-300/20 bg-amber-300/[.04] p-5 text-sm text-amber-100/80\">No open PCG grading orders are available. Create the collector order from <a href=\"?mode=received&tool=submissions\" className=\"font-black text-[#ead49d] underline underline-offset-4\">Orders</a>, then return to Mass Intake.</div>:null}{driveState==='missing'||driveState==='reconnect'?<div className=\"border border-dashed border-amber-300/20 bg-amber-300/[.04] p-5\"><div className=\"text-sm font-black text-amber-100\">{driveState==='reconnect'?'Google Workspace needs Drive permission':'Connect PCG Google Workspace before image intake'}</div><p className=\"mt-1 text-xs leading-5 text-white/45\">New PCG master images are stored in Anthony’s Google Drive. Intake stays locked until that private Drive connection is ready.</p></div>:null}<div className=\"grid gap-px overflow-hidden border border-white/[0.08] bg-white/[0.08] lg:grid-cols-2\"><label className={cn('group flex min-h-[180px] flex-col justify-between bg-[#09090a]/94 p-5',selectedSubmissionId&&driveReady&&!running?'cursor-pointer':'cursor-not-allowed opacity-45')}><input type=\"file\" multiple accept=\"image/*\" disabled={!selectedSubmissionId||!driveReady||running} className=\"hidden\" onChange={event=>{if(!event.target.files)return;setSession('batch-'+crypto.randomUUID());setRows([]);setItems(pairFiles(Array.from(event.target.files),[]))}}/><UploadCloud className=\"h-6 w-6 text-[#d8bb78]\"/><div><h2 className=\"text-xl font-black\">2 · Choose the card image batch</h2><p className=\"mt-2 text-sm leading-6 text-white/36\">Front/back filenames pair automatically. The selected order owns every imported card.</p></div></label><label className={cn('group flex min-h-[180px] flex-col justify-between bg-[#09090a]/94 p-5',items.length&&!running?'cursor-pointer':'cursor-not-allowed opacity-45')}><input type=\"file\" accept=\".csv,text/csv\" disabled={!items.length||running} className=\"hidden\" onChange={event=>event.target.files?.[0]?.text().then(text=>{const parsed=parseCsv(text);setRows(parsed);setItems(current=>current.map(item=>({...item,row:parsed.find(row=>fileStem(rowValue(row,'filename','file','front','image')).toLowerCase()===item.key.toLowerCase())})))})}/><FileSpreadsheet className=\"h-6 w-6 text-[#d8bb78]\"/><div><h2 className=\"text-xl font-black\">3 · Attach CSV details <span className=\"text-white/30\">(optional)</span></h2><p className=\"mt-2 text-sm leading-6 text-white/36\">Map filenames, player, set, year and card number into those same canonical order records.</p></div></label></div><div className=\"border border-white/[0.08] bg-[#09090a]/82\"><div className=\"flex flex-col gap-4 border-b border-white/[0.07] p-5 sm:flex-row sm:items-center\"><div className=\"mr-auto\"><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Mass intake queue</div><div className=\"mt-1 text-lg font-black\">{items.length.toLocaleString()} cards <span className=\"font-medium text-white/30\">· {done} stored · {failed} failed</span></div>{selectedSubmission?<div className=\"mt-1 text-xs font-bold text-[#d8bb78]/80\">{selectedSubmission.submission_number} · {selectedSubmission.customer_name||'Collector'}</div>:null}</div>{running?<button onClick={()=>{stop.current=true}} className=\"inline-flex h-10 items-center gap-2 border border-white/[0.10] px-4 text-xs font-bold\"><PauseCircle className=\"h-4 w-4\"/>Pause intake</button>:<button disabled={!remaining.length||!selectedSubmissionId||!driveReady} onClick={()=>void runBatch(remaining)} className=\"inline-flex h-10 items-center gap-2 bg-[#d8bb78] px-4 text-xs font-black text-black disabled:opacity-35\"><UploadCloud className=\"h-4 w-4\"/>{!driveReady?'Google Drive required':!selectedSubmissionId?'Select an order':failed?'Retry remaining':'Start mass intake'}</button>}</div><div className=\"h-1 bg-white/[0.05]\"><div className=\"h-full bg-[#d8bb78]\" style={{width:`${progress}%`}}/></div><div className=\"max-h-[360px] overflow-auto p-2\">{!items.length?<div className=\"grid min-h-44 place-items-center text-center\"><div><Layers3 className=\"mx-auto h-7 w-7 text-white/16\"/><div className=\"mt-3 text-sm font-bold text-white/48\">No card batch loaded</div><div className=\"mt-1 text-xs text-white/28\">Choose an order, then load its card images.</div></div></div>:items.slice(0,2000).map((item,index)=><div key={`${item.key}-${index}`} className=\"grid grid-cols-[1fr_auto] items-center gap-3 px-3 py-2.5 text-sm\"><div className=\"min-w-0\"><div className=\"truncate font-semibold text-white/72\">{item.key}</div><div className=\"truncate text-[10px] text-white/24\">{item.front?.name}{item.back?' + back':''}</div></div>{item.status==='done'?<CheckCircle2 className=\"h-4 w-4 text-emerald-400\"/>:item.status==='failed'?<XCircle className=\"h-4 w-4 text-rose-400\"/>:item.status==='uploading'?<Loader2 className=\"h-4 w-4 animate-spin text-[#d8bb78]\"/>:<span className=\"text-[10px] text-white/24\">Queued</span>}</div>)}</div></div></section>:null}\n<section className=\"mt-8 border-t border-white/[0.08] pt-6\"><div className=\"flex items-end justify-between\"><div><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/28\">Card Vault</div><h2 className=\"mt-1 text-lg font-black\">Recently stored</h2></div><button onClick={()=>void load()} className=\"grid h-9 w-9 place-items-center border border-white/[0.08] text-white/36\"><RefreshCw className=\"h-4 w-4\"/></button></div>{recent.length?<div className=\"mt-4 grid grid-cols-2 gap-px overflow-hidden border border-white/[0.07] bg-white/[0.07] sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 xl:grid-cols-8 2xl:grid-cols-9\">{recent.map(card=><article key={card.id} className=\"bg-black/48\"><div className=\"relative aspect-[3/4] overflow-hidden bg-[#080809]\">{card.metadata?.demo?<DemoCardFace card={card}/>:card.front_image_url?<img src={card.front_image_url} alt=\"\" className=\"h-full w-full object-contain p-2\"/>:<div className=\"grid h-full place-items-center\"><Archive className=\"h-7 w-7 text-white/12\"/></div>}{card.grade?<div className=\"absolute right-2 top-2 z-10 bg-black/78 px-2 py-1 text-[10px] font-black text-[#e5cd93]\">{card.grade}</div>:null}</div><div className=\"p-2.5\"><div className=\"truncate text-xs font-bold\">{card.player_character||card.brand_set||'Card'}</div><div className=\"mt-1 truncate text-[10px] text-white/30\">{[card.year,card.brand_set,card.card_number&&`#${card.card_number}`].filter(Boolean).join(' · ')||card.cert_number||'PCG record'}</div></div></article>)}</div>:<div className=\"mt-4 grid min-h-36 place-items-center border border-dashed border-white/[0.08] bg-black/20 text-center\"><div><Archive className=\"mx-auto h-7 w-7 text-white/12\"/><div className=\"mt-2 text-sm font-bold text-white/42\">The vault is ready.</div></div></div>}</section></div>}\nexport default function PCGWorkspace(){return <CRMShell><div className=\"mx-auto w-full max-w-[1500px] px-4 py-5 sm:px-6 sm:py-7 xl:px-9 xl:py-8\"><PCGCardVaultContent/></div></CRMShell>}\n","expectedSha":"32e289438ca9342cdc0f76fa0d1b4c0bda868337"}],"branch":"ai/objective-first-repair-83515a4a94d3","writes":[],"patches":[],"version":1,"approved":true,"missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36","repository":"noel/KnockLaunchOS","commitMessage":"PCG: add legacy migration studio","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/card-grading/PCGWorkspace.tsx"],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/card-grading/PCGWorkspace.tsx"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"452a93a4b9b3a0f8db2e8e42a25998ad34f421574ee3b466c9b988ba3496722a","replayCount":0,"serializedBytes":70328},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:30:57.221542+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:repository-mutation-intent:452a93a4b9b3a0f8db2e8e42a25998ad34f421574ee3b466c9b988ba3496722a:0","mission_step_id":"9397b175-1fb2-4877-b47c-c8446816e356","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"f42973f0-3d48-491f-b65b-6dc1a5b6138a","source":"cc-execution","status":"cancelled","payload":{"cancelled":true,"missionId":"d31923ac-371e-4a5b-9034-e02109a06e33"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:32:44.775743+00:00","proof_gate":"durable_mission_cancelled","source_sha":null,"external_id":null,"receipt_type":"owner_mission_cancelled","idempotency_key":"mission:d31923ac-371e-4a5b-9034-e02109a06e33:mission-cancel:d31923ac-371e-4a5b-9034-e02109a06e33","mission_step_id":"182ed2c1-daf6-47d6-be1b-5e3b4d4e5f3b","command_center_event_id":"d31923ac-371e-4a5b-9034-e02109a06e33"},{"id":"4703309b-6b21-4196-af9c-4ff5357a57ff","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a","objective":"Apply exact repository-authority decruft batch 5 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"workstreamKey":"repo-decruft-pr4073-batch5-c2eea2a4ff6c","anchored_edits":[{"path":"workers/cc-execution/src/index-runtime-verify-gate.js","edits":[{"new_content":"import { getRuntimeState } from \"./runtime-state.js\";\n\nconst SERVICE_NAME = \"cc-execution\";\nconst VERSION = \"1.7.2-provider-neutral-runtime-verification\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\nconst SUPABASE_PROJECT_REF = \"ymntrajfubicyxwwdxxa\";\n","old_content":"import { getRuntimeState } from \"./runtime-state.js\";\n\nconst SERVICE_NAME = \"cc-execution\";\nconst VERSION = \"1.7.1-render-onrunner-runtime-verification\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\nconst SUPABASE_PROJECT_REF = \"ymntrajfubicyxwwdxxa\";\n"},{"new_content":"  };\n}\n\nasync function edgeFunctionRuntimeProof(functionName, expectedVersion) {\n  const base = `https://${SUPABASE_PROJECT_REF}.supabase.co/functions/v1/${functionName}`;\n  const [health, openapi] = await Promise.all([","old_content":"  };\n}\n\nasync function renderOnRunnerRuntimeProof(expectedVersion, expectedSourceCommit = \"\") {\n  const [health, openapi] = await Promise.all([\n    fetchJson(`https://knocklaunch-visual-witness-runner.onrender.com/health?runtimeVerify=${Date.now()}`),\n    fetchJson(`https://knocklaunch-visual-witness-runner.onrender.com/openapi.json?runtimeVerify=${Date.now()}`)\n  ]);\n  const healthVersion = String(health.data?.version || \"\");\n  const sourceCommit = String(health.data?.renderSourceCommit || health.data?.sourceCommit || \"\");\n  const openapiText = JSON.stringify(openapi.data || {});\n  const versionMatches = health.ok && openapi.ok && healthVersion === expectedVersion && openapiText.includes(expectedVersion);\n  const sourceMatches = !expectedSourceCommit || sourceCommit === expectedSourceCommit || openapiText.includes(expectedSourceCommit);\n  return {\n    ok: versionMatches && sourceMatches,\n    service: \"render-onrunner\",\n    expectedVersion,\n    expectedSourceCommit: expectedSourceCommit || null,\n    healthVersion: healthVersion || null,\n    sourceCommit: sourceCommit || null,\n    healthStatus: health.responseStatus,\n    openapiStatus: openapi.responseStatus,\n    checks: { versionMatches, sourceMatches },\n    proofGate: versionMatches && sourceMatches\n      ? \"render_onrunner_health_openapi_source_verified\"\n      : \"render_onrunner_runtime_identity_mismatch\",\n    health,\n    openapi\n  };\n}\n\nasync function edgeFunctionRuntimeProof(functionName, expectedVersion) {\n  const base = `https://${SUPABASE_PROJECT_REF}.supabase.co/functions/v1/${functionName}`;\n  const [health, openapi] = await Promise.all(["},{"new_content":"  }\n\n  const target = String(body.target || body.functionName || body.function_name || \"cc-execution\").trim();\n  if (!edgeDeployment && target !== \"cc-execution\") {\n    return json({ ok: false, status: \"blocked\", proofGate: \"repair_plan_runtime_verification_blocked\", reason: \"unsupported_runtime_target\", target, destructiveActionsAllowed: false }, 400);\n  }\n  const deployStatus = await callDeployWorker(request, env, ctx, \"/deploy/status\", {\n    repository,\n    deploymentId,\n    ref: body.ref || \"main\",\n    target,\n    functionName: target\n  });","old_content":"  }\n\n  const target = String(body.target || body.functionName || body.function_name || \"cc-execution\").trim();\n  const deployStatus = await callDeployWorker(request, env, ctx, \"/deploy/status\", {\n    repository,\n    deploymentId,\n    ref: target === \"render-onrunner\" ? \"main\" : body.ref || \"main\",\n    target,\n    functionName: target\n  });"},{"new_content":"    deployStatusProof?.result?.conclusion === \"success\"\n  );\n\n  const healthProof = edgeDeployment\n    ? await edgeFunctionRuntimeProof(edgeDeployment.functionName, expectedVersion)\n    : ccExecutionRuntimeProof(env, expectedVersion, deployStatusProof, deploymentId);\n\n  if (!deployCompleted || healthProof?.ok !== true) {\n    return json({","old_content":"    deployStatusProof?.result?.conclusion === \"success\"\n  );\n\n  const healthProof = target === \"render-onrunner\"\n    ? await renderOnRunnerRuntimeProof(expectedVersion, String(body.expectedSourceCommit || body.expected_source_commit || \"\").trim())\n    : edgeDeployment\n      ? await edgeFunctionRuntimeProof(edgeDeployment.functionName, expectedVersion)\n      : ccExecutionRuntimeProof(env, expectedVersion, deployStatusProof, deploymentId);\n\n  if (!deployCompleted || healthProof?.ok !== true) {\n    return json({"},{"new_content":"      repository,\n      deploymentId,\n      expectedVersion,\n      deploymentKind: edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n      deployStatusProof,\n      healthProof,\n      externalHealthProof: {","old_content":"      repository,\n      deploymentId,\n      expectedVersion,\n      deploymentKind: target === \"render-onrunner\" ? \"render_onrunner\" : edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n      deployStatusProof,\n      healthProof,\n      externalHealthProof: {"},{"new_content":"    repository,\n    deploymentId,\n    expectedVersion,\n    deploymentKind: edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n    target: edgeDeployment?.functionName || SERVICE_NAME,\n    deployStatusProof,\n    healthProof,\n    externalHealthProof: {","old_content":"    repository,\n    deploymentId,\n    expectedVersion,\n    deploymentKind: target === \"render-onrunner\" ? \"render_onrunner\" : edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n    target: target === \"render-onrunner\" ? target : edgeDeployment?.functionName || SERVICE_NAME,\n    deployStatusProof,\n    healthProof,\n    externalHealthProof: {"}]},{"path":"workers/cc-execution/src/mission-ledger.js","edits":[{"new_content":"    const existingVisualJob = Boolean(text(mission.jobId || context.jobId, 200));\n    return {\n      action: \"verify_visual\",\n      lane: \"visual-sandbox\",\n      reason: existingVisualJob ? \"release_verified_existing_visual_job_pending_reconciliation\" : \"release_verified_visual_proof_pending\",\n      automationAllowed: true,\n      ownerActionRequired: false,","old_content":"    const existingVisualJob = Boolean(text(mission.jobId || context.jobId, 200));\n    return {\n      action: \"verify_visual\",\n      lane: \"onrunner\",\n      reason: existingVisualJob ? \"release_verified_existing_visual_job_pending_reconciliation\" : \"release_verified_visual_proof_pending\",\n      automationAllowed: true,\n      ownerActionRequired: false,"},{"new_content":"  const activeStatuses = new Set([\"ready\", \"running\", \"in_progress\", \"waiting\", \"queued\", \"requested\"]);\n  const activeStep = steps.find((step) => activeStatuses.has(text(step.status, 80).toLowerCase())) || null;\n  const key = text(activeStep?.key || mission.phase, 120).toLowerCase();\n  const lane = text(activeStep?.lane, 120) || (key === \"release\" ? \"production-release-conductor\" : key === \"visual_proof\" ? \"visual-sandbox\" : \"cc-execution\");\n  const byStep = {\n    preflight: \"resolve_preflight\",\n    implementation: \"continue_implementation\",","old_content":"  const activeStatuses = new Set([\"ready\", \"running\", \"in_progress\", \"waiting\", \"queued\", \"requested\"]);\n  const activeStep = steps.find((step) => activeStatuses.has(text(step.status, 80).toLowerCase())) || null;\n  const key = text(activeStep?.key || mission.phase, 120).toLowerCase();\n  const lane = text(activeStep?.lane, 120) || (key === \"release\" ? \"production-release-conductor\" : key === \"visual_proof\" ? \"onrunner\" : \"cc-execution\");\n  const byStep = {\n    preflight: \"resolve_preflight\",\n    implementation: \"continue_implementation\","},{"new_content":"  return Array.from(bytes).map((entry) => entry.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nconst REQUEST_CONTRACT_RELEASE_TARGET_KEYS = [\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"];\n\nfunction requestContractReleaseTargetList(value) {\n  return [...new Set((Array.isArray(value) ? value : [])","old_content":"  return Array.from(bytes).map((entry) => entry.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nconst REQUEST_CONTRACT_RELEASE_TARGET_KEYS = [\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"];\n\nfunction requestContractReleaseTargetList(value) {\n  return [...new Set((Array.isArray(value) ? value : [])"},{"new_content":"    const states = {\n      \"forgejo-main/source\": sourceInMain ? \"success\" : \"pending\",\n    };\n    const releaseTargetKeys = [\"ccExecution\", \"supabaseEdge\", \"frontend\", \"migrations\"];\n    const persistedReleaseTargets = context.releaseTargets || mission.releaseTargets || null;\n    const persistedReleaseTargetsRecord = record(persistedReleaseTargets);\n    const persistedReleaseTargetsHasActive = releaseTargetKeys.some((key) => persistedReleaseTargetsRecord[key] === true);","old_content":"    const states = {\n      \"forgejo-main/source\": sourceInMain ? \"success\" : \"pending\",\n    };\n    const releaseTargetKeys = [\"ccExecution\", \"onrunner\", \"supabaseEdge\", \"frontend\", \"migrations\"];\n    const persistedReleaseTargets = context.releaseTargets || mission.releaseTargets || null;\n    const persistedReleaseTargetsRecord = record(persistedReleaseTargets);\n    const persistedReleaseTargetsHasActive = releaseTargetKeys.some((key) => persistedReleaseTargetsRecord[key] === true);"},{"new_content":"        .map((key) => [key, \"success\"]),\n    );\n    let releaseTargetStates = mergeForgejoReleaseTargetStates(durableReleaseTargetSuccesses);\n    const hasCanonicalReleaseTarget = targets.ccExecution === true || targets.supabaseEdge === true || targets.frontend === true || targets.migrations === true;\n    if (releaseAttemptEvidence && !releaseTargetsKnown) states[\"release-targets/detection\"] = \"pending\";\n    const storedWorkflowRunSourceMatches = pushedRunReceipt?.sourceSha === sourceSha;\n    if (hasCanonicalReleaseTarget && !storedWorkflowRunSourceMatches) {","old_content":"        .map((key) => [key, \"success\"]),\n    );\n    let releaseTargetStates = mergeForgejoReleaseTargetStates(durableReleaseTargetSuccesses);\n    const hasCanonicalReleaseTarget = targets.ccExecution === true || targets.onrunner === true || targets.supabaseEdge === true || targets.frontend === true || targets.migrations === true;\n    if (releaseAttemptEvidence && !releaseTargetsKnown) states[\"release-targets/detection\"] = \"pending\";\n    const storedWorkflowRunSourceMatches = pushedRunReceipt?.sourceSha === sourceSha;\n    if (hasCanonicalReleaseTarget && !storedWorkflowRunSourceMatches) {"},{"new_content":"    // cc-execution runtime cannot prove frontend, Supabase Edge, or migrations.\n    const ccExecutionOnlyCanonicalRelease = Boolean(\n      targets.ccExecution === true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true","old_content":"    // cc-execution runtime cannot prove frontend, Supabase Edge, or migrations.\n    const ccExecutionOnlyCanonicalRelease = Boolean(\n      targets.ccExecution === true\n      && targets.onrunner !== true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true"},{"new_content":"      };\n    }\n\n    // Promote authoritative per-target runtime proof into the durable target\n    // ledger before evaluating the enclosing workflow. This allows an interrupted\n    // workflow to reconcile cleanly when every affected runtime target proved","old_content":"      };\n    }\n\n    let onrunnerRuntimeProof = null;\n    if (targets.onrunner === true) {\n      const hostedUrl = text(\n        env.VISUAL_WITNESS_HOSTED_RUNNER_URL\n          || env.HOSTED_VISUAL_WITNESS_RUNNER_URL\n          || \"https://knocklaunchcrm.onrender.com\",\n        500,\n      ).replace(/\\/+$/g, \"\");\n      try {\n        const response = await fetch(`${hostedUrl}/health?release_proof=${Date.now()}`, {\n          headers: { \"cache-control\": \"no-cache, no-store, max-age=0\" },\n          signal: AbortSignal.timeout(15000),\n        });\n        const body = await response.json().catch(() => ({}));\n        const liveSha = text(\n          body?.sourceCommit\n            || body?.sourceSha\n            || body?.runtime?.gitSha\n            || body?.runner?.sourceCommit\n            || body?.runner?.sourceSha,\n          100,\n        );\n        const brokerReady = body?.brokerStartupStatus === \"authority_proven\"\n          && !body?.brokerStartupErrorCode\n          && body?.readiness?.brokerReady === true;\n        const runtimeReady = response.ok && body?.ok === true && brokerReady;\n        const sourceMatches = Boolean(liveSha) && liveSha === sourceSha;\n        const exactSource = runtimeReady && sourceMatches;\n        states[\"render-onrunner/runtime-proof\"] = exactSource ? \"success\" : forgejoWorkflowState === \"pending\" ? \"pending\" : liveSha ? \"failure\" : \"pending\";\n        onrunnerRuntimeProof = {\n          hostedUrl,\n          healthStatus: response.status,\n          expectedSourceSha: sourceSha,\n          liveSourceSha: liveSha || null,\n          exactSource,\n          runtimeReady,\n          brokerReady,\n          runnerVersion: body?.version || body?.runner?.version || null,\n          reason: exactSource\n            ? null\n            : liveSha && !sourceMatches\n              ? \"render_onrunner_source_mismatch\"\n              : liveSha && !runtimeReady\n                ? \"render_onrunner_runtime_not_ready\"\n                : \"render_onrunner_source_identity_missing\",\n        };\n      } catch (error) {\n        states[\"render-onrunner/runtime-proof\"] = \"pending\";\n        onrunnerRuntimeProof = {\n          hostedUrl,\n          expectedSourceSha: sourceSha,\n          liveSourceSha: null,\n          exactSource: false,\n          reason: error instanceof Error ? error.message : String(error),\n        };\n      }\n    }\n\n    // For an OnRunner-only canonical release, exact healthy live runtime identity\n    // is stronger evidence than an enclosing workflow that was interrupted after\n    // the deploy was already dispatched. Mixed releases still require every\n    // affected target to prove itself independently.\n    const onrunnerOnlyCanonicalRelease = Boolean(\n      targets.onrunner === true\n      && targets.ccExecution !== true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true\n    );\n    const onrunnerExactLiveRuntimeProof = Boolean(\n      states[\"render-onrunner/runtime-proof\"] === \"success\"\n      && onrunnerRuntimeProof?.exactSource === true\n      && onrunnerRuntimeProof?.liveSourceSha === sourceSha\n    );\n    const onrunnerRuntimeSubstitutesWorkflowReceipt = Boolean(\n      hasCanonicalReleaseTarget\n      && onrunnerOnlyCanonicalRelease\n      && onrunnerExactLiveRuntimeProof\n      && [\"pending\", \"failure\"].includes(forgejoWorkflowState)\n    );\n    if (onrunnerRuntimeSubstitutesWorkflowReceipt) {\n      forgejoWorkflowState = \"success\";\n      states[\"forgejo-release/workflow\"] = \"success\";\n      forgejoWorkflowProof = {\n        ...(forgejoWorkflowProof || {}),\n        source: \"exact_live_onrunner_runtime_identity\",\n        proofGate: \"onrunner_exact_live_runtime_substitutes_interrupted_workflow_receipt\",\n        sourceSha,\n        liveSha: onrunnerRuntimeProof.liveSourceSha,\n        runnerVersion: onrunnerRuntimeProof.runnerVersion || null,\n        workflowReceiptSubstituted: true,\n      };\n    }\n\n    // Promote authoritative per-target runtime proof into the durable target\n    // ledger before evaluating the enclosing workflow. This allows an interrupted\n    // workflow to reconcile cleanly when every affected runtime target proved"},{"new_content":"    if (targets.ccExecution === true && states[\"cc-execution/runtime-proof\"] === \"success\") {\n      runtimeProvenTargetStates.ccExecution = \"success\";\n    }\n    if (Object.keys(runtimeProvenTargetStates).length > 0) {\n      releaseTargetStates = mergeForgejoReleaseTargetStates(releaseTargetStates, runtimeProvenTargetStates);\n    }\n    const runtimeProofOnlyRelease = Boolean(\n      targets.ccExecution === true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true","old_content":"    if (targets.ccExecution === true && states[\"cc-execution/runtime-proof\"] === \"success\") {\n      runtimeProvenTargetStates.ccExecution = \"success\";\n    }\n    if (targets.onrunner === true && onrunnerExactLiveRuntimeProof) {\n      runtimeProvenTargetStates.onrunner = \"success\";\n    }\n    if (Object.keys(runtimeProvenTargetStates).length > 0) {\n      releaseTargetStates = mergeForgejoReleaseTargetStates(releaseTargetStates, runtimeProvenTargetStates);\n    }\n    const runtimeProofOnlyRelease = Boolean(\n      (targets.ccExecution === true || targets.onrunner === true)\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true"},{"new_content":"    if (releaseAttemptEvidence && !releaseTargetsKnown) required.push(\"release-targets/detection\");\n    if (hasCanonicalReleaseTarget) required.push(\"forgejo-release/workflow\");\n    if (targets.ccExecution === true) required.push(\"cc-execution/runtime-proof\");\n    if (targets.supabaseEdge === true) required.push(\"supabase-edge-production/live\");\n    if (targets.frontend === true) required.push(\"frontend-cloudflare/live\");\n    if (targets.migrations === true) required.push(\"supabase-migrations/live\");","old_content":"    if (releaseAttemptEvidence && !releaseTargetsKnown) required.push(\"release-targets/detection\");\n    if (hasCanonicalReleaseTarget) required.push(\"forgejo-release/workflow\");\n    if (targets.ccExecution === true) required.push(\"cc-execution/runtime-proof\");\n    if (targets.onrunner === true) required.push(\"render-onrunner/runtime-proof\");\n    if (targets.supabaseEdge === true) required.push(\"supabase-edge-production/live\");\n    if (targets.frontend === true) required.push(\"frontend-cloudflare/live\");\n    if (targets.migrations === true) required.push(\"supabase-migrations/live\");"},{"new_content":"      phase: releaseState === \"verified\" ? (visualRequested ? \"visual_proof\" : \"runtime_proof\") : \"release\",\n      terminal: false,\n      terminal_reason: null,\n      payload: { sourceSha, mainSha, sourceInMain, releaseSourceVerified, exactReleaseVerifiedAfterMainAdvanced, compareStatus, releaseState, requestContractHash: text(context.requestContractHash, 100) || null, releaseTargets: releaseTargetsInput || null, releaseTargetStates, releaseTargetRecoveryProof, required, states, missing, pending, failed, forgejoWorkflowProof, ccExecutionRuntimeProof },\n      context_patch: {\n        releaseState,\n        workflowRunId: workflowRunId > 0 ? workflowRunId : (context.workflowRunId || null),","old_content":"      phase: releaseState === \"verified\" ? (visualRequested ? \"visual_proof\" : \"runtime_proof\") : \"release\",\n      terminal: false,\n      terminal_reason: null,\n      payload: { sourceSha, mainSha, sourceInMain, releaseSourceVerified, exactReleaseVerifiedAfterMainAdvanced, compareStatus, releaseState, requestContractHash: text(context.requestContractHash, 100) || null, releaseTargets: releaseTargetsInput || null, releaseTargetStates, releaseTargetRecoveryProof, required, states, missing, pending, failed, forgejoWorkflowProof, ccExecutionRuntimeProof, onrunnerRuntimeProof },\n      context_patch: {\n        releaseState,\n        workflowRunId: workflowRunId > 0 ? workflowRunId : (context.workflowRunId || null),"},{"new_content":"              : null,\n        forgejoWorkflowProof,\n        ccExecutionRuntimeProof,\n      },\n    });\n    if (!append.ok) return append;","old_content":"              : null,\n        forgejoWorkflowProof,\n        ccExecutionRuntimeProof,\n        onrunnerRuntimeProof,\n      },\n    });\n    if (!append.ok) return append;"}]},{"path":"workers/cc-execution/src/version.js","edits":[{"new_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\nexport const CC_EXECUTION_VERSION = \"1.60.1-forgejo-authority-decruft\";","old_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\nexport const CC_EXECUTION_VERSION = \"1.60.0-adaptive-objective-compiler\";"}]},{"path":"workers/cc-execution/test/capability-release-reconciliation.test.js","edits":[{"new_content":"});\n\n\ntest('retired visual release target is absent from canonical release reconciliation', () => {\n  const source = fs.readFileSync(new URL('../src/mission-ledger.js', import.meta.url), 'utf8');\n  assert.match(\n    source,\n    /const REQUEST_CONTRACT_RELEASE_TARGET_KEYS = \\[\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"\\]/,\n  );\n  assert.doesNotMatch(source, /release_onrunner|targets\\.onrunner|render-onrunner\\/runtime-proof/);\n  assert.match(source, /const failed = required\\.filter\\(\\(name\\) => \\[\"failure\", \"error\"\\]\\.includes\\(states\\[name\\]\\)\\)/);\n});","old_content":"});\n\n\ntest('OnRunner source mismatch stays nonterminal while canonical release workflow is pending', () => {\n  const source = fs.readFileSync(new URL('../src/mission-ledger.js', import.meta.url), 'utf8');\n  assert.match(\n    source,\n    /exactSource \\? \"success\" : forgejoWorkflowState === \"pending\" \\? \"pending\" : liveSha \\? \"failure\" : \"pending\"/,\n  );\n  assert.match(source, /const failed = required\\.filter\\(\\(name\\) => \\[\"failure\", \"error\"\\]\\.includes\\(states\\[name\\]\\)\\)/);\n});"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 5 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 5 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 5 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 5 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"recovery":false,"fingerprint":"fdb1e9818a04e88b65974a79fdec190377b0c025f7ceccdb65650820b7060418","replayCount":0,"serializedBytes":26562},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:33:38.231903+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a:repository-mutation-intent:fdb1e9818a04e88b65974a79fdec190377b0c025f7ceccdb65650820b7060418:0","mission_step_id":"b727b4c8-9734-4346-909d-ddd3d49ae617","command_center_event_id":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a"},{"id":"f0cceca1-3d41-4e59-8395-08152df37086","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"ef3e703b-509b-408e-b38b-49549fcf23dc","objective":"Apply exact repository-authority decruft batch 5 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, preserving the newer cc-execution 1.63.0 lineage by advancing it to 1.63.1-forgejo-authority-decruft. Bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"workstreamKey":"repo-decruft-pr4073-batch5-adapted-c2eea2a4ff6c","anchored_edits":[{"path":"workers/cc-execution/src/index-runtime-verify-gate.js","edits":[{"new_content":"import { getRuntimeState } from \"./runtime-state.js\";\n\nconst SERVICE_NAME = \"cc-execution\";\nconst VERSION = \"1.7.2-provider-neutral-runtime-verification\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\nconst SUPABASE_PROJECT_REF = \"ymntrajfubicyxwwdxxa\";\n","old_content":"import { getRuntimeState } from \"./runtime-state.js\";\n\nconst SERVICE_NAME = \"cc-execution\";\nconst VERSION = \"1.7.1-render-onrunner-runtime-verification\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\nconst SUPABASE_PROJECT_REF = \"ymntrajfubicyxwwdxxa\";\n"},{"new_content":"  };\n}\n\nasync function edgeFunctionRuntimeProof(functionName, expectedVersion) {\n  const base = `https://${SUPABASE_PROJECT_REF}.supabase.co/functions/v1/${functionName}`;\n  const [health, openapi] = await Promise.all([","old_content":"  };\n}\n\nasync function renderOnRunnerRuntimeProof(expectedVersion, expectedSourceCommit = \"\") {\n  const [health, openapi] = await Promise.all([\n    fetchJson(`https://knocklaunch-visual-witness-runner.onrender.com/health?runtimeVerify=${Date.now()}`),\n    fetchJson(`https://knocklaunch-visual-witness-runner.onrender.com/openapi.json?runtimeVerify=${Date.now()}`)\n  ]);\n  const healthVersion = String(health.data?.version || \"\");\n  const sourceCommit = String(health.data?.renderSourceCommit || health.data?.sourceCommit || \"\");\n  const openapiText = JSON.stringify(openapi.data || {});\n  const versionMatches = health.ok && openapi.ok && healthVersion === expectedVersion && openapiText.includes(expectedVersion);\n  const sourceMatches = !expectedSourceCommit || sourceCommit === expectedSourceCommit || openapiText.includes(expectedSourceCommit);\n  return {\n    ok: versionMatches && sourceMatches,\n    service: \"render-onrunner\",\n    expectedVersion,\n    expectedSourceCommit: expectedSourceCommit || null,\n    healthVersion: healthVersion || null,\n    sourceCommit: sourceCommit || null,\n    healthStatus: health.responseStatus,\n    openapiStatus: openapi.responseStatus,\n    checks: { versionMatches, sourceMatches },\n    proofGate: versionMatches && sourceMatches\n      ? \"render_onrunner_health_openapi_source_verified\"\n      : \"render_onrunner_runtime_identity_mismatch\",\n    health,\n    openapi\n  };\n}\n\nasync function edgeFunctionRuntimeProof(functionName, expectedVersion) {\n  const base = `https://${SUPABASE_PROJECT_REF}.supabase.co/functions/v1/${functionName}`;\n  const [health, openapi] = await Promise.all(["},{"new_content":"  }\n\n  const target = String(body.target || body.functionName || body.function_name || \"cc-execution\").trim();\n  if (!edgeDeployment && target !== \"cc-execution\") {\n    return json({ ok: false, status: \"blocked\", proofGate: \"repair_plan_runtime_verification_blocked\", reason: \"unsupported_runtime_target\", target, destructiveActionsAllowed: false }, 400);\n  }\n  const deployStatus = await callDeployWorker(request, env, ctx, \"/deploy/status\", {\n    repository,\n    deploymentId,\n    ref: body.ref || \"main\",\n    target,\n    functionName: target\n  });","old_content":"  }\n\n  const target = String(body.target || body.functionName || body.function_name || \"cc-execution\").trim();\n  const deployStatus = await callDeployWorker(request, env, ctx, \"/deploy/status\", {\n    repository,\n    deploymentId,\n    ref: target === \"render-onrunner\" ? \"main\" : body.ref || \"main\",\n    target,\n    functionName: target\n  });"},{"new_content":"    deployStatusProof?.result?.conclusion === \"success\"\n  );\n\n  const healthProof = edgeDeployment\n    ? await edgeFunctionRuntimeProof(edgeDeployment.functionName, expectedVersion)\n    : ccExecutionRuntimeProof(env, expectedVersion, deployStatusProof, deploymentId);\n\n  if (!deployCompleted || healthProof?.ok !== true) {\n    return json({","old_content":"    deployStatusProof?.result?.conclusion === \"success\"\n  );\n\n  const healthProof = target === \"render-onrunner\"\n    ? await renderOnRunnerRuntimeProof(expectedVersion, String(body.expectedSourceCommit || body.expected_source_commit || \"\").trim())\n    : edgeDeployment\n      ? await edgeFunctionRuntimeProof(edgeDeployment.functionName, expectedVersion)\n      : ccExecutionRuntimeProof(env, expectedVersion, deployStatusProof, deploymentId);\n\n  if (!deployCompleted || healthProof?.ok !== true) {\n    return json({"},{"new_content":"      repository,\n      deploymentId,\n      expectedVersion,\n      deploymentKind: edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n      deployStatusProof,\n      healthProof,\n      externalHealthProof: {","old_content":"      repository,\n      deploymentId,\n      expectedVersion,\n      deploymentKind: target === \"render-onrunner\" ? \"render_onrunner\" : edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n      deployStatusProof,\n      healthProof,\n      externalHealthProof: {"},{"new_content":"    repository,\n    deploymentId,\n    expectedVersion,\n    deploymentKind: edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n    target: edgeDeployment?.functionName || SERVICE_NAME,\n    deployStatusProof,\n    healthProof,\n    externalHealthProof: {","old_content":"    repository,\n    deploymentId,\n    expectedVersion,\n    deploymentKind: target === \"render-onrunner\" ? \"render_onrunner\" : edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n    target: target === \"render-onrunner\" ? target : edgeDeployment?.functionName || SERVICE_NAME,\n    deployStatusProof,\n    healthProof,\n    externalHealthProof: {"}]},{"path":"workers/cc-execution/src/mission-ledger.js","edits":[{"new_content":"    const existingVisualJob = Boolean(text(mission.jobId || context.jobId, 200));\n    return {\n      action: \"verify_visual\",\n      lane: \"visual-sandbox\",\n      reason: existingVisualJob ? \"release_verified_existing_visual_job_pending_reconciliation\" : \"release_verified_visual_proof_pending\",\n      automationAllowed: true,\n      ownerActionRequired: false,","old_content":"    const existingVisualJob = Boolean(text(mission.jobId || context.jobId, 200));\n    return {\n      action: \"verify_visual\",\n      lane: \"onrunner\",\n      reason: existingVisualJob ? \"release_verified_existing_visual_job_pending_reconciliation\" : \"release_verified_visual_proof_pending\",\n      automationAllowed: true,\n      ownerActionRequired: false,"},{"new_content":"  const activeStatuses = new Set([\"ready\", \"running\", \"in_progress\", \"waiting\", \"queued\", \"requested\"]);\n  const activeStep = steps.find((step) => activeStatuses.has(text(step.status, 80).toLowerCase())) || null;\n  const key = text(activeStep?.key || mission.phase, 120).toLowerCase();\n  const lane = text(activeStep?.lane, 120) || (key === \"release\" ? \"production-release-conductor\" : key === \"visual_proof\" ? \"visual-sandbox\" : \"cc-execution\");\n  const byStep = {\n    preflight: \"resolve_preflight\",\n    implementation: \"continue_implementation\",","old_content":"  const activeStatuses = new Set([\"ready\", \"running\", \"in_progress\", \"waiting\", \"queued\", \"requested\"]);\n  const activeStep = steps.find((step) => activeStatuses.has(text(step.status, 80).toLowerCase())) || null;\n  const key = text(activeStep?.key || mission.phase, 120).toLowerCase();\n  const lane = text(activeStep?.lane, 120) || (key === \"release\" ? \"production-release-conductor\" : key === \"visual_proof\" ? \"onrunner\" : \"cc-execution\");\n  const byStep = {\n    preflight: \"resolve_preflight\",\n    implementation: \"continue_implementation\","},{"new_content":"  return Array.from(bytes).map((entry) => entry.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nconst REQUEST_CONTRACT_RELEASE_TARGET_KEYS = [\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"];\n\nfunction requestContractReleaseTargetList(value) {\n  return [...new Set((Array.isArray(value) ? value : [])","old_content":"  return Array.from(bytes).map((entry) => entry.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nconst REQUEST_CONTRACT_RELEASE_TARGET_KEYS = [\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"];\n\nfunction requestContractReleaseTargetList(value) {\n  return [...new Set((Array.isArray(value) ? value : [])"},{"new_content":"    const states = {\n      \"forgejo-main/source\": sourceInMain ? \"success\" : \"pending\",\n    };\n    const releaseTargetKeys = [\"ccExecution\", \"supabaseEdge\", \"frontend\", \"migrations\"];\n    const persistedReleaseTargets = context.releaseTargets || mission.releaseTargets || null;\n    const persistedReleaseTargetsRecord = record(persistedReleaseTargets);\n    const persistedReleaseTargetsHasActive = releaseTargetKeys.some((key) => persistedReleaseTargetsRecord[key] === true);","old_content":"    const states = {\n      \"forgejo-main/source\": sourceInMain ? \"success\" : \"pending\",\n    };\n    const releaseTargetKeys = [\"ccExecution\", \"onrunner\", \"supabaseEdge\", \"frontend\", \"migrations\"];\n    const persistedReleaseTargets = context.releaseTargets || mission.releaseTargets || null;\n    const persistedReleaseTargetsRecord = record(persistedReleaseTargets);\n    const persistedReleaseTargetsHasActive = releaseTargetKeys.some((key) => persistedReleaseTargetsRecord[key] === true);"},{"new_content":"        .map((key) => [key, \"success\"]),\n    );\n    let releaseTargetStates = mergeForgejoReleaseTargetStates(durableReleaseTargetSuccesses);\n    const hasCanonicalReleaseTarget = targets.ccExecution === true || targets.supabaseEdge === true || targets.frontend === true || targets.migrations === true;\n    if (releaseAttemptEvidence && !releaseTargetsKnown) states[\"release-targets/detection\"] = \"pending\";\n    const storedWorkflowRunSourceMatches = pushedRunReceipt?.sourceSha === sourceSha;\n    if (hasCanonicalReleaseTarget && !storedWorkflowRunSourceMatches) {","old_content":"        .map((key) => [key, \"success\"]),\n    );\n    let releaseTargetStates = mergeForgejoReleaseTargetStates(durableReleaseTargetSuccesses);\n    const hasCanonicalReleaseTarget = targets.ccExecution === true || targets.onrunner === true || targets.supabaseEdge === true || targets.frontend === true || targets.migrations === true;\n    if (releaseAttemptEvidence && !releaseTargetsKnown) states[\"release-targets/detection\"] = \"pending\";\n    const storedWorkflowRunSourceMatches = pushedRunReceipt?.sourceSha === sourceSha;\n    if (hasCanonicalReleaseTarget && !storedWorkflowRunSourceMatches) {"},{"new_content":"    // cc-execution runtime cannot prove frontend, Supabase Edge, or migrations.\n    const ccExecutionOnlyCanonicalRelease = Boolean(\n      targets.ccExecution === true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true","old_content":"    // cc-execution runtime cannot prove frontend, Supabase Edge, or migrations.\n    const ccExecutionOnlyCanonicalRelease = Boolean(\n      targets.ccExecution === true\n      && targets.onrunner !== true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true"},{"new_content":"      };\n    }\n\n    // Promote authoritative per-target runtime proof into the durable target\n    // ledger before evaluating the enclosing workflow. This allows an interrupted\n    // workflow to reconcile cleanly when every affected runtime target proved","old_content":"      };\n    }\n\n    let onrunnerRuntimeProof = null;\n    if (targets.onrunner === true) {\n      const hostedUrl = text(\n        env.VISUAL_WITNESS_HOSTED_RUNNER_URL\n          || env.HOSTED_VISUAL_WITNESS_RUNNER_URL\n          || \"https://knocklaunchcrm.onrender.com\",\n        500,\n      ).replace(/\\/+$/g, \"\");\n      try {\n        const response = await fetch(`${hostedUrl}/health?release_proof=${Date.now()}`, {\n          headers: { \"cache-control\": \"no-cache, no-store, max-age=0\" },\n          signal: AbortSignal.timeout(15000),\n        });\n        const body = await response.json().catch(() => ({}));\n        const liveSha = text(\n          body?.sourceCommit\n            || body?.sourceSha\n            || body?.runtime?.gitSha\n            || body?.runner?.sourceCommit\n            || body?.runner?.sourceSha,\n          100,\n        );\n        const brokerReady = body?.brokerStartupStatus === \"authority_proven\"\n          && !body?.brokerStartupErrorCode\n          && body?.readiness?.brokerReady === true;\n        const runtimeReady = response.ok && body?.ok === true && brokerReady;\n        const sourceMatches = Boolean(liveSha) && liveSha === sourceSha;\n        const exactSource = runtimeReady && sourceMatches;\n        states[\"render-onrunner/runtime-proof\"] = exactSource ? \"success\" : forgejoWorkflowState === \"pending\" ? \"pending\" : liveSha ? \"failure\" : \"pending\";\n        onrunnerRuntimeProof = {\n          hostedUrl,\n          healthStatus: response.status,\n          expectedSourceSha: sourceSha,\n          liveSourceSha: liveSha || null,\n          exactSource,\n          runtimeReady,\n          brokerReady,\n          runnerVersion: body?.version || body?.runner?.version || null,\n          reason: exactSource\n            ? null\n            : liveSha && !sourceMatches\n              ? \"render_onrunner_source_mismatch\"\n              : liveSha && !runtimeReady\n                ? \"render_onrunner_runtime_not_ready\"\n                : \"render_onrunner_source_identity_missing\",\n        };\n      } catch (error) {\n        states[\"render-onrunner/runtime-proof\"] = \"pending\";\n        onrunnerRuntimeProof = {\n          hostedUrl,\n          expectedSourceSha: sourceSha,\n          liveSourceSha: null,\n          exactSource: false,\n          reason: error instanceof Error ? error.message : String(error),\n        };\n      }\n    }\n\n    // For an OnRunner-only canonical release, exact healthy live runtime identity\n    // is stronger evidence than an enclosing workflow that was interrupted after\n    // the deploy was already dispatched. Mixed releases still require every\n    // affected target to prove itself independently.\n    const onrunnerOnlyCanonicalRelease = Boolean(\n      targets.onrunner === true\n      && targets.ccExecution !== true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true\n    );\n    const onrunnerExactLiveRuntimeProof = Boolean(\n      states[\"render-onrunner/runtime-proof\"] === \"success\"\n      && onrunnerRuntimeProof?.exactSource === true\n      && onrunnerRuntimeProof?.liveSourceSha === sourceSha\n    );\n    const onrunnerRuntimeSubstitutesWorkflowReceipt = Boolean(\n      hasCanonicalReleaseTarget\n      && onrunnerOnlyCanonicalRelease\n      && onrunnerExactLiveRuntimeProof\n      && [\"pending\", \"failure\"].includes(forgejoWorkflowState)\n    );\n    if (onrunnerRuntimeSubstitutesWorkflowReceipt) {\n      forgejoWorkflowState = \"success\";\n      states[\"forgejo-release/workflow\"] = \"success\";\n      forgejoWorkflowProof = {\n        ...(forgejoWorkflowProof || {}),\n        source: \"exact_live_onrunner_runtime_identity\",\n        proofGate: \"onrunner_exact_live_runtime_substitutes_interrupted_workflow_receipt\",\n        sourceSha,\n        liveSha: onrunnerRuntimeProof.liveSourceSha,\n        runnerVersion: onrunnerRuntimeProof.runnerVersion || null,\n        workflowReceiptSubstituted: true,\n      };\n    }\n\n    // Promote authoritative per-target runtime proof into the durable target\n    // ledger before evaluating the enclosing workflow. This allows an interrupted\n    // workflow to reconcile cleanly when every affected runtime target proved"},{"new_content":"    if (targets.ccExecution === true && states[\"cc-execution/runtime-proof\"] === \"success\") {\n      runtimeProvenTargetStates.ccExecution = \"success\";\n    }\n    if (Object.keys(runtimeProvenTargetStates).length > 0) {\n      releaseTargetStates = mergeForgejoReleaseTargetStates(releaseTargetStates, runtimeProvenTargetStates);\n    }\n    const runtimeProofOnlyRelease = Boolean(\n      targets.ccExecution === true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true","old_content":"    if (targets.ccExecution === true && states[\"cc-execution/runtime-proof\"] === \"success\") {\n      runtimeProvenTargetStates.ccExecution = \"success\";\n    }\n    if (targets.onrunner === true && onrunnerExactLiveRuntimeProof) {\n      runtimeProvenTargetStates.onrunner = \"success\";\n    }\n    if (Object.keys(runtimeProvenTargetStates).length > 0) {\n      releaseTargetStates = mergeForgejoReleaseTargetStates(releaseTargetStates, runtimeProvenTargetStates);\n    }\n    const runtimeProofOnlyRelease = Boolean(\n      (targets.ccExecution === true || targets.onrunner === true)\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true"},{"new_content":"    if (releaseAttemptEvidence && !releaseTargetsKnown) required.push(\"release-targets/detection\");\n    if (hasCanonicalReleaseTarget) required.push(\"forgejo-release/workflow\");\n    if (targets.ccExecution === true) required.push(\"cc-execution/runtime-proof\");\n    if (targets.supabaseEdge === true) required.push(\"supabase-edge-production/live\");\n    if (targets.frontend === true) required.push(\"frontend-cloudflare/live\");\n    if (targets.migrations === true) required.push(\"supabase-migrations/live\");","old_content":"    if (releaseAttemptEvidence && !releaseTargetsKnown) required.push(\"release-targets/detection\");\n    if (hasCanonicalReleaseTarget) required.push(\"forgejo-release/workflow\");\n    if (targets.ccExecution === true) required.push(\"cc-execution/runtime-proof\");\n    if (targets.onrunner === true) required.push(\"render-onrunner/runtime-proof\");\n    if (targets.supabaseEdge === true) required.push(\"supabase-edge-production/live\");\n    if (targets.frontend === true) required.push(\"frontend-cloudflare/live\");\n    if (targets.migrations === true) required.push(\"supabase-migrations/live\");"},{"new_content":"      phase: releaseState === \"verified\" ? (visualRequested ? \"visual_proof\" : \"runtime_proof\") : \"release\",\n      terminal: false,\n      terminal_reason: null,\n      payload: { sourceSha, mainSha, sourceInMain, releaseSourceVerified, exactReleaseVerifiedAfterMainAdvanced, compareStatus, releaseState, requestContractHash: text(context.requestContractHash, 100) || null, releaseTargets: releaseTargetsInput || null, releaseTargetStates, releaseTargetRecoveryProof, required, states, missing, pending, failed, forgejoWorkflowProof, ccExecutionRuntimeProof },\n      context_patch: {\n        releaseState,\n        workflowRunId: workflowRunId > 0 ? workflowRunId : (context.workflowRunId || null),","old_content":"      phase: releaseState === \"verified\" ? (visualRequested ? \"visual_proof\" : \"runtime_proof\") : \"release\",\n      terminal: false,\n      terminal_reason: null,\n      payload: { sourceSha, mainSha, sourceInMain, releaseSourceVerified, exactReleaseVerifiedAfterMainAdvanced, compareStatus, releaseState, requestContractHash: text(context.requestContractHash, 100) || null, releaseTargets: releaseTargetsInput || null, releaseTargetStates, releaseTargetRecoveryProof, required, states, missing, pending, failed, forgejoWorkflowProof, ccExecutionRuntimeProof, onrunnerRuntimeProof },\n      context_patch: {\n        releaseState,\n        workflowRunId: workflowRunId > 0 ? workflowRunId : (context.workflowRunId || null),"},{"new_content":"              : null,\n        forgejoWorkflowProof,\n        ccExecutionRuntimeProof,\n      },\n    });\n    if (!append.ok) return append;","old_content":"              : null,\n        forgejoWorkflowProof,\n        ccExecutionRuntimeProof,\n        onrunnerRuntimeProof,\n      },\n    });\n    if (!append.ok) return append;"}]},{"path":"workers/cc-execution/src/version.js","edits":[{"new_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\\nexport const CC_EXECUTION_VERSION = \"1.63.1-forgejo-authority-decruft\";","old_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\\nexport const CC_EXECUTION_VERSION = \"1.63.0-mission-freedom-web-research\";"}]},{"path":"workers/cc-execution/test/capability-release-reconciliation.test.js","edits":[{"new_content":"});\n\n\ntest('retired visual release target is absent from canonical release reconciliation', () => {\n  const source = fs.readFileSync(new URL('../src/mission-ledger.js', import.meta.url), 'utf8');\n  assert.match(\n    source,\n    /const REQUEST_CONTRACT_RELEASE_TARGET_KEYS = \\[\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"\\]/,\n  );\n  assert.doesNotMatch(source, /release_onrunner|targets\\.onrunner|render-onrunner\\/runtime-proof/);\n  assert.match(source, /const failed = required\\.filter\\(\\(name\\) => \\[\"failure\", \"error\"\\]\\.includes\\(states\\[name\\]\\)\\)/);\n});","old_content":"});\n\n\ntest('OnRunner source mismatch stays nonterminal while canonical release workflow is pending', () => {\n  const source = fs.readFileSync(new URL('../src/mission-ledger.js', import.meta.url), 'utf8');\n  assert.match(\n    source,\n    /exactSource \\? \"success\" : forgejoWorkflowState === \"pending\" \\? \"pending\" : liveSha \\? \"failure\" : \"pending\"/,\n  );\n  assert.match(source, /const failed = required\\.filter\\(\\(name\\) => \\[\"failure\", \"error\"\\]\\.includes\\(states\\[name\\]\\)\\)/);\n});"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 5 exact edits are committed to existing PR #4073 while preserving newer PAUL/runtime lineage.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 5 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, preserving the newer cc-execution 1.63.0 lineage by advancing it to 1.63.1-forgejo-authority-decruft. Bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"preserve-newer","statement":"Do not downgrade cc-execution version lineage; advance 1.63.0 to 1.63.1-forgejo-authority-decruft.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 5 exact edits are committed to existing PR #4073 while preserving newer PAUL/runtime lineage.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 5 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, preserving the newer cc-execution 1.63.0 lineage by advancing it to 1.63.1-forgejo-authority-decruft. Bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"preserve-newer","statement":"Do not downgrade cc-execution version lineage; advance 1.63.0 to 1.63.1-forgejo-authority-decruft.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"recovery":false,"fingerprint":"36dbb3053993844997c2373709121180073cc6ed26290ab86d1c474bb40c18b3","replayCount":0,"serializedBytes":27315},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:34.676953+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:ef3e703b-509b-408e-b38b-49549fcf23dc:repository-mutation-intent:36dbb3053993844997c2373709121180073cc6ed26290ab86d1c474bb40c18b3:0","mission_step_id":"a290e3e1-dae2-441f-a53c-59eb624904b8","command_center_event_id":"ef3e703b-509b-408e-b38b-49549fcf23dc"},{"id":"e4fa5953-fc30-4cbc-8f62-a7db6aa6180e","source":"cc-execution","status":"blocked","payload":{"reason":"anchored_edit_anchor_missing:workers/cc-execution/src/version.js","fingerprint":"36dbb3053993844997c2373709121180073cc6ed26290ab86d1c474bb40c18b3"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:37.657736+00:00","proof_gate":"repository_mutation_intent_deterministic_failure","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent_blocked","idempotency_key":"mission:ef3e703b-509b-408e-b38b-49549fcf23dc:repository-mutation-intent-blocked:36dbb3053993844997c2373709121180073cc6ed26290ab86d1c474bb40c18b3","mission_step_id":"a290e3e1-dae2-441f-a53c-59eb624904b8","command_center_event_id":"ef3e703b-509b-408e-b38b-49549fcf23dc"},{"id":"6499aaf1-dbc7-4c5a-9749-404e6ff857f1","source":"durable-mission-ledger","status":"pending","payload":{"sourceSha":"c267479c921da9f1dea8b4b217448a4367523515","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"legacy-drive-copy","satisfied":false,"statement":"Imported legacy PCG card images can be copied directly from approved PCG/Squarespace HTTPS sources into Anthony's private Google Drive with stable dedupe and controlled delivery URLs.","proofConditionIds":["runtime"]},{"id":"migration-linked","satisfied":false,"statement":"Legacy image migration updates only canonical cards created by the selected import batch, preserves legacy source provenance, and is resumable in chunks.","proofConditionIds":["runtime"]},{"id":"owner-ui","satisfied":false,"statement":"Migration Center exposes truthful Google Drive image-migration progress and remains blocked when Google Workspace is not connected.","proofConditionIds":["runtime"]}],"satisfied":false,"constraints":[{"id":"allowlist","satisfied":false,"statement":"Remote image fetches are restricted to pcgslab.com, www.pcgslab.com, images.squarespace-cdn.com, and static1.squarespace.com, including every redirect hop; HTTPS only.","proofConditionIds":["runtime"]},{"id":"image-guard","satisfied":false,"statement":"Reject non-image responses and legacy source files larger than 25 MB.","proofConditionIds":["runtime"]},{"id":"no-knocklaunch-master","satisfied":false,"statement":"Do not persist legacy master image blobs in KNOCKLAUNCH or Supabase Storage.","proofConditionIds":["runtime"]},{"id":"pcg-only","satisfied":false,"statement":"No other tenant behavior changes.","proofConditionIds":["runtime"]},{"id":"no-witness","satisfied":false,"statement":"Do not run Visual Witness.","proofConditionIds":["runtime"]},{"id":"capability-completeness","satisfied":false,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["runtime"]},{"id":"atomic-capability-lifecycle","satisfied":false,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["runtime"]}],"contractHash":"eb9ce1be253947b427f7fc9e99b4f38f686d75f021cb6bd5d83be61273a5bbe1","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"runtime","kind":"runtime","evidence":{"reason":"missing_required_release_targets:migrations","satisfied":false,"releaseState":"verified","missingTargets":["migrations"],"disallowedTargets":[],"migrationRequired":true,"releaseTargetStates":{"frontend":"success","supabaseEdge":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend","supabaseEdge"],"allowedReleaseTargets":[],"requiredReleaseTargets":["migrations"],"migrationReleaseVerified":false,"releaseRequestContractHash":"eb9ce1be253947b427f7fc9e99b4f38f686d75f021cb6bd5d83be61273a5bbe1"},"required":true,"satisfied":false}],"validationErrors":[],"pendingProofKinds":["runtime"],"activeReleaseTargets":["frontend","supabaseEdge"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:23.660982+00:00","proof_gate":"request_contract_pending","source_sha":"c267479c921da9f1dea8b4b217448a4367523515","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:request-contract:eb9ce1be253947b427f7fc9e99b4f38f686d75f021cb6bd5d83be61273a5bbe1:c267479c921da9f1dea8b4b217448a4367523515:pending:runtime","mission_step_id":"592fd8b1-5de3-46ed-b7ea-2133bd338522","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"b8641f84-da91-4149-9231-bda82de16a32","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-83515a4a94d3","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":75913,"releaseCount":0,"toolCallCount":4,"repeatedCallCount":0,"executorlessWaitMs":203194,"firstUsefulResultAt":"2026-09-29T02:27:44.732Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":null,"prNumber":4085,"terminal":false,"missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","timingsMs":{"prReadinessMs":614,"approvedPlanMs":0,"shipAndProveMs":2931,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},"performance":null,"deploymentId":"forgejo-main-c2eea2a4ff6c","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1814,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:25.584239+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4085","receipt_type":"automatic_mission_resume","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:automatic-mission-resume:4085:canonical_release_reconciliation_pending","mission_step_id":"4d871772-da8f-4d37-b7bd-c375faf7f8d9","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"86383f24-48b4-4c65-bf55-e51ad60fcd19","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"8a7bb657-b031-451c-bb29-f9c4cb54bf9c","objective":"Apply exact repository-authority decruft batch 2 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["scripts/release-target-ownership.test.mjs","scripts/visual-witness-hosted-runner/Dockerfile","scripts/visual-witness-hosted-runner/src/__tests__/mission-supervisor.test.mjs","scripts/visual-witness-hosted-runner/src/mission-gateway.mjs","scripts/visual-witness-hosted-runner/src/universal-witness.mjs","scripts/visual-witness-hosted-runner/test/interaction-headless-launch.contract.test.mjs","scripts/visual-witness-hosted-runner/test/mission-supervisor-durability.test.mjs","scripts/visual-witness-hosted-runner/test/supervisor-active-progress-projection.test.mjs","src/config/platformCapabilityMatrix.ts"],"workstreamKey":"repo-decruft-pr4073-batch2-c2eea2a4ff6c","anchored_edits":[{"path":"scripts/release-target-ownership.test.mjs","edits":[{"new_content":"import assert from \"node:assert/strict\";\nimport { releaseTargetsFromChangedPaths, workflowReleaseFlagsFromChangedPaths } from \"./release-target-ownership.mjs\";\n\nconst none = { ccExecution: false, frontend: false, supabaseEdge: false, migrations: false };\nassert.deepEqual(releaseTargetsFromChangedPaths([\".forgejo/workflows/knocklaunch.yml\"]), none);\nassert.deepEqual(releaseTargetsFromChangedPaths([\"scripts/protected-main-release-recovery.mjs\"]), none);\nassert.deepEqual(releaseTargetsFromChangedPaths([\"scripts/release-target-ownership.mjs\", \"scripts/release-target-ownership.test.mjs\"]), none);","old_content":"import assert from \"node:assert/strict\";\nimport { releaseTargetsFromChangedPaths, workflowReleaseFlagsFromChangedPaths } from \"./release-target-ownership.mjs\";\n\nconst none = { ccExecution: false, onrunner: false, frontend: false, supabaseEdge: false, migrations: false };\nassert.deepEqual(releaseTargetsFromChangedPaths([\".forgejo/workflows/knocklaunch.yml\"]), none);\nassert.deepEqual(releaseTargetsFromChangedPaths([\"scripts/protected-main-release-recovery.mjs\"]), none);\nassert.deepEqual(releaseTargetsFromChangedPaths([\"scripts/release-target-ownership.mjs\", \"scripts/release-target-ownership.test.mjs\"]), none);"},{"new_content":"assert.equal(releaseTargetsFromChangedPaths([\"config/control-plane-capabilities.json\"]).ccExecution, true);\nassert.equal(releaseTargetsFromChangedPaths([\"src/App.tsx\"]).frontend, true);\nassert.equal(releaseTargetsFromChangedPaths([\"scripts/visual-witness-hosted-runner/src/mission-supervisor.mjs\"]).ccExecution, true);\nassert.equal(Object.prototype.hasOwnProperty.call(releaseTargetsFromChangedPaths([\"scripts/visual-witness-hosted-runner/src/mission-supervisor.mjs\"]), \"onrunner\"), false);\nassert.equal(releaseTargetsFromChangedPaths([\"supabase/functions/example/index.ts\"]).supabaseEdge, true);\nassert.equal(releaseTargetsFromChangedPaths([\"scripts/reconcile-supabase-edge-registry.mjs\"]).supabaseEdge, true);\nassert.equal(releaseTargetsFromChangedPaths([\"supabase/migrations/20260904000000_example.sql\"]).migrations, true);\nassert.deepEqual(workflowReleaseFlagsFromChangedPaths([\".forgejo/workflows/knocklaunch.yml\"]), {\n  release_cc_execution: \"false\",\n  release_frontend: \"false\",\n  release_supabase_edge: \"false\",\n  release_migrations: \"false\",","old_content":"assert.equal(releaseTargetsFromChangedPaths([\"config/control-plane-capabilities.json\"]).ccExecution, true);\nassert.equal(releaseTargetsFromChangedPaths([\"src/App.tsx\"]).frontend, true);\nassert.equal(releaseTargetsFromChangedPaths([\"scripts/visual-witness-hosted-runner/src/mission-supervisor.mjs\"]).ccExecution, true);\nassert.equal(releaseTargetsFromChangedPaths([\"scripts/visual-witness-hosted-runner/src/mission-supervisor.mjs\"]).onrunner, false);\nassert.equal(releaseTargetsFromChangedPaths([\"supabase/functions/example/index.ts\"]).supabaseEdge, true);\nassert.equal(releaseTargetsFromChangedPaths([\"scripts/reconcile-supabase-edge-registry.mjs\"]).supabaseEdge, true);\nassert.equal(releaseTargetsFromChangedPaths([\"supabase/migrations/20260904000000_example.sql\"]).migrations, true);\nassert.deepEqual(workflowReleaseFlagsFromChangedPaths([\".forgejo/workflows/knocklaunch.yml\"]), {\n  release_cc_execution: \"false\",\n  release_onrunner: \"false\",\n  release_frontend: \"false\",\n  release_supabase_edge: \"false\",\n  release_migrations: \"false\","}]},{"path":"scripts/visual-witness-hosted-runner/Dockerfile","edits":[{"new_content":"COPY src ./src\n\nARG KNOCKLAUNCH_SOURCE_SHA=unknown\nENV KNOCKLAUNCH_SOURCE_SHA=${KNOCKLAUNCH_SOURCE_SHA}\nLABEL org.opencontainers.image.revision=${KNOCKLAUNCH_SOURCE_SHA}\nENV NODE_ENV=production\nENV PORT=8080","old_content":"COPY src ./src\n\nARG KNOCKLAUNCH_SOURCE_SHA=unknown\nENV RENDER_GIT_COMMIT=${KNOCKLAUNCH_SOURCE_SHA}\nLABEL org.opencontainers.image.revision=${KNOCKLAUNCH_SOURCE_SHA}\nENV NODE_ENV=production\nENV PORT=8080"}]},{"path":"scripts/visual-witness-hosted-runner/src/__tests__/mission-supervisor.test.mjs","edits":[{"new_content":"    result: null,\n  };\n  const primary = new MissionSupervisor({\n    runtimeLane: 'cc-execution -> KNOCKLAUNCH Visual Sandbox -> universal-witness.mjs',\n    createAttempt: async () => completed(true),\n    readAttempt: async () => completed(true),\n    load: async () => structuredClone(persistedPaulSupervisor),","old_content":"    result: null,\n  };\n  const primary = new MissionSupervisor({\n    runtimeLane: 'cc-execution -> Render OnRunner -> universal-witness.mjs',\n    createAttempt: async () => completed(true),\n    readAttempt: async () => completed(true),\n    load: async () => structuredClone(persistedPaulSupervisor),"}]},{"path":"scripts/visual-witness-hosted-runner/src/mission-gateway.mjs","edits":[{"new_content":"async function handleHealth(res) {\n  try {\n    const { response, body } = await childJson('/health');\n    return json(res, response.status, { ...body, sourceCommit: String(process.env.KNOCKLAUNCH_SOURCE_SHA || process.env.GIT_COMMIT || ''), sourceBranch: String(process.env.KNOCKLAUNCH_SOURCE_BRANCH || 'main'), missionEngine: capabilities(), missionEngineStatus: 'live' });\n  } catch (error) {\n    return json(res, 503, { ok: false, service: 'knocklaunch-visual-witness-runner', status: 'starting', error: 'internal_runner_unavailable', detail: redact(error.message), missionEngine: capabilities() });\n  }","old_content":"async function handleHealth(res) {\n  try {\n    const { response, body } = await childJson('/health');\n    return json(res, response.status, { ...body, renderSourceCommit: String(process.env.RENDER_GIT_COMMIT || ''), renderGitBranch: String(process.env.RENDER_GIT_BRANCH || ''), missionEngine: capabilities(), missionEngineStatus: 'live' });\n  } catch (error) {\n    return json(res, 503, { ok: false, service: 'knocklaunch-visual-witness-runner', status: 'starting', error: 'internal_runner_unavailable', detail: redact(error.message), missionEngine: capabilities() });\n  }"},{"new_content":"async function handleOpenApi(res) {\n  try {\n    const { response, body } = await childJson('/openapi.json');\n    body.info = { ...(body.info || {}), 'x-mission-engine-version': VERSION, 'x-knocklaunch-source-commit': String(process.env.KNOCKLAUNCH_SOURCE_SHA || process.env.GIT_COMMIT || '') };\n    body.paths = {\n      ...(body.paths || {}),\n      '/mission-capabilities': { get: { operationId: 'visualWitnessMissionCapabilities', summary: 'Read autonomous Visual Witness capabilities', responses: { 200: { description: 'Capabilities' } } } },","old_content":"async function handleOpenApi(res) {\n  try {\n    const { response, body } = await childJson('/openapi.json');\n    body.info = { ...(body.info || {}), 'x-mission-engine-version': VERSION, 'x-render-source-commit': String(process.env.RENDER_GIT_COMMIT || '') };\n    body.paths = {\n      ...(body.paths || {}),\n      '/mission-capabilities': { get: { operationId: 'visualWitnessMissionCapabilities', summary: 'Read autonomous Visual Witness capabilities', responses: { 200: { description: 'Capabilities' } } } },"}]},{"path":"scripts/visual-witness-hosted-runner/src/universal-witness.mjs","edits":[{"new_content":"import { chromium, firefox, webkit, devices } from '@playwright/test';\nimport { createClient as createSupabaseClient } from '@supabase/supabase-js';\n\n// Release freshness marker: redeploy the owner-controlled Visual Witness from current Forgejo main.\n\n// Wrap every Supabase client created in this runtime at construction time. The\n// first ephemeral-evidence repair patched one client instance, but live proof","old_content":"import { chromium, firefox, webkit, devices } from '@playwright/test';\nimport { createClient as createSupabaseClient } from '@supabase/supabase-js';\n\n// Release freshness marker: redeploy the canonical OnRunner witness from current main.\n\n// Wrap every Supabase client created in this runtime at construction time. The\n// first ephemeral-evidence repair patched one client instance, but live proof"},{"new_content":"const SUPABASE_SERVICE_KEY = String(process.env.VISUAL_WITNESS_SUPABASE_SERVICE_KEY || '');\nconst STORAGE_BUCKET = String(process.env.VISUAL_WITNESS_STORAGE_BUCKET || 'command-center-visual-witness');\nconst AUTH_STATE_PATH = String(process.env.VISUAL_WITNESS_AUTH_STATE_PATH || '/data/auth-state.json');\nconst SOURCE_COMMIT = String(process.env.KNOCKLAUNCH_SOURCE_SHA || process.env.GIT_COMMIT || 'unknown');\nconst RUNTIME_KIND = String(process.env.VISUAL_WITNESS_RUNTIME_KIND || 'laptop').trim() || 'laptop';\nconst VIRTUAL_RUNTIME_HEADLESS_DEFAULT = RUNTIME_KIND === 'virtual' || RUNTIME_KIND === 'paul';\nconst RUNTIME_LANE = String(process.env.VISUAL_WITNESS_RUNTIME_LANE || 'cc-execution -> KNOCKLAUNCH Visual Sandbox -> universal-witness.mjs').trim() || 'cc-execution -> KNOCKLAUNCH Visual Sandbox -> universal-witness.mjs';\nconst PAUL_HYBRID_STATUS_PATH = String(process.env.PAUL_HYBRID_STATUS_PATH || '/paul-hybrid/status.json').trim() || '/paul-hybrid/status.json';\nconst VERSION = `${RUNTIME_KIND}-${SOURCE_COMMIT.slice(0, 12)}`; // immutable runtime identity derived from the deployed source\nconst RUNTIME_CONTRACT = 'visual-witness-durable-resume-v1';\n// Release marker: deploy canonical app-origin authentication projection and fail-closed login-shell proof.\nconst ACCESS_STORAGE_KEY = 'kl_godmode_access_context_v1';","old_content":"const SUPABASE_SERVICE_KEY = String(process.env.VISUAL_WITNESS_SUPABASE_SERVICE_KEY || '');\nconst STORAGE_BUCKET = String(process.env.VISUAL_WITNESS_STORAGE_BUCKET || 'command-center-visual-witness');\nconst AUTH_STATE_PATH = String(process.env.VISUAL_WITNESS_AUTH_STATE_PATH || '/data/auth-state.json');\nconst RENDER_SOURCE_COMMIT = String(process.env.RENDER_GIT_COMMIT || 'unknown');\nconst RUNTIME_KIND = String(process.env.VISUAL_WITNESS_RUNTIME_KIND || 'onrunner').trim() || 'onrunner';\nconst VIRTUAL_RUNTIME_HEADLESS_DEFAULT = RUNTIME_KIND === 'virtual' || RUNTIME_KIND === 'paul';\nconst RUNTIME_LANE = String(process.env.VISUAL_WITNESS_RUNTIME_LANE || 'cc-execution -> Render OnRunner -> universal-witness.mjs').trim() || 'cc-execution -> Render OnRunner -> universal-witness.mjs';\nconst PAUL_HYBRID_STATUS_PATH = String(process.env.PAUL_HYBRID_STATUS_PATH || '/paul-hybrid/status.json').trim() || '/paul-hybrid/status.json';\nconst VERSION = `${RUNTIME_KIND}-${RENDER_SOURCE_COMMIT.slice(0, 12)}`; // immutable runtime identity derived from the deployed source\nconst RUNTIME_CONTRACT = 'visual-witness-durable-resume-v1';\n// Release marker: deploy canonical app-origin authentication projection and fail-closed login-shell proof.\nconst ACCESS_STORAGE_KEY = 'kl_godmode_access_context_v1';"},{"new_content":"}\nasync function persistSupervisorCheckpointState(job) {\n  if (!supabase || !job?.supervisorId) return;\n  const upload = await withIoTimeout(supabase.storage.from(STORAGE_BUCKET).upload(supervisorCheckpointPath(job.supervisorId), Buffer.from(JSON.stringify({ version: 2, supervisorId: job.supervisorId, sourceJobId: job.id, sourceCommit: SOURCE_COMMIT, runnerVersion: VERSION, checkpoints: Array.isArray(job.checkpoints) ? job.checkpoints : [], checkpointAccounting: checkpointAccounting(job), updatedAt: new Date().toISOString() })), { contentType: 'application/json', cacheControl: 'no-store', upsert: true }), 10_000, 'supervisor_checkpoint_upload');\n  if (upload?.error) throw new Error(`supervisor_checkpoint_upload_failed:${redact(upload.error.message)}`);\n}\nasync function loadSupervisorCheckpointState(supervisorId) {","old_content":"}\nasync function persistSupervisorCheckpointState(job) {\n  if (!supabase || !job?.supervisorId) return;\n  const upload = await withIoTimeout(supabase.storage.from(STORAGE_BUCKET).upload(supervisorCheckpointPath(job.supervisorId), Buffer.from(JSON.stringify({ version: 2, supervisorId: job.supervisorId, sourceJobId: job.id, sourceCommit: RENDER_SOURCE_COMMIT, runnerVersion: VERSION, checkpoints: Array.isArray(job.checkpoints) ? job.checkpoints : [], checkpointAccounting: checkpointAccounting(job), updatedAt: new Date().toISOString() })), { contentType: 'application/json', cacheControl: 'no-store', upsert: true }), 10_000, 'supervisor_checkpoint_upload');\n  if (upload?.error) throw new Error(`supervisor_checkpoint_upload_failed:${redact(upload.error.message)}`);\n}\nasync function loadSupervisorCheckpointState(supervisorId) {"},{"new_content":"    ok: job.status === 'completed' ? result?.ok === true : job.status !== 'failed' && job.status !== 'cancelled',\n    service: 'knocklaunch-universal-visual-witness',\n    version: VERSION,\n    sourceCommit: SOURCE_COMMIT,\n    runtimeLane: RUNTIME_LANE,\n    jobId: job.id,\n    job_id: job.id,","old_content":"    ok: job.status === 'completed' ? result?.ok === true : job.status !== 'failed' && job.status !== 'cancelled',\n    service: 'knocklaunch-universal-visual-witness',\n    version: VERSION,\n    sourceCommit: RENDER_SOURCE_COMMIT,\n    runtimeLane: RUNTIME_LANE,\n    jobId: job.id,\n    job_id: job.id,"},{"new_content":"    service: 'knocklaunch-universal-visual-witness',\n    version: VERSION,\n    runtimeContract: RUNTIME_CONTRACT,\n    sourceCommit: SOURCE_COMMIT,\n    canonicalLane: RUNTIME_LANE,\n    paulHybrid,\n    authenticatedProfile: true,","old_content":"    service: 'knocklaunch-universal-visual-witness',\n    version: VERSION,\n    runtimeContract: RUNTIME_CONTRACT,\n    sourceCommit: RENDER_SOURCE_COMMIT,\n    canonicalLane: RUNTIME_LANE,\n    paulHybrid,\n    authenticatedProfile: true,"},{"new_content":"  const supervisorId = safeText(resumeContext?.supervisorId || '', 160) || null;\n  const resumeState = supervisorId ? await loadSupervisorCheckpointState(supervisorId) : null;\n  const checkpointSourceCommit = String(resumeState?.sourceCommit || '').trim();\n  const checkpointSourceMatches = Boolean(checkpointSourceCommit) && checkpointSourceCommit === SOURCE_COMMIT;\n  const resumedCheckpoints = checkpointSourceMatches && Array.isArray(resumeState?.checkpoints) ? resumeState.checkpoints : [];\n  const checkpointResumeRejected = resumeState && !checkpointSourceMatches\n    ? {\n        reason: checkpointSourceCommit ? 'source_commit_mismatch' : 'source_commit_missing',\n        checkpointSourceCommit: checkpointSourceCommit || null,\n        currentSourceCommit: SOURCE_COMMIT,\n      }\n    : null;\n  const job = {","old_content":"  const supervisorId = safeText(resumeContext?.supervisorId || '', 160) || null;\n  const resumeState = supervisorId ? await loadSupervisorCheckpointState(supervisorId) : null;\n  const checkpointSourceCommit = String(resumeState?.sourceCommit || '').trim();\n  const checkpointSourceMatches = Boolean(checkpointSourceCommit) && checkpointSourceCommit === RENDER_SOURCE_COMMIT;\n  const resumedCheckpoints = checkpointSourceMatches && Array.isArray(resumeState?.checkpoints) ? resumeState.checkpoints : [];\n  const checkpointResumeRejected = resumeState && !checkpointSourceMatches\n    ? {\n        reason: checkpointSourceCommit ? 'source_commit_mismatch' : 'source_commit_missing',\n        checkpointSourceCommit: checkpointSourceCommit || null,\n        currentSourceCommit: RENDER_SOURCE_COMMIT,\n      }\n    : null;\n  const job = {"},{"new_content":"});\n\nserver.listen(PORT, '0.0.0.0', () => {\n  console.log(`[UniversalVisualWitness] listening on ${PORT} version=${VERSION} source=${SOURCE_COMMIT}`);\n  startVisualWitnessRetention({ drain: true });\n});\nconst retentionInterval = setInterval(() => startVisualWitnessRetention(), 6 * 60 * 60 * 1000);","old_content":"});\n\nserver.listen(PORT, '0.0.0.0', () => {\n  console.log(`[UniversalVisualWitness] listening on ${PORT} version=${VERSION} source=${RENDER_SOURCE_COMMIT}`);\n  startVisualWitnessRetention({ drain: true });\n});\nconst retentionInterval = setInterval(() => startVisualWitnessRetention(), 6 * 60 * 60 * 1000);"}]},{"path":"scripts/visual-witness-hosted-runner/test/interaction-headless-launch.contract.test.mjs","edits":[{"new_content":"const sourceUrl = new URL('../src/universal-witness.mjs', import.meta.url);\n\nasync function source() {\n  return (await readFile(sourceUrl, 'utf8')).replace(/\\r\\n/g, '\\n');\n}\n\ntest('explicit targeted interaction audits force Chromium headless without starting managed display capture', async () => {","old_content":"const sourceUrl = new URL('../src/universal-witness.mjs', import.meta.url);\n\nasync function source() {\n  return readFile(sourceUrl, 'utf8');\n}\n\ntest('explicit targeted interaction audits force Chromium headless without starting managed display capture', async () => {"}]},{"path":"scripts/visual-witness-hosted-runner/test/mission-supervisor-durability.test.mjs","edits":[{"new_content":"});\n\ntest('checkpoint resume is bound to exact witness source commit and fails closed across source changes', async () => {\n  const source = (await readFile(witnessSourceUrl, 'utf8')).replace(/\\r\\n/g, '\\n');\n  assert.match(source, /sourceCommit: SOURCE_COMMIT/);\n  assert.match(source, /const checkpointSourceCommit = String\\(resumeState\\?\\.sourceCommit \\|\\| ''\\)\\.trim\\(\\);/);\n  assert.match(source, /checkpointSourceCommit === SOURCE_COMMIT/);\n  assert.match(source, /const resumedCheckpoints = checkpointSourceMatches/);\n  assert.match(source, /reason: checkpointSourceCommit \\? 'source_commit_mismatch' : 'source_commit_missing'/);\n  assert.match(source, /currentSourceCommit: SOURCE_COMMIT/);\n  assert.match(source, /checkpointResumeRejected/);\n});\n","old_content":"});\n\ntest('checkpoint resume is bound to exact witness source commit and fails closed across source changes', async () => {\n  const source = await readFile(witnessSourceUrl, 'utf8');\n  assert.match(source, /sourceCommit: RENDER_SOURCE_COMMIT/);\n  assert.match(source, /const checkpointSourceCommit = String\\(resumeState\\?\\.sourceCommit \\|\\| ''\\)\\.trim\\(\\);/);\n  assert.match(source, /checkpointSourceCommit === RENDER_SOURCE_COMMIT/);\n  assert.match(source, /const resumedCheckpoints = checkpointSourceMatches/);\n  assert.match(source, /reason: checkpointSourceCommit \\? 'source_commit_mismatch' : 'source_commit_missing'/);\n  assert.match(source, /currentSourceCommit: RENDER_SOURCE_COMMIT/);\n  assert.match(source, /checkpointResumeRejected/);\n});\n"}]},{"path":"scripts/visual-witness-hosted-runner/test/supervisor-active-progress-projection.test.mjs","edits":[{"new_content":"  const persisted = [];\n  let reads = 0;\n  const supervisor = new MissionSupervisor({\n    runtimeLane: 'KNOCKLAUNCH Visual Sandbox',\n    createAttempt: async () => ({ id: 'attempt-1', status: 'queued', phase: 'queued', progress: { phase: 'queued' } }),\n    readAttempt: async () => {\n      reads += 1;","old_content":"  const persisted = [];\n  let reads = 0;\n  const supervisor = new MissionSupervisor({\n    runtimeLane: 'Render OnRunner',\n    createAttempt: async () => ({ id: 'attempt-1', status: 'queued', phase: 'queued', progress: { phase: 'queued' } }),\n    readAttempt: async () => {\n      reads += 1;"}]},{"path":"src/config/platformCapabilityMatrix.ts","edits":[{"new_content":"] as const;\n\nexport const EDGE_FUNCTION_BUCKETS: readonly EdgeFunctionBucket[] = [\n  { id: 'command-center', label: 'Command Center and proof lanes', examples: ['cc-agent', 'cc-tools', 'command-center-autopilot', 'command-center-sql-ops', 'cc-execution', 'visual-witness-hosted-runner'], risk: ['protected', 'destructive'], requiredClassification: ['owner approval', 'safe view/PII boundary', 'deploy freshness', 'health/openapi/logs', 'managed profile_ref only', 'tenant-tagged screenshot artifact', 'manifest receipt', 'visual proof where UI-facing'], currentHealth: 'proven', nextAction: 'Use cc-execution as the only visual gateway and the owner-controlled KNOCKLAUNCH Visual Sandbox as the supervised browser runtime.' },\n  { id: 'admin-tenant-user', label: 'Admin, tenant, user, and auth operations', examples: ['admin-create-user', 'admin-reset-password', 'tenant-manage', 'user-roles-manage', 'user-whoami'], risk: ['protected', 'destructive'], requiredClassification: ['role required', 'tenant boundary', 'write/read/delete', 'audit log', 'read-back required'], currentHealth: 'partial', nextAction: 'Classify every admin/user/tenant function by destructive capability and proof requirement.' },\n  { id: 'crm-pipeline', label: 'CRM, contacts, leads, workflows', examples: ['contacts-manage', 'leads-manage', 'claim-lead', 'workflows-manage'], risk: ['protected'], requiredClassification: ['frontend caller', 'tenant scope', 'RLS/server guard', 'bulk action risk'], currentHealth: 'partial', nextAction: 'Map every pipeline route to caller functions and role boundaries.' },\n  { id: 'communications', label: 'Twilio, SMS, email, voicemail, compliance', examples: ['twilio-voice-webhook', 'send-sms', 'send-email', 'dnc-operations', 'compliance-preflight'], risk: ['protected', 'external_mutation'], requiredClassification: ['external provider', 'webhook verification', 'DNC/compliance check', 'PII scrub', 'retry/idempotency'], currentHealth: 'partial', nextAction: 'Separate provider webhooks from user-triggered mutations and prove compliance preflight.' },","old_content":"] as const;\n\nexport const EDGE_FUNCTION_BUCKETS: readonly EdgeFunctionBucket[] = [\n  { id: 'command-center', label: 'Command Center and proof lanes', examples: ['cc-agent', 'cc-tools', 'command-center-autopilot', 'command-center-sql-ops', 'cc-execution', 'visual-witness-hosted-runner'], risk: ['protected', 'destructive'], requiredClassification: ['owner approval', 'safe view/PII boundary', 'deploy freshness', 'health/openapi/logs', 'managed profile_ref only', 'tenant-tagged screenshot artifact', 'manifest receipt', 'visual proof where UI-facing'], currentHealth: 'proven', nextAction: 'Use cc-execution as the only visual gateway and Render OnRunner Universal Witness as the supervised browser runtime.' },\n  { id: 'admin-tenant-user', label: 'Admin, tenant, user, and auth operations', examples: ['admin-create-user', 'admin-reset-password', 'tenant-manage', 'user-roles-manage', 'user-whoami'], risk: ['protected', 'destructive'], requiredClassification: ['role required', 'tenant boundary', 'write/read/delete', 'audit log', 'read-back required'], currentHealth: 'partial', nextAction: 'Classify every admin/user/tenant function by destructive capability and proof requirement.' },\n  { id: 'crm-pipeline', label: 'CRM, contacts, leads, workflows', examples: ['contacts-manage', 'leads-manage', 'claim-lead', 'workflows-manage'], risk: ['protected'], requiredClassification: ['frontend caller', 'tenant scope', 'RLS/server guard', 'bulk action risk'], currentHealth: 'partial', nextAction: 'Map every pipeline route to caller functions and role boundaries.' },\n  { id: 'communications', label: 'Twilio, SMS, email, voicemail, compliance', examples: ['twilio-voice-webhook', 'send-sms', 'send-email', 'dnc-operations', 'compliance-preflight'], risk: ['protected', 'external_mutation'], requiredClassification: ['external provider', 'webhook verification', 'DNC/compliance check', 'PII scrub', 'retry/idempotency'], currentHealth: 'partial', nextAction: 'Separate provider webhooks from user-triggered mutations and prove compliance preflight.' },"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 2 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 2 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["scripts/release-target-ownership.test.mjs","scripts/visual-witness-hosted-runner/Dockerfile","scripts/visual-witness-hosted-runner/src/__tests__/mission-supervisor.test.mjs","scripts/visual-witness-hosted-runner/src/mission-gateway.mjs","scripts/visual-witness-hosted-runner/src/universal-witness.mjs","scripts/visual-witness-hosted-runner/test/interaction-headless-launch.contract.test.mjs","scripts/visual-witness-hosted-runner/test/mission-supervisor-durability.test.mjs","scripts/visual-witness-hosted-runner/test/supervisor-active-progress-projection.test.mjs","src/config/platformCapabilityMatrix.ts"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 2 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 2 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["scripts/release-target-ownership.test.mjs","scripts/visual-witness-hosted-runner/Dockerfile","scripts/visual-witness-hosted-runner/src/__tests__/mission-supervisor.test.mjs","scripts/visual-witness-hosted-runner/src/mission-gateway.mjs","scripts/visual-witness-hosted-runner/src/universal-witness.mjs","scripts/visual-witness-hosted-runner/test/interaction-headless-launch.contract.test.mjs","scripts/visual-witness-hosted-runner/test/mission-supervisor-durability.test.mjs","scripts/visual-witness-hosted-runner/test/supervisor-active-progress-projection.test.mjs","src/config/platformCapabilityMatrix.ts"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["scripts/release-target-ownership.test.mjs","scripts/visual-witness-hosted-runner/Dockerfile","scripts/visual-witness-hosted-runner/src/__tests__/mission-supervisor.test.mjs","scripts/visual-witness-hosted-runner/src/mission-gateway.mjs","scripts/visual-witness-hosted-runner/src/universal-witness.mjs","scripts/visual-witness-hosted-runner/test/interaction-headless-launch.contract.test.mjs","scripts/visual-witness-hosted-runner/test/mission-supervisor-durability.test.mjs","scripts/visual-witness-hosted-runner/test/supervisor-active-progress-projection.test.mjs","src/config/platformCapabilityMatrix.ts"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"recovery":false,"fingerprint":"c396301e32b51f2f9c3dda1a37e54d57fdb152b617480cc1c23b4d21d968f2bb","replayCount":0,"serializedBytes":29753},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:53.851402+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:8a7bb657-b031-451c-bb29-f9c4cb54bf9c:repository-mutation-intent:c396301e32b51f2f9c3dda1a37e54d57fdb152b617480cc1c23b4d21d968f2bb:0","mission_step_id":"81decc47-47e9-4d60-8ca6-0d02a7e771d2","command_center_event_id":"8a7bb657-b031-451c-bb29-f9c4cb54bf9c"},{"id":"78c6b3e3-43d2-4c26-8b3b-47de72f8ed61","source":"cc-execution","status":"complete","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":null,"status":"complete","metrics":{"receiptBytes":29900,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:31:53.797Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4073,"terminal":false,"missionId":"8a7bb657-b031-451c-bb29-f9c4cb54bf9c","operation":"execute_mission","proofGate":"repair_mission_prepared","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":7634,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":321,"providerAuthMs":0,"ledgerPrepareMs":321,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":321,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":321,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"continue_batch_or_ship_and_prove","receiptRef":{"mode":"full","missionId":"8a7bb657-b031-451c-bb29-f9c4cb54bf9c"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":4133,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:32:02.524833+00:00","proof_gate":"repair_mission_prepared","source_sha":null,"external_id":"4073","receipt_type":"execute_mission","idempotency_key":"mission:8a7bb657-b031-451c-bb29-f9c4cb54bf9c:execute_mission:repair_mission_prepared:current-generation","mission_step_id":"81decc47-47e9-4d60-8ca6-0d02a7e771d2","command_center_event_id":"8a7bb657-b031-451c-bb29-f9c4cb54bf9c"},{"id":"d7019b4e-869d-41b4-b3fd-42487df8909f","source":"cc-execution","status":"complete","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":null,"status":"complete","metrics":{"receiptBytes":29434,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:32:29.937Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4073,"terminal":false,"missionId":"d31923ac-371e-4a5b-9034-e02109a06e33","operation":"execute_mission","proofGate":"repair_mission_prepared","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":4482,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":279,"providerAuthMs":0,"ledgerPrepareMs":279,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":279,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":279,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"continue_batch_or_ship_and_prove","receiptRef":{"mode":"full","missionId":"d31923ac-371e-4a5b-9034-e02109a06e33"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3870,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:32:35.441544+00:00","proof_gate":"repair_mission_prepared","source_sha":null,"external_id":"4073","receipt_type":"execute_mission","idempotency_key":"mission:d31923ac-371e-4a5b-9034-e02109a06e33:execute_mission:repair_mission_prepared:current-generation","mission_step_id":"b12b3526-ace1-491c-8b04-d14bbda04108","command_center_event_id":"d31923ac-371e-4a5b-9034-e02109a06e33"},{"id":"1d39142e-d004-4fc5-86d3-5a261fbc2512","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"7e0fa14d-6c4b-4f73-8a11-d14205162dbf","objective":"Apply exact repository-authority decruft batch 4 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/index-controlled-deploy-gate.js","workers/cc-execution/src/index-mcp.js","workers/cc-execution/src/index-mission-control.js"],"workstreamKey":"repo-decruft-pr4073-batch4-c2eea2a4ff6c","anchored_edits":[{"path":"workers/cc-execution/src/index-controlled-deploy-gate.js","edits":[{"new_content":"import edgeFunctionDeployWorker from \"./index-edge-function-deploy-lane.js\";\n\nconst SERVICE_NAME = \"cc-execution\";\nconst VERSION = \"1.5.4-provider-neutral-deploy-targets\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\n\nfunction json(body, status = 200) {","old_content":"import edgeFunctionDeployWorker from \"./index-edge-function-deploy-lane.js\";\n\nconst SERVICE_NAME = \"cc-execution\";\nconst VERSION = \"1.5.3-render-onrunner-target\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\n\nfunction json(body, status = 200) {"},{"new_content":"\n  const target = String(body.target || body.functionName || body.function_name || \"\").trim();\n  const isEdgeFunction = expectedVersion.startsWith(\"edge-function:\");\n  if (!isEdgeFunction && target && target !== \"cc-execution\") {\n    return json({ ok: false, status: \"blocked\", proofGate: \"repair_plan_deploy_blocked\", reason: \"unsupported_deployment_target\", target, destructiveActionsAllowed: false }, 400);\n  }\n  const dispatched = isEdgeFunction\n    ? await (async () => {\n        const url = new URL(request.url);","old_content":"\n  const target = String(body.target || body.functionName || body.function_name || \"\").trim();\n  const isEdgeFunction = expectedVersion.startsWith(\"edge-function:\");\n  const dispatched = isEdgeFunction\n    ? await (async () => {\n        const url = new URL(request.url);"},{"new_content":"      })()\n    : await callMergeWorker(request, env, ctx, \"/deploy/request\", {\n        repository,\n        ref,\n        deploymentId,\n        expectedVersion,\n        target,","old_content":"      })()\n    : await callMergeWorker(request, env, ctx, \"/deploy/request\", {\n        repository,\n        ref: target === \"render-onrunner\" ? \"main\" : ref,\n        deploymentId,\n        expectedVersion,\n        target,"}]},{"path":"workers/cc-execution/src/index-mcp.js","edits":[{"new_content":"  tool(\n    \"inspect_route_health\",\n    \"Check visual witness health\",\n    \"Verify the canonical supervised KNOCKLAUNCH visual-sandbox lane before starting a mission.\",\n    \"/repair/inspect-route/health\",\n    emptyInput,\n    { readOnly: true, idempotent: true },","old_content":"  tool(\n    \"inspect_route_health\",\n    \"Check visual witness health\",\n    \"Verify the canonical Render OnRunner supervised visual-witness lane before starting a mission.\",\n    \"/repair/inspect-route/health\",\n    emptyInput,\n    { readOnly: true, idempotent: true },"},{"new_content":"  tool(\n    \"inspect_route\",\n    \"Start authenticated route inspection\",\n    \"Start one durable supervised KNOCKLAUNCH visual-sandbox mission for an exact route using GodMode authority with optional actual tenant-user or representative-role projection.\",\n    \"/repair/inspect-route/start\",\n    {\n      type: \"object\",","old_content":"  tool(\n    \"inspect_route\",\n    \"Start authenticated route inspection\",\n    \"Start one durable supervised Render OnRunner mission for an exact KNOCKLAUNCH route using GodMode authority with optional actual tenant-user or representative-role projection.\",\n    \"/repair/inspect-route/start\",\n    {\n      type: \"object\","},{"new_content":"  tool(\n    \"inspect_route_status\",\n    \"Read route inspection status\",\n    \"Poll one supervised visual-sandbox mission and return its normalized terminal evidence receipt, including desktop and mobile proof.\",\n    \"/repair/inspect-route/status\",\n    {\n      type: \"object\",","old_content":"  tool(\n    \"inspect_route_status\",\n    \"Read route inspection status\",\n    \"Poll one supervised OnRunner mission and return its normalized terminal evidence receipt, including desktop and mobile proof.\",\n    \"/repair/inspect-route/status\",\n    {\n      type: \"object\","},{"new_content":"  tool(\n    \"inspect_route_cancel\",\n    \"Cancel route inspection\",\n    \"Cancel one supervised visual-sandbox mission by its durable job identifier.\",\n    \"/repair/inspect-route/cancel\",\n    {\n      type: \"object\",","old_content":"  tool(\n    \"inspect_route_cancel\",\n    \"Cancel route inspection\",\n    \"Cancel one supervised OnRunner mission by its durable job identifier.\",\n    \"/repair/inspect-route/cancel\",\n    {\n      type: \"object\","}]},{"path":"workers/cc-execution/src/index-mission-control.js","edits":[{"new_content":"    : {};\n  const releaseOnlyProtectedMainRecovery = (!Number.isInteger(Number(prNumber)) || Number(prNumber) < 1)\n    && /^[0-9a-f]{40}$/i.test(explicitProtectedMainSourceSha)\n    && [\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"].some((target) => explicitReleaseRequirements[target] === true);\n  if (releaseOnlyProtectedMainRecovery) {\n    const currentMainSnapshot = await readMainSnapshot(env, false);\n    const currentMainSha = String(currentMainSnapshot?.sha || \"\").trim();","old_content":"    : {};\n  const releaseOnlyProtectedMainRecovery = (!Number.isInteger(Number(prNumber)) || Number(prNumber) < 1)\n    && /^[0-9a-f]{40}$/i.test(explicitProtectedMainSourceSha)\n    && [\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"].some((target) => explicitReleaseRequirements[target] === true);\n  if (releaseOnlyProtectedMainRecovery) {\n    const currentMainSnapshot = await readMainSnapshot(env, false);\n    const currentMainSha = String(currentMainSnapshot?.sha || \"\").trim();"},{"new_content":"    ? preverifiedRecoverySeed.releaseTargets\n    : {};\n  let targets = releaseOnlyProtectedMainRecovery\n    ? { ccExecution: false, frontend: false, supabaseEdge: false, migrations: false, edgeFunctionSlugs: [] }\n    : preverifiedRecoverySeed\n      ? {\n          ccExecution: seededRecoveryTargets.ccExecution === true,\n          frontend: seededRecoveryTargets.frontend === true,\n          supabaseEdge: seededRecoveryTargets.supabaseEdge === true,\n          migrations: seededRecoveryTargets.migrations === true,","old_content":"    ? preverifiedRecoverySeed.releaseTargets\n    : {};\n  let targets = releaseOnlyProtectedMainRecovery\n    ? { ccExecution: false, onrunner: false, frontend: false, supabaseEdge: false, migrations: false, edgeFunctionSlugs: [] }\n    : preverifiedRecoverySeed\n      ? {\n          ccExecution: seededRecoveryTargets.ccExecution === true,\n          onrunner: seededRecoveryTargets.onrunner === true,\n          frontend: seededRecoveryTargets.frontend === true,\n          supabaseEdge: seededRecoveryTargets.supabaseEdge === true,\n          migrations: seededRecoveryTargets.migrations === true,"},{"new_content":"        }\n      : { ...releaseTargetsFromPaths(paths), edgeFunctionSlugs };\n  targets = mergeForgejoReleaseRequirements(targets, requiredReleaseTargetsInput);\n  let releaseRequired = targets.ccExecution || targets.frontend || targets.supabaseEdge || targets.migrations;\n  const risk = releaseRisk(paths);\n  const decisionConfidence = confidenceScore({ samples: localIntelligenceState?.operations?.length || 0, recurrence: risk.reasons.length, deterministic: true });\n  let pr = preverifiedReadiness","old_content":"        }\n      : { ...releaseTargetsFromPaths(paths), edgeFunctionSlugs };\n  targets = mergeForgejoReleaseRequirements(targets, requiredReleaseTargetsInput);\n  let releaseRequired = targets.ccExecution || targets.onrunner || targets.frontend || targets.supabaseEdge || targets.migrations;\n  const risk = releaseRisk(paths);\n  const decisionConfidence = confidenceScore({ samples: localIntelligenceState?.operations?.length || 0, recurrence: risk.reasons.length, deterministic: true });\n  let pr = preverifiedReadiness"},{"new_content":"      : null;\n  if (preverifiedRecovery) {\n    const durableUnfinishedTargets = preverifiedRecovery.releaseTargets;\n    for (const target of [\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"]) {\n      targets[target] = targets[target] === true && durableUnfinishedTargets[target] === true;\n    }\n    if (!targets.supabaseEdge) targets.edgeFunctionSlugs = [];\n    releaseRequired = targets.ccExecution || targets.frontend || targets.supabaseEdge || targets.migrations;\n    if (!releaseRequired) throw new Error(\"preverified_recovery_target_scope_empty\");\n  }\n  let knownWorkflowRun = null;","old_content":"      : null;\n  if (preverifiedRecovery) {\n    const durableUnfinishedTargets = preverifiedRecovery.releaseTargets;\n    for (const target of [\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"]) {\n      targets[target] = targets[target] === true && durableUnfinishedTargets[target] === true;\n    }\n    if (!targets.supabaseEdge) targets.edgeFunctionSlugs = [];\n    releaseRequired = targets.ccExecution || targets.onrunner || targets.frontend || targets.supabaseEdge || targets.migrations;\n    if (!releaseRequired) throw new Error(\"preverified_recovery_target_scope_empty\");\n  }\n  let knownWorkflowRun = null;"},{"new_content":"  }\n  const preverifiedKnownRunTargetStates = {};\n  if (preverifiedRecovery) {\n    for (const target of [\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"]) {\n      if (targets[target] !== true) continue;\n      const state = String(preverifiedRecovery.targetStates[target] || \"\").trim().toLowerCase();\n      if ([\"success\", \"failure\", \"pending\"].includes(state)) preverifiedKnownRunTargetStates[target] = state;","old_content":"  }\n  const preverifiedKnownRunTargetStates = {};\n  if (preverifiedRecovery) {\n    for (const target of [\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"]) {\n      if (targets[target] !== true) continue;\n      const state = String(preverifiedRecovery.targetStates[target] || \"\").trim().toLowerCase();\n      if ([\"success\", \"failure\", \"pending\"].includes(state)) preverifiedKnownRunTargetStates[target] = state;"},{"new_content":"    sourceSha = mainSha;\n\n    const exactLiveCcExecutionOnly = targets.ccExecution\n      && !targets.frontend\n      && !targets.supabaseEdge\n      && !targets.migrations;","old_content":"    sourceSha = mainSha;\n\n    const exactLiveCcExecutionOnly = targets.ccExecution\n      && !targets.onrunner\n      && !targets.frontend\n      && !targets.supabaseEdge\n      && !targets.migrations;"},{"new_content":"    }\n\n    const ccExecutionOnly = targets.ccExecution\n      && !targets.frontend\n      && !targets.supabaseEdge\n      && !targets.migrations;","old_content":"    }\n\n    const ccExecutionOnly = targets.ccExecution\n      && !targets.onrunner\n      && !targets.frontend\n      && !targets.supabaseEdge\n      && !targets.migrations;"},{"new_content":"            source_sha: sourceSha,\n            changed_paths_b64: encodeUtf8Base64(paths.join(\"\\n\")),\n            release_cc_execution: dispatchTargets.ccExecution ? \"true\" : \"false\",\n            release_frontend: dispatchTargets.frontend ? \"true\" : \"false\",\n            release_supabase_edge: dispatchTargets.supabaseEdge ? \"true\" : \"false\",\n            release_migrations: dispatchTargets.migrations ? \"true\" : \"false\",","old_content":"            source_sha: sourceSha,\n            changed_paths_b64: encodeUtf8Base64(paths.join(\"\\n\")),\n            release_cc_execution: dispatchTargets.ccExecution ? \"true\" : \"false\",\n            release_onrunner: dispatchTargets.onrunner ? \"true\" : \"false\",\n            release_frontend: dispatchTargets.frontend ? \"true\" : \"false\",\n            release_supabase_edge: dispatchTargets.supabaseEdge ? \"true\" : \"false\",\n            release_migrations: dispatchTargets.migrations ? \"true\" : \"false\","},{"new_content":"  return callVisual(request, env, ctx, \"/repair/inspect-route/start\", payload);\n}\n\nfunction genericOperation(operationId, summary) {\n  return {\n    operationId,","old_content":"  return callVisual(request, env, ctx, \"/repair/inspect-route/start\", payload);\n}\n\nasync function startVisualLegacy(request, env, ctx, payload = {}) {\n  const hostedUrl = String(\n    env.VISUAL_WITNESS_HOSTED_RUNNER_URL\n      || env.HOSTED_VISUAL_WITNESS_RUNNER_URL\n      || \"https://knocklaunchcrm.onrender.com\",\n  ).trim().replace(/\\/+$/g, \"\");\n  const runnerBearer = String(\n    env.VISUAL_WITNESS_RUNNER_BEARER\n      || env.HOSTED_VISUAL_WITNESS_RUNNER_BEARER\n      || env.VISUAL_WITNESS_HOSTED_RUNNER_BEARER\n      || \"\",\n  ).trim();\n\n  if (!runnerBearer) {\n    return {\n      response: { ok: false, status: 503 },\n      data: { ok: false, status: \"blocked\", proofGate: \"visual_start_blocked\", reason: \"runner_bearer_missing\" },\n    };\n  }\n\n  const exactRoute = String(payload.route || \"/\").trim();\n  let authorizedOrigins = [];\n  try {\n    authorizedOrigins = await resolveVisualWitnessAuthorizedOrigins(env, exactRoute);\n  } catch (error) {\n    const status = Number(error?.status || 502);\n    return {\n      response: { ok: false, status },\n      data: {\n        ok: false,\n        status: \"blocked\",\n        proofGate: \"visual_start_origin_blocked\",\n        reason: error instanceof Error ? error.message : String(error),\n        requestedRoute: exactRoute,\n      },\n    };\n  }\n  const normalizedMission = buildVisualMission({ ...payload, route: exactRoute });\n  if (authorizedOrigins.length) normalizedMission.authorizedOrigins = authorizedOrigins;\n  const startedAt = Date.now();\n  try {\n    const wakeStartedAt = Date.now();\n    let wakeAttempts = 0;\n    let wakeReceipt = null;\n    let wakeFailure = null;\n    for (let attempt = 1; attempt <= 3; attempt += 1) {\n      wakeAttempts = attempt;\n      try {\n        const wakeResponse = await fetch(`${hostedUrl}/health?wake=${Date.now()}`, {\n          headers: { \"Cache-Control\": \"no-cache\" },\n          signal: AbortSignal.timeout(attempt === 1 ? 8000 : 12000),\n        });\n        wakeReceipt = await wakeResponse.json().catch(() => null);\n        if (wakeResponse.ok && wakeReceipt?.ok === true) {\n          wakeFailure = null;\n          break;\n        }\n        wakeFailure = `visual_witness_runner_not_ready:${wakeResponse.status}:${wakeReceipt?.brokerStartupErrorCode || wakeReceipt?.status || \"health_not_ok\"}`;\n      } catch (error) {\n        wakeFailure = `visual_witness_wake_transport:${error instanceof Error ? error.message : String(error)}`;\n      }\n      if (attempt < 3) await new Promise((resolve) => setTimeout(resolve, 350 * attempt));\n    }\n    const wakeMs = Date.now() - wakeStartedAt;\n    if (wakeFailure) {\n      return {\n        response: { ok: false, status: 503 },\n        data: {\n          ok: false,\n          status: \"blocked\",\n          proofGate: \"visual_start_runner_unready\",\n          reason: wakeFailure,\n          hostedUrl,\n          wakeAttempts,\n          runner: wakeReceipt ? {\n            service: wakeReceipt.service || null,\n            version: wakeReceipt.version || null,\n            sourceCommit: wakeReceipt.sourceCommit || null,\n            brokerStartupStatus: wakeReceipt.brokerStartupStatus || null,\n            brokerStartupErrorCode: wakeReceipt.brokerStartupErrorCode || null,\n          } : null,\n          timingsMs: { wake: wakeMs, total: Date.now() - startedAt },\n        },\n      };\n    }\n    const submitStartedAt = Date.now();\n    const response = await fetch(`${hostedUrl}/supervised-missions`, {\n      method: \"POST\",\n      headers: { Authorization: `Bearer ${runnerBearer}`, \"Content-Type\": \"application/json\" },\n      body: JSON.stringify(normalizedMission),\n      signal: AbortSignal.timeout(30000),\n    });\n    const submitMs = Date.now() - submitStartedAt;\n    const totalMs = Date.now() - startedAt;\n    const receipt = await response.json().catch(() => ({ ok: false, status: \"blocked\", proofGate: \"invalid_onrunner_start_response\" }));\n    const jobId = receipt?.supervisor_id || receipt?.supervisorId || receipt?.job_id || receipt?.jobId || null;\n    const accepted = response.ok && Boolean(jobId);\n    const data = accepted\n      ? {\n          ok: true,\n          status: \"pending\",\n          phase: \"universal_visual_witness_supervised\",\n          proofGate: \"universal_visual_witness_pending\",\n          visualAcceptance: null,\n          jobId,\n          supervisorId: receipt?.supervisor_id || receipt?.supervisorId || jobId,\n          supervised: true,\n          requestedRoute: exactRoute,\n          tenant: payload.tenantRef || payload.tenant || null,\n          role: payload.roleRef || payload.projection || \"GodMode\",\n          profile: payload.profileRef || payload.profile || \"default\",\n          mode: normalizedMission.mode,\n          scope: normalizedMission.scope,\n          viewports: normalizedMission.viewports,\n          timingsMs: { wake: wakeMs, wakeAttempts, submit: submitMs, total: totalMs },\n          jobStatus: receipt?.status || \"running\",\n          terminal: false,\n          nextAction: \"Poll inspect_route_status or cancel with inspect_route_cancel.\",\n        }\n      : {\n          ok: false,\n          status: \"blocked\",\n          proofGate: \"visual_start_rejected\",\n          reason: receipt?.error || receipt?.failureReason || `onrunner_http_${response.status}`,\n          runner: receipt,\n        };\n    return { response: { ok: accepted, status: response.status }, data };\n  } catch (error) {\n    const totalMs = Date.now() - startedAt;\n    return {\n      response: { ok: false, status: 502 },\n      data: {\n        ok: false,\n        status: \"blocked\",\n        proofGate: \"visual_start_onrunner_failed\",\n        reason: error instanceof Error ? error.message : String(error),\n        timingsMs: { total: totalMs },\n      },\n    };\n  }\n}\n\nfunction genericOperation(operationId, summary) {\n  return {\n    operationId,"},{"new_content":"  ));\n  ensureOperation(document, \"/repair/inspect-route\", \"post\", genericOperation(\n    \"ccExecutionInspectRoute\",\n    \"Run the canonical authenticated KNOCKLAUNCH visual-sandbox proof lane with the default profile and GodMode projection.\",\n  ));\n  ensureOperation(document, \"/release/ship-pr\", \"post\", genericOperation(\n    \"ccExecutionShipPr\",","old_content":"  ));\n  ensureOperation(document, \"/repair/inspect-route\", \"post\", genericOperation(\n    \"ccExecutionInspectRoute\",\n    \"Run the canonical authenticated Render OnRunner visual proof lane with the default profile and GodMode projection.\",\n  ));\n  ensureOperation(document, \"/release/ship-pr\", \"post\", genericOperation(\n    \"ccExecutionShipPr\","},{"new_content":"  const appended = await appendMissionReceipt(env, mission.missionId, {\n    step_key: \"visual_proof\",\n    receipt_type: \"visual_proof_status\",\n    source: \"visual-sandbox\",\n    status: receiptStatus,\n    proof_gate: proofGate,\n    external_id: mission.jobId,","old_content":"  const appended = await appendMissionReceipt(env, mission.missionId, {\n    step_key: \"visual_proof\",\n    receipt_type: \"visual_proof_status\",\n    source: \"onrunner\",\n    status: receiptStatus,\n    proof_gate: proofGate,\n    external_id: mission.jobId,"},{"new_content":"    || proof.workflowStatus\n    || \"\",\n  ).trim().toLowerCase();\n  const hasAffectedReleaseTarget = [\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"]\n    .some((target) => releaseTargets[target] === true);\n  const cancelledAffectedTargetRecovery = [\"cancelled\", \"canceled\"].includes(workflowState)\n    && hasAffectedReleaseTarget","old_content":"    || proof.workflowStatus\n    || \"\",\n  ).trim().toLowerCase();\n  const hasAffectedReleaseTarget = [\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"]\n    .some((target) => releaseTargets[target] === true);\n  const cancelledAffectedTargetRecovery = [\"cancelled\", \"canceled\"].includes(workflowState)\n    && hasAffectedReleaseTarget"},{"new_content":"    },\n    canonicalVisualLane: {\n      route: \"/repair/inspect-route\",\n      runtime: \"KNOCKLAUNCH Visual Sandbox\",\n      source: \"scripts/visual-witness-hosted-runner/src/runner-entrypoint.mjs -> universal-witness.mjs\",\n      profile: \"default\",\n      projection: \"GodMode\",","old_content":"    },\n    canonicalVisualLane: {\n      route: \"/repair/inspect-route\",\n      runtime: \"Render OnRunner\",\n      source: \"scripts/visual-witness-hosted-runner/src/runner-entrypoint.mjs -> universal-witness.mjs\",\n      profile: \"default\",\n      projection: \"GodMode\","},{"new_content":"    && explicitRequiredReleaseTargets\n    && typeof explicitRequiredReleaseTargets === \"object\"\n    && !Array.isArray(explicitRequiredReleaseTargets)\n    && [\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"].some((target) => explicitRequiredReleaseTargets[target] === true);\n  if ((!Number.isInteger(prNumber) || prNumber < 1) && !releaseOnlyProtectedMainRecovery) {\n    return json({ ok: false, status: \"blocked\", proofGate: \"ship_and_prove_blocked\", reason: \"valid_prNumber_required\" }, 400);\n  }","old_content":"    && explicitRequiredReleaseTargets\n    && typeof explicitRequiredReleaseTargets === \"object\"\n    && !Array.isArray(explicitRequiredReleaseTargets)\n    && [\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"].some((target) => explicitRequiredReleaseTargets[target] === true);\n  if ((!Number.isInteger(prNumber) || prNumber < 1) && !releaseOnlyProtectedMainRecovery) {\n    return json({ ok: false, status: \"blocked\", proofGate: \"ship_and_prove_blocked\", reason: \"valid_prNumber_required\" }, 400);\n  }"},{"new_content":"    && explicitRequiredReleaseTargets\n    && typeof explicitRequiredReleaseTargets === \"object\"\n    && !Array.isArray(explicitRequiredReleaseTargets)\n    && [\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"].some((target) => explicitRequiredReleaseTargets[target] === true);\n  const missionIdForLineage = String(body.missionId || body.mission_id || \"\").trim();\n  if ((!Number.isInteger(existingPrNumber) || existingPrNumber < 1) && !hasMutationPayload && missionIdForLineage) {\n    const persisted = await readMission(env, missionIdForLineage, false);","old_content":"    && explicitRequiredReleaseTargets\n    && typeof explicitRequiredReleaseTargets === \"object\"\n    && !Array.isArray(explicitRequiredReleaseTargets)\n    && [\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"].some((target) => explicitRequiredReleaseTargets[target] === true);\n  const missionIdForLineage = String(body.missionId || body.mission_id || \"\").trim();\n  if ((!Number.isInteger(existingPrNumber) || existingPrNumber < 1) && !hasMutationPayload && missionIdForLineage) {\n    const persisted = await readMission(env, missionIdForLineage, false);"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 4 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 4 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/index-controlled-deploy-gate.js","workers/cc-execution/src/index-mcp.js","workers/cc-execution/src/index-mission-control.js"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 4 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 4 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/index-controlled-deploy-gate.js","workers/cc-execution/src/index-mcp.js","workers/cc-execution/src/index-mission-control.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/index-controlled-deploy-gate.js","workers/cc-execution/src/index-mcp.js","workers/cc-execution/src/index-mission-control.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"recovery":false,"fingerprint":"b09d52a7d5efbe1f6ee62ac8ca45dd580800c41af52f10656ebe86374fd4b563","replayCount":0,"serializedBytes":27445},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:32:58.769246+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:7e0fa14d-6c4b-4f73-8a11-d14205162dbf:repository-mutation-intent:b09d52a7d5efbe1f6ee62ac8ca45dd580800c41af52f10656ebe86374fd4b563:0","mission_step_id":"5b461ec2-4aaf-4e90-87e9-c6ae60b54720","command_center_event_id":"7e0fa14d-6c4b-4f73-8a11-d14205162dbf"},{"id":"217176bf-acf1-46fc-ab11-80063d7c24c8","source":"cc-execution","status":"complete","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":null,"status":"complete","metrics":{"receiptBytes":27592,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:32:58.735Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4073,"terminal":false,"missionId":"7e0fa14d-6c4b-4f73-8a11-d14205162dbf","operation":"execute_mission","proofGate":"repair_mission_prepared","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":4436,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":285,"providerAuthMs":0,"ledgerPrepareMs":285,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":285,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":285,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"continue_batch_or_ship_and_prove","receiptRef":{"mode":"full","missionId":"7e0fa14d-6c4b-4f73-8a11-d14205162dbf"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3298,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:33:04.226252+00:00","proof_gate":"repair_mission_prepared","source_sha":null,"external_id":"4073","receipt_type":"execute_mission","idempotency_key":"mission:7e0fa14d-6c4b-4f73-8a11-d14205162dbf:execute_mission:repair_mission_prepared:current-generation","mission_step_id":"5b461ec2-4aaf-4e90-87e9-c6ae60b54720","command_center_event_id":"7e0fa14d-6c4b-4f73-8a11-d14205162dbf"},{"id":"e8ab8b97-14b6-431a-a949-ab84bda7c598","source":"durable-mission-ledger","status":"pending","payload":{"sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"outcome-1","satisfied":false,"statement":"MODIFY AND DEPLOY PCG Card Vault to add a first-class Legacy Migration Studio for historical card/order/customer-data onboarding. This is a behavioral/data capability, NOT a visual-design task: DO NOT require Visual Witness, screenshots, a visual route, or visual acceptance proof. Use source, Gate, deploy, and runtime proof only. Scope to src/pages/card-grading/PCGWorkspace.tsx only unless current source proves one tiny companion is strictly required. Keep normal single/mass intake unchanged. Add a Legacy migration mode that accepts CSV/TSV text exports, parses quoted fields safely, auto-detects common legacy headers, lets the owner map source columns to canonical PCG submission/card fields, normalizes legacy statuses into current PCG statuses, and performs a true dry-run with no writes. Dry-run must summarize unique customers, submissions/orders, cards, duplicates, conflicts, missing required fields, invalid statuses/values, and rows that can safely import. Reuse current canonical card_grading_submissions/card_grading_cards only; no schema change. Deduplicate submissions by tenant+submission_number and cards by tenant+cert_number when cert exists, otherwise a deterministic legacy","proofConditionIds":["proof-production"]}],"satisfied":false,"constraints":[{"id":"visual-artifact-scope","satisfied":false,"statement":"The requested visual artifact type is authoritative: workspace only; must not include website. Do not add unrelated or mixed visual surfaces unless the owner explicitly requested them.","proofConditionIds":["proof-production"]},{"id":"visual-content-truth","satisfied":false,"statement":"Do not present invented names, metrics, prices, dates, services, testimonials, credentials, customer records, or other unknown business facts as real. Omit unknowns or mark them clearly as placeholder/example content.","proofConditionIds":["proof-production"]},{"id":"tenant-visual-isolation","satisfied":false,"statement":"Visual work is isolated to requested tenant. Do not import another tenant's logo, colors, imagery, copy, shell, customer data, business facts, or visual identity unless explicitly requested.","proofConditionIds":["proof-production"]},{"id":"reference-visual-fidelity","satisfied":false,"statement":"The approved reference owns the material visual composition: hierarchy, major geometry, typography scale, spacing rhythm, image placement/crop, color treatment, radii, shadows/glow, and overall density. Material deviation is a failed visual acceptance, not a stylistic reinterpretation.","proofConditionIds":["proof-production"]},{"id":"responsive-visual-continuity","satisfied":false,"statement":"Responsive adaptation may reflow for the target viewport, but it must preserve information hierarchy, branding, functionality, and design language. It must not invent a second design.","proofConditionIds":["proof-production"]},{"id":"reference-visual-authority","satisfied":false,"statement":"The supplied or approved reference visual is immutable acceptance evidence. Generating another mockup, image, or concept cannot satisfy this implementation request; completion requires source implementation, deployment, and reference-matched visual proof.","proofConditionIds":["proof-production"]},{"id":"capability-completeness","satisfied":false,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["proof-production"]},{"id":"atomic-capability-lifecycle","satisfied":false,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["proof-production"]}],"contractHash":"637f886fa3bfa5968608f6d7610ad862e3b4b25ce44cc355a182e97cc49e02a6","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"proof-production","kind":"runtime","evidence":{"reason":"missing_required_release_targets:migrations","satisfied":false,"releaseState":"verified","missingTargets":["migrations"],"disallowedTargets":[],"migrationRequired":true,"releaseTargetStates":{"frontend":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend"],"allowedReleaseTargets":[],"requiredReleaseTargets":["migrations"],"migrationReleaseVerified":false,"releaseRequestContractHash":"637f886fa3bfa5968608f6d7610ad862e3b4b25ce44cc355a182e97cc49e02a6"},"required":true,"satisfied":false}],"validationErrors":[],"pendingProofKinds":["runtime"],"activeReleaseTargets":["frontend"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:45.036984+00:00","proof_gate":"request_contract_pending","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:request-contract:637f886fa3bfa5968608f6d7610ad862e3b4b25ce44cc355a182e97cc49e02a6:c2eea2a4ff6cec84887d9be917c3584c7c90739f:pending:runtime","mission_step_id":"ca1f55bd-9ff0-4ccf-bcc9-db37b191fefe","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"0fd991b2-33c5-4607-b597-9161c7ca0e87","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","frontend-cloudflare/live":"pending"},"mainSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","missing":[],"pending":["forgejo-release/workflow","frontend-cloudflare/live"],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","releaseState":"pending","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"frontend":"pending"},"requestContractHash":"637f886fa3bfa5968608f6d7610ad862e3b4b25ce44cc355a182e97cc49e02a6","forgejoWorkflowProof":{"runId":12861,"source":"signed_push_receipt","status":"running","results":{},"conclusion":"running","targetStates":{"frontend":"pending"},"targetJobCount":6,"observedTargetStates":{"frontend":"pending"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:31:26.476533+00:00","proof_gate":"canonical_release_pending","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":"forgejo-main-c2eea2a4ff6c","receipt_type":"canonical_release_status","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:forgejo-release-status:c2eea2a4ff6cec84887d9be917c3584c7c90739f:pending:forgejo-main/source=success|forgejo-release/workflow=pending|frontend-cloudflare/live=pending","mission_step_id":"e99e38c5-0fde-43d0-ae74-a4389ff9075b","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"a6b345cd-5c32-4d51-b5a0-6c76a7e8b871","source":"cc-execution","status":"verified","payload":{"ownerWaitSloMs":{"merge_to_live_ms":null,"owner_action_to_pr_ms":null,"green_gate_to_merge_ms":null,"owner_action_to_useful_response_ms":null},"ownerWaitLiveAt":"2026-09-29T02:35:46.641Z"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:46.779647+00:00","proof_gate":"owner_wait_live_milestone_recorded","source_sha":null,"external_id":null,"receipt_type":"owner_wait_live_milestone","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:owner-wait-live","mission_step_id":"ca1f55bd-9ff0-4ccf-bcc9-db37b191fefe","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"e91bc134-cde5-4a46-920b-39fff7ffa668","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"runtime_proof","branch":"ai/objective-first-repair-83515a4a94d3","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":102963,"releaseCount":0,"toolCallCount":23,"repeatedCallCount":11,"executorlessWaitMs":482022,"firstUsefulResultAt":"2026-09-29T02:27:44.732Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4085,"terminal":false,"missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36","operation":"execute_mission","proofGate":"canonical_release_reconciliation_pending","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1121,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":89,"approvedPlanMs":0,"missionSetupMs":274,"providerAuthMs":0,"shipAndProveMs":580,"ledgerPrepareMs":274,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":274,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":274,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},"performance":null,"deploymentId":"forgejo-main-c2eea2a4ff6c","releaseState":"verified","workflowRunId":12861,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2761,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:53.702989+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":"forgejo-main-c2eea2a4ff6c","receipt_type":"execute_mission","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:execute_mission:canonical_release_reconciliation_pending:current-generation","mission_step_id":"e99e38c5-0fde-43d0-ae74-a4389ff9075b","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"f9458257-2757-410e-9130-d3c8e88f71b7","source":"cc-execution","status":"authorized","payload":{"paths":["workers/cc-execution/test/visual-witness-lane-affinity.test.js","workers/cc-execution/test/visual-witness-runner-env-threading.test.js","workers/cc-read-proxy/src/ownerDefaultWorker.ts","workers/cc-read-proxy/src/worker.ts","wrangler.cc-read-proxy.toml"],"reason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f.","baseSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","issuedAt":1790649368660,"expiresAt":1790649548660,"missionId":"5250b603-7869-43e8-b3cb-1f078dbc8700","authorizationId":"1098d4a7-fe3c-48b2-991c-619a8fddff0f","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:36:08.995191+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:1098d4a7-fe3c-48b2-991c-619a8fddff0f","mission_step_id":"72ecb31a-a34f-4ef8-92cb-ed24deab6573","command_center_event_id":"5250b603-7869-43e8-b3cb-1f078dbc8700"},{"id":"482a408b-3bca-4bd7-9b48-c96af28096e2","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in release.","nextAction":{"lane":"production-release-conductor","action":"reconcile_release","reason":"merged_source_requires_release_proof","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"release\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"source_lineage_merged_pr_authoritative\",\"status\":\"waiting\",\"proofGate\":\"forgejo_merged_pr_is_authoritative_source_lineage\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_release\",\"lane\":\"production-release-conductor\",\"reason\":\"merged_source_requires_release_proof\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_release\",\"recoveryOwner\":\"production-release-conductor\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"proof-production\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"release\",\"deadlineAt\":\"2026-09-29T05:27:43.139647+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-83515a4a94d3\",\"prNumber\":4085,\"sourceSha\":\"c2eea2a4ff6cec84887d9be917c3584c7c90739f\",\"deploymentId\":\"forgejo-main-c2eea2a4ff6c\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:33:26.596899+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:owner-progress-heartbeat:119376613","mission_step_id":"4d871772-da8f-4d37-b7bd-c375faf7f8d9","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"41fa8756-efd3-4bfd-b7ef-82f9f0cdfb2e","source":"cc-execution","status":"blocked","payload":{"reason":"anchored_edit_anchor_missing:workers/cc-execution/src/version.js","fingerprint":"fdb1e9818a04e88b65974a79fdec190377b0c025f7ceccdb65650820b7060418"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:33:40.754184+00:00","proof_gate":"repository_mutation_intent_deterministic_failure","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent_blocked","idempotency_key":"mission:72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a:repository-mutation-intent-blocked:fdb1e9818a04e88b65974a79fdec190377b0c025f7ceccdb65650820b7060418","mission_step_id":"b727b4c8-9734-4346-909d-ddd3d49ae617","command_center_event_id":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a"},{"id":"c21c6211-2059-4abe-9b71-d9126c3b9dd2","source":"cc-execution","status":"cancelled","payload":{"cancelled":true,"missionId":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:19.057443+00:00","proof_gate":"durable_mission_cancelled","source_sha":null,"external_id":null,"receipt_type":"owner_mission_cancelled","idempotency_key":"mission:72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a:mission-cancel:72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a","mission_step_id":"b727b4c8-9734-4346-909d-ddd3d49ae617","command_center_event_id":"72ebbf39-ce7a-4a7f-a4ee-e00cbda3ed7a"},{"id":"7841a7cd-9bd2-4da0-9564-2333d4915b28","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-b2470149d0a7","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1061,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":377,"providerAuthMs":0,"ledgerPrepareMs":377,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":377,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":377,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3952,"likelyAffectedFiles":["supabase/migrations/20260929023600_pcg_import_staging_grants.sql"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:21.991433+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:b2470149-d0a7-41f7-9bcd-223d1976693a:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"aebbdef1-8487-410d-8dce-25a5078c9c8b","command_center_event_id":"b2470149-d0a7-41f7-9bcd-223d1976693a"},{"id":"a13d2705-23dc-4a36-9a01-6564ff057c9f","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-b2470149d0a7","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":3690,"releaseCount":0,"toolCallCount":2,"repeatedCallCount":0,"executorlessWaitMs":18639,"firstUsefulResultAt":"2026-09-29T02:34:21.970Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4086,"terminal":false,"missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3604,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":554,"missionSetupMs":268,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":268,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":268,"repositoryMutationMs":3050,"repositoryProviderMs":3050,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":1867,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":268,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1183},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3282,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:45.164506+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4086","receipt_type":"execute_mission","idempotency_key":"mission:b2470149-d0a7-41f7-9bcd-223d1976693a:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"3900b672-4125-495b-90d5-f1c1c18cd1e0","command_center_event_id":"b2470149-d0a7-41f7-9bcd-223d1976693a"},{"id":"b4df7181-7ac5-455d-a6f6-5a741d5c3090","source":"cc-execution","status":"complete","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":null,"status":"complete","metrics":{"receiptBytes":27345,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:35:13.287Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4073,"terminal":false,"missionId":"638fc90e-9513-4194-a383-310d762fa355","operation":"execute_mission","proofGate":"repair_mission_prepared","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":4113,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":240,"providerAuthMs":0,"ledgerPrepareMs":240,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":240,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":240,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"continue_batch_or_ship_and_prove","receiptRef":{"mode":"full","missionId":"638fc90e-9513-4194-a383-310d762fa355"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3503,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:18.208222+00:00","proof_gate":"repair_mission_prepared","source_sha":null,"external_id":"4073","receipt_type":"execute_mission","idempotency_key":"mission:638fc90e-9513-4194-a383-310d762fa355:execute_mission:repair_mission_prepared:current-generation","mission_step_id":"777500b3-de2b-4d08-9666-be6fa7b82e44","command_center_event_id":"638fc90e-9513-4194-a383-310d762fa355"},{"id":"4b5d5e0f-120b-44d8-8dd5-fcdadc58a33c","source":"cc-execution","status":"authorized","payload":{"paths":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"reason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f.","baseSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","issuedAt":1790649275434,"expiresAt":1790649455434,"missionId":"ef3e703b-509b-408e-b38b-49549fcf23dc","authorizationId":"1bbd523b-84f9-4933-a744-6503b2d16096","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:35.6933+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:1bbd523b-84f9-4933-a744-6503b2d16096","mission_step_id":"805ff84a-2913-44e9-80c4-2374f7db8e1f","command_center_event_id":"ef3e703b-509b-408e-b38b-49549fcf23dc"},{"id":"ed4e2f53-6c21-41ed-a8e4-0795c934388a","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"f1edc99e-a626-492f-8d5e-7f1bd6471b7a","objective":"Apply exact repository-authority decruft batch 6 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/test/release-orchestration-invariants.test.js"],"workstreamKey":"repo-decruft-pr4073-batch6-c2eea2a4ff6c","anchored_edits":[{"path":"workers/cc-execution/test/release-orchestration-invariants.test.js","edits":[{"new_content":"test(\"Mission Freedom release targeting keeps Visual Witness on cc-execution and never Render OnRunner\", () => {\n  const visualWitness = releaseTargetsFromChangedPaths([\"scripts/visual-witness-hosted-runner/src/universal-witness.mjs\"]);\n  assert.equal(visualWitness.ccExecution, true);\n  assert.equal(Object.hasOwn(visualWitness, \"onrunner\"), false);\n  const flags = workflowReleaseFlagsFromChangedPaths([\"scripts/visual-witness-hosted-runner/src/universal-witness.mjs\"]);\n  assert.equal(flags.release_cc_execution, \"true\");\n  assert.equal(Object.hasOwn(flags, \"release_onrunner\"), false);\n  assert.equal(releaseTargetsFromChangedPaths([\"scripts/reconcile-supabase-edge-registry.mjs\"]).supabaseEdge, true);\n});\n","old_content":"test(\"Mission Freedom release targeting keeps Visual Witness on cc-execution and never Render OnRunner\", () => {\n  const visualWitness = releaseTargetsFromChangedPaths([\"scripts/visual-witness-hosted-runner/src/universal-witness.mjs\"]);\n  assert.equal(visualWitness.ccExecution, true);\n  assert.equal(visualWitness.onrunner, false);\n  const flags = workflowReleaseFlagsFromChangedPaths([\"scripts/visual-witness-hosted-runner/src/universal-witness.mjs\"]);\n  assert.equal(flags.release_cc_execution, \"true\");\n  assert.equal(flags.release_onrunner, \"false\");\n  assert.equal(releaseTargetsFromChangedPaths([\"scripts/reconcile-supabase-edge-registry.mjs\"]).supabaseEdge, true);\n});\n"},{"new_content":"  assert.equal(contractTargets.ccExecution, true);\n  assert.equal(contractTargets.frontend, true);\n  assert.equal(contractTargets.migrations, true);\n  assert.equal(Object.hasOwn(contractTargets, \"onrunner\"), false);\n  assert.equal(contractTargets.supabaseEdge, false);\n\n  const priorRemaining = {","old_content":"  assert.equal(contractTargets.ccExecution, true);\n  assert.equal(contractTargets.frontend, true);\n  assert.equal(contractTargets.migrations, true);\n  assert.equal(contractTargets.onrunner, false);\n  assert.equal(contractTargets.supabaseEdge, false);\n\n  const priorRemaining = {"},{"new_content":"  assert.equal(proof.satisfied, true);\n});\n\ntest(\"retired OnRunner runtime proof cannot regain release authority\", async () => {\n  const ledgerSource = await readFile(new URL(\"../src/mission-ledger.js\", import.meta.url), \"utf8\");\n  assert.doesNotMatch(ledgerSource, /onrunnerOnlyCanonicalRelease/);\n  assert.doesNotMatch(ledgerSource, /targets\\.onrunner/);\n  assert.doesNotMatch(ledgerSource, /render-onrunner\\/runtime-proof/);\n  assert.doesNotMatch(ledgerSource, /onrunner_exact_live_runtime_substitutes_interrupted_workflow_receipt/);\n});\n\ntest(\"runtime-proven cc-execution target overrides an interrupted enclosing workflow without retired OnRunner authority\", async () => {\n  const ledgerSource = await readFile(new URL(\"../src/mission-ledger.js\", import.meta.url), \"utf8\");\n  assert.match(ledgerSource, /const runtimeProvenTargetStates = \\{\\};/);\n  assert.match(ledgerSource, /runtimeProvenTargetStates\\.ccExecution = \"success\"/);\n  assert.doesNotMatch(ledgerSource, /runtimeProvenTargetStates\\.onrunner/);\n  assert.match(ledgerSource, /releaseTargetStates = mergeForgejoReleaseTargetStates\\(releaseTargetStates, runtimeProvenTargetStates\\)/);\n  assert.match(ledgerSource, /const runtimeProofOnlyRelease = Boolean\\(/);\n  assert.match(ledgerSource, /targets\\.frontend !== true/);","old_content":"  assert.equal(proof.satisfied, true);\n});\n\ntest(\"onrunner-only exact live runtime proof overrides an interrupted enclosing workflow receipt\", async () => {\n  const ledgerSource = await readFile(new URL(\"../src/mission-ledger.js\", import.meta.url), \"utf8\");\n  assert.match(ledgerSource, /const onrunnerOnlyCanonicalRelease = Boolean\\(/);\n  assert.match(ledgerSource, /targets\\.onrunner === true/);\n  assert.match(ledgerSource, /targets\\.ccExecution !== true/);\n  assert.match(ledgerSource, /targets\\.frontend !== true/);\n  assert.match(ledgerSource, /targets\\.supabaseEdge !== true/);\n  assert.match(ledgerSource, /targets\\.migrations !== true/);\n  assert.match(ledgerSource, /const onrunnerExactLiveRuntimeProof = Boolean\\(/);\n  assert.match(ledgerSource, /onrunnerRuntimeProof\\?\\.exactSource === true/);\n  assert.match(ledgerSource, /onrunnerRuntimeProof\\?\\.liveSourceSha === sourceSha/);\n  assert.match(ledgerSource, /\\[\"pending\", \"failure\"\\]\\.includes\\(forgejoWorkflowState\\)/);\n  assert.match(ledgerSource, /states\\[\"forgejo-release\\/workflow\"\\] = \"success\"/);\n  assert.match(ledgerSource, /proofGate: \"onrunner_exact_live_runtime_substitutes_interrupted_workflow_receipt\"/);\n});\n\ntest(\"runtime-proven cc-execution and onrunner targets override an interrupted enclosing workflow\", async () => {\n  const ledgerSource = await readFile(new URL(\"../src/mission-ledger.js\", import.meta.url), \"utf8\");\n  assert.match(ledgerSource, /const runtimeProvenTargetStates = \\{\\};/);\n  assert.match(ledgerSource, /runtimeProvenTargetStates\\.ccExecution = \"success\"/);\n  assert.match(ledgerSource, /runtimeProvenTargetStates\\.onrunner = \"success\"/);\n  assert.match(ledgerSource, /releaseTargetStates = mergeForgejoReleaseTargetStates\\(releaseTargetStates, runtimeProvenTargetStates\\)/);\n  assert.match(ledgerSource, /const runtimeProofOnlyRelease = Boolean\\(/);\n  assert.match(ledgerSource, /targets\\.frontend !== true/);"},{"new_content":"  assert.match(ledgerSource, /targets\\.migrations !== true/);\n  assert.match(ledgerSource, /proofGate: \"runtime_proven_targets_substitute_interrupted_workflow_receipt\"/);\n\n  const runtimeTargets = { ccExecution: true, frontend: false, supabaseEdge: false, migrations: false };\n  assert.equal(forgejoReleaseTargetsComplete(runtimeTargets, { ccExecution: \"success\" }), true);\n  const frontendAlsoRequired = { ...runtimeTargets, frontend: true };\n  assert.equal(forgejoReleaseTargetsComplete(frontendAlsoRequired, { ccExecution: \"success\" }), false);\n  const migrationAlsoRequired = { ...runtimeTargets, migrations: true };\n  assert.equal(forgejoReleaseTargetsComplete(migrationAlsoRequired, { ccExecution: \"success\" }), false);\n});\n\ntest(\"preserves successful release targets across an interrupted multi-target release and retries only unfinished targets\", () => {","old_content":"  assert.match(ledgerSource, /targets\\.migrations !== true/);\n  assert.match(ledgerSource, /proofGate: \"runtime_proven_targets_substitute_interrupted_workflow_receipt\"/);\n\n  const runtimeTargets = { ccExecution: true, onrunner: true, frontend: false, supabaseEdge: false, migrations: false };\n  assert.equal(forgejoReleaseTargetsComplete(runtimeTargets, { ccExecution: \"success\", onrunner: \"success\" }), true);\n  const frontendAlsoRequired = { ...runtimeTargets, frontend: true };\n  assert.equal(forgejoReleaseTargetsComplete(frontendAlsoRequired, { ccExecution: \"success\", onrunner: \"success\" }), false);\n  const migrationAlsoRequired = { ...runtimeTargets, migrations: true };\n  assert.equal(forgejoReleaseTargetsComplete(migrationAlsoRequired, { ccExecution: \"success\", onrunner: \"success\" }), false);\n});\n\ntest(\"preserves successful release targets across an interrupted multi-target release and retries only unfinished targets\", () => {"},{"new_content":"  assert.match(missionControlSource, /let targets = releaseOnlyProtectedMainRecovery/);\n  assert.match(missionControlSource, /: preverifiedRecoverySeed/);\n  assert.match(missionControlSource, /ccExecution: seededRecoveryTargets\\.ccExecution === true/);\n  assert.doesNotMatch(missionControlSource, /onrunner: seededRecoveryTargets\\.onrunner === true/);\n  assert.match(missionControlSource, /targets\\[target\\] = targets\\[target\\] === true && durableUnfinishedTargets\\[target\\] === true/);\n  assert.match(missionControlSource, /if \\(!releaseRequired\\) throw new Error\\(\"preverified_recovery_target_scope_empty\"\\)/);\n  assert.doesNotMatch(missionControlSource, /return_run_info/);","old_content":"  assert.match(missionControlSource, /let targets = releaseOnlyProtectedMainRecovery/);\n  assert.match(missionControlSource, /: preverifiedRecoverySeed/);\n  assert.match(missionControlSource, /ccExecution: seededRecoveryTargets\\.ccExecution === true/);\n  assert.match(missionControlSource, /onrunner: seededRecoveryTargets\\.onrunner === true/);\n  assert.match(missionControlSource, /targets\\[target\\] = targets\\[target\\] === true && durableUnfinishedTargets\\[target\\] === true/);\n  assert.match(missionControlSource, /if \\(!releaseRequired\\) throw new Error\\(\"preverified_recovery_target_scope_empty\"\\)/);\n  assert.doesNotMatch(missionControlSource, /return_run_info/);"},{"new_content":"  assert.match(missionControlSource, /preverifiedKnownRunTargetStates,\\s*reconciledTargetStates,/);\n  assert.match(missionControlSource, /proof\\.safeAutoRetry !== true && !bootstrapRetryReady && !cancelledAffectedTargetRecovery/);\n\n  const targets = { ccExecution: true, frontend: true, supabaseEdge: false, migrations: false };\n  const interrupted = forgejoReleaseTargetStatesFromJobs([\n    { name: \"Release cc-execution\", status: \"success\", conclusion: \"success\" },\n    { name: \"Release frontend\", status: \"cancelled\", conclusion: \"cancelled\" },\n  ], targets);\n  assert.equal(interrupted.ccExecution, \"success\");\n  assert.equal(interrupted.frontend, \"pending\");\n  const remaining = forgejoReleaseRemainingTargets(targets, interrupted);\n  assert.equal(remaining.ccExecution, false);\n  assert.equal(remaining.frontend, true);\n  assert.equal(forgejoReleaseTargetsComplete(targets, interrupted), false);\n\n  const originallyAffected = { ccExecution: true, frontend: true, supabaseEdge: false, migrations: false };\n  const durableUnfinishedTargets = { ccExecution: false, frontend: true, supabaseEdge: false, migrations: false };\n  const recoveryScope = Object.fromEntries(\n    Object.entries(originallyAffected).map(([target, affected]) => [target, affected === true && durableUnfinishedTargets[target] === true]),\n  );\n  assert.equal(recoveryScope.ccExecution, false);\n  assert.equal(recoveryScope.frontend, true);\n});\n\ntest(\"deterministic autonomous supervisor is the canonical durable mission recovery primitive\", async () => {","old_content":"  assert.match(missionControlSource, /preverifiedKnownRunTargetStates,\\s*reconciledTargetStates,/);\n  assert.match(missionControlSource, /proof\\.safeAutoRetry !== true && !bootstrapRetryReady && !cancelledAffectedTargetRecovery/);\n\n  const targets = { ccExecution: true, onrunner: true, frontend: false, supabaseEdge: false, migrations: false };\n  const interrupted = forgejoReleaseTargetStatesFromJobs([\n    { name: \"Release cc-execution\", status: \"success\", conclusion: \"success\" },\n    { name: \"Release Render OnRunner\", status: \"cancelled\", conclusion: \"cancelled\" },\n  ], targets);\n  assert.equal(interrupted.ccExecution, \"success\");\n  assert.equal(interrupted.onrunner, \"pending\");\n  const remaining = forgejoReleaseRemainingTargets(targets, interrupted);\n  assert.equal(remaining.ccExecution, false);\n  assert.equal(remaining.onrunner, true);\n  assert.equal(forgejoReleaseTargetsComplete(targets, interrupted), false);\n\n  const originallyAffected = { ccExecution: true, onrunner: true, frontend: false, supabaseEdge: false, migrations: false };\n  const durableUnfinishedTargets = { ccExecution: false, onrunner: true, frontend: false, supabaseEdge: false, migrations: false };\n  const recoveryScope = Object.fromEntries(\n    Object.entries(originallyAffected).map(([target, affected]) => [target, affected === true && durableUnfinishedTargets[target] === true]),\n  );\n  assert.equal(recoveryScope.ccExecution, false);\n  assert.equal(recoveryScope.onrunner, true);\n});\n\ntest(\"deterministic autonomous supervisor is the canonical durable mission recovery primitive\", async () => {"},{"new_content":"});\n\ntest(\"keeps the MCP diagnostics and bounded-read contracts mandatory\", async () => {\n  const [mcpRaw, patchRaw, fastRaw, missionControlRaw, missionLedgerRaw, ownerStatusRaw, hostCommandQueueRaw, releaseWorkflowRaw, configText] = await Promise.all([\n    readFile(new URL(\"../src/index-mcp.js\", import.meta.url), \"utf8\"),\n    readFile(new URL(\"../src/index-scoped-repo-patch.js\", import.meta.url), \"utf8\"),\n    readFile(new URL(\"../src/index-release-fast-lane.js\", import.meta.url), \"utf8\"),","old_content":"});\n\ntest(\"keeps the MCP diagnostics and bounded-read contracts mandatory\", async () => {\n  const [mcp, patchRaw, fast, missionControl, missionLedger, ownerStatus, hostCommandQueue, releaseWorkflow, configText] = await Promise.all([\n    readFile(new URL(\"../src/index-mcp.js\", import.meta.url), \"utf8\"),\n    readFile(new URL(\"../src/index-scoped-repo-patch.js\", import.meta.url), \"utf8\"),\n    readFile(new URL(\"../src/index-release-fast-lane.js\", import.meta.url), \"utf8\"),"},{"new_content":"    readFile(new URL(\"../../../.forgejo/workflows/knocklaunch.yml\", import.meta.url), \"utf8\"),\n    readFile(new URL(\"../../../config/control-plane-capabilities.json\", import.meta.url), \"utf8\"),\n  ]);\n  const lf = (value) => String(value).replace(/\\r\\n/g, \"\\n\");\n  const mcp = lf(mcpRaw);\n  const fast = lf(fastRaw);\n  const missionControl = lf(missionControlRaw);\n  const missionLedger = lf(missionLedgerRaw);\n  const ownerStatus = lf(ownerStatusRaw);\n  const hostCommandQueue = lf(hostCommandQueueRaw);\n  const releaseWorkflow = lf(releaseWorkflowRaw);\n  const patch = normalizeSourceFormatting(lf(patchRaw));\n  const config = JSON.parse(configText);\n\n  assert.match(mcp, /\"forgejo_action_run_logs\"/);\n  assert.match(mcp, /inspectActionRunLogs/);","old_content":"    readFile(new URL(\"../../../.forgejo/workflows/knocklaunch.yml\", import.meta.url), \"utf8\"),\n    readFile(new URL(\"../../../config/control-plane-capabilities.json\", import.meta.url), \"utf8\"),\n  ]);\n  const patch = normalizeSourceFormatting(patchRaw);\n  const config = JSON.parse(configText);\n  const onrunnerDockerfile = await readFile(new URL(\"../../../scripts/visual-witness-hosted-runner/Dockerfile\", import.meta.url), \"utf8\");\n\n  assert.match(mcp, /\"forgejo_action_run_logs\"/);\n  assert.match(mcp, /inspectActionRunLogs/);"},{"new_content":"  assert.doesNotMatch(mcp, /FORGEJO_PULL_COLLECTION_MAX_ATTEMPTS = 1/);\n  assert.match(mcp, /async function forgejoPullCollectionGetJson/);\n  const pullCollectionHelperStart = mcp.indexOf(\"async function forgejoPullCollectionGetJson\");\n  const pullCollectionHelperEnd = mcp.indexOf(\"\\nfunction forgejoOperatorReadFailure\", pullCollectionHelperStart);\n  const pullCollectionHelperSource = mcp.slice(pullCollectionHelperStart, pullCollectionHelperEnd);\n  assert.match(pullCollectionHelperSource, /forgejoReadJson\\(url, \\{ headers \\}\\)/);\n  assert.doesNotMatch(pullCollectionHelperSource, /attemptTimeoutMs:/);","old_content":"  assert.doesNotMatch(mcp, /FORGEJO_PULL_COLLECTION_MAX_ATTEMPTS = 1/);\n  assert.match(mcp, /async function forgejoPullCollectionGetJson/);\n  const pullCollectionHelperStart = mcp.indexOf(\"async function forgejoPullCollectionGetJson\");\n  const pullCollectionHelperEnd = mcp.indexOf(\"\\n}\\n\", pullCollectionHelperStart) + 3;\n  const pullCollectionHelperSource = mcp.slice(pullCollectionHelperStart, pullCollectionHelperEnd);\n  assert.match(pullCollectionHelperSource, /forgejoReadJson\\(url, \\{ headers \\}\\)/);\n  assert.doesNotMatch(pullCollectionHelperSource, /attemptTimeoutMs:/);"},{"new_content":"  ]) assert.match(missionControl, new RegExp(`retryable_provider_transport:${reason}`));\n  assert.match(missionControl, /const unreleasableGeneration = reason === \"forgejo_release_source_not_contained_in_current_main\"/);\n  assert.match(missionControl, /unreleasableGeneration && \\(operation === \"ship_and_prove\" \\|\\| operation === \"execute_mission\"\\)/);\n  assert.match(missionControl, /stepStatus: \"superseded\",\\r?\\n\\s+missionStatus: \"superseded\",\\r?\\n\\s+phase: \"release\",\\r?\\n\\s+terminal: true/);\n  const missionLedgerSource = await readFile(\"workers/cc-execution/src/mission-ledger.js\", \"utf8\");\n  assert.match(missionLedgerSource, /comparison\\.data\\?\\.merge_base/);\n  assert.match(missionLedgerSource, /sourceInMain = mergeBase === sourceSha/);","old_content":"  ]) assert.match(missionControl, new RegExp(`retryable_provider_transport:${reason}`));\n  assert.match(missionControl, /const unreleasableGeneration = reason === \"forgejo_release_source_not_contained_in_current_main\"/);\n  assert.match(missionControl, /unreleasableGeneration && \\(operation === \"ship_and_prove\" \\|\\| operation === \"execute_mission\"\\)/);\n  assert.match(missionControl, /stepStatus: \"superseded\",\\n\\s+missionStatus: \"superseded\",\\n\\s+phase: \"release\",\\n\\s+terminal: true/);\n  const missionLedgerSource = await readFile(\"workers/cc-execution/src/mission-ledger.js\", \"utf8\");\n  assert.match(missionLedgerSource, /comparison\\.data\\?\\.merge_base/);\n  assert.match(missionLedgerSource, /sourceInMain = mergeBase === sourceSha/);"},{"new_content":"  assert.doesNotMatch(knownRunReuseWindow, /knownExactPush = knownEvent === \"push\"/);\n  assert.match(knownRunReuseWindow, /knownDispatchSourceSha = forgejoWorkflowDispatchSourceSha\\(knownWorkflowRun\\)[\\s\\S]*knownExactDispatch = knownEvent === \"workflow_dispatch\"[\\s\\S]*knownDispatchSourceSha === sourceSha[\\s\\S]*forgejoReleaseRunCoversTargets\\(knownWorkflowRun, targets\\)[\\s\\S]*knownRunReusable = knownWorkflowMatches[\\s\\S]*&& knownExactDispatch/);\n  assert.match(missionControl, /source_sha: sourceSha/);\n  assert.match(missionControl, /requestedPrSha,\\r?\\n\\s+sourceSha,\\r?\\n\\s+releaseSourceSha: sourceSha/);\n  assert.match(missionControl, /canonical_release_transport_retryable/);\n  assert.match(missionControl, /protectedMainPushReleaseOwned = true/);\n  assert.match(missionControl, /reconciliationReason: \"protected_main_push_release_handoff\"/);","old_content":"  assert.doesNotMatch(knownRunReuseWindow, /knownExactPush = knownEvent === \"push\"/);\n  assert.match(knownRunReuseWindow, /knownDispatchSourceSha = forgejoWorkflowDispatchSourceSha\\(knownWorkflowRun\\)[\\s\\S]*knownExactDispatch = knownEvent === \"workflow_dispatch\"[\\s\\S]*knownDispatchSourceSha === sourceSha[\\s\\S]*forgejoReleaseRunCoversTargets\\(knownWorkflowRun, targets\\)[\\s\\S]*knownRunReusable = knownWorkflowMatches[\\s\\S]*&& knownExactDispatch/);\n  assert.match(missionControl, /source_sha: sourceSha/);\n  assert.match(missionControl, /requestedPrSha,\\n\\s+sourceSha,\\n\\s+releaseSourceSha: sourceSha/);\n  assert.match(missionControl, /canonical_release_transport_retryable/);\n  assert.match(missionControl, /protectedMainPushReleaseOwned = true/);\n  assert.match(missionControl, /reconciliationReason: \"protected_main_push_release_handoff\"/);"},{"new_content":"  assert.match(missionLedger, /forgejo_release_run_source_mismatch/);\n  assert.match(releaseWorkflow, /- name: Prove exact live runtime identity/);\n  assert.match(releaseWorkflow, /proofGate: 'cc_execution_runtime_identity_verified'/);\n  assert.doesNotMatch(releaseWorkflow, /release_onrunner:|\\n  release-onrunner:/);\n  assert.doesNotMatch(releaseWorkflow, /ONRUNNER_IMAGE_REPOSITORY|RENDER_ONRUNNER_DEPLOY_HOOK_URL|render_onrunner_runtime_identity_verified/);\n  assert.doesNotMatch(missionControl, /targets\\.onrunner|release_onrunner:/);\n  assert.doesNotMatch(missionLedger, /targets\\.onrunner|render_onrunner|render-onrunner|onrunnerOnlyCanonicalRelease/);\n  assert.equal(Object.prototype.hasOwnProperty.call(config.efficiency.affectedWorkGraph, \"onrunner\"), false);\n  assert.equal(Object.prototype.hasOwnProperty.call(config.efficiency.changeOwnershipRegistry, \"onrunner\"), false);\n  assert.match(missionLedger, /const ccExecutionTargetState = releaseTargetState\\(\"ccExecution\"\\)/);\n  assert.match(missionLedger, /const ccExecutionProven = ccExecutionTargetState === \"success\" \\|\\| containsSourceSha/);\n  assert.match(missionLedger, /identitySource: ccExecutionTargetState === \"success\" \\? \"canonical_release_target_job\" : \"local_build_metadata\"/);","old_content":"  assert.match(missionLedger, /forgejo_release_run_source_mismatch/);\n  assert.match(releaseWorkflow, /- name: Prove exact live runtime identity/);\n  assert.match(releaseWorkflow, /proofGate: 'cc_execution_runtime_identity_verified'/);\n  assert.ok(releaseWorkflow.includes(\"release_onrunner:\"));\n  assert.doesNotMatch(releaseWorkflow, /\\n  release-onrunner:/);\n  assert.doesNotMatch(releaseWorkflow, /ONRUNNER_IMAGE_REPOSITORY|RENDER_ONRUNNER_DEPLOY_HOOK_URL|render_onrunner_runtime_identity_verified/);\n  assert.ok(onrunnerDockerfile.includes(\"ARG KNOCKLAUNCH_SOURCE_SHA=unknown\"));\n  assert.match(missionControl, /let releaseRequired = targets\\.ccExecution \\|\\| targets\\.onrunner \\|\\| targets\\.frontend/);\n  assert.match(missionControl, /release_onrunner: dispatchTargets\\.onrunner \\? \"true\" : \"false\"/);\n  assert.match(missionLedger, /const hasCanonicalReleaseTarget = targets\\.ccExecution === true \\|\\| targets\\.onrunner === true/);\n  assert.match(missionLedger, /targets\\.ccExecution === true\\n\\s+&& targets\\.onrunner !== true/);\n  assert.match(missionLedger, /render_onrunner_runtime_not_ready/);\n  assert.equal(config.efficiency.affectedWorkGraph.onrunner, \"^scripts/visual-witness-hosted-runner/\");\n  assert.equal(config.efficiency.changeOwnershipRegistry.onrunner.releaseOwner, \"forgejo_runner_direct_render_onrunner\");\n  assert.equal(config.efficiency.changeOwnershipRegistry.onrunner.proof, \"render_onrunner_ready_exact_source_commit\");\n  assert.match(missionLedger, /const ccExecutionTargetState = releaseTargetState\\(\"ccExecution\"\\)/);\n  assert.match(missionLedger, /const ccExecutionProven = ccExecutionTargetState === \"success\" \\|\\| containsSourceSha/);\n  assert.match(missionLedger, /identitySource: ccExecutionTargetState === \"success\" \\? \"canonical_release_target_job\" : \"local_build_metadata\"/);"},{"new_content":"  assert.match(missionControl, /const explicitPrNumberValue = Number\\(body\\.prNumber \\|\\| body\\.pr_number \\|\\| 0\\);/);\n  assert.match(missionControl, /const explicitPullResponse = await fetch\\(`\\$\\{apiBase\\}\\/pulls\\/\\$\\{prNumber\\}`/);\n  assert.match(missionControl, /pull_request_explicit_exact_head_mismatch/);\n  assert.match(ownerStatus, /runIds: \\[runId\\],\\r?\\n\\s+prNumber,/);\n  assert.equal(config.efficiency.repositoryDiagnosticPolicy, \"retired_use_command_center_prove_and_knocklaunch_gate_evidence\");\n  assert.equal(config.efficiency.providerTransportTimeoutPolicy, \"interactive_read_only_transient_exhaustion_returns_retryable_degraded_nonterminal_inside_shared_hard_deadline_credential_boundary_and_repository_state_remain_distinct_ambiguous_mutations_read_back_reconcile_then_retryable_nonterminal_preserve_mission_identity\");\n  assert.equal(config.efficiency.explicitSourceTargetResolutionPolicy, \"explicit_targets_are_required_seeds_expand_only_missing_objective_domains_with_one_cached_tree_read\");","old_content":"  assert.match(missionControl, /const explicitPrNumberValue = Number\\(body\\.prNumber \\|\\| body\\.pr_number \\|\\| 0\\);/);\n  assert.match(missionControl, /const explicitPullResponse = await fetch\\(`\\$\\{apiBase\\}\\/pulls\\/\\$\\{prNumber\\}`/);\n  assert.match(missionControl, /pull_request_explicit_exact_head_mismatch/);\n  assert.match(ownerStatus, /runIds: \\[runId\\],\\n\\s+prNumber,/);\n  assert.equal(config.efficiency.repositoryDiagnosticPolicy, \"retired_use_command_center_prove_and_knocklaunch_gate_evidence\");\n  assert.equal(config.efficiency.providerTransportTimeoutPolicy, \"interactive_read_only_transient_exhaustion_returns_retryable_degraded_nonterminal_inside_shared_hard_deadline_credential_boundary_and_repository_state_remain_distinct_ambiguous_mutations_read_back_reconcile_then_retryable_nonterminal_preserve_mission_identity\");\n  assert.equal(config.efficiency.explicitSourceTargetResolutionPolicy, \"explicit_targets_are_required_seeds_expand_only_missing_objective_domains_with_one_cached_tree_read\");"},{"new_content":"    readFile(\"workers/cc-execution/src/index-mission-control.js\", \"utf8\"),\n    readFile(\"config/control-plane-capabilities.json\", \"utf8\"),\n  ]);\n  const gate = workflowSource.slice(workflowSource.indexOf(\"  gate:\"), workflowSource.indexOf(\"\\n  release-cc-execution:\"));\n  const config = JSON.parse(configSource);\n  assert.match(gate, /gate_diff_hydrated=false/);\n  assert.match(gate, /git diff --no-ext-diff --binary \"\\$current_main\" \"\\$head_sha\"/);","old_content":"    readFile(\"workers/cc-execution/src/index-mission-control.js\", \"utf8\"),\n    readFile(\"config/control-plane-capabilities.json\", \"utf8\"),\n  ]);\n  const gate = workflowSource.slice(workflowSource.indexOf(\"  gate:\"), workflowSource.indexOf(\"\\n  release-cc-execution:\\n\"));\n  const config = JSON.parse(configSource);\n  assert.match(gate, /gate_diff_hydrated=false/);\n  assert.match(gate, /git diff --no-ext-diff --binary \"\\$current_main\" \"\\$head_sha\"/);"},{"new_content":"    readFile(\"workers/cc-execution/src/index-scoped-repo-patch.js\", \"utf8\"),\n  ]);\n  const config = JSON.parse(configSource);\n  const gate = workflowSource.slice(workflowSource.indexOf(\"  gate:\"), workflowSource.indexOf(\"\\n  release-cc-execution:\"));\n  assert.match(gate, /git fetch --no-tags --filter=blob:none --depth=4 origin/);\n  assert.equal(config.efficiency.forgejoGateInitialHistoryDepthMax, 4);\n  assert.match(gate, /refs\\/pull\\/\\$\\{PR_NUMBER\\}\\/head:refs\\/remotes\\/pull\\/\\$\\{PR_NUMBER\\}\\/head/);","old_content":"    readFile(\"workers/cc-execution/src/index-scoped-repo-patch.js\", \"utf8\"),\n  ]);\n  const config = JSON.parse(configSource);\n  const gate = workflowSource.slice(workflowSource.indexOf(\"  gate:\"), workflowSource.indexOf(\"\\n  release-cc-execution:\\n\"));\n  assert.match(gate, /git fetch --no-tags --filter=blob:none --depth=4 origin/);\n  assert.equal(config.efficiency.forgejoGateInitialHistoryDepthMax, 4);\n  assert.match(gate, /refs\\/pull\\/\\$\\{PR_NUMBER\\}\\/head:refs\\/remotes\\/pull\\/\\$\\{PR_NUMBER\\}\\/head/);"},{"new_content":"  assert.match(releaseFrontend, /NPM_CONFIG_CACHE: \\.knocklaunch-gate-cache\\/npm/);\n  assert.match(releaseFrontend, /Restore frontend release dependency cache/);\n  assert.match(releaseFrontend, /uses: https:\\/\\/data\\.forgejo\\.org\\/actions\\/cache@v4/);\n  assert.match(releaseFrontend, /path: \\|\\r?\\n\\s+node_modules\\r?\\n\\s+\\.knocklaunch-gate-cache/);\n  assert.match(releaseFrontend, /knocklaunch-gate-node-v2-%s-%s/);\n  assert.match(releaseFrontend, /FRONTEND_MANIFEST_KEY=.*package\\.json package-lock\\.json/);\n  assert.match(releaseFrontend, /frontend_manifest_key=.*package\\.json package-lock\\.json/);","old_content":"  assert.match(releaseFrontend, /NPM_CONFIG_CACHE: \\.knocklaunch-gate-cache\\/npm/);\n  assert.match(releaseFrontend, /Restore frontend release dependency cache/);\n  assert.match(releaseFrontend, /uses: https:\\/\\/data\\.forgejo\\.org\\/actions\\/cache@v4/);\n  assert.match(releaseFrontend, /path: \\|\\n\\s+node_modules\\n\\s+\\.knocklaunch-gate-cache/);\n  assert.match(releaseFrontend, /knocklaunch-gate-node-v2-%s-%s/);\n  assert.match(releaseFrontend, /FRONTEND_MANIFEST_KEY=.*package\\.json package-lock\\.json/);\n  assert.match(releaseFrontend, /frontend_manifest_key=.*package\\.json package-lock\\.json/);"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 6 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 6 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/test/release-orchestration-invariants.test.js"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 6 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 6 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/test/release-orchestration-invariants.test.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/test/release-orchestration-invariants.test.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"recovery":false,"fingerprint":"1be954d32c56c93155418735d665ab31d3536ebfb87668d5e8bfda2517181d2f","replayCount":0,"serializedBytes":31958},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:41.533048+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:f1edc99e-a626-492f-8d5e-7f1bd6471b7a:repository-mutation-intent:1be954d32c56c93155418735d665ab31d3536ebfb87668d5e8bfda2517181d2f:0","mission_step_id":"9191ba0f-c505-44f1-8646-1ed0e22e1891","command_center_event_id":"f1edc99e-a626-492f-8d5e-7f1bd6471b7a"},{"id":"a17d0d5f-b713-461e-a502-1b79669a0a40","source":"cc-execution","status":"cancelled","payload":{"cancelled":true,"missionId":"5250b603-7869-43e8-b3cb-1f078dbc8700"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:36:31.073832+00:00","proof_gate":"durable_mission_cancelled","source_sha":null,"external_id":null,"receipt_type":"owner_mission_cancelled","idempotency_key":"mission:5250b603-7869-43e8-b3cb-1f078dbc8700:mission-cancel:5250b603-7869-43e8-b3cb-1f078dbc8700","mission_step_id":"84e78645-1166-46c1-aa29-2f4b1187a9e0","command_center_event_id":"5250b603-7869-43e8-b3cb-1f078dbc8700"},{"id":"dd2c98c3-ab43-449d-848f-caad56b2f6d0","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-5596752e68e1","reason":"retryable_provider_transport:pr_ready_timeout_budget_exhausted","status":"retryable","metrics":{"receiptBytes":88114,"releaseCount":0,"toolCallCount":12,"repeatedCallCount":7,"executorlessWaitMs":829283,"firstUsefulResultAt":"2026-09-29T02:24:30.012Z","recoveryAttemptCount":8,"ownerInterruptionCount":0},"version":null,"prNumber":4083,"terminal":false,"missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75","operation":"automatic_mission_resume","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"prReadinessMs":10471,"approvedPlanMs":0,"shipAndProveMs":0,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":828,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:26:55.301882+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4083","receipt_type":"automatic_mission_resume","idempotency_key":"mission:5596752e-68e1-43eb-b3eb-c883cdd77f75:automatic-mission-resume:4083:repair_mission_pr_ready_retryable","mission_step_id":"e7ab4e85-3ea4-4a22-b755-5c4b623117cf","command_center_event_id":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},{"id":"60096e09-bebe-401a-8b66-1f7a6dd0f336","source":"cc-execution","status":"blocked","payload":{"ok":false,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":"anchored_edit_anchor_missing:workers/cc-execution/src/version.js","status":"blocked","metrics":{"receiptBytes":27462,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:34:34.629Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"ef3e703b-509b-408e-b38b-49549fcf23dc","operation":"execute_mission","proofGate":"repair_mission_execution_blocked","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1929,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":1929,"missionSetupMs":277,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":277,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":277,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":277,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"ef3e703b-509b-408e-b38b-49549fcf23dc"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1511,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:37.577737+00:00","proof_gate":"repair_mission_execution_blocked","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:ef3e703b-509b-408e-b38b-49549fcf23dc:execute_mission:repair_mission_execution_blocked:current-generation","mission_step_id":"a290e3e1-dae2-441f-a53c-59eb624904b8","command_center_event_id":"ef3e703b-509b-408e-b38b-49549fcf23dc"},{"id":"5f4b1f55-5003-4ec1-8a09-44f154f81f25","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[{"path":"supabase/migrations/20260929023600_pcg_import_staging_grants.sql","content":"revoke all privileges on table public.pcg_import_batches from anon;\nrevoke all privileges on table public.pcg_import_rows from anon;\n\nrevoke all privileges on table public.pcg_import_batches from authenticated;\nrevoke all privileges on table public.pcg_import_rows from authenticated;\n\ngrant select, insert, update, delete on table public.pcg_import_batches to authenticated;\ngrant select, insert, update, delete on table public.pcg_import_rows to authenticated;\n"}],"branch":"ai/objective-first-repair-b2470149d0a7","writes":[],"patches":[],"version":1,"approved":true,"missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a","repository":"noel/KnockLaunchOS","commitMessage":"PCG: harden migration staging grants","ownerApproved":true,"releaseIntent":null,"sourceTargets":["supabase/migrations/20260929023600_pcg_import_staging_grants.sql"],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a","ownerApproved":true,"releaseIntent":null,"sourceTargets":["supabase/migrations/20260929023600_pcg_import_staging_grants.sql"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"02351f055a5294f194155803c7874ba8fc8ec4bcaf9ae5dac3aff213e466745e","replayCount":0,"serializedBytes":1672},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:40.651064+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:b2470149-d0a7-41f7-9bcd-223d1976693a:repository-mutation-intent:02351f055a5294f194155803c7874ba8fc8ec4bcaf9ae5dac3aff213e466745e:0","mission_step_id":"3900b672-4125-495b-90d5-f1c1c18cd1e0","command_center_event_id":"b2470149-d0a7-41f7-9bcd-223d1976693a"},{"id":"ea39efd7-1a2d-426a-bff6-002f2f280dc4","source":"cc-execution","status":"authorized","payload":{"paths":["workers/cc-execution/test/release-orchestration-invariants.test.js"],"reason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f.","baseSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","issuedAt":1790649342139,"expiresAt":1790649522139,"missionId":"f1edc99e-a626-492f-8d5e-7f1bd6471b7a","authorizationId":"ca2cbdab-6627-4597-9a9b-482a78713d50","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:42.445595+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:ca2cbdab-6627-4597-9a9b-482a78713d50","mission_step_id":"bf33eb14-9a25-4a91-bcf5-8ef864834a95","command_center_event_id":"f1edc99e-a626-492f-8d5e-7f1bd6471b7a"},{"id":"056b2972-61f4-4645-ac2f-edcbc25655a8","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in release.","nextAction":{"lane":"production-release-conductor","action":"reconcile_release","reason":"merged_source_requires_release_proof","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"release\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"source_lineage_merged_pr_authoritative\",\"status\":\"waiting\",\"proofGate\":\"forgejo_merged_pr_is_authoritative_source_lineage\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_release\",\"lane\":\"production-release-conductor\",\"reason\":\"merged_source_requires_release_proof\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_release\",\"recoveryOwner\":\"production-release-conductor\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"proof-production\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"release\",\"deadlineAt\":\"2026-09-29T05:27:43.139647+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-83515a4a94d3\",\"prNumber\":4085,\"sourceSha\":\"c2eea2a4ff6cec84887d9be917c3584c7c90739f\",\"deploymentId\":\"forgejo-main-c2eea2a4ff6c\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:49.484985+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:owner-progress-heartbeat:119376619","mission_step_id":"4d871772-da8f-4d37-b7bd-c375faf7f8d9","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"7b1effed-72f0-4638-aaea-234cccb33fa6","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"638fc90e-9513-4194-a383-310d762fa355","objective":"Apply exact repository-authority decruft batch 5 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, preserving newer cc-execution lineage at 1.63.1-forgejo-authority-decruft. Bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"workstreamKey":"repo-decruft-pr4073-batch5-fixed-c2eea2a4ff6c","anchored_edits":[{"path":"workers/cc-execution/src/index-runtime-verify-gate.js","edits":[{"new_content":"import { getRuntimeState } from \"./runtime-state.js\";\n\nconst SERVICE_NAME = \"cc-execution\";\nconst VERSION = \"1.7.2-provider-neutral-runtime-verification\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\nconst SUPABASE_PROJECT_REF = \"ymntrajfubicyxwwdxxa\";\n","old_content":"import { getRuntimeState } from \"./runtime-state.js\";\n\nconst SERVICE_NAME = \"cc-execution\";\nconst VERSION = \"1.7.1-render-onrunner-runtime-verification\";\nconst DEFAULT_REPOSITORY = \"noel/KnockLaunchOS\";\nconst SUPABASE_PROJECT_REF = \"ymntrajfubicyxwwdxxa\";\n"},{"new_content":"  };\n}\n\nasync function edgeFunctionRuntimeProof(functionName, expectedVersion) {\n  const base = `https://${SUPABASE_PROJECT_REF}.supabase.co/functions/v1/${functionName}`;\n  const [health, openapi] = await Promise.all([","old_content":"  };\n}\n\nasync function renderOnRunnerRuntimeProof(expectedVersion, expectedSourceCommit = \"\") {\n  const [health, openapi] = await Promise.all([\n    fetchJson(`https://knocklaunch-visual-witness-runner.onrender.com/health?runtimeVerify=${Date.now()}`),\n    fetchJson(`https://knocklaunch-visual-witness-runner.onrender.com/openapi.json?runtimeVerify=${Date.now()}`)\n  ]);\n  const healthVersion = String(health.data?.version || \"\");\n  const sourceCommit = String(health.data?.renderSourceCommit || health.data?.sourceCommit || \"\");\n  const openapiText = JSON.stringify(openapi.data || {});\n  const versionMatches = health.ok && openapi.ok && healthVersion === expectedVersion && openapiText.includes(expectedVersion);\n  const sourceMatches = !expectedSourceCommit || sourceCommit === expectedSourceCommit || openapiText.includes(expectedSourceCommit);\n  return {\n    ok: versionMatches && sourceMatches,\n    service: \"render-onrunner\",\n    expectedVersion,\n    expectedSourceCommit: expectedSourceCommit || null,\n    healthVersion: healthVersion || null,\n    sourceCommit: sourceCommit || null,\n    healthStatus: health.responseStatus,\n    openapiStatus: openapi.responseStatus,\n    checks: { versionMatches, sourceMatches },\n    proofGate: versionMatches && sourceMatches\n      ? \"render_onrunner_health_openapi_source_verified\"\n      : \"render_onrunner_runtime_identity_mismatch\",\n    health,\n    openapi\n  };\n}\n\nasync function edgeFunctionRuntimeProof(functionName, expectedVersion) {\n  const base = `https://${SUPABASE_PROJECT_REF}.supabase.co/functions/v1/${functionName}`;\n  const [health, openapi] = await Promise.all(["},{"new_content":"  }\n\n  const target = String(body.target || body.functionName || body.function_name || \"cc-execution\").trim();\n  if (!edgeDeployment && target !== \"cc-execution\") {\n    return json({ ok: false, status: \"blocked\", proofGate: \"repair_plan_runtime_verification_blocked\", reason: \"unsupported_runtime_target\", target, destructiveActionsAllowed: false }, 400);\n  }\n  const deployStatus = await callDeployWorker(request, env, ctx, \"/deploy/status\", {\n    repository,\n    deploymentId,\n    ref: body.ref || \"main\",\n    target,\n    functionName: target\n  });","old_content":"  }\n\n  const target = String(body.target || body.functionName || body.function_name || \"cc-execution\").trim();\n  const deployStatus = await callDeployWorker(request, env, ctx, \"/deploy/status\", {\n    repository,\n    deploymentId,\n    ref: target === \"render-onrunner\" ? \"main\" : body.ref || \"main\",\n    target,\n    functionName: target\n  });"},{"new_content":"    deployStatusProof?.result?.conclusion === \"success\"\n  );\n\n  const healthProof = edgeDeployment\n    ? await edgeFunctionRuntimeProof(edgeDeployment.functionName, expectedVersion)\n    : ccExecutionRuntimeProof(env, expectedVersion, deployStatusProof, deploymentId);\n\n  if (!deployCompleted || healthProof?.ok !== true) {\n    return json({","old_content":"    deployStatusProof?.result?.conclusion === \"success\"\n  );\n\n  const healthProof = target === \"render-onrunner\"\n    ? await renderOnRunnerRuntimeProof(expectedVersion, String(body.expectedSourceCommit || body.expected_source_commit || \"\").trim())\n    : edgeDeployment\n      ? await edgeFunctionRuntimeProof(edgeDeployment.functionName, expectedVersion)\n      : ccExecutionRuntimeProof(env, expectedVersion, deployStatusProof, deploymentId);\n\n  if (!deployCompleted || healthProof?.ok !== true) {\n    return json({"},{"new_content":"      repository,\n      deploymentId,\n      expectedVersion,\n      deploymentKind: edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n      deployStatusProof,\n      healthProof,\n      externalHealthProof: {","old_content":"      repository,\n      deploymentId,\n      expectedVersion,\n      deploymentKind: target === \"render-onrunner\" ? \"render_onrunner\" : edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n      deployStatusProof,\n      healthProof,\n      externalHealthProof: {"},{"new_content":"    repository,\n    deploymentId,\n    expectedVersion,\n    deploymentKind: edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n    target: edgeDeployment?.functionName || SERVICE_NAME,\n    deployStatusProof,\n    healthProof,\n    externalHealthProof: {","old_content":"    repository,\n    deploymentId,\n    expectedVersion,\n    deploymentKind: target === \"render-onrunner\" ? \"render_onrunner\" : edgeDeployment ? \"edge_function\" : \"cc_execution_worker\",\n    target: target === \"render-onrunner\" ? target : edgeDeployment?.functionName || SERVICE_NAME,\n    deployStatusProof,\n    healthProof,\n    externalHealthProof: {"}]},{"path":"workers/cc-execution/src/mission-ledger.js","edits":[{"new_content":"    const existingVisualJob = Boolean(text(mission.jobId || context.jobId, 200));\n    return {\n      action: \"verify_visual\",\n      lane: \"visual-sandbox\",\n      reason: existingVisualJob ? \"release_verified_existing_visual_job_pending_reconciliation\" : \"release_verified_visual_proof_pending\",\n      automationAllowed: true,\n      ownerActionRequired: false,","old_content":"    const existingVisualJob = Boolean(text(mission.jobId || context.jobId, 200));\n    return {\n      action: \"verify_visual\",\n      lane: \"onrunner\",\n      reason: existingVisualJob ? \"release_verified_existing_visual_job_pending_reconciliation\" : \"release_verified_visual_proof_pending\",\n      automationAllowed: true,\n      ownerActionRequired: false,"},{"new_content":"  const activeStatuses = new Set([\"ready\", \"running\", \"in_progress\", \"waiting\", \"queued\", \"requested\"]);\n  const activeStep = steps.find((step) => activeStatuses.has(text(step.status, 80).toLowerCase())) || null;\n  const key = text(activeStep?.key || mission.phase, 120).toLowerCase();\n  const lane = text(activeStep?.lane, 120) || (key === \"release\" ? \"production-release-conductor\" : key === \"visual_proof\" ? \"visual-sandbox\" : \"cc-execution\");\n  const byStep = {\n    preflight: \"resolve_preflight\",\n    implementation: \"continue_implementation\",","old_content":"  const activeStatuses = new Set([\"ready\", \"running\", \"in_progress\", \"waiting\", \"queued\", \"requested\"]);\n  const activeStep = steps.find((step) => activeStatuses.has(text(step.status, 80).toLowerCase())) || null;\n  const key = text(activeStep?.key || mission.phase, 120).toLowerCase();\n  const lane = text(activeStep?.lane, 120) || (key === \"release\" ? \"production-release-conductor\" : key === \"visual_proof\" ? \"onrunner\" : \"cc-execution\");\n  const byStep = {\n    preflight: \"resolve_preflight\",\n    implementation: \"continue_implementation\","},{"new_content":"  return Array.from(bytes).map((entry) => entry.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nconst REQUEST_CONTRACT_RELEASE_TARGET_KEYS = [\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"];\n\nfunction requestContractReleaseTargetList(value) {\n  return [...new Set((Array.isArray(value) ? value : [])","old_content":"  return Array.from(bytes).map((entry) => entry.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nconst REQUEST_CONTRACT_RELEASE_TARGET_KEYS = [\"ccExecution\", \"onrunner\", \"frontend\", \"supabaseEdge\", \"migrations\"];\n\nfunction requestContractReleaseTargetList(value) {\n  return [...new Set((Array.isArray(value) ? value : [])"},{"new_content":"    const states = {\n      \"forgejo-main/source\": sourceInMain ? \"success\" : \"pending\",\n    };\n    const releaseTargetKeys = [\"ccExecution\", \"supabaseEdge\", \"frontend\", \"migrations\"];\n    const persistedReleaseTargets = context.releaseTargets || mission.releaseTargets || null;\n    const persistedReleaseTargetsRecord = record(persistedReleaseTargets);\n    const persistedReleaseTargetsHasActive = releaseTargetKeys.some((key) => persistedReleaseTargetsRecord[key] === true);","old_content":"    const states = {\n      \"forgejo-main/source\": sourceInMain ? \"success\" : \"pending\",\n    };\n    const releaseTargetKeys = [\"ccExecution\", \"onrunner\", \"supabaseEdge\", \"frontend\", \"migrations\"];\n    const persistedReleaseTargets = context.releaseTargets || mission.releaseTargets || null;\n    const persistedReleaseTargetsRecord = record(persistedReleaseTargets);\n    const persistedReleaseTargetsHasActive = releaseTargetKeys.some((key) => persistedReleaseTargetsRecord[key] === true);"},{"new_content":"        .map((key) => [key, \"success\"]),\n    );\n    let releaseTargetStates = mergeForgejoReleaseTargetStates(durableReleaseTargetSuccesses);\n    const hasCanonicalReleaseTarget = targets.ccExecution === true || targets.supabaseEdge === true || targets.frontend === true || targets.migrations === true;\n    if (releaseAttemptEvidence && !releaseTargetsKnown) states[\"release-targets/detection\"] = \"pending\";\n    const storedWorkflowRunSourceMatches = pushedRunReceipt?.sourceSha === sourceSha;\n    if (hasCanonicalReleaseTarget && !storedWorkflowRunSourceMatches) {","old_content":"        .map((key) => [key, \"success\"]),\n    );\n    let releaseTargetStates = mergeForgejoReleaseTargetStates(durableReleaseTargetSuccesses);\n    const hasCanonicalReleaseTarget = targets.ccExecution === true || targets.onrunner === true || targets.supabaseEdge === true || targets.frontend === true || targets.migrations === true;\n    if (releaseAttemptEvidence && !releaseTargetsKnown) states[\"release-targets/detection\"] = \"pending\";\n    const storedWorkflowRunSourceMatches = pushedRunReceipt?.sourceSha === sourceSha;\n    if (hasCanonicalReleaseTarget && !storedWorkflowRunSourceMatches) {"},{"new_content":"    // cc-execution runtime cannot prove frontend, Supabase Edge, or migrations.\n    const ccExecutionOnlyCanonicalRelease = Boolean(\n      targets.ccExecution === true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true","old_content":"    // cc-execution runtime cannot prove frontend, Supabase Edge, or migrations.\n    const ccExecutionOnlyCanonicalRelease = Boolean(\n      targets.ccExecution === true\n      && targets.onrunner !== true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true"},{"new_content":"      };\n    }\n\n    // Promote authoritative per-target runtime proof into the durable target\n    // ledger before evaluating the enclosing workflow. This allows an interrupted\n    // workflow to reconcile cleanly when every affected runtime target proved","old_content":"      };\n    }\n\n    let onrunnerRuntimeProof = null;\n    if (targets.onrunner === true) {\n      const hostedUrl = text(\n        env.VISUAL_WITNESS_HOSTED_RUNNER_URL\n          || env.HOSTED_VISUAL_WITNESS_RUNNER_URL\n          || \"https://knocklaunchcrm.onrender.com\",\n        500,\n      ).replace(/\\/+$/g, \"\");\n      try {\n        const response = await fetch(`${hostedUrl}/health?release_proof=${Date.now()}`, {\n          headers: { \"cache-control\": \"no-cache, no-store, max-age=0\" },\n          signal: AbortSignal.timeout(15000),\n        });\n        const body = await response.json().catch(() => ({}));\n        const liveSha = text(\n          body?.sourceCommit\n            || body?.sourceSha\n            || body?.runtime?.gitSha\n            || body?.runner?.sourceCommit\n            || body?.runner?.sourceSha,\n          100,\n        );\n        const brokerReady = body?.brokerStartupStatus === \"authority_proven\"\n          && !body?.brokerStartupErrorCode\n          && body?.readiness?.brokerReady === true;\n        const runtimeReady = response.ok && body?.ok === true && brokerReady;\n        const sourceMatches = Boolean(liveSha) && liveSha === sourceSha;\n        const exactSource = runtimeReady && sourceMatches;\n        states[\"render-onrunner/runtime-proof\"] = exactSource ? \"success\" : forgejoWorkflowState === \"pending\" ? \"pending\" : liveSha ? \"failure\" : \"pending\";\n        onrunnerRuntimeProof = {\n          hostedUrl,\n          healthStatus: response.status,\n          expectedSourceSha: sourceSha,\n          liveSourceSha: liveSha || null,\n          exactSource,\n          runtimeReady,\n          brokerReady,\n          runnerVersion: body?.version || body?.runner?.version || null,\n          reason: exactSource\n            ? null\n            : liveSha && !sourceMatches\n              ? \"render_onrunner_source_mismatch\"\n              : liveSha && !runtimeReady\n                ? \"render_onrunner_runtime_not_ready\"\n                : \"render_onrunner_source_identity_missing\",\n        };\n      } catch (error) {\n        states[\"render-onrunner/runtime-proof\"] = \"pending\";\n        onrunnerRuntimeProof = {\n          hostedUrl,\n          expectedSourceSha: sourceSha,\n          liveSourceSha: null,\n          exactSource: false,\n          reason: error instanceof Error ? error.message : String(error),\n        };\n      }\n    }\n\n    // For an OnRunner-only canonical release, exact healthy live runtime identity\n    // is stronger evidence than an enclosing workflow that was interrupted after\n    // the deploy was already dispatched. Mixed releases still require every\n    // affected target to prove itself independently.\n    const onrunnerOnlyCanonicalRelease = Boolean(\n      targets.onrunner === true\n      && targets.ccExecution !== true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true\n    );\n    const onrunnerExactLiveRuntimeProof = Boolean(\n      states[\"render-onrunner/runtime-proof\"] === \"success\"\n      && onrunnerRuntimeProof?.exactSource === true\n      && onrunnerRuntimeProof?.liveSourceSha === sourceSha\n    );\n    const onrunnerRuntimeSubstitutesWorkflowReceipt = Boolean(\n      hasCanonicalReleaseTarget\n      && onrunnerOnlyCanonicalRelease\n      && onrunnerExactLiveRuntimeProof\n      && [\"pending\", \"failure\"].includes(forgejoWorkflowState)\n    );\n    if (onrunnerRuntimeSubstitutesWorkflowReceipt) {\n      forgejoWorkflowState = \"success\";\n      states[\"forgejo-release/workflow\"] = \"success\";\n      forgejoWorkflowProof = {\n        ...(forgejoWorkflowProof || {}),\n        source: \"exact_live_onrunner_runtime_identity\",\n        proofGate: \"onrunner_exact_live_runtime_substitutes_interrupted_workflow_receipt\",\n        sourceSha,\n        liveSha: onrunnerRuntimeProof.liveSourceSha,\n        runnerVersion: onrunnerRuntimeProof.runnerVersion || null,\n        workflowReceiptSubstituted: true,\n      };\n    }\n\n    // Promote authoritative per-target runtime proof into the durable target\n    // ledger before evaluating the enclosing workflow. This allows an interrupted\n    // workflow to reconcile cleanly when every affected runtime target proved"},{"new_content":"    if (targets.ccExecution === true && states[\"cc-execution/runtime-proof\"] === \"success\") {\n      runtimeProvenTargetStates.ccExecution = \"success\";\n    }\n    if (Object.keys(runtimeProvenTargetStates).length > 0) {\n      releaseTargetStates = mergeForgejoReleaseTargetStates(releaseTargetStates, runtimeProvenTargetStates);\n    }\n    const runtimeProofOnlyRelease = Boolean(\n      targets.ccExecution === true\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true","old_content":"    if (targets.ccExecution === true && states[\"cc-execution/runtime-proof\"] === \"success\") {\n      runtimeProvenTargetStates.ccExecution = \"success\";\n    }\n    if (targets.onrunner === true && onrunnerExactLiveRuntimeProof) {\n      runtimeProvenTargetStates.onrunner = \"success\";\n    }\n    if (Object.keys(runtimeProvenTargetStates).length > 0) {\n      releaseTargetStates = mergeForgejoReleaseTargetStates(releaseTargetStates, runtimeProvenTargetStates);\n    }\n    const runtimeProofOnlyRelease = Boolean(\n      (targets.ccExecution === true || targets.onrunner === true)\n      && targets.frontend !== true\n      && targets.supabaseEdge !== true\n      && targets.migrations !== true"},{"new_content":"    if (releaseAttemptEvidence && !releaseTargetsKnown) required.push(\"release-targets/detection\");\n    if (hasCanonicalReleaseTarget) required.push(\"forgejo-release/workflow\");\n    if (targets.ccExecution === true) required.push(\"cc-execution/runtime-proof\");\n    if (targets.supabaseEdge === true) required.push(\"supabase-edge-production/live\");\n    if (targets.frontend === true) required.push(\"frontend-cloudflare/live\");\n    if (targets.migrations === true) required.push(\"supabase-migrations/live\");","old_content":"    if (releaseAttemptEvidence && !releaseTargetsKnown) required.push(\"release-targets/detection\");\n    if (hasCanonicalReleaseTarget) required.push(\"forgejo-release/workflow\");\n    if (targets.ccExecution === true) required.push(\"cc-execution/runtime-proof\");\n    if (targets.onrunner === true) required.push(\"render-onrunner/runtime-proof\");\n    if (targets.supabaseEdge === true) required.push(\"supabase-edge-production/live\");\n    if (targets.frontend === true) required.push(\"frontend-cloudflare/live\");\n    if (targets.migrations === true) required.push(\"supabase-migrations/live\");"},{"new_content":"      phase: releaseState === \"verified\" ? (visualRequested ? \"visual_proof\" : \"runtime_proof\") : \"release\",\n      terminal: false,\n      terminal_reason: null,\n      payload: { sourceSha, mainSha, sourceInMain, releaseSourceVerified, exactReleaseVerifiedAfterMainAdvanced, compareStatus, releaseState, requestContractHash: text(context.requestContractHash, 100) || null, releaseTargets: releaseTargetsInput || null, releaseTargetStates, releaseTargetRecoveryProof, required, states, missing, pending, failed, forgejoWorkflowProof, ccExecutionRuntimeProof },\n      context_patch: {\n        releaseState,\n        workflowRunId: workflowRunId > 0 ? workflowRunId : (context.workflowRunId || null),","old_content":"      phase: releaseState === \"verified\" ? (visualRequested ? \"visual_proof\" : \"runtime_proof\") : \"release\",\n      terminal: false,\n      terminal_reason: null,\n      payload: { sourceSha, mainSha, sourceInMain, releaseSourceVerified, exactReleaseVerifiedAfterMainAdvanced, compareStatus, releaseState, requestContractHash: text(context.requestContractHash, 100) || null, releaseTargets: releaseTargetsInput || null, releaseTargetStates, releaseTargetRecoveryProof, required, states, missing, pending, failed, forgejoWorkflowProof, ccExecutionRuntimeProof, onrunnerRuntimeProof },\n      context_patch: {\n        releaseState,\n        workflowRunId: workflowRunId > 0 ? workflowRunId : (context.workflowRunId || null),"},{"new_content":"              : null,\n        forgejoWorkflowProof,\n        ccExecutionRuntimeProof,\n      },\n    });\n    if (!append.ok) return append;","old_content":"              : null,\n        forgejoWorkflowProof,\n        ccExecutionRuntimeProof,\n        onrunnerRuntimeProof,\n      },\n    });\n    if (!append.ok) return append;"}]},{"path":"workers/cc-execution/src/version.js","edits":[{"new_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\nexport const CC_EXECUTION_VERSION = \"1.63.1-forgejo-authority-decruft\";","old_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\nexport const CC_EXECUTION_VERSION = \"1.63.0-mission-freedom-web-research\";"}]},{"path":"workers/cc-execution/test/capability-release-reconciliation.test.js","edits":[{"new_content":"});\n\n\ntest('retired visual release target is absent from canonical release reconciliation', () => {\n  const source = fs.readFileSync(new URL('../src/mission-ledger.js', import.meta.url), 'utf8');\n  assert.match(\n    source,\n    /const REQUEST_CONTRACT_RELEASE_TARGET_KEYS = \\[\"ccExecution\", \"frontend\", \"supabaseEdge\", \"migrations\"\\]/,\n  );\n  assert.doesNotMatch(source, /release_onrunner|targets\\.onrunner|render-onrunner\\/runtime-proof/);\n  assert.match(source, /const failed = required\\.filter\\(\\(name\\) => \\[\"failure\", \"error\"\\]\\.includes\\(states\\[name\\]\\)\\)/);\n});","old_content":"});\n\n\ntest('OnRunner source mismatch stays nonterminal while canonical release workflow is pending', () => {\n  const source = fs.readFileSync(new URL('../src/mission-ledger.js', import.meta.url), 'utf8');\n  assert.match(\n    source,\n    /exactSource \\? \"success\" : forgejoWorkflowState === \"pending\" \\? \"pending\" : liveSha \\? \"failure\" : \"pending\"/,\n  );\n  assert.match(source, /const failed = required\\.filter\\(\\(name\\) => \\[\"failure\", \"error\"\\]\\.includes\\(states\\[name\\]\\)\\)/);\n});"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 5 exact edits are committed to existing PR #4073 while preserving newer PAUL/runtime lineage.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 5 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, preserving newer cc-execution lineage at 1.63.1-forgejo-authority-decruft. Bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"preserve-newer","statement":"Advance cc-execution 1.63.0 to 1.63.1-forgejo-authority-decruft; do not downgrade.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 5 exact edits are committed to existing PR #4073 while preserving newer PAUL/runtime lineage.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 5 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, preserving newer cc-execution lineage at 1.63.1-forgejo-authority-decruft. Bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"preserve-newer","statement":"Advance cc-execution 1.63.0 to 1.63.1-forgejo-authority-decruft; do not downgrade.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"recovery":false,"fingerprint":"29ebb800c9678a04417d95eff7a3074f7b489c54bd49873e01763e649ed9ff9e","replayCount":0,"serializedBytes":27198},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:13.310758+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:638fc90e-9513-4194-a383-310d762fa355:repository-mutation-intent:29ebb800c9678a04417d95eff7a3074f7b489c54bd49873e01763e649ed9ff9e:0","mission_step_id":"777500b3-de2b-4d08-9666-be6fa7b82e44","command_center_event_id":"638fc90e-9513-4194-a383-310d762fa355"},{"id":"fce17f2e-3d07-496e-8725-d891134c338b","source":"cc-execution","status":"authorized","payload":{"paths":["workers/cc-execution/src/index-runtime-verify-gate.js","workers/cc-execution/src/mission-ledger.js","workers/cc-execution/src/version.js","workers/cc-execution/test/capability-release-reconciliation.test.js"],"reason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f.","baseSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","issuedAt":1790649313763,"expiresAt":1790649493763,"missionId":"638fc90e-9513-4194-a383-310d762fa355","authorizationId":"4f008d45-89f4-4b01-8e15-0f0aa8f025f5","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:14.083673+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:4f008d45-89f4-4b01-8e15-0f0aa8f025f5","mission_step_id":"f388c6a0-e1d9-47b8-af34-57ad5805d497","command_center_event_id":"638fc90e-9513-4194-a383-310d762fa355"},{"id":"01e06ea4-2837-4632-ab03-2fa317040766","source":"cc-execution","status":"cancelled","payload":{"cancelled":true,"missionId":"638fc90e-9513-4194-a383-310d762fa355"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:28.389349+00:00","proof_gate":"durable_mission_cancelled","source_sha":null,"external_id":null,"receipt_type":"owner_mission_cancelled","idempotency_key":"mission:638fc90e-9513-4194-a383-310d762fa355:mission-cancel:638fc90e-9513-4194-a383-310d762fa355","mission_step_id":"7dae883a-2d9d-458a-aa20-2c71cd4e9f8a","command_center_event_id":"638fc90e-9513-4194-a383-310d762fa355"},{"id":"1cff95b8-c4e9-483e-b495-6d2cbfaab41d","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"version":1,"approved":true,"prNumber":4073,"missionId":"5250b603-7869-43e8-b3cb-1f078dbc8700","objective":"Apply exact repository-authority decruft batch 7 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/test/visual-witness-lane-affinity.test.js","workers/cc-execution/test/visual-witness-runner-env-threading.test.js","workers/cc-read-proxy/src/ownerDefaultWorker.ts","workers/cc-read-proxy/src/worker.ts","wrangler.cc-read-proxy.toml"],"workstreamKey":"repo-decruft-pr4073-batch7-c2eea2a4ff6c","anchored_edits":[{"path":"workers/cc-execution/test/visual-witness-lane-affinity.test.js","edits":[{"new_content":"    result: { ok: true },\n  };\n  const supervisor = new MissionSupervisor({\n    runtimeLane: \"cc-execution -> KNOCKLAUNCH Visual Sandbox -> universal-witness.mjs\",\n    createAttempt: async () => { throw new Error(\"should_not_run\"); },\n    readAttempt: async () => null,\n    persist: async () => {},","old_content":"    result: { ok: true },\n  };\n  const supervisor = new MissionSupervisor({\n    runtimeLane: \"cc-execution -> Render OnRunner -> universal-witness.mjs\",\n    createAttempt: async () => { throw new Error(\"should_not_run\"); },\n    readAttempt: async () => null,\n    persist: async () => {},"}]},{"path":"workers/cc-execution/test/visual-witness-runner-env-threading.test.js","edits":[{"new_content":"    service: 'knocklaunch-universal-visual-witness',\n    canonicalLane: lane === 'virtual'\n      ? 'cc-execution -> Cloudflare Container -> universal-witness.mjs'\n      : 'cc-execution -> KNOCKLAUNCH Visual Sandbox -> universal-witness.mjs',\n    authenticatedProfile: true,\n    godModeAuthorityRequired: true,\n    supabaseProjectAligned: true,","old_content":"    service: 'knocklaunch-universal-visual-witness',\n    canonicalLane: lane === 'virtual'\n      ? 'cc-execution -> Cloudflare Container -> universal-witness.mjs'\n      : 'cc-execution -> Render OnRunner -> universal-witness.mjs',\n    authenticatedProfile: true,\n    godModeAuthorityRequired: true,\n    supabaseProjectAligned: true,"}]},{"path":"workers/cc-read-proxy/src/ownerDefaultWorker.ts","edits":[{"new_content":"// Compatibility entrypoint for the canonical cc-read proxy.\n//\n// Authenticated browser execution is owned exclusively by:\n//   cc-execution -> KNOCKLAUNCH Visual Sandbox -> universal-witness.mjs\n//\n// Do not add browser engines, route packs, managed profiles, or fallback behavior here.\n// Browser-facing compatibility endpoints in worker.ts fail closed with an explicit","old_content":"// Compatibility entrypoint for the canonical cc-read proxy.\n//\n// Authenticated browser execution is owned exclusively by:\n//   cc-execution -> Render OnRunner -> runner-entrypoint.mjs -> universal-witness.mjs\n//\n// Do not add browser engines, route packs, managed profiles, or fallback behavior here.\n// Browser-facing compatibility endpoints in worker.ts fail closed with an explicit"}]},{"path":"workers/cc-read-proxy/src/worker.ts","edits":[{"new_content":"    active_worker_delegate: 'workers/cc-read-proxy/src/worker.ts',\n    upstream_origin: UPSTREAM_ORIGIN,\n    read_only: true,\n    proof_boundary: 'read_proxy_only; authenticated browser execution is exclusively cc-execution -> KNOCKLAUNCH Visual Sandbox',\n    key_forwarding: Boolean(env.UPSTREAM_CC_AGENT_KEY),\n    has_read_proxy_secret: Boolean(env.READ_PROXY_BEARER_KEY),\n    has_upstream_key: Boolean(env.UPSTREAM_CC_AGENT_KEY),","old_content":"    active_worker_delegate: 'workers/cc-read-proxy/src/worker.ts',\n    upstream_origin: UPSTREAM_ORIGIN,\n    read_only: true,\n    proof_boundary: 'read_proxy_only; authenticated browser execution is exclusively cc-execution -> Render OnRunner',\n    key_forwarding: Boolean(env.UPSTREAM_CC_AGENT_KEY),\n    has_read_proxy_secret: Boolean(env.READ_PROXY_BEARER_KEY),\n    has_upstream_key: Boolean(env.UPSTREAM_CC_AGENT_KEY),"},{"new_content":"function readProxyOpenApi() {\n  return {\n    openapi: '3.1.0',\n    info: { title: 'KNOCKLAUNCH Command Center Read Proxy', version: WRAPPER_VERSION, description: 'Read-only Command Center proxy. Authenticated browser execution is exclusively provided by cc-execution and the KNOCKLAUNCH Visual Sandbox.' },\n    servers: [{ url: 'https://cc-read.knocklaunch.app' }],\n    components: { securitySchemes: { bearerAuth: { type: 'http', scheme: 'bearer' } }, schemas: {} },\n    security: [{ bearerAuth: [] }],","old_content":"function readProxyOpenApi() {\n  return {\n    openapi: '3.1.0',\n    info: { title: 'KNOCKLAUNCH Command Center Read Proxy', version: WRAPPER_VERSION, description: 'Read-only Command Center proxy. Authenticated browser execution is exclusively provided by cc-execution and Render OnRunner.' },\n    servers: [{ url: 'https://cc-read.knocklaunch.app' }],\n    components: { securitySchemes: { bearerAuth: { type: 'http', scheme: 'bearer' } }, schemas: {} },\n    security: [{ bearerAuth: [] }],"}]},{"path":"wrangler.cc-read-proxy.toml","edits":[{"new_content":"#   UPSTREAM_CC_AGENT_KEY   - read-capable kl_* Command Center key forwarded to Supabase\n# Without those secrets, the Worker preserves legacy behavior and forwards the caller's bearer auth directly.\n# KNOCKLAUNCH_CHANGE_STAMP: 2026-06-26T03:12:00Z — ai/read-proxy-combined-default-smoke-20260626 — Command Center\n# Compatibility entrypoint delegates to the read-only worker. Authenticated browser execution is exclusively cc-execution -> KNOCKLAUNCH Visual Sandbox; no fallback engine is permitted.\n\nname = \"knocklaunch-cc-read-proxy\"\nmain = \"workers/cc-read-proxy/src/ownerDefaultWorker.ts\"","old_content":"#   UPSTREAM_CC_AGENT_KEY   - read-capable kl_* Command Center key forwarded to Supabase\n# Without those secrets, the Worker preserves legacy behavior and forwards the caller's bearer auth directly.\n# KNOCKLAUNCH_CHANGE_STAMP: 2026-06-26T03:12:00Z — ai/read-proxy-combined-default-smoke-20260626 — Command Center\n# Compatibility entrypoint delegates to the read-only worker. Authenticated browser execution is exclusively cc-execution -> Render OnRunner; no fallback engine is permitted.\n\nname = \"knocklaunch-cc-read-proxy\"\nmain = \"workers/cc-read-proxy/src/ownerDefaultWorker.ts\""}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 7 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 7 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/test/visual-witness-lane-affinity.test.js","workers/cc-execution/test/visual-witness-runner-env-threading.test.js","workers/cc-read-proxy/src/ownerDefaultWorker.ts","workers/cc-read-proxy/src/worker.ts","wrangler.cc-read-proxy.toml"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"Batch 7 exact edits are committed to existing PR #4073.","proofConditionIds":["proof-branch"]}],"objective":"Apply exact repository-authority decruft batch 7 to existing PR #4073 on branch ai/objective-first-repair-e3478acfa504, bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f. Do not merge, release, create another PR, or broaden scope.","constraints":[{"id":"same-pr","statement":"Reuse PR #4073 and branch ai/objective-first-repair-e3478acfa504 only.","proofConditionIds":["proof-branch"]},{"id":"no-ship","statement":"Do not merge or release this intermediate batch.","proofConditionIds":["proof-branch"]},{"id":"exact-scope","statement":"Apply only the supplied anchored edits.","proofConditionIds":["proof-branch"]}],"terminalPolicy":"all_required_proof_conditions_satisfied","proofConditions":[{"id":"proof-branch","kind":"repository","claim":"The supplied batch is committed to the exact existing PR branch.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/test/visual-witness-lane-affinity.test.js","workers/cc-execution/test/visual-witness-runner-env-threading.test.js","workers/cc-read-proxy/src/ownerDefaultWorker.ts","workers/cc-read-proxy/src/worker.ts","wrangler.cc-read-proxy.toml"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/test/visual-witness-lane-affinity.test.js","workers/cc-execution/test/visual-witness-runner-env-threading.test.js","workers/cc-read-proxy/src/ownerDefaultWorker.ts","workers/cc-read-proxy/src/worker.ts","wrangler.cc-read-proxy.toml"],"controlPlaneMaintenanceReason":"Exact owner-authorized intermediate PR #4073 mutation bound to current protected main c2eea2a4ff6cec84887d9be917c3584c7c90739f."},"recovery":false,"fingerprint":"4e5b8053d4f21d29786c4c837bb2a546bc3da7804e709d9e4241e52fefde68f0","replayCount":0,"serializedBytes":10583},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:36:08.154844+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:5250b603-7869-43e8-b3cb-1f078dbc8700:repository-mutation-intent:4e5b8053d4f21d29786c4c837bb2a546bc3da7804e709d9e4241e52fefde68f0:0","mission_step_id":"947178ab-d8e8-4309-a590-b2919db8dd95","command_center_event_id":"5250b603-7869-43e8-b3cb-1f078dbc8700"},{"id":"3bd72a6f-7c8d-490f-8f1b-481fe8d752bd","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","frontend-cloudflare/live":"success"},"mainSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","releaseState":"verified","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"frontend":"success"},"requestContractHash":"637f886fa3bfa5968608f6d7610ad862e3b4b25ce44cc355a182e97cc49e02a6","forgejoWorkflowProof":{"runId":12861,"source":"signed_push_receipt","status":"success","results":{},"conclusion":"success","targetStates":{"frontend":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:43.399712+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"c2eea2a4ff6cec84887d9be917c3584c7c90739f","external_id":"forgejo-main-c2eea2a4ff6c","receipt_type":"canonical_release_status","idempotency_key":"mission:83515a4a-94d3-4807-bbee-e6c6d341bc36:forgejo-release-status:c2eea2a4ff6cec84887d9be917c3584c7c90739f:verified:forgejo-main/source=success|forgejo-release/workflow=success|frontend-cloudflare/live=success","mission_step_id":"ca1f55bd-9ff0-4ccf-bcc9-db37b191fefe","command_center_event_id":"83515a4a-94d3-4807-bbee-e6c6d341bc36"},{"id":"c9bd888e-4e6b-4272-8a94-09c17d316d6f","source":"cc-execution","status":"complete","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":null,"status":"complete","metrics":{"receiptBytes":32105,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:35:41.508Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4073,"terminal":false,"missionId":"f1edc99e-a626-492f-8d5e-7f1bd6471b7a","operation":"execute_mission","proofGate":"repair_mission_prepared","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":4320,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":297,"providerAuthMs":0,"ledgerPrepareMs":297,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":297,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":297,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"continue_batch_or_ship_and_prove","receiptRef":{"mode":"full","missionId":"f1edc99e-a626-492f-8d5e-7f1bd6471b7a"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2960,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:35:46.670986+00:00","proof_gate":"repair_mission_prepared","source_sha":null,"external_id":"4073","receipt_type":"execute_mission","idempotency_key":"mission:f1edc99e-a626-492f-8d5e-7f1bd6471b7a:execute_mission:repair_mission_prepared:current-generation","mission_step_id":"9191ba0f-c505-44f1-8646-1ed0e22e1891","command_center_event_id":"f1edc99e-a626-492f-8d5e-7f1bd6471b7a"},{"id":"3e23f0f2-f76e-4f8b-b223-2ed2a3d6a493","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-ad3715ae1d45","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"ad3715ae-1d45-4de0-9799-35804937bcc7","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1444,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":445,"providerAuthMs":0,"ledgerPrepareMs":445,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":445,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":445,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"ad3715ae-1d45-4de0-9799-35804937bcc7"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":4441,"likelyAffectedFiles":["src/pages/card-grading/PCGWorkspace.tsx","src/pages/card-grading/PCGModesWorkspace.tsx"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:37:29.665106+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:ad3715ae-1d45-4de0-9799-35804937bcc7:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"f60c4984-3934-4471-bf7f-39deb98452bd","command_center_event_id":"ad3715ae-1d45-4de0-9799-35804937bcc7"},{"id":"711d2b05-581e-4be1-95cf-e2e92b29e79f","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-ad3715ae1d45","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":58940,"releaseCount":0,"toolCallCount":2,"repeatedCallCount":0,"executorlessWaitMs":41694,"firstUsefulResultAt":"2026-09-29T02:37:29.637Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4087,"terminal":false,"missionId":"ad3715ae-1d45-4de0-9799-35804937bcc7","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3877,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":703,"missionSetupMs":345,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":345,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":345,"repositoryMutationMs":3174,"repositoryProviderMs":3174,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":2020,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":345,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1154},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"ad3715ae-1d45-4de0-9799-35804937bcc7"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3883,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:38:16.300407+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4087","receipt_type":"execute_mission","idempotency_key":"mission:ad3715ae-1d45-4de0-9799-35804937bcc7:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"c0ea7fff-de4b-431d-8093-4a8b659a2d32","command_center_event_id":"ad3715ae-1d45-4de0-9799-35804937bcc7"},{"id":"c1014a54-1a99-449c-9ca5-d65e721e6f2b","source":"cc-execution","status":"waiting","payload":{"body":{"ship":false,"files":[],"branch":"ai/objective-first-repair-0c9214aed67b","writes":[],"patches":[],"version":1,"approved":true,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","objective":"Continue the same WMP/BMD public-surface media bootstrap mission. Apply the shared media contract, shared Settings upload/reset UI, and contract-test batch only. Preserve the same mission/branch and do not release yet.","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/lib/tenantMedia.ts","src/pages/settings/TenantSettingsPageWithWebsiteAssets.tsx","src/__tests__/contracts/prehistoric-001-tenant-media.contract.test.ts"],"anchored_edits":[{"path":"src/lib/tenantMedia.ts","new_content":"export const TENANT_BRAND_CHARACTER_RENDER_COLLECTION = 'brand-character-renders';\nexport const TENANT_PUBLIC_SURFACE_MEDIA_CONTRACT = 'TENANT_PUBLIC_SURFACE_MEDIA_V1';\nexport const TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS = Object.freeze({\n  wmp: Object.freeze({\n    profile: 'wmp-profile-photo',\n    hero: 'wmp-hero',\n    background: 'wmp-background',\n    cover: 'wmp-cover',\n    general: 'wmp-media',\n  }),\n  bmd: Object.freeze({\n    profile: 'bmd-profile-photo',\n    hero: 'bmd-hero',\n    background: 'bmd-background',\n    cover: 'bmd-cover',\n    general: 'bmd-media',\n  }),\n});\nexport type TenantPublicSurface = keyof typeof TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS;\nexport type TenantPublicSurfaceMediaSlot = keyof typeof TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.wmp;\nexport const TENANT_PUBLIC_SURFACE_MEDIA_BOOTSTRAP_POLICY = Object.freeze({\n  strategy: 'lazy_non_destructive_fallback',\n  emptySlotsHealthy: true,\n  overwriteExistingCustomMedia: false,\n  resetBehavior: 'delete_custom_asset_then_fallback',\n});\nexport function tenantPublicSurfaceMediaCollection(surface: TenantPublicSurface, slot: TenantPublicSurfaceMediaSlot): string {\n  return TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS[surface][slot];\n}\nconst DEFAULT_SIGNED_URL_SECONDS = 60 * 60 * 6;","old_content":"export const TENANT_BRAND_CHARACTER_RENDER_COLLECTION = 'brand-character-renders';\nconst DEFAULT_SIGNED_URL_SECONDS = 60 * 60 * 6;"},{"path":"src/pages/settings/TenantSettingsPageWithWebsiteAssets.tsx","new_content":"import { supabase } from '@/integrations/supabase/client';\nimport { TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS } from '@/lib/tenantMedia';","old_content":"import { supabase } from '@/integrations/supabase/client';"},{"path":"src/pages/settings/TenantSettingsPageWithWebsiteAssets.tsx","new_content":"];\n\ntype PublicSurfaceAssetSlot = {\n  key: string;\n  surface: 'wmp' | 'bmd';\n  label: string;\n  collection: string;\n  description: string;\n  guidance: string;\n  fallback: string;\n  accept: string;\n  replace: boolean;\n  icon: React.ComponentType<{ className?: string }>;\n};\n\nconst PUBLIC_SURFACE_ASSET_SLOTS: PublicSurfaceAssetSlot[] = [\n  { key: 'wmp-profile', surface: 'wmp', label: 'Profile / Logo', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.wmp.profile, description: 'Primary WhatsMyProgress identity image.', guidance: 'Recommended: square transparent PNG, SVG, or WebP.', fallback: 'Falls back to the tenant logo/avatar when empty.', accept: 'image/png,image/svg+xml,image/webp,image/jpeg,image/avif', replace: true, icon: Image },\n  { key: 'wmp-hero', surface: 'wmp', label: 'Hero Image', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.wmp.hero, description: 'Primary visual used on the public progress experience.', guidance: 'Recommended: 1600×900 or larger.', fallback: 'Falls back to the tenant website/public hero when available.', accept: 'image/jpeg,image/png,image/webp,image/avif', replace: true, icon: Image },\n  { key: 'wmp-background', surface: 'wmp', label: 'Background', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.wmp.background, description: 'Full-page background for WhatsMyProgress.', guidance: 'Recommended: 1920×1080 or larger.', fallback: 'Falls back to the tenant/public background when available.', accept: 'image/jpeg,image/png,image/webp,image/avif', replace: true, icon: Image },\n  { key: 'wmp-cover', surface: 'wmp', label: 'Cover / Banner', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.wmp.cover, description: 'Wide banner image for the public progress home.', guidance: 'Recommended: 1800×600 or wider.', fallback: 'Falls back to the tenant website/public hero when available.', accept: 'image/jpeg,image/png,image/webp,image/avif', replace: true, icon: Image },\n  { key: 'wmp-general', surface: 'wmp', label: 'Supporting Media', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.wmp.general, description: 'Additional customer-facing images for WhatsMyProgress.', guidance: 'Upload approved supporting images as needed.', fallback: 'No fallback; the gallery stays hidden when empty.', accept: 'image/jpeg,image/png,image/webp,image/avif', replace: false, icon: UploadCloud },\n  { key: 'bmd-profile', surface: 'bmd', label: 'Profile / Logo', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.bmd.profile, description: 'Primary BookMeDirectly identity image.', guidance: 'Recommended: square transparent PNG, SVG, or WebP.', fallback: 'Falls back to the tenant logo/avatar when empty.', accept: 'image/png,image/svg+xml,image/webp,image/jpeg,image/avif', replace: true, icon: Image },\n  { key: 'bmd-hero', surface: 'bmd', label: 'Hero Image', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.bmd.hero, description: 'Primary visual used on the public booking experience.', guidance: 'Recommended: 1600×900 or larger.', fallback: 'Falls back to the tenant website/public hero when available.', accept: 'image/jpeg,image/png,image/webp,image/avif', replace: true, icon: Image },\n  { key: 'bmd-background', surface: 'bmd', label: 'Background', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.bmd.background, description: 'Full-page background for BookMeDirectly.', guidance: 'Recommended: 1920×1080 or larger.', fallback: 'Falls back to the tenant/public background when available.', accept: 'image/jpeg,image/png,image/webp,image/avif', replace: true, icon: Image },\n  { key: 'bmd-cover', surface: 'bmd', label: 'Cover / Banner', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.bmd.cover, description: 'Wide banner image for the public booking home.', guidance: 'Recommended: 1800×600 or wider.', fallback: 'Falls back to the tenant website/public hero when available.', accept: 'image/jpeg,image/png,image/webp,image/avif', replace: true, icon: Image },\n  { key: 'bmd-general', surface: 'bmd', label: 'Supporting Media', collection: TENANT_PUBLIC_SURFACE_MEDIA_COLLECTIONS.bmd.general, description: 'Additional customer-facing images for BookMeDirectly.', guidance: 'Upload approved supporting images as needed.', fallback: 'No fallback; the gallery stays hidden when empty.', accept: 'image/jpeg,image/png,image/webp,image/avif', replace: false, icon: UploadCloud },\n];\n\nfunction AssetPreview","old_content":"];\n\nfunction AssetPreview"},{"path":"src/pages/settings/TenantSettingsPageWithWebsiteAssets.tsx","new_content":"function CustomerSurfaceAssetsSettingsSection() {\n  const { activeTenant } = useMultiTenant();\n  const tenantId = String(activeTenant?.id || '').trim();\n  const [assets, setAssets] = React.useState<MediaAsset[]>([]);\n  const [loading, setLoading] = React.useState(false);\n  const [busyKey, setBusyKey] = React.useState('');\n  const [error, setError] = React.useState('');\n  const [notice, setNotice] = React.useState('');\n\n  const refresh = React.useCallback(async () => {\n    if (!tenantId) return;\n    setLoading(true);\n    setError('');\n    try {\n      const { data, error: invokeError } = await supabase.functions.invoke('tenant-media-library', { body: { action: 'list', tenantId } });\n      if (invokeError || !data?.ok) throw new Error(data?.error || 'Could not load public-surface media.');\n      const allowed = new Set(PUBLIC_SURFACE_ASSET_SLOTS.map(slot => slot.collection));\n      const next = Array.isArray(data.assets) ? data.assets : [];\n      setAssets(next.filter((asset: MediaAsset) => allowed.has(String(asset.collection_key || ''))));\n    } catch (caught: any) {\n      setError(caught?.message || 'Could not load public-surface media.');\n    } finally {\n      setLoading(false);\n    }\n  }, [tenantId]);\n\n  React.useEffect(() => { void refresh(); }, [refresh]);\n\n  const upload = async (slot: PublicSurfaceAssetSlot, file: File | null) => {\n    if (!tenantId || !file || busyKey) return;\n    setBusyKey(slot.key);\n    setError('');\n    setNotice('');\n    const previous = slot.replace ? assets.find(asset => asset.collection_key === slot.collection) : undefined;\n    try {\n      const { data: created, error: createError } = await supabase.functions.invoke('tenant-media-library', {\n        body: {\n          action: 'create_upload',\n          tenantId,\n          name: file.name,\n          type: file.type || 'application/octet-stream',\n          size: file.size,\n          collection: slot.collection,\n          title: slot.label,\n          published: true,\n          usage: 'tenant_public_surface_media',\n          surface: slot.surface,\n          slot: slot.key,\n        },\n      });\n      if (createError || !created?.ok || !created?.asset?.id || !created?.bucket || !created?.path || !created?.token) {\n        throw new Error(created?.error || 'Could not prepare upload.');\n      }\n      const stored = await supabase.storage.from(String(created.bucket)).uploadToSignedUrl(\n        String(created.path),\n        String(created.token),\n        file,\n        { contentType: file.type || undefined },\n      );\n      if (stored.error) throw stored.error;\n      const { data: finalized, error: finalizeError } = await supabase.functions.invoke('tenant-media-library', {\n        body: { action: 'finalize_upload', tenantId, assetId: created.asset.id },\n      });\n      if (finalizeError || !finalized?.ok) throw new Error(finalized?.error || 'Could not finalize upload.');\n      if (previous?.id && previous.id !== created.asset.id) {\n        await supabase.functions.invoke('tenant-media-library', { body: { action: 'delete', tenantId, assetId: previous.id } });\n      }\n      setNotice(slot.replace ? slot.label + ' updated.' : slot.label + ' uploaded.');\n      await refresh();\n    } catch (caught: any) {\n      setError(caught?.message || 'Upload failed.');\n    } finally {\n      setBusyKey('');\n    }\n  };\n\n  const reset = async (asset: MediaAsset) => {\n    if (!tenantId || !asset.id || busyKey) return;\n    setBusyKey('delete:' + asset.id);\n    setError('');\n    setNotice('');\n    try {\n      const { data, error: invokeError } = await supabase.functions.invoke('tenant-media-library', {\n        body: { action: 'delete', tenantId, assetId: asset.id },\n      });\n      if (invokeError || !data?.ok) throw new Error(data?.error || 'Could not reset media.');\n      setNotice('Custom media removed. The tenant fallback is active again.');\n      await refresh();\n    } catch (caught: any) {\n      setError(caught?.message || 'Could not reset media.');\n    } finally {\n      setBusyKey('');\n    }\n  };\n\n  if (!tenantId) return null;\n\n  const groups = [\n    { key: 'wmp' as const, eyebrow: 'WhatsMyProgress', title: 'WMP Media', description: 'Brand the customer progress experience independently from the workspace and website.' },\n    { key: 'bmd' as const, eyebrow: 'BookMeDirectly', title: 'BMD Media', description: 'Brand the direct-booking experience independently from WMP, the workspace, and the website.' },\n  ];\n\n  return (\n    <section className=\"mx-auto mt-6 w-full max-w-6xl rounded-3xl border border-white/12 bg-black/30 p-5 text-white shadow-[0_24px_70px_rgba(0,0,0,.24)] backdrop-blur-xl sm:p-6 lg:p-8\" data-public-surface-assets-settings=\"true\">\n      <div className=\"flex flex-wrap items-start justify-between gap-4\">\n        <div>\n          <div className=\"text-[10px] font-black uppercase tracking-[.22em] text-emerald-300\">Public Surface Media</div>\n          <h2 className=\"mt-2 text-2xl font-black tracking-[-.03em] sm:text-3xl\">WMP + BMD Media Bootstrap</h2>\n          <p className=\"mt-2 max-w-3xl text-sm leading-6 text-white/58\">Every tenant gets independent media packs for WhatsMyProgress and BookMeDirectly. Empty slots safely inherit existing tenant branding; custom uploads never overwrite one another across surfaces.</p>\n        </div>\n        {loading ? <div className=\"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[.05] px-3 py-2 text-xs font-bold text-white/55\"><LoaderCircle className=\"h-4 w-4 animate-spin\" /> Loading media</div> : null}\n      </div>\n      {error ? <div className=\"mt-4 rounded-xl border border-red-400/20 bg-red-500/10 px-4 py-3 text-sm font-bold text-red-100\">{error}</div> : null}\n      {notice ? <div className=\"mt-4 rounded-xl border border-emerald-400/20 bg-emerald-500/10 px-4 py-3 text-sm font-bold text-emerald-100\">{notice}</div> : null}\n      <div className=\"mt-6 space-y-5\">\n        {groups.map(group => {\n          const groupSlots = PUBLIC_SURFACE_ASSET_SLOTS.filter(slot => slot.surface === group.key);\n          const fixedSlots = groupSlots.filter(slot => slot.replace);\n          const generalSlot = groupSlots.find(slot => !slot.replace)!;\n          const generalAssets = assets.filter(asset => asset.collection_key === generalSlot.collection);\n          return (\n            <div key={group.key} className=\"rounded-2xl border border-white/10 bg-white/[.035] p-4 sm:p-5\" data-public-surface={group.key}>\n              <div>\n                <div className=\"text-[9px] font-black uppercase tracking-[.2em] text-white/35\">{group.eyebrow}</div>\n                <h3 className=\"mt-1 text-xl font-black\">{group.title}</h3>\n                <p className=\"mt-1 max-w-2xl text-xs leading-5 text-white/48\">{group.description}</p>\n              </div>\n              <div className=\"mt-4 grid gap-4 md:grid-cols-2\">\n                {fixedSlots.map(slot => {\n                  const current = assets.find(asset => asset.collection_key === slot.collection);\n                  const Icon = slot.icon;\n                  const busy = busyKey === slot.key;\n                  return (\n                    <article key={slot.key} className=\"rounded-2xl border border-white/10 bg-black/20 p-4\">\n                      <div className=\"flex items-start gap-3\">\n                        <div className=\"grid h-10 w-10 shrink-0 place-items-center rounded-xl border border-emerald-300/15 bg-emerald-400/10 text-emerald-300\"><Icon className=\"h-5 w-5\" /></div>\n                        <div className=\"min-w-0 flex-1\"><h4 className=\"font-black\">{slot.label}</h4><p className=\"mt-1 text-xs leading-5 text-white/48\">{slot.description}</p></div>\n                      </div>\n                      <div className=\"mt-4\"><AssetPreview asset={current || {} as MediaAsset} /></div>\n                      <p className=\"mt-3 text-[11px] font-semibold leading-5 text-white/38\">{slot.guidance}</p>\n                      <p className=\"mt-1 text-[10px] font-semibold leading-5 text-emerald-200/55\">{slot.fallback}</p>\n                      <div className=\"mt-3 flex gap-2\">\n                        <label className=\"inline-flex min-h-10 cursor-pointer items-center justify-center gap-2 rounded-xl bg-emerald-300 px-4 text-xs font-black text-slate-950 transition hover:bg-emerald-200\">\n                          {busy ? <LoaderCircle className=\"h-4 w-4 animate-spin\" /> : <UploadCloud className=\"h-4 w-4\" />}\n                          {current ? 'Replace' : 'Upload'}\n                          <input type=\"file\" accept={slot.accept} className=\"hidden\" disabled={Boolean(busyKey)} onChange={event => { const file = event.target.files?.[0] || null; event.currentTarget.value = ''; void upload(slot, file); }} />\n                        </label>\n                        {current ? <button type=\"button\" disabled={Boolean(busyKey)} onClick={() => void reset(current)} className=\"inline-flex min-h-10 items-center justify-center gap-2 rounded-xl border border-white/12 bg-white/[.05] px-3 text-xs font-black text-white/65 transition hover:bg-white/[.09] disabled:opacity-50\"><Trash2 className=\"h-4 w-4\" /> Reset</button> : null}\n                      </div>\n                    </article>\n                  );\n                })}\n              </div>\n              <div className=\"mt-4 rounded-2xl border border-white/10 bg-black/20 p-4\">\n                <div className=\"flex flex-wrap items-center justify-between gap-3\">\n                  <div><h4 className=\"font-black\">{generalSlot.label}</h4><p className=\"mt-1 text-xs leading-5 text-white/48\">{generalSlot.description}</p></div>\n                  <label className=\"inline-flex min-h-10 cursor-pointer items-center justify-center gap-2 rounded-xl bg-emerald-300 px-4 text-xs font-black text-slate-950 transition hover:bg-emerald-200\">\n                    {busyKey === generalSlot.key ? <LoaderCircle className=\"h-4 w-4 animate-spin\" /> : <UploadCloud className=\"h-4 w-4\" />}\n                    Upload media\n                    <input type=\"file\" accept={generalSlot.accept} className=\"hidden\" disabled={Boolean(busyKey)} onChange={event => { const file = event.target.files?.[0] || null; event.currentTarget.value = ''; void upload(generalSlot, file); }} />\n                  </label>\n                </div>\n                <div className=\"mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n                  {generalAssets.map(asset => <div key={asset.id} className=\"rounded-xl border border-white/10 bg-white/[.025] p-3\"><AssetPreview asset={asset} /><div className=\"mt-2 truncate text-xs font-bold text-white/70\">{asset.display_name || generalSlot.label}</div><button type=\"button\" disabled={Boolean(busyKey)} onClick={() => void reset(asset)} className=\"mt-2 inline-flex min-h-9 items-center gap-2 rounded-lg border border-white/10 px-3 text-[11px] font-black text-white/55 hover:bg-white/[.06] disabled:opacity-50\"><Trash2 className=\"h-3.5 w-3.5\" /> Remove</button></div>)}\n                  {!generalAssets.length ? <div className=\"col-span-full rounded-xl border border-dashed border-white/10 px-4 py-6 text-center text-xs font-semibold text-white/35\">No supporting media uploaded yet.</div> : null}\n                </div>\n              </div>\n            </div>\n          );\n        })}\n      </div>\n    </section>\n  );\n}\n\nexport default function TenantSettingsPageWithWebsiteAssets() {","old_content":"export default function TenantSettingsPageWithWebsiteAssets() {"},{"path":"src/pages/settings/TenantSettingsPageWithWebsiteAssets.tsx","new_content":"      <WebsiteAssetsSettingsSection />\n      <CustomerSurfaceAssetsSettingsSection />\n    </>","old_content":"      <WebsiteAssetsSettingsSection />\n    </>"},{"path":"src/__tests__/contracts/prehistoric-001-tenant-media.contract.test.ts","new_content":"const helper=read('supabase/functions/_shared/tenant-media-folders.ts'); const tenantManage=read('supabase/functions/tenant-manage/index.ts'); const adminManage=read('supabase/functions/admin-manage/index.ts'); const onboarding=read('supabase/functions/onboarding-orchestrator/index.ts'); const mediaLibrary=read('supabase/functions/tenant-media-library/index.ts'); const branding=read('src/lib/tenants/tenantMediaBranding.ts'); const tenantBackground=read('src/lib/tenantBackground.ts'); const loader=read('src/components/ui/universal-loading-screen.tsx'); const hardening=read('supabase/migrations/20260903021500_harden_prehistoric_001_tenant_media.sql'); const contract=JSON.parse(read('config/contracts/PREHISTORIC-001-TENANT-MEDIA.json')); const applicationPrimitive=read('src/lib/tenantMedia.ts'); const surfaceSettings=read('src/pages/settings/TenantSettingsPageWithWebsiteAssets.tsx'); const customerPortal=read('supabase/functions/customer-portal/index.ts'); const wmpHome=read('src/pages/whats-my-progress/WhatsMyProgressTenantHome.tsx'); const pcgWmpHome=read('src/pages/whats-my-progress/PCGWhatsMyProgressHome.tsx'); const bmdHome=read('src/pages/book-me-directly/BookMeDirectlyPublicPage.tsx');","old_content":"const helper=read('supabase/functions/_shared/tenant-media-folders.ts'); const tenantManage=read('supabase/functions/tenant-manage/index.ts'); const adminManage=read('supabase/functions/admin-manage/index.ts'); const onboarding=read('supabase/functions/onboarding-orchestrator/index.ts'); const mediaLibrary=read('supabase/functions/tenant-media-library/index.ts'); const branding=read('src/lib/tenants/tenantMediaBranding.ts'); const tenantBackground=read('src/lib/tenantBackground.ts'); const loader=read('src/components/ui/universal-loading-screen.tsx'); const hardening=read('supabase/migrations/20260903021500_harden_prehistoric_001_tenant_media.sql'); const contract=JSON.parse(read('config/contracts/PREHISTORIC-001-TENANT-MEDIA.json')); const applicationPrimitive=read('src/lib/tenantMedia.ts');"},{"path":"src/__tests__/contracts/prehistoric-001-tenant-media.contract.test.ts","new_content":" it('keeps media library and applications on one tenant-owned private storage contract',()=>{expect(mediaLibrary).toContain('public:false');expect(contract.invariants.cloudflareMediaCanonical).toBe(false);expect(contract.invariants.applicationMediaOwnership).toBe('tenant_owned');expect(contract.invariants.appSpecificBucketsAllowed).toBe(false);expect(contract.invariants.appFacingPrimitive).toBe('src/lib/tenantMedia.ts');expect(applicationPrimitive).toContain(\"TENANT_MEDIA_FUNCTION = 'tenant-media-library'\");expect(applicationPrimitive).toContain('assertTenantMediaAsset');});\n it('bootstraps independent WMP and BMD media packs non-destructively for every tenant',()=>{for(const value of['wmp-profile-photo','wmp-hero','wmp-background','wmp-cover','wmp-media','bmd-profile-photo','bmd-hero','bmd-background','bmd-cover','bmd-media'])expect(applicationPrimitive).toContain(value);expect(applicationPrimitive).toContain(\"strategy: 'lazy_non_destructive_fallback'\");expect(applicationPrimitive).toContain('overwriteExistingCustomMedia: false');expect(surfaceSettings).toContain('WMP + BMD Media Bootstrap');expect(surfaceSettings).toContain('data-public-surface-assets-settings');expect(customerPortal).toContain('wmp_media: wmpMedia');expect(customerPortal).toContain('bmd_media: bmdMedia');expect(wmpHome).toContain('tenant.wmp_media');expect(pcgWmpHome).toContain(\"resolve_tenant_public_presence\");expect(bmdHome).toContain('bmd_media: bmdMedia');});\n});","old_content":" it('keeps media library and applications on one tenant-owned private storage contract',()=>{expect(mediaLibrary).toContain('public:false');expect(contract.invariants.cloudflareMediaCanonical).toBe(false);expect(contract.invariants.applicationMediaOwnership).toBe('tenant_owned');expect(contract.invariants.appSpecificBucketsAllowed).toBe(false);expect(contract.invariants.appFacingPrimitive).toBe('src/lib/tenantMedia.ts');expect(applicationPrimitive).toContain(\"TENANT_MEDIA_FUNCTION = 'tenant-media-library'\");expect(applicationPrimitive).toContain('assertTenantMediaAsset');});\n});"}],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":false,"version":1,"approved":true,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/lib/tenantMedia.ts","src/pages/settings/TenantSettingsPageWithWebsiteAssets.tsx","src/__tests__/contracts/prehistoric-001-tenant-media.contract.test.ts"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"05c42cec30eb153aeaa5486401bdfaab1c161160b647e38ffcc98a60309184cd","replayCount":0,"serializedBytes":24119},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:39:10.257362+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:repository-mutation-intent:05c42cec30eb153aeaa5486401bdfaab1c161160b647e38ffcc98a60309184cd:0","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"6e358621-fc2a-483f-9ba9-688bd62a22c4","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-ad3715ae1d45","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":61026,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":0,"executorlessWaitMs":46624,"firstUsefulResultAt":"2026-09-29T02:37:29.637Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":null,"prNumber":4087,"terminal":false,"missionId":"ad3715ae-1d45-4de0-9799-35804937bcc7","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"c834719c5def8c72adeb7befb8a8f4197b26397b","timingsMs":{"prReadinessMs":665,"approvedPlanMs":0,"shipAndProveMs":2533,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"ad3715ae-1d45-4de0-9799-35804937bcc7"},"performance":null,"deploymentId":"forgejo-main-c834719c5def","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1862,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:38:22.911537+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4087","receipt_type":"automatic_mission_resume","idempotency_key":"mission:ad3715ae-1d45-4de0-9799-35804937bcc7:automatic-mission-resume:4087:canonical_release_reconciliation_pending","mission_step_id":"ea5d0ee2-f937-40fc-8956-3857ad38e521","command_center_event_id":"ad3715ae-1d45-4de0-9799-35804937bcc7"},{"id":"984a6d35-938d-4446-befa-17d1d0e6c2ac","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","frontend-cloudflare/live":"pending"},"mainSha":"c834719c5def8c72adeb7befb8a8f4197b26397b","missing":[],"pending":["forgejo-release/workflow","frontend-cloudflare/live"],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"c834719c5def8c72adeb7befb8a8f4197b26397b","releaseState":"pending","sourceInMain":true,"compareStatus":"identical","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"frontend":"pending"},"requestContractHash":"ddba0d32a3a476b55b9f73842ba6b638c85b7bad566d03f82e631e4459ae3342","forgejoWorkflowProof":{"url":"https://git.knocklaunch.app/noel/KnockLaunchOS/actions/runs/12872","runId":12872,"status":"waiting","sourceSha":"c834719c5def8c72adeb7befb8a8f4197b26397b","conclusion":null,"failedJobs":[],"diagnostics":null,"exactSource":true,"targetStates":{"frontend":"pending"},"targetJobCount":6,"observedTargetStates":{"frontend":"pending"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:38:23.92197+00:00","proof_gate":"canonical_release_pending","source_sha":"c834719c5def8c72adeb7befb8a8f4197b26397b","external_id":"forgejo-main-c834719c5def","receipt_type":"canonical_release_status","idempotency_key":"mission:ad3715ae-1d45-4de0-9799-35804937bcc7:forgejo-release-status:c834719c5def8c72adeb7befb8a8f4197b26397b:pending:forgejo-main/source=success|forgejo-release/workflow=pending|frontend-cloudflare/live=pending","mission_step_id":"040d6492-36bb-489b-ab1a-9bb9021501f9","command_center_event_id":"ad3715ae-1d45-4de0-9799-35804937bcc7"},{"id":"48fdb6a6-aa2a-4f34-9231-4ec355d40f70","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in runtime proof.","nextAction":{"lane":"cc-execution","action":"reconcile_request_contract","reason":"release_verified_contract_pending","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"runtime_proof\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"request_contract_reconciliation\",\"status\":\"pending\",\"proofGate\":\"request_contract_pending\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_request_contract\",\"lane\":\"cc-execution\",\"reason\":\"release_verified_contract_pending\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_request_contract\",\"recoveryOwner\":\"cc-execution\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"runtime\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"visual_proof\",\"deadlineAt\":\"2026-09-29T06:20:56.455215+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-d8028b7a80b7\",\"prNumber\":4082,\"sourceSha\":\"c267479c921da9f1dea8b4b217448a4367523515\",\"deploymentId\":\"forgejo-main-c267479c921d\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:38:36.56753+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:owner-progress-heartbeat:119376634","mission_step_id":"e9d7e549-deb9-4d13-ae51-bb5c174bd32a","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"e984b067-b77f-4e36-8208-58c8a95be451","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-b2470149d0a7","reason":"retryable_provider_transport:pr_ready_timeout_budget_exhausted","status":"retryable","metrics":{"receiptBytes":10497,"releaseCount":0,"toolCallCount":6,"repeatedCallCount":2,"executorlessWaitMs":291082,"firstUsefulResultAt":"2026-09-29T02:34:21.970Z","recoveryAttemptCount":3,"ownerInterruptionCount":0},"version":null,"prNumber":4086,"terminal":false,"missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a","operation":"automatic_mission_resume","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"prReadinessMs":10511,"approvedPlanMs":0,"shipAndProveMs":0,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":828,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:57.733676+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4086","receipt_type":"automatic_mission_resume","idempotency_key":"mission:b2470149-d0a7-41f7-9bcd-223d1976693a:automatic-mission-resume:4086:repair_mission_pr_ready_retryable","mission_step_id":"f5f5d584-1e03-4604-b38d-d728760eb1ed","command_center_event_id":"b2470149-d0a7-41f7-9bcd-223d1976693a"},{"id":"e729c121-f76e-4e60-814c-80e68419d3eb","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-ad3715ae1d45","prNumber":4087,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"c834719c5def8c72adeb7befb8a8f4197b26397b","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:41:47.359629+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"c834719c5def8c72adeb7befb8a8f4197b26397b","external_id":"4087","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:ad3715ae-1d45-4de0-9799-35804937bcc7:merged-pr:4087:c834719c5def8c72adeb7befb8a8f4197b26397b","mission_step_id":"040d6492-36bb-489b-ab1a-9bb9021501f9","command_center_event_id":"ad3715ae-1d45-4de0-9799-35804937bcc7"},{"id":"2c118c3b-2a71-4771-92ab-02c8e6a60a79","source":"durable-mission-ledger","status":"verified","payload":{"sourceSha":"c834719c5def8c72adeb7befb8a8f4197b26397b","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"outcome-1","satisfied":true,"statement":"Consolidate Prestigious Card Grading legacy migration onto the single canonical dedicated Migration Center that already exists on current main. Scope only src/pages/card-grading/PCGWorkspace.tsx and src/pages/card-grading/PCGModesWorkspace.tsx. Remove the duplicate browser-only Legacy Migration Studio mode/component/helpers from PCGWorkspace/Card Vault so normal Card Vault retains only Overview, Single intake, Mass intake, and Growth Lab. Preserve all normal intake behavior. In PCGModesWorkspace, add 'migration' as a supported WorkspaceTab/tool label, allow ?tool=migration routing, and add a clear Migration quick action from the PCG dashboard so the owner can open the dedicated PCGLegacyMigrationCenter through PcgWorkspace. Do not alter the dedicated PCGLegacyMigrationCenter or pcg-legacy-import backend in this outcome. Preserve mobile shell behavior, tenant isolation, current routes, and no Visual Witness. One focused PR, Gate, squash merge, frontend release, and runtime proof.","proofConditionIds":["proof-production"]}],"satisfied":true,"constraints":[{"id":"capability-completeness","satisfied":true,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["proof-production"]},{"id":"atomic-capability-lifecycle","satisfied":true,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["proof-production"]}],"contractHash":"ddba0d32a3a476b55b9f73842ba6b638c85b7bad566d03f82e631e4459ae3342","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"proof-production","kind":"runtime","evidence":{"reason":null,"satisfied":true,"releaseState":"verified","missingTargets":[],"disallowedTargets":[],"migrationRequired":false,"releaseTargetStates":{"frontend":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend"],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"migrationReleaseVerified":null,"releaseRequestContractHash":"ddba0d32a3a476b55b9f73842ba6b638c85b7bad566d03f82e631e4459ae3342"},"required":true,"satisfied":true}],"validationErrors":[],"pendingProofKinds":[],"activeReleaseTargets":["frontend"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:41:49.60541+00:00","proof_gate":"request_contract_terminal_verified","source_sha":"c834719c5def8c72adeb7befb8a8f4197b26397b","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:ad3715ae-1d45-4de0-9799-35804937bcc7:request-contract:ddba0d32a3a476b55b9f73842ba6b638c85b7bad566d03f82e631e4459ae3342:c834719c5def8c72adeb7befb8a8f4197b26397b:verified:","mission_step_id":"70709614-667c-478a-9c69-b0a6aa2fc6b1","command_center_event_id":"ad3715ae-1d45-4de0-9799-35804937bcc7"},{"id":"93b32a0a-7972-4976-8ce0-379fbc4e1308","source":"cc-execution","status":"complete","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-0c9214aed67b","reason":null,"status":"complete","metrics":{"receiptBytes":39743,"releaseCount":0,"toolCallCount":9,"repeatedCallCount":5,"executorlessWaitMs":1166868,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4088,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"execute_mission","proofGate":"repair_mission_prepared","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3202,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":437,"providerAuthMs":0,"ledgerPrepareMs":331,"ledgerReconcileMs":0,"lineageReconcileMs":106,"resolvePreflightMs":437,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":331,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"continue_batch_or_ship_and_prove","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["visual","runtime","runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2761,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:39:15.199668+00:00","proof_gate":"repair_mission_prepared","source_sha":null,"external_id":"4088","receipt_type":"execute_mission","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:execute_mission:repair_mission_prepared:current-generation","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"a3597338-57b0-4ba6-8e4c-76712e9bbad0","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-5596752e68e1","reason":"retryable_provider_transport:pr_ready_timeout_budget_exhausted","status":"retryable","metrics":{"receiptBytes":89700,"releaseCount":0,"toolCallCount":13,"repeatedCallCount":8,"executorlessWaitMs":840329,"firstUsefulResultAt":"2026-09-29T02:24:30.012Z","recoveryAttemptCount":9,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4083,"terminal":false,"missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75","operation":"execute_mission","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":44492,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":44395,"approvedPlanMs":0,"missionSetupMs":753,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":201,"ledgerReconcileMs":0,"lineageReconcileMs":552,"resolvePreflightMs":753,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":201,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2832,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:34:40.056209+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4083","receipt_type":"execute_mission","idempotency_key":"mission:5596752e-68e1-43eb-b3eb-c883cdd77f75:execute_mission:repair_mission_pr_ready_retryable:current-generation","mission_step_id":"38f82569-902f-41a8-9fda-640984a6c55a","command_center_event_id":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},{"id":"9c16a77e-4cb1-4869-8989-fc90f814db17","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-0c9214aed67b","reason":"retryable_provider_transport:forgejo_provider_read_timeout","status":"retryable","metrics":{"receiptBytes":46579,"releaseCount":0,"toolCallCount":13,"repeatedCallCount":7,"executorlessWaitMs":1244049,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":3,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4088,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"execute_mission","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":6011,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":5892,"approvedPlanMs":0,"missionSetupMs":409,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":287,"ledgerReconcileMs":0,"lineageReconcileMs":122,"resolvePreflightMs":409,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":287,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["visual","runtime","runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1522,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:40:48.248999+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4088","receipt_type":"execute_mission","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:execute_mission:repair_mission_pr_ready_retryable:current-generation","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"80f99998-f54a-41d6-b010-5d68ad418a92","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","frontend-cloudflare/live":"success"},"mainSha":"c834719c5def8c72adeb7befb8a8f4197b26397b","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","frontend-cloudflare/live"],"sourceSha":"c834719c5def8c72adeb7befb8a8f4197b26397b","releaseState":"verified","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"frontend":"success"},"requestContractHash":"ddba0d32a3a476b55b9f73842ba6b638c85b7bad566d03f82e631e4459ae3342","forgejoWorkflowProof":{"runId":12872,"source":"signed_push_receipt","status":"success","results":{},"conclusion":"success","targetStates":{"frontend":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:41:48.158917+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"c834719c5def8c72adeb7befb8a8f4197b26397b","external_id":"forgejo-main-c834719c5def","receipt_type":"canonical_release_status","idempotency_key":"mission:ad3715ae-1d45-4de0-9799-35804937bcc7:forgejo-release-status:c834719c5def8c72adeb7befb8a8f4197b26397b:verified:forgejo-main/source=success|forgejo-release/workflow=success|frontend-cloudflare/live=success","mission_step_id":"70709614-667c-478a-9c69-b0a6aa2fc6b1","command_center_event_id":"ad3715ae-1d45-4de0-9799-35804937bcc7"},{"id":"9ee31dc6-814b-4117-ab32-0d993c8a5f4f","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","supabase-migrations/live":"pending"},"mainSha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","missing":[],"pending":["forgejo-release/workflow","supabase-migrations/live"],"required":["forgejo-main/source","forgejo-release/workflow","supabase-migrations/live"],"sourceSha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","releaseState":"pending","sourceInMain":true,"compareStatus":"identical","releaseTargets":{"frontend":false,"onrunner":false,"migrations":true,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{},"requestContractHash":"68e690d4d12062ae459b559d00054f44eaeb138df3dd4d2cf3ef830e7fb85c40","forgejoWorkflowProof":{"error":"workflow_run_id_missing","runId":null},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:42:11.075212+00:00","proof_gate":"canonical_release_pending","source_sha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","external_id":"forgejo-main-c484aa18d69d","receipt_type":"canonical_release_status","idempotency_key":"mission:b2470149-d0a7-41f7-9bcd-223d1976693a:forgejo-release-status:c484aa18d69d6cc3f197ce43c51bdc42b4e57072:pending:forgejo-main/source=success|forgejo-release/workflow=pending|supabase-migrations/live=pending","mission_step_id":"e02f7b7f-41ab-43d3-84ce-4f2a0c033816","command_center_event_id":"b2470149-d0a7-41f7-9bcd-223d1976693a"},{"id":"61120bb4-a052-4cc1-9f67-4820014146e0","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-b2470149d0a7","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":12082,"releaseCount":0,"toolCallCount":7,"repeatedCallCount":3,"executorlessWaitMs":302227,"firstUsefulResultAt":"2026-09-29T02:34:21.970Z","recoveryAttemptCount":4,"ownerInterruptionCount":0},"version":null,"prNumber":4086,"terminal":false,"missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","timingsMs":{"prReadinessMs":10491,"approvedPlanMs":0,"shipAndProveMs":2713,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"b2470149-d0a7-41f7-9bcd-223d1976693a"},"performance":null,"deploymentId":"forgejo-main-c484aa18d69d","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":false,"onrunner":false,"migrations":true,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1866,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:42:10.17309+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4086","receipt_type":"automatic_mission_resume","idempotency_key":"mission:b2470149-d0a7-41f7-9bcd-223d1976693a:automatic-mission-resume:4086:canonical_release_reconciliation_pending","mission_step_id":"f5f5d584-1e03-4604-b38d-d728760eb1ed","command_center_event_id":"b2470149-d0a7-41f7-9bcd-223d1976693a"},{"id":"409ae92c-4111-4e68-88aa-6d210ca81417","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","supabase-migrations/live":"success"},"mainSha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","supabase-migrations/live"],"sourceSha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","releaseState":"verified","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":false,"onrunner":false,"migrations":true,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"releaseTargetStates":{"migrations":"success"},"requestContractHash":"68e690d4d12062ae459b559d00054f44eaeb138df3dd4d2cf3ef830e7fb85c40","forgejoWorkflowProof":{"url":"https://git.knocklaunch.app/noel/KnockLaunchOS/actions/runs/12881","runId":12881,"status":"success","sourceSha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","conclusion":null,"failedJobs":[],"diagnostics":null,"exactSource":true,"targetStates":{"migrations":"success"},"targetJobCount":6,"observedTargetStates":{"migrations":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:43:07.983708+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"c484aa18d69d6cc3f197ce43c51bdc42b4e57072","external_id":"forgejo-main-c484aa18d69d","receipt_type":"canonical_release_status","idempotency_key":"mission:b2470149-d0a7-41f7-9bcd-223d1976693a:forgejo-release-status:c484aa18d69d6cc3f197ce43c51bdc42b4e57072:verified:forgejo-main/source=success|forgejo-release/workflow=success|supabase-migrations/live=success","mission_step_id":"78ea1042-f68d-4f4b-9d20-72b1e3e646b5","command_center_event_id":"b2470149-d0a7-41f7-9bcd-223d1976693a"},{"id":"751c8592-83b6-48a3-81c4-0bd37fbc4354","source":"cc-execution","status":"blocked","payload":{"ok":false,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-0c9214aed67b","reason":"anchored_edit_anchor_missing:config/capabilities/pcg-card-grading-modes.json","status":"blocked","metrics":{"receiptBytes":48571,"releaseCount":0,"toolCallCount":14,"repeatedCallCount":8,"executorlessWaitMs":1260961,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":4,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4088,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"execute_mission","proofGate":"repair_mission_execution_blocked","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3791,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":3791,"missionSetupMs":394,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":286,"ledgerReconcileMs":0,"lineageReconcileMs":108,"resolvePreflightMs":394,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":286,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["visual","runtime","runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1536,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:43:19.088399+00:00","proof_gate":"repair_mission_execution_blocked","source_sha":null,"external_id":"4088","receipt_type":"execute_mission","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:execute_mission:repair_mission_execution_blocked:current-generation","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"dcd5f0a6-6d36-4595-b4e5-ffa3ec7b9d68","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-0c9214aed67b","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":50481,"releaseCount":0,"toolCallCount":15,"repeatedCallCount":8,"executorlessWaitMs":1375508,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":4,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4088,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3333,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":1054,"missionSetupMs":433,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":318,"ledgerReconcileMs":0,"lineageReconcileMs":115,"resolvePreflightMs":433,"repositoryMutationMs":2279,"repositoryProviderMs":2279,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":1876,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":318,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":403},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["visual","runtime","runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3328,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:44:10.472499+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4088","receipt_type":"execute_mission","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"712c2494-dfd1-4ad2-a5b8-b2cb31466bd7","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","frontend-cloudflare/live":"pending","supabase-edge-production/live":"pending"},"mainSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","missing":[],"pending":["forgejo-release/workflow","supabase-edge-production/live","frontend-cloudflare/live"],"required":["forgejo-main/source","forgejo-release/workflow","supabase-edge-production/live","frontend-cloudflare/live"],"sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","releaseState":"pending","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-customer-progress"]},"releaseTargetStates":{"frontend":"pending","supabaseEdge":"pending"},"requestContractHash":"d534bf0f43d3d21771f525ba0550ed730d91be16f89f3ab4b82b1158555b2069","forgejoWorkflowProof":{"runId":12887,"source":"signed_push_receipt","status":"running","results":{},"conclusion":"running","targetStates":{"frontend":"pending","supabaseEdge":"pending"},"targetJobCount":6,"observedTargetStates":{"frontend":"pending","supabaseEdge":"pending"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:47:38.174077+00:00","proof_gate":"canonical_release_pending","source_sha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","external_id":"forgejo-main-d65dabe6c765","receipt_type":"canonical_release_status","idempotency_key":"mission:e26bb076-6723-46b3-b6c1-0c9e1a31b85f:forgejo-release-status:d65dabe6c7655a2be9635cd1b4826696806e69b9:pending:forgejo-main/source=success|forgejo-release/workflow=pending|supabase-edge-production/live=pending|frontend-cloudflare/live=pending","mission_step_id":"af6d850e-f60e-4791-9d0f-18e09026e8ee","command_center_event_id":"e26bb076-6723-46b3-b6c1-0c9e1a31b85f"},{"id":"592cad75-49c6-4dec-a6e5-b68c9c5ad562","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-5596752e68e1","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4083,"terminal":false,"missionId":"e26bb076-6723-46b3-b6c1-0c9e1a31b85f","operation":"execute_mission","proofGate":"canonical_release_reconciliation_pending","sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":13812,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":10530,"approvedPlanMs":0,"missionSetupMs":519,"providerAuthMs":0,"shipAndProveMs":2783,"ledgerPrepareMs":519,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":519,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":519,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"e26bb076-6723-46b3-b6c1-0c9e1a31b85f"},"performance":null,"deploymentId":"forgejo-main-d65dabe6c765","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-customer-progress"]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2682,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:47:29.124263+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","external_id":"forgejo-main-d65dabe6c765","receipt_type":"execute_mission","idempotency_key":"mission:e26bb076-6723-46b3-b6c1-0c9e1a31b85f:execute_mission:canonical_release_reconciliation_pending:current-generation","mission_step_id":"af6d850e-f60e-4791-9d0f-18e09026e8ee","command_center_event_id":"e26bb076-6723-46b3-b6c1-0c9e1a31b85f"},{"id":"37e4f3d6-62aa-4e69-8c26-3398d4fc1566","source":"durable-mission-ledger","status":"verified","payload":{"sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"merge-existing-pr","satisfied":true,"statement":"Exact existing PR #4083 is squash-merged without creating or mutating replacement source.","proofConditionIds":["preview-live"]},{"id":"release-preview","satisfied":true,"statement":"Affected production targets from PR #4083 are released and the PCG KNOCKLAUNCH preview routes are live.","proofConditionIds":["preview-live"]}],"satisfied":true,"constraints":[{"id":"exact-pr","satisfied":true,"statement":"Operate only on existing PR #4083 / branch ai/objective-first-repair-5596752e68e1; do not create another PR or branch.","proofConditionIds":["preview-live"]},{"id":"no-source-mutation","satisfied":true,"statement":"Do not modify source in this continuation; use the already Gate-green head.","proofConditionIds":["preview-live"]},{"id":"no-dns","satisfied":true,"statement":"Do not change pcgslab.com DNS, nameservers, registrar, or Squarespace production routing.","proofConditionIds":["preview-live"]},{"id":"no-visual-proof","satisfied":true,"statement":"No Visual Witness or screenshot proof is required; use source lineage, release receipt, and runtime route availability.","proofConditionIds":["preview-live"]},{"id":"capability-completeness","satisfied":true,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["preview-live"]},{"id":"atomic-capability-lifecycle","satisfied":true,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["preview-live"]}],"contractHash":"d534bf0f43d3d21771f525ba0550ed730d91be16f89f3ab4b82b1158555b2069","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"preview-live","kind":"runtime","evidence":{"reason":null,"satisfied":true,"releaseState":"verified","missingTargets":[],"disallowedTargets":[],"migrationRequired":false,"releaseTargetStates":{"frontend":"success","supabaseEdge":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend","supabaseEdge"],"allowedReleaseTargets":["frontend","supabaseEdge"],"requiredReleaseTargets":[],"migrationReleaseVerified":null,"releaseRequestContractHash":"d534bf0f43d3d21771f525ba0550ed730d91be16f89f3ab4b82b1158555b2069"},"required":true,"satisfied":true}],"validationErrors":[],"pendingProofKinds":[],"activeReleaseTargets":["frontend","supabaseEdge"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:49:24.089358+00:00","proof_gate":"request_contract_terminal_verified","source_sha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:e26bb076-6723-46b3-b6c1-0c9e1a31b85f:request-contract:d534bf0f43d3d21771f525ba0550ed730d91be16f89f3ab4b82b1158555b2069:d65dabe6c7655a2be9635cd1b4826696806e69b9:verified:","mission_step_id":"00a76723-ce8f-41d1-8ba5-8a7a12171a2d","command_center_event_id":"e26bb076-6723-46b3-b6c1-0c9e1a31b85f"},{"id":"b1c8cb44-83b4-40ca-ad82-f6b11c91c7fb","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-5596752e68e1","prNumber":4083,"nextAction":null,"mergeCommitSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:50:00.612243+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","external_id":"4083","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:5596752e-68e1-43eb-b3eb-c883cdd77f75:merged-pr:4083:d65dabe6c7655a2be9635cd1b4826696806e69b9","mission_step_id":"e7ab4e85-3ea4-4a22-b755-5c4b623117cf","command_center_event_id":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},{"id":"2f818d9b-f092-4a36-ac95-d219ad08ce1d","source":"cc-execution","status":"complete","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":null,"status":"complete","metrics":{"receiptBytes":5245,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:51:26.007Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4073,"terminal":false,"missionId":"1c94d54f-2a5a-4d6a-a178-a6571e9546cf","operation":"execute_mission","proofGate":"repair_mission_prepared","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":7987,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":282,"providerAuthMs":0,"ledgerPrepareMs":282,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":282,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":282,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"continue_batch_or_ship_and_prove","receiptRef":{"mode":"full","missionId":"1c94d54f-2a5a-4d6a-a178-a6571e9546cf"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2864,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:51:35.004186+00:00","proof_gate":"repair_mission_prepared","source_sha":null,"external_id":"4073","receipt_type":"execute_mission","idempotency_key":"mission:1c94d54f-2a5a-4d6a-a178-a6571e9546cf:execute_mission:repair_mission_prepared:current-generation","mission_step_id":"1af51e68-6f42-499f-9afa-cfa6ac683f36","command_center_event_id":"1c94d54f-2a5a-4d6a-a178-a6571e9546cf"},{"id":"ebf7fab8-ec2e-4b6d-8868-377f78eea567","source":"forgejo-runtime","status":"pending","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"pending","frontend-cloudflare/live":"pending","supabase-edge-production/live":"success"},"mainSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","missing":[],"pending":["forgejo-release/workflow","frontend-cloudflare/live"],"required":["forgejo-main/source","forgejo-release/workflow","supabase-edge-production/live","frontend-cloudflare/live"],"sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","releaseState":"pending","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-customer-progress"]},"releaseTargetStates":{"frontend":"pending","supabaseEdge":"success"},"requestContractHash":"d534bf0f43d3d21771f525ba0550ed730d91be16f89f3ab4b82b1158555b2069","forgejoWorkflowProof":{"runId":12887,"source":"signed_push_receipt","status":"running","results":{},"conclusion":"running","targetStates":{"frontend":"pending","supabaseEdge":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"pending","supabaseEdge":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:47:51.199371+00:00","proof_gate":"canonical_release_pending","source_sha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","external_id":"forgejo-main-d65dabe6c765","receipt_type":"canonical_release_status","idempotency_key":"mission:e26bb076-6723-46b3-b6c1-0c9e1a31b85f:forgejo-release-status:d65dabe6c7655a2be9635cd1b4826696806e69b9:pending:forgejo-main/source=success|forgejo-release/workflow=pending|supabase-edge-production/live=success|frontend-cloudflare/live=pending","mission_step_id":"af6d850e-f60e-4791-9d0f-18e09026e8ee","command_center_event_id":"e26bb076-6723-46b3-b6c1-0c9e1a31b85f"},{"id":"e4c66fa1-e7e9-4e1e-b485-c126a873cc2f","source":"cc-execution","status":"release_freshness_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-0c9214aed67b","reason":null,"status":"release_freshness_reconciliation_pending","metrics":{"receiptBytes":58941,"releaseCount":0,"toolCallCount":20,"repeatedCallCount":12,"executorlessWaitMs":1517189,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":8,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4088,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"execute_mission","proofGate":"canonical_release_freshness_reconciliation_pending","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1837,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":931,"approvedPlanMs":0,"missionSetupMs":390,"providerAuthMs":0,"shipAndProveMs":453,"ledgerPrepareMs":282,"ledgerReconcileMs":0,"lineageReconcileMs":108,"resolvePreflightMs":390,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":282,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"refresh_regate_and_reconcile_release","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["visual","runtime","runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1463,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:48:12.157866+00:00","proof_gate":"canonical_release_freshness_reconciliation_pending","source_sha":null,"external_id":"4088","receipt_type":"execute_mission","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:execute_mission:canonical_release_freshness_reconciliation_pending:current-generation","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"eb3c7c2b-2ac4-458a-bfc0-a50c2bf4d14f","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-d6cd243d5f8d","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"d6cd243d-5f8d-4268-a43e-590d637909e6","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1107,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":374,"providerAuthMs":0,"ledgerPrepareMs":374,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":374,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":374,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"d6cd243d-5f8d-4268-a43e-590d637909e6"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3576,"likelyAffectedFiles":["supabase/functions/pcg-customer-progress/index.ts","src/pages/card-grading/PCGPublicSite.tsx"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:48:33.798397+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:d6cd243d-5f8d-4268-a43e-590d637909e6:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"3df22aa4-adea-4271-acd5-a839c46fa85d","command_center_event_id":"d6cd243d-5f8d-4268-a43e-590d637909e6"},{"id":"48d7bf76-eda1-4119-816e-7a636f122d4d","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","frontend-cloudflare/live":"success","supabase-edge-production/live":"success"},"mainSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","supabase-edge-production/live","frontend-cloudflare/live"],"sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","releaseState":"verified","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-customer-progress"]},"releaseTargetStates":{"frontend":"success","supabaseEdge":"success"},"requestContractHash":"d534bf0f43d3d21771f525ba0550ed730d91be16f89f3ab4b82b1158555b2069","forgejoWorkflowProof":{"runId":12887,"source":"signed_push_receipt","status":"success","results":{},"conclusion":"success","targetStates":{"frontend":"success","supabaseEdge":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"success","supabaseEdge":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:49:22.829604+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","external_id":"forgejo-main-d65dabe6c765","receipt_type":"canonical_release_status","idempotency_key":"mission:e26bb076-6723-46b3-b6c1-0c9e1a31b85f:forgejo-release-status:d65dabe6c7655a2be9635cd1b4826696806e69b9:verified:forgejo-main/source=success|forgejo-release/workflow=success|supabase-edge-production/live=success|frontend-cloudflare/live=success","mission_step_id":"00a76723-ce8f-41d1-8ba5-8a7a12171a2d","command_center_event_id":"e26bb076-6723-46b3-b6c1-0c9e1a31b85f"},{"id":"c125b3a9-415e-480b-bacf-db25c4636805","source":"forgejo-runtime","status":"verified","payload":{"failed":[],"states":{"forgejo-main/source":"success","forgejo-release/workflow":"success","frontend-cloudflare/live":"success","supabase-edge-production/live":"success"},"mainSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","missing":[],"pending":[],"required":["forgejo-main/source","forgejo-release/workflow","supabase-edge-production/live","frontend-cloudflare/live"],"sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","releaseState":"verified","sourceInMain":true,"compareStatus":"protected_main_push_exact_source","releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-customer-progress"]},"releaseTargetStates":{"frontend":"success","supabaseEdge":"success"},"requestContractHash":"72c874d200d03e86375a85b30f2cf6a859f052f78ccebb95225b4f38c398f72a","forgejoWorkflowProof":{"url":"https://git.knocklaunch.app/noel/KnockLaunchOS/actions/runs/12887","runId":12887,"status":"success","sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","conclusion":null,"failedJobs":[],"diagnostics":null,"exactSource":true,"targetStates":{"frontend":"success","supabaseEdge":"success"},"targetJobCount":6,"observedTargetStates":{"frontend":"success","supabaseEdge":"success"}},"onrunnerRuntimeProof":null,"releaseSourceVerified":true,"ccExecutionRuntimeProof":null,"releaseTargetRecoveryProof":null,"exactReleaseVerifiedAfterMainAdvanced":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:50:03.718112+00:00","proof_gate":"canonical_release_terminal_verified","source_sha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","external_id":"forgejo-main-d65dabe6c765","receipt_type":"canonical_release_status","idempotency_key":"mission:5596752e-68e1-43eb-b3eb-c883cdd77f75:forgejo-release-status:d65dabe6c7655a2be9635cd1b4826696806e69b9:verified:forgejo-main/source=success|forgejo-release/workflow=success|supabase-edge-production/live=success|frontend-cloudflare/live=success","mission_step_id":"3bc825c3-2bfa-4632-8900-cf4474800bba","command_center_event_id":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},{"id":"56abf2b2-29b8-4f6d-a269-e95037496d16","source":"cc-execution","status":"corrective_generation_required","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-0c9214aed67b","reason":"refresh_conflict_requires_corrective_generation","status":"corrective_generation_required","metrics":{"receiptBytes":64791,"releaseCount":0,"toolCallCount":24,"repeatedCallCount":12,"executorlessWaitMs":1764043,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":10,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4088,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"execute_mission","proofGate":"repair_mission_refresh_conflict_requires_corrective_generation","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":33244,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":32463,"approvedPlanMs":0,"missionSetupMs":1185,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":294,"ledgerReconcileMs":0,"lineageReconcileMs":891,"resolvePreflightMs":1185,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":294,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Create exactly one fresh repair generation from current main under the same request contract; preserve this conflicted PR as evidence until the corrective generation proves preservation.","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["visual","runtime","runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2548,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:48:53.390972+00:00","proof_gate":"repair_mission_refresh_conflict_requires_corrective_generation","source_sha":null,"external_id":"4088","receipt_type":"execute_mission","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:execute_mission:repair_mission_refresh_conflict_requires_corrective_generation:current-generation","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"df728b64-b220-4c66-99f8-f208ef4f12b1","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[{"path":"supabase/functions/pcg-customer-progress/index.ts","content":"import {serve} from \"https://deno.land/std@0.168.0/http/server.ts\";\nimport {createClient} from \"https://esm.sh/@supabase/supabase-js@2\";\n\nexport const FUNCTION_VERSION='1.3.0-pcg-public-cert-privacy';\nconst cors={'Access-Control-Allow-Origin':'*','Access-Control-Allow-Headers':'authorization, x-client-info, apikey, content-type','Access-Control-Allow-Methods':'GET, POST, OPTIONS'};\nconst json=(body:unknown,status=200)=>new Response(JSON.stringify(body),{status,headers:{...cors,'Content-Type':'application/json','Cache-Control':'no-store'}});\nconst normalize=(v:unknown)=>String(v||'').trim();\nconst SUPABASE_URL=Deno.env.get('SUPABASE_URL')||'';\nconst normalizeCertIdentity=(v:unknown)=>normalize(v).toUpperCase().replace(/^PCG[\\s#:_-]*/,'').replace(/[^A-Z0-9]/g,'');\nconst controlledMediaUrl=(v:unknown)=>{const value=normalize(v);const prefix=SUPABASE_URL.replace(/\\/$/,'')+'/functions/v1/pcg-google-drive-media/media?';return value&&value.startsWith(prefix)?value:null};\nconst modeFor=(status:string)=>['received','intake_imaging'].includes(status)?'received':['authentication','grading','encapsulation','qa'].includes(status)?'grading':status==='ready'?'completed':['shipped','picked_up','delivered','closed'].includes(status)?'mailed':'received';\nconst safeCard=(card:any)=>({cert_number:card.cert_number||null,year:card.year||null,brand_set:card.brand_set||null,player_character:card.player_character||null,card_number:card.card_number||null,variation:card.variation||null,card_description:card.card_description||card.variation||null,autograph_present:card.autograph_present??null,grade:card.grade??null,grade_label:card.grade_label||null,front_image_url:controlledMediaUrl(card.front_image_url),back_image_url:controlledMediaUrl(card.back_image_url),slab_image_url:controlledMediaUrl(card.slab_image_url)});\nasync function resolvePcg(supabase:any,tenantSlug:string){\n  if(!tenantSlug)return null;\n  const{data:tenant,error}=await supabase.from('tenants').select('id,company_slug,company_dba_name,company_legal_name,name,company_logo_url,company_phone,company_email,company_address,company_mailing_address,status,is_active,settings').eq('company_slug',tenantSlug).maybeSingle();\n  if(error)throw error;\n  const settings=(tenant?.settings||{}) as Record<string,any>;\n  const identity=[tenant?.company_slug,tenant?.company_dba_name,tenant?.company_legal_name,tenant?.name].filter(Boolean).join(' ').toLowerCase();\n  const pcg=Boolean(tenant?.id)&&(tenant?.is_active!==false)&&String(tenant?.status||'active').toLowerCase()!=='deleted'&&(tenantSlug==='pcg'||String(settings.workspace_type||'').toLowerCase()==='card_grading'||String(settings.routing_family||'').toUpperCase()==='CARD_GRADING_OPS'||identity.includes('prestigious card grading'));\n  return pcg?{tenant,settings}:null\n}\nserve(async(req)=>{\n  if(req.method==='OPTIONS')return new Response(null,{headers:cors});\n  const url=new URL(req.url);\n  if(req.method==='GET'&&url.pathname.endsWith('/health'))return json({ok:true,service:'pcg-customer-progress',version:FUNCTION_VERSION,public_actions:['public_profile','cert_lookup','legacy_path_lookup'],progress_contract:'order+email'});\n  if(req.method!=='POST')return json({ok:false,error:'Method not allowed'},405);\n  try{\n    const body=await req.json().catch(()=>({})),action=normalize(body.action).toLowerCase();\n    const tenantSlug=normalize(body.tenant_slug||'pcg').toLowerCase();\n    const supabase=createClient(SUPABASE_URL,Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')||'');\n    const resolved=await resolvePcg(supabase,tenantSlug);\n    if(!resolved)return json({ok:false,error:action==='cert_lookup'?'We could not verify that PCG certification.':'We could not match that PCG record.'},200);\n    const{tenant,settings}=resolved;\n    if(action==='public_profile'){\n      const presence=(settings.public_presence||{}) as Record<string,any>,media=(settings.media_branding||{}) as Record<string,any>;\n      const paymentActive=String(settings.payment_processor_status||'').toLowerCase()==='external_payment_link_active';\n      return json({ok:true,data:{company_name:tenant.company_legal_name||tenant.company_dba_name||tenant.name||'Prestigious Card Grading LLC',short_name:tenant.company_dba_name||'PCG',logo_url:tenant.company_logo_url||null,background_url:media.hero_background_url||settings.background_image_url||settings.backgroundImageUrl||null,phone:tenant.company_phone||null,email:tenant.company_email||null,address:tenant.company_address||tenant.company_mailing_address||null,grading_services:Array.isArray(settings.grading_services)?settings.grading_services:[],no_upcharges:settings.no_upcharges===true,booking_url:presence?.bookmedirectly?.url||settings.canonical_booking_route||null,progress_url:presence?.whatsmyprogress?.url||settings.canonical_public_route||null,payment_url:paymentActive?settings.stripe_payment_link||null:null,public_cert_lookup:settings.public_cert_lookup!==false}});\n    }\n    if(action==='cert_lookup'){\n      const rawCert=normalize(body.cert_number),identity=normalizeCertIdentity(rawCert);if(!identity||identity.length>64)return json({ok:false,error:'Enter a PCG certification number.'},200);\n      const pattern='%'+identity.split('').join('%')+'%';\n      const{data:candidates,error}=await supabase.from('card_grading_cards').select('cert_number,year,brand_set,player_character,card_number,variation,card_description,autograph_present,grade,grade_label,front_image_url,back_image_url,slab_image_url,is_demo').eq('tenant_id',tenant.id).not('cert_number','is',null).or('is_demo.is.null,is_demo.eq.false').ilike('cert_number',pattern).limit(50);\n      if(error)throw error;\n      const matches=(candidates||[]).filter((card:any)=>normalizeCertIdentity(card.cert_number)===identity);\n      if(matches.length!==1)return json({ok:false,error:'No PCG card matched that certification number.'},200);\n      return json({ok:true,data:{card:safeCard(matches[0])}});\n    }\n    if(action==='legacy_path_lookup'){\n      const raw=normalize(body.path||body.source_url);if(!raw||raw.length>800)return json({ok:false,error:'Legacy card link not found.'},200);\n      let path=raw;try{const parsed=new URL(raw,'https://www.pcgslab.com');path=parsed.pathname}catch{}\n      if(!path.startsWith('/'))path='/'+path;\n      const candidates=['https://www.pcgslab.com'+path,'https://pcgslab.com'+path];\n      const{data:row,error}=await supabase.from('pcg_import_rows').select('canonical_card_id').eq('tenant_id',tenant.id).in('source_url',candidates).not('canonical_card_id','is',null).limit(1).maybeSingle();\n      if(error)throw error;if(!row?.canonical_card_id)return json({ok:false,error:'Legacy card link not found.'},200);\n      const{data:card,error:cardError}=await supabase.from('card_grading_cards').select('id,cert_number,year,brand_set,player_character,card_number,variation,card_description,autograph_present,grade,grade_label,front_image_url,back_image_url,slab_image_url,is_demo').eq('tenant_id',tenant.id).eq('id',row.canonical_card_id).or('is_demo.is.null,is_demo.eq.false').maybeSingle();\n      if(cardError)throw cardError;if(!card?.id)return json({ok:false,error:'Legacy card link not found.'},200);\n      return json({ok:true,data:{card:safeCard(card)}});\n    }\n    const submissionNumber=normalize(body.submission_number).toUpperCase(),email=normalize(body.email).toLowerCase();\n    if(!submissionNumber||!email||!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email))return json({ok:false,error:'Enter your order number and the email used for the order.'},200);\n    const{submission}= {submission:(await supabase.from('card_grading_submissions').select('id,submission_number,customer_name,customer_email,service_tier,status,received_at,due_at,tracking_out,payment_status,delivery_method').eq('tenant_id',tenant.id).eq('submission_number',submissionNumber).ilike('customer_email',email).maybeSingle()).data};\n    if(!submission?.id)return json({ok:false,error:'We could not match that order and email.'},200);\n    const{data:cards,error:cardsError}=await supabase.from('card_grading_cards').select('id,sequence_number,cert_number,year,brand_set,player_character,card_number,card_description,autograph_present,variation,grade,grade_label,status,front_image_url,back_image_url,slab_image_url').eq('tenant_id',tenant.id).eq('submission_id',submission.id).order('sequence_number',{ascending:true});\n    if(cardsError)throw cardsError;\n    return json({ok:true,data:{tenant:{company_name:tenant.company_dba_name||tenant.company_legal_name||tenant.name||'Prestigious Card Grading',company_slug:tenant.company_slug,logo_url:tenant.company_logo_url||null},order:{submission_number:submission.submission_number,customer_name:submission.customer_name||'Collector',service_tier:submission.service_tier,status:submission.status,mode:modeFor(String(submission.status||'')),received_at:submission.received_at,due_at:submission.due_at,tracking_out:submission.tracking_out||null,payment_status:submission.payment_status||null,delivery_method:submission.delivery_method||null},cards:(cards||[]).map((card:any)=>({id:card.id,sequence_number:card.sequence_number,cert_number:card.cert_number||null,year:card.year||null,brand_set:card.brand_set||null,player_character:card.player_character||null,card_number:card.card_number||null,card_description:card.card_description||card.variation||null,autograph_present:card.autograph_present??null,grade:card.grade??null,grade_label:card.grade_label||null,status:card.status,front_image_url:card.front_image_url||null,back_image_url:card.back_image_url||null,slab_image_url:card.slab_image_url||null}))}});\n  }catch(error){console.error('[pcg-customer-progress]',error);return json({ok:false,error:'PCG is temporarily unavailable. Please try again.'},500)}\n});","expectedSha":"e7bfd73ea0d7d0243cdb3580fae15d50fc36e745"},{"path":"src/pages/card-grading/PCGPublicSite.tsx","content":"import {FormEvent,useEffect,useMemo,useState,type ReactNode} from 'react';\nimport {ArrowRight,Clock3,CreditCard,ExternalLink,MapPin,PackageCheck,Phone,Search,ShieldCheck,Sparkles,Store,Truck,type LucideIcon} from 'lucide-react';\nimport {Link} from 'react-router-dom';\nimport {supabase} from '@/integrations/supabase/client';\nimport video0 from './pcgHeroVideoChunk0';\nimport video1 from './pcgHeroVideoChunk1';\nimport video2 from './pcgHeroVideoChunk2';\n\nconst HERO_VIDEO=`data:video/mp4;base64,${video0}${video1}${video2}`;\ntype PCGPublicPage='home'|'grading'|'submit'|'shop'|'contact';\ntype Service={id?:string;label?:string;days?:number;price_per_card?:number};\ntype Profile={company_name:string;short_name:string;logo_url:string|null;background_url:string|null;phone:string|null;email:string|null;address:string|null;grading_services:Service[];no_upcharges:boolean;booking_url:string|null;progress_url:string|null;payment_url:string|null;public_cert_lookup:boolean};\ntype Card={cert_number:string|null;year:string|null;brand_set:string|null;player_character:string|null;card_number:string|null;variation:string|null;card_description:string|null;autograph_present:boolean|null;grade:number|null;grade_label:string|null;front_image_url:string|null;back_image_url:string|null;slab_image_url:string|null};\nconst BASE='/prestigious-card-grading';\nconst FALLBACK_LOGO='https://ymntrajfubicyxwwdxxa.supabase.co/functions/v1/tenant-media-library?mode=asset&id=d663baad-dc59-4e01-817d-f53cf79c27a1&variant=thumb';\nconst FALLBACK_ADDRESS='14170 US Highway 1 · Sebastian, FL 32958';\nconst NAV:[string,string][]=[['Home',BASE],['Grading',`${BASE}/grading`],['Submit',`${BASE}/submit`],['Shop',`${BASE}/shop`],['Contact',`${BASE}/contact`]];\nconst HOME_FEATURES:[LucideIcon,string,string][]=[[ShieldCheck,'Consistent grading','Defined standards, authentication workflow, encapsulation and QA.'],[Clock3,'Fast turnaround','Multiple service tiers from standard turnaround through same-day grading.'],[CreditCard,'No up-charges','Straightforward per-card pricing from PCG’s canonical grading menu.']];\nconst SUBMIT_STEPS:[LucideIcon,string,string][]=[[PackageCheck,'1. Choose service','Select the turnaround that fits your collection.'],[ShieldCheck,'2. Protect each card','Package cards securely for drop-off or shipment.'],[Truck,'3. Mail or visit','Ship to or visit the Sebastian PCG shop.'],[CreditCard,'4. Complete checkout','Use the current PCG submission or secure payment link when available.']];\nconst PAGE_TITLES:Record<PCGPublicPage,string>={home:'Prestigious Card Grading | Sebastian, Florida',grading:'Grading Standards | Prestigious Card Grading',submit:'Start a Submission | Prestigious Card Grading',shop:'Card Shop | Prestigious Card Grading',contact:'Contact | Prestigious Card Grading'};\nfunction money(value:unknown){const n=Number(value);return Number.isFinite(n)?'$'+n.toFixed(n%1?2:0):'—'}\n\nfunction Frame({page,profile,children}:{page:PCGPublicPage;profile:Profile|null;children:ReactNode}){\n  useEffect(()=>{const previous=document.title;document.title=PAGE_TITLES[page];return()=>{document.title=previous}},[page]);\n  const logo=profile?.logo_url||FALLBACK_LOGO,phone=profile?.phone||'833-472-4752',email=profile?.email||'tony@pcgslab.com',address=profile?.address||FALLBACK_ADDRESS;\n  return <main className=\"min-h-screen bg-[#050506] text-white\"><header className=\"sticky top-0 z-50 border-b border-white/[0.09] bg-[#060607]/90 backdrop-blur-xl\"><div className=\"mx-auto flex h-20 max-w-7xl items-center gap-4 px-4 sm:px-6 lg:px-8\"><Link to={BASE} className=\"flex min-w-0 items-center gap-3\"><span className=\"grid h-11 w-11 shrink-0 place-items-center overflow-hidden rounded-xl border border-[#d8bb78]/25 bg-[#d8bb78]/[0.07]\"><img src={logo} alt=\"PCG\" className=\"h-full w-full object-contain p-1\"/></span><span className=\"hidden md:block\"><span className=\"block text-sm font-black\">Prestigious Card Grading</span><span className=\"mt-0.5 block text-[9px] font-bold uppercase tracking-[.18em] text-[#d8bb78]\">Sebastian · Florida</span></span></Link><nav className=\"ml-auto flex items-center gap-1 overflow-x-auto text-[11px] font-bold sm:text-xs\">{NAV.map(([label,to])=><Link key={to} to={to} className=\"whitespace-nowrap rounded-full px-3 py-2 text-white/55 transition hover:bg-white/[0.06] hover:text-white\">{label}</Link>)}</nav></div></header>{children}<footer className=\"border-t border-white/[0.08] bg-black/30\"><div className=\"mx-auto grid max-w-7xl gap-8 px-5 py-10 sm:px-6 md:grid-cols-3 lg:px-8\"><div><img src={logo} alt=\"PCG\" className=\"h-14 w-14 object-contain\"/><div className=\"mt-3 text-sm font-black\">{profile?.company_name||'Prestigious Card Grading LLC'}</div><p className=\"mt-2 max-w-sm text-xs leading-5 text-white/42\">Professional trading-card grading, authentication and collector services.</p></div><div className=\"text-xs leading-6 text-white/48\"><div className=\"font-black uppercase tracking-[.16em] text-[#d8bb78]\">Visit</div><div className=\"mt-2\">{address}</div></div><div className=\"text-xs leading-6 text-white/48\"><div className=\"font-black uppercase tracking-[.16em] text-[#d8bb78]\">Contact</div><a href={'tel:'+phone.replace(/[^+\\d]/g,'')} className=\"mt-2 block hover:text-white\">{phone}</a><a href={'mailto:'+email} className=\"block hover:text-white\">{email}</a></div></div></footer></main>\n}\nfunction ServiceGrid({profile}:{profile:Profile|null}){const services=profile?.grading_services||[];return <div className=\"grid gap-px overflow-hidden border border-white/[0.09] bg-white/[0.09] sm:grid-cols-2 lg:grid-cols-4\">{services.length?services.map(service=><div key={service.id||service.label} className=\"bg-[#0a0a0b] p-6\"><div className=\"text-[10px] font-black uppercase tracking-[.17em] text-white/34\">{service.label||'Grading'}</div><div className=\"mt-2 text-4xl font-black text-[#e4c77f]\">{money(service.price_per_card)}</div><div className=\"mt-1 text-xs text-white/38\">per card{service.days===0?' · same day':service.days?(' · '+service.days+' day'+(service.days===1?'':'s')):''}</div></div>):<div className=\"col-span-full bg-[#0a0a0b] p-6 text-sm text-white/45\">Grading service pricing is being loaded from PCG.</div>}</div>}\n\nfunction Home({profile}:{profile:Profile|null}){const bg=profile?.background_url;return <Frame page=\"home\" profile={profile}><section className=\"relative isolate overflow-hidden border-b border-white/[0.08]\">{bg?<img src={bg} alt=\"\" aria-hidden=\"true\" className=\"absolute inset-0 -z-30 h-full w-full object-cover\"/>:null}<div className=\"absolute inset-0 -z-20 bg-[linear-gradient(90deg,rgba(4,4,5,.98)_0%,rgba(4,4,5,.90)_48%,rgba(4,4,5,.68)_100%)]\"/><div className=\"mx-auto grid min-h-[520px] max-w-7xl items-center gap-10 px-5 py-14 sm:px-6 lg:grid-cols-[minmax(0,1fr)_minmax(420px,.92fr)] lg:px-8\"><div><div className=\"inline-flex items-center gap-2 text-[10px] font-black uppercase tracking-[.22em] text-[#d8bb78]\"><Sparkles className=\"h-4 w-4\"/>Prestigious Card Grading</div><h1 className=\"mt-5 max-w-3xl text-5xl font-black leading-[.9] tracking-[-.055em] sm:text-7xl\">Cards deserve a grade you can trust.</h1><p className=\"mt-6 max-w-xl text-base leading-7 text-white/62 sm:text-lg\">Professional trading-card grading, authentication, premium slabs and fast turnaround with transparent per-card pricing.</p><div className=\"mt-8 flex flex-wrap gap-3\"><Link to={`${BASE}/submit`} className=\"inline-flex items-center gap-2 bg-[#d8bb78] px-6 py-3.5 text-sm font-black text-black\">Start a submission <ArrowRight className=\"h-4 w-4\"/></Link><a href=\"#verify\" className=\"inline-flex items-center gap-2 border border-white/15 bg-black/35 px-6 py-3.5 text-sm font-black\">Search a PCG cert</a></div></div><div className=\"relative mx-auto w-full max-w-[720px] overflow-hidden rounded-[26px] border border-white/12 bg-black/75 shadow-[0_30px_90px_rgba(0,0,0,.58)]\"><div className=\"aspect-video\"><video src={HERO_VIDEO} autoPlay muted loop playsInline preload=\"metadata\" className=\"h-full w-full object-cover motion-reduce:hidden\"/><div className=\"absolute inset-0 ring-1 ring-inset ring-[#d8bb78]/10\"/></div></div></div></section><section className=\"mx-auto max-w-7xl px-5 py-12 sm:px-6 lg:px-8\"><ServiceGrid profile={profile}/><div className=\"mt-12 grid gap-8 lg:grid-cols-3\">{HOME_FEATURES.map(([Icon,title,copy])=><article key={title} className=\"border-t border-white/[0.09] pt-6\"><Icon className=\"h-6 w-6 text-[#d8bb78]\"/><h2 className=\"mt-5 text-xl font-black\">{title}</h2><p className=\"mt-2 text-sm leading-6 text-white/42\">{copy}</p></article>)}</div><CertLookup/><div className=\"mt-12 flex flex-wrap gap-3\">{profile?.progress_url?<a href={profile.progress_url} className=\"bg-white px-5 py-3 text-sm font-black text-black\">Check grading progress</a>:null}{profile?.booking_url?<a href={profile.booking_url} className=\"border border-white/15 px-5 py-3 text-sm font-black\">Start a submission</a>:null}</div></section></Frame>}\nfunction Grading({profile}:{profile:Profile|null}){return <Frame page=\"grading\" profile={profile}><section className=\"mx-auto max-w-7xl px-5 py-16 sm:px-6 lg:px-8\"><div className=\"max-w-3xl\"><div className=\"text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\">PCG grading standards</div><h1 className=\"mt-3 text-5xl font-black tracking-[-.05em] sm:text-6xl\">Clear standards. Real turnaround choices.</h1><p className=\"mt-5 text-base leading-7 text-white/48\">PCG evaluates card condition through a structured grading and quality-control workflow.</p></div><div className=\"mt-10\"><ServiceGrid profile={profile}/></div><div className=\"mt-12 grid gap-10 lg:grid-cols-2\"><section><div className=\"text-[10px] font-black uppercase tracking-[.17em] text-[#d8bb78]\">Common categories</div><div className=\"mt-4 flex flex-wrap gap-2\">{['Sports','Pokémon','One Piece','Lorcana','Disney','Marvel','Magic: The Gathering'].map(item=><span key={item} className=\"border border-white/10 bg-white/[0.035] px-4 py-2 text-xs font-bold text-white/64\">{item}</span>)}</div></section><section className=\"border-l border-white/[0.08] lg:pl-8\"><div className=\"text-[10px] font-black uppercase tracking-[.17em] text-[#d8bb78]\">Grade guide</div><div className=\"mt-4 divide-y divide-white/[0.08]\">{[['10','Exceptional presentation with virtually no visible handling flaws.'],['9','Mint presentation with only minor imperfections on close inspection.'],['8','Near mint-mint condition with light imperfections.'],['7','Near mint condition with more noticeable but limited wear.']].map(([grade,copy])=><div key={grade} className=\"py-5\"><div className=\"text-lg font-black\">PCG {grade}</div><p className=\"mt-1 text-sm leading-6 text-white/42\">{copy}</p></div>)}</div></section></div></section></Frame>}\nfunction CertLookup(){const[cert,setCert]=useState('');const[card,setCard]=useState<Card|null>(null);const[busy,setBusy]=useState(false);const[error,setError]=useState('');async function submit(event:FormEvent){event.preventDefault();if(!cert.trim()||busy)return;setBusy(true);setError('');setCard(null);try{const{data,error:fnError}=await supabase.functions.invoke('pcg-customer-progress',{body:{action:'cert_lookup',tenant_slug:'pcg',cert_number:cert.trim()}});if(fnError||!data?.ok)throw new Error(data?.error||fnError?.message||'Certification lookup failed.');setCard(data.data.card)}catch(e){setError(e instanceof Error?e.message:String(e))}finally{setBusy(false)}}const image=card?.slab_image_url||card?.front_image_url||card?.back_image_url;return <section id=\"verify\" className=\"mt-12 border border-[#d8bb78]/18 bg-[#d8bb78]/[.035] p-5 sm:p-7\"><div className=\"max-w-3xl\"><div className=\"text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\">PCG certification</div><h2 className=\"mt-2 text-3xl font-black tracking-[-.04em] sm:text-4xl\">Search a card by PCG #</h2><p className=\"mt-3 text-sm leading-6 text-white/46\">Enter the certification number printed on the slab. Public lookup returns only the graded card record.</p></div><form onSubmit={submit} className=\"mt-6 grid gap-3 sm:grid-cols-[1fr_auto]\"><input value={cert} onChange={event=>setCert(event.target.value)} placeholder=\"PCG certification number\" className=\"h-14 border border-white/12 bg-black/25 px-4 text-lg font-bold outline-none focus:border-[#d8bb78]/55\"/><button disabled={busy||!cert.trim()} className=\"inline-flex h-14 items-center justify-center gap-2 bg-[#d8bb78] px-6 font-black text-black disabled:opacity-40\"><Search className=\"h-4 w-4\"/>{busy?'Checking…':'Search'}</button></form>{error?<div className=\"mt-4 border border-amber-300/20 bg-amber-300/[.05] p-4 text-sm text-amber-100\">{error}</div>:null}{card?<div className=\"mt-6 grid gap-6 border border-white/[.09] bg-black/25 p-5 md:grid-cols-[minmax(180px,.65fr)_1.35fr]\">{image?<img src={image} alt=\"Verified PCG graded card\" className=\"max-h-[460px] w-full object-contain\"/>:<div className=\"grid min-h-56 place-items-center border border-white/10 text-sm text-white/30\">No public card image</div>}<div><div className=\"text-[10px] font-black uppercase tracking-[.18em] text-emerald-300\">Verified PCG record</div><div className=\"mt-3 text-5xl font-black text-[#d8bb78]\">{card.grade??'—'}</div><div className=\"mt-1 text-xs uppercase tracking-[.15em] text-white/35\">{card.grade_label||'PCG grade'}</div><h3 className=\"mt-6 text-2xl font-black\">{[card.year,card.brand_set,card.player_character].filter(Boolean).join(' · ')||'PCG graded card'}</h3><div className=\"mt-4 space-y-2 text-sm text-white/52\"><div><span className=\"text-white/28\">Cert</span> · {card.cert_number}</div>{card.card_number?<div><span className=\"text-white/28\">Card #</span> · {card.card_number}</div>:null}{card.variation?<div><span className=\"text-white/28\">Variation</span> · {card.variation}</div>:null}</div></div></div>:null}</section>}\nfunction Submit({profile}:{profile:Profile|null}){const booking=profile?.booking_url,payment=profile?.payment_url;return <Frame page=\"submit\" profile={profile}><section className=\"mx-auto max-w-7xl px-5 py-16 sm:px-6 lg:px-8\"><div className=\"grid gap-12 lg:grid-cols-[.9fr_1.1fr]\"><div><div className=\"text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\">Start a submission</div><h1 className=\"mt-3 text-5xl font-black tracking-[-.05em] sm:text-6xl\">Get your cards onto the PCG bench.</h1><p className=\"mt-5 max-w-xl text-base leading-7 text-white/48\">Choose your turnaround, prepare the cards securely, and use PCG's current submission channel for drop-off or mail-in grading.</p><div className=\"mt-8 flex flex-wrap gap-3\">{booking?<a href={booking} className=\"inline-flex items-center gap-2 bg-[#d8bb78] px-6 py-3.5 text-sm font-black text-black\">Start submission <ExternalLink className=\"h-4 w-4\"/></a>:null}{payment?<a href={payment} target=\"_blank\" rel=\"noreferrer\" className=\"inline-flex items-center gap-2 border border-white/15 px-6 py-3.5 text-sm font-black\">Secure checkout <ExternalLink className=\"h-4 w-4\"/></a>:null}</div></div><div className=\"grid gap-px overflow-hidden border border-white/[0.09] bg-white/[0.09] sm:grid-cols-2\">{SUBMIT_STEPS.map(([Icon,title,copy])=><article key={title} className=\"bg-[#0a0a0b] p-6\"><Icon className=\"h-6 w-6 text-[#d8bb78]\"/><h2 className=\"mt-5 text-lg font-black\">{title}</h2><p className=\"mt-2 text-sm leading-6 text-white/42\">{copy}</p></article>)}</div></div><div className=\"mt-12 border border-[#d8bb78]/20 bg-[#d8bb78]/[0.055] p-6\"><div className=\"text-[10px] font-black uppercase tracking-[.17em] text-[#d8bb78]\">Mail / drop-off</div><div className=\"mt-3 text-xl font-black\">Prestigious Card Grading</div><div className=\"mt-2 text-sm text-white/55\">{profile?.address||FALLBACK_ADDRESS}</div></div></section></Frame>}\nfunction Shop({profile}:{profile:Profile|null}){return <Frame page=\"shop\" profile={profile}><section className=\"mx-auto max-w-7xl px-5 py-20 sm:px-6 lg:px-8\"><div className=\"flex items-center gap-2 text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\"><Store className=\"h-4 w-4\"/>Sebastian storefront</div><h1 className=\"mt-4 max-w-3xl text-5xl font-black tracking-[-.05em] sm:text-7xl\">Grading and collecting under one roof.</h1><p className=\"mt-5 max-w-xl text-base leading-7 text-white/55\">Visit the PCG storefront for graded cards, packs and collector inventory alongside the grading operation.</p><Link to={`${BASE}/contact`} className=\"mt-8 inline-flex bg-white px-5 py-3 text-sm font-black text-black\">Visit PCG</Link></section></Frame>}\nfunction Contact({profile}:{profile:Profile|null}){const phone=profile?.phone||'833-472-4752',email=profile?.email||'tony@pcgslab.com';return <Frame page=\"contact\" profile={profile}><section className=\"mx-auto max-w-7xl px-5 py-16 sm:px-6 lg:px-8\"><div className=\"max-w-3xl\"><div className=\"text-[10px] font-black uppercase tracking-[.2em] text-[#d8bb78]\">Contact PCG</div><h1 className=\"mt-3 text-5xl font-black tracking-[-.05em] sm:text-6xl\">Questions, drop-offs, mail-ins — PCG is here.</h1></div><div className=\"mt-10 grid gap-px overflow-hidden border border-white/[0.09] bg-white/[0.09] md:grid-cols-3\">{[[MapPin,'Location',profile?.address||FALLBACK_ADDRESS],[Phone,'Phone',phone],[ShieldCheck,'Customer portal','Track a grading order securely through WhatsMyProgress.']].map(([Icon,title,copy]:any)=><article key={title} className=\"bg-[#0a0a0b] p-6\"><Icon className=\"h-6 w-6 text-[#d8bb78]\"/><h2 className=\"mt-5 text-lg font-black\">{title}</h2><p className=\"mt-2 text-sm leading-6 text-white/48\">{copy}</p></article>)}</div><div className=\"mt-8 flex flex-wrap gap-3\"><a href={'tel:'+phone.replace(/[^+\\d]/g,'')} className=\"bg-[#d8bb78] px-6 py-3.5 text-sm font-black text-black\">Call PCG</a><a href={'mailto:'+email} className=\"border border-white/15 px-6 py-3.5 text-sm font-black\">Email PCG</a>{profile?.progress_url?<a href={profile.progress_url} className=\"border border-white/15 px-6 py-3.5 text-sm font-black\">Check progress</a>:null}</div></section></Frame>}\nexport default function PCGPublicSite({page='home'}:{page?:PCGPublicPage}){const[profile,setProfile]=useState<Profile|null>(null);const[loading,setLoading]=useState(true);useEffect(()=>{let cancelled=false;void supabase.functions.invoke('pcg-customer-progress',{body:{action:'public_profile',tenant_slug:'pcg'}}).then(({data})=>{if(!cancelled&&data?.ok)setProfile(data.data||null)}).finally(()=>{if(!cancelled)setLoading(false)});return()=>{cancelled=true}},[]);const fallback=useMemo<Profile|null>(()=>profile,[profile]);if(loading&&!fallback)return <main className=\"grid min-h-screen place-items-center bg-[#050506] text-white\"><div className=\"text-center\"><img src={FALLBACK_LOGO} alt=\"PCG\" className=\"mx-auto h-16 w-16 animate-pulse object-contain\"/><div className=\"mt-4 text-xs font-black uppercase tracking-[.2em] text-[#d8bb78]\">Loading PCG</div></div></main>;if(page==='grading')return <Grading profile={fallback}/>;if(page==='submit')return <Submit profile={fallback}/>;if(page==='shop')return <Shop profile={fallback}/>;if(page==='contact')return <Contact profile={fallback}/>;return <Home profile={fallback}/>;}","expectedSha":"4bea9147aef555d9587813ed6225d595c256f37e"}],"branch":"ai/objective-first-repair-d6cd243d5f8d","writes":[],"patches":[],"version":1,"approved":true,"missionId":"d6cd243d-5f8d-4268-a43e-590d637909e6","repository":"noel/KnockLaunchOS","commitMessage":"PCG: harden public cert lookup","ownerApproved":true,"releaseIntent":null,"sourceTargets":["supabase/functions/pcg-customer-progress/index.ts","src/pages/card-grading/PCGPublicSite.tsx"],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"d6cd243d-5f8d-4268-a43e-590d637909e6","ownerApproved":true,"releaseIntent":null,"sourceTargets":["supabase/functions/pcg-customer-progress/index.ts","src/pages/card-grading/PCGPublicSite.tsx"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"d7472533bf46fe88db9757614390e8a9d89b767f6e0c92fb8c4b04afe4c0d266","replayCount":0,"serializedBytes":30553},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:50:46.1038+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:d6cd243d-5f8d-4268-a43e-590d637909e6:repository-mutation-intent:d7472533bf46fe88db9757614390e8a9d89b767f6e0c92fb8c4b04afe4c0d266:0","mission_step_id":"8c731e56-2ee2-47af-acbb-524a5c1b9168","command_center_event_id":"d6cd243d-5f8d-4268-a43e-590d637909e6"},{"id":"3336f752-917b-487e-9140-5ac94437638e","source":"forgejo","status":"retryable","payload":{"branch":"ai/objective-first-repair-e3478acfa504","merged":false,"prNumber":4073,"remediationRequired":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:54:52.52093+00:00","proof_gate":"forgejo_closed_pr_is_authoritative_source_lineage","source_sha":null,"external_id":"4073","receipt_type":"source_lineage_pr_closed_without_merge","idempotency_key":"mission:1c94d54f-2a5a-4d6a-a178-a6571e9546cf:closed-pr:4073:unmerged","mission_step_id":"bed050dc-3226-4b4d-b85f-6e503ad70f57","command_center_event_id":"1c94d54f-2a5a-4d6a-a178-a6571e9546cf"},{"id":"e65d0e04-bf3f-43b0-a6b7-aab0ee7a0b6a","source":"forgejo","status":"retryable","payload":{"branch":"ai/objective-first-repair-e3478acfa504","merged":false,"prNumber":4073,"remediationRequired":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:56:22.111705+00:00","proof_gate":"forgejo_closed_pr_is_authoritative_source_lineage","source_sha":null,"external_id":"4073","receipt_type":"source_lineage_pr_closed_without_merge","idempotency_key":"mission:276cfdf9-8116-4ac5-93bc-ac1b2103b2ec:closed-pr:4073:unmerged","mission_step_id":"77766f0c-2f32-4365-93d9-3d82446568aa","command_center_event_id":"276cfdf9-8116-4ac5-93bc-ac1b2103b2ec"},{"id":"ac7d191b-b1f2-406d-9434-08a15da67de1","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-5596752e68e1","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":91678,"releaseCount":0,"toolCallCount":14,"repeatedCallCount":9,"executorlessWaitMs":909507,"firstUsefulResultAt":"2026-09-29T02:24:30.012Z","recoveryAttemptCount":10,"ownerInterruptionCount":0},"version":null,"prNumber":4083,"terminal":false,"missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","timingsMs":{"prReadinessMs":100,"approvedPlanMs":0,"shipAndProveMs":392,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},"performance":null,"deploymentId":"forgejo-main-d65dabe6c765","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":true,"edgeFunctionSlugs":["pcg-customer-progress"]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":2055,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:50:02.573682+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4083","receipt_type":"automatic_mission_resume","idempotency_key":"mission:5596752e-68e1-43eb-b3eb-c883cdd77f75:automatic-mission-resume:4083:canonical_release_reconciliation_pending","mission_step_id":"e7ab4e85-3ea4-4a22-b755-5c4b623117cf","command_center_event_id":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},{"id":"9f4ebd5e-e71c-4ced-bfb5-6c26a01969b7","source":"durable-mission-ledger","status":"verified","payload":{"sourceSha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","requestContractProof":{"legacy":false,"present":true,"outcomes":[{"id":"public-preview","satisfied":true,"statement":"A production public PCG preview exists under /prestigious-card-grading with premium responsive branding, canonical service/contact data, grading information, WMP and submission access.","proofConditionIds":["runtime"]},{"id":"cert-lookup","satisfied":true,"statement":"Public PCG certification lookup returns safe canonical card details by cert number without exposing customer or submission PII.","proofConditionIds":["runtime"]},{"id":"legacy-resolution","satisfied":true,"statement":"The PCG public backend can resolve migrated legacy pcgslab.com source paths to canonical card data for future redirect compatibility.","proofConditionIds":["runtime"]}],"satisfied":true,"constraints":[{"id":"no-dns","satisfied":true,"statement":"Do not modify DNS or route pcgslab.com traffic in this objective.","proofConditionIds":["runtime"]},{"id":"safe-public-data","satisfied":true,"statement":"Public responses include only business/public card data and never customer/submission PII.","proofConditionIds":["runtime"]},{"id":"preserve-wmp","satisfied":true,"statement":"Existing order-number plus email progress lookup remains compatible.","proofConditionIds":["runtime"]},{"id":"scope","satisfied":true,"statement":"Only pcg-customer-progress, PCGPublicSite, and publicRoutes may change.","proofConditionIds":["runtime"]},{"id":"no-witness","satisfied":true,"statement":"Do not run Visual Witness.","proofConditionIds":["runtime"]},{"id":"capability-completeness","satisfied":true,"statement":"Every dependency the implementation declares or relies on must be wired and proven across applicable frontend, backend/runtime, schema/data/storage, authentication/authorization, provider configuration, prerequisite/loading/empty/error states, release ownership, and live production behavior; owner-authorized unavailable dependencies must become explicit prerequisite states rather than runtime failures.","proofConditionIds":["runtime"]},{"id":"atomic-capability-lifecycle","satisfied":true,"statement":"Changed capabilities remain non-active until dependency readiness, N/N-1 compatibility, affected-target release, and claim-matched production canary proof are satisfied; missing optional dependencies become prerequisite_required, and runtime drift or health-contract violation quarantines only the affected capability instead of breaking unrelated working capability.","proofConditionIds":["runtime"]}],"contractHash":"72c874d200d03e86375a85b30f2cf6a859f052f78ccebb95225b4f38c398f72a","releaseBound":true,"witnessBound":false,"visualRequested":false,"visualSatisfied":true,"conditionResults":[{"id":"runtime","kind":"runtime","evidence":{"reason":null,"satisfied":true,"releaseState":"verified","missingTargets":[],"disallowedTargets":[],"migrationRequired":false,"releaseTargetStates":{"frontend":"success","supabaseEdge":"success"},"unsuccessfulTargets":[],"activeReleaseTargets":["frontend","supabaseEdge"],"allowedReleaseTargets":[],"requiredReleaseTargets":[],"migrationReleaseVerified":null,"releaseRequestContractHash":"72c874d200d03e86375a85b30f2cf6a859f052f78ccebb95225b4f38c398f72a"},"required":true,"satisfied":true}],"validationErrors":[],"pendingProofKinds":[],"activeReleaseTargets":["frontend","supabaseEdge"]},"authoritativeMissionRefresh":true,"evaluatedRequestContractRevision":1},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:50:05.21739+00:00","proof_gate":"request_contract_terminal_verified","source_sha":"d65dabe6c7655a2be9635cd1b4826696806e69b9","external_id":null,"receipt_type":"request_contract_reconciliation","idempotency_key":"mission:5596752e-68e1-43eb-b3eb-c883cdd77f75:request-contract:72c874d200d03e86375a85b30f2cf6a859f052f78ccebb95225b4f38c398f72a:d65dabe6c7655a2be9635cd1b4826696806e69b9:verified:","mission_step_id":"3bc825c3-2bfa-4632-8900-cf4474800bba","command_center_event_id":"5596752e-68e1-43eb-b3eb-c883cdd77f75"},{"id":"d72b32e5-7306-4c62-84af-6a13ba8e55ad","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in runtime proof.","nextAction":{"lane":"cc-execution","action":"reconcile_request_contract","reason":"release_verified_contract_pending","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"runtime_proof\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"request_contract_reconciliation\",\"status\":\"pending\",\"proofGate\":\"request_contract_pending\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_request_contract\",\"lane\":\"cc-execution\",\"reason\":\"release_verified_contract_pending\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_request_contract\",\"recoveryOwner\":\"cc-execution\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"runtime\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"visual_proof\",\"deadlineAt\":\"2026-09-29T06:20:56.455215+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-d8028b7a80b7\",\"prNumber\":4082,\"sourceSha\":\"c267479c921da9f1dea8b4b217448a4367523515\",\"deploymentId\":\"forgejo-main-c267479c921d\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:50:11.803385+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:owner-progress-heartbeat:119376680","mission_step_id":"e9d7e549-deb9-4d13-ae51-bb5c174bd32a","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"ac889a13-8d79-4cd2-be0b-220f89e13abb","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-0c9214aed67b","reason":"pull_request_not_open","status":"retryable","metrics":{"receiptBytes":66912,"releaseCount":0,"toolCallCount":25,"repeatedCallCount":13,"executorlessWaitMs":1797945,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":11,"ownerInterruptionCount":0},"version":null,"prNumber":4088,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"automatic_mission_resume","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"prReadinessMs":21183,"approvedPlanMs":0,"shipAndProveMs":0,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":999,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:41:01.096285+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4088","receipt_type":"automatic_mission_resume","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:automatic-mission-resume:4088:repair_mission_pr_ready_retryable","mission_step_id":"d21feb53-bc84-428a-9a20-30622e9e15d6","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"facaa7bc-b8ff-4f55-86e3-ab0a76a132ad","source":"cc-execution","status":"verified","payload":{"ownerWaitSloMs":{"merge_to_live_ms":null,"owner_action_to_pr_ms":null,"green_gate_to_merge_ms":null,"owner_action_to_useful_response_ms":null},"ownerWaitLiveAt":"2026-09-29T03:04:17.670Z"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:29:00.854525+00:00","proof_gate":"owner_wait_live_milestone_recorded","source_sha":null,"external_id":null,"receipt_type":"owner_wait_live_milestone","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:owner-wait-live","mission_step_id":"592fd8b1-5de3-46ed-b7ea-2133bd338522","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"57c521e7-ce64-4bf9-a0bf-1ae89c83f6ed","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in runtime proof.","nextAction":{"lane":"cc-execution","action":"reconcile_request_contract","reason":"release_verified_contract_pending","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"runtime_proof\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"request_contract_reconciliation\",\"status\":\"pending\",\"proofGate\":\"request_contract_pending\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_request_contract\",\"lane\":\"cc-execution\",\"reason\":\"release_verified_contract_pending\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_request_contract\",\"recoveryOwner\":\"cc-execution\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"runtime\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"visual_proof\",\"deadlineAt\":\"2026-09-29T06:20:56.455215+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-d8028b7a80b7\",\"prNumber\":4082,\"sourceSha\":\"c267479c921da9f1dea8b4b217448a4367523515\",\"deploymentId\":\"forgejo-main-c267479c921d\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:52:08.003739+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:owner-progress-heartbeat:119376688","mission_step_id":"e9d7e549-deb9-4d13-ae51-bb5c174bd32a","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"567f06af-4386-4d74-95c0-80da08797dd0","source":"cc-execution","status":"corrective_generation_required","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-0c9214aed67b","reason":"refresh_conflict_requires_corrective_generation","status":"corrective_generation_required","metrics":{"receiptBytes":75891,"releaseCount":0,"toolCallCount":36,"repeatedCallCount":23,"executorlessWaitMs":2690140,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":15,"ownerInterruptionCount":0},"version":null,"prNumber":4088,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"automatic_mission_resume","proofGate":"repair_mission_refresh_conflict_requires_corrective_generation","sourceSha":null,"timingsMs":{"prReadinessMs":32584,"approvedPlanMs":0,"shipAndProveMs":0,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Create exactly one fresh repair generation from current main under the same request contract; preserve this conflicted PR as evidence until the corrective generation proves preservation.","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1860,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:49:34.420694+00:00","proof_gate":"repair_mission_refresh_conflict_requires_corrective_generation","source_sha":null,"external_id":"4088","receipt_type":"automatic_mission_resume","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:automatic-mission-resume:4088:repair_mission_refresh_conflict_requires_corrective_generation","mission_step_id":"d21feb53-bc84-428a-9a20-30622e9e15d6","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"ca9bd376-0f2e-48e1-8fc8-ddda60ad55c9","source":"cc-execution","status":"complete","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-0c9214aed67b","reason":null,"status":"complete","metrics":{"receiptBytes":70181,"releaseCount":0,"toolCallCount":27,"repeatedCallCount":15,"executorlessWaitMs":1913993,"firstUsefulResultAt":"2026-09-29T02:20:23.532Z","recoveryAttemptCount":13,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"0c9214ae-d67b-4116-b34f-105594135791","operation":"execute_mission","proofGate":"repair_mission_prepared","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":5396,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":399,"providerAuthMs":0,"ledgerPrepareMs":281,"ledgerReconcileMs":0,"lineageReconcileMs":118,"resolvePreflightMs":399,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":281,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"continue_batch_or_ship_and_prove","receiptRef":{"mode":"full","missionId":"0c9214ae-d67b-4116-b34f-105594135791"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["visual","runtime","runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3040,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:54:44.263266+00:00","proof_gate":"repair_mission_prepared","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:execute_mission:repair_mission_prepared:generation-1","mission_step_id":"3740dfcc-522f-4099-9fed-68a313ef527c","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"857e023b-1f9f-4e79-894e-8b7b2a76abad","source":"forgejo","status":"retryable","payload":{"branch":"ai/objective-first-repair-0c9214aed67b","merged":false,"prNumber":4088,"remediationRequired":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:49:47.625527+00:00","proof_gate":"forgejo_closed_pr_is_authoritative_source_lineage","source_sha":null,"external_id":"4088","receipt_type":"source_lineage_pr_closed_without_merge","idempotency_key":"mission:0c9214ae-d67b-4116-b34f-105594135791:closed-pr:4088:unmerged","mission_step_id":"d21feb53-bc84-428a-9a20-30622e9e15d6","command_center_event_id":"0c9214ae-d67b-4116-b34f-105594135791"},{"id":"14d609a3-460e-49d2-9d7f-1ad53f4be0d6","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-e3478acfa504","reason":"retryable_provider_transport:pr_ready_timeout_budget_exhausted","status":"retryable","metrics":{"receiptBytes":11882,"releaseCount":0,"toolCallCount":8,"repeatedCallCount":5,"executorlessWaitMs":984897,"firstUsefulResultAt":"2026-09-29T02:55:26.386Z","recoveryAttemptCount":7,"ownerInterruptionCount":0},"version":null,"prNumber":4073,"terminal":false,"missionId":"276cfdf9-8116-4ac5-93bc-ac1b2103b2ec","operation":"automatic_mission_resume","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"prReadinessMs":10561,"approvedPlanMs":0,"shipAndProveMs":0,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"276cfdf9-8116-4ac5-93bc-ac1b2103b2ec"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":828,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:55:40.445404+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4073","receipt_type":"automatic_mission_resume","idempotency_key":"mission:276cfdf9-8116-4ac5-93bc-ac1b2103b2ec:automatic-mission-resume:4073:repair_mission_pr_ready_retryable","mission_step_id":"77766f0c-2f32-4365-93d9-3d82446568aa","command_center_event_id":"276cfdf9-8116-4ac5-93bc-ac1b2103b2ec"},{"id":"83c717d8-46a3-43a6-ac24-15a36ba305aa","source":"cc-execution","status":"retryable","payload":{"ok":false,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-e3478acfa504","reason":"retryable_provider_transport:forgejo_provider_read_timeout","status":"retryable","metrics":{"receiptBytes":5080,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":1,"executorlessWaitMs":21466,"firstUsefulResultAt":"2026-09-29T02:55:26.386Z","recoveryAttemptCount":3,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4073,"terminal":false,"missionId":"276cfdf9-8116-4ac5-93bc-ac1b2103b2ec","operation":"execute_mission","proofGate":"repair_mission_pr_ready_retryable","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":6903,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":6731,"approvedPlanMs":0,"missionSetupMs":471,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":301,"ledgerReconcileMs":0,"lineageReconcileMs":170,"resolvePreflightMs":471,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":301,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"Reconcile this same mission and pull request automatically; do not create a replacement branch or PR.","receiptRef":{"mode":"full","missionId":"276cfdf9-8116-4ac5-93bc-ac1b2103b2ec"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1523,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:55:26.459368+00:00","proof_gate":"repair_mission_pr_ready_retryable","source_sha":null,"external_id":"4073","receipt_type":"execute_mission","idempotency_key":"mission:276cfdf9-8116-4ac5-93bc-ac1b2103b2ec:execute_mission:repair_mission_pr_ready_retryable:current-generation","mission_step_id":"da091bc1-02d9-47fb-b94a-2561a7a9666d","command_center_event_id":"276cfdf9-8116-4ac5-93bc-ac1b2103b2ec"},{"id":"d91eddf0-62e7-41b0-9151-236024f9db58","source":"cc-execution","status":"blocked","payload":{"ok":false,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":"control_plane_maintenance_scope_mismatch","status":"blocked","metrics":{"receiptBytes":11546,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T03:02:03.072Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"fc713e8e-e5e6-4e36-9976-4ab06f59eafb","operation":"execute_mission","proofGate":"repair_mission_execution_blocked","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":0,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":0,"missionSetupMs":281,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":281,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":281,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":281,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"fc713e8e-e5e6-4e36-9976-4ab06f59eafb"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1552,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:02:04.051726+00:00","proof_gate":"repair_mission_execution_blocked","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:fc713e8e-e5e6-4e36-9976-4ab06f59eafb:execute_mission:repair_mission_execution_blocked:current-generation","mission_step_id":"f88655d7-a6f6-4ba3-bcd7-d660d5800b98","command_center_event_id":"fc713e8e-e5e6-4e36-9976-4ab06f59eafb"},{"id":"58af23e0-4030-4658-a15e-c83b3beef33b","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"pr_body":"<!-- knocklaunch:auto-progress -->\n\nFresh delivery from the preserved decruft branch after terminal-mission parking. Includes the forward supervisor regression fix; no decruft work is replayed.","version":1,"approved":true,"pr_title":"Finish Forgejo authority decruft and resumed-PR lifecycle safety","missionId":"b0fe7e5b-c119-40a1-985b-4cb738209f95","objective":"Fresh delivery from the preserved repository-authority decruft branch after PR #4073 was terminal-mission parked. Explicitly recover this unique orphan branch, preserve its decruft work, refresh it against current protected main, add only the supervisor fix that lets a newer resumed mission supersede an older terminal mission for the same PR, add one regression test, and advance cc-execution to 1.63.2-resumed-pr-delivery-safe. Open one fresh PR from this preserved branch, arm it with knocklaunch:auto-progress, run canonical Gate, squash merge, release affected production owners, and verify live. Do not create another branch or replay the decruft work.","sourceSha":"770292ffa2a1898873d0290e04024eb9bb40d948","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/entrypoint-owner-status.js","workers/cc-execution/test/release-orchestration-invariants.test.js","workers/cc-execution/src/version.js"],"workstreamKey":"repo-decruft-fresh-delivery-resume-safe-1632-orphan-recovery","anchored_edits":[{"path":"workers/cc-execution/src/entrypoint-owner-status.js","edits":[{"new_content":"  return {\n    park: true,\n    reason: \"terminal_mission_pr_should_park\",\n    missionId: String(mission?.missionId || mission?.id || \"\").trim() || null,\n    missionStatus: missionStatus || \"terminal\",\n    prNumber,\n    branch,\n  };\n}\n\nexport function terminalMissionByLatestPrMission(missionItems = []) {\n  const latestMissionByPr = new Map();\n  for (const mission of Array.isArray(missionItems) ? missionItems : []) {\n    const prNumber = Number(mission?.prNumber || 0) || null;\n    if (!prNumber || latestMissionByPr.has(prNumber)) continue;\n    latestMissionByPr.set(prNumber, mission);\n  }\n  const terminalMissionByPr = new Map();\n  for (const [prNumber, mission] of latestMissionByPr.entries()) {\n    const status = String(mission?.status || \"\").trim().toLowerCase();\n    const terminal = mission?.terminal === true || TERMINAL_MISSION_QUEUE_STATES.has(status);\n    if (terminal) terminalMissionByPr.set(prNumber, mission);\n  }\n  return terminalMissionByPr;\n}\n\nfunction forgejoContentPath(path) {","old_content":"  return {\n    park: true,\n    reason: \"terminal_mission_pr_should_park\",\n    missionId: String(mission?.missionId || mission?.id || \"\").trim() || null,\n    missionStatus: missionStatus || \"terminal\",\n    prNumber,\n    branch,\n  };\n}\n\nfunction forgejoContentPath(path) {"},{"new_content":"  const missionItems = missionIndex?.ok && Array.isArray(missionIndex.data?.items) ? missionIndex.data.items : [];\n  const terminalMissionByPr = terminalMissionByLatestPrMission(missionItems);","old_content":"  const missionItems = missionIndex?.ok && Array.isArray(missionIndex.data?.items) ? missionIndex.data.items : [];\n  const terminalMissionByPr = new Map();\n  for (const mission of missionItems) {\n    const prNumber = Number(mission?.prNumber || 0) || null;\n    const status = String(mission?.status || \"\").trim().toLowerCase();\n    const terminal = mission?.terminal === true || TERMINAL_MISSION_QUEUE_STATES.has(status);\n    if (prNumber && terminal && !terminalMissionByPr.has(prNumber)) terminalMissionByPr.set(prNumber, mission);\n  }"}]},{"path":"workers/cc-execution/test/release-orchestration-invariants.test.js","edits":[{"new_content":"import { deterministicGateHeadDecision, terminalMissionByLatestPrMission, zombieGateRecoveryDecision } from \"../src/entrypoint-owner-status.js\";","old_content":"import { deterministicGateHeadDecision, zombieGateRecoveryDecision } from \"../src/entrypoint-owner-status.js\";"},{"new_content":"test(\"deterministic Gate quarantine is bound to the exact PR head\", () => {\n  const first = deterministicGateHeadDecision({ prNumber: 4040, headSha: SOURCE_SHA, failureClass: \"code_validation\" });\n  const changed = deterministicGateHeadDecision({ prNumber: 4040, headSha: COMMIT_SHA, failureClass: \"code_validation\" });\n  assert.equal(first.quarantine, true);\n  assert.equal(first.sourceChangeRequired, true);\n  assert.notEqual(first.quarantineKey, changed.quarantineKey);\n  assert.equal(deterministicGateHeadDecision({ prNumber: 4040, headSha: SOURCE_SHA, failureClass: \"infrastructure_transient\" }).quarantine, false);\n});\n\ntest(\"newer resumed mission supersedes older terminal mission for the same PR\", () => {\n  const terminal = terminalMissionByLatestPrMission([\n    { missionId: \"resumed\", prNumber: 4073, status: \"running\", terminal: false },\n    { missionId: \"cancelled\", prNumber: 4073, status: \"cancelled\", terminal: true },\n    { missionId: \"terminal-only\", prNumber: 4040, status: \"blocked\", terminal: true },\n  ]);\n  assert.equal(terminal.has(4073), false);\n  assert.equal(terminal.get(4040)?.missionId, \"terminal-only\");\n});\n\ntest(\"blocked PR backlog stays separate from runnable Gate work\", () => {","old_content":"test(\"deterministic Gate quarantine is bound to the exact PR head\", () => {\n  const first = deterministicGateHeadDecision({ prNumber: 4040, headSha: SOURCE_SHA, failureClass: \"code_validation\" });\n  const changed = deterministicGateHeadDecision({ prNumber: 4040, headSha: COMMIT_SHA, failureClass: \"code_validation\" });\n  assert.equal(first.quarantine, true);\n  assert.equal(first.sourceChangeRequired, true);\n  assert.notEqual(first.quarantineKey, changed.quarantineKey);\n  assert.equal(deterministicGateHeadDecision({ prNumber: 4040, headSha: SOURCE_SHA, failureClass: \"infrastructure_transient\" }).quarantine, false);\n});\n\ntest(\"blocked PR backlog stays separate from runnable Gate work\", () => {"}]},{"path":"workers/cc-execution/src/version.js","edits":[{"new_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\nexport const CC_EXECUTION_VERSION = \"1.63.2-resumed-pr-delivery-safe\";","old_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\nexport const CC_EXECUTION_VERSION = \"1.63.1-forgejo-authority-decruft\";"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"The preserved decruft branch is recovered into one fresh PR, and older terminal missions no longer poison a newer resumed delivery for the same PR.","proofConditionIds":["proof-live"]}],"objective":"Fresh delivery from the preserved repository-authority decruft branch after PR #4073 was terminal-mission parked. Explicitly recover this unique orphan branch, preserve its decruft work, refresh it against current protected main, add only the supervisor fix that lets a newer resumed mission supersede an older terminal mission for the same PR, add one regression test, and advance cc-execution to 1.63.2-resumed-pr-delivery-safe. Open one fresh PR from this preserved branch, arm it with knocklaunch:auto-progress, run canonical Gate, squash merge, release affected production owners, and verify live. Do not create another branch or replay the decruft work.","constraints":[{"id":"same-branch","statement":"Recover preserved branch ai/objective-first-repair-e3478acfa504; do not create another branch.","proofConditionIds":["proof-live"]},{"id":"unique-orphan","statement":"Preserve the unique decruft work already on the orphan branch while refreshing against current main.","proofConditionIds":["proof-live"]},{"id":"small-forward-fix","statement":"Add only resumed-mission queue safety, its regression test, and the version bump beyond the already-proven decruft source.","proofConditionIds":["proof-live"]},{"id":"armed","statement":"Fresh PR must include knocklaunch:auto-progress so canonical merge/release supervision owns progression.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"Fresh PR passes Gate, squash merges, affected production targets release successfully, cc-execution reports 1.63.2-resumed-pr-delivery-safe, and the resumed-PR supervisor regression is active.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/entrypoint-owner-status.js","workers/cc-execution/test/release-orchestration-invariants.test.js","workers/cc-execution/src/version.js"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"The preserved decruft branch is recovered into one fresh PR, and older terminal missions no longer poison a newer resumed delivery for the same PR.","proofConditionIds":["proof-live"]}],"objective":"Fresh delivery from the preserved repository-authority decruft branch after PR #4073 was terminal-mission parked. Explicitly recover this unique orphan branch, preserve its decruft work, refresh it against current protected main, add only the supervisor fix that lets a newer resumed mission supersede an older terminal mission for the same PR, add one regression test, and advance cc-execution to 1.63.2-resumed-pr-delivery-safe. Open one fresh PR from this preserved branch, arm it with knocklaunch:auto-progress, run canonical Gate, squash merge, release affected production owners, and verify live. Do not create another branch or replay the decruft work.","constraints":[{"id":"same-branch","statement":"Recover preserved branch ai/objective-first-repair-e3478acfa504; do not create another branch.","proofConditionIds":["proof-live"]},{"id":"unique-orphan","statement":"Preserve the unique decruft work already on the orphan branch while refreshing against current main.","proofConditionIds":["proof-live"]},{"id":"small-forward-fix","statement":"Add only resumed-mission queue safety, its regression test, and the version bump beyond the already-proven decruft source.","proofConditionIds":["proof-live"]},{"id":"armed","statement":"Fresh PR must include knocklaunch:auto-progress so canonical merge/release supervision owns progression.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"Fresh PR passes Gate, squash merges, affected production targets release successfully, cc-execution reports 1.63.2-resumed-pr-delivery-safe, and the resumed-PR supervisor regression is active.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/entrypoint-owner-status.js","workers/cc-execution/src/version.js"],"controlPlaneMaintenanceReason":"Owner-authorized unique-orphan branch recovery for preserved decruft work plus resumed-PR queue safety fix."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/entrypoint-owner-status.js","workers/cc-execution/src/version.js"],"recover_orphan_unique_branch":true,"controlPlaneMaintenanceReason":"Owner-authorized unique-orphan branch recovery for preserved decruft work plus resumed-PR queue safety fix."},"recovery":false,"fingerprint":"cfffbd4df0d3ecc8a868f90fafa5007fd4ce96f42369e7d40c164011feadd0dd","replayCount":0,"serializedBytes":12044},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:04:12.37875+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:b0fe7e5b-c119-40a1-985b-4cb738209f95:repository-mutation-intent:cfffbd4df0d3ecc8a868f90fafa5007fd4ce96f42369e7d40c164011feadd0dd:0","mission_step_id":"be186043-ccd5-4e23-933b-50fd3355f3ee","command_center_event_id":"b0fe7e5b-c119-40a1-985b-4cb738209f95"},{"id":"1f466428-16c1-498b-810d-38251ebf4b70","source":"cc-execution","status":"blocked","payload":{"reason":"control_plane_maintenance_scope_mismatch","fingerprint":"cfffbd4df0d3ecc8a868f90fafa5007fd4ce96f42369e7d40c164011feadd0dd"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:04:13.352291+00:00","proof_gate":"repository_mutation_intent_deterministic_failure","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent_blocked","idempotency_key":"mission:b0fe7e5b-c119-40a1-985b-4cb738209f95:repository-mutation-intent-blocked:cfffbd4df0d3ecc8a868f90fafa5007fd4ce96f42369e7d40c164011feadd0dd","mission_step_id":"be186043-ccd5-4e23-933b-50fd3355f3ee","command_center_event_id":"b0fe7e5b-c119-40a1-985b-4cb738209f95"},{"id":"2188587a-cadc-48bb-bac5-ccdd0d8d545f","source":"cc-execution","status":"authorized","payload":{"paths":["workers/cc-execution/src/entrypoint-owner-status.js","workers/cc-execution/src/version.js","workers/cc-execution/test/release-orchestration-invariants.test.js"],"reason":"Owner-authorized unique-orphan branch recovery for preserved decruft work plus resumed-PR queue safety fix.","baseSha":"770292ffa2a1898873d0290e04024eb9bb40d948","issuedAt":1790651103112,"expiresAt":1790651283112,"missionId":"6ababd0f-0d54-40d7-8503-b39b4c94807b","authorizationId":"6eb625c3-a2ee-4994-b958-16cab78569d6","retryableWithinExactScope":true},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:05:03.428018+00:00","proof_gate":"control_plane_maintenance_scope_authorized","source_sha":"770292ffa2a1898873d0290e04024eb9bb40d948","external_id":null,"receipt_type":"control_plane_maintenance_authorization","idempotency_key":"control-plane-maintenance-authorize:6eb625c3-a2ee-4994-b958-16cab78569d6","mission_step_id":"372a49fc-c2cb-434d-bce9-5be32fa5111a","command_center_event_id":"6ababd0f-0d54-40d7-8503-b39b4c94807b"},{"id":"88834764-3a57-45db-9c6d-7e13a9aee491","source":"cc-execution","status":"blocked","payload":{"ok":false,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":"control_plane_maintenance_scope_mismatch","status":"blocked","metrics":{"receiptBytes":12191,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T03:04:12.353Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"b0fe7e5b-c119-40a1-985b-4cb738209f95","operation":"execute_mission","proofGate":"repair_mission_execution_blocked","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":0,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":0,"missionSetupMs":267,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":267,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":267,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":267,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"b0fe7e5b-c119-40a1-985b-4cb738209f95"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1553,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:04:13.294008+00:00","proof_gate":"repair_mission_execution_blocked","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:b0fe7e5b-c119-40a1-985b-4cb738209f95:execute_mission:repair_mission_execution_blocked:current-generation","mission_step_id":"be186043-ccd5-4e23-933b-50fd3355f3ee","command_center_event_id":"b0fe7e5b-c119-40a1-985b-4cb738209f95"},{"id":"647d44e8-1c0e-44ac-ae55-fd800a9acf45","source":"cc-execution","status":"waiting","payload":{"kind":"heartbeat","message":"Still active in runtime proof.","nextAction":{"lane":"cc-execution","action":"reconcile_request_contract","reason":"release_verified_contract_pending","automationAllowed":true,"ownerActionRequired":false},"silenceBudgetMs":15000,"semanticCheckpointSignature":"{\"stateMachineVersion\":1,\"phase\":\"runtime_proof\",\"ownerFacingState\":null,\"latest\":{\"kind\":\"receipt\",\"key\":\"request_contract_reconciliation\",\"status\":\"pending\",\"proofGate\":\"request_contract_pending\"},\"activeStep\":{\"key\":\"pull_request\",\"status\":\"waiting\",\"lane\":\"cc-execution\"},\"nextStep\":{\"key\":\"release\",\"status\":\"waiting\",\"lane\":\"production-release-conductor\"},\"nextSafeAction\":{\"action\":\"reconcile_request_contract\",\"lane\":\"cc-execution\",\"reason\":\"release_verified_contract_pending\",\"automationAllowed\":true,\"ownerActionRequired\":false},\"executionOwnership\":{\"active\":false,\"state\":\"waiting\",\"executor\":null,\"lane\":\"cc-execution\",\"nextAction\":\"reconcile_request_contract\",\"recoveryOwner\":\"cc-execution\"},\"acceptance\":{\"total\":1,\"verified\":0,\"pending\":1,\"percent\":0,\"satisfied\":false,\"verifiedIds\":[],\"pendingIds\":[\"runtime\"]},\"stall\":{\"stalled\":false,\"reason\":\"within_deadline\",\"step\":\"visual_proof\",\"deadlineAt\":\"2026-09-29T06:20:56.455215+00:00\",\"recoveryAction\":null},\"blocker\":null,\"terminal\":false,\"branch\":\"ai/objective-first-repair-d8028b7a80b7\",\"prNumber\":4082,\"sourceSha\":\"c267479c921da9f1dea8b4b217448a4367523515\",\"deploymentId\":\"forgejo-main-c267479c921d\"}"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:04:17.059826+00:00","proof_gate":"owner_progress_heartbeat","source_sha":null,"external_id":null,"receipt_type":"owner_progress_heartbeat","idempotency_key":"mission:d8028b7a-80b7-44a7-bd61-1f210843326b:owner-progress-heartbeat:119376737","mission_step_id":"e9d7e549-deb9-4d13-ae51-bb5c174bd32a","command_center_event_id":"d8028b7a-80b7-44a7-bd61-1f210843326b"},{"id":"8709ee54-a1a4-46bd-a0f7-e7920f18ab0c","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[],"branch":"ai/objective-first-repair-e3478acfa504","writes":[],"patches":[],"pr_body":"<!-- knocklaunch:auto-progress -->\n\nFresh delivery from the preserved decruft branch after terminal-mission parking. Includes the forward supervisor regression fix; no decruft work is replayed.","version":1,"approved":true,"pr_title":"Finish Forgejo authority decruft and resumed-PR lifecycle safety","missionId":"6ababd0f-0d54-40d7-8503-b39b4c94807b","objective":"Fresh delivery from the preserved repository-authority decruft branch after PR #4073 was terminal-mission parked. Explicitly recover this unique orphan branch, preserve its decruft work, refresh it against current protected main, add only the supervisor fix that lets a newer resumed mission supersede an older terminal mission for the same PR, add one regression test, and advance cc-execution to 1.63.2-resumed-pr-delivery-safe. Open one fresh PR from this preserved branch, arm it with knocklaunch:auto-progress, run canonical Gate, squash merge, release affected production owners, and verify live. Do not create another branch or replay the decruft work.","sourceSha":"770292ffa2a1898873d0290e04024eb9bb40d948","repository":"noel/KnockLaunchOS","ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/entrypoint-owner-status.js","workers/cc-execution/test/release-orchestration-invariants.test.js","workers/cc-execution/src/version.js"],"workstreamKey":"repo-decruft-fresh-delivery-resume-safe-1632-orphan-scope-fixed","anchored_edits":[{"path":"workers/cc-execution/src/entrypoint-owner-status.js","edits":[{"new_content":"  return {\n    park: true,\n    reason: \"terminal_mission_pr_should_park\",\n    missionId: String(mission?.missionId || mission?.id || \"\").trim() || null,\n    missionStatus: missionStatus || \"terminal\",\n    prNumber,\n    branch,\n  };\n}\n\nexport function terminalMissionByLatestPrMission(missionItems = []) {\n  const latestMissionByPr = new Map();\n  for (const mission of Array.isArray(missionItems) ? missionItems : []) {\n    const prNumber = Number(mission?.prNumber || 0) || null;\n    if (!prNumber || latestMissionByPr.has(prNumber)) continue;\n    latestMissionByPr.set(prNumber, mission);\n  }\n  const terminalMissionByPr = new Map();\n  for (const [prNumber, mission] of latestMissionByPr.entries()) {\n    const status = String(mission?.status || \"\").trim().toLowerCase();\n    const terminal = mission?.terminal === true || TERMINAL_MISSION_QUEUE_STATES.has(status);\n    if (terminal) terminalMissionByPr.set(prNumber, mission);\n  }\n  return terminalMissionByPr;\n}\n\nfunction forgejoContentPath(path) {","old_content":"  return {\n    park: true,\n    reason: \"terminal_mission_pr_should_park\",\n    missionId: String(mission?.missionId || mission?.id || \"\").trim() || null,\n    missionStatus: missionStatus || \"terminal\",\n    prNumber,\n    branch,\n  };\n}\n\nfunction forgejoContentPath(path) {"},{"new_content":"  const missionItems = missionIndex?.ok && Array.isArray(missionIndex.data?.items) ? missionIndex.data.items : [];\n  const terminalMissionByPr = terminalMissionByLatestPrMission(missionItems);","old_content":"  const missionItems = missionIndex?.ok && Array.isArray(missionIndex.data?.items) ? missionIndex.data.items : [];\n  const terminalMissionByPr = new Map();\n  for (const mission of missionItems) {\n    const prNumber = Number(mission?.prNumber || 0) || null;\n    const status = String(mission?.status || \"\").trim().toLowerCase();\n    const terminal = mission?.terminal === true || TERMINAL_MISSION_QUEUE_STATES.has(status);\n    if (prNumber && terminal && !terminalMissionByPr.has(prNumber)) terminalMissionByPr.set(prNumber, mission);\n  }"}]},{"path":"workers/cc-execution/test/release-orchestration-invariants.test.js","edits":[{"new_content":"import { deterministicGateHeadDecision, terminalMissionByLatestPrMission, zombieGateRecoveryDecision } from \"../src/entrypoint-owner-status.js\";","old_content":"import { deterministicGateHeadDecision, zombieGateRecoveryDecision } from \"../src/entrypoint-owner-status.js\";"},{"new_content":"test(\"deterministic Gate quarantine is bound to the exact PR head\", () => {\n  const first = deterministicGateHeadDecision({ prNumber: 4040, headSha: SOURCE_SHA, failureClass: \"code_validation\" });\n  const changed = deterministicGateHeadDecision({ prNumber: 4040, headSha: COMMIT_SHA, failureClass: \"code_validation\" });\n  assert.equal(first.quarantine, true);\n  assert.equal(first.sourceChangeRequired, true);\n  assert.notEqual(first.quarantineKey, changed.quarantineKey);\n  assert.equal(deterministicGateHeadDecision({ prNumber: 4040, headSha: SOURCE_SHA, failureClass: \"infrastructure_transient\" }).quarantine, false);\n});\n\ntest(\"newer resumed mission supersedes older terminal mission for the same PR\", () => {\n  const terminal = terminalMissionByLatestPrMission([\n    { missionId: \"resumed\", prNumber: 4073, status: \"running\", terminal: false },\n    { missionId: \"cancelled\", prNumber: 4073, status: \"cancelled\", terminal: true },\n    { missionId: \"terminal-only\", prNumber: 4040, status: \"blocked\", terminal: true },\n  ]);\n  assert.equal(terminal.has(4073), false);\n  assert.equal(terminal.get(4040)?.missionId, \"terminal-only\");\n});\n\ntest(\"blocked PR backlog stays separate from runnable Gate work\", () => {","old_content":"test(\"deterministic Gate quarantine is bound to the exact PR head\", () => {\n  const first = deterministicGateHeadDecision({ prNumber: 4040, headSha: SOURCE_SHA, failureClass: \"code_validation\" });\n  const changed = deterministicGateHeadDecision({ prNumber: 4040, headSha: COMMIT_SHA, failureClass: \"code_validation\" });\n  assert.equal(first.quarantine, true);\n  assert.equal(first.sourceChangeRequired, true);\n  assert.notEqual(first.quarantineKey, changed.quarantineKey);\n  assert.equal(deterministicGateHeadDecision({ prNumber: 4040, headSha: SOURCE_SHA, failureClass: \"infrastructure_transient\" }).quarantine, false);\n});\n\ntest(\"blocked PR backlog stays separate from runnable Gate work\", () => {"}]},{"path":"workers/cc-execution/src/version.js","edits":[{"new_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\nexport const CC_EXECUTION_VERSION = \"1.63.2-resumed-pr-delivery-safe\";","old_content":"// Release marker: Forgejo is the canonical repository and self-hosted Actions control plane.\nexport const CC_EXECUTION_VERSION = \"1.63.1-forgejo-authority-decruft\";"}]}],"implementation":{"files":[],"writes":[]},"updateStrategy":"push_to_branch","requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"The preserved decruft branch is recovered into one fresh PR, and older terminal missions no longer poison a newer resumed delivery for the same PR.","proofConditionIds":["proof-live"]}],"objective":"Fresh delivery from the preserved repository-authority decruft branch after PR #4073 was terminal-mission parked. Explicitly recover this unique orphan branch, preserve its decruft work, refresh it against current protected main, add only the supervisor fix that lets a newer resumed mission supersede an older terminal mission for the same PR, add one regression test, and advance cc-execution to 1.63.2-resumed-pr-delivery-safe. Open one fresh PR from this preserved branch, arm it with knocklaunch:auto-progress, run canonical Gate, squash merge, release affected production owners, and verify live. Do not create another branch or replay the decruft work.","constraints":[{"id":"same-branch","statement":"Recover preserved branch ai/objective-first-repair-e3478acfa504; do not create another branch.","proofConditionIds":["proof-live"]},{"id":"unique-orphan","statement":"Preserve the unique decruft work already on the orphan branch while refreshing against current main.","proofConditionIds":["proof-live"]},{"id":"small-forward-fix","statement":"Add only resumed-mission queue safety, its regression test, and the version bump beyond the already-proven decruft source.","proofConditionIds":["proof-live"]},{"id":"armed","statement":"Fresh PR must include knocklaunch:auto-progress so canonical merge/release supervision owns progression.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"Fresh PR passes Gate, squash merges, affected production targets release successfully, cc-execution reports 1.63.2-resumed-pr-delivery-safe, and the resumed-PR supervisor regression is active.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":null,"ownerApproved":true,"releaseIntent":null,"sourceTargets":["workers/cc-execution/src/entrypoint-owner-status.js","workers/cc-execution/test/release-orchestration-invariants.test.js","workers/cc-execution/src/version.js"],"requestContract":{"source":"explicit","version":1,"outcomes":[{"id":"outcome-1","statement":"The preserved decruft branch is recovered into one fresh PR, and older terminal missions no longer poison a newer resumed delivery for the same PR.","proofConditionIds":["proof-live"]}],"objective":"Fresh delivery from the preserved repository-authority decruft branch after PR #4073 was terminal-mission parked. Explicitly recover this unique orphan branch, preserve its decruft work, refresh it against current protected main, add only the supervisor fix that lets a newer resumed mission supersede an older terminal mission for the same PR, add one regression test, and advance cc-execution to 1.63.2-resumed-pr-delivery-safe. Open one fresh PR from this preserved branch, arm it with knocklaunch:auto-progress, run canonical Gate, squash merge, release affected production owners, and verify live. Do not create another branch or replay the decruft work.","constraints":[{"id":"same-branch","statement":"Recover preserved branch ai/objective-first-repair-e3478acfa504; do not create another branch.","proofConditionIds":["proof-live"]},{"id":"unique-orphan","statement":"Preserve the unique decruft work already on the orphan branch while refreshing against current main.","proofConditionIds":["proof-live"]},{"id":"small-forward-fix","statement":"Add only resumed-mission queue safety, its regression test, and the version bump beyond the already-proven decruft source.","proofConditionIds":["proof-live"]},{"id":"armed","statement":"Fresh PR must include knocklaunch:auto-progress so canonical merge/release supervision owns progression.","proofConditionIds":["proof-live"]}],"terminalPolicy":"all_required_proof_conditions_satisfied_after_live_release","proofConditions":[{"id":"proof-live","kind":"runtime","claim":"Fresh PR passes Gate, squash merges, affected production targets release successfully, cc-execution reports 1.63.2-resumed-pr-delivery-safe, and the resumed-PR supervisor regression is active.","route":null,"required":true,"expectedText":null,"targetedActions":[],"allowedReleaseTargets":[],"requiredReleaseTargets":[]}]},"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/entrypoint-owner-status.js","workers/cc-execution/test/release-orchestration-invariants.test.js","workers/cc-execution/src/version.js"],"controlPlaneMaintenanceReason":"Owner-authorized unique-orphan branch recovery for preserved decruft work plus resumed-PR queue safety fix."},"proofRequirements":null,"controlPlaneUnfreeze":true,"durableMutationResume":true,"controlPlaneMaintenance":true,"controlPlaneMaintenancePaths":["workers/cc-execution/src/entrypoint-owner-status.js","workers/cc-execution/test/release-orchestration-invariants.test.js","workers/cc-execution/src/version.js"],"recover_orphan_unique_branch":true,"controlPlaneMaintenanceReason":"Owner-authorized unique-orphan branch recovery for preserved decruft work plus resumed-PR queue safety fix."},"recovery":false,"fingerprint":"cc620c92f9241e958f1a7d72b402fe7d06d7bcbcb1fea0c009f88f0f600fc629","replayCount":0,"serializedBytes":12185},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:05:02.342057+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:6ababd0f-0d54-40d7-8503-b39b4c94807b:repository-mutation-intent:cc620c92f9241e958f1a7d72b402fe7d06d7bcbcb1fea0c009f88f0f600fc629:0","mission_step_id":"2f18feae-aee7-4f55-bd9a-7cc72e035cc4","command_center_event_id":"6ababd0f-0d54-40d7-8503-b39b4c94807b"},{"id":"4d0a1bc5-5892-4cb5-9de3-235ec186baab","source":"cc-execution","status":"blocked","payload":{"reason":"orphaned_branch_recovery_scope_mismatch:ai/objective-first-repair-e3478acfa504","fingerprint":"cc620c92f9241e958f1a7d72b402fe7d06d7bcbcb1fea0c009f88f0f600fc629"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:05:05.910808+00:00","proof_gate":"repository_mutation_intent_deterministic_failure","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent_blocked","idempotency_key":"mission:6ababd0f-0d54-40d7-8503-b39b4c94807b:repository-mutation-intent-blocked:cc620c92f9241e958f1a7d72b402fe7d06d7bcbcb1fea0c009f88f0f600fc629","mission_step_id":"2f18feae-aee7-4f55-bd9a-7cc72e035cc4","command_center_event_id":"6ababd0f-0d54-40d7-8503-b39b4c94807b"},{"id":"68af91a4-2db7-487b-ad6b-134946eeaebf","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-d87a4d10ade7","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":1859,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T02:52:26.720Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"d87a4d10-ade7-4268-a0f3-290a0559f97c","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1146,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":419,"providerAuthMs":0,"ledgerPrepareMs":419,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":419,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":419,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"d87a4d10-ade7-4268-a0f3-290a0559f97c"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3409,"likelyAffectedFiles":["src/pages/card-grading/PCGLegacyMigrationCenter.tsx"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:52:26.742194+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:d87a4d10-ade7-4268-a0f3-290a0559f97c:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"a493de82-6165-4241-821d-34b36a0ae1b1","command_center_event_id":"d87a4d10-ade7-4268-a0f3-290a0559f97c"},{"id":"28bf36a6-eae6-4561-886f-a9a11366b099","source":"cc-execution","status":"waiting","payload":{"body":{"ship":true,"files":[{"path":"src/pages/card-grading/PCGLegacyMigrationCenter.tsx","content":"import {useEffect,useMemo,useState} from 'react';\nimport {AlertTriangle,CheckCircle2,Database,RefreshCw,ShieldCheck,UploadCloud} from 'lucide-react';\nimport {useMultiTenant} from '@/contexts/MultiTenantContext';\nimport {supabase} from '@/integrations/supabase/client';\nimport {toast} from '@/lib/notify';\n\ntype Batch={id:string;source_type:string;source_label:string|null;source_url:string|null;status:string;dry_run:boolean;total_rows:number;valid_rows:number;duplicate_rows:number;imported_rows:number;review_rows:number;error_rows:number;source_fingerprint:string|null;summary?:Record<string,unknown>|null;created_at:string;updated_at:string};\ntype ImportRow={id:string;row_number:number;external_key:string|null;source_url:string|null;validation_status:string;planned_action:string;canonical_card_id:string|null;error_text:string|null;normalized_payload:Record<string,unknown>|null};\nconst panel='border border-white/[0.08] bg-[#09090a]/88';\nconst input='w-full border border-white/[0.10] bg-black/45 px-3.5 py-3 text-sm text-white outline-none placeholder:text-white/28 focus:border-[#d8bb78]/55';\nconst pretty=(value:string)=>value.replaceAll('_',' ').replace(/\\b\\w/g,char=>char.toUpperCase());\n\nfunction parseCsv(text:string){\n  const rows:string[][]=[];let row:string[]=[],field='',quoted=false;const value=text.replace(/^\\uFEFF/,'');\n  for(let i=0;i<value.length;i++){const char=value[i];if(quoted){if(char==='\"'&&value[i+1]==='\"'){field+='\"';i++;continue}if(char==='\"'){quoted=false;continue}field+=char;continue}if(char==='\"'){quoted=true;continue}if(char===','){row.push(field);field='';continue}if(char==='\\n'||char==='\\r'){if(char==='\\r'&&value[i+1]==='\\n')i++;row.push(field);field='';if(row.some(cell=>cell.trim()!==''))rows.push(row);row=[];continue}field+=char}\n  row.push(field);if(row.some(cell=>cell.trim()!==''))rows.push(row);if(rows.length<2)throw new Error('The CSV needs a header row and at least one card row.');\n  const headers=rows[0].map((header,index)=>header.trim()||('Column '+(index+1)));return rows.slice(1).map(cells=>Object.fromEntries(headers.map((header,index)=>[header,cells[index]??''])));\n}\nasync function parseImportFile(file:File){const ext=file.name.split('.').pop()?.toLowerCase()||'';if(ext==='csv')return parseCsv(await file.text());if(ext==='xlsx'||ext==='xls'){const XLSX=await import('xlsx');const workbook=XLSX.read(await file.arrayBuffer(),{type:'array'});const sheetName=workbook.SheetNames[0];if(!sheetName)throw new Error('The workbook does not contain a worksheet.');const rows=XLSX.utils.sheet_to_json<Record<string,unknown>>(workbook.Sheets[sheetName],{defval:'',raw:false});if(!rows.length)throw new Error('The first worksheet needs a header row and at least one card row.');return rows}throw new Error('Choose a CSV, XLSX, or XLS file.')}\nasync function fingerprint(file:File){const digest=new Uint8Array(await crypto.subtle.digest('SHA-256',new Uint8Array(await file.arrayBuffer())));return Array.from(digest).map(value=>value.toString(16).padStart(2,'0')).join('')}\nfunction metric(label:string,value:number,sub:string){return <div className=\"bg-black/35 p-3\"><div className=\"text-[9px] font-black uppercase tracking-[.15em] text-white/30\">{label}</div><div className=\"mt-1 text-2xl font-black\">{value.toLocaleString()}</div><div className=\"mt-1 text-[10px] text-white/25\">{sub}</div></div>}\n\nexport default function PCGLegacyMigrationCenter(){\n  const{activeTenant}=useMultiTenant();const tenantId=activeTenant?.id||'';const[batches,setBatches]=useState<Batch[]>([]);const[selectedId,setSelectedId]=useState('');const[preview,setPreview]=useState<ImportRow[]>([]);const[busy,setBusy]=useState(false);const[progress,setProgress]=useState('');const[confirmText,setConfirmText]=useState('');const[driveReady,setDriveReady]=useState(false);const selected=useMemo(()=>batches.find(batch=>batch.id===selectedId)||null,[batches,selectedId]);\n  async function invoke(action:string,extra:Record<string,unknown>={}){if(!tenantId)throw new Error('PCG tenant is not ready.');const{data,error}=await supabase.functions.invoke('pcg-legacy-import',{body:{action,tenant_id:tenantId,...extra}});if(error)throw new Error(error.message||'PCG migration request failed.');if(!data?.ok)throw new Error(data?.error||'PCG migration request failed.');return data}\n  async function load(){if(!tenantId)return;const[{data,error},{data:google}]=await Promise.all([(supabase as any).from('pcg_import_batches').select('*').eq('tenant_id',tenantId).order('created_at',{ascending:false}).limit(30),(supabase as any).from('tenant_provider_credentials').select('credential_status,metadata').eq('tenant_id',tenantId).eq('provider','google_workspace').maybeSingle()]);if(error){toast.error(error.message);return}const next=(data||[]) as Batch[];setBatches(next);setSelectedId(current=>next.some(batch=>batch.id===current)?current:(next[0]?.id||''));const scopes=Array.isArray((google as any)?.metadata?.granted_scopes)?(google as any).metadata.granted_scopes.map((value:unknown)=>String(value)):[];setDriveReady((google as any)?.credential_status==='active'&&scopes.includes('https://www.googleapis.com/auth/drive.file'))}\n  async function loadPreview(batchId:string){if(!batchId){setPreview([]);return}try{const data=await invoke('batch_status',{batch_id:batchId,start_row:1,limit:25});setPreview((data.rows||[]) as ImportRow[]);if(data.batch)setBatches(current=>current.map(batch=>batch.id===data.batch.id?data.batch:batch))}catch(error){setPreview([]);if(error instanceof Error)toast.error(error.message)}}\n  useEffect(()=>{void load()},[tenantId]);useEffect(()=>{if(selectedId)void loadPreview(selectedId)},[selectedId]);\n  async function upload(file:File){if(!tenantId)return;setBusy(true);setProgress('Reading migration file…');try{const rows=await parseImportFile(file);if(rows.length>100000)throw new Error('This import exceeds the 100,000-row safety ceiling. Split it into multiple files.');setProgress('Fingerprinting '+rows.length.toLocaleString()+' source rows…');const sourceFingerprint=await fingerprint(file);const created=await invoke('create_batch',{source_type:'csv',source_label:file.name,source_fingerprint:sourceFingerprint});const batch=created.batch as Batch;setSelectedId(batch.id);if(created.deduped&&batch.status!=='draft'&&batch.total_rows>0){setProgress('This exact file was already staged. Opening the existing reconciliation batch.');await load();await loadPreview(batch.id);return}for(let offset=0;offset<rows.length;offset+=250){const chunk=rows.slice(offset,offset+250);setProgress('Staging '+Math.min(offset+chunk.length,rows.length).toLocaleString()+' / '+rows.length.toLocaleString()+' rows…');await invoke('stage_rows',{batch_id:batch.id,start_row:offset+1,rows:chunk})}let next=1,done=false,guard=0;while(!done&&guard++<Math.ceil(rows.length/500)+5){setProgress('Analyzing rows from '+next.toLocaleString()+'…');const result=await invoke('analyze_batch',{batch_id:batch.id,start_row:next,limit:500});done=Boolean(result.done);next=Number(result.next_row||next+500)}if(!done)throw new Error('Analysis paused before completion. Re-open this batch to continue safely.');setProgress('Dry run complete. Nothing canonical was changed.');await load();await loadPreview(batch.id);toast.success('PCG migration dry run complete.')}catch(error){toast.error(error instanceof Error?error.message:String(error));setProgress('')}finally{setBusy(false)}}\n  async function migrateImages(){\n    if(!selected||!driveReady||busy||!selected.imported_rows)return;setBusy(true);setProgress('Copying legacy master images into Anthony\\'s Google Drive…');\n    try{let next=1,done=false,guard=0,totalImages=0,totalFailed=0;while(!done&&guard++<Math.ceil(Math.max(selected.total_rows,1)/10)+10){const result=await invoke('migrate_images',{batch_id:selected.id,start_row:next,limit:10});done=Boolean(result.done);next=Number(result.next_row||next+10);totalImages+=Number(result.migrated_images||0);totalFailed+=Number(result.failed_images||0);if(result.batch)setBatches(current=>current.map(batch=>batch.id===result.batch.id?result.batch:batch));setProgress('Drive migration: '+totalImages.toLocaleString()+' images copied'+(totalFailed?' · '+totalFailed.toLocaleString()+' need review':'')+'…')}if(!done)throw new Error('Image migration paused at the safety iteration limit. Run it again to resume without duplicates.');setProgress(totalFailed?'Drive migration completed with '+totalFailed.toLocaleString()+' image issue(s) to review.':'Legacy master images are now owned by Anthony\\'s Google Drive.');await load();await loadPreview(selected.id);if(totalFailed)toast.error('Image migration finished with '+totalFailed+' issue(s). Squarespace stays in place until they are resolved.');else toast.success('PCG legacy image migration complete.')}catch(error){toast.error(error instanceof Error?error.message:String(error))}finally{setBusy(false)}\n  }\n  async function commit(){if(!selected||confirmText!=='IMPORT'||busy)return;setBusy(true);setProgress('Starting controlled import…');try{let done=false,guard=0;while(!done&&guard++<1100){const result=await invoke('commit_batch',{batch_id:selected.id,confirm:'IMPORT',limit:100});done=Boolean(result.done);const batch=result.batch as Batch;setBatches(current=>current.map(item=>item.id===batch.id?batch:item));setProgress('Imported '+Number(batch.imported_rows||0).toLocaleString()+' / '+Number(batch.valid_rows||0).toLocaleString()+' validated rows…')}if(!done)throw new Error('Import paused at the safety iteration limit. It can be resumed without duplicating cards.');setConfirmText('');setProgress('Migration committed and reconciled.');await load();await loadPreview(selected.id);toast.success('PCG legacy migration complete.')}catch(error){toast.error(error instanceof Error?error.message:String(error))}finally{setBusy(false)}}\n  return <section className=\"space-y-6\">\n    <div className=\"border-b border-white/[0.08] pb-5\"><div className=\"text-[10px] font-black uppercase tracking-[.20em] text-[#d0ae61]\">Legacy migration</div><h1 className=\"mt-2 text-4xl font-black sm:text-5xl\">Migration Center</h1><p className=\"mt-3 max-w-3xl text-sm leading-6 text-white/42\">Stage Anthony's existing PCG database, prove the mapping and duplicates, then commit only approved rows. Upload and analysis are dry-run operations.</p></div>\n    <div className=\"grid gap-4 xl:grid-cols-[1.15fr_.85fr]\">\n      <label className={panel+' '+(busy?'cursor-not-allowed opacity-60':'cursor-pointer')+' p-6'}><input type=\"file\" accept=\".csv,.xlsx,.xls\" className=\"hidden\" disabled={busy} onChange={event=>{const file=event.target.files?.[0];if(file)void upload(file);event.currentTarget.value=''}}/><div className=\"flex items-start gap-4\"><div className=\"grid h-12 w-12 shrink-0 place-items-center border border-[#d8bb78]/20 bg-[#d8bb78]/[.06]\"><UploadCloud className=\"h-5 w-5 text-[#d8bb78]\"/></div><div><div className=\"text-lg font-black\">Upload legacy spreadsheet</div><p className=\"mt-1 text-sm leading-6 text-white/40\">CSV, XLSX and XLS are supported. Excel uses the first worksheet. The original file is fingerprinted, staged in chunks, normalized and deduplicated before any canonical PCG card is created.</p><div className=\"mt-4 inline-flex border border-white/10 px-3 py-2 text-xs font-black text-white/60\">{busy?'Migration working…':'Choose CSV / Excel file'}</div></div></div></label>\n      <div className={panel+' p-6'}><div className=\"flex items-center gap-3\"><ShieldCheck className={'h-5 w-5 '+(driveReady?'text-emerald-300':'text-amber-200')}/><div><div className=\"font-black\">Image migration</div><div className={'mt-1 text-xs font-bold '+(driveReady?'text-emerald-300':'text-amber-200')}>{driveReady?'Google Drive ready':'Google Workspace connection required'}</div></div></div><p className=\"mt-4 text-sm leading-6 text-white/38\">Legacy image URLs stay preserved as provenance. After card data is committed, copy the master images directly into Anthony\\'s Google Drive. Squarespace remains the fallback until every image is verified.</p>{selected&&selected.imported_rows>0?<button disabled={busy||!driveReady||!(selected.status==='completed'||selected.status==='completed_with_errors')} onClick={()=>void migrateImages()} className=\"mt-4 w-full border border-[#d8bb78]/30 bg-[#d8bb78]/[.08] px-4 py-3 text-xs font-black text-[#ead49d] disabled:cursor-not-allowed disabled:opacity-35\">{!driveReady?'Connect Google Workspace first':((selected.summary as any)?.legacy_image_migration?.complete?'Re-verify / resume Drive image migration':'Copy imported masters to Google Drive')}</button>:null}<p className=\"mt-3 text-[11px] leading-5 text-white/25\">Only approved PCG/Squarespace HTTPS image hosts are accepted. No master image is copied into KNOCKLAUNCH storage.</p></div>\n    </div>\n    {progress?<div className=\"flex items-center gap-3 border border-[#d8bb78]/20 bg-[#d8bb78]/[.05] px-4 py-3 text-sm text-[#ead49d]\"><RefreshCw className={'h-4 w-4 '+(busy?'animate-spin':'')}/>{progress}</div>:null}\n    <div className=\"grid gap-6 xl:grid-cols-[340px_1fr]\">\n      <aside className={panel}><div className=\"border-b border-white/[0.08] p-4\"><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/30\">Migration history</div></div><div className=\"max-h-[520px] overflow-auto\">{batches.length?batches.map(batch=><button key={batch.id} onClick={()=>setSelectedId(batch.id)} className={'w-full border-b border-white/[0.07] p-4 text-left '+(selectedId===batch.id?'bg-white/[.06]':'hover:bg-white/[.025]')}><div className=\"truncate text-sm font-black\">{batch.source_label||pretty(batch.source_type)}</div><div className=\"mt-1 text-[10px] font-bold uppercase tracking-[.12em] text-[#d8bb78]\">{pretty(batch.status)}</div><div className=\"mt-2 text-xs text-white/32\">{Number(batch.total_rows||0).toLocaleString()} rows · {new Date(batch.created_at).toLocaleString()}</div></button>):<div className=\"p-5 text-sm text-white/35\">No migration batches yet.</div>}</div></aside>\n      <div className=\"space-y-5\">{selected?<>\n        <div className={panel+' p-5'}><div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\"><div><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-[#d0ae61]\">Selected batch</div><h2 className=\"mt-1 text-xl font-black\">{selected.source_label||pretty(selected.source_type)}</h2><div className=\"mt-1 text-xs text-white/30\">Fingerprint {(selected.source_fingerprint||'not-supplied').slice(0,16)}… · {pretty(selected.status)}</div></div><button disabled={busy} onClick={()=>void loadPreview(selected.id)} className=\"inline-flex items-center justify-center gap-2 border border-white/10 px-3 py-2 text-xs font-black text-white/55\"><RefreshCw className=\"h-3.5 w-3.5\"/>Refresh</button></div><div className=\"mt-5 grid grid-cols-2 gap-px overflow-hidden border border-white/[.07] bg-white/[.07] sm:grid-cols-3 xl:grid-cols-6\">{metric('Source',selected.total_rows,'staged rows')}{metric('Valid',selected.valid_rows,'safe to create')}{metric('Duplicates',selected.duplicate_rows,'will skip')}{metric('Review',selected.review_rows,'needs mapping')}{metric('Errors',selected.error_rows,'cannot import')}{metric('Imported',selected.imported_rows,'canonical cards')}</div></div>\n        {preview.length?<div className={panel}><div className=\"border-b border-white/[.07] p-4\"><div className=\"text-[10px] font-black uppercase tracking-[.16em] text-white/30\">Normalized preview · first 25 rows</div></div><div className=\"overflow-x-auto\"><table className=\"w-full min-w-[900px] text-left text-xs\"><thead className=\"text-[9px] uppercase tracking-[.13em] text-white/28\"><tr><th className=\"p-3\">Row</th><th className=\"p-3\">Cert</th><th className=\"p-3\">Card</th><th className=\"p-3\">Grade</th><th className=\"p-3\">Decision</th><th className=\"p-3\">Issue</th></tr></thead><tbody>{preview.map(row=>{const n=row.normalized_payload||{};const card=[n.year,n.brand_set,n.player_character].filter(Boolean).map(String).join(' · ')||'Needs identity';return <tr key={row.id} className=\"border-t border-white/[.06]\"><td className=\"p-3 font-black text-white/45\">{row.row_number}</td><td className=\"p-3 font-bold\">{String(n.cert_number||'—')}</td><td className=\"p-3\"><div className=\"font-bold\">{card}</div><div className=\"mt-1 text-white/30\">{n.card_number?('#'+String(n.card_number)):''}</div></td><td className=\"p-3\">{n.grade==null?'—':String(n.grade)}</td><td className=\"p-3\"><span className={'font-black '+(row.validation_status==='valid'?'text-emerald-300':row.validation_status==='duplicate'?'text-blue-300':'text-amber-200')}>{pretty(row.planned_action)}</span></td><td className=\"max-w-xs p-3 text-white/35\">{row.error_text||'—'}</td></tr>})}</tbody></table></div></div>:null}\n        <div className={panel+' p-5'}><div className=\"flex items-start gap-3\">{selected.review_rows||selected.error_rows?<AlertTriangle className=\"mt-0.5 h-5 w-5 shrink-0 text-amber-300\"/>:<CheckCircle2 className=\"mt-0.5 h-5 w-5 shrink-0 text-emerald-300\"/>}<div><div className=\"font-black\">{selected.review_rows||selected.error_rows?'Review exceptions before committing':'Dry run reconciled'}</div><p className=\"mt-1 text-sm leading-6 text-white/40\">Duplicates are skipped automatically. Rows marked Review or Error are never silently forced into the canonical card database.</p></div></div><div className=\"mt-5 grid gap-3 sm:grid-cols-[1fr_auto]\"><input value={confirmText} onChange={event=>setConfirmText(event.target.value)} placeholder=\"Type IMPORT to enable canonical writes\" className={input}/><button disabled={busy||confirmText!=='IMPORT'||selected.status==='completed'} onClick={()=>void commit()} className=\"bg-[#d8bb78] px-5 py-3 text-sm font-black text-black disabled:cursor-not-allowed disabled:opacity-35\">{busy?'Working…':selected.status==='completed'?'Imported':'Commit approved rows'}</button></div><p className=\"mt-2 text-xs text-white/25\">Commit re-checks cert numbers and import keys immediately before every canonical write. Existing PCG data is never deleted.</p></div>\n      </>:<div className={panel+' grid min-h-[360px] place-items-center p-8 text-center'}><div><Database className=\"mx-auto h-8 w-8 text-white/20\"/><div className=\"mt-4 text-lg font-black\">No migration selected</div><p className=\"mt-2 max-w-md text-sm leading-6 text-white/35\">Upload Anthony's legacy card export to create the first dry-run batch.</p></div></div>}</div>\n    </div>\n  </section>\n}","expectedSha":"43a0350b4f84b0b866d2c3245291bf4c35ea8745"}],"branch":"ai/objective-first-repair-d87a4d10ade7","writes":[],"patches":[],"version":1,"approved":true,"missionId":"d87a4d10-ade7-4268-a0f3-290a0559f97c","repository":"noel/KnockLaunchOS","commitMessage":"PCG: accept Excel legacy exports","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/card-grading/PCGLegacyMigrationCenter.tsx"],"implementation":{"files":[],"writes":[]},"requestContract":null,"repairGeneration":null,"executionEnvelope":{"ship":true,"version":1,"approved":true,"missionId":"d87a4d10-ade7-4268-a0f3-290a0559f97c","ownerApproved":true,"releaseIntent":null,"sourceTargets":["src/pages/card-grading/PCGLegacyMigrationCenter.tsx"],"requestContract":null,"repairGeneration":null,"proofRequirements":null,"controlPlaneUnfreeze":false,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"proofRequirements":null,"controlPlaneUnfreeze":false,"durableMutationResume":true,"controlPlaneMaintenance":false,"controlPlaneMaintenancePaths":[],"controlPlaneMaintenanceReason":null},"recovery":false,"fingerprint":"fa8314cc5ab3466ac2d4f2c3b180c8857e1da700e87dbc79c7239add66ef8ea8","replayCount":0,"serializedBytes":19851},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:05:20.222784+00:00","proof_gate":"repository_mutation_intent_persisted","source_sha":null,"external_id":null,"receipt_type":"repository_mutation_intent","idempotency_key":"mission:d87a4d10-ade7-4268-a0f3-290a0559f97c:repository-mutation-intent:fa8314cc5ab3466ac2d4f2c3b180c8857e1da700e87dbc79c7239add66ef8ea8:0","mission_step_id":"2df6c13a-3c61-4b1e-b79f-b60968d7901b","command_center_event_id":"d87a4d10-ade7-4268-a0f3-290a0559f97c"},{"id":"d4e27db3-c22d-48fb-b77c-41c9225a9ce9","source":"cc-execution","status":"blocked","payload":{"ok":false,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-e3478acfa504","reason":"orphaned_branch_recovery_scope_mismatch:ai/objective-first-repair-e3478acfa504","status":"blocked","metrics":{"receiptBytes":12332,"releaseCount":0,"toolCallCount":1,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":"2026-09-29T03:05:02.296Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"6ababd0f-0d54-40d7-8503-b39b4c94807b","operation":"execute_mission","proofGate":"repair_mission_execution_blocked","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":2619,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":2619,"missionSetupMs":355,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":355,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":355,"repositoryMutationMs":0,"repositoryProviderMs":0,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":355,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":0},"nextAction":null,"receiptRef":{"mode":"full","missionId":"6ababd0f-0d54-40d7-8503-b39b4c94807b"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1540,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:05:06.002369+00:00","proof_gate":"repair_mission_execution_blocked","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:6ababd0f-0d54-40d7-8503-b39b4c94807b:execute_mission:repair_mission_execution_blocked:current-generation","mission_step_id":"2f18feae-aee7-4f55-bd9a-7cc72e035cc4","command_center_event_id":"6ababd0f-0d54-40d7-8503-b39b4c94807b"},{"id":"850e5921-d122-49a1-b560-35f8dbbc0d44","source":"cc-execution","status":"synthesis_required","payload":{"ok":true,"jobId":null,"phase":"objective_received","branch":"ai/objective-first-repair-eea0b97d6278","reason":null,"status":"synthesis_required","metrics":{"receiptBytes":0,"releaseCount":0,"toolCallCount":0,"repeatedCallCount":0,"executorlessWaitMs":0,"firstUsefulResultAt":null,"recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":null,"terminal":false,"missionId":"eea0b97d-6278-4545-881c-8011de578424","operation":"execute_mission","proofGate":"repair_mission_synthesis_ready","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":1219,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"missionSetupMs":465,"providerAuthMs":0,"ledgerPrepareMs":465,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":465,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"totalSynchronousLedgerMs":465,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0},"nextAction":"Inspect the bounded repository paths, synthesize exact files or anchored_edits, and call /mission/execute again automatically with this same missionId without another owner prompt or workflow switch.","receiptRef":{"mode":"full","missionId":"eea0b97d-6278-4545-881c-8011de578424"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":4743,"likelyAffectedFiles":["src/pages/card-grading/PCGOnboardingReadiness.tsx","src/pages/crm/PcgWorkspace.tsx"],"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:07:25.755469+00:00","proof_gate":"repair_mission_synthesis_ready","source_sha":null,"external_id":null,"receipt_type":"execute_mission","idempotency_key":"mission:eea0b97d-6278-4545-881c-8011de578424:execute_mission:repair_mission_synthesis_ready:current-generation","mission_step_id":"aef7c36b-23da-4586-aded-17ab92a7fa60","command_center_event_id":"eea0b97d-6278-4545-881c-8011de578424"},{"id":"74af5dc5-4d25-4e0e-b985-04b89f9f45ad","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-d6cd243d5f8d","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":70490,"releaseCount":0,"toolCallCount":25,"repeatedCallCount":21,"executorlessWaitMs":1484561,"firstUsefulResultAt":"2026-09-29T02:48:33.777Z","recoveryAttemptCount":20,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4089,"terminal":false,"missionId":"d6cd243d-5f8d-4268-a43e-590d637909e6","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":2830,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":888,"missionSetupMs":388,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":286,"ledgerReconcileMs":0,"lineageReconcileMs":102,"resolvePreflightMs":388,"repositoryMutationMs":1942,"repositoryProviderMs":1942,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":1778,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":286,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":164},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"d6cd243d-5f8d-4268-a43e-590d637909e6"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3328,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T02:50:51.312205+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4089","receipt_type":"execute_mission","idempotency_key":"mission:d6cd243d-5f8d-4268-a43e-590d637909e6:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"8c731e56-2ee2-47af-acbb-524a5c1b9168","command_center_event_id":"d6cd243d-5f8d-4268-a43e-590d637909e6"},{"id":"444eaf3d-b0d7-4e5a-bd76-991294ef791d","source":"cc-execution","status":"waiting_for_gate","payload":{"ok":true,"jobId":null,"phase":"implementation","branch":"ai/objective-first-repair-d87a4d10ade7","reason":"provider_verified_auto_progress_owns_gate_merge_release_outside_owner_response","status":"waiting_for_gate","metrics":{"receiptBytes":23746,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":1,"executorlessWaitMs":773480,"firstUsefulResultAt":"2026-09-29T02:52:26.720Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":"1.63.0-mission-freedom-web-research","prNumber":4091,"terminal":false,"missionId":"d87a4d10-ade7-4268-a0f3-290a0559f97c","operation":"execute_mission","proofGate":"repair_mission_pr_handed_off_to_supervisor","sourceSha":null,"timingsMs":{"gateMs":0,"proofMs":0,"handlerMs":3797,"releaseMs":0,"mutationMs":0,"repositoryMs":0,"prReadinessMs":0,"approvedPlanMs":470,"missionSetupMs":285,"providerAuthMs":0,"shipAndProveMs":0,"ledgerPrepareMs":285,"ledgerReconcileMs":0,"lineageReconcileMs":0,"resolvePreflightMs":285,"repositoryMutationMs":3327,"repositoryProviderMs":3327,"authoritativeLedgerMs":0,"ledgerAsyncDispatchMs":0,"repositoryAtomicCommitMs":1972,"repositoryBranchCreateMs":0,"totalSynchronousLedgerMs":285,"asyncBookkeepingDispatchMs":0,"ledgerAuthoritativeCommitMs":0,"repositoryPullRequestCreateMs":1355},"nextAction":"Canonical KnockLaunch Gate notifier and durable mission supervisor own Gate, merge, release, and proof progression from this exact PR head outside the owner response path.","receiptRef":{"mode":"full","missionId":"d87a4d10-ade7-4268-a0f3-290a0559f97c"},"performance":null,"deploymentId":null,"releaseState":null,"workflowRunId":null,"releaseTargets":null,"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":["runtime"],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":3759,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:05:24.945196+00:00","proof_gate":"repair_mission_pr_handed_off_to_supervisor","source_sha":null,"external_id":"4091","receipt_type":"execute_mission","idempotency_key":"mission:d87a4d10-ade7-4268-a0f3-290a0559f97c:execute_mission:repair_mission_pr_handed_off_to_supervisor:current-generation","mission_step_id":"2df6c13a-3c61-4b1e-b79f-b60968d7901b","command_center_event_id":"d87a4d10-ade7-4268-a0f3-290a0559f97c"},{"id":"079640ba-2bfb-40a8-833a-5c45cbcfa711","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-d87a4d10ade7","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":25833,"releaseCount":0,"toolCallCount":4,"repeatedCallCount":1,"executorlessWaitMs":778196,"firstUsefulResultAt":"2026-09-29T02:52:26.720Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":null,"prNumber":4091,"terminal":false,"missionId":"d87a4d10-ade7-4268-a0f3-290a0559f97c","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"2487281a716d73b698ac967504fe8800500b609d","timingsMs":{"prReadinessMs":631,"approvedPlanMs":0,"shipAndProveMs":2755,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"d87a4d10-ade7-4268-a0f3-290a0559f97c"},"performance":null,"deploymentId":"forgejo-main-2487281a716d","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1826,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:06:41.130156+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4091","receipt_type":"automatic_mission_resume","idempotency_key":"mission:d87a4d10-ade7-4268-a0f3-290a0559f97c:automatic-mission-resume:4091:canonical_release_reconciliation_pending","mission_step_id":"4704f030-bd75-441c-a057-44f631c0c805","command_center_event_id":"d87a4d10-ade7-4268-a0f3-290a0559f97c"},{"id":"83efcb9f-37f8-4612-94b9-529dd5433100","source":"forgejo","status":"waiting","payload":{"branch":"ai/objective-first-repair-d87a4d10ade7","prNumber":4091,"nextAction":"Follow the existing canonical release to terminal proof.","mergeCommitSha":"2487281a716d73b698ac967504fe8800500b609d","branchDeletedAfterMerge":true,"correctiveGenerationCreated":false},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:07:05.684374+00:00","proof_gate":"forgejo_merged_pr_is_authoritative_source_lineage","source_sha":"2487281a716d73b698ac967504fe8800500b609d","external_id":"4091","receipt_type":"source_lineage_merged_pr_authoritative","idempotency_key":"mission:d87a4d10-ade7-4268-a0f3-290a0559f97c:merged-pr:4091:2487281a716d73b698ac967504fe8800500b609d","mission_step_id":"c448aaaf-cc3b-426e-b610-fe82251ef5b7","command_center_event_id":"d87a4d10-ade7-4268-a0f3-290a0559f97c"},{"id":"13553bfc-b089-4667-93a6-8a3704da083a","source":"cc-execution","status":"release_reconciliation_pending","payload":{"ok":true,"jobId":null,"phase":"pull_request","branch":"ai/objective-first-repair-eea0b97d6278","reason":null,"status":"release_reconciliation_pending","metrics":{"receiptBytes":64494,"releaseCount":0,"toolCallCount":3,"repeatedCallCount":0,"executorlessWaitMs":68905,"firstUsefulResultAt":"2026-09-29T03:07:25.711Z","recoveryAttemptCount":0,"ownerInterruptionCount":0},"version":null,"prNumber":4092,"terminal":false,"missionId":"eea0b97d-6278-4545-881c-8011de578424","operation":"automatic_mission_resume","proofGate":"canonical_release_reconciliation_pending","sourceSha":"0eff641fb3b2ab7ba8a55b650bd7154d744ff19c","timingsMs":{"prReadinessMs":861,"approvedPlanMs":0,"shipAndProveMs":2985,"repositoryMutationMs":0,"repositoryProviderMs":0,"repositoryAtomicCommitMs":0,"repositoryBranchCreateMs":0,"repositoryPullRequestCreateMs":0},"nextAction":"reconcile_release","receiptRef":{"mode":"full","missionId":"eea0b97d-6278-4545-881c-8011de578424"},"performance":null,"deploymentId":"forgejo-main-0eff641fb3b2","releaseState":null,"workflowRunId":null,"releaseTargets":{"frontend":true,"onrunner":false,"migrations":false,"ccExecution":false,"supabaseEdge":false,"edgeFunctionSlugs":[]},"detailsAvailable":true,"ownerFacingState":"IN_PROGRESS","pendingProofKinds":[],"verificationState":null,"workflowInvariant":{"oneBranch":true,"oneMission":true,"oneRelease":true,"invariantScope":"repair_generation","onePullRequest":true,"terminalProofRequired":true,"correctiveGenerationsAllowed":true},"sourceReceiptBytes":1858,"ownerActionRequired":false,"ownerFacingTerminal":false,"continuationRequired":true,"requestContractState":"pending"},"tenant_id":"a3ffa31f-0c88-4fdd-b872-051db013ca3e","created_at":"2026-09-29T03:08:47.094281+00:00","proof_gate":"canonical_release_reconciliation_pending","source_sha":null,"external_id":"4092","receipt_type":"automatic_mission_resume","idempotency_key":"mission:eea0b97d-6278-4545-881c-8011de578424:automatic-mission-resume:4092:canonical_release_reconciliation_pending","mission_step_id":"7a9202a0-ed35-4c79-b2cd-778e776028f9","command_center_event_id":"eea0b97d-6278-4545-881c-8011de578424"}],"rows":200,"limit":200,"table":"command_center_receipts","format":"knocklaunch-table-chunk-v1","offset":29800,"schema":"public"}