@warmhub/sdk-ts 0.106.0 → 0.108.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/repository-checkpoint/types.ts","../src/repository-checkpoint/archive-reader.ts","../src/repository-checkpoint/identity-sort.ts","../src/repository-checkpoint/content-verifier.ts","../src/repository-checkpoint/verify.ts"],"names":["RepositoryCheckpointVerificationError","reason","messageForReason","LOCAL_SIGNATURE","CENTRAL_SIGNATURE","DESCRIPTOR_SIGNATURE","ZIP64_END_SIGNATURE","ZIP64_LOCATOR_SIGNATURE","CLASSIC_END_SIGNATURE","ZIP_FLAGS","ZIP_METHOD_DEFLATE","ZIP_VERSION_45","ZIP_VERSION_MADE_BY_UNIX","ZIP64_SENTINEL_16","ZIP64_SENTINEL_32","DOS_EPOCH_DATE","REGULAR_FILE_0644","INFLATE_INPUT_BYTES","CHUNK_PATH","CHECKPOINT_PART_DIGITS","utf8Decoder","CheckpointSourceReadError","readCheckpointZip64Archive","source","openEntry","reader","StreamingByteReader","entries","names","manifestSeen","localOffset","header","assertLocalHeader","nameLength","extraLength","name","decodeEntryName","assertEntryName","CHECKPOINT_MANIFEST_NAME","assertLocalExtra","sink","inflated","inflateEntry","descriptor","assertDescriptor","readCentralDirectory","entry","inflater","createInflateRaw","compressedSize","uncompressedSize","crc","output","Writable","bytes","_encoding","done","crc32","error","completed","pipeline","failed","input","before","writeInflateInput","consumed","written","resolve","reject","centralOffset","expected","assertCentralHeader","assertCentralExtra","centralSize","zip64Offset","end","requireU32","locator","classic","extra","offset","value","#iterator","#hash","createHash","#queue","#queueOffset","#sourceDone","#loadedBytes","toAsyncIterable","length","result","chunk","limit","#load","head","available","current","CHECKPOINT_IDENTITY_SORT_BUDGET_BYTES","CHECKPOINT_IDENTITY_MERGE_FAN_IN","RUN_BUFFER_BYTES","RUN_READ_BUFFER_BYTES","IDENTITY_LENGTH_BYTES","OFFSET_BYTES","MINIMUM_IDENTITY_BYTES","MINIMUM_RECORD_BYTES","MINIMUM_RESIDENT_BYTES","DuplicateCheckpointDurableIdError","CheckpointIdentitySorter","#scratchPath","#resident","#runs","#nextRun","#mergeFanIn","scratchPath","options","sortBudgetBytes","ResidentDurableIds","durableId","byteLength","#flushRun","nextRuns","group","#runPath","writeMergedRun","path","rm","previous","mergeRuns","compareUtf8Bytes","nextDurableId","nextByteLength","writeResidentRun","join","#records","#offsets","#recordBytes","#count","byteBudget","offsetCapacity","offsets","left","right","#compareAt","index","consume","each","#recordAt","leftOffset","rightOffset","#valueAt","resident","writeRun","writer","BufferedRunWriter","record","inputs","outputPath","produce","open","createWriteStream","once","#output","#buffer","#length","#flushThenWrite","#flushThenBuffer","recordLength","#flushThenWriteValue","#flushThenBufferValue","#writeValue","#flush","writeChunk","batch","paths","cursors","RunCursor","cursor","selected","#stream","#chunk","#offset","createReadStream","#readExactly","copied","next","values","sharedLength","difference","CheckpointContentVerifier","#identitySorter","#streamStates","#streamChunks","#observedChunks","#manifestBytes","chunks","CheckpointChunkSink","manifest","parseCheckpointManifest","declared","stream","observed","state","finishCheckpointStreamValidation","#path","#completed","#lineFragments","#lineFragmentBytes","#shapeName","#recordCount","#byteLength","streamStates","streamChunks","identitySorter","lf","#consumeRow","#takeLine","#appendLineFragment","CHECKPOINT_CHUNK_BYTE_LIMIT","row","parseCheckpointRowLine","shapeName","#startChunk","createCheckpointStreamValidationState","validateCheckpointStreamRow","flushed","tail","line","firstRowBytes","part","verifyRepositoryCheckpointArchive","verifyRepositoryCheckpointArchiveWithOptions","mkdtemp","tmpdir","chmod","failure","content","archive","chunkCount","assertExpected","mapVerificationError","checkpointSha256Schema","message"],"mappings":"2ZAeO,IAAMA,CAAAA,CAAN,cAAoD,KAAM,CAG/D,WAAA,CAAqBC,EAAqD,CACxE,KAAA,CAAMC,EAAAA,CAAiBD,CAAM,CAAC,CAAA,CADX,YAAAA,EAErB,CAFqB,MAAA,CAFH,IAAA,CAAO,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EAAsC,iBAAiB,CAAA,CACnE,OAAO2F,CACT,CAEA,SAASoJ,EAAAA,CACPzK,CAAAA,CACAuK,CAAAA,CACAxC,CAAAA,CACM,CACN,GAAK/H,CAAAA,GACL2K,GAAAA,CAAuB,MAAM3K,CAAAA,CAAS,MAAM,CAAA,CAE1CA,CAAAA,CAAS,YAAA,GAAiB+H,CAAAA,CAAS,cACnC/H,CAAAA,CAAS,OAAA,GAAY+H,CAAAA,CAAS,OAAA,EAC9B/H,CAAAA,CAAS,UAAA,GAAeuK,EAAQ,UAAA,EAChCvK,CAAAA,CAAS,MAAA,GAAWuK,CAAAA,CAAQ,MAAA,CAAA,CAE5B,MAAM,IAAI7O,CAAAA,CACR,4BACF,CAEJ,CAEA,SAASgP,EAAAA,CACPtL,CAAAA,CACuC,CACvC,GAAIA,CAAAA,YAAiB1D,CAAAA,CAAuC,OAAO0D,CAAAA,CACnE,GAAIA,aAAiBrC,CAAAA,CACnB,OAAO,IAAIrB,CAAAA,CAAsC,eAAe,CAAA,CAElE,GAAI0D,CAAAA,YAAiBiD,CAAAA,CACnB,OAAO,IAAI3G,CAAAA,CAAsC,sBAAsB,CAAA,CAEzE,IAAMkP,CAAAA,CAAUxL,CAAAA,YAAiB,KAAA,CAAQA,CAAAA,CAAM,OAAA,CAAU,EAAA,CACzD,OAAIwL,CAAAA,CAAQ,QAAA,CAAS,UAAU,CAAA,CACtB,IAAIlP,CAAAA,CAAsC,kBAAkB,CAAA,CAGnEkP,CAAAA,CAAQ,QAAA,CAAS,OAAO,CAAA,EACxBA,CAAAA,CAAQ,QAAA,CAAS,KAAK,CAAA,EACtBA,CAAAA,CAAQ,QAAA,CAAS,cAAc,CAAA,CAExB,IAAIlP,CAAAA,CAAsC,eAAe,CAAA,CAE3D,IAAIA,CAAAA,CAAsC,iBAAiB,CACpE","file":"checkpoint.js"}
1
+ {"version":3,"sources":["../src/repository-checkpoint/types.ts","../src/repository-checkpoint/archive-reader.ts","../src/repository-checkpoint/identity-sort.ts","../src/repository-checkpoint/content-verifier.ts","../src/repository-checkpoint/verify.ts"],"names":["RepositoryCheckpointVerificationError","reason","messageForReason","LOCAL_SIGNATURE","CENTRAL_SIGNATURE","DESCRIPTOR_SIGNATURE","ZIP64_END_SIGNATURE","ZIP64_LOCATOR_SIGNATURE","CLASSIC_END_SIGNATURE","ZIP_FLAGS","ZIP_METHOD_DEFLATE","ZIP_VERSION_45","ZIP_VERSION_MADE_BY_UNIX","ZIP64_SENTINEL_16","ZIP64_SENTINEL_32","DOS_EPOCH_DATE","REGULAR_FILE_0644","INFLATE_INPUT_BYTES","CHUNK_PATH","CHECKPOINT_PART_DIGITS","utf8Decoder","CheckpointSourceReadError","readCheckpointZip64Archive","source","openEntry","reader","StreamingByteReader","entries","names","manifestSeen","localOffset","header","assertLocalHeader","nameLength","extraLength","name","decodeEntryName","assertEntryName","CHECKPOINT_MANIFEST_NAME","assertLocalExtra","sink","inflated","inflateEntry","descriptor","assertDescriptor","readCentralDirectory","entry","inflater","createInflateRaw","compressedSize","uncompressedSize","crc","output","Writable","bytes","_encoding","done","crc32","error","completed","pipeline","failed","input","before","writeInflateInput","consumed","written","resolve","reject","centralOffset","expected","assertCentralHeader","assertCentralExtra","centralSize","zip64Offset","end","requireU32","locator","classic","extra","offset","value","#iterator","#hash","createHash","#queue","#queueOffset","#sourceDone","#loadedBytes","toAsyncIterable","length","result","chunk","limit","#load","head","available","current","CHECKPOINT_IDENTITY_SORT_BUDGET_BYTES","CHECKPOINT_IDENTITY_MERGE_FAN_IN","RUN_BUFFER_BYTES","RUN_READ_BUFFER_BYTES","IDENTITY_LENGTH_BYTES","OFFSET_BYTES","MINIMUM_IDENTITY_BYTES","MINIMUM_RECORD_BYTES","MINIMUM_RESIDENT_BYTES","DuplicateCheckpointDurableIdError","CheckpointIdentitySorter","#scratchPath","#resident","#runs","#nextRun","#mergeFanIn","scratchPath","options","sortBudgetBytes","ResidentDurableIds","durableId","byteLength","#flushRun","nextRuns","group","#runPath","writeMergedRun","path","rm","previous","mergeRuns","compareUtf8Bytes","nextDurableId","nextByteLength","writeResidentRun","join","#records","#offsets","#recordBytes","#count","byteBudget","offsetCapacity","offsets","left","right","#compareAt","index","consume","each","#recordAt","leftOffset","rightOffset","#valueAt","resident","writeRun","writer","BufferedRunWriter","record","inputs","outputPath","produce","open","createWriteStream","once","#output","#buffer","#length","#flushThenWrite","#flushThenBuffer","recordLength","#flushThenWriteValue","#flushThenBufferValue","#writeValue","#flush","writeChunk","batch","paths","cursors","RunCursor","cursor","selected","#stream","#chunk","#offset","createReadStream","#readExactly","copied","next","values","sharedLength","difference","CheckpointContentVerifier","#identitySorter","#streamStates","#streamChunks","#observedChunks","#manifestBytes","chunks","CheckpointChunkSink","manifest","parseCheckpointManifest","declared","stream","observed","state","finishCheckpointStreamValidation","#path","#completed","#lineFragments","#lineFragmentBytes","#shapeName","#recordCount","#byteLength","streamStates","streamChunks","identitySorter","lf","#consumeRow","#takeLine","#appendLineFragment","CHECKPOINT_CHUNK_BYTE_LIMIT","row","parseCheckpointRowLine","shapeName","#startChunk","createCheckpointStreamValidationState","validateCheckpointStreamRow","flushed","tail","line","firstRowBytes","part","verifyRepositoryCheckpointArchive","verifyRepositoryCheckpointArchiveWithOptions","mkdtemp","tmpdir","chmod","failure","content","archive","chunkCount","assertExpected","mapVerificationError","checkpointSha256Schema","message"],"mappings":"oZAeO,IAAMA,CAAAA,CAAN,cAAoD,KAAM,CAG/D,WAAA,CAAqBC,EAAqD,CACxE,KAAA,CAAMC,EAAAA,CAAiBD,CAAM,CAAC,CAAA,CADX,YAAAA,EAErB,CAFqB,MAAA,CAFH,IAAA,CAAO,uCAK3B,EAmCA,SAASC,EAAAA,CACPD,CAAAA,CACQ,CACR,OAAQA,CAAAA,EACN,KAAK,gBACH,OAAO,gDAAA,CACT,KAAK,iBAAA,CACH,OAAO,0CAAA,CACT,KAAK,4BAAA,CACH,OAAO,wDAAA,CACT,KAAK,kBAAA,CACH,OAAO,4CACT,KAAK,eAAA,C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iB+H,CAAAA,CAAS,cACnC/H,CAAAA,CAAS,OAAA,GAAY+H,CAAAA,CAAS,OAAA,EAC9B/H,CAAAA,CAAS,UAAA,GAAeuK,EAAQ,UAAA,EAChCvK,CAAAA,CAAS,MAAA,GAAWuK,CAAAA,CAAQ,MAAA,CAAA,CAE5B,MAAM,IAAI7O,CAAAA,CACR,4BACF,CAEJ,CAEA,SAASgP,EAAAA,CACPtL,CAAAA,CACuC,CACvC,GAAIA,CAAAA,YAAiB1D,CAAAA,CAAuC,OAAO0D,CAAAA,CACnE,GAAIA,aAAiBrC,CAAAA,CACnB,OAAO,IAAIrB,CAAAA,CAAsC,eAAe,CAAA,CAElE,GAAI0D,CAAAA,YAAiBiD,CAAAA,CACnB,OAAO,IAAI3G,CAAAA,CAAsC,sBAAsB,CAAA,CAEzE,IAAMkP,CAAAA,CAAUxL,CAAAA,YAAiB,KAAA,CAAQA,CAAAA,CAAM,OAAA,CAAU,EAAA,CACzD,OAAIwL,CAAAA,CAAQ,QAAA,CAAS,UAAU,CAAA,CACtB,IAAIlP,CAAAA,CAAsC,kBAAkB,CAAA,CAGnEkP,CAAAA,CAAQ,QAAA,CAAS,OAAO,CAAA,EACxBA,CAAAA,CAAQ,QAAA,CAAS,KAAK,CAAA,EACtBA,CAAAA,CAAQ,QAAA,CAAS,cAAc,CAAA,CAExB,IAAIlP,CAAAA,CAAsC,eAAe,CAAA,CAE3D,IAAIA,CAAAA,CAAsC,iBAAiB,CACpE","file":"checkpoint.js"}
@@ -0,0 +1,10 @@
1
+ import {j as j$1,W as W$1,G,S,T as T$1,V as V$1,F as F$1,n,q,o,p,r,Z as Z$1,E,u,v,b,f as f$1,e,i,a,d as d$1,C as C$1,w as w$1,U as U$1,Q as Q$1,m,D as D$1,z as z$2,Y as Y$1,X as X$1,k,c,l,R,g,h}from'./chunk-X5CR7GVH.js';import {TRPCClientError,createTRPCProxyClient,splitLink,httpBatchLink,httpLink}from'@trpc/client';import {observable}from'@trpc/server/observable';import {z as z$1}from'zod';function Et(r,e){let{childContext:t,onStringValue:n,onObjectKey:i}=e,o=[{value:r,context:e.rootContext}];for(;o.length>0;){let{value:s,context:a}=o.pop();if(typeof s=="string"){n(s,a);continue}if(Array.isArray(s)){for(let p=s.length-1;p>=0;p--)o.push({value:s[p],context:t(a,p)});continue}if(!w$1(s))continue;let c=Object.entries(s).map(([p,l])=>[p,t(a,p),l]);if(i)for(let[p,l]of c)i(p,l);for(let p=c.length-1;p>=0;p--){let l=c[p];l&&o.push({value:l[2],context:l[1]});}}}var Ur=new Set(["arc","bond","pair","set","list"]);function z(r,e){let t=It(r,e,"add");return {operation:"add",kind:"collection",name:t.name,type:t.type,members:t.members,...r.skipExisting===true?{skipExisting:true}:{}}}function de(r,e){let t=It(r,e,"revise");if(!t.name)throw new Error(`${e}: collection revise requires a target name`);return {operation:"revise",kind:"collection",name:t.name,type:t.type,members:t.members,...typeof r.expectedVersion=="number"?{expectedVersion:r.expectedVersion}:{},...typeof r.leaseId=="string"&&r.leaseId.length>0?{leaseId:r.leaseId}:{}}}function It(r,e,t){let n=E({operation:t,kind:"collection",name:typeof r.name=="string"?r.name:void 0,type:typeof r.type=="string"?r.type:void 0,members:Array.isArray(r.members)?r.members:void 0},0);if(n.length>0)throw new Error(`${e}: ${n.map(s=>s.message).join("; ")}`);let i=Hr(r.type);if(!i)throw new Error(`${e}: collection ${t} requires 'type'. Use one of: arc, bond, set, list`);if(!Array.isArray(r.members))throw new Error(`${e}: collection ${t} requires a 'members' array`);let o=Fr(r.name);if(!o)throw new Error(`${e}: collection ${t} name must be a non-empty string`);return Vr(r,e,t),{name:o,type:i,members:r.members}}function Vr(r,e,t){let n=["about","aboutWref","shapeWref","data",...t==="revise"?["skipExisting"]:[]].filter(i=>r[i]!==void 0);if(n.length>0)throw new Error(`${e}: collection ${t} does not support ${n.map(i=>`'${i}'`).join(", ")}`)}function Hr(r){if(typeof r!="string")return;let e=r.trim();if(Ur.has(e))return e}function Fr(r){if(typeof r=="string"&&!(r.length===0||r.trim()!==r))return r}function D(r){if(r.expectedVersion!==void 0&&r.operation!=="revise"&&r.operation!=="retract"&&r.operation!=="reaffirm")throw new Error("expectedVersion is only valid on revise, retract, or reaffirm operations \u2014 set an explicit operation discriminator");if(r.operation==="retract")return {operation:"retract",name:r.name,...r.kind?{kind:r.kind}:{},...r.reason?{reason:r.reason}:{},...r.expectedVersion!==void 0?{expectedVersion:r.expectedVersion}:{},...r.leaseId?{leaseId:r.leaseId}:{}};if(r.operation==="reaffirm")return {operation:"reaffirm",name:r.name,...r.expectedVersion!==void 0?{expectedVersion:r.expectedVersion}:{},...r.kind?{kind:r.kind}:{},...r.add?{add:r.add}:{},...r.remove?{remove:r.remove}:{},...r.leaseId?{leaseId:r.leaseId}:{}};if(r.operation==="rename")return {operation:"rename",name:r.name,newName:r.newName,...r.kind?{kind:r.kind}:{}};if(r.operation==="revise"){let n=r.name??r.wref;if(!n)throw new Error("revise operation requires a target");let i=m({kind:r.kind,name:n});if(Object.hasOwn(r,"active"))throw new Error(`${i} revise operation no longer supports 'active' \u2014 use retract('${n}') instead`);if(i!=="assertion"&&r.affirmedTargets!==void 0)throw new Error(`${i} revise operation does not support 'affirmedTargets' \u2014 it applies only to assertions; set kind: 'assertion' explicitly`);if(i==="collection")return de(r,"commit.apply");if(r.data===void 0)throw new Error(`${i} revise operation requires 'data'`);return i==="assertion"?{operation:"revise",kind:"assertion",name:n,data:r.data,...r.affirmedTargets?{affirmedTargets:r.affirmedTargets}:{},...r.expectedVersion!==void 0?{expectedVersion:r.expectedVersion}:{},...r.leaseId?{leaseId:r.leaseId}:{}}:{operation:"revise",kind:i,name:n,data:r.data,...r.expectedVersion!==void 0?{expectedVersion:r.expectedVersion}:{},...r.leaseId?{leaseId:r.leaseId}:{}}}let e=m(r),t="skipExisting"in r?r.skipExisting:void 0;if(e!=="collection"&&("type"in r&&r.type!==void 0||"members"in r&&r.members!==void 0))throw new Error(`add operation '${r.name??""}' has collection fields but resolved kind '${e}' \u2014 collection adds require both 'type' and 'members', or set kind: 'collection'`);if(e!=="assertion"&&r.affirmedTargets!==void 0)throw new Error(`${e} add operation does not support 'affirmedTargets' \u2014 it applies only to assertions; set kind: 'assertion' explicitly`);if(e==="collection")return z({...r,skipExisting:t},"commit.apply");if(!r.name)throw new Error("add operation requires a name");if(e==="assertion"){if(!("about"in r)||r.about===void 0)throw new Error("assertion add operation requires 'about'");if(typeof r.about!="string")throw new Error(D$1);if(r.data===void 0)throw new Error("assertion add operation requires 'data'");return {operation:"add",kind:"assertion",name:r.name,about:r.about,data:r.data,...r.affirmedTargets?{affirmedTargets:r.affirmedTargets}:{},...t===true?{skipExisting:t}:{}}}if(r.data===void 0)throw new Error(`${e} add operation requires 'data'`);return {operation:"add",kind:e,name:r.name,data:r.data,...t===true?{skipExisting:t}:{}}}var Wr=1e4,$r=4*1024*1024,Le=class extends Error{code="VALIDATION_ERROR";status=400;constructor(e){super(e),this.name="WarmHubError";}};function qe(r,e){return r.map((t,n)=>{let i;try{i=D(t);}catch(o){let s=o instanceof Error?o.message:String(o);throw new Le(`Invalid operation at index ${n}: ${s}`)}return e===true&&i.operation==="add"?{...i,skipExisting:true}:i})}function Gr(r,e,t,n){return {orgName:r,repoName:e,...n?.committer!==void 0?{committer:n.committer}:{},...n?.message!==void 0?{message:n.message}:{},...n?.componentRef!==void 0?{componentRef:n.componentRef}:{},operations:qe(t,n?.skipExisting),...n?.includeWouldBeBody!==void 0?{includeWouldBeBody:n.includeWouldBeBody}:{}}}function At(r){return JSON.stringify(r)}function Kr(r){return new TextEncoder().encode(At(r)).byteLength}var Me="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Be=new Uint8Array(256).fill(255);for(let r=0;r<Me.length;r++){let e=Me.charCodeAt(r);Be[e]=r,e>=65&&(Be[e+32]=r);}function vt(r){let e=r.length*8,t=Math.ceil(e/5),n="";for(let i=0;i<t;i++){let o=i*5,s=o>>3,a=o&7,c=r[s]??0,p;if(a<=3)p=c>>3-a&31;else {let l=r[s+1]??0;p=(c<<a-3|l>>11-a)&31;}n+=Me[p];}return n}function kt(r){let e=Math.floor(r.length*5/8),t=new Uint8Array(e),n=0,i=0,o=0;for(let s=0;s<r.length;s++){let a=r.charCodeAt(s),c=Be[a];if(c===void 0||c===255)return null;n=n<<5|c,i+=5,i>=8&&(i-=8,o<e&&(t[o++]=n>>i&255));}return t}var zr=1;var Tt=16,Nt=4;function jr(r){return Math.ceil((1+r+Nt)*8/5)}var Yr=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let i=0;i<8;i++)n=n&1?n>>>1^2197175160:n>>>1;e[t]=n>>>0;}return e})();function Jr(r){let e=4294967295;for(let t of r)e=(e>>>8^(Yr[(e^t)&255]??0))>>>0;return (e^4294967295)>>>0}function _t(r,e=0){let t=Array.from(r.slice(e,e+16)).map(n=>n.toString(16).padStart(2,"0")).join("");return [t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20,32)].join("-")}function Qr(r,e,t){let n=e.startsWith("wh:")?e.slice(3):e;if(n.length!==jr(t))return null;let i=kt(n);if(!i||i.length!==1+t+Nt||i[0]!==r)return null;let o=1+t,s=(i[o]??0)<<24|(i[o+1]??0)<<16|(i[o+2]??0)<<8|(i[o+3]??0),a=Jr(i.slice(0,o));return s>>>0!==a>>>0||vt(i)!==n.toUpperCase()?null:i.slice(1,1+t)}function Xr(r){let e=Qr(zr,r,Tt*2);return e?{repoId:_t(e,0),thingId:_t(e,Tt)}:null}var Zr=/^(?:v0*[1-9]\d*|[Hh][Ee][Aa][Dd]|[Aa][Ll][Ll])$/;function Pt(r){let e=r.lastIndexOf("@"),t=e>=0&&Zr.test(r.slice(e+1))?r.slice(e+1):null,n=t===null?r:r.slice(0,e);return Xr(n)===null?null:{durableId:(n.startsWith("wh:")?n.slice(3):n).toUpperCase(),selector:t}}function le(r){let e=new Set;return Et(r,{rootContext:{key:null,parentKey:null,insideData:false},childContext:(t,n)=>({key:n,parentKey:t.key,insideData:t.insideData||n==="data"}),onStringValue:(t,n)=>{if(n.key==="durableId"&&n.parentKey==="metadata"&&!n.insideData)return;let i=Pt(t);i&&e.add(i.durableId);}}),e}function rn(r){let e={};for(let t of r)e[t.durableId]=t.canonicalWref;return e}function Ue(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function nn(r){if(!Ue(r))return;let e=r.decorations;return Ue(e)?e:void 0}function on(r){let e=r instanceof Error?r:new Error(String(r));return Object.assign(e,{decorationFailure:true})}function Dt(r){return ()=>({op:e,next:t})=>!r.enabled||e.type!=="query"||e.path==="thing.headVersions"?t(e):observable(n=>{let i=false,o=false,s=false,a=()=>{!i&&o&&!s&&n.complete();},c=t(e).subscribe({next:p=>{let l=p.result?.data;if(!Ue(l)){n.next(p);return}let m=le(l);if(m.size===0){n.next(p);return}s=true,r.getClient().thing.headVersions(void 0,void 0,[...m]).then(({items:g})=>{i||n.next({...p,result:{...p.result,data:{...l,decorations:rn(g)}}});}).catch(g=>{i||n.error(TRPCClientError.from(on(g)));}).finally(()=>{s=false,a();});},error:p=>n.error(p),complete:()=>{o=true,a();}});return ()=>{i=true,c.unsubscribe();}})}function Lt(r,e){return {create:async(t,n,i)=>{try{return await r().grant.create.mutate({orgName:t,repoName:n,...i})}catch(o){throw e(o)}},get:async(t,n,i)=>{try{return await r().grant.get.query({orgName:t,repoName:n,grantId:i})}catch(o){throw e(o)}},list:async(t,n,i)=>{try{return await r().grant.list.query({orgName:t,repoName:n,limit:i?.limit,cursor:i?.cursor})}catch(o){throw e(o)}},revoke:async(t,n,i,o)=>{try{return await r().grant.revoke.mutate({orgName:t,repoName:n,grantId:i,reason:o?.reason})}catch(s){throw e(s)}}}}function qt(r){return {...r,createdAt:new Date(r.createdAt),updatedAt:new Date(r.updatedAt),runStartedAt:new Date(r.runStartedAt),...r.state==="complete"||r.state==="failed"?{completedAt:new Date(r.completedAt)}:{}}}function sn(r){return {...r,expiresAt:new Date(r.expiresAt)}}function Mt(r){if(typeof r.checkpointId=="string"&&typeof r.repoSeq!="number")return {by:"id",checkpointId:r.checkpointId};if(typeof r.repoSeq=="number"&&typeof r.checkpointId!="string")return {by:"repoSeq",repoSeq:r.repoSeq};throw new TypeError("Repository checkpoint selector must contain exactly one of checkpointId or repoSeq")}function Bt(r,e){return {status:async(t,n,i)=>{try{let o=await r().repo.checkpoint.status.query({orgName:t,repoName:n,selector:Mt(i)});return qt(o)}catch(o){throw e(o)}},latest:async(t,n)=>{try{let i=await r().repo.checkpoint.latest.query({orgName:t,repoName:n});return i.checkpoint?qt(i.checkpoint):null}catch(i){throw e(i)}},getAccess:async(t,n,i)=>{try{let o=await r().repo.checkpoint.access.query({orgName:t,repoName:n,selector:i.checkpoint==="latest"?{by:"latest"}:Mt(i.checkpoint),artifact:i.artifact==="archive"||i.artifact==="manifest"?{kind:i.artifact}:{kind:"chunk",path:i.artifact.chunkPath}});return sn(o)}catch(o){throw e(o)}}}}function an(r){return typeof r.get=="function"}function Ut(r){return an(r)?r.values():r}function Vt(r,e){let t=new Map;for(let n of Ut(r))n.active?t.set(n.durableId,n):t.delete(n.durableId);for(let n of Ut(e))n.active?t.set(n.durableId,n):t.delete(n.durableId);return t}var y=class extends Error{constructor(t,n){super(n??cn[t]);this.reason=t;}reason;name="RepositoryExportError"},cn={count_mismatch:"Repository export trailer record count does not match the rows read",digest_mismatch:"Repository export content digest does not match the trailer",fence_mismatch:"Repository export header and trailer disagree about atRepoSeq",header_invalid:"Repository export header is invalid",row_invalid:"Repository export row is invalid or not canonical",row_out_of_order:"Repository export rows are not strictly increasing by durableId",since_below_epoch_floor:"Repository export delta base is below the epoch floor",trailer_invalid:"Repository export trailer is invalid",truncated:"Repository export stream ended before its trailer"},j=class{#n=W$1();#i=W$1();#o=0;#t;#e;#a;#s=false;#c=false;#r;get header(){return this.#t}get lastDurableId(){return this.#e}get rowCount(){return this.#n.rowCount}get segmentRowCount(){return this.#o}get contentSha256(){return this.#r}finalizeContentSha256(){return this.#r===void 0&&(this.#r=this.#n.finalize(),this.#s=true),this.#r}beginSegment(){this.assertResumable(),this.#i=W$1(),this.#o=0;}markUnverifiable(){this.#c=true;}finalizeSegment(){return this.#i.finalize()}get token(){return this.#a}set token(e){this.#a=e;}get complete(){return this.#s}markComplete(){this.finalizeContentSha256();}assertResumable(){if(this.#c)throw new y("digest_mismatch","Repository export session failed verification and cannot be resumed; start a new session");if(this.#s)throw new y("header_invalid","Repository export session is already complete; start a new session")}adoptHeader(e){this.assertResumable();let t=this.#t;if(t!==void 0&&(t.repo!==e.repo||t.mode!==e.mode||t.sinceRepoSeq!==e.sinceRepoSeq||t.atRepoSeq!==e.atRepoSeq))throw new y("header_invalid","Resumed repository export header does not match the opening header");this.#t=e;}recordRow(e,t){if(this.#t?.mode==="heads"&&this.#e!==void 0&&G(this.#e,e)>=0)throw new y("row_out_of_order",`Repository export row '${e}' does not follow '${this.#e}'`);this.#n.update(t),this.#i.update(t),this.#o+=1,this.#e=e;}};function B(){return new j}var Ht=10,pn=new TextDecoder;function un(r){let e=r.header;if(!e)throw new y("header_invalid","Repository export resumed without an opening header to inherit");return e}async function dn(r,e,t){let n=await r.next();if(n.done)throw new y("truncated");let i;try{i=U$1(n.value);}catch(o){Ve("header_invalid",o);}if(i.formatVersion!==Q$1||t!==void 0&&(i.repo!==t.repo||i.mode!==t.mode||t.sinceRepoSeq!==void 0&&i.sinceRepoSeq!==t.sinceRepoSeq||t.atRepoSeq!==void 0&&i.atRepoSeq!==t.atRepoSeq))throw new y("header_invalid",t===void 0?`Repository export header declares format version ${i.formatVersion}; expected ${Q$1}`:`Repository export header describes ${i.repo} (${i.mode}, ${i.sinceRepoSeq}..${i.atRepoSeq}); expected ${t.repo} (${t.mode}${t.sinceRepoSeq!==void 0?`, since ${t.sinceRepoSeq}`:""}${t.atRepoSeq!==void 0?`, at ${t.atRepoSeq}`:""})`);return e.adoptHeader(i),i}async function*ln(r,e){let t=new Uint8Array(0);for await(let n of mn(r)){let i=new Uint8Array(t.length+n.length);i.set(t),i.set(n,t.length),t=i;let o=t.indexOf(Ht);for(;o!==-1;)yield t.subarray(0,o+1),t=t.subarray(o+1),o=t.indexOf(Ht);}e.unterminated=t.length>0;}function mn(r){return Symbol.asyncIterator in r?r:{async*[Symbol.asyncIterator](){let e=r.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)return;n&&(yield n);}}finally{e.releaseLock();}}}}function gn(r){try{let e=JSON.parse(pn.decode(r));if(e!==null&&typeof e=="object"&&"kind"in e){let t=e.kind;if(typeof t=="string")return t}}catch{}return ""}function Ve(r,e){throw e instanceof y?e:new y(r,e instanceof Error?e.message:void 0)}async function*Y(r,e,t,n={}){yield*Wt(r,e,t,n);}async function Ft(r,e={}){let t=B(),n=Wt(r,t,void 0,e),i=await n.next();for(;!i.done;)i=await n.next();return t}async function*Wt(r,e,t,n){let i={unterminated:false},o=ln(r,i);try{yield*hn(o,i,e,t,n);}finally{await o.return(void 0);}}async function*hn(r,e,t,n,i){t.assertResumable();let o=i.resumed===true?un(t):await dn(r,t,n),s=S(o);for(t.beginSegment();;){let a=await r.next();if(a.done){if(i.partial===true)return;throw new y("truncated")}let c=a.value;if(gn(c)!=="trailer"){let l;try{l=T$1(c);}catch(m){Ve("row_invalid",m);}if(!l.active&&!s)throw new y("row_invalid","Repository export tombstone is not legal in a full export");t.recordRow(l.durableId,c),yield l;continue}let p;try{if(p=V$1(c),p.atRepoSeq!==o.atRepoSeq)throw new y("fence_mismatch");if(p.recordCount!==t.segmentRowCount)throw new y("count_mismatch");if(p.contentSha256!==t.finalizeSegment())throw new y("digest_mismatch")}catch(l){if(t.markUnverifiable(),l instanceof y)throw l;Ve("trailer_invalid",l);}if(!(await r.next()).done||e.unterminated)throw new y("trailer_invalid","Repository export stream continues past its trailer");t.markComplete();return}}var yn="since-below-epoch-floor",fn=1e3,Rn=50,bn=3;function He(r,e,t){let n=new URLSearchParams;for(let[o,s]of Object.entries(t))s!==void 0&&n.set(o,String(s));let i=n.toString();return `/api/repos/${encodeURIComponent(r)}/${encodeURIComponent(e)}/export${i?`?${i}`:""}`}function $t(r){let e=r?.reason;return e instanceof Error?e:new Error("Repository export was aborted")}function Sn(r){return r===void 0||!Number.isFinite(r)?fn:Math.max(r,Rn)}async function wn(r,e){if(e?.aborted)throw $t(e);await new Promise((t,n)=>{let i=()=>{clearTimeout(o),n($t(e));},o=setTimeout(()=>{e?.removeEventListener("abort",i),t();},r);e?.addEventListener("abort",i,{once:true});});}async function Cn(r,e){let t;try{t=await r.clone().json();}catch{}return (t?.code??t?.error?.code)===yn?new y("since_below_epoch_floor",t?.message):t?.code!==void 0&&t.error===void 0?await e(new Response(JSON.stringify({error:t}),{status:r.status,headers:{"content-type":"application/json"}})):await e(r)}function xn(r){let e=r;return typeof e?.url=="string"&&e.url!==""&&typeof e.expiresAt=="number"&&typeof e.atRepoSeq=="number"&&typeof e.recordCount=="number"&&typeof e.contentSha256=="string"}async function On(r){let e;try{e=await r.json();}catch{throw new y("header_invalid","Repository export redemption did not return a JSON download envelope")}if(!xn(e))throw new y("header_invalid","Repository export download envelope must carry url, expiresAt, atRepoSeq, recordCount, and contentSha256");return e}function En(r,e){let t=r.header?.atRepoSeq;if(t!==e.atRepoSeq)throw new y("fence_mismatch",`Repository export download is pinned to ${t}; the redemption named ${e.atRepoSeq}`);if(r.rowCount!==e.recordCount)throw new y("count_mismatch",`Repository export download carried ${r.rowCount} rows; the redemption named ${e.recordCount}`);if(r.contentSha256!==e.contentSha256)throw new y("digest_mismatch","Repository export download digest does not match the digest the redemption named")}function Fe(r,e,t=(n,i)=>globalThis.fetch(n,i)){let n=async(a,c)=>{let p=await r(a,{method:"GET",headers:{accept:R},...c?{signal:c}:{}});if(!p.ok&&p.status!==202)throw await Cn(p,e);return p},i=async(a,c,p={})=>{let m=await(await n(He(a,c,{mode:p.mode??"heads",sinceRepoSeq:p.sinceRepoSeq,atRepoSeq:p.atRepoSeq,prefer:"async"}),p.signal)).json();if(typeof m.exportToken!="string"||typeof m.atRepoSeq!="number")throw new y("header_invalid","Repository export async request did not return an exportToken and atRepoSeq");return {exportToken:m.exportToken,atRepoSeq:m.atRepoSeq}};return {prepare:i,stream:(a,c,p={})=>{let l=p.session?.lastDurableId??p.afterDurableId;if(l!==void 0&&(p.token!==void 0||p.session?.token!==void 0||p.prefer==="async"))throw new y("header_invalid",`Repository export token download cannot continue from '${l}': redemption returns the whole prepared object. Start a new session and redeem the token again.`);if(p.afterDurableId!==void 0&&p.session?.header===void 0)throw new y("header_invalid","Repository export afterDurableId needs a session carrying the opening header; reuse the session the broken stream wrote, or rebuild one with restoreRepositoryExportSession");return s(a,c,p)}};async function*s(a,c,p){let l=p.session??B(),m=l.header,g=p.signal,h={mode:m?.mode??p.mode??"heads",sinceRepoSeq:m?.sinceRepoSeq??p.sinceRepoSeq,atRepoSeq:m?.atRepoSeq??p.atRepoSeq,afterDurableId:l.lastDurableId??p.afterDurableId},O={repo:`${a}/${c}`,mode:h.mode,...p.sinceRepoSeq===void 0?{}:{sinceRepoSeq:p.sinceRepoSeq},...p.atRepoSeq===void 0?{}:{atRepoSeq:p.atRepoSeq}};if(p.token!==void 0&&l.token!==void 0&&p.token!==l.token)throw new y("header_invalid",`Repository export session was redeeming token ${l.token}; resuming it with token ${p.token} would splice two exports`);let R=p.token??l.token;if(R!==void 0){l.token=R,yield*E(R);return}if(p.prefer==="async"){let v=await i(a,c,{mode:h.mode,...h.sinceRepoSeq===void 0?{}:{sinceRepoSeq:h.sinceRepoSeq},...h.atRepoSeq===void 0?{}:{atRepoSeq:h.atRepoSeq},...g?{signal:g}:{}});l.token=v.exportToken,yield*E(v.exportToken);return}let b=await n(He(a,c,h),g);if(!b.body)throw new y("truncated");yield*Y(b.body,l,O,{resumed:h.afterDurableId!==void 0});async function*E(v){for(let I=1;;I+=1){let te=await P(v);try{yield*S(te);return}catch(ve){if(!(!(ve instanceof y)||ve.reason==="truncated")||l.rowCount>0||I>=bn||g?.aborted===true)throw ve}}}async function*S(v){let I=await t(v.url,g?{signal:g}:{});if(!I.ok||!I.body)throw await I.body?.cancel(),new y("truncated",`Repository export download returned HTTP ${I.status}`);yield*Y(I.body,l,O,{resumed:false}),En(l,v);}async function P(v){let I=He(a,c,{token:v});for(;;){let te=await n(I,g);if(te.status!==202)return await On(te);await wn(Sn(p.pollIntervalMs),g);}}}}function J(r,e,t){let n=Y$1(e,t==="revise"?{allowUnsafeFieldNamePaths:X$1(e)}:void 0);return n.valid?null:`Invalid shape definition for "${r}": ${n.errors.join("; ")}`}function In(r,e,t){let n=r.operation===void 0||r.operation==="noop"?t?.operation??"add":r.operation,i={opIndex:e,name:r.name??"",operation:n,...r.affirmations?{affirmations:r.affirmations}:{},...r.resolvedName!==void 0?{resolvedName:r.resolvedName}:{},...r.warnings?{warnings:r.warnings}:{}};return r.status==="failed"?{...i,status:"error",errors:[{code:r.error?.code??"BACKEND",message:r.error?.message??`Operation on "${r.name}" failed`,...r.error?.details?{details:r.error.details}:{},...r.retryable!==void 0?{retryable:r.retryable}:{}}],...t?.name!==void 0?{submittedName:t.name}:{}}:{...i,status:r.status==="noop"||r.operation==="noop"?"noop":"applied",...r.version!==void 0?{version:r.version}:{},...r.dataHash!==void 0?{dataHash:r.dataHash}:{}}}var U=class{receipts=[];operations=[];statusCounts={applied:0,noop:0,error:0};get allFailed(){return this.operations.length>0&&this.statusCounts.error===this.operations.length}addChunk(e){if(e.result.schemaVersion==="operation-event-receipt/v2"){e.result.results.forEach(t=>{this.statusCounts[t.status]++,this.operations.push({...t,opIndex:e.chunkStart+t.opIndex});});return}e.result.results.forEach((t,n)=>{let i=t.opIndex??n,o=e.submittedOperations[i],s=In(t,e.chunkStart+i,o);this.statusCounts[s.status]++,this.operations.push(s);});}addReceipt(e){this.receipts.push(e);}completedOperations(){return this.operations.filter(e=>e.status!=="error")}toResult(e){let t=this.statusCounts.error>0;return {...e.committer!==void 0?{committer:e.committer}:{},...e.createdByEmail!==void 0?{createdByEmail:e.createdByEmail}:{},message:e.message,operationCount:this.operations.length,...e.repoSeq!==void 0?{repoSeq:e.repoSeq}:{},...t?{partial:t,statusCounts:{...this.statusCounts}}:{},operations:this.operations,receipts:this.receipts}}};function V(){let r=globalThis.crypto?.randomUUID?.();if(!r)throw new Error("This runtime cannot mint a cryptographically secure UUID");return r.toLowerCase()}var An=V;var me=1e3,ge=1e4,A=class extends Error{code="PARTIAL_STREAM_SUBMISSION";completedReceipts;completedOperations;submissionId;eventRequestId;chunkOrdinal;pendingOutcome;acknowledgedOperationCount;lastAcknowledgedRepoSeq;attemptedAppendOutcome;cause;constructor(e){super(e.pendingOutcome==="unknown"?`Stream submission outcome is unknown for event request ${e.eventRequestId}. Look up its immutable receipt before retrying.`:`Stream submission stopped at event request ${e.eventRequestId} after earlier chunks committed.`),this.name="WarmHubError",this.cause=e.cause,this.completedReceipts=e.completedReceipts,this.completedOperations=e.completedOperations??[],this.submissionId=e.submissionId,this.eventRequestId=e.eventRequestId,this.chunkOrdinal=e.chunkOrdinal,this.pendingOutcome=e.pendingOutcome,this.acknowledgedOperationCount=e.acknowledgedOperationCount??e.completedReceipts.length,this.attemptedAppendOutcome=e.attemptedAppendOutcome,e.lastAcknowledgedRepoSeq!==void 0&&(this.lastAcknowledgedRepoSeq=e.lastAcknowledgedRepoSeq);}},_=class extends Error{code="STREAM_ALL_OPERATIONS_FAILED";receipts;result;operations;statusCounts;cause;constructor(e){let t=e.operations.find(n=>n.status==="error")?.errors[0];super(t?`All ${e.operationCount} stream operations failed: ${t.message}`:`All ${e.operationCount} stream operations failed.`),this.name="WarmHubError",this.cause=t,this.result=e,this.receipts=e.receipts,this.operations=e.operations,this.statusCounts=e.statusCounts??{applied:0,noop:0,error:e.operationCount};}};function We(r){let e="status"in r?r.status:void 0;return e==="failed"||e==="error"?"error":e==="noop"||r.operation==="noop"?"noop":"applied"}function zt(r){let e={applied:0,noop:0,error:0};for(let t of r)e[We(t)]++;return e}var vn={maxAttempts:3,baseDelayMs:250,maxDelayMs:8e3},kn=10,Gt=6e4;function $e(r){if(r===false)return false;let e={};r!==void 0&&(Number.isFinite(r.maxAttempts)&&(e.maxAttempts=r.maxAttempts),Number.isFinite(r.baseDelayMs)&&(e.baseDelayMs=r.baseDelayMs),Number.isFinite(r.maxDelayMs)&&(e.maxDelayMs=r.maxDelayMs));let t={...vn,...e};return {maxAttempts:Math.min(kn,Math.max(1,Math.trunc(t.maxAttempts))),baseDelayMs:Math.min(Gt,Math.max(0,Math.trunc(t.baseDelayMs))),maxDelayMs:Math.min(Gt,Math.max(0,Math.trunc(t.maxDelayMs)))}}var Tn=new Set(["BAD_REQUEST","METHOD_NOT_SUPPORTED","PARSE_ERROR","PAYLOAD_TOO_LARGE","PRECONDITION_FAILED","UNAUTHORIZED","UNPROCESSABLE_CONTENT","UNSUPPORTED_MEDIA_TYPE","UNAUTHENTICATED","FORBIDDEN","VALIDATION_ERROR","SHAPE_MISMATCH","RESERVED_NAME","ILLEGAL_OP_SEQUENCE","NOT_FOUND","KIND_MISMATCH","CONFLICT","ALREADY_RETRACTED","ARCHIVED","RATE_LIMITED","TOO_MANY_REQUESTS","UNRESOLVED_TOKEN"]),_n=new Set(["COMMIT_OUTCOME_UNKNOWN"]);function jt(r){if(!r||typeof r!="object")return;let e=r.code;if(typeof e=="string")return e;let t=r.data,n=t?.warmhub?.code;if(typeof n=="string")return n;let i=t?.code;if(typeof i=="string")return i}function Nn(r){if(!r||typeof r!="object")return;let e=r.data?.httpStatus;if(typeof e=="number")return e;let t=r.data?.warmhub?.status;if(typeof t=="number")return t;let n=r.status;return typeof n=="number"?n:void 0}function Pn(r){return r!==void 0&&r>=400&&r<500&&r!==408}function Yt(r){let e=jt(r);return e!==void 0&&_n.has(e)}function Q(r){if(Yt(r))return false;let e=jt(r);return e!==void 0&&Tn.has(e)||Pn(Nn(r))}function Ge(r){if(Yt(r)||Q(r))return false;if(Kt(r))return true;if(r instanceof TypeError||r instanceof SyntaxError)return false;let e=r?.cause;return Kt(e)?true:!(e instanceof TypeError||e instanceof SyntaxError)}function Kt(r){return r instanceof TypeError&&/fetch/i.test(r.message)}function Ke(r,e){let t=e.baseDelayMs*2**Math.max(0,r-1),n=Math.random()*e.baseDelayMs;return Math.min(e.maxDelayMs,t+n)}function ze(r){return new Promise(e=>setTimeout(e,r))}var X=class extends Error{code;status=400;constructor(e,t="VALIDATION_ERROR"){super(e),this.code=t,this.name="WarmHubError";}},he=class extends Error{constructor(t){super("operation source failed");this.reason=t;}reason};async function H(r,e){let t=fe(e.chunkSize),n=e.submissionId??V(),i=e.streamId??n,o=$e(e.retry),s=new U,a=[],c,p,l=0,m,g=0,h=R=>new A({cause:R.cause,completedReceipts:s.receipts,completedOperations:s.completedOperations(),acknowledgedOperationCount:l,lastAcknowledgedRepoSeq:m,attemptedAppendOutcome:R.pendingOutcome==="absent"?"not_applied":"unknown",submissionId:n,eventRequestId:C$1(n,g),chunkOrdinal:g,pendingOutcome:R.pendingOutcome});try{for await(let R of Dn(e.operations,t,e.skipExisting===!0)){let b=1,E=!1;for(;;)try{let S=await r.stream.append({allocatedTokenRanges:a,chunkOrdinal:g,orgName:e.orgName,repoName:e.repoName,streamId:i,submissionId:n,componentRef:e.componentRef,committer:e.committer,message:e.message,...e.returnRepoSeq!==void 0?{returnRepoSeq:e.returnRepoSeq}:{},operations:R.operations});s.addReceipt(S.receipt),a=S.allocatedTokenRanges,c=S.createdByEmail??c,p=S.repoSeq??p,s.addChunk({result:S,chunkStart:R.start,submittedOperations:R.operations}),l+=R.operations.length;let P=qn(S.receipt);P!==void 0&&(m=P);break}catch(S){let P=Q(S);if(s.receipts.length===0&&!E&&P)throw S;if(o!==!1&&b<o.maxAttempts&&Ge(S)){await ze(Ke(b,o)),b+=1,E=!0;continue}throw h({cause:S,pendingOutcome:E||!P?"unknown":"absent"})}g+=1;}}catch(R){throw R instanceof he?s.receipts.length===0?R.reason:h({cause:R.reason,pendingOutcome:"absent"}):R}if(g===0)throw new X("At least one operation is required for stream submission.");let O=s.toResult({committer:e.committer,createdByEmail:c,message:e.message,repoSeq:p});if(s.allFailed)throw new _(O);return O}async function*Dn(r,e,t){try{if(Array.isArray(r)){let o=r.map((s,a)=>je(s,a,t));Xt(o,0);for(let s=0;s<o.length;s+=e)yield {operations:o.slice(s,s+e),start:s};return}let n=0,i=[];for await(let o of Qt(r,t))i.push(o),n+=1,!(i.length<e)&&(yield Jt(i,n),i=[]);i.length>0&&(yield Jt(i,n));}catch(n){throw new he(n)}}function Jt(r,e){let t=e-r.length;return Xt(r,t),{operations:r,start:t}}function je(r,e,t){let n;try{n=D(r);}catch(i){let o=i instanceof Error?i.message:String(i);throw new X(`Invalid operation at index ${e}: ${o}`)}return t&&n.operation==="add"?{...n,skipExisting:true}:n}async function*Qt(r,e){let t=ye(r,e);try{for(;;){let n=await t.next();if(n.done)return;yield n.value;}}finally{let n=t.returnSourceOnce();n&&await n;}}function ye(r,e){let t,n=0,i=false,o=false,s=()=>t||(t=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator](),t);return {async next(){let a=await s().next();if(a.done)return o=true,{done:true,value:void 0};let c=je(a.value,n,e);return n+=1,{done:false,value:c}},returnSourceOnce(){if(!i&&(i=true,!o))return t?.return?.()}}}function Ye(r){return Ln.encode(`${JSON.stringify(r)}
2
+ `)}var Ln=new TextEncoder;function qn(r){let e=r.event?.repoSeq;if(e===void 0)return;let t=Number(e);return Number.isSafeInteger(t)?t:void 0}function Xt(r,e){let t=F$1(r).find(n=>!Mn(n));if(t)throw new X(`Invalid operation at index ${e+t.operationIndex}: ${t.message}`,t.code)}function Mn(r){return r.code==="ILLEGAL_OP_SEQUENCE"&&r.message.includes("Cannot revise then add ")}function fe(r){return Number.isFinite(r)?Math.max(1,Math.min(ge,Math.trunc(r))):me}var tr="warmhub/streaming-submission-manifest/v1",Bn=new TextEncoder,Qe=z$1.string().regex(/^sha256:[0-9a-f]{64}$/),rr={type:z$1.literal("result"),chunkOrdinal:z$1.number().int().nonnegative(),opIndex:z$1.number().int().nonnegative(),submissionIndex:z$1.number().int().nonnegative(),name:z$1.string()},Un=z$1.enum(j$1),Vn=z$1.enum([...j$1,"noop"]),nr=z$1.object({path:z$1.string(),message:z$1.string()}),ir=z$1.object({undeclaredFields:z$1.array(z$1.string()).optional(),undeclaredFieldsTruncated:z$1.literal(true).optional(),totalUndeclared:z$1.number().int().nonnegative().optional(),coalescedWrefs:z$1.array(z$1.object({fieldPath:z$1.string(),wref:z$1.string(),reason:z$1.string()})).optional(),coalescedWrefsTruncated:z$1.literal(true).optional(),totalCoalescedWrefs:z$1.number().int().nonnegative().optional(),deprecations:z$1.array(z$1.object({shape:z$1.string(),message:z$1.string(),removalMilestone:z$1.string()})).optional()}).optional(),or=z$1.object({added:z$1.array(z$1.string()),removed:z$1.array(z$1.string()),ignored:z$1.array(z$1.string())}),Hn=z$1.discriminatedUnion("reason",[z$1.object({reason:z$1.literal("expected_version_mismatch"),expectedVersion:z$1.number().int().positive(),currentVersion:z$1.number().int().positive()}),z$1.object({reason:z$1.literal("lease_held"),leaseExpiresAt:z$1.string().datetime()}),z$1.object({reason:z$1.literal("validation_failed"),issues:z$1.array(nr)}),z$1.object({reason:z$1.literal("rate_limit_reset"),retryAfterSeconds:z$1.number().int().positive(),resetAt:z$1.string().datetime()}),z$1.object({reason:z$1.literal("cursor_fence_unavailable"),cause:z$1.enum(["not_ready","below_floor","above_head"]),retryFromStart:z$1.literal(true)})]),Fn=z$1.discriminatedUnion("reason",[z$1.object({reason:z$1.literal("expected_version_mismatch"),expectedVersion:z$1.number().int().nonnegative(),currentVersion:z$1.number().int().nonnegative()}).strict(),z$1.object({reason:z$1.literal("lease_held"),leaseExpiresAt:z$1.string().datetime()}).strict(),z$1.object({reason:z$1.literal("validation_failed"),issues:z$1.array(nr.strict())}).strict(),z$1.object({reason:z$1.literal("rate_limit_reset"),retryAfterSeconds:z$1.number().nonnegative(),resetAt:z$1.string().datetime()}).strict(),z$1.object({reason:z$1.literal("cursor_fence_unavailable"),cause:z$1.enum(["not_ready","below_floor","above_head"]),retryFromStart:z$1.literal(true)}).strict(),z$1.object({reason:z$1.literal("dependency_failed"),producerOpIndexes:z$1.array(z$1.number().int().nonnegative()).min(1)}).strict()]),Zt={...rr,operation:Un,submittedName:z$1.string().optional(),resolvedName:z$1.string().optional(),warnings:ir,affirmations:or.optional()},Wn=z$1.union([z$1.object({...rr,operation:Vn.optional(),version:z$1.number().optional(),dataHash:z$1.string().optional(),status:z$1.enum(["success","noop","failed"]).optional(),error:z$1.object({code:z$1.string(),message:z$1.string(),details:Hn.optional()}).optional(),resolvedName:z$1.string().optional(),retryable:z$1.boolean().optional(),warnings:ir,affirmations:or.optional()}).passthrough(),z$1.object({...Zt,status:z$1.enum(["applied","noop"]),version:z$1.number().int().positive().optional(),dataHash:z$1.string().min(1).optional()}).passthrough(),z$1.object({...Zt,status:z$1.literal("error"),errors:z$1.array(z$1.object({code:z$1.string().min(1),message:z$1.string(),path:z$1.string().min(1).optional(),details:Fn.optional(),retryable:z$1.boolean().optional()}).strict()).min(1)}).passthrough()]),sr=z$1.object({applied:z$1.number().int().nonnegative(),noop:z$1.number().int().nonnegative(),failed:z$1.number().int().nonnegative()}),$n=z$1.object({type:z$1.literal("group"),chunkOrdinal:z$1.number().int().nonnegative(),eventRequestId:z$1.string().uuid(),requestDigest:Qe,outcome:z$1.enum(["event","no_event"]),repoSeq:z$1.number().int().nonnegative().optional(),operations:sr,manifestDigest:Qe}).passthrough(),Gn=z$1.object({type:z$1.literal("summary"),submissionId:z$1.string().uuid(),streamId:z$1.string().min(1),groupSize:z$1.number().int().positive(),groups:z$1.number().int().nonnegative(),operations:sr.extend({total:z$1.number().int().nonnegative()}),repoSeq:z$1.object({first:z$1.number().int().nonnegative().nullable(),last:z$1.number().int().nonnegative().nullable()}),verdict:z$1.string().min(1),durationMs:z$1.number().nonnegative(),truncatedAt:z$1.object({lineNumber:z$1.number().int().positive(),message:z$1.string()}).optional(),manifest:z$1.object({groups:z$1.number().int().nonnegative(),digest:Qe})}).passthrough(),Kn=z$1.object({type:z$1.literal("error"),code:z$1.string().min(1),message:z$1.string().optional()}).passthrough(),zn=z$1.union([Wn,$n,Gn,Kn]),Je=()=>({applied:0,noop:0,failed:0}),er=(r,e)=>r.applied===e.applied&&r.noop===e.noop&&r.failed===e.failed,jn=new Set(["complete","operation-limit-reached","group-limit-reached"]),T=class extends Error{constructor(t,n){super(`Streaming submission protocol error at row ${n}: ${t}`);this.rowIndex=n;this.name="StreamingSubmissionProtocolError";}rowIndex};async function ar(r){let e=Bn.encode(r),t=await globalThis.crypto.subtle.digest("SHA-256",e);return `sha256:${Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("")}`}async function Yn(r,e,t){return ar(`${tr}\0${r}\0${e}\0${t}`)}function Jn(r){return r.status==="failed"||r.status==="error"?"failed":r.status==="noop"||r.operation==="noop"?"noop":"applied"}var Xe=class{index=0;groupCount=0;resultCount=0;pendingCount=0;pendingCounts=Je();totalCounts=Je();firstRepoSeq=null;lastRepoSeq=null;manifestDigest=ar(tr);terminalSeen=false;accept(e){let t=n=>{throw new T(n,this.index)};if(this.terminalSeen&&t("No row may follow the terminal row"),e.type==="result"){e.chunkOrdinal!==this.groupCount&&t(`Expected result chunkOrdinal ${this.groupCount}`),e.opIndex!==this.pendingCount&&t(`Expected result opIndex ${this.pendingCount}`),e.submissionIndex!==this.resultCount&&t(`Expected submissionIndex ${this.resultCount}`);let n=Jn(e);this.pendingCounts[n]+=1,this.totalCounts[n]+=1,this.pendingCount+=1,this.resultCount+=1,this.index+=1;return}if(e.type==="group")return e.chunkOrdinal!==this.groupCount&&t(`Expected group chunkOrdinal ${this.groupCount}`),this.pendingCount===0&&t("A group must close result rows"),er(this.pendingCounts,e.operations)||t("Group operation counters do not match its result rows"),this.acceptGroup(e,t);if(this.terminalSeen=true,this.pendingCount>0&&t("Terminal row cannot close a partial group"),e.type==="summary")return this.acceptSummary(e,t);this.index+=1;}async acceptGroup(e,t){this.manifestDigest=this.manifestDigest.then(n=>Yn(n,e.chunkOrdinal,e.requestDigest)),e.manifestDigest!==await this.manifestDigest&&t("Group manifest digest does not match the receipt chain"),e.repoSeq!==void 0&&(this.firstRepoSeq??=e.repoSeq,this.lastRepoSeq=e.repoSeq),this.groupCount+=1,this.pendingCount=0,this.pendingCounts=Je(),this.index+=1;}async acceptSummary(e,t){er(this.totalCounts,e.operations)||t("Summary operation counters do not match result rows"),(e.groups!==this.groupCount||e.manifest.groups!==this.groupCount)&&t("Summary group counters do not match group rows"),e.manifest.digest!==await this.manifestDigest&&t("Summary manifest digest does not match the receipt chain"),(e.repoSeq.first!==this.firstRepoSeq||e.repoSeq.last!==this.lastRepoSeq)&&t("Summary repo sequence does not match group rows"),(jn.has(e.verdict)?e.operations.total!==this.resultCount:e.operations.total<this.resultCount)&&t("Summary total is incompatible with its verdict"),e.verdict==="truncated-by-parse-error"!=(e.truncatedAt!==void 0)&&t("truncatedAt must appear only for a parse-truncated verdict"),this.index+=1;}finish(){if(!this.terminalSeen)throw new T("Response must end with a summary or error row",this.index)}};function Qn(r,e){let t;try{t=JSON.parse(r);}catch(i){throw new T(i instanceof Error?i.message:"Invalid JSON",e)}let n=zn.safeParse(t);if(!n.success)throw new T(n.error.issues[0]?.message??"Malformed row",e);return n.data}async function*cr(r,e){let t=r.body?.getReader();if(!t)throw new T("Missing response body",0);let n=new Xe,i=new TextDecoder,o="",s=0,a=false,c,p=m=>{if(m.endsWith("\r")&&(m=m.slice(0,-1)),m.length===0)throw new T("Blank response row",s);let g=Qn(m,s);return {pending:n.accept(g),row:g}},l=m=>{if(m.type==="summary"&&e!==void 0&&(m.submissionId!==e.submissionId||m.streamId!==e.streamId||m.groupSize!==e.groupSize))throw new T("Summary identity does not match the submission handle",s);s+=1;};try{for(;;){let{done:m,value:g}=await t.read();if(m)break;for(o+=i.decode(g,{stream:!0});;){let h=o.indexOf(`
3
+ `);if(h===-1)break;let O=o.slice(0,h);o=o.slice(h+1);let{pending:R,row:b}=p(O);R&&await R,l(b),b.type==="summary"||b.type==="error"?c=b:yield b;}}if(o+=i.decode(),o.length>0){let{pending:m,row:g}=p(o);m&&await m,l(g),g.type==="summary"||g.type==="error"?c=g:yield g;}n.finish(),a=!0,c&&(yield c);}finally{a||await t.cancel().catch(()=>{}),t.releaseLock();}}var N=class extends Error{code="STREAMING_SUBMISSION_OUTCOME_UNKNOWN";outcome="unknown";retryable=false;retryIdentity;cause;constructor(e,t){super(`Streaming submission outcome is unknown for ${e.submissionId}. Reconstruct the original source and copy every retryIdentity field into the next applyStreaming call.`),this.name="StreamingSubmissionOutcomeUnknownError",this.retryIdentity=e,this.cause=t;}};function Re(r){return r===void 0||r===""?void 0:r}function Xn(){let r=globalThis;if(r.Bun!==void 0)return true;let e=r.process?.versions?.node;if(!e)return false;let[t=0,n=0]=e.split(".").map(Number);return t>22||t===22&&n>=2}function Zn(r){let e=new URLSearchParams({submissionId:r.submissionId,groupSize:String(r.groupSize)});return r.message!==void 0&&e.set("message",r.message),r.committer!==void 0&&e.set("committer",r.committer),`/api/repos/${encodeURIComponent(r.orgName)}/${encodeURIComponent(r.repoName)}/streams/${encodeURIComponent(r.streamId)}/submissions?${e}`}function ei(r){let e=ye(r,false),t=false,n=()=>{if(t)return;t=true;let o=e.returnSourceOnce();o&&Promise.resolve(o).catch(()=>{});};return {stream:new ReadableStream({async pull(o){try{let s=await e.next();if(t)return;if(s.done){o.close();return}o.enqueue(Ye(s.value));}catch(s){o.error(s),n();}},cancel(){n();}}),returnSourceOnce:n}}function ti(r,e){if(!r)return ()=>{};let t=()=>e.abort(r.reason);return r.aborted?t():r.addEventListener("abort",t,{once:true}),()=>r.removeEventListener("abort",t)}function ri(r){let e=r.options?.submissionId??V();return {orgName:r.orgName,repoName:r.repoName,streamId:r.options.streamId,submissionId:e,groupSize:fe(r.options.groupSize),...Re(r.message)!==void 0?{message:Re(r.message)}:{},...Re(r.options?.committer)!==void 0?{committer:Re(r.options?.committer)}:{}}}function pr(r,e){if(!r.options.streamId)throw e.localError("VALIDATION_ERROR","Streaming submissions require a non-empty streamId.");let t=ri(r),n=new AbortController,i=()=>{},o,s=false,a=async function*(){let c=false,p=false,l;try{if(!(e.runtimeSupported??Xn)())throw e.localError("VALIDATION_ERROR","Streaming submissions require Bun or Node.js 22.2 or newer.");if(i=ti(r.options.signal,n),n.signal.aborted)throw e.localError("CANCELLED","Streaming submission was aborted.");let m=await e.prepare(Zn(t));if(n.signal.aborted)throw e.localError("CANCELLED","Streaming submission was aborted.");l=ei(r.operations),c=!0;let g=await m.dispatch(l.stream,n.signal);if(!g.ok)throw p=!0,await m.httpError(g);for await(let h of cr(g,t))yield h;}catch(m){throw m instanceof N?m:c&&!p?new N(t,m):e.normalizeLocalError(m)}finally{n.abort(),l?.returnSourceOnce(),i(),s=true;}};return {retryIdentity:t,[Symbol.asyncIterator](){return this},next(){return s?Promise.resolve({done:true,value:void 0}):(o??=a(),o.next())},async return(c){return n.abort(),o?o.return(c):(s=true,i(),{done:true,value:c})},async throw(c){if(n.abort(c),!o)throw s=true,i(),c;return o.throw(c)}}}var ni="0.0.0-development";function F(r){return r===ni}var Ze="0.108.0";var ur=1;function ii(r){return r===g?"Run: wh update --yes":r===f$1?"Run: npm install @warmhub/sdk-ts@latest (or your package manager's equivalent).":r===h?"Run: pip install --upgrade warmhub":`Deploy a released ${r} build that satisfies the backend compatibility contract.`}function dr(r,e){if(typeof r?.minSupportedClients!="object"||r.minSupportedClients===null||!Number.isSafeInteger(r.writeContractVersion)||r.writeContractVersion<1)return {message:"The backend does not advertise valid per-client write compatibility data.",hint:"Upgrade the WarmHub backend before retrying this write."};let t=r.minSupportedClients[e.name],n=typeof t=="string"?u(t):null;if(!n)return {message:`The backend does not advertise a valid compatibility floor for ${e.name}.`,hint:"Upgrade the WarmHub backend or register this first-party client family before writing."};if(!F(e.version)){let i=u(e.version);if(!i)return {message:`${e.name} reported malformed version "${e.version}".`,hint:"Use a released WarmHub client with a SemVer package version."};if(v(i,n)<0)return {message:`${e.name} ${e.version} is older than the backend's minimum supported version ${n}.`,hint:ii(e.name)}}if(r.writeContractVersion<ur)return {message:`${e.name} requires write contract ${ur}, but the backend provides ${r.writeContractVersion}.`,hint:"Upgrade the WarmHub backend before retrying this write."}}function et(r,e){try{return new URL(r).origin===new URL(e).origin}catch{return false}}var oi=new Set(["GET","POST","PUT","PATCH","DELETE"]),x=class extends Error{reason;constructor(e,t){super(t),this.name="CliCallVerificationError",this.reason=e;}};async function si(r$1,e,t){let n$1=r$1.method.toUpperCase();if(!oi.has(n$1))throw new x("unsupported-method",`Unsupported HTTP method "${r$1.method}" \u2014 component CLI dispatch only emits GET, POST, PUT, or PATCH`);let i=n$1,o$1=r$1.headers.get(n);if(!o$1)throw new x("missing-install-repo",`Missing ${n} header`);let s=W(e.CLI_SIGNING_SECRET),a=W(e.CLI_BEARER_TOKEN),c=W(e.CLI_API_KEY),p$1=W(e.CLI_BASIC_USERNAME)&&W(e.CLI_BASIC_PASSWORD);if(!s&&!a&&!c&&!p$1)throw new x("no-scheme-configured","no-scheme-configured: need at least one of CLI_SIGNING_SECRET, CLI_BEARER_TOKEN, CLI_API_KEY, or CLI_BASIC_USERNAME + CLI_BASIC_PASSWORD");if(a&&p$1)throw new x("no-scheme-configured","unsupported-scheme-combination: CLI_BEARER_TOKEN and CLI_BASIC_USERNAME + CLI_BASIC_PASSWORD both use the Authorization header and cannot be configured together");let l=new URL(r$1.url),m=l.pathname,g,h,O;if(q(i)?g={}:(g=Object.fromEntries(l.searchParams.entries()),h="",O={...g}),s){let R=r$1.headers.get(o);if(!R)throw new x("missing-signature",`Missing ${o} header`);let b=r$1.headers.get(p);if(!b)throw new x("missing-timestamp",`Missing ${p} header`);let E=Number(b);if(!Number.isFinite(E)||!Number.isInteger(E))throw new x("invalid-timestamp",`${p} must be an integer unix seconds value; got "${b}"`);h=await lr(r$1,i,h);let S=await r({secret:e.CLI_SIGNING_SECRET,method:i,path:m,query:g,installRepo:o$1,body:h,signature:R,timestamp:E,nowUnixSeconds:t?.nowUnixSeconds??Math.floor(Date.now()/1e3),toleranceSec:t?.toleranceSec});if(!S.ok)throw new x(S.reason,`HMAC verification failed: ${S.reason}`)}if(a){let R=`Bearer ${e.CLI_BEARER_TOKEN}`,b=r$1.headers.get("authorization")??"";if(!await tt(b,R))throw new x("invalid-bearer","invalid-bearer: bearer token mismatch")}if(c){let R=W(e.CLI_API_KEY_HEADER)?e.CLI_API_KEY_HEADER:"X-API-Key",b=r$1.headers.get(R)??"";if(!await tt(b,e.CLI_API_KEY))throw new x("invalid-api-key",`invalid-api-key: mismatch on header "${R}"`)}if(p$1){let R=`Basic ${btoa(`${e.CLI_BASIC_USERNAME}:${e.CLI_BASIC_PASSWORD}`)}`,b=r$1.headers.get("authorization")??"";if(!await tt(b,R))throw new x("invalid-basic","invalid-basic: basic auth mismatch")}return O===void 0&&(h=await lr(r$1,i,h),O=ai(h)),{method:i,installRepo:o$1,args:O}}async function lr(r,e,t){return q(e)?t!==void 0?t:r.text():""}function ai(r){let e;try{e=JSON.parse(r);}catch{throw new x("invalid-body","POST body is not valid JSON")}if(!ci(e))throw new x("invalid-body","POST body must be a JSON object of primitive args (string / number / boolean)");return e}function W(r){return typeof r=="string"&&r.length>0}function ci(r){if(typeof r!="object"||r===null||Array.isArray(r))return false;for(let e of Object.values(r))if(e!==void 0&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean")return false;return true}async function tt(r,e){let[t,n]=await Promise.all([mr(r),mr(e)]),i=0;for(let o=0;o<t.length;o++)i|=t[o]^n[o];return i===0}async function mr(r){return new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(r)))}function nt(r){if(r.includes("/"))return r.split("/")[0]}function hr(r){if("shapeWref"in r&&typeof r.shapeWref=="string")return r.shapeWref;if(r.name)return nt(r.name)}function rt(r){if(typeof r!="string")return;let e=r.trim();return e.length>0?e:void 0}function $(r){return m({kind:r.kind,name:r.name,about:we(r),type:be(r),members:Se(r)})}function we(r){if("about"in r&&r.about!==void 0)return r.about;if("aboutWref"in r)return r.aboutWref}function it(r){return "data"in r?r.data:void 0}function be(r){return "type"in r?r.type:void 0}function Se(r){return "members"in r?r.members:void 0}function Z(r,e){return m({kind:r.kind,name:e})}function gr(r){return r.data??{}}function yr(r){if(r.operation==="retract")return D(r);if(r.operation==="reaffirm")return D({operation:"reaffirm",name:r.name,...r.expectedVersion!==void 0?{expectedVersion:r.expectedVersion}:{},...r.kind?{kind:r.kind}:{},...r.add?{add:[...r.add]}:{},...r.remove?{remove:[...r.remove]}:{},...r.leaseId?{leaseId:r.leaseId}:{}});if(r.operation==="add"){let n=$(r);if(n==="collection")return z(r,"OperationBuilder");let i=r,o=gr(i),s=rt(i.name);if(!s)throw new Error("OperationBuilder: add operation missing name");if(n==="assertion"){let a=we(i);if(a===void 0)throw new Error(`OperationBuilder: assertion add '${s}' missing required 'about'`);if(typeof a!="string")throw new Error(D$1);return {operation:"add",kind:n,name:s,about:a,data:o,...i.affirmedTargets?{affirmedTargets:[...i.affirmedTargets]}:{},...i.skipExisting===true?{skipExisting:true}:{}}}return {operation:"add",kind:n,name:s,data:o,...i.skipExisting===true?{skipExisting:true}:{}}}let e=rt(r.name)??rt(r.wref);if(!e)throw new Error("OperationBuilder: revise operation missing required target ('name' or 'wref')");let t=Z(r,e);if(t==="collection")return de({...r,name:e},"OperationBuilder");if(t==="assertion")return {operation:"revise",kind:t,name:e,data:r.data??{},...r.affirmedTargets?{affirmedTargets:[...r.affirmedTargets]}:{},...r.expectedVersion!==void 0?{expectedVersion:r.expectedVersion}:{},...r.leaseId?{leaseId:r.leaseId}:{}};if(r.affirmedTargets!==void 0)throw new Error(`OperationBuilder: REVISE '${e}' has affirmedTargets but inferred kind '${t}' \u2014 affirmedTargets applies only to assertions; set kind: 'assertion'`);return {operation:"revise",kind:t,name:e,data:gr(r),...r.expectedVersion!==void 0?{expectedVersion:r.expectedVersion}:{},...r.leaseId?{leaseId:r.leaseId}:{}}}function L(r,e){return r.operation==="add"?{operation:r.operation,kind:e,name:r.name,about:we(r),type:be(r),members:Se(r)}:{operation:r.operation,kind:e,name:r.name??r.wref,type:be(r),members:Se(r)}}function fr(r){if(r.length!==0)throw new Error(r.join("; "))}function Rr(r,e,t,n){let i=[];if((e==="thing"||e==="assertion"||e==="collection"&&r==="REVISE")&&(l(t)||i.push(`${r} ${e} name must be a local path (Shape/name), got: "${t}"`)),e==="shape"&&(r==="ADD"||r==="REVISE")&&n!==void 0){let s=J(t,n,r==="REVISE"?"revise":"add");s&&i.push(s);}return i}function br(r,e){let t=[];if(r.name&&t.push(...Rr("ADD",e,r.name,it(r))),e==="assertion"&&we(r)===void 0&&t.push(`ADD assertion '${r.name}' missing required 'about' \u2014 for hierarchical thing names set kind: 'thing' explicitly`),e!=="collection"&&(be(r)!==void 0||Se(r)!==void 0)&&t.push(`ADD '${r.name}' has collection fields but inferred kind '${e}' \u2014 collection adds require both 'type' and 'members', or set kind: 'collection'`),e!=="assertion"&&"affirmedTargets"in r&&r.affirmedTargets!==void 0&&t.push(`ADD '${r.name}' has affirmedTargets but inferred kind '${e}' \u2014 affirmedTargets applies only to assertions; set kind: 'assertion'`),e==="collection")try{z(r,"OperationBuilder");}catch(n){t.push(n instanceof Error?n.message:String(n));}for(let n of E(L(r,e),0))t.push(n.message);fr(t);}function Sr(r,e,t){let n=[];r!=="collection"&&t.data===void 0&&n.push(`OperationBuilder: ${r} revise requires 'data'`),r!=="assertion"&&t.affirmedTargets!==void 0&&n.push(`REVISE '${e}' has affirmedTargets but inferred kind '${r}' \u2014 affirmedTargets applies only to assertions; set kind: 'assertion'`),n.push(...Rr("REVISE",r,e,t.data),...E(L({...t,name:e},r),0).map(i=>i.message)),fr(n);}var Ce=class{ops=[];pendingNames=new Set;shapes;wrefToShape=new Map;submitted=false;inFlight=false;constructor(e){this.shapes=e?.shapes;}add(e){this.assertCanModify();let t={...e};delete t.operation;let n=hr(t),i=it(t);if(this.shapes&&n&&i!==void 0){let c=this.shapes[n];if(c){let p=Z$1(i,c);if(!p.valid)throw new Error(`Shape validation failed for '${t.name}' (shape: ${n}): ${p.errors.join("; ")}`)}}let o={operation:"add",...t},s=$(o);(o.name||s==="collection")&&br(o,s);let a=Object.freeze({operation:"add",...t});return this.ops.push(a),t.name&&(this.pendingNames.add(t.name),n&&this.wrefToShape.set(t.name,n)),this}revise(e){this.assertCanModify();let t={...e};delete t.operation;let n=t.name??t.wref;if(this.shapes&&n&&t.data!==void 0){let o=this.wrefToShape.get(n)??nt(n);if(o){let s=this.shapes[o];if(s){let a=Z$1(t.data,s);if(!a.valid)throw new Error(`Shape validation failed for revise '${n}' (shape: ${o}): ${a.errors.join("; ")}`)}}}if(n){let o=Z({...t},n);Sr(o,n,{operation:"revise",...t});}let i=Object.freeze({operation:"revise",...t});return this.ops.push(i),this}retract(e){this.assertCanModify();let t=Object.freeze(typeof e=="string"?{operation:"retract",name:e}:{operation:"retract",name:e.name,...e.kind?{kind:e.kind}:{},...e.reason?{reason:e.reason}:{},...e.expectedVersion!==void 0?{expectedVersion:e.expectedVersion}:{},...e.leaseId?{leaseId:e.leaseId}:{}});return this.ops.push(t),this}reaffirm(e){this.assertCanModify();let t=Object.freeze({operation:"reaffirm",name:e.name,...e.expectedVersion!==void 0?{expectedVersion:e.expectedVersion}:{},...e.kind?{kind:e.kind}:{},...e.add?{add:Object.freeze([...e.add])}:{},...e.remove?{remove:Object.freeze([...e.remove])}:{},...e.leaseId?{leaseId:e.leaseId}:{}});return this.ops.push(t),this}get operations(){return Object.freeze([...this.ops])}get size(){return this.ops.length}has(e){return this.pendingNames.has(e)}validate(){let e=[],t=[],n=new Set,i=new Set;for(let c=0;c<this.ops.length;c+=1){let p=this.ops[c];if(p){if(p.operation==="add"){let l=$(p);!p.name&&l!=="collection"?e.push({code:"MISSING_NAME",operationIndex:c,message:`Add operation at index ${c} is missing required 'name' field`}):p.name&&(n.has(p.name)&&e.push({code:"DUPLICATE_NAME",operationIndex:c,message:`Duplicate name '${p.name}' at index ${c} (already added earlier in commit)`}),n.add(p.name));}if(p.operation==="revise"){let l=p.name??p.wref;l?i.has(l)?e.push({code:"REVISE_AFTER_RETRACT",operationIndex:c,message:`Revise at index ${c} targets '${l}' which was already retracted in this commit`}):n.has(l)||t.push({code:"REVISE_UNKNOWN_WREF",operationIndex:c,message:`Revise at index ${c} references '${l}' which was not added in this commit (assuming it exists server-side)`}):e.push({code:"MISSING_WREF",operationIndex:c,message:`Revise operation at index ${c} is missing required target ('name' or 'wref')`});}p.operation==="retract"&&(p.name?i.has(p.name)?t.push({code:"RETRACT_AFTER_RETRACT",operationIndex:c,message:`Retract at index ${c} targets '${p.name}' which was already retracted in this commit`}):(n.has(p.name)||t.push({code:"RETRACT_UNKNOWN_WREF",operationIndex:c,message:`Retract at index ${c} references '${p.name}' which was not added in this commit (assuming it exists server-side)`}),i.add(p.name)):e.push({code:"MISSING_NAME",operationIndex:c,message:`Retract operation at index ${c} is missing required 'name' field`}));}}let o=this.ops.flatMap((c,p)=>{if(c.operation==="add")return E(L(c,$(c)),p);if(c.operation==="revise"){let l=c.name??c.wref;return E(L(c,l?Z(c,l):"thing"),p)}return E({operation:"retract",kind:c.kind,name:c.name},p)});for(let c of o)e.push({code:c.code,operationIndex:c.operationIndex,message:c.message});let s=this.ops.flatMap((c,p)=>{if(c.operation==="retract"||c.operation==="reaffirm")return [];if(c.operation==="add")return [{op:L(c,$(c)),operationIndex:p}];let l=c.name??c.wref;return [{op:L(c,l?Z(c,l):"thing"),operationIndex:p}]}),a=F$1(s.map(({op:c})=>c),{checkAddAdd:false,sourceOperationIndexes:s.map(({operationIndex:c})=>c)});for(let c of a)e.push({code:c.code,operationIndex:c.operationIndex,message:c.message});return this.ops.length===0&&e.push({code:"EMPTY_COMMIT",operationIndex:-1,message:"OperationBuilder has no operations"}),{valid:e.length===0,errors:e,warnings:t}}async commit(e){if(this.assertNotSubmitted(),this.inFlight)throw new Error("OperationBuilder: stream submission already in flight");let t=this.validate();if(!t.valid){let n=t.errors.map(i=>i.message).join("; ");throw new Error(`OperationBuilder validation failed: ${n}`)}this.inFlight=true;try{let n=this.ops.map(o=>yr(o)),i=await H(e.client,{orgName:e.orgName,repoName:e.repoName,committer:e.committer,message:e.message,chunkSize:e.chunkSize,streamId:e.streamId,submissionId:e.submissionId,returnRepoSeq:e.returnRepoSeq,retry:e.retry,operations:n});return this.submitted=!0,i}catch(n){throw n instanceof A&&(this.submitted=true),n}finally{this.inFlight=false;}}assertNotSubmitted(){if(this.submitted)throw new Error("OperationBuilder: already submitted, cannot modify")}assertCanModify(){if(this.assertNotSubmitted(),this.inFlight)throw new Error("OperationBuilder: stream submission already in flight, cannot modify")}};function Vs(r){return r.replace(/@(?:v\d+|HEAD|ALL)$/i,"")}var yi={apiUrl:true,fetch:true,accessToken:true,auth:true,functionLogs:true,client:true,clientFlags:true,decorateResponses:true},Pr=Object.keys(yi),fi=new Set(Pr),Ri=new Set(["token","apiKey","bearer"]);function bi(r){if(r)for(let e of Object.keys(r)){if(fi.has(e))continue;let t=Ri.has(e)?'; did you mean "accessToken"?':`. Valid options are: ${Pr.join(", ")}.`;throw new TypeError(`Unknown WarmHubClient option "${e}"${t}`)}}function Si(r){if(!r||r.length===0)return [];for(let e of r)if(!c(e))throw new TypeError(`Invalid client flag "${e}": expected lowercase tokens matching [a-z0-9-]+.`);return [...new Set(r)].sort()}var ot="https://api.warmhub.ai",wi=new Set(["commit.validate","repo.shapeInstanceCounts","thing.getMany","thing.headVersions"]),wr=500,Cr=500,xr=1,Or=8;function Ee(r){return {...r,actionContainer:void 0,actionContainerConfig:void 0}}function Ci(r){return r.map(e=>Ee(e))}function Dr(r,e,t){if(e===r||t.has(e))throw new f("VALIDATION_ERROR","Paginated result cursor did not advance")}function Er(r){if(r===void 0)throw new f("VALIDATION_ERROR","sinceRepoSeq is required for an incremental read")}async function*Lr(r,e){let t=e,n=new Set;for(;;){t&&n.add(t);let i=await r(t);if(yield i,!i.nextCursor)return;Dr(t,i.nextCursor,n),t=i.nextCursor;}}async function*w(r,e,t){for await(let n of Lr(r,t))yield*e(n);}async function C(r,e,t,n){if(t!==void 0&&(!Number.isFinite(t)||Math.trunc(t)!==t||t<0))throw new f("VALIDATION_ERROR","max must be a nonnegative integer");let i=[];for await(let o of Lr(r,n)){let s=e(o);if(t!==void 0&&i.length+s.length>t)throw new f("VALIDATION_ERROR",`Paginated result exceeded max=${t}`);i.push(...s);}return i}function Ir(r){if(r?.slugs!==void 0)throw new f("VALIDATION_ERROR","repo.explore pagination helpers do not support slugs mode")}async function Ar(r){let e=[],t,n=new Set;for(;;){t&&n.add(t);let i=await r(t);if(e.push(...i.items),!i.nextCursor){if(i.repoSeq===void 0)throw new f("VALIDATION_ERROR","Incremental read completed without repoSeq");return {items:e,repoSeq:i.repoSeq}}Dr(t,i.nextCursor,n),t=i.nextCursor;}}function xe(r,e,t){return Number.isFinite(r)?Math.max(1,Math.min(t,Math.trunc(r))):e}function vr(r,e){let t=[];for(let n=0;n<r.length;n+=e)t.push(r.slice(n,n+e));return t}function Oe(r){return r!==void 0&&k.includes(r)?r:void 0}function ee(r){let[e,t,n]=r;return typeof e=="string"?{orgName:e,repoName:t,name:n}:e}function xi(r){let[e,t]=r;return typeof e=="string"?{orgName:e,repoName:t}:e}function Oi(r){let[e,t,n,i]=r;return typeof e=="string"?{orgName:e,repoName:t,subscriptionName:n,credentialSetName:i}:e}function Ei(r){let[e,t,n]=r;return typeof e=="string"?{orgName:e,repoName:t,subscriptionName:n}:e}function Ii(r){let{actionContainer:e,actionContainerConfig:t,...n}=r;return n}function Ai(r){let{actionContainer:e,actionContainerConfig:t,...n}=r;return n}function Ie(r){return !!r&&(!!r.shape||!!r.kind||!!r.about||!!r.match||!!r.componentRef||r.excludeComponents===true||(r.where?.length??0)>0)}function Ae(r){return !!r&&(!!r.shape||!!r.about||!!r.match||!!r.componentRef||(r.where?.length??0)>0)}function qr(r){let e=r.members;return Array.isArray(e)&&e.length>0}function vi(r){let t=r.replace(/^wh:[^/]+\/[^/]+\//,"").replace(/@(?:HEAD|ALL|v\d+)$/,"").split("/")[0]?.toLowerCase();return t==="arc"||t==="bond"||t==="pair"||t==="set"||t==="list"?t:void 0}function ki(r,e){if(Ie(e.query)&&!Ae(e.query))throw new f("VALIDATION_ERROR","Selector-backed collection sources require shape, about, match, componentRef, or where; kind and excludeComponents only narrow an existing selector.");if(e.sourceRepo&&!Ae(e.query))throw new f("VALIDATION_ERROR","sourceRepo requires a selector-backed collection query");if(e.sourceRepo&&qr(e))throw new f("VALIDATION_ERROR","sourceRepo cannot be combined with explicit members; use canonical wh:org/repo/... member wrefs or omit sourceRepo.");if(Ie(e.query)&&r!=="set")throw new f("VALIDATION_ERROR","Selector-backed collection sources are only supported for set collections")}function Hs(r){return r??"off"}function Ti(r){if(r!==void 0)switch(r){case "BAD_REQUEST":case "PARSE_ERROR":case "PAYLOAD_TOO_LARGE":case "UNPROCESSABLE_CONTENT":case "UNSUPPORTED_MEDIA_TYPE":return "VALIDATION_ERROR";case "METHOD_NOT_SUPPORTED":return "NOT_FOUND";case "UNAUTHORIZED":return "UNAUTHENTICATED";case "FORBIDDEN":return "FORBIDDEN";case "NOT_FOUND":return "NOT_FOUND";case "CONFLICT":return "CONFLICT";case "PRECONDITION_FAILED":return "PRECONDITION_FAILED";case "TOO_MANY_REQUESTS":return "RATE_LIMITED";default:return}}function _i(r){if(r===void 0||r===408)return;if(r===405)return "NOT_FOUND";if(r===412)return "PRECONDITION_FAILED";if(r===422)return "VALIDATION_ERROR";let e=Br(r);return e!=="BACKEND"?e:r>=400&&r<500?"VALIDATION_ERROR":e}var Ni=[/\bselect\b.+?\bfrom\b/i,/\binsert\b.+?\binto\b/i,/\bupdate\b.+?\bset\b/i,/\bdelete\b.+?\bfrom\b/i,/\bparams:\s/i,/\.ts\(\d+,\d+\)/,/at\s+\S+\s+\(.*:\d+:\d+\)/,/node_modules\//,/drizzle/i];function st(r){for(let e of Ni)if(e.test(r))return "An internal error occurred. Please try again or contact support.";return r}var f=class extends Error{code;status;hint;retryAfter;errorCode;backendCode;details;constructor(e,t,n,i,o,s,a){super(t),this.name="WarmHubError",this.code=e,this.status=n,this.hint=i,this.retryAfter=o,this.errorCode=s,this.backendCode=s,this.details=a;}get kind(){return this.code}};function kr(r,e){if(typeof e!="string")return;let t=z$2(r,e);if(t)throw new f("VALIDATION_ERROR",t)}function d(r){if(r instanceof f)return r;if(r instanceof TRPCClientError){if(r.cause instanceof f)return r.cause;let e=r.data,t=e?.warmhub?.code,n=typeof e?.code=="string"?Ti(e.code):void 0,i=_i(e?.httpStatus),o=e?.warmhub?.message??st(r.message);return new f(t??n??i??"BACKEND",o,e?.warmhub?.status??e?.httpStatus,e?.warmhub?.hint,e?.warmhub?.retryAfter??e?.retryAfter,t,e?.warmhub?.details)}if(r instanceof Error){let e=r;return r.name==="WarmHubError"&&typeof e.code=="string"?new f(e.code,st(r.message),typeof e.status=="number"?e.status:void 0,typeof e.hint=="string"?e.hint:void 0,typeof e.retryAfter=="number"?e.retryAfter:void 0,typeof e.errorCode=="string"?e.errorCode:typeof e.backendCode=="string"?e.backendCode:void 0,e.details):r.name==="AbortError"?new f("CANCELLED",r.message):r instanceof TypeError&&/fetch/i.test(r.message)?new f("NETWORK",r.message):new f("BACKEND",st(r.message))}return new f("BACKEND","Unknown SDK error")}function Pi(r){return r instanceof f}function Fs(r){if(r instanceof N)return false;let e=d(r);return e.kind==="NETWORK"||e.kind==="CANCELLED"||e.kind==="BACKEND"||e.kind==="RATE_LIMITED"}var Di=new Set(["ConnectionRefused","ECONNREFUSED","ENOTFOUND","ETIMEDOUT","EAI_AGAIN"]);function Li(r){if(r instanceof TypeError&&/fetch/i.test(r.message))return true;if(r&&typeof r=="object"){let e=r.code;if(typeof e=="string"&&Di.has(e))return true}return false}function qi(r){return `Unable to connect to ${r}. Is the computer able to access the url?`}function Ws(r,e){if(F(r))return false;let t=u(r),n=u(e);return !t||!n?false:v(t,n)<0}function Mr(r,e){return new f("CLIENT_INCOMPATIBLE",r,412,e)}function Mi(r,e){let t=dr(r,e);if(t)throw Mr(t.message,t.hint)}var Tr=class r{apiUrl;fetchImpl;accessToken;clientIdentity;clientFlags;decorateResponses;functionLogMode;getToken;compatibilityCheck;overrideNoticePrinted=false;repositoryExport=Fe((e,t)=>this.fetchWithAuth(`${this.apiUrl.replace(/\/$/,"")}${e}`,t),e=>this.httpResponseError(e),(e,t)=>(this.fetchImpl??globalThis.fetch)(e,t));noteCompatibilityOverride(){this.overrideNoticePrinted||(this.overrideNoticePrinted=true,console.error(`warmhub: compatibility checks overridden by client flag ${b}; the server remains authoritative.`));}assertWriteCompatible(){return this.clientFlags.includes(b)?(this.noteCompatibilityOverride(),Promise.resolve()):F(this.clientIdentity.version)&&et(this.apiUrl,ot)?Promise.reject(Mr(`Development client ${this.clientIdentity.name}/${this.clientIdentity.version} cannot write to production.`,"Install a released WarmHub client artifact before writing to api.warmhub.ai.")):F(this.clientIdentity.version)&&!et(this.apiUrl,ot)?Promise.resolve():this.diagnostics.assertCompatible()}createCompatibilityLink(){return ()=>({op:e,next:t})=>e.type!=="mutation"||e.path==="commit.validate"?t(e):observable(n=>{let i=false,o;return (async()=>{try{await this.assertWriteCompatible();}catch(s){if(i)return;n.error(TRPCClientError.from(s));return}i||(o=t(e).subscribe(n));})(),()=>{i=true,o?.unsubscribe();}})}auth={getClientId:async()=>{try{return await this.trpc.auth.getClientId.query()}catch(e){throw d(e)}},sync:async()=>{try{return await this.trpc.auth.sync.mutate()}catch(e){throw d(e)}},currentUser:async()=>{try{return await this.trpc.auth.currentUser.query()}catch(e){throw d(e)}},whoami:async()=>{try{return await this.trpc.auth.whoami.query()}catch(e){throw d(e)}}};homepage={featuredLists:async()=>{try{return await this.trpc.homepage.featuredLists.query()}catch(e){throw d(e)}}};access={resolve:async e=>{try{return await this.trpc.access.resolve.query(e)}catch(t){throw d(t)}}};diagnostics={ping:async()=>{let e=await this.fetchWithAuth(`${this.apiUrl.replace(/\/$/,"")}/health`);if(!e.ok)throw new f("BACKEND",`Health request failed with status ${e.status}`,e.status);return await e.json()},capabilities:async()=>{try{return await this.trpc.diagnostics.capabilities.query()}catch(e){throw d(e)}},assertCompatible:()=>{if(this.compatibilityCheck)return this.compatibilityCheck;let e=(async()=>{let t=await this.diagnostics.capabilities();Mi(t,this.clientIdentity);})();return this.compatibilityCheck=e,e.catch(t=>{Pi(t)&&t.code==="CLIENT_INCOMPATIBLE"||this.compatibilityCheck===e&&(this.compatibilityCheck=void 0);}),e}};component={list:async(e,t,n)=>{try{return await this.trpc.component.list.query({orgName:e,repoName:t,limit:n?.limit,cursor:n?.cursor})}catch(i){throw d(i)}},listIter:(e,t,n)=>w(i=>this.component.list(e,t,{...n,cursor:i}),i=>i.items,n?.cursor),listAll:async(e,t,n)=>{let{max:i,...o}=n??{};return await C(s=>this.component.list(e,t,{...o,cursor:s}),s=>s.items,i,o.cursor)},search:async(e,t)=>{try{return await this.trpc.component.search.query({query:e,limit:t?.limit,cursor:t?.cursor})}catch(n){throw d(n)}},searchIter:(e,t)=>w(n=>this.component.search(e,{...t,cursor:n}),n=>n.items,t?.cursor),searchAll:async(e,t)=>{let{max:n,...i}=t??{};return await C(o=>this.component.search(e,{...i,cursor:o}),o=>o.items,n,i.cursor)},get:async(e,t,n)=>{try{return await this.trpc.component.get.query({orgName:e,repoName:t,componentRef:n})}catch(i){throw d(i)}},history:async(e,t,n)=>{try{return await this.trpc.component.history.query({orgName:e,repoName:t,componentRef:n?.componentRef,limit:n?.limit})}catch(i){throw d(i)}},install:async(e,t,n,i)=>{try{return await this.trpc.component.install.mutate({orgName:e,repoName:t,componentRef:n,submissionId:i.submissionId})}catch(o){throw d(o)}},uninstall:async(e,t,n,i)=>{try{return await this.trpc.component.uninstall.mutate({orgName:e,repoName:t,componentRef:n,submissionId:i.submissionId})}catch(o){throw d(o)}},registry:{register:async(e,t,n)=>{try{return await this.trpc.component.registry.register.mutate({orgName:e,componentName:t,...n})}catch(i){throw d(i)}},unregister:async(e,t)=>{try{return await this.trpc.component.registry.unregister.mutate({orgName:e,componentName:t})}catch(n){throw d(n)}},list:async e=>{try{return await this.trpc.component.registry.list.query({orgName:e})}catch(t){throw d(t)}},view:async(e,t)=>{try{return await this.trpc.component.registry.view.query({orgName:e,componentName:t})}catch(n){throw d(n)}},update:async(e,t,n)=>{try{return await this.trpc.component.registry.update.mutate({orgName:e,componentName:t,...n})}catch(i){throw d(i)}},resolve:async(e,t,n)=>await this.requestJson(`/api/component-registry/${encodeURIComponent(e)}/${encodeURIComponent(t)}/resolve`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({installRepo:n})}),setupCall:async(e,t,n)=>(await this.assertWriteCompatible(),await this.requestJson(`/api/component-registry/${encodeURIComponent(e)}/${encodeURIComponent(t)}/setup-call`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)}))},cli:{call:async(e,t,n,i)=>(await this.assertWriteCompatible(),await this.requestJson(`/api/component-registry/${encodeURIComponent(e)}/${encodeURIComponent(t)}/cli/${encodeURIComponent(n)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i)}))}};commit={validate:async(e,t,n,i)=>{try{return await this.trpc.commit.validate.mutate({orgName:e,repoName:t,committer:i?.committer,message:i?.message,componentRef:i?.componentRef,operations:qe(n,i?.skipExisting),includeWouldBeBody:i?.includeWouldBeBody},{signal:i?.signal})}catch(o){throw d(o)}},apply:async(e,t,n,i,o)=>{try{return await H(this,{orgName:e,repoName:t,committer:o?.committer,message:n,componentRef:o?.componentRef,chunkSize:o?.chunkSize,skipExisting:o?.skipExisting,streamId:o?.streamId,submissionId:o?.submissionId,returnRepoSeq:o?.returnRepoSeq,retry:o?.retry,operations:i})}catch(s){throw s instanceof A||s instanceof _?s:d(s)}},applyStreaming:(e,t,n,i,o)=>pr({orgName:e,repoName:t,message:n,operations:i,options:o},{prepare:async s=>await this.prepareStreamingSubmissionRequest(s),localError:(s,a)=>new f(s,a),normalizeLocalError:d}),getReceipt:async(e,t,n)=>{try{return await this.trpc.commit.getReceipt.query({orgName:e,repoName:t,eventRequestId:n})}catch(i){throw d(i)}}};org={get:async e=>{try{return await this.trpc.org.get.query({orgName:e})}catch(t){throw d(t)}},getCallerRole:async e=>{try{return await this.trpc.org.getCallerRole.query({orgName:e})}catch(t){throw d(t)}},list:async e=>{try{return {items:await this.trpc.org.list.query({includeArchived:e?.includeArchived})}}catch(t){throw d(t)}},create:async(e,t,n)=>{try{return await this.trpc.org.create.mutate({name:e,displayName:t,description:n})}catch(i){throw d(i)}},setDescription:async(e,t)=>{try{return await this.trpc.org.setDescription.mutate({orgName:e,description:t})}catch(n){throw d(n)}},setDisplayName:async(e,t)=>{try{return await this.trpc.org.setDisplayName.mutate({orgName:e,displayName:t})}catch(n){throw d(n)}},rename:async(e,t)=>{try{return await this.trpc.org.rename.mutate({orgName:e,newName:t})}catch(n){throw d(n)}},update:async e=>{try{return await this.trpc.org.update.mutate(e)}catch(t){throw d(t)}},addMember:async(e,t,n="editor")=>{try{return await this.trpc.org.addMember.mutate({orgName:e,email:t,role:n})}catch(i){throw d(i)}},removeMember:async(e,t)=>{try{await this.trpc.org.removeMember.mutate({orgName:e,email:t});}catch(n){throw d(n)}},leave:async e=>{try{await this.trpc.org.leave.mutate({orgName:e});}catch(t){throw d(t)}},changeMemberRole:async(e,t,n)=>{try{return await this.trpc.org.changeMemberRole.mutate({orgName:e,email:t,role:n})}catch(i){throw d(i)}},setMemberScopes:async(e,t,n)=>{try{await this.trpc.org.setMemberScopes.mutate({orgName:e,email:t,scopes:n});}catch(i){throw d(i)}},clearMemberScopes:async(e,t)=>{try{await this.trpc.org.clearMemberScopes.mutate({orgName:e,email:t});}catch(n){throw d(n)}},listMembers:async(e,t)=>{try{return await this.trpc.org.listMembers.query({orgName:e,pending:t?.pending})}catch(n){throw d(n)}},archive:async e=>{try{return await this.trpc.org.archive.mutate({orgName:e})}catch(t){throw d(t)}},unarchive:async e=>{try{return await this.trpc.org.unarchive.mutate({orgName:e})}catch(t){throw d(t)}}};repo={checkpoint:Bt(()=>this.trpc,d),export:(e,t,n)=>this.repositoryExport.stream(e,t,n),exportPrepare:(e,t,n)=>this.repositoryExport.prepare(e,t,n),get:async(e,t)=>{try{return await this.trpc.repo.get.query({orgName:e,repoName:t})}catch(n){throw d(n)}},getStats:async(e,t)=>{try{return await this.trpc.repo.stats.query({orgName:e,repoName:t})}catch(n){throw d(n)}},getStatsBatch:async(e,t)=>{try{return await this.trpc.repo.statsBatch.query({orgName:e,repoNames:t})}catch(n){throw d(n)}},getConfigureStats:async(e,t)=>{try{return await this.trpc.repo.configureStats.query({orgName:e,repoName:t})}catch(n){throw d(n)}},getShapeInstanceCounts:async(e,t)=>{try{return await this.trpc.repo.shapeInstanceCounts.query({orgName:e,repoName:t})}catch(n){throw d(n)}},list:async(e,t)=>{try{return await this.trpc.repo.list.query({orgName:e,limit:t?.limit,cursor:t?.cursor,includeArchived:t?.includeArchived,search:t?.search,sort:t?.sort})}catch(n){throw d(n)}},listIter:(e,t)=>w(n=>this.repo.list(e,{...t,cursor:n}),n=>n.items,t?.cursor),listAll:async(e,t)=>{let{max:n,...i}=t??{};return await C(o=>this.repo.list(e,{...i,cursor:o}),o=>o.items,n,i.cursor)},search:async(e,t)=>{try{return await this.trpc.repo.search.query({query:e,limit:t?.limit,cursor:t?.cursor})}catch(n){throw d(n)}},searchIter:(e,t)=>w(n=>this.repo.search(e,{...t,cursor:n}),n=>n.items,t?.cursor),searchAll:async(e,t)=>{let{max:n,...i}=t??{};return await C(o=>this.repo.search(e,{...i,cursor:o}),o=>o.items,n,i.cursor)},create:async(e,t,n,i,o)=>{try{return await this.trpc.repo.create.mutate({orgName:e,repoName:t,description:n,visibility:i,displayName:o})}catch(s){throw d(s)}},setDescription:async(e,t,n)=>{try{return await this.trpc.repo.setDescription.mutate({orgName:e,repoName:t,description:n})}catch(i){throw d(i)}},setDisplayName:async(e,t,n)=>{try{return await this.trpc.repo.setDisplayName.mutate({orgName:e,repoName:t,displayName:n})}catch(i){throw d(i)}},setVisibility:async(e,t,n)=>{try{return await this.trpc.repo.setVisibility.mutate({orgName:e,repoName:t,visibility:n})}catch(i){throw d(i)}},rename:async(e,t,n)=>{try{return await this.trpc.repo.rename.mutate({orgName:e,repoName:t,newName:n})}catch(i){throw d(i)}},update:async e=>{try{return await this.trpc.repo.update.mutate(e)}catch(t){throw d(t)}},archive:async(e,t)=>{try{return await this.trpc.repo.archive.mutate({orgName:e,repoName:t})}catch(n){throw d(n)}},unarchive:async(e,t)=>{try{return await this.trpc.repo.unarchive.mutate({orgName:e,repoName:t})}catch(n){throw d(n)}},delete:async(e,t)=>{try{let n=await this.trpc.repo.delete.mutate({orgName:e,repoName:t});return {graceExpiresAt:new Date(n.graceExpiresAt)}}catch(n){throw d(n)}},listPage:async(e,t)=>{try{return await this.trpc.repo.listPage.query({orgName:e,limit:t?.limit,cursor:t?.cursor,includeArchived:t?.includeArchived,search:t?.search,sort:t?.sort})}catch(n){throw d(n)}},listPageIter:(e,t)=>w(n=>this.repo.listPage(e,{...t,cursor:n}),n=>n.items,t?.cursor),listPageAll:async(e,t)=>{let{max:n,...i}=t??{};return await C(o=>this.repo.listPage(e,{...i,cursor:o}),o=>o.items,n,i.cursor)},listForCaller:async e=>{try{return await this.trpc.repo.listForCaller.query({limit:e?.limit,sort:e?.sort})}catch(t){throw d(t)}},explore:async e=>{try{return await this.trpc.repo.explore.query({search:e?.search,org:e?.org,activity:e?.activity,hasSubscriptions:e?.hasSubscriptions,minThings:e?.minThings,sort:e?.sort,limit:e?.limit,cursor:e?.cursor,slugs:e?.slugs})}catch(t){throw d(t)}},exploreIter:e=>(Ir(e),w(t=>this.repo.explore({...e,cursor:t}),t=>t.items,e?.cursor)),exploreAll:async e=>{Ir(e);let{max:t,...n}=e??{};return await C(i=>this.repo.explore({...n,cursor:i}),i=>i.items,t,n.cursor)},getReadme:async(e,t)=>{try{return await this.trpc.repo.getReadme.query({orgName:e,repoName:t})}catch(n){throw d(n)}},getAgents:async(e,t)=>{try{return await this.trpc.repo.getAgents.query({orgName:e,repoName:t})}catch(n){throw d(n)}},getLicense:async(e,t)=>{try{return await this.trpc.repo.getLicense.query({orgName:e,repoName:t})}catch(n){throw d(n)}},describe:async(e,t)=>{try{return await this.trpc.repo.describe.query({orgName:e,repoName:t})}catch(n){throw d(n)}},setReadme:async(e,t,n,i)=>{try{return kr("Content/Readme.content",n),await this.trpc.repo.setReadme.mutate({orgName:e,repoName:t,eventRequestId:i.eventRequestId,content:n})}catch(o){throw d(o)}},setAgents:async(e,t,n,i)=>{try{return kr("Content/Agents.content",n),await this.trpc.repo.setAgents.mutate({orgName:e,repoName:t,eventRequestId:i.eventRequestId,content:n})}catch(o){throw d(o)}},getLlmsTxt:async(e,t)=>{try{return await this.trpc.repo.getLlmsTxt.query({orgName:e,repoName:t})}catch(n){throw d(n)}},index:{describe:async(e,t)=>{try{return await this.trpc.repo.index.describe.query({orgName:e,repoName:t})}catch(n){throw d(n)}}}};shape={list:async(e,t,n)=>{try{return await this.trpc.shape.list.query({orgName:e,repoName:t,match:n?.match,componentRef:n?.componentRef,excludeComponents:n?.excludeComponents,includeRetracted:n?.includeRetracted})}catch(i){throw d(i)}},get:async(e,t,n,i)=>{try{return await this.trpc.shape.get.query({orgName:e,repoName:t,shapeName:n,includeRetracted:i?.includeRetracted})}catch(o){throw d(o)}},create:async(e,t,n,i,o)=>{let s=J(n,{fields:i,...o.description!==void 0?{description:o.description}:{}},"add");if(s)throw new f("VALIDATION_ERROR",s);try{return await this.trpc.shape.create.mutate({orgName:e,repoName:t,shapeName:n,fields:i,eventRequestId:o.eventRequestId,description:o.description})}catch(a){throw d(a)}},revise:async(e,t,n,i,o)=>{let s=J(n,{fields:i,...o.description!==void 0?{description:o.description}:{}},"revise");if(s)throw new f("VALIDATION_ERROR",s);try{return await this.trpc.shape.revise.mutate({orgName:e,repoName:t,shapeName:n,newFields:i,eventRequestId:o.eventRequestId,description:o.description})}catch(a){throw d(a)}},remove:async(e,t,n,i)=>{try{return await this.trpc.shape.remove.mutate({orgName:e,repoName:t,shapeName:n,eventRequestId:i.eventRequestId})}catch(o){throw d(o)}},rename:async(e,t,n,i,o)=>{try{return await this.trpc.shape.rename.mutate({orgName:e,repoName:t,oldName:n,newName:i,eventRequestId:o.eventRequestId})}catch(s){throw d(s)}},history:async(e,t,n,i={})=>{try{return await this.trpc.shape.history.query({orgName:e,repoName:t,name:n,includeRetracted:i.includeRetracted,limit:i.limit,cursor:i.cursor})}catch(o){throw d(o)}},historyIter:(e,t,n,i={})=>w(o=>this.shape.history(e,t,n,{...i,cursor:o}),o=>o.versions,i.cursor),historyAll:async(e,t,n,i)=>{let{max:o,...s}=i??{};return await C(a=>this.shape.history(e,t,n,{...s,cursor:a}),a=>a.versions,o,s.cursor)}};subscription={create:async e=>{try{let t=await this.trpc.subscription.create.mutate(Ii(e));return Ee(t)}catch(t){throw d(t)}},get:async(...e)=>{try{let t=await this.trpc.subscription.get.query(ee(e));return Ee(t)}catch(t){throw d(t)}},reveal:async(...e)=>{try{return await this.trpc.subscription.reveal.query(ee(e))}catch(t){throw d(t)}},list:async(...e)=>{try{let t=await this.trpc.subscription.list.query(xi(e));return Ci(t)}catch(t){throw d(t)}},update:async e=>{try{let t=await this.trpc.subscription.update.mutate(Ai(e));return Ee(t)}catch(t){throw d(t)}},pause:async(...e)=>{try{return await this.trpc.subscription.pause.mutate(ee(e))}catch(t){throw d(t)}},resume:async(...e)=>{try{return await this.trpc.subscription.resume.mutate(ee(e))}catch(t){throw d(t)}},remove:async(...e)=>{try{return await this.trpc.subscription.remove.mutate(ee(e))}catch(t){throw d(t)}},bindCredentials:async(...e)=>{try{return await this.trpc.subscription.bindCredentials.mutate(Oi(e))}catch(t){throw d(t)}},unbindCredentials:async(...e)=>{try{return await this.trpc.subscription.unbindCredentials.mutate(Ei(e))}catch(t){throw d(t)}}};action={acquireLease:async(e,t,n,i,o,s)=>{try{return await this.trpc.action.acquireLease.mutate({orgName:e,repoName:t,subscriptionName:n,holderId:i,holderType:o,graceMs:s?.graceMs,ttlMs:s?.ttlMs})}catch(a){throw d(a)}},heartbeatLease:async(e,t,n,i,o)=>{try{return await this.trpc.action.heartbeatLease.mutate({orgName:e,repoName:t,subscriptionName:n,holderId:i,ttlMs:o})}catch(s){throw d(s)}},releaseLease:async(e,t,n,i)=>{try{return await this.trpc.action.releaseLease.mutate({orgName:e,repoName:t,subscriptionName:n,holderId:i})}catch(o){throw d(o)}},claimDelivery:async(e,t,n,i)=>{let o=typeof n=="string"?{runId:n}:n;try{return await this.trpc.action.claimDelivery.mutate({orgName:e,repoName:t,...o,holderId:i})}catch(s){throw d(s)}},completeDelivery:async(e,t,n,i)=>{let o=typeof n=="string"?{runId:n}:n;try{return await this.trpc.action.completeDelivery.mutate({orgName:e,repoName:t,...o,holderId:i})}catch(s){throw d(s)}},liveFeed:async(e,t,n,i)=>{try{return await this.trpc.action.liveFeed.query({orgName:e,repoName:t,subscriptionName:n,limit:i?.limit,cursor:i?.cursor})}catch(o){throw d(o)}},liveFeedIter:(e,t,n,i)=>w(o=>this.action.liveFeed(e,t,n,{...i,cursor:o}),o=>o.items,i?.cursor),liveFeedAll:async(e,t,n,i)=>{let{max:o,...s}=i??{};return await C(a=>this.action.liveFeed(e,t,n,{...s,cursor:a}),a=>a.items,o,s.cursor)},listRuns:async(e,t,n)=>{try{return await this.trpc.action.listRuns.query({orgName:e,repoName:t,runId:n?.runId,subscriptionName:n?.subscriptionName,status:n?.status,outcome:n?.outcome,since:n?.since,cursor:n?.cursor,limit:n?.limit})}catch(i){throw d(i)}},listRunsIter:(e,t,n)=>w(i=>this.action.listRuns(e,t,{...n,since:i===void 0?n?.since:void 0,cursor:i}),i=>i.items,n?.cursor),listRunsAll:async(e,t,n)=>{let{max:i,...o}=n??{};return await C(s=>this.action.listRuns(e,t,{...o,since:s===void 0?o.since:void 0,cursor:s}),s=>s.items,i,o.cursor)},latestRuns:async(e,t)=>{try{return await this.trpc.action.latestRuns.query({orgName:e,repoName:t})}catch(n){throw d(n)}},runStats:async(e,t,n)=>{try{return await this.trpc.action.runStats.query({orgName:e,repoName:t,subscriptionName:n?.subscriptionName,since:n?.since})}catch(i){throw d(i)}},getRunAttempts:async(e,t,n)=>{try{return await this.trpc.action.getRunAttempts.query({orgName:e,repoName:t,runId:n})}catch(i){throw d(i)}},listNotifications:async(e,t,n)=>{try{return await this.trpc.action.listNotifications.query({orgName:e,repoName:t,since:n?.since,limit:n?.limit})}catch(i){throw d(i)}}};collection={create:async(e,t,n)=>{try{return ki(n.type,n),await this.trpc.collection.create.mutate({orgName:e,repoName:t,eventRequestId:n.eventRequestId,type:n.type,name:n.name,members:n.members,from:n.from,add:n.add,remove:n.remove,replaceMembers:n.replaceMembers,query:n.query,sourceOrgName:n.sourceRepo?.orgName,sourceRepoName:n.sourceRepo?.repoName,skipExisting:n.skipExisting,message:n.message,committer:n.committer})}catch(i){throw d(i)}},members:async(e,t,n,i)=>{try{return await this.trpc.collection.members.query({orgName:e,repoName:t,wref:n,version:i?.version,limit:i?.limit,cursor:i?.cursor})}catch(o){throw d(o)}},membersIter:(e,t,n,i)=>{let o=i?.version;return w(async s=>{let a=await this.collection.members(e,t,n,{...i,version:o,cursor:s});return o??=a.version,a},s=>s.items,i?.cursor)},membersAll:async(e,t,n,i)=>{let{max:o,...s}=i??{},a=s.version;return await C(async c=>{let p=await this.collection.members(e,t,n,{...s,version:a,cursor:c});return a??=p.version,p},c=>c.items,o,s.cursor)},contains:async(e,t,n,i,o)=>{try{return await this.trpc.collection.contains.query({orgName:e,repoName:t,wref:n,version:o?.version,members:i,position:o?.position})}catch(s){throw d(s)}},diff:async(e,t,n,i,o)=>{try{return await this.trpc.collection.diff.query({orgName:e,repoName:t,leftWref:n,rightWref:i,leftVersion:o?.leftVersion,rightVersion:o?.rightVersion,mode:o?.mode})}catch(s){throw d(s)}},revise:async(e,t,n,i)=>{try{let o=vi(n);if(Ie(i.query)&&!Ae(i.query))throw new f("VALIDATION_ERROR","Selector-backed collection sources require shape, about, match, componentRef, or where; kind and excludeComponents only narrow an existing selector.");if(i.sourceRepo&&!Ae(i.query))throw new f("VALIDATION_ERROR","sourceRepo requires a selector-backed collection query");if(i.sourceRepo&&qr(i))throw new f("VALIDATION_ERROR","sourceRepo cannot be combined with explicit members; use canonical wh:org/repo/... member wrefs or omit sourceRepo.");if(Ie(i.query)&&o&&o!=="set")throw new f("VALIDATION_ERROR","Selector-backed revise requires a Set/<name> target wref");return await this.trpc.collection.revise.mutate({orgName:e,repoName:t,eventRequestId:i.eventRequestId,wref:n,members:i.members,add:i.add,remove:i.remove,query:i.query,sourceOrgName:i.sourceRepo?.orgName,sourceRepoName:i.sourceRepo?.repoName,message:i.message,committer:i.committer})}catch(o){throw d(o)}},stats:async(e,t,n,i)=>{try{return await this.trpc.collection.stats.query({orgName:e,repoName:t,wref:n,version:i?.version})}catch(o){throw d(o)}}};view={evaluate:async(e,t,n,i)=>{try{return await this.trpc.view.evaluate.query({orgName:e,repoName:t,wref:n,limit:i?.limit,cursor:i?.cursor})}catch(o){throw d(o)}},evaluateIter:(e,t,n,i)=>w(o=>this.view.evaluate(e,t,n,{...i,cursor:o}),o=>o.items,i?.cursor),evaluateAll:async(e,t,n,i)=>{let{max:o,...s}=i??{};return await C(a=>this.view.evaluate(e,t,n,{...s,cursor:a}),a=>a.items,o,s.cursor)}};grant=Lt(()=>this.trpc,d);thing={head:async(e,t,n)=>{try{return await this.trpc.thing.head.query({orgName:e,repoName:t,shape:n?.shape,kind:Oe(n?.kind),match:n?.match,dataMode:n?.dataMode,includeRetracted:n?.includeRetracted,limit:n?.limit,cursor:n?.cursor,componentRef:n?.componentRef,excludeComponents:n?.excludeComponents,excludeInfraShapes:n?.excludeInfraShapes,where:n?.where,sinceRepoSeq:n?.sinceRepoSeq})}catch(i){throw d(i)}},headIter:(e,t,n)=>w(i=>this.thing.head(e,t,{...n,cursor:i}),i=>i.items,n?.cursor),headAll:async(e,t,n)=>{let{max:i,...o}=n??{};return await C(s=>this.thing.head(e,t,{...o,cursor:s}),s=>s.items,i,o.cursor)},headChanges:async(e,t,n)=>(Er(n?.sinceRepoSeq),await Ar(i=>this.thing.head(e,t,{...n,includeRetracted:true,cursor:i}))),get:async(e,t,n,i,o)=>{try{return await this.trpc.thing.get.query({orgName:e,repoName:t,wref:n,version:i,includeRetracted:o?.includeRetracted,dataMode:o?.dataMode})}catch(s){throw d(s)}},getWithLease:async(e,t,n,i)=>{try{return await this.trpc.thing.getWithLease.mutate({orgName:e,repoName:t,wref:n,ttlMs:i?.ttlMs})}catch(o){throw d(o)}},releaseLease:async(e,t,n,i)=>{try{await this.trpc.thing.releaseLease.mutate({orgName:e,repoName:t,wref:n,leaseId:i});}catch(o){throw d(o)}},graph:async(e,t,n,i)=>{try{return await this.trpc.thing.graph.query({orgName:e,repoName:t,wref:n,version:i?.version,depth:i?.depth,limit:i?.limit})}catch(o){throw d(o)}},getMany:async(e,t,n,i,o)=>{try{if(n.length===0)return {requested:0,items:[],missing:[]};let s=xe(o?.chunkSize,wr,Cr),a=xe(o?.chunkConcurrency,xr,Or),c=async m=>await this.trpc.thing.getMany.query({orgName:e,repoName:t,wrefs:m,version:i,includeRetracted:o?.includeRetracted,dataMode:o?.dataMode});if(n.length<=s)return await c(n);let p=vr(n,s),l=[];for(let m=0;m<p.length;m+=a){let g=p.slice(m,m+a),h=await Promise.all(g.map(c));l.push(...h);}return {requested:n.length,items:l.flatMap(m=>m.items),missing:l.flatMap(m=>m.missing)}}catch(s){throw d(s)}},headVersions:async(e,t,n,i)=>{try{if(n.length===0)return {requested:0,items:[],missing:[]};let o=xe(i?.chunkSize,wr,Cr),s=xe(i?.chunkConcurrency,xr,Or),a=async l=>await this.trpc.thing.headVersions.query({orgName:e,repoName:t,wrefs:l});if(n.length<=o)return await a(n);let c=vr(n,o),p=[];for(let l=0;l<c.length;l+=s){let m=c.slice(l,l+s),g=await Promise.all(m.map(a));p.push(...g);}return {requested:n.length,items:p.flatMap(l=>l.items),missing:p.flatMap(l=>l.missing)}}catch(o){throw d(o)}},history:async(e,t,n)=>{try{return await this.trpc.thing.history.query({orgName:e,repoName:t,wref:n.wref,shape:n.shape,about:n.about,includeRetracted:n.includeRetracted,resolveCollections:n.resolveCollections,match:n.match,limit:n.limit,cursor:n.cursor})}catch(i){throw d(i)}},historyIter:(e,t,n)=>w(i=>this.thing.history(e,t,{...n,cursor:i}),i=>i.versions,n.cursor),historyAll:async(e,t,n)=>{let{max:i,...o}=n;return await C(s=>this.thing.history(e,t,{...o,cursor:s}),s=>s.versions,i,o.cursor)},rename:async(e,t,n,i,o,s)=>{try{return await this.trpc.thing.rename.mutate({orgName:e,repoName:t,shapeName:n,oldName:i,newName:o,eventRequestId:s.eventRequestId})}catch(a){throw d(a)}},resolve:async(e,t,n)=>{try{return await this.trpc.thing.resolve.query({orgName:e,repoName:t,wref:n})}catch(i){throw d(i)}},about:async(e,t,n,i)=>{try{return await this.trpc.thing.about.query({orgName:e,repoName:t,wref:n,shape:i?.shape,match:i?.match,includeRetracted:i?.includeRetracted,depth:i?.depth,resolveCollections:i?.resolveCollections,role:i?.role,limit:i?.limit,cursor:i?.cursor,where:i?.where})}catch(o){throw d(o)}},aboutIter:(e,t,n,i)=>w(o=>this.thing.about(e,t,n,{...i,cursor:o}),o=>o.assertions,i?.cursor),aboutAll:async(e,t,n,i)=>{let{max:o,...s}=i??{};return await C(a=>this.thing.about(e,t,n,{...s,cursor:a}),a=>a.assertions,o,s.cursor)},query:async(e,t,n)=>{try{return await this.trpc.thing.query.query({orgName:e,repoName:t,shape:n?.shape,about:n?.about,affirmedAbout:n?.affirmedAbout,kind:Oe(n?.kind),match:n?.match,includeRetracted:n?.includeRetracted,resolveCollections:n?.resolveCollections,role:n?.role,limit:n?.limit,cursor:n?.cursor,componentRef:n?.componentRef,excludeComponents:n?.excludeComponents,excludeInfraShapes:n?.excludeInfraShapes,where:n?.where,sinceRepoSeq:n?.sinceRepoSeq})}catch(i){throw d(i)}},queryIter:(e,t,n)=>w(i=>this.thing.query(e,t,{...n,cursor:i}),i=>i.items,n?.cursor),queryAll:async(e,t,n)=>{let{max:i,...o}=n??{};return await C(s=>this.thing.query(e,t,{...o,cursor:s}),s=>s.items,i,o.cursor)},queryChanges:async(e,t,n)=>(Er(n?.sinceRepoSeq),await Ar(i=>this.thing.query(e,t,{...n,includeRetracted:true,cursor:i}))),search:async(e,t,n,i)=>{try{return await this.trpc.thing.search.query({orgName:e,repoName:t,query:n,shape:i?.shape,about:i?.about,affirmedAbout:i?.affirmedAbout,kind:Oe(i?.kind),match:i?.match,includeRetracted:i?.includeRetracted,resolveCollections:i?.resolveCollections,limit:i?.limit,cursor:i?.cursor,componentRef:i?.componentRef,excludeComponents:i?.excludeComponents,excludeInfraShapes:i?.excludeInfraShapes,mode:i?.mode,nameMatch:i?.nameMatch})}catch(o){throw d(o)}},searchIter:(e,t,n,i)=>w(o=>this.thing.search(e,t,n,{...i,cursor:o}),o=>o.items,i?.cursor),searchAll:async(e,t,n,i)=>{let{max:o,...s}=i??{};return await C(a=>this.thing.search(e,t,n,{...s,cursor:a}),a=>a.items,o,s.cursor)},count:async(e,t,n)=>{try{return await this.trpc.thing.count.query({orgName:e,repoName:t,shape:n?.shape,about:n?.about,affirmedAbout:n?.affirmedAbout,kind:Oe(n?.kind),match:n?.match,includeRetracted:n?.includeRetracted,resolveCollections:n?.resolveCollections,componentRef:n?.componentRef,excludeComponents:n?.excludeComponents,excludeInfraShapes:n?.excludeInfraShapes,where:n?.where,sinceRepoSeq:n?.sinceRepoSeq})}catch(i){throw d(i)}},refs:async(e,t,n,i)=>{try{return await this.trpc.thing.refs.query({orgName:e,repoName:t,wref:n,direction:i?.direction,fieldPath:i?.fieldPath,limit:i?.limit,cursor:i?.cursor})}catch(o){throw d(o)}},refsIter:(e,t,n,i)=>w(o=>this.thing.refs(e,t,n,{...i,cursor:o}),o=>o.items,i?.cursor),refsAll:async(e,t,n,i)=>{let{max:o,...s}=i??{};return await C(a=>this.thing.refs(e,t,n,{...s,cursor:a}),a=>a.items,o,s.cursor)}};live={thingHead:async(e,t,n,i)=>this.watchRepoQuery(e,t,n?.signal,()=>this.thing.head(e,t,{shape:n?.shape,kind:n?.kind,match:n?.match,dataMode:n?.dataMode,limit:n?.limit,cursor:n?.cursor,includeRetracted:n?.includeRetracted,where:n?.where}),i),thingHistory:async(e,t,n,i)=>this.watchRepoQuery(e,t,n.signal,()=>this.thing.history(e,t,{wref:n.wref,limit:n.limit,cursor:n.cursor,includeRetracted:n.includeRetracted}),i),subscriptionLog:async(e,t,n,i,o)=>this.watchRepoQuery(e,t,i?.signal,()=>this.action.liveFeed(e,t,n,{limit:i?.limit,cursor:i?.cursor}),o),subscribe:async(e,t,n,i)=>{let o=new AbortController,s=_r(n?.signal,o),a=0,c=(async()=>{let p=await this.trpc.live.issueTicket.mutate({orgName:e,repoName:t}),l=await this.openSse(p.ticket,s,async m=>{if(m.type!=="invalidate")return;let g=m.data;a++,await i({topic:g.topic,affectedShapes:g.affectedShapes,affectedThings:g.affectedThings,affectedTargets:g.affectedTargets,hasNewCommit:g.hasNewCommit});});return await l.ready,s.aborted?{updates:a}:(await l.closed,{updates:a})})();return {close(){o.abort();},closed:c}}};token={create:async e=>{try{return await this.trpc.token.create.mutate(e)}catch(t){throw d(t)}},list:async e=>{try{return await this.trpc.token.list.query(e?.includeInactive?{includeInactive:!0}:void 0)}catch(t){throw d(t)}},get:async e=>{try{return await this.trpc.token.get.query({name:e})}catch(t){throw d(t)}},revoke:async e=>{try{return await this.trpc.token.revoke.mutate({name:e})}catch(t){throw d(t)}}};stream={append:async e=>{try{return await this.trpc.stream.append.mutate(e)}catch(t){throw d(t)}}};credential={createSet:async(e,t,n,i)=>{try{return await this.trpc.credential.createSet.mutate({orgName:e,repoName:t,name:n,scope:i?.scope??"repo",description:i?.description})}catch(o){throw d(o)}},listSets:async(e,t)=>{try{return await this.trpc.credential.listSets.query({orgName:e,repoName:t})}catch(n){throw d(n)}},getSet:async(e,t,n)=>{try{return await this.trpc.credential.getSet.query({orgName:e,repoName:t,name:n})}catch(i){throw d(i)}},setKey:async(e,t,n,i,o)=>{try{return await this.trpc.credential.setKey.mutate({orgName:e,repoName:t,setName:n,keyName:i,value:o})}catch(s){throw d(s)}},setKeys:async(e,t,n,i)=>{try{return await this.trpc.credential.setKeys.mutate({orgName:e,repoName:t,setName:n,secrets:i})}catch(o){throw d(o)}},unsetKey:async(e,t,n,i)=>{try{return await this.trpc.credential.unsetKey.mutate({orgName:e,repoName:t,setName:n,keyName:i})}catch(o){throw d(o)}},deleteSet:async(e,t,n)=>{try{return await this.trpc.credential.deleteSet.mutate({orgName:e,repoName:t,setName:n})}catch(i){throw d(i)}},listAuditLog:async(e,t,n,i)=>{try{return await this.trpc.credential.listAuditLog.query({orgName:e,repoName:t,setName:n,limit:i?.limit})}catch(o){throw d(o)}},revokeSet:async(e,t,n,i)=>{try{return await this.trpc.credential.revokeSet.mutate({orgName:e,repoName:t,setName:n,reason:i?.reason})}catch(o){throw d(o)}}};credentials=this.credential;constructor(e,t){let n=typeof e=="string"?t:e;bi(n);let i=typeof e=="string"?e:e?.apiUrl??ot;if(this.apiUrl=i,this.fetchImpl=n?.fetch,this.accessToken=n?.accessToken??n?.auth?.getToken,this.functionLogMode=n?.functionLogs??"off",this.clientIdentity={name:n?.client?.name??f$1,version:n?.client?.version??Ze},this.clientFlags=Si(n?.clientFlags),this.decorateResponses=n?.decorateResponses??false,typeof this.accessToken=="function"){let a=this.accessToken;this.getToken=async()=>await a();}else if(this.accessToken){let a=this.accessToken;this.getToken=async()=>a;}let o=`${i.replace(/\/$/,"")}/trpc`,s=((a,c)=>this.fetchWithAuth(a,c));Object.defineProperty(this,"trpc",{value:createTRPCProxyClient({links:[this.createCompatibilityLink(),Dt({enabled:this.decorateResponses,getClient:()=>this}),splitLink({condition:a=>wi.has(a.path),true:httpLink({url:o,fetch:s,methodOverride:"POST"}),false:httpBatchLink({url:o,fetch:s,methodOverride:"POST"})})]}),enumerable:false,writable:false,configurable:true});}withAccessToken(e){return new r({apiUrl:this.apiUrl,fetch:this.fetchImpl,accessToken:e,client:this.clientIdentity,clientFlags:this.clientFlags,decorateResponses:this.decorateResponses})}actions=this.action;async openSse(e,t,n){let i=await this.fetchWithAuth(`${this.apiUrl.replace(/\/$/,"")}/sse?ticket=${encodeURIComponent(e)}`,{headers:{accept:"text/event-stream"},signal:t});if(!i.ok)throw new f("BACKEND",`SSE request failed with status ${i.status}`,i.status);let o=i.body?.getReader();if(!o)throw new f("BACKEND","SSE response body is missing");let s=()=>{},a=new Promise(p=>{s=p;}),c=(async()=>{let p=new TextDecoder,l="";try{for(;;){let{done:m,value:g}=await o.read();if(m)break;for(l+=p.decode(g,{stream:!0}).replaceAll(`\r
4
+ `,`
5
+ `);;){let h=l.indexOf(`
6
+
7
+ `);if(h===-1)break;let O=l.slice(0,h);l=l.slice(h+2);let R=Bi(O);if(R){if(R.type==="ready"){s();continue}await n(R);}}}}catch(m){if(Ui(m)||t.aborted)return;throw m}finally{s(),o.releaseLock();}})();return {ready:a,closed:c}}applyClientHeader(e$1){e$1.has(e)||e$1.set(e,i(this.clientIdentity.name,this.clientIdentity.version)),this.clientFlags.length>0&&!e$1.has(a)&&e$1.set(a,d$1(this.clientFlags));}async fetchWithAuth(e,t){let n=this.fetchImpl??globalThis.fetch,i=new Headers(t?.headers),o=await at(this.accessToken);o&&i.set("authorization",`Bearer ${o}`),this.applyClientHeader(i);let s=async c=>{try{return await n(e,c)}catch(p){throw Li(p)?new f("NETWORK",qi(this.apiUrl)):p}},a=await s({...t,headers:i});if(a.status===401&&typeof this.accessToken=="function"){let c=await at(this.accessToken);if(c&&c!==o){let p=new Headers(t?.headers);return p.set("authorization",`Bearer ${c}`),this.applyClientHeader(p),s({...t,headers:p})}}return a}async requestResponse(e,t){let n=await this.fetchWithAuth(`${this.apiUrl.replace(/\/$/,"")}${e}`,t);if(!n.ok)throw await this.httpResponseError(n);return n}async prepareStreamingSubmissionRequest(e){let t=this.fetchImpl??globalThis.fetch,n=new Headers({accept:"application/x-ndjson","content-type":"application/x-ndjson"}),i=await at(this.accessToken);i&&n.set("authorization",`Bearer ${i}`),this.applyClientHeader(n);let o=`${this.apiUrl.replace(/\/$/,"")}${e}`;return {dispatch:async(s,a)=>await t(o,{method:"POST",headers:n,body:s,signal:a,duplex:"half"}),httpError:async s=>await this.httpResponseError(s)}}async httpResponseError(e){let t=`Request failed with status ${e.status}`,n=Br(e.status),i,o,s;try{let a=await e.json();typeof a.error?.message=="string"&&(t=a.error.message),typeof a.error?.code=="string"&&(n=a.error.code,i=a.error.code),typeof a.error?.hint=="string"&&(o=a.error.hint),typeof a.error?.retryAfter=="number"&&(s=a.error.retryAfter);}catch{}return new f(n,t,e.status,o,s,i)}async requestJson(e,t){return await(await this.requestResponse(e,t)).json()}async watchRepoQuery(e,t,n,i,o){let s=new AbortController,a=_r(n,s),c=0,p=(async()=>{let l=async()=>{let h=await i();c+=1,await o(h);},m=await this.trpc.live.issueTicket.mutate({orgName:e,repoName:t}),g=await this.openSse(m.ticket,a,async h=>{h.type==="invalidate"&&await l();});return await g.ready,a.aborted?{updates:c}:(await l(),await g.closed,{updates:c})})();return {close(){s.abort();},closed:p}}};function Br(r){switch(r){case 400:return "VALIDATION_ERROR";case 401:return "UNAUTHENTICATED";case 403:return "FORBIDDEN";case 404:return "NOT_FOUND";case 409:return "CONFLICT";case 429:return "RATE_LIMITED";default:return "BACKEND"}}async function at(r){if(r)return typeof r=="string"?r:r()}function _r(r,e){return r?r.aborted?(e.abort(),e.signal):(r.addEventListener("abort",()=>e.abort(),{once:true}),e.signal):e.signal}function Bi(r){let e="message",t=[];for(let i of r.split(`
8
+ `))if(!(!i||i.startsWith(":"))){if(i.startsWith("event:")){e=i.slice(6).trim();continue}i.startsWith("data:")&&t.push(i.slice(5).trim());}if(t.length===0)return null;let n=t.join(`
9
+ `);return {type:e,data:JSON.parse(n)}}function Ui(r){return r instanceof Error&&r.name==="AbortError"}export{x as A,si as B,Ce as C,Vs as D,ot as E,Hs as F,st as G,f as H,d as I,Pi as J,Fs as K,Li as L,qi as M,Ws as N,Tr as O,Wr as a,$r as b,Gr as c,At as d,Kr as e,le as f,nn as g,Vt as h,y as i,j,B as k,Y as l,Ft as m,U as n,V as o,An as p,me as q,ge as r,A as s,_ as t,We as u,zt as v,Q as w,H as x,N as y,Ze as z};//# sourceMappingURL=chunk-WEJSFESQ.js.map
10
+ //# sourceMappingURL=chunk-WEJSFESQ.js.map