export declare const RECEIZ_SEALED_OUTPUT_URI = "ui://receiz/sealed-output-v12.html";
export declare const RECEIZ_SEALED_OUTPUT_RESOURCE: Readonly<{
    uri: "ui://receiz/sealed-output-v12.html";
    name: "Receiz sealed proof delivery";
    description: "Component-only exact sealed artifact download after canonical device verification.";
    mimeType: "text/html;profile=mcp-app";
}>;
export declare const RECEIZ_SEALED_CHUNK_SIZE: number;
export declare function registerReceizSealedOutput(runtime: object, reference: string, sha256: string): string;
/** Device-custodied exact bytes. The reference is a locator, never authority. */
export declare function readReceizSealedOutputChunk(input: unknown, workspace: string, runtime: object): Promise<{
    public: {
        offset: number;
        nextOffset: number;
        byteLength: number;
        artifactSha256: string;
        filename: string;
        mimeType: string;
        mcpAuthority: boolean;
    };
    private: {
        bytesBase64: string;
    };
}>;
export declare const RECEIZ_SEALED_OUTPUT_HTML = "<!doctype html><html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><style>\n*{box-sizing:border-box}body{font:14px/1.45 system-ui,-apple-system,\"Segoe UI\",sans-serif;margin:0;padding:8px;background:transparent;color:#152238}\n.proof{position:relative;overflow:hidden;width:100%;max-width:600px;border:1px solid #e6e1d5;border-radius:20px;background:linear-gradient(150deg,#fff 0%,#fff 58%,#faf8f2 100%);box-shadow:0 16px 40px rgba(16,30,50,.09),0 1px 3px rgba(16,30,50,.04)}\n.proof:before{content:\"\";display:block;height:3px;background:linear-gradient(90deg,#a98546,#e8d9ac 38%,#f8f2df 74%,#a98546)}\n.inner{padding:21px 23px 19px}.head{display:flex;gap:13px;align-items:center}.mark{display:grid;place-items:center;width:42px;height:42px;flex:none;border:1px solid #e3dac7;border-radius:12px;background:#fff;box-shadow:0 3px 9px rgba(22,34,53,.06);color:#152238;font:700 25px/1 Georgia,serif}\n.eyebrow{margin:0 0 3px;color:#8f7141;font-size:10px;font-weight:750;letter-spacing:.16em;text-transform:uppercase}.title{margin:0;color:#152238;font:600 21px/1.1 Georgia,\"Times New Roman\",serif;letter-spacing:-.025em}.rule{height:1px;margin:18px 0;background:linear-gradient(90deg,#ded8c9,#eeeae1 80%,transparent)}\n.state{display:flex;align-items:flex-start;gap:10px;min-height:41px}.dot{width:8px;height:8px;flex:none;margin-top:6px;border-radius:50%;background:#af8a4d;box-shadow:0 0 0 4px #f8f0df}.state p{margin:0;color:#344355;font-size:13px}button{display:inline-flex;justify-content:center;align-items:center;width:100%;min-height:42px;margin:17px 0 0;padding:10px 15px;border:1px solid #132239;border-radius:10px;background:#14243b;color:#fff;font:650 13px/1.2 system-ui,-apple-system,\"Segoe UI\",sans-serif;letter-spacing:.015em;cursor:pointer;box-shadow:0 6px 14px rgba(20,36,59,.16)}button:hover:not(:disabled){background:#263e5c}button:focus-visible,a:focus-visible{outline:2px solid #a98546;outline-offset:3px}button:disabled{opacity:.58;cursor:default;box-shadow:none}\n.facts{display:grid;grid-template-columns:1fr auto;gap:7px 12px;margin-top:19px;padding:13px 14px;border:1px solid #eee8dc;border-radius:11px;background:#fcfbf8}.label{color:#7c766b;font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}.value{color:#26374c;font-size:11px;font-weight:650;text-align:right}.hash{grid-column:1/-1;color:#3b4b5d;font:10px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;overflow-wrap:anywhere}.foot{display:flex;align-items:flex-start;gap:7px;margin:14px 0 0;color:#6e7780;font-size:11px;line-height:1.45}.foot:before{content:\"\u25C6\";color:#ad8a50;font-size:9px;margin-top:2px}#link{margin:0}#link a{display:inline-block;margin-top:12px;color:#173b66;font-weight:650;text-decoration:underline;text-underline-offset:3px}\n@media(max-width:440px){.inner{padding:17px}.title{font-size:19px}.facts{grid-template-columns:1fr auto}}\n</style></head><body><article class=\"proof\" aria-label=\"Receiz sealed proof object\"><div class=\"inner\"><header class=\"head\"><div class=\"mark\" aria-hidden=\"true\">R</div><div><p class=\"eyebrow\">Receiz \u00B7 private custody</p><h2 class=\"title\">Sealed proof object</h2></div></header><div class=\"rule\"></div><div class=\"state\"><span class=\"dot\" aria-hidden=\"true\"></span><p id=\"status\" aria-live=\"polite\">Waiting for the proof result from your device.</p></div><div class=\"facts\"><span class=\"label\">Integrity</span><span class=\"value\">Canonical proof</span><span class=\"label\">Sealed bytes</span><span class=\"value\" id=\"size\">\u2014</span><span class=\"label\">Artifact SHA-256</span><span class=\"hash\" id=\"digest\">Awaiting verified artifact</span></div><button id=\"save\" disabled>Save sealed proof \u2193</button><p id=\"link\"></p><p class=\"foot\">The sealed file is the proof object. This panel only verifies delivery of its exact bytes.</p></div></article><script>\n(function(){\n const status=document.getElementById('status'),button=document.getElementById('save'),link=document.getElementById('link'),digest=document.getElementById('digest'),size=document.getElementById('size');\n let output=null,token=null,hostCapabilities=null,bridgeReady=false,busy=false,failed=false,nextId=1;\n const pending=new Map();\n function envelopes(value){\n  const values=[value,value?.result,value?.mcp_tool_result,value?.mcp_tool_result?.result,\n   value?.call_tool_result,value?.call_tool_result?.result];\n  return values.filter(item=>item&&typeof item==='object');\n }\n function accept(result){\n  const frames=envelopes(result);\n  const raw=frames.map(item=>item.structuredContent||item).find(item=>item?.artifactReference&&/^[a-f0-9]{64}$/.test(item?.artifactSha256||''));\n  const nextToken=frames.map(item=>item._meta?.['receiz/sealedTransfer']?.token).find(value=>typeof value==='string');\n  if(raw){if(raw.artifactSha256!==output?.artifactSha256)token=null;output=raw;\n   digest.textContent=raw.artifactSha256;size.textContent=Number.isSafeInteger(raw.byteLength)?raw.byteLength.toLocaleString()+' bytes':'\u2014';}\n  if(nextToken)token=nextToken;\n  if(busy||failed)return;\n  if(output&&(token||bridgeReady)){status.textContent='Verified proof ready on your connected device.';button.disabled=false;}\n  else if(output){status.textContent='Proof verified; this host did not provide the private file handoff.';\n   status.dataset.handoffShape=frames.map(item=>['_meta','structuredContent','result','mcp_tool_result','call_tool_result'].filter(key=>key in item).join(',')).join('|');\n   status.dataset.handoffMeta=frames.map(item=>Object.keys(item._meta||{}).join(',')).join('|');\n   status.dataset.handoffTransfer=frames.map(item=>Object.keys(item._meta?.['receiz/sealedTransfer']||{}).join(',')).join('|');}\n }\n function discover(){\n  const legacy=window.openai;\n  if(!legacy)return;\n  const result=legacy.toolResponseMetadata?.mcp_tool_result;\n  if(result){accept({...result,structuredContent:result.structuredContent||legacy.toolOutput});return;}\n  if(legacy.toolOutput)accept({structuredContent:legacy.toolOutput,_meta:legacy.toolResponseMetadata?._meta});\n }\n function request(method,params){\n  const id=nextId++;\n  return new Promise((resolve,reject)=>{\n   const timeout=setTimeout(()=>{pending.delete(id);reject(Error('Host did not answer '+method));},15000);\n   pending.set(id,{resolve,reject,timeout});\n   window.parent.postMessage({jsonrpc:'2.0',id,method,params},'*');\n  });\n }\n window.addEventListener('message',event=>{\n  if(event.source!==window.parent)return;\n  const message=event.data;\n  if(!message||message.jsonrpc!=='2.0')return;\n  if(message.id!==undefined&&pending.has(message.id)){\n   const wait=pending.get(message.id);pending.delete(message.id);clearTimeout(wait.timeout);\n   if(message.error)wait.reject(Error(message.error.message||'Host request failed'));\n   else wait.resolve(message.result);\n  }\n  if(message.method==='ui/notifications/tool-result')accept(message.params);\n },{passive:true});\n window.addEventListener('openai:set_globals',discover);discover();\n request('ui/initialize',{protocolVersion:'2026-01-26',appInfo:{name:'Receiz sealed proof delivery',version:'11.0.0'},appCapabilities:{}})\n  .then(result=>{hostCapabilities=result?.hostCapabilities||{};bridgeReady=true;\n   status.dataset.hostCapabilities=Object.keys(hostCapabilities).join(',');\n   if(output)accept({structuredContent:output});\n   window.parent.postMessage({jsonrpc:'2.0',method:'ui/notifications/initialized'},'*');})\n  .catch(()=>{if(!window.openai&&!output)status.textContent='This host did not connect the proof handoff.';});\n const decode=value=>{const binary=atob(value),bytes=new Uint8Array(binary.length);for(let i=0;i<binary.length;i++)bytes[i]=binary.charCodeAt(i);return bytes;};\n const hex=bytes=>Array.from(bytes,v=>v.toString(16).padStart(2,'0')).join('');\n button.onclick=async()=>{\n  if(!output||(!token&&!bridgeReady))return;\n  failed=false;busy=true;button.disabled=true;status.textContent='Retrieving exact sealed bytes\u2026';status.dataset.handoffStage='requesting-chunk';\n  try{\n   const parts=[],attemptIds=[];let offset=0,expectedLength=null;\n   while(expectedLength===null||offset<expectedLength){\n    const argumentsForChunk=token?{transferToken:token,offset}\n     :{artifactReference:output.artifactReference,artifactSha256:output.artifactSha256,offset};\n    const result=window.openai?.callTool\n     ?await window.openai.callTool('receiz_offline_artifact_chunk',argumentsForChunk)\n     :await request('tools/call',{name:'receiz_offline_artifact_chunk',arguments:argumentsForChunk});\n    const frames=envelopes(result);\n    status.dataset.handoffStage='chunk-returned';\n    if(frames.some(item=>item.isError))throw Error('Device retrieval failed');\n    const publicPart=frames.map(item=>item.structuredContent).find(item=>item?.artifactSha256);\n    const meta=frames.map(item=>item._meta?.['receiz/sealedChunk']).find(Boolean);\n    const chunkBase64=meta?.bytesBase64||(!token&&publicPart?.bytesBase64);\n    if(!chunkBase64)throw Error('Component-only file transport unavailable');\n    if(!publicPart||publicPart.offset!==offset||publicPart.artifactSha256!==output.artifactSha256)throw Error('Proof source changed');\n    if(!Number.isSafeInteger(publicPart.nextOffset)||publicPart.nextOffset<=offset||!Number.isSafeInteger(publicPart.byteLength)\n      ||publicPart.nextOffset>publicPart.byteLength||(expectedLength!==null&&publicPart.byteLength!==expectedLength)\n      ||(output.byteLength!==undefined&&publicPart.byteLength!==output.byteLength))throw Error('Incomplete proof transfer');\n    const bytes=decode(chunkBase64);if(bytes.length!==publicPart.nextOffset-offset)throw Error('Incomplete proof transfer');\n    if(typeof publicPart.receizTransportAttemptId==='string')attemptIds.push(publicPart.receizTransportAttemptId);\n    parts.push(bytes);offset=publicPart.nextOffset;expectedLength=publicPart.byteLength;\n   }\n   const exact=new Uint8Array(offset);let cursor=0;for(const part of parts){exact.set(part,cursor);cursor+=part.length;}\n   const digest=hex(new Uint8Array(await crypto.subtle.digest('SHA-256',exact)));\n   if(digest!==output.artifactSha256)throw Error('Proof bytes changed');\n   status.dataset.handoffStage='digest-matched';\n   const file=new File([exact],output.suggestedFilename||'receiz-proof.receized',{type:output.mimeType||'application/octet-stream'});\n   status.dataset.chatgptFileApis=['uploadFile','getFileDownloadUrl'].filter(name=>typeof window.openai?.[name]==='function').join(',');\n   if(window.openai?.uploadFile){try{\n    let uploaded;\n    try{uploaded=await window.openai.uploadFile(file,{library:true});}\n    catch(error){status.dataset.libraryUploadError=error?.message||'Library upload unavailable';\n     uploaded=await window.openai.uploadFile(file);}\n    if(uploaded?.fileId&&window.openai.getFileDownloadUrl){const target=await window.openai.getFileDownloadUrl({fileId:uploaded.fileId});\n      if(target?.downloadUrl){const a=document.createElement('a');a.href=target.downloadUrl;a.textContent='Download sealed proof';a.download=file.name;link.replaceChildren(a);busy=false;status.textContent='Exact sealed proof is available in ChatGPT.';return;}}\n   }catch(error){status.dataset.chatgptUploadError=error?.message||'ChatGPT file upload unavailable';}}\n   if(hostCapabilities?.downloadFile){\n    const safeName=file.name.replace(/[^a-zA-Z0-9._-]/g,'_');\n    // Encode the already verified exact bytes, never a projection or a URL.\n    let binary='';for(let i=0;i<exact.length;i+=32768)binary+=String.fromCharCode(...exact.subarray(i,i+32768));\n    await request('ui/download-file',{contents:[{type:'resource',resource:{uri:'file:///'+encodeURIComponent(safeName),mimeType:file.type,blob:btoa(binary)}}]});\n    status.dataset.handoffStage='download-accepted';busy=false;\n    status.textContent='Exact sealed proof sent to your downloads.';return;\n   }\n   if(attemptIds.length===parts.length){\n    const prepared=await request('tools/call',{name:'receiz_offline_artifact_chunk',arguments:{prepareDownload:true,\n     attemptIds,artifactSha256:output.artifactSha256,byteLength:exact.length}});\n    const frames=envelopes(prepared);\n    if(frames.some(item=>item.isError))throw Error('The Receiz download route is not ready yet');\n    const receipt=frames.map(item=>item.structuredContent).find(item=>typeof item?.downloadUrl==='string');\n    if(!receipt||receipt.artifactSha256!==output.artifactSha256||receipt.byteLength!==exact.length)throw Error('Download ticket does not match the proof');\n    const target=new URL(receipt.downloadUrl);\n    if(target.origin!=='https://receiz.com'||target.pathname!=='/receiz-proof-download.html'||!target.hash)throw Error('Download route is not Receiz');\n    const a=document.createElement('a');a.href=target.href;a.textContent='Open secure Receiz download \u2197';a.rel='noreferrer';\n    a.onclick=async event=>{event.preventDefault();try{await request('ui/open-link',{url:target.href});}\n     catch{status.textContent='Open the Receiz download link to save the exact proof.';}};\n    link.replaceChildren(a);status.dataset.handoffStage='receiz-ticket-ready';busy=false;\n    status.textContent='Exact proof verified. Starting the Receiz download\u2026';\n    try{await request('ui/open-link',{url:target.href});}\n    catch{status.textContent='Use the secure Receiz link to start your download.';}\n    return;\n   }\n   throw Error('This host does not support sealed file downloads');\n  }catch(error){busy=false;failed=true;status.dataset.handoffError=error?.message||'File handoff failed';\n   status.textContent=status.dataset.handoffError;button.disabled=false;}\n };\n})();\n</script></body></html>";
//# sourceMappingURL=sealedArtifactOutput.d.ts.map