@oonacode/win32-x64 0.3.133 → 0.3.134

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.
package/oona.exe CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/oona.exe
3
3
  size: 110471168 bytes
4
- sha256: 0c8203d0a48e04b448f5803f8da55fa895c3bbd886ae0f00986e2a355b98d429
4
+ sha256: 7ebc4c6253a459225b9136a49092de7d8a909c68ba13ec9b084260ce0c6903f8
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "oonacode",
3
- "version": "0.3.133",
3
+ "version": "0.3.134",
4
4
  "channel": "stable",
5
5
  "platform": "win32",
6
6
  "arch": "x64",
7
7
  "mode": "bun",
8
8
  "launcherRuntime": "bun 1.4.1",
9
- "commit": "069363cb",
10
- "builtAt": "2026-09-23T18:12:20.9835564Z",
9
+ "commit": "f1a14c6a",
10
+ "builtAt": "2026-09-23T19:57:33.7631957Z",
11
11
  "engine": "engine-store",
12
12
  "engineVersion": "0.3.280",
13
13
  "siteOrigin": "https://oonacode.oonak.ai",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oonacode/win32-x64",
3
- "version": "0.3.133",
3
+ "version": "0.3.134",
4
4
  "description": "OonaCode native binaries for Windows x64: oona.exe (CLI + headless host service), the pinned oonaclaude.exe engine sidecar, local web UI assets. Installed automatically as an optional dependency of `oonacode`.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://oonacode.oonak.ai",
@@ -71,7 +71,7 @@ Error generating stack: `+e.message+`
71
71
 
72
72
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Ke,s=!je.jitless,c=s&&qe.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?hr([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function vr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ct(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ft(e,r,Me())))}),t)}var yr=L(`$ZodUnion`,(e,t)=>{jn.init(e,t),Be(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Be(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Be(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Be(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Le(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>vr(t,r,e,i)):vr(o,r,e,i)}}),br=L(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,yr.init(e,t);let n=e._zod.parse;Be(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Fe(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Ke(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),xr=L(`$ZodIntersection`,(e,t)=>{jn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Cr(e,t,n)):Cr(e,i,a)}});function Sr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Je(e)&&Je(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Sr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Sr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Cr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ct(e))return e;let o=Sr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var wr=L(`$ZodRecord`,(e,t)=>{jn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Je(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>ft(e,r,Me())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...ut(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...ut(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&cn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>ft(e,r,Me())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...ut(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...ut(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Tr=L(`$ZodEnum`,(e,t)=>{jn.init(e,t);let n=Ne(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Xe.has(typeof e)).map(e=>typeof e==`string`?Ze(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Er=L(`$ZodLiteral`,(e,t)=>{if(jn.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Ze(e):e?Ze(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Dr=L(`$ZodTransform`,(e,t)=>{jn.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ae(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new ke;return n.value=i,n.fallback=!0,n}});function Or(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var kr=L(`$ZodOptional`,(e,t)=>{jn.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Be(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Be(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Le(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Or(e,r)):Or(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ar=L(`$ZodExactOptional`,(e,t)=>{kr.init(e,t),Be(e._zod,`values`,()=>t.innerType._zod.values),Be(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),jr=L(`$ZodNullable`,(e,t)=>{jn.init(e,t),Be(e._zod,`optin`,()=>t.innerType._zod.optin),Be(e._zod,`optout`,()=>t.innerType._zod.optout),Be(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Le(e.source)}|null)$`):void 0}),Be(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Mr=L(`$ZodDefault`,(e,t)=>{jn.init(e,t),e._zod.optin=`optional`,Be(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Nr(e,t)):Nr(r,t)}});function Nr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Pr=L(`$ZodPrefault`,(e,t)=>{jn.init(e,t),e._zod.optin=`optional`,Be(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Fr=L(`$ZodNonOptional`,(e,t)=>{jn.init(e,t),Be(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ir(t,e)):Ir(i,e)}});function Ir(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Lr=L(`$ZodCatch`,(e,t)=>{jn.init(e,t),e._zod.optin=`optional`,Be(e._zod,`optout`,()=>t.innerType._zod.optout),Be(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ft(e,n,Me()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ft(e,n,Me()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Rr=L(`$ZodPipe`,(e,t)=>{jn.init(e,t),Be(e._zod,`values`,()=>t.in._zod.values),Be(e._zod,`optin`,()=>t.in._zod.optin),Be(e._zod,`optout`,()=>t.out._zod.optout),Be(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>zr(e,t.in,n)):zr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>zr(e,t.out,n)):zr(r,t.out,n)}});function zr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Br=L(`$ZodReadonly`,(e,t)=>{jn.init(e,t),Be(e._zod,`propValues`,()=>t.innerType._zod.propValues),Be(e._zod,`values`,()=>t.innerType._zod.values),Be(e._zod,`optin`,()=>t.innerType?._zod?.optin),Be(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Vr):Vr(r)}});function Vr(e){return e.value=Object.freeze(e.value),e}var Hr=L(`$ZodCustom`,(e,t)=>{fn.init(e,t),jn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ur(t,n,r,e));Ur(i,n,r,e)}});function Ur(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(mt(e))}}var Wr,Gr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Kr(){return new Gr}(Wr=globalThis).__zod_globalRegistry??(Wr.__zod_globalRegistry=Kr());var qr=globalThis.__zod_globalRegistry;function Jr(e,t){return new e({type:`string`,...R(t)})}function Yr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...R(t)})}function Xr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...R(t)})}function Zr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...R(t)})}function Qr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...R(t)})}function $r(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...R(t)})}function ei(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...R(t)})}function ti(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...R(t)})}function ni(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...R(t)})}function ri(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...R(t)})}function ii(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...R(t)})}function ai(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...R(t)})}function oi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...R(t)})}function si(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...R(t)})}function ci(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...R(t)})}function li(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...R(t)})}function ui(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...R(t)})}function di(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...R(t)})}function fi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...R(t)})}function pi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...R(t)})}function mi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...R(t)})}function hi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...R(t)})}function gi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...R(t)})}function _i(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...R(t)})}function vi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...R(t)})}function yi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...R(t)})}function bi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...R(t)})}function xi(e,t){return new e({type:`number`,checks:[],...R(t)})}function Si(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...R(t)})}function Ci(e,t){return new e({type:`boolean`,...R(t)})}function wi(e){return new e({type:`unknown`})}function Ti(e,t){return new e({type:`never`,...R(t)})}function Ei(e,t){return new mn({check:`less_than`,...R(t),value:e,inclusive:!1})}function Di(e,t){return new mn({check:`less_than`,...R(t),value:e,inclusive:!0})}function Oi(e,t){return new hn({check:`greater_than`,...R(t),value:e,inclusive:!1})}function ki(e,t){return new hn({check:`greater_than`,...R(t),value:e,inclusive:!0})}function Ai(e,t){return new gn({check:`multiple_of`,...R(t),value:e})}function ji(e,t){return new vn({check:`max_length`,...R(t),maximum:e})}function Mi(e,t){return new yn({check:`min_length`,...R(t),minimum:e})}function Ni(e,t){return new bn({check:`length_equals`,...R(t),length:e})}function Pi(e,t){return new Sn({check:`string_format`,format:`regex`,...R(t),pattern:e})}function Fi(e){return new Cn({check:`string_format`,format:`lowercase`,...R(e)})}function Ii(e){return new wn({check:`string_format`,format:`uppercase`,...R(e)})}function Li(e,t){return new Tn({check:`string_format`,format:`includes`,...R(t),includes:e})}function Ri(e,t){return new En({check:`string_format`,format:`starts_with`,...R(t),prefix:e})}function zi(e,t){return new Dn({check:`string_format`,format:`ends_with`,...R(t),suffix:e})}function Bi(e){return new On({check:`overwrite`,tx:e})}function Vi(e){return Bi(t=>t.normalize(e))}function Hi(){return Bi(e=>e.trim())}function Ui(){return Bi(e=>e.toLowerCase())}function Wi(){return Bi(e=>e.toUpperCase())}function Gi(){return Bi(e=>We(e))}function Ki(e,t,n){return new e({type:`array`,element:t,...R(n)})}function qi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...R(n)})}function Ji(e,t){let n=Yi(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(mt(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(mt(r))}},e(t.value,t)),t);return n}function Yi(e,t){let n=new fn({check:`custom`,...R(t)});return n._zod.check=e,n}function Xi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??qr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Zi(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Zi(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&ea(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Qi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
73
73
 
74
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function $i(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:na(t,`input`,e.processors),output:na(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ea(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ea(r.element,n);if(r.type===`set`)return ea(r.valueType,n);if(r.type===`lazy`)return ea(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return ea(r.innerType,n);if(r.type===`intersection`)return ea(r.left,n)||ea(r.right,n);if(r.type===`record`||r.type===`map`)return ea(r.keyType,n)||ea(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ea(r.in,n)||ea(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ea(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ea(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ea(e,n))return!0;return!!(r.rest&&ea(r.rest,n))}return!1}var ta=(e,t={})=>n=>{let r=Xi({...n,processors:t});return Zi(e,r),Qi(r,e),$i(r,e)},na=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Xi({...i??{},target:a,io:t,processors:n});return Zi(e,o),Qi(o,e),$i(o,e)},ra={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ia=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ra[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},aa=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},oa=(e,t,n,r)=>{n.type=`boolean`},sa=(e,t,n,r)=>{n.not={}},ca=(e,t,n,r)=>{let i=e._zod.def,a=Ne(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},la=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ua=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},da=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},fa=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Zi(a.element,t,{...r,path:[...r.path,`items`]})},pa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Zi(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Zi(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ma=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Zi(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ha=(e,t,n,r)=>{let i=e._zod.def,a=Zi(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Zi(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ga=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Zi(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Zi(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Zi(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},_a=(e,t,n,r)=>{let i=e._zod.def,a=Zi(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},va=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ya=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ba=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},xa=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Sa=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Zi(o,t,r);let s=t.seen.get(e);s.ref=o},Ca=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},wa=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ta=L(`ZodISODateTime`,(e,t)=>{Gn.init(e,t),Za.init(e,t)});function Ea(e){return _i(Ta,e)}var Da=L(`ZodISODate`,(e,t)=>{Kn.init(e,t),Za.init(e,t)});function Oa(e){return vi(Da,e)}var ka=L(`ZodISOTime`,(e,t)=>{qn.init(e,t),Za.init(e,t)});function Aa(e){return yi(ka,e)}var ja=L(`ZodISODuration`,(e,t)=>{Jn.init(e,t),Za.init(e,t)});function Ma(e){return bi(ja,e)}var Na=L(`ZodError`,(e,t)=>{gt.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>yt(e,t)},flatten:{value:t=>vt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Pe,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Pe,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Pa=bt(Na),Fa=xt(Na),Ia=St(Na),La=wt(Na),Ra=Et(Na),za=Dt(Na),Ba=Ot(Na),Va=kt(Na),Ha=At(Na),Ua=jt(Na),Wa=Mt(Na),Ga=Nt(Na),Ka=new WeakMap;function qa(e,t,n){let r=Object.getPrototypeOf(e),i=Ka.get(r);if(i||(i=new Set,Ka.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Ja=L(`ZodType`,(e,t)=>(jn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:na(e,`input`),output:na(e,`output`)}}),e.toJSONSchema=ta(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Pa(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ia(e,t,n),e.parseAsync=async(t,n)=>Fa(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>La(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ra(e,t,n),e.decode=(t,n)=>za(e,t,n),e.encodeAsync=async(t,n)=>Ba(e,t,n),e.decodeAsync=async(t,n)=>Va(e,t,n),e.safeEncode=(t,n)=>Ha(e,t,n),e.safeDecode=(t,n)=>Ua(e,t,n),e.safeEncodeAsync=async(t,n)=>Wa(e,t,n),e.safeDecodeAsync=async(t,n)=>Ga(e,t,n),qa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(He(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Qe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(us(e,t))},superRefine(e,t){return this.check(ds(e,t))},overwrite(e){return this.check(Bi(e))},optional(){return Ko(this)},exactOptional(){return Jo(this)},nullable(){return Xo(this)},nullish(){return Ko(Xo(this))},nonoptional(e){return ns(this,e)},array(){return Oo(this)},or(e){return Mo([this,e])},and(e){return Io(this,e)},transform(e){return os(this,Wo(e))},default(e){return Qo(this,e)},prefault(e){return es(this,e)},catch(e){return is(this,e)},pipe(e){return os(this,e)},readonly(){return cs(this)},describe(e){let t=this.clone();return qr.add(t,{description:e}),t},meta(...e){if(e.length===0)return qr.get(this);let t=this.clone();return qr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return qr.get(e)?.description},configurable:!0}),e)),Ya=L(`_ZodString`,(e,t)=>{Mn.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,qa(e,`_ZodString`,{regex(...e){return this.check(Pi(...e))},includes(...e){return this.check(Li(...e))},startsWith(...e){return this.check(Ri(...e))},endsWith(...e){return this.check(zi(...e))},min(...e){return this.check(Mi(...e))},max(...e){return this.check(ji(...e))},length(...e){return this.check(Ni(...e))},nonempty(...e){return this.check(Mi(1,...e))},lowercase(e){return this.check(Fi(e))},uppercase(e){return this.check(Ii(e))},trim(){return this.check(Hi())},normalize(...e){return this.check(Vi(...e))},toLowerCase(){return this.check(Ui())},toUpperCase(){return this.check(Wi())},slugify(){return this.check(Gi())}})}),Xa=L(`ZodString`,(e,t)=>{Mn.init(e,t),Ya.init(e,t),e.email=t=>e.check(Yr(Qa,t)),e.url=t=>e.check(ti(to,t)),e.jwt=t=>e.check(gi(go,t)),e.emoji=t=>e.check(ni(no,t)),e.guid=t=>e.check(Xr($a,t)),e.uuid=t=>e.check(Zr(eo,t)),e.uuidv4=t=>e.check(Qr(eo,t)),e.uuidv6=t=>e.check($r(eo,t)),e.uuidv7=t=>e.check(ei(eo,t)),e.nanoid=t=>e.check(ri(ro,t)),e.guid=t=>e.check(Xr($a,t)),e.cuid=t=>e.check(ii(io,t)),e.cuid2=t=>e.check(ai(ao,t)),e.ulid=t=>e.check(oi(oo,t)),e.base64=t=>e.check(pi(B,t)),e.base64url=t=>e.check(mi(mo,t)),e.xid=t=>e.check(si(so,t)),e.ksuid=t=>e.check(ci(co,t)),e.ipv4=t=>e.check(li(lo,t)),e.ipv6=t=>e.check(ui(uo,t)),e.cidrv4=t=>e.check(di(fo,t)),e.cidrv6=t=>e.check(fi(po,t)),e.e164=t=>e.check(hi(ho,t)),e.datetime=t=>e.check(Ea(t)),e.date=t=>e.check(Oa(t)),e.time=t=>e.check(Aa(t)),e.duration=t=>e.check(Ma(t))});function z(e){return Jr(Xa,e)}var Za=L(`ZodStringFormat`,(e,t)=>{Nn.init(e,t),Ya.init(e,t)}),Qa=L(`ZodEmail`,(e,t)=>{In.init(e,t),Za.init(e,t)}),$a=L(`ZodGUID`,(e,t)=>{Pn.init(e,t),Za.init(e,t)}),eo=L(`ZodUUID`,(e,t)=>{Fn.init(e,t),Za.init(e,t)}),to=L(`ZodURL`,(e,t)=>{Ln.init(e,t),Za.init(e,t)}),no=L(`ZodEmoji`,(e,t)=>{Rn.init(e,t),Za.init(e,t)}),ro=L(`ZodNanoID`,(e,t)=>{zn.init(e,t),Za.init(e,t)}),io=L(`ZodCUID`,(e,t)=>{Bn.init(e,t),Za.init(e,t)}),ao=L(`ZodCUID2`,(e,t)=>{Vn.init(e,t),Za.init(e,t)}),oo=L(`ZodULID`,(e,t)=>{Hn.init(e,t),Za.init(e,t)}),so=L(`ZodXID`,(e,t)=>{Un.init(e,t),Za.init(e,t)}),co=L(`ZodKSUID`,(e,t)=>{Wn.init(e,t),Za.init(e,t)}),lo=L(`ZodIPv4`,(e,t)=>{Yn.init(e,t),Za.init(e,t)}),uo=L(`ZodIPv6`,(e,t)=>{Xn.init(e,t),Za.init(e,t)}),fo=L(`ZodCIDRv4`,(e,t)=>{Zn.init(e,t),Za.init(e,t)}),po=L(`ZodCIDRv6`,(e,t)=>{Qn.init(e,t),Za.init(e,t)}),B=L(`ZodBase64`,(e,t)=>{er.init(e,t),Za.init(e,t)}),mo=L(`ZodBase64URL`,(e,t)=>{nr.init(e,t),Za.init(e,t)}),ho=L(`ZodE164`,(e,t)=>{rr.init(e,t),Za.init(e,t)}),go=L(`ZodJWT`,(e,t)=>{ar.init(e,t),Za.init(e,t)}),_o=L(`ZodNumber`,(e,t)=>{or.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r),qa(e,`ZodNumber`,{gt(e,t){return this.check(Oi(e,t))},gte(e,t){return this.check(ki(e,t))},min(e,t){return this.check(ki(e,t))},lt(e,t){return this.check(Ei(e,t))},lte(e,t){return this.check(Di(e,t))},max(e,t){return this.check(Di(e,t))},int(e){return this.check(bo(e))},safe(e){return this.check(bo(e))},positive(e){return this.check(Oi(0,e))},nonnegative(e){return this.check(ki(0,e))},negative(e){return this.check(Ei(0,e))},nonpositive(e){return this.check(Di(0,e))},multipleOf(e,t){return this.check(Ai(e,t))},step(e,t){return this.check(Ai(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function vo(e){return xi(_o,e)}var yo=L(`ZodNumberFormat`,(e,t)=>{sr.init(e,t),_o.init(e,t)});function bo(e){return Si(yo,e)}var xo=L(`ZodBoolean`,(e,t)=>{cr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oa(e,t,n,r)});function So(e){return Ci(xo,e)}var Co=L(`ZodUnknown`,(e,t)=>{lr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function wo(){return wi(Co)}var To=L(`ZodNever`,(e,t)=>{ur.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sa(e,t,n,r)});function Eo(e){return Ti(To,e)}var Do=L(`ZodArray`,(e,t)=>{fr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r),e.element=t.element,qa(e,`ZodArray`,{min(e,t){return this.check(Mi(e,t))},nonempty(e){return this.check(Mi(1,e))},max(e,t){return this.check(ji(e,t))},length(e,t){return this.check(Ni(e,t))},unwrap(){return this.element}})});function Oo(e,t){return Ki(Do,e,t)}var ko=L(`ZodObject`,(e,t)=>{_r.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r),Be(e,`shape`,()=>t.shape),qa(e,`ZodObject`,{keyof(){return Bo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:wo()})},loose(){return this.clone({...this._zod.def,catchall:wo()})},strict(){return this.clone({...this._zod.def,catchall:Eo()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return rt(this,e)},safeExtend(e){return it(this,e)},merge(e){return at(this,e)},pick(e){return tt(this,e)},omit(e){return nt(this,e)},partial(...e){return ot(Go,this,e[0])},required(...e){return st(ts,this,e[0])}})});function Ao(e,t){return new ko({type:`object`,shape:e??{},...R(t)})}var jo=L(`ZodUnion`,(e,t)=>{yr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r),e.options=t.options});function Mo(e,t){return new jo({type:`union`,options:e,...R(t)})}var No=L(`ZodDiscriminatedUnion`,(e,t)=>{jo.init(e,t),br.init(e,t)});function Po(e,t,n){return new No({type:`union`,options:t,discriminator:e,...R(n)})}var Fo=L(`ZodIntersection`,(e,t)=>{xr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r)});function Io(e,t){return new Fo({type:`intersection`,left:e,right:t})}var Lo=L(`ZodRecord`,(e,t)=>{wr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ro(e,t,n){return!t||!t._zod?new Lo({type:`record`,keyType:z(),valueType:e,...R(t)}):new Lo({type:`record`,keyType:e,valueType:t,...R(n)})}var zo=L(`ZodEnum`,(e,t)=>{Tr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ca(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new zo({...t,checks:[],...R(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new zo({...t,checks:[],...R(r),entries:i})}});function Bo(e,t){return new zo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}var Vo=L(`ZodLiteral`,(e,t)=>{Er.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>la(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ho(e,t){return new Vo({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var Uo=L(`ZodTransform`,(e,t)=>{Dr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ae(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(mt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(mt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Wo(e){return new Uo({type:`transform`,transform:e})}var Go=L(`ZodOptional`,(e,t)=>{kr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ko(e){return new Go({type:`optional`,innerType:e})}var qo=L(`ZodExactOptional`,(e,t)=>{Ar.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jo(e){return new qo({type:`optional`,innerType:e})}var Yo=L(`ZodNullable`,(e,t)=>{jr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xo(e){return new Yo({type:`nullable`,innerType:e})}var Zo=L(`ZodDefault`,(e,t)=>{Mr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Qo(e,t){return new Zo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ye(t)}})}var $o=L(`ZodPrefault`,(e,t)=>{Pr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function es(e,t){return new $o({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ye(t)}})}var ts=L(`ZodNonOptional`,(e,t)=>{Fr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ns(e,t){return new ts({type:`nonoptional`,innerType:e,...R(t)})}var rs=L(`ZodCatch`,(e,t)=>{Lr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function is(e,t){return new rs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var as=L(`ZodPipe`,(e,t)=>{Rr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r),e.in=t.in,e.out=t.out});function os(e,t){return new as({type:`pipe`,in:e,out:t})}var ss=L(`ZodReadonly`,(e,t)=>{Br.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cs(e){return new ss({type:`readonly`,innerType:e})}var ls=L(`ZodCustom`,(e,t)=>{Hr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ua(e,t,n,r)});function us(e,t={}){return qi(ls,e,t)}function ds(e,t){return Ji(e,t)}var fs={artificial_analysis_intelligence_index:{label:`Intelligence index`,scale:`index`},artificial_analysis_coding_index:{label:`Coding index`,scale:`index`},artificial_analysis_math_index:{label:`Math index`,scale:`index`},gpqa:{label:`GPQA Diamond`,scale:`fraction`},hle:{label:`Humanity's Last Exam`,scale:`fraction`},lcr:{label:`Long-context reasoning`,scale:`fraction`},livecodebench:{label:`LiveCodeBench`,scale:`fraction`},scicode:{label:`SciCode`,scale:`fraction`},math_500:{label:`MATH-500`,scale:`fraction`},aime:{label:`AIME`,scale:`fraction`},aime_25:{label:`AIME 2025`,scale:`fraction`},ifbench:{label:`IFBench`,scale:`fraction`},mmlu_pro:{label:`MMLU Pro`,scale:`fraction`},tau2:{label:`τ²-bench (agentic)`,scale:`fraction`},tau_banking:{label:`τ-bench banking`,scale:`fraction`},terminalbench_hard:{label:`Terminal-Bench Hard`,scale:`fraction`},terminalbench_v2_1:{label:`Terminal-Bench 2.1`,scale:`fraction`}};function ps(e){return(e.credentialVariants??[]).filter(e=>!e.operatorOnly)}function ms(e){let t=new Set(e.map(e=>e.definition.id));return e.filter(e=>!e.definition.clientGroup||e.definition.clientGroup===e.definition.id||!t.has(e.definition.clientGroup))}function hs(e,t){return e.filter(e=>e.definition.id===t||e.definition.clientGroup===t&&e.definition.id!==t)}function gs(e){return ms(e).filter(e=>e.definition.enabled&&e.definition.credentialClass!==`none`&&T(e.definition.id)&&!D(e.definition.id))}function _s(e){if(!e)return!1;try{let t=new URL(e).hostname.toLowerCase();return t===`127.0.0.1`||t===`localhost`||t===`::1`||t===`[::1]`}catch{return!1}}function vs(e,t={}){let n=e.displayName,r=t.credentialClass??e.credentialClass,i=t.baseUrl??e.baseUrl;return e.id===`oonacode`?{kind:`pool`,badge:`via OonaCode`,detail:`Runs on OonaCode's own provider accounts, through the OonaCode gateway. Priced models are billed to your account in credits; free models cost nothing on any plan.`,viaGateway:!0}:e.route===`direct`?{kind:`subscription-direct`,badge:`direct to provider`,detail:`Your ${n} subscription runs straight from this PC to the provider — it never passes through the OonaCode gateway.`,viaGateway:!1}:r===`api_key`&&e.kind!==`anthropic-passthrough`?{kind:`own-key-translated`,badge:`direct to provider`,detail:`Your ${n} key stays on this PC: OonaCode translates the request here and calls ${n} from this machine. The gateway sees neither the key nor the traffic.`,viaGateway:!1}:_s(i)?{kind:`local-server`,badge:`on this machine`,detail:`Runs against ${n} on this machine (${i}) — the request never leaves the PC.`,viaGateway:!1}:r===`api_key`&&e.kind===`anthropic-passthrough`&&e.directCapable===!0?{kind:`own-key-direct`,badge:`direct to provider`,detail:`Your ${n} key runs straight from this PC to ${n} — the OonaCode gateway is not in the path.`,viaGateway:!1}:{kind:`gateway`,badge:`via OonaCode`,detail:`Routed to ${n} through the OonaCode gateway.`,viaGateway:!0}}var ys=Po(`type`,[Ao({type:Ho(`oauth-device`),deviceAuthorizationUrl:z().url(),tokenUrl:z().url(),clientId:z().min(1),scopes:Oo(z().min(1)).min(1),signInLabel:z().min(1).optional(),referrer:z().min(1).optional()}),Ao({type:Ho(`openai-device`),deviceAuthorizationUrl:z().url(),pollUrl:z().url(),tokenUrl:z().url(),verificationUri:z().url(),redirectUri:z().url(),clientId:z().min(1),signInLabel:z().min(1).optional()})]),bs=Ao({id:z().min(1),displayName:z().min(1),upstreamId:z().min(1).optional(),servedBy:Oo(z().min(1)).optional(),subscriptionServedBy:Oo(z().min(1)).optional(),contextWindow:vo().int().positive().optional(),maxOutputTokens:vo().int().positive().optional(),supportsTools:So().optional(),supportsThinking:So().optional(),effortLevels:Oo(Bo(me)).optional(),supportsVision:So().optional(),inputPricePerM:vo().nonnegative().optional(),outputPricePerM:vo().nonnegative().optional(),notes:z().optional()}),xs=Ao({id:z().regex(/^[a-z0-9][a-z0-9-]{1,40}$/,`provider id must be lowercase kebab-case`),displayName:z().min(1),kind:Bo([`anthropic-passthrough`,`openai-compatible`,`gemini`]),route:Bo([`gateway`,`direct`]),credentialClass:Bo([`api_key`,`subscription`,`none`]),baseUrl:z().url(),messagesPath:z().startsWith(`/`).optional(),modelsPath:z().startsWith(`/`).optional(),auth:Ao({header:Bo([`x-api-key`,`authorization-bearer`,`api-key`,`none`]),extraHeaders:Ro(z(),z()).optional()}),models:Oo(bs),defaultModel:z().min(1),modelAliases:Ro(z(),z()).optional(),helperModel:z().min(1).optional(),capabilities:Ao({streaming:So(),tools:So(),thinking:So(),vision:So(),countTokens:So(),promptCaching:So(),promptCacheTtlSec:vo().int().positive().optional()}),translate:Ao({maxTokensParam:Bo([`max_tokens`,`max_completion_tokens`]).optional(),reasoningEffortFromBudget:So().optional(),reasoningContentField:z().nullable().optional(),supportsParallelToolCalls:So().optional(),systemRole:Bo([`system`,`developer`]).optional(),streamIncludeUsage:So().optional(),wire:Bo([`chat`,`responses`]).optional()}).optional(),passthrough:Ao({stripCacheControl:So().optional(),cacheChain:So().optional(),toolSchemaRequiredArray:So().optional(),toolDescriptionRequired:So().optional(),allowedBetas:Oo(z()).optional(),anthropicVersion:z().optional()}).optional(),userBaseUrl:So().optional(),engineEnv:Ro(z(),z()).optional(),directCapable:So().optional(),subscriptionLogin:ys.optional(),phase:Mo([Ho(1),Ho(2)]),enabled:So(),docsUrl:z().url().optional(),notes:z().optional(),references:Oo(Ao({label:z().min(1),url:z().url(),kind:Bo([`docs`,`pricing`,`models`,`console`,`status`,`keys`,`signup`,`other`]).optional()})).optional(),keyFormat:z().optional(),credentialVariants:Oo(Ao({id:z().min(1),label:z().min(1),header:Bo([`x-api-key`,`authorization-bearer`,`api-key`,`none`]).optional(),extraHeaders:Ro(z(),z()).optional(),operatorOnly:So().optional(),requiresClaudeCodeIdentity:So().optional(),subscriptionLogin:ys.optional(),claudeCodeShape:Ao({betas:z().min(1),userAgent:z().min(1),billingHeader:z().min(1),headers:Ro(z(),z()).optional()}).optional(),baseUrl:z().url().optional(),keyFormat:z().optional(),notes:z().optional()})).optional(),adminGroup:z().optional(),clientGroup:z().optional(),recordLabel:z().optional(),effortLevels:Oo(Bo(me)).optional()});Ao({version:vo().int().positive(),updatedAt:z(),providers:Oo(xs)});function Ss(e){return/^claude-/i.test(e)}function Cs(e,t){return{images:e.models.find(e=>e.id===t)?.supportsVision??e.capabilities.vision,documents:Ss(t)}}function ws(e,t,n){let r=Cs(e,t),i=new Set;for(let e of n){let t=e?.type;(t===`image`||t===`document`)&&i.add(t)}let a=e.models.find(e=>e.id===t)?.displayName??t;return i.has(`image`)&&!r.images?`${a} cannot read images. Remove the image, or pick a model that can — the model details say which.`:i.has(`document`)&&!r.documents?`${a} cannot read PDF documents — only Anthropic's Claude models take a PDF. Attach it as text, or pick a Claude model.`:null}var Ts={messages:`/v1/messages`,countTokens:`/v1/messages/count_tokens`,models:`/v1/models`,providerMessages:e=>`/p/${e}/v1/messages`,providerCountTokens:e=>`/p/${e}/v1/messages/count_tokens`,providerModels:e=>`/p/${e}/v1/models`,health:`/api/health`,streamCheck:`/api/stream-check`,register:`/api/auth/register`,login:`/api/auth/login`,refresh:`/api/auth/refresh`,logout:`/api/auth/logout`,me:`/api/auth/me`,prelogin:`/api/auth/prelogin`,tokens:`/api/me/tokens`,token:e=>`/api/me/tokens/${e}`,tokenPurge:e=>`/api/me/tokens/${e}/purge`,tokenUsage:e=>`/api/me/tokens/${e}/usage`,providers:`/api/me/providers`,provider:e=>`/api/me/providers/${e}`,providerTest:e=>`/api/me/providers/${e}/test`,routing:`/api/me/routing`,usage:`/api/me/usage`,usageSession:e=>`/api/me/usage/sessions/${e}`,devices:`/api/me/devices`,pushToken:`/api/me/push-token`,hostNotify:`/api/me/hosts/notify`,device:e=>`/api/me/devices/${e}`,hosts:`/api/me/hosts`,hostHeartbeat:`/api/me/hosts/heartbeat`,hostVaultUnlock:e=>`/api/me/hosts/${encodeURIComponent(e)}/vault-unlock`,host:e=>`/api/me/hosts/${encodeURIComponent(e)}`,vault:`/api/me/vault`,vaultEvents:`/api/me/vault/events`,historySessions:`/api/me/history/sessions`,historySession:e=>`/api/me/history/sessions/${e}`,historyEntries:e=>`/api/me/history/sessions/${e}/entries`,registry:`/api/registry`,releasesLatest:`/api/releases/latest`,releasesHistory:`/api/releases`,team:`/api/me/team`,teamInvites:`/api/me/team/invites`,teamInvite:e=>`/api/me/team/invites/${e}`,teamInviteLookup:`/api/team/invites/lookup`,teamInviteDecline:`/api/team/invites/decline`,teamJoin:`/api/me/team/join`,teamInvitations:`/api/me/team/invitations`,teamInvitationAccept:e=>`/api/me/team/invitations/${e}/accept`,teamInvitationDecline:e=>`/api/me/team/invitations/${e}/decline`,teamMember:e=>`/api/me/team/members/${e}`,teamLeave:`/api/me/team/leave`,teamTransfer:`/api/me/team/transfer`,teamAudit:`/api/me/team/audit`,teamCheckout:`/api/me/team/checkout`,teamTopup:`/api/me/team/topup`,teamSeats:`/api/me/team/seats`,googleConfig:`/api/auth/google/config`,googleStart:`/api/auth/google/start`,googleCallback:`/api/auth/google/callback`,githubConfig:`/api/auth/github/config`,githubStart:`/api/auth/github/start`,githubCallback:`/api/auth/github/callback`,googleUnlink:`/api/me/google`,telegramConfig:`/api/auth/telegram/config`,telegramAuth:`/api/auth/telegram`,telegram:`/api/me/telegram`,telegramWebhook:`/api/webhooks/telegram`,passphraseSetup:`/api/auth/passphrase/setup`,passphraseRekey:`/api/me/passphrase/rekey`,recovery:`/api/me/recovery`,recoveryChallenge:`/api/auth/recovery/challenge`,recoveryConsume:`/api/auth/recovery/consume`,deviceApprovals:`/api/me/device-approvals`,deviceApproval:e=>`/api/me/device-approvals/${e}`,deviceApprovalApprove:e=>`/api/me/device-approvals/${e}/approve`,deviceApprovalDeny:e=>`/api/me/device-approvals/${e}/deny`,passwordResetRequest:`/api/auth/password-reset/request`,passwordResetConfirm:`/api/auth/password-reset/confirm`,vaultRekeyComplete:`/api/me/vault/rekey-complete`,vaultRekeyPending:`/api/me/vault/rekey-pending`,emailVerifySend:`/api/auth/email/verify/send`,emailVerifyConfirm:`/api/auth/email/verify/confirm`,emailVerifyWatch:`/api/auth/email/verify/watch`,twoFactor:`/api/me/2fa`,twoFactorEnroll:`/api/me/2fa/enroll`,twoFactorConfirm:`/api/me/2fa/confirm`,twoFactorDisable:`/api/me/2fa/disable`,twoFactorDisableRequest:`/api/me/2fa/disable/request`,twoFactorRecoveryCodes:`/api/me/2fa/recovery-codes`,twoFactorVerify:`/api/auth/2fa/verify`,deviceLinkStart:`/api/auth/device/start`,deviceLinkPoll:`/api/auth/device/poll`,deviceLinks:`/api/me/device-links`,deviceLink:e=>`/api/me/device-links/${e}`,deviceLinkApprove:e=>`/api/me/device-links/${e}/approve`,deviceLinkDeny:e=>`/api/me/device-links/${e}/deny`,hostLogs:`/api/me/hosts/logs`,errorReport:`/api/me/errors`,bugReports:`/api/me/bug-reports`,plans:`/api/plans`,myPlan:`/api/me/plan`,checkout:`/api/me/plan/checkout`,creditsTopup:`/api/me/credits/topup`,billing:`/api/me/billing`},Es=2048,Ds=16384,Os=8e3,ks=5242880,As=12582912;new Set(`BCDFGHJKLMNPQRSTVWXZ`.split(``));var js=`discard-my-vault-and-history`,Ms=`Anyone who can use this device can use your saved provider keys without your passphrase. Turn this off on shared or public computers. You can revoke it any time from Devices.`,Ns=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`],Ps=/^([01]\d|2[0-3]):[0-5]\d$/;Ao({tz:z().min(1),windows:Oo(Ao({from:z().regex(Ps,`HH:MM`),to:z().regex(Ps,`HH:MM`),days:Oo(Bo(Ns)).optional(),kind:Bo([`peak`,`offpeak`])})),offpeakDiscount:vo().nonnegative().max(1).optional()});var Fs=[`priceInputCacheMissPeak`,`priceInputCacheMissOffpeak`,`priceInputCacheHitPeak`,`priceInputCacheHitOffpeak`,`priceCacheWritePeak`,`priceCacheWriteOffpeak`,`priceOutputPeak`,`priceOutputOffpeak`],Is=Ao({inputCacheMiss:vo().nonnegative(),inputCacheHit:vo().nonnegative().optional(),cacheWrite:vo().nonnegative().optional(),output:vo().nonnegative()});Ao({by:Ho(`prompt_tokens`),tiers:Oo(Ao({upToPromptTokens:vo().int().positive().optional(),price:Is,cost:Is.optional()})).min(1),note:z().optional()}).superRefine((e,t)=>{let n=0;e.tiers.forEach((r,i)=>{let a=r.upToPromptTokens;if(a===void 0){i!==e.tiers.length-1&&t.addIssue({code:`custom`,message:`only the LAST tier may omit upToPromptTokens`,path:[`tiers`,i]});return}a<=n&&t.addIssue({code:`custom`,message:`tiers must ascend: ${a} does not exceed ${n}`,path:[`tiers`,i,`upToPromptTokens`]}),n=a})}),[...Fs];var Ls={oonacode:{hex:`#000000`,owner:`OonaCode`,d:`M0.72 12a11.28 11.28 0 1 0 22.56 0a11.28 11.28 0 1 0 -22.56 0ZM4.8 12a7.2 7.2 0 1 0 14.4 0a7.2 7.2 0 1 0 -14.4 0ZM7.44 12a4.56 4.56 0 1 0 9.12 0a4.56 4.56 0 1 0 -9.12 0Z`,fillRule:`evenodd`},anthropic:{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},"anthropic-subscription":{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},openai:{hex:`#000000`,owner:`OpenAI`,d:`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`},xai:{hex:`#000000`,owner:`xAI`,d:`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`},deepseek:{hex:`#5786FE`,owner:`DeepSeek`,d:`M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45`},kimi:{hex:`#000000`,owner:`Moonshot`,d:`M21.765.351C22.998.351 24 1.353 24 2.586S22.998 4.82 21.765 4.82h-1.974c-.15 0-.26-.12-.26-.26V2.586A2.237 2.237 0 0 1 21.765.35M9.41 13.388l8.447-8.377c.16-.16.07-.471-.14-.471h-4.55s-.1.02-.14.06l-9.099 9.029c-.14.14-.35.02-.35-.21V4.81c0-.15-.1-.27-.221-.27H.22c-.12 0-.22.12-.22.27v18.57c0 .15.1.27.22.27h3.137c.12 0 .22-.12.22-.27v-3.79c0-.08.03-.16.08-.21l2.826-2.796c.07-.07.16-.08.241-.03l7.546 5.551a8.9 8.9 0 0 0 4.018 1.493c.12.01.23-.11.23-.27V19.76c0-.14-.08-.25-.19-.26a5.8 5.8 0 0 1-2.355-.942l-6.533-4.73c-.14-.09-.15-.32-.03-.441`},qwen:{hex:`#6950EF`,owner:`Alibaba`,d:`M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z`},mimo:{hex:`#FF6900`,owner:`Xiaomi`,d:`M12 0C8.016 0 4.756.255 2.493 2.516.23 4.776 0 8.033 0 12.012c0 3.98.23 7.235 2.494 9.497C4.757 23.77 8.017 24 12 24c3.983 0 7.243-.23 9.506-2.491C23.77 19.247 24 15.99 24 12.012c0-3.984-.233-7.243-2.502-9.504C19.234.252 15.978 0 12 0zM4.906 7.405h5.624c1.47 0 3.007.068 3.764.827.746.746.827 2.233.83 3.676v4.54a.15.15 0 0 1-.152.147h-1.947a.15.15 0 0 1-.152-.148V11.83c-.002-.806-.048-1.634-.464-2.051-.358-.36-1.026-.441-1.72-.458H7.158a.15.15 0 0 0-.151.147v6.98a.15.15 0 0 1-.152.148H4.906a.15.15 0 0 1-.15-.148V7.554a.15.15 0 0 1 .15-.149zm12.131 0h1.949a.15.15 0 0 1 .15.15v8.892a.15.15 0 0 1-.15.148h-1.949a.15.15 0 0 1-.151-.148V7.554a.15.15 0 0 1 .151-.149zM8.92 10.948h2.046c.083 0 .15.066.15.147v5.352a.15.15 0 0 1-.15.148H8.92a.15.15 0 0 1-.152-.148v-5.352a.15.15 0 0 1 .152-.147Z`}};function Rs(e){return Ls[e]??null}function zs(e){let t=e.replace(/\(.*?\)/g,` `).split(/[\s/_-]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[1][0]}`.toUpperCase()}var Bs=[`stable`,`dev`];function Vs(e){return typeof e==`string`&&Bs.includes(e)}function Hs(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return Vs(t)?t:null}function Us(e){let t=Hs(e)??`stable`;return t===`stable`?Ts.releasesLatest:`${Ts.releasesLatest}?channel=${encodeURIComponent(t)}`}function Ws(e,t){let n=Hs(t)??`stable`;return n===`stable`?e:`${e} (${n})`}var Gs=5e4,Ks=[`bg`,`surface`,`surface-2`,`surface-3`,`border`,`fg`,`fg-muted`,`fg-faint`,`accent`,`accent-fg`,`accent-soft`,`project`,`ok`,`ok-soft`,`warn`,`warn-soft`,`danger`,`danger-soft`,`think`,`think-soft`,`code-bg`,`user-bubble`],qs={agentFinished:!1,permissionRequired:!0,errorOccurred:!0},Js={autoAcceptPermissions:!1,showReasoningSummaries:!0,notifications:qs,showAgentPicker:!0,transcriptWindowSize:500,openTabs:[],draftTabs:[],draftTitles:{},activeTab:null,remoteTabs:{},sessionPanelOpen:!1,explorerOpen:!1,dismissedUpdateVersion:null,lastSeenReleaseNotes:null,claudeImportOffered:!1,claudeImportOffers:0,collapsedProjects:[],themeColors:{light:{},dark:{}}};function Ys(e){return Math.min(Math.max(typeof e==`number`&&Number.isFinite(e)?Math.floor(e):0,0),3)}function Xs(e){return Math.min(Gs,Math.max(100,typeof e==`number`&&Number.isFinite(e)?Math.round(e):500))}function Zs(e,t){return typeof e==`boolean`?e:t}function Qs(e){return typeof e==`string`&&e.length>0&&e.length<=64?e:null}function $s(e,t=50){if(!Array.isArray(e))return[];let n=[];for(let r of e)if(!(typeof r!=`string`||r.length===0||r.length>200)&&!n.includes(r)&&(n.push(r),n.length>=t))break;return n}function ec(e,t=50){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n={};for(let[r,i]of Object.entries(e))if(!(r.length===0||r.length>200)&&!(typeof i!=`string`||i.length===0||i.length>200)&&(n[r]=i,Object.keys(n).length>=t))break;return n}function tc(e){if(typeof e!=`string`)return null;let t=e.trim();return/^#[0-9a-fA-F]{6}$/.test(t)?t.toLowerCase():null}function nc(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!Ks.includes(n))continue;let e=tc(r);e!==null&&(t[n]=e)}return t}function rc(e){let t=typeof e==`object`&&e?e:{};return{light:nc(t.light),dark:nc(t.dark)}}function ic(e){let t=typeof e==`object`&&e?e:{},n=typeof t.notifications==`object`&&t.notifications!==null?t.notifications:{},r=$s(t.openTabs),i=$s(t.draftTabs).filter(e=>!r.includes(e)),a={};for(let[e,n]of Object.entries(ec(t.draftTitles)))i.includes(e)&&(a[e]=n);let o=[...r,...i],s=t.activeTab,c=typeof s==`string`&&o.includes(s)?s:o[o.length-1]??null;return{autoAcceptPermissions:Zs(t.autoAcceptPermissions,Js.autoAcceptPermissions),showReasoningSummaries:Zs(t.showReasoningSummaries,Js.showReasoningSummaries),notifications:{agentFinished:Zs(n.agentFinished,qs.agentFinished),permissionRequired:Zs(n.permissionRequired,qs.permissionRequired),errorOccurred:Zs(n.errorOccurred,qs.errorOccurred)},showAgentPicker:Zs(t.showAgentPicker,Js.showAgentPicker),transcriptWindowSize:Xs(t.transcriptWindowSize),openTabs:r,draftTabs:i,draftTitles:a,activeTab:c,remoteTabs:ec(t.remoteTabs),sessionPanelOpen:Zs(t.sessionPanelOpen,Js.sessionPanelOpen),explorerOpen:Zs(t.explorerOpen,Js.explorerOpen),dismissedUpdateVersion:Qs(t.dismissedUpdateVersion),lastSeenReleaseNotes:Qs(t.lastSeenReleaseNotes),claudeImportOffered:Zs(t.claudeImportOffered,Js.claudeImportOffered),claudeImportOffers:Ys(t.claudeImportOffers),collapsedProjects:$s(t.collapsedProjects),themeColors:rc(t.themeColors)}}new Set(Object.keys(Js));var ac=[{version:`0.3.133`,date:`2026-09-23`,added:[`Bring your Claude desktop app projects across: File → Import chats from other coding agents now lists every project the Claude app has opened on this PC. Each one arrives as an OonaCode project of the same name — its goal, instructions and what Claude noted about it become the project’s instructions — with its project chat and one chat per thread filed under it, ready to carry on.`,`A Claude Code chat you moved into a Claude app project is filed under that project here too.`,`A thread you never opened in the Claude app still comes across, with its task and every reply the project chat saw; open it once in the Claude app and import again for its whole conversation.`],fixed:[`Cursor chats appear in the import list again — they had been left out since September 10.`]},{version:`0.3.132`,date:`2026-09-23`,added:[`Reply to any part of a chat: select some text (or just right-click a block), choose Reply, and it is quoted in your message box — type your answer under it. A quote from a file the agent read names the file.`,`Right-click in a chat: copy what you selected, copy a whole reply or tool output, copy a code block or a link, find the selected words in the chat, or select a block.`,`Search in a chat opens the block its match is in — a folded tool card, a thought, a finished agent’s work — and scrolls to the words themselves.`,`Search matches are now bright orange, the current one strongest, so they stand out on code too.`,`The file viewer shows pictures (PNG, JPEG, GIF, WebP, SVG and more), plays audio and video, and shows Markdown formatted, with a switch to the source.`,`Right-click a file or folder in the explorer to copy its path or delete it.`],fixed:[`Moving a chat to another folder or project while it was working could delete the folder it was working in, start two agents at once, or send your next message to the old folder.`,`The working line no longer says a chat may be stuck while it waits for your approval or answer, or right after you send a message, and it counts time correctly (no more "4m 60s").`,`A date line no longer says "Today" for yesterday’s messages when the app stays open past midnight.`,"Installing with npm (`npm i -g oonacode`) installs this version again; earlier npm releases carried an old program.",`The What’s new window could open again on the next start, showing the same update a second time.`,`An older OonaCode window or VS Code extension no longer resets settings it does not know about, such as your theme colours or which project groups you folded.`,`A new install no longer opens with a list of changes; this window now appears only after an update.`,`The notification switch for permissions now says it also covers the agent’s questions.`]},{version:`0.3.131`,date:`2026-09-23`,added:[`Claude Opus 5.5 is here — the newest Opus, and cheaper to run than Opus 5. Choose it in the model picker, from the OonaCode pool or on your own Claude subscription. It runs on the newer Claude Code engine (2.1.280) that this update brings.`,`Every block in a chat shows its time at the bottom right, in your local time — hover it for the full date — and a date line marks where each day starts.`,`A running chat tells you how long the agent has been quiet, and after five minutes that it may be stuck and what to do.`,`After every update, OonaCode now opens this window to show you what changed.`],fixed:[`A reply that streamed in live had no time on it until the chat was opened again.`,`Chats open in tabs could fail to come back after a restart if a setting changed while they were being restored.`]}];function oc(e,t){let n=e=>{let[t,...n]=e.trim().replace(/^v/,``).split(`-`);return{nums:(t??``).split(`.`).map(e=>Number.parseInt(e,10)||0),pre:n.length>0?n.join(`-`):null}},r=n(e),i=n(t);for(let e=0;e<Math.max(r.nums.length,i.nums.length);e++){let t=(r.nums[e]??0)-(i.nums[e]??0);if(t!==0)return t}return r.pre===i.pre?0:r.pre===null?1:i.pre===null?-1:sc(r.pre,i.pre)}function sc(e,t){let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e],i=r[e];if(t===i)continue;if(t===void 0)return-1;if(i===void 0)return 1;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);if(a&&o){let e=Number(t)-Number(i);if(e!==0)return e;continue}return a===o?t<i?-1:1:a?-1:1}return 0}function cc(e,t,n=ac){if(!e||e===`0.0.0`)return[];let r=n.filter(t=>oc(t.version,e)<=0);return[...t===null?r.filter(t=>oc(t.version,e)===0):r.filter(e=>oc(e.version,t)>0)].sort((e,t)=>oc(t.version,e.version))}function lc(e,t,n,r=ac){if(!e||e===`0.0.0`)return{record:null,show:[]};let i=null;for(let e of r)(i===null||oc(e.version,i)>0)&&(i=e.version);let a=i!==null&&oc(e,i)>0?i:e;return{record:t===null||oc(a,t)>0?a:null,show:t===null&&!n?[]:cc(e,t,r)}}function uc(e,t){if(t==null)return[...e];if(t.length===0)return[];let n=new Set(t),r=e.filter(e=>n.has(e.id));return r.length>0?r:[...e]}var dc=`the user skipped the question`,fc=`(the user skipped this question)`;function pc(e){let t=e?.questions;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.question!=`string`)continue;let r=Array.isArray(t.options)?t.options.map(e=>e&&typeof e==`object`?e:null).filter(e=>e!==null&&typeof e.label==`string`).map(e=>({label:e.label,...typeof e.description==`string`?{description:e.description}:{}})):[];n.push({question:t.question,header:typeof t.header==`string`?t.header:``,options:r,multiSelect:t.multiSelect===!0})}return n}function mc(e,t,n={},r=new Set){let i={};return e.forEach((e,a)=>{if(r.has(a)){i[e.question]=fc;return}let o=[...t[a]??[]],s=(n[a]??``).trim();s&&o.push(s),i[e.question]=o.join(`, `)}),i}function hc(e,t,n){return n?`${e}::${n}::${t}`:`${e}::${t}`}function gc(e,t){return e===`oonacode`?-1:t}function _c(e){return e.filter(e=>e.definition.enabled&&e.configured&&T(e.definition.id)&&!D(e.definition.id)&&e.definition.models.length>0).map((e,t)=>({p:e,order:gc(e.definition.id,t)})).sort((e,t)=>e.order-t.order).map(e=>e.p)}function vc(e){let t=ps(e.definition);if(t.length<2)return[{variantId:null,suffix:``}];let n=new Set((e.credentials??[]).map(e=>e.variantId??`payg`)),r=t.filter(e=>n.has(e.id));return r.length<2?[{variantId:null,suffix:``}]:r.map(e=>({variantId:e.id,suffix:` ${yc(e.id,e.label)}`}))}function yc(e,t){return e===`token-plan`?`Subscription`:e===`payg`||e===`api-key`?`API`:t}function bc(e,t){let n=_c(e),r=e=>{let t=e.definition.clientGroup,r=(t?n.find(e=>e.definition.id===t)?.definition:void 0)?.displayName??e.definition.displayName,i=n.filter(n=>(n.definition.clientGroup??n.definition.id)===(t??e.definition.id));return e.definition.recordLabel&&i.length>1?`${r} ${e.definition.recordLabel}`:r};return n.flatMap(n=>{let i=uc(n.definition.models,t?.[n.definition.id]),a=r(n);return vc(n).map(t=>({providerId:n.definition.id,variantId:t.variantId,label:`${a}${t.suffix}`,route:n.definition.route,models:i.map(r=>({providerId:n.definition.id,variantId:t.variantId,modelId:r.id,label:r.displayName||r.id,value:hc(n.definition.id,r.id,t.variantId),free:r.free===!0,details:{...r.aaIntelligence===void 0?{}:{intelligence:r.aaIntelligence},...r.aaCoding===void 0?{}:{coding:r.aaCoding},...r.aaOutputTps===void 0?{}:{outputTps:r.aaOutputTps},...r.aaTtft===void 0?{}:{ttft:r.aaTtft},...r.contextWindow===void 0?{}:{contextWindow:r.contextWindow},...r.maxOutputTokens===void 0?{}:{maxOutputTokens:r.maxOutputTokens},...r.supportsThinking===void 0?{}:{thinking:r.supportsThinking},...r.supportsVision===void 0?{}:{vision:r.supportsVision},...r.supportsTools===void 0?{}:{tools:r.supportsTools},...r.inputPricePerM===void 0?{}:{inputPricePerM:r.inputPricePerM},...r.outputPricePerM===void 0?{}:{outputPricePerM:r.outputPricePerM},...r.notes===void 0?{}:{notes:r.notes},...r.aa===void 0?{}:{aa:r.aa},...r.servedBy===void 0?{}:{providers:r.servedBy.map(t=>{let n=e.find(e=>e.definition.id===t)?.definition,i=n?.displayName??t;if(!r.subscriptionServedBy?.includes(t))return i;let a=n?.credentialVariants?.find(e=>e.id===`token-plan`)?.label;return`${i} — ${a?a.replace(/\s*\(.*\)\s*$/,``):`subscription`}`})}}}))}))}).filter(e=>e.models.length>0)}function xc(e,t){let n=bc(e),r=n[0]??null,i=t.providerId??r?.providerId??null,a=t.variantId??(i?n.find(e=>e.providerId===i)?.variantId??null:r?.variantId??null);return i?t.model?{providerId:i,variantId:a,modelId:t.model}:{providerId:i,variantId:a,modelId:e.find(e=>e.definition.id===i)?.definition?.defaultModel||n.find(e=>e.providerId===i)?.models[0]?.modelId||null}:{providerId:null,variantId:a,modelId:t.model??null}}function Sc(e){if(!Number.isFinite(e))return`0 credits`;let t=Math.round(e*1e3)/1e3,n=t.toFixed(3).replace(/\.?0+$/,``);return`${n===``?`0`:n} credit${t===1?``:`s`}`}function Cc(e){if(typeof e!=`string`)return null;let t=/^API Error\b:?\s*(?:(\d{3})(?!\d)\s*)?([\s\S]*)$/i.exec(e.trim());return t?{status:t[1]===void 0?null:Number(t[1]),message:(t[2]??``).trim()}:null}function wc(e){return typeof e!=`string`||e===``?!1:/prompt is too long|maximum context length|context[ _-]?length[ _-]?exceeded|input token count exceeds|too many (?:input )?tokens|exceeds? the (?:maximum|model's) context/i.test(e)}var Tc=`chat too long for this model`;function Ec(e,t){if(wc(t))return Tc;switch(e){case 400:case 422:return`invalid request`;case 401:return`sign-in needed`;case 402:return`insufficient credits`;case 403:return`not allowed`;case 404:return`model not found`;case 408:case 504:return`timed out`;case 413:return`request too large`;case 429:return`rate limited`;default:return e!==null&&e>=500&&e<=599?`provider error`:`API error`}}var Dc={error_max_turns:`max turns reached`,error_max_budget_usd:`budget reached`,error_during_execution:`error during execution`,error_max_structured_output_retries:`structured output failed`,interrupted:`interrupted`,success:`error`};function Oc(e){if(!e.isError)return`turn complete`;let t=Cc(e.text);if(t)return Ec(t.status,t.message);let n=Dc[e.subtype];if(n!==void 0)return n;let r=e.subtype.replace(/_/g,` `).trim();return r===``?`error`:r}var kc={authentication_failed:`sign-in needed`,billing_error:`billing problem`,rate_limit:`rate limited`,invalid_request:`invalid request`,server_error:`provider error`};function Ac(e,t){if(typeof e!=`string`)return null;let n=e.trim();if(n===``)return null;if(wc(t))return Tc;let r=kc[n];if(r!==void 0)return r;if(n===`unknown`){let e=Cc(t);return e?Ec(e.status,e.message):wc(t)?Tc:`error`}return n.replace(/_/g,` `)}function jc(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function Mc(e,t){let n=typeof e==`object`&&e?e:{},r={input:jc(n.input_tokens),cached:jc(n.cache_read_input_tokens)+jc(n.cache_creation_input_tokens),output:jc(n.output_tokens)};if(r.input+r.cached+r.output>0||typeof t!=`object`||!t)return r;let i={input:0,cached:0,output:0};for(let e of Object.values(t)){if(typeof e!=`object`||!e)continue;let t=e;i.input+=jc(t.inputTokens),i.cached+=jc(t.cacheReadInputTokens)+jc(t.cacheCreationInputTokens),i.output+=jc(t.outputTokens)}return i}function Nc(e,t,n=140){let r=t??{};for(let t of[`command`,`file_path`,`pattern`,`query`,`url`,`path`,`prompt`]){let i=r[t];if(typeof i==`string`&&i.trim().length>0){let t=i.replace(/\s+/g,` `).trim();return`${e}: ${t.length>n?`${t.slice(0,n)}…`:t}`}}return e}var Pc={complete:`/api/v1/account/vault/rekey-complete`,revoke:`/api/v1/account/vault/rekey-revoke`,deviceUnlock:`/api/v1/account/device-unlock`};function Fc(e){return e?.deviceUnlock??`off`}function Ic(e){if(!e?.loggedIn)return null;let t=e;if(t.vaultStatus!==`pending_rekey`)return null;let n=t.vaultRekeyPending??null;return{pending:n,canFinishHere:t.canFinishRekey===!0,trustedDevices:n?.trustedDevices.map(e=>e.label||e.name)??[],since:n?.since??null,from:Lc(n)}}function Lc(e){if(!e)return null;let t=e.requestedFrom.device?.trim()||null,n=e.requestedFrom.ip?.trim()||null;return t&&n?`${t} (${n})`:t??n}function Rc(e){if(!e)return`an unknown date`;let t=Date.parse(e);if(Number.isNaN(t))return`an unknown date`;try{return new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}catch{return new Date(t).toISOString()}}function zc(e){let t=e.from?` from ${e.from}`:``;return`A password reset was started on ${Rc(e.since)}${t}. Your saved provider keys are still sealed under the old password.`}function Bc(e){return e.trustedDevices.length===0?`No device with "keep me unlocked" is left, so nothing here holds the key from before the reset.`:`Open OonaCode on ${Hc(e.trustedDevices)} to finish the reset — your saved keys are waiting there.`}var Vc=`Either way, your vault Recovery Key still works: sign in on the OonaCode website from any device and finish the reset there. Discarding is the last resort — it deletes your saved provider keys, your mirrored history and that Recovery Key for good.`;function Hc(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} or ${e[e.length-1]}`}function Uc(e){return e.canFinishHere?`A password reset is waiting: this PC can move your vault to the new password.`:e.trustedDevices.length>0?`A password reset is waiting — your saved keys stay locked until it is finished on ${Hc(e.trustedDevices)}.`:`A password reset is waiting and no PC holds the old key — finish it with your vault Recovery Key on the OonaCode website.`}var Wc=class extends Error{code;status;details;constructor(e,t,n,r){super(n),this.name=`HostApiError`,this.code=e,this.status=t,this.details=r}get isUnauthorized(){return this.status===401||this.code===`unauthorized`}get isEmailNotVerified(){return this.code===`email_not_verified`}};function Gc(e){if(!e)return``;let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function Kc(e){return e.trim().replace(/\/+$/,``)}function qc(e,t){let n=Kc(e.baseUrl),r=t??((e,t)=>fetch(e,t));async function i(t,i,a,o={}){let s={Authorization:`Bearer ${e.token}`,Accept:o.raw||o.bytes?`*/*`:`application/json`},c={method:t,headers:s,credentials:`omit`};a!==void 0&&(s[`Content-Type`]=`application/json`,c.body=JSON.stringify(a));let l;try{l=await r(`${n}${i}`,c)}catch(e){throw new Wc(`network`,0,`Cannot reach the host at ${n}: ${String(e?.message??e)}`)}if(!l.ok){let e=null,t=``;try{t=await l.text(),e=t?JSON.parse(t):null}catch{e=null}let n=e?.error?.code??(l.status===401?`unauthorized`:`internal`),r=e?.error?.message??(t||`${l.status} ${l.statusText}`);throw new Wc(n,l.status,r,e?.error?.details)}if(o.bytes)return await l.arrayBuffer();if(o.raw)return await l.text();if(l.status===204)return;let u=await l.text();if(u)try{return JSON.parse(u)}catch{throw new Wc(`parse`,l.status,`Host returned malformed JSON for ${t} ${i}`)}}let a=Te;return{health:()=>i(a.health,I.health),info:()=>i(a.info,I.info),listSessions:e=>i(a.listSessions,`${I.sessions}${Gc(e)}`),createSession:e=>i(a.createSession,I.sessions,e),getSession:e=>i(a.getSession,I.session(e)),updateSession:(e,t)=>i(a.updateSession,I.session(e),t),deleteSession:e=>i(a.deleteSession,I.session(e)),exportSessionsArchive:async t=>{let i=await r(`${n}${I.sessionsExportArchive}`,{method:`POST`,credentials:`omit`,headers:{Authorization:`Bearer ${e.token}`,Accept:`application/zip`,"Content-Type":`application/json`},body:JSON.stringify({password:t})});if(!i.ok){let e=await i.text().catch(()=>``),t=null;try{t=e?JSON.parse(e):null}catch{t=null}throw new Wc(t?.error?.code??`internal`,i.status,t?.error?.message??e??`the export failed`)}return i.blob()},listEntries:(e,t)=>i(a.listEntries,`${I.sessionEntries(e)}${Gc(t)}`),listMessages:e=>i(a.listMessages,I.sessionMessages(e)),prompt:(e,t)=>i(a.prompt,I.sessionPrompt(e),{...t,stream:!1}),interrupt:e=>i(a.interrupt,I.sessionInterrupt(e),{}),cancelQueued:(e,t)=>i(a.cancelQueued,I.sessionQueued(e,t)),forkSession:(e,t)=>i(a.fork,I.sessionFork(e),t??{}),exportSession:(e,t)=>i(a.export,`${I.sessionExport(e)}${Gc(t)}`,void 0,{raw:!0}),listProjects:()=>i(a.listProjects,I.projects),listVaultProjects:()=>i(a.listVaultProjects,I.vaultProjects),createVaultProject:e=>i(a.createVaultProject,I.vaultProjects,e),updateVaultProject:(e,t)=>i(a.updateVaultProject,I.vaultProject(e),t),deleteVaultProject:e=>i(a.deleteVaultProject,I.vaultProject(e)),scanClaudeSessions:()=>i(a.scanClaudeSessions,I.importClaude),importClaudeSessions:e=>i(a.importClaudeSessions,I.importClaude,e??{}),sessionLink:e=>i(a.sessionLink,I.sessionLink(e)),syncSessionDown:e=>i(a.syncSessionDown,I.sessionSyncDown(e),{}),inspectProject:e=>i(a.inspectProject,`${I.projectInspect}${Gc(e)}`),attachSessionProject:(e,t)=>i(a.attachSessionProject,I.sessionProject(e),t),listProviders:()=>i(a.listProviders,I.providers),setActiveProvider:e=>i(a.setActiveProvider,I.providersActive,e),testProvider:e=>i(a.providerTest,I.providerTest(e),{}),probeCredential:(e,t)=>i(a.providerProbe,I.providerProbe(e),t),listModels:e=>i(a.listModels,`${I.models}${Gc(e)}`),getSettings:()=>i(a.getSettings,I.settings),updateSettings:e=>i(a.updateSettings,I.settings,e),getAccount:()=>i(a.getAccount,I.account),login:e=>i(a.login,I.accountLogin,e),logout:()=>i(a.logout,I.accountLogout,{}),unlock:e=>i(a.unlock,I.accountUnlock,e),lock:()=>i(`POST`,I.accountLock,{reason:`user`}),plan:()=>i(`GET`,I.accountPlan),remoteUnlockHost:(e,t)=>i(`POST`,I.hostVaultUnlock(e),{password:t}),resendVerification:e=>i(a.resendVerification,I.accountResendVerification,e),startAccountLink:e=>i(a.linkStart,I.accountLinkStart,e??{}),accountLinkStatus:()=>i(a.linkStatus,I.accountLinkStatus),cancelAccountLink:()=>i(a.linkCancel,I.accountLinkCancel,{}),completeVaultRekey:e=>i(`POST`,Pc.complete,e),revokeVaultRekey:e=>i(`POST`,Pc.revoke,e),setDeviceUnlock:e=>i(`POST`,Pc.deviceUnlock,e),listCredentials:()=>i(a.listCredentials,I.credentials),addCredential:e=>i(a.addCredential,I.credentials,e),deleteCredential:e=>i(a.deleteCredential,I.credential(e)),testCredential:e=>i(a.credentialTest,I.credentialTest(e),{}),syncNow:()=>i(a.syncNow,I.syncNow,{}),claudeSubscriptionLogin:()=>i(a.claudeLogin,I.subscriptionClaudeLogin,{}),claudeSubscriptionStatus:()=>i(a.claudeStatus,I.subscriptionClaudeStatus),claudeLoginState:()=>i(a.claudeLoginState,I.subscriptionClaudeLoginState),claudeLoginCode:e=>i(a.claudeLoginCode,I.subscriptionClaudeLoginCode,e),claudeLoginCancel:()=>i(a.claudeLoginCancel,I.subscriptionClaudeLoginCancel,{}),oauthLoginStart:e=>i(a.oauthLogin,I.subscriptionOauthLogin(e),{}),oauthLoginState:e=>i(a.oauthLoginState,I.subscriptionOauthLoginState(e)),oauthLoginCancel:e=>i(a.oauthLoginCancel,I.subscriptionOauthLoginCancel(e),{}),doctor:()=>i(a.doctor,I.doctor),listHosts:()=>i(a.listHosts,I.hosts),listHostSessions:e=>i(a.listHostSessions,I.hostSessions(e)),deleteHostSession:(e,t)=>i(a.deleteHostSession,I.hostSession(e,t),{method:`DELETE`}),updateHost:(e,t)=>i(a.updateHost,I.host(e),t),listHostSessionEntries:(e,t,n)=>i(a.listHostSessionEntries,`${I.hostSessionEntries(e,t)}${Gc(n)}`),reportError:e=>i(a.errorReport,I.errorReport,e),sendBugReport:e=>i(a.bugReport,I.bugReport,e),listSessionFiles:(e,t)=>i(a.listSessionFiles,`${I.sessionFiles(e)}${Gc({path:t})}`),readSessionFile:(e,t)=>i(a.readSessionFile,`${I.sessionFile(e)}${Gc({path:t})}`,void 0,{raw:!0}),readSessionFileBytes:(e,t)=>i(a.readSessionFile,`${I.sessionFile(e)}${Gc({path:t})}`,void 0,{bytes:!0}),deleteSessionFile:(e,t)=>i(a.deleteSessionFile,`${I.sessionFile(e)}${Gc({path:t})}`)}}function Jc(e){return e instanceof Wc&&(e.status===404||e.status===501)}var Yc=120;function Xc(){return Yc}function Zc(e){let t=e.batchMs??120,n=e.hiddenBatchMs??1e3,r=e.isHidden??(()=>!1),i=e.now??(()=>Date.now()),a=e.setTimeout??((e,t)=>setTimeout(e,t)),o=e.clearTimeout??(e=>clearTimeout(e)),s=[],c=null,l=-1/0,u=!1,d=()=>{if(c!==null&&(o(c),c=null),s.length===0)return;let t=s;s=[],l=i(),e.deliver(t)};return{push(o){if(u)return;if(s.push(o),!e.isStreamFrame(o)){d();return}let f=r()?n:t;if(f<=0){d();return}if(c!==null)return;let p=i()-l;if(p>=f){d();return}c=a(()=>{c=null,d()},f-p)},flush:d,dispose(){u=!0,c!==null&&o(c),c=null,s=[]}}}function Qc(e){return e instanceof Wc&&e.code===`email_not_verified`}function $c(e){if(!Qc(e))return null;let t={error:{code:e.code,message:e.message,details:e.details}};return A(t)?t.error.details:null}function el(e){let t=e.trim(),n=t.indexOf(`@`);return n<=0?`***`:`${t.slice(0,1)}***${t.slice(n)}`}function tl(e,t){return e===void 0||!Number.isFinite(e)||e<=0?t:t+Math.ceil(e)*1e3}function nl(e,t){return Math.max(0,Math.ceil((e.resendAt-t)/1e3))}function rl(e,t){if(!Qc(e))return null;let n=t.now??Date.now(),r=$c(e),i=t.email.trim();return{email:i,displayEmail:r?.email||el(i),verification:r?.verification??`pending`,registered:t.registered===!0,resendAt:tl(r?.resendAfterSec,n)}}function il(e){let t=e.registered?`Account created. `:``;return e.verification===`unverified`?`${t}Confirm your email first — no link is outstanding for ${e.displayEmail}; send a new one.`:`${t}Confirm your email first — we sent a link to ${e.displayEmail}.`}function al(e=null){return{sessionId:e,session:null,items:[],index:new Map,status:`idle`,activeTurnId:null,init:null,statusText:null,pendingPermissions:[],lastSeq:null,totals:{costUsd:0,inputTokens:0,cachedInputTokens:0,outputTokens:0,turns:0},turnCachedTokens:0,hydrated:!1,agentActivity:{},hasSubagentItems:!1,hasOptimisticUser:!1,lastLocalPromptId:null,lastFrameAt:null,lastLiveUuid:null,engineSince:null,subpathParents:{},seen:new Set,streams:{},nextId:1}}function ol(e,t){let n=e.agentActivity[t.agentId],r={subpath:t.subpath,firstAt:n?Math.min(n.firstAt,t.at):t.at,at:n?Math.max(n.at,t.at):t.at,finished:t.finished,toolUses:(n?.toolUses??0)+t.toolUses};return{...e,agentActivity:{...e.agentActivity,[t.agentId]:r}}}function sl(e,t,n,r,i,a){let o=Hl.exec(t)?.[2];if(!o)return e;let s=i&&Date.parse(i)||0;if(n!==`assistant`)return ol(e,{agentId:o,subpath:t,at:s,finished:e.agentActivity[o]?.finished??!1,toolUses:0});let c=(Array.isArray(r)?r:[]).filter(e=>e.type===`tool_use`),l=c.length===0;return typeof a==`string`&&(l=a===`end_turn`||a===`stop_sequence`),c.some(e=>e.name===`StructuredOutput`)&&(l=!0),ol(e,{agentId:o,subpath:t,at:s,finished:l,toolUses:c.length})}function cl(e,t){switch(t.type){case`frame`:return ll(e,t.frame,t.receivedAt);case`hydrate`:return Rl(e,t.messages,t.session??null);case`entries`:return Bl(e,t.entries);case`session`:return H(e,t.session);case`local_prompt`:return ql(e,t);case`local_prompt_failed`:return Jl(e,t.requestId);case`local_permission`:return Ll(e,t.requestId,t.behavior,`local`);case`local_system`:{let n={kind:`system`,id:`sys:${e.nextId}`,uuid:null,parentToolUseId:null,turnId:null,timestamp:null,subtype:t.subtype,text:t.text};return tu({...e,nextId:e.nextId+1},n)}case`reset`:return al(e.sessionId)}}function ll(e,t,n){let r=ml(e,t,n);if(n===void 0||!dl(t,e,r))return r;let i=r.lastFrameAt;return i!==null&&n>=i&&n-i<1e3?r:{...r,lastFrameAt:n}}function ul(e){return e===`running`||e===`waiting_permission`}function dl(e,t,n){switch(e.type){case`agent`:return e.seq===null?e.message.type!==`system`||e.message.subtype!==`local_command`:!1;case`turn_started`:case`turn_finished`:case`prompt_delivered`:case`subagent_activity`:return!0;case`permission_request`:return n!==t;case`permission_resolved`:return!0;default:return!1}}function fl(e){if(e.lastFrameAt!==null||!e.hydrated||!ul(e.status))return e;let t=e.engineSince??0;for(let n=e.items.length-1;n>=0;n--){let r=e.items[n].timestamp,i=r?Date.parse(r):NaN;if(Number.isFinite(i)){i>t&&(t=i);break}}for(let n of Object.values(e.agentActivity))n.at>t&&(t=n.at);return t>0?{...e,lastFrameAt:t}:e}function pl(e,t,n){return t!==null||n===void 0||typeof e.timestamp==`string`?e:{...e,timestamp:new Date(n).toISOString()}}function ml(e,t,n){switch(t.type){case`agent`:{if(t.seq!==null&&e.seen.has(`seq:${t.seq}`))return e;let r=hl(e,pl(t.message,t.seq,n),{turnId:t.turnId,receivedAt:n});return t.seq!==null&&(r=au(r,`seq:${t.seq}`),(r.lastSeq===null||t.seq>r.lastSeq)&&(r={...r,lastSeq:t.seq})),r}case`turn_started`:{let n=`turnstart:${t.turnId}`;if(e.seen.has(n))return e;let r=au(e,n);if(r={...r,activeTurnId:t.turnId,status:`running`,statusText:null,turnCachedTokens:0},t.requestId){let e=r.items.findIndex(e=>e.kind===`user`&&e.requestId===t.requestId);if(e>=0){let n={...r.items[e],turnId:t.turnId,waiting:!1};r=e<r.items.length-1?tu(ru(r,new Set([n.id])),n):nu(r,e,n)}}return r}case`turn_finished`:return Ml(e,t.result,t.turnId);case`prompt_delivered`:return Ol(e,t.text,t.deliveredAt);case`prompt_cancelled`:{let n=e.items.filter(e=>e.kind===`user`&&!e.failed&&(e.requestId===t.requestId||(e.waiting||e.optimistic)&&e.deliveredAt===null&&e.text===t.text));return ru(e,new Set(n.map(e=>e.id)))}case`subagent_activity`:return ol(e,{agentId:t.agentId,subpath:t.subpath,at:Date.parse(t.at)||Date.now(),finished:t.finished,toolUses:t.toolUses});case`permission_request`:return Il(e,t.request,t.turnId,t.settled===!0);case`permission_resolved`:return Ll(e,t.requestId,t.behavior,t.resolvedBy);case`session_state`:{let n=t.session;return H((n.status===`idle`||n.status===`error`)&&e.pendingPermissions.length===0&&e.activeTurnId!==null?{...e,activeTurnId:null}:e,n)}case`error`:{if(t.code===`replay_truncated`||t.code===`replay_windowed`)return e;let r={kind:`error`,id:`err:${e.nextId}`,uuid:null,parentToolUseId:null,turnId:e.activeTurnId,timestamp:n===void 0?null:new Date(n).toISOString(),code:t.code,message:t.message,requestId:t.requestId??null};return tu({...e,nextId:e.nextId+1},r)}default:return e}}function hl(e,t,n){let r=typeof t.uuid==`string`?t.uuid:null,i=t.type===`stream_event`||t.type===`tool_progress`,a=r&&!i?`uuid:${r}`:null;if(i&&r!==null&&r===e.lastLiveUuid)return e;if(a&&e.seen.has(a))return t.type===`assistant`?bl(e,t):e;let o=e;switch(t.type){case`system`:o=gl(e,t,n);break;case`stream_event`:o=_l(e,t,n);break;case`assistant`:o=yl(e,t,n);break;case`user`:o=Tl(e,t,n);break;case`result`:o=jl(e,t,n);break;case`tool_progress`:o=Pl(e,t);break;case`auth_status`:o=Fl(e,t,n);break;default:return e}return a?o=au(o,a):i&&r!==null&&(o={...o,lastLiveUuid:r}),o}function gl(e,t,n){switch(t.subtype){case`init`:{let r={model:du(t.model),cwd:du(t.cwd),tools:Array.isArray(t.tools)?t.tools.filter(e=>typeof e==`string`):[],permissionMode:du(t.permissionMode),claudeCodeVersion:du(t.claude_code_version),apiKeySource:du(t.apiKeySource),sessionId:du(t.session_id),mcpServers:Array.isArray(t.mcp_servers)?t.mcp_servers:[]};return{...e,init:r,engineSince:n.receivedAt??Date.now()}}case`compact_boundary`:{let r=t.compact_metadata??{},i={kind:`compact`,id:su(e,`compact`,t),uuid:cu(t),parentToolUseId:lu(t),turnId:n.turnId,timestamp:uu(t),trigger:r.trigger===`manual`?`manual`:`auto`,preTokens:typeof r.pre_tokens==`number`?r.pre_tokens:0,postTokens:typeof r.post_tokens==`number`?r.post_tokens:null};return tu(ou(e),i)}case`status`:{let n=typeof t.status==`string`?t.status:null;return{...e,statusText:n}}case`task_notification`:{let r=fe({taskId:du(t.task_id)||null,toolUseId:du(t.tool_use_id)||null,status:du(t.status)||null,summary:du(t.summary)||null});if(Zl(e,r))return e;let i=cu(t),a={kind:`user`,id:i?`u:${i}`:`i${e.nextId}`,uuid:i,parentToolUseId:lu(t),turnId:n.turnId,timestamp:uu(t),text:r,attachments:[],requestId:null,optimistic:!1,failed:!1,waiting:!1,deliveredAt:null,compactSummary:!1,taskNotification:!0,engineNote:!1};return e.index.get(a.id)===void 0?tu(i?e:ou(e),a):e}case`permission_denied`:{let n=du(t.tool_use_id),r=du(t.message);return iu(e,n,e=>{let t=e.name===`AskUserQuestion`&&r===`the user skipped the question`;return{...e,status:t?`skipped`:`denied`,result:e.result??{content:r||`Permission denied`,isError:!t,structured:null}}})}case`rewind_boundary`:{let n={kind:`system`,id:`sys:${e.nextId}`,uuid:cu(t),parentToolUseId:lu(t),turnId:e.activeTurnId,timestamp:uu(t),subtype:`rewind`,text:typeof t.content==`string`&&t.content.trim()?t.content.trim():`Rewound here — the conversation was taken back to this point and continued differently.`};return tu({...e,nextId:e.nextId+1},n)}default:{let n=typeof t.content==`string`?t.content.trim():``,r=n?wl(n):null;if(!r||r.subtype===`caveat`)return e;let i={kind:`system`,id:`sys:${e.nextId}`,uuid:cu(t),parentToolUseId:lu(t),turnId:e.activeTurnId,timestamp:uu(t),subtype:r.subtype,text:r.text};return tu({...e,nextId:e.nextId+1},i)}}}function _l(e,t,n){let r=t.event;if(!r||typeof r!=`object`)return e;let i=lu(t),a=i??``,o=e.streams[a]??{messageId:null,model:null,blocks:{},unclaimed:[]};switch(r.type){case`message_start`:{let t=r.message,n={messageId:t?.id??null,model:t?.model??null,blocks:{},unclaimed:[]},i=e;for(let e of o.unclaimed)i=vl(i,e);return{...i,streams:{...i.streams,[a]:n}}}case`content_block_start`:{let s=r.content_block,c=e,l;if(s.type===`text`)l={kind:`assistant`,id:`i${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:uu(t),text:s.text??``,streaming:!0,model:o.model,messageId:o.messageId,error:null,aborted:!1},c=ou(c);else if(s.type===`thinking`||s.type===`redacted_thinking`)l={kind:`thinking`,id:`i${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:uu(t),text:s.type===`thinking`?s.thinking??``:``,streaming:!0,redacted:s.type===`redacted_thinking`},c=ou(c);else if(s.type===`tool_use`){let c=s;if(e.index.get(c.id)!==void 0){let t={...o.blocks,[r.index]:c.id};return{...e,streams:{...e.streams,[a]:{...o,blocks:t}}}}let u=c.input&&Object.keys(c.input).length>0;l={kind:`tool`,id:c.id,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:uu(t),toolUseId:c.id,name:c.name,input:u?c.input:null,inputJson:u?JSON.stringify(c.input):``,status:`streaming`,result:null,startedAt:n.receivedAt??null,finishedAt:null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:o.messageId}}else return e;c=tu(c,l);let u={...o.blocks,[r.index]:l.id},d=[...o.unclaimed,l.id];return{...c,streams:{...c.streams,[a]:{...o,blocks:u,unclaimed:d}}}}case`content_block_delta`:{let t=o.blocks[r.index];if(!t)return e;let n=e.index.get(t);if(n===void 0)return e;let i=e.items[n],a=r.delta;return a.type===`text_delta`&&i.kind===`assistant`?nu(e,n,{...i,text:i.text+a.text}):a.type===`thinking_delta`&&i.kind===`thinking`?nu(e,n,{...i,text:i.text+a.thinking}):a.type===`input_json_delta`&&i.kind===`tool`?nu(e,n,{...i,inputJson:i.inputJson+a.partial_json}):e}case`content_block_stop`:{let t=o.blocks[r.index];return t?vl(e,t,n.receivedAt):e}case`message_delta`:case`message_stop`:case`ping`:return e;case`error`:{let a={kind:`error`,id:`err:${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:uu(t),code:r.error?.type??`stream_error`,message:r.error?.message??`stream error`,requestId:null};return tu(ou(e),a)}default:return e}}function vl(e,t,n){let r=e.index.get(t);if(r===void 0)return e;let i=e.items[r];if(i.kind===`assistant`||i.kind===`thinking`)return i.streaming?nu(e,r,{...i,streaming:!1}):e;if(i.kind===`tool`&&i.status===`streaming`){let t=i.input??hu(i.inputJson);return nu(e,r,{...i,input:t,status:`running`,startedAt:i.startedAt??n??null})}return e}function yl(e,t,n){let r=t.message??{},i=pu(r.content),a=lu(t),o=a??``,s=cu(t),c=uu(t),l=typeof t.error==`string`?t.error:null,u=t.aborted===!0,d=e;{let e=fu(r.usage?.cache_read_input_tokens)+fu(r.usage?.cache_creation_input_tokens),t=`usage:${r.id??``}`;e>0&&r.id&&!d.seen.has(t)&&(d={...au(d,t),turnCachedTokens:d.turnCachedTokens+e})}let f=d.streams[o];for(let e of i){let t=f?xl(d,f,e):null;if(t){let n=d.index.get(t),i=d.items[n];d=nu(d,n,Sl(i,e,{uuid:s,timestamp:c,model:r.model??null,messageId:r.id??null,errorText:l,aborted:u})),f={...f,unclaimed:f.unclaimed.filter(e=>e!==t)},d={...d,streams:{...d.streams,[o]:f}};continue}let i=Cl(d,e,{uuid:s,timestamp:c,parentToolUseId:a,turnId:n.turnId,model:r.model??null,messageId:r.id??null,errorText:l,aborted:u,receivedAt:n.receivedAt});i&&(d=i)}if(i.length===0&&l){let e={kind:`error`,id:`err:${d.nextId}`,uuid:s,parentToolUseId:a,turnId:n.turnId,timestamp:c,code:`assistant_error`,message:l,requestId:null};d=tu(ou(d),e)}return d}function bl(e,t){let n=lu(t)??``,r=e.streams[n];if(!r||r.unclaimed.length===0)return e;let i=t.message??{},a=new Set,o=e,s=r;for(let e of pu(i.content)){let t=xl(o,s,e);t&&(a.add(t),s={...s,unclaimed:s.unclaimed.filter(e=>e!==t)},o={...o,streams:{...o.streams,[n]:s}})}return ru(e,a)}function xl(e,t,n){for(let r of t.unclaimed){let t=e.index.get(r);if(t===void 0)continue;let i=e.items[t];if(!i.uuid&&(n.type===`text`&&i.kind===`assistant`||(n.type===`thinking`||n.type===`redacted_thinking`)&&i.kind===`thinking`||n.type===`tool_use`&&i.kind===`tool`&&i.toolUseId===n.id))return r}return null}function Sl(e,t,n){if(e.kind===`assistant`&&t.type===`text`){let r=t.text??e.text;return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,text:r.length>=e.text.length?r:e.text,streaming:!1,model:n.model??e.model,messageId:n.messageId??e.messageId,error:n.errorText,aborted:n.aborted}}if(e.kind===`thinking`){let r=t.type===`thinking`?t.thinking??e.text:e.text;return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,text:r||e.text,streaming:!1}}if(e.kind===`tool`&&t.type===`tool_use`){let r=t,i=r.input&&Object.keys(r.input).length>0?r.input:e.input??hu(e.inputJson);return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,name:r.name??e.name,input:i,inputJson:e.inputJson||(i?JSON.stringify(i):``),status:e.status===`streaming`?`running`:e.status,messageId:n.messageId??e.messageId}}return e}function Cl(e,t,n){let r={uuid:n.uuid,parentToolUseId:n.parentToolUseId,turnId:n.turnId,timestamp:n.timestamp};if(t.type===`text`){let i={kind:`assistant`,id:`i${e.nextId}`,...r,text:t.text??``,streaming:!1,model:n.model,messageId:n.messageId,error:n.errorText,aborted:n.aborted};return tu(ou(e),i)}if(t.type===`thinking`||t.type===`redacted_thinking`){let n={kind:`thinking`,id:`i${e.nextId}`,...r,text:t.type===`thinking`?t.thinking??``:``,streaming:!1,redacted:t.type===`redacted_thinking`};return tu(ou(e),n)}if(t.type===`tool_use`){let i=t,a=e.index.get(i.id);if(a!==void 0){let r=e.items[a];return nu(e,a,Sl(r,t,n))}let o=i.input&&typeof i.input==`object`?i.input:null;return tu(e,{kind:`tool`,id:i.id,...r,toolUseId:i.id,name:i.name,input:o,inputJson:o?JSON.stringify(o):``,status:`running`,result:null,startedAt:n.receivedAt??null,finishedAt:null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:n.messageId})}return null}function wl(e){if(/^<local-command-caveat>/.test(e))return{subtype:`caveat`,text:``};let t=/^<local-command-(stdout|stderr)>([\s\S]*?)<\/local-command-\1>$/.exec(e);if(t){let e=t[2].replace(/\u001b\[[0-9;]*m/g,``).trim();return{subtype:t[1]===`stderr`?`local-command-error`:`local-command`,text:e}}let n=/<command-name>([^<]*)<\/command-name>/.exec(e);if(n&&/^<command-/.test(e)){let t=/<command-args>([^<]*)<\/command-args>/.exec(e)?.[1]?.trim()??``;return{subtype:`command`,text:`${n[1].trim()}${t?` `+t:``}`}}return null}function Tl(e,t,n){let r=t.message??{},i=lu(t),a=cu(t),o=uu(t),s=t.isSynthetic===!0,c=e,l=[],u=[],d=!1;if(typeof r.content==`string`)l.push(r.content);else for(let e of pu(r.content))if(e.type===`text`)l.push(e.text??``);else if(e.type===`tool_result`){d=!0;let r=e;c=kl(c,r.tool_use_id,{content:r.content??``,isError:r.is_error===!0,structured:t.tool_use_result??null},n.receivedAt)}else(e.type===`image`||e.type===`document`)&&u.push(e);let f=se(l.join(`
74
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function $i(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:na(t,`input`,e.processors),output:na(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ea(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ea(r.element,n);if(r.type===`set`)return ea(r.valueType,n);if(r.type===`lazy`)return ea(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return ea(r.innerType,n);if(r.type===`intersection`)return ea(r.left,n)||ea(r.right,n);if(r.type===`record`||r.type===`map`)return ea(r.keyType,n)||ea(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ea(r.in,n)||ea(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ea(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ea(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ea(e,n))return!0;return!!(r.rest&&ea(r.rest,n))}return!1}var ta=(e,t={})=>n=>{let r=Xi({...n,processors:t});return Zi(e,r),Qi(r,e),$i(r,e)},na=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Xi({...i??{},target:a,io:t,processors:n});return Zi(e,o),Qi(o,e),$i(o,e)},ra={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ia=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ra[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},aa=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},oa=(e,t,n,r)=>{n.type=`boolean`},sa=(e,t,n,r)=>{n.not={}},ca=(e,t,n,r)=>{let i=e._zod.def,a=Ne(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},la=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ua=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},da=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},fa=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Zi(a.element,t,{...r,path:[...r.path,`items`]})},pa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Zi(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Zi(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ma=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Zi(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ha=(e,t,n,r)=>{let i=e._zod.def,a=Zi(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Zi(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ga=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Zi(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Zi(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Zi(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},_a=(e,t,n,r)=>{let i=e._zod.def,a=Zi(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},va=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ya=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ba=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},xa=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Sa=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Zi(o,t,r);let s=t.seen.get(e);s.ref=o},Ca=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},wa=(e,t,n,r)=>{let i=e._zod.def;Zi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ta=L(`ZodISODateTime`,(e,t)=>{Gn.init(e,t),Za.init(e,t)});function Ea(e){return _i(Ta,e)}var Da=L(`ZodISODate`,(e,t)=>{Kn.init(e,t),Za.init(e,t)});function Oa(e){return vi(Da,e)}var ka=L(`ZodISOTime`,(e,t)=>{qn.init(e,t),Za.init(e,t)});function Aa(e){return yi(ka,e)}var ja=L(`ZodISODuration`,(e,t)=>{Jn.init(e,t),Za.init(e,t)});function Ma(e){return bi(ja,e)}var Na=L(`ZodError`,(e,t)=>{gt.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>yt(e,t)},flatten:{value:t=>vt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Pe,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Pe,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Pa=bt(Na),Fa=xt(Na),Ia=St(Na),La=wt(Na),Ra=Et(Na),za=Dt(Na),Ba=Ot(Na),Va=kt(Na),Ha=At(Na),Ua=jt(Na),Wa=Mt(Na),Ga=Nt(Na),Ka=new WeakMap;function qa(e,t,n){let r=Object.getPrototypeOf(e),i=Ka.get(r);if(i||(i=new Set,Ka.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Ja=L(`ZodType`,(e,t)=>(jn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:na(e,`input`),output:na(e,`output`)}}),e.toJSONSchema=ta(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Pa(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ia(e,t,n),e.parseAsync=async(t,n)=>Fa(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>La(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ra(e,t,n),e.decode=(t,n)=>za(e,t,n),e.encodeAsync=async(t,n)=>Ba(e,t,n),e.decodeAsync=async(t,n)=>Va(e,t,n),e.safeEncode=(t,n)=>Ha(e,t,n),e.safeDecode=(t,n)=>Ua(e,t,n),e.safeEncodeAsync=async(t,n)=>Wa(e,t,n),e.safeDecodeAsync=async(t,n)=>Ga(e,t,n),qa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(He(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Qe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(us(e,t))},superRefine(e,t){return this.check(ds(e,t))},overwrite(e){return this.check(Bi(e))},optional(){return Ko(this)},exactOptional(){return Jo(this)},nullable(){return Xo(this)},nullish(){return Ko(Xo(this))},nonoptional(e){return ns(this,e)},array(){return Oo(this)},or(e){return Mo([this,e])},and(e){return Io(this,e)},transform(e){return os(this,Wo(e))},default(e){return Qo(this,e)},prefault(e){return es(this,e)},catch(e){return is(this,e)},pipe(e){return os(this,e)},readonly(){return cs(this)},describe(e){let t=this.clone();return qr.add(t,{description:e}),t},meta(...e){if(e.length===0)return qr.get(this);let t=this.clone();return qr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return qr.get(e)?.description},configurable:!0}),e)),Ya=L(`_ZodString`,(e,t)=>{Mn.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,qa(e,`_ZodString`,{regex(...e){return this.check(Pi(...e))},includes(...e){return this.check(Li(...e))},startsWith(...e){return this.check(Ri(...e))},endsWith(...e){return this.check(zi(...e))},min(...e){return this.check(Mi(...e))},max(...e){return this.check(ji(...e))},length(...e){return this.check(Ni(...e))},nonempty(...e){return this.check(Mi(1,...e))},lowercase(e){return this.check(Fi(e))},uppercase(e){return this.check(Ii(e))},trim(){return this.check(Hi())},normalize(...e){return this.check(Vi(...e))},toLowerCase(){return this.check(Ui())},toUpperCase(){return this.check(Wi())},slugify(){return this.check(Gi())}})}),Xa=L(`ZodString`,(e,t)=>{Mn.init(e,t),Ya.init(e,t),e.email=t=>e.check(Yr(Qa,t)),e.url=t=>e.check(ti(to,t)),e.jwt=t=>e.check(gi(go,t)),e.emoji=t=>e.check(ni(no,t)),e.guid=t=>e.check(Xr($a,t)),e.uuid=t=>e.check(Zr(eo,t)),e.uuidv4=t=>e.check(Qr(eo,t)),e.uuidv6=t=>e.check($r(eo,t)),e.uuidv7=t=>e.check(ei(eo,t)),e.nanoid=t=>e.check(ri(ro,t)),e.guid=t=>e.check(Xr($a,t)),e.cuid=t=>e.check(ii(io,t)),e.cuid2=t=>e.check(ai(ao,t)),e.ulid=t=>e.check(oi(oo,t)),e.base64=t=>e.check(pi(B,t)),e.base64url=t=>e.check(mi(mo,t)),e.xid=t=>e.check(si(so,t)),e.ksuid=t=>e.check(ci(co,t)),e.ipv4=t=>e.check(li(lo,t)),e.ipv6=t=>e.check(ui(uo,t)),e.cidrv4=t=>e.check(di(fo,t)),e.cidrv6=t=>e.check(fi(po,t)),e.e164=t=>e.check(hi(ho,t)),e.datetime=t=>e.check(Ea(t)),e.date=t=>e.check(Oa(t)),e.time=t=>e.check(Aa(t)),e.duration=t=>e.check(Ma(t))});function z(e){return Jr(Xa,e)}var Za=L(`ZodStringFormat`,(e,t)=>{Nn.init(e,t),Ya.init(e,t)}),Qa=L(`ZodEmail`,(e,t)=>{In.init(e,t),Za.init(e,t)}),$a=L(`ZodGUID`,(e,t)=>{Pn.init(e,t),Za.init(e,t)}),eo=L(`ZodUUID`,(e,t)=>{Fn.init(e,t),Za.init(e,t)}),to=L(`ZodURL`,(e,t)=>{Ln.init(e,t),Za.init(e,t)}),no=L(`ZodEmoji`,(e,t)=>{Rn.init(e,t),Za.init(e,t)}),ro=L(`ZodNanoID`,(e,t)=>{zn.init(e,t),Za.init(e,t)}),io=L(`ZodCUID`,(e,t)=>{Bn.init(e,t),Za.init(e,t)}),ao=L(`ZodCUID2`,(e,t)=>{Vn.init(e,t),Za.init(e,t)}),oo=L(`ZodULID`,(e,t)=>{Hn.init(e,t),Za.init(e,t)}),so=L(`ZodXID`,(e,t)=>{Un.init(e,t),Za.init(e,t)}),co=L(`ZodKSUID`,(e,t)=>{Wn.init(e,t),Za.init(e,t)}),lo=L(`ZodIPv4`,(e,t)=>{Yn.init(e,t),Za.init(e,t)}),uo=L(`ZodIPv6`,(e,t)=>{Xn.init(e,t),Za.init(e,t)}),fo=L(`ZodCIDRv4`,(e,t)=>{Zn.init(e,t),Za.init(e,t)}),po=L(`ZodCIDRv6`,(e,t)=>{Qn.init(e,t),Za.init(e,t)}),B=L(`ZodBase64`,(e,t)=>{er.init(e,t),Za.init(e,t)}),mo=L(`ZodBase64URL`,(e,t)=>{nr.init(e,t),Za.init(e,t)}),ho=L(`ZodE164`,(e,t)=>{rr.init(e,t),Za.init(e,t)}),go=L(`ZodJWT`,(e,t)=>{ar.init(e,t),Za.init(e,t)}),_o=L(`ZodNumber`,(e,t)=>{or.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r),qa(e,`ZodNumber`,{gt(e,t){return this.check(Oi(e,t))},gte(e,t){return this.check(ki(e,t))},min(e,t){return this.check(ki(e,t))},lt(e,t){return this.check(Ei(e,t))},lte(e,t){return this.check(Di(e,t))},max(e,t){return this.check(Di(e,t))},int(e){return this.check(bo(e))},safe(e){return this.check(bo(e))},positive(e){return this.check(Oi(0,e))},nonnegative(e){return this.check(ki(0,e))},negative(e){return this.check(Ei(0,e))},nonpositive(e){return this.check(Di(0,e))},multipleOf(e,t){return this.check(Ai(e,t))},step(e,t){return this.check(Ai(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function vo(e){return xi(_o,e)}var yo=L(`ZodNumberFormat`,(e,t)=>{sr.init(e,t),_o.init(e,t)});function bo(e){return Si(yo,e)}var xo=L(`ZodBoolean`,(e,t)=>{cr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oa(e,t,n,r)});function So(e){return Ci(xo,e)}var Co=L(`ZodUnknown`,(e,t)=>{lr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function wo(){return wi(Co)}var To=L(`ZodNever`,(e,t)=>{ur.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sa(e,t,n,r)});function Eo(e){return Ti(To,e)}var Do=L(`ZodArray`,(e,t)=>{fr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r),e.element=t.element,qa(e,`ZodArray`,{min(e,t){return this.check(Mi(e,t))},nonempty(e){return this.check(Mi(1,e))},max(e,t){return this.check(ji(e,t))},length(e,t){return this.check(Ni(e,t))},unwrap(){return this.element}})});function Oo(e,t){return Ki(Do,e,t)}var ko=L(`ZodObject`,(e,t)=>{_r.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r),Be(e,`shape`,()=>t.shape),qa(e,`ZodObject`,{keyof(){return Bo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:wo()})},loose(){return this.clone({...this._zod.def,catchall:wo()})},strict(){return this.clone({...this._zod.def,catchall:Eo()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return rt(this,e)},safeExtend(e){return it(this,e)},merge(e){return at(this,e)},pick(e){return tt(this,e)},omit(e){return nt(this,e)},partial(...e){return ot(Go,this,e[0])},required(...e){return st(ts,this,e[0])}})});function Ao(e,t){return new ko({type:`object`,shape:e??{},...R(t)})}var jo=L(`ZodUnion`,(e,t)=>{yr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r),e.options=t.options});function Mo(e,t){return new jo({type:`union`,options:e,...R(t)})}var No=L(`ZodDiscriminatedUnion`,(e,t)=>{jo.init(e,t),br.init(e,t)});function Po(e,t,n){return new No({type:`union`,options:t,discriminator:e,...R(n)})}var Fo=L(`ZodIntersection`,(e,t)=>{xr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r)});function Io(e,t){return new Fo({type:`intersection`,left:e,right:t})}var Lo=L(`ZodRecord`,(e,t)=>{wr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ro(e,t,n){return!t||!t._zod?new Lo({type:`record`,keyType:z(),valueType:e,...R(t)}):new Lo({type:`record`,keyType:e,valueType:t,...R(n)})}var zo=L(`ZodEnum`,(e,t)=>{Tr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ca(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new zo({...t,checks:[],...R(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new zo({...t,checks:[],...R(r),entries:i})}});function Bo(e,t){return new zo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}var Vo=L(`ZodLiteral`,(e,t)=>{Er.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>la(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ho(e,t){return new Vo({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var Uo=L(`ZodTransform`,(e,t)=>{Dr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ae(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(mt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(mt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Wo(e){return new Uo({type:`transform`,transform:e})}var Go=L(`ZodOptional`,(e,t)=>{kr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ko(e){return new Go({type:`optional`,innerType:e})}var qo=L(`ZodExactOptional`,(e,t)=>{Ar.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jo(e){return new qo({type:`optional`,innerType:e})}var Yo=L(`ZodNullable`,(e,t)=>{jr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xo(e){return new Yo({type:`nullable`,innerType:e})}var Zo=L(`ZodDefault`,(e,t)=>{Mr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Qo(e,t){return new Zo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ye(t)}})}var $o=L(`ZodPrefault`,(e,t)=>{Pr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function es(e,t){return new $o({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ye(t)}})}var ts=L(`ZodNonOptional`,(e,t)=>{Fr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ns(e,t){return new ts({type:`nonoptional`,innerType:e,...R(t)})}var rs=L(`ZodCatch`,(e,t)=>{Lr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function is(e,t){return new rs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var as=L(`ZodPipe`,(e,t)=>{Rr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r),e.in=t.in,e.out=t.out});function os(e,t){return new as({type:`pipe`,in:e,out:t})}var ss=L(`ZodReadonly`,(e,t)=>{Br.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cs(e){return new ss({type:`readonly`,innerType:e})}var ls=L(`ZodCustom`,(e,t)=>{Hr.init(e,t),Ja.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ua(e,t,n,r)});function us(e,t={}){return qi(ls,e,t)}function ds(e,t){return Ji(e,t)}var fs={artificial_analysis_intelligence_index:{label:`Intelligence index`,scale:`index`},artificial_analysis_coding_index:{label:`Coding index`,scale:`index`},artificial_analysis_math_index:{label:`Math index`,scale:`index`},gpqa:{label:`GPQA Diamond`,scale:`fraction`},hle:{label:`Humanity's Last Exam`,scale:`fraction`},lcr:{label:`Long-context reasoning`,scale:`fraction`},livecodebench:{label:`LiveCodeBench`,scale:`fraction`},scicode:{label:`SciCode`,scale:`fraction`},math_500:{label:`MATH-500`,scale:`fraction`},aime:{label:`AIME`,scale:`fraction`},aime_25:{label:`AIME 2025`,scale:`fraction`},ifbench:{label:`IFBench`,scale:`fraction`},mmlu_pro:{label:`MMLU Pro`,scale:`fraction`},tau2:{label:`τ²-bench (agentic)`,scale:`fraction`},tau_banking:{label:`τ-bench banking`,scale:`fraction`},terminalbench_hard:{label:`Terminal-Bench Hard`,scale:`fraction`},terminalbench_v2_1:{label:`Terminal-Bench 2.1`,scale:`fraction`}};function ps(e){return(e.credentialVariants??[]).filter(e=>!e.operatorOnly)}function ms(e){let t=new Set(e.map(e=>e.definition.id));return e.filter(e=>!e.definition.clientGroup||e.definition.clientGroup===e.definition.id||!t.has(e.definition.clientGroup))}function hs(e,t){return e.filter(e=>e.definition.id===t||e.definition.clientGroup===t&&e.definition.id!==t)}function gs(e){return ms(e).filter(e=>e.definition.enabled&&e.definition.credentialClass!==`none`&&T(e.definition.id)&&!D(e.definition.id))}function _s(e){if(!e)return!1;try{let t=new URL(e).hostname.toLowerCase();return t===`127.0.0.1`||t===`localhost`||t===`::1`||t===`[::1]`}catch{return!1}}function vs(e,t={}){let n=e.displayName,r=t.credentialClass??e.credentialClass,i=t.baseUrl??e.baseUrl;return e.id===`oonacode`?{kind:`pool`,badge:`via OonaCode`,detail:`Runs on OonaCode's own provider accounts, through the OonaCode gateway. Priced models are billed to your account in credits; free models cost nothing on any plan.`,viaGateway:!0}:e.route===`direct`?{kind:`subscription-direct`,badge:`direct to provider`,detail:`Your ${n} subscription runs straight from this PC to the provider — it never passes through the OonaCode gateway.`,viaGateway:!1}:r===`api_key`&&e.kind!==`anthropic-passthrough`?{kind:`own-key-translated`,badge:`direct to provider`,detail:`Your ${n} key stays on this PC: OonaCode translates the request here and calls ${n} from this machine. The gateway sees neither the key nor the traffic.`,viaGateway:!1}:_s(i)?{kind:`local-server`,badge:`on this machine`,detail:`Runs against ${n} on this machine (${i}) — the request never leaves the PC.`,viaGateway:!1}:r===`api_key`&&e.kind===`anthropic-passthrough`&&e.directCapable===!0?{kind:`own-key-direct`,badge:`direct to provider`,detail:`Your ${n} key runs straight from this PC to ${n} — the OonaCode gateway is not in the path.`,viaGateway:!1}:{kind:`gateway`,badge:`via OonaCode`,detail:`Routed to ${n} through the OonaCode gateway.`,viaGateway:!0}}var ys=Po(`type`,[Ao({type:Ho(`oauth-device`),deviceAuthorizationUrl:z().url(),tokenUrl:z().url(),clientId:z().min(1),scopes:Oo(z().min(1)).min(1),signInLabel:z().min(1).optional(),referrer:z().min(1).optional()}),Ao({type:Ho(`openai-device`),deviceAuthorizationUrl:z().url(),pollUrl:z().url(),tokenUrl:z().url(),verificationUri:z().url(),redirectUri:z().url(),clientId:z().min(1),signInLabel:z().min(1).optional()})]),bs=Ao({id:z().min(1),displayName:z().min(1),upstreamId:z().min(1).optional(),servedBy:Oo(z().min(1)).optional(),subscriptionServedBy:Oo(z().min(1)).optional(),contextWindow:vo().int().positive().optional(),maxOutputTokens:vo().int().positive().optional(),supportsTools:So().optional(),supportsThinking:So().optional(),effortLevels:Oo(Bo(me)).optional(),supportsVision:So().optional(),inputPricePerM:vo().nonnegative().optional(),outputPricePerM:vo().nonnegative().optional(),notes:z().optional()}),xs=Ao({id:z().regex(/^[a-z0-9][a-z0-9-]{1,40}$/,`provider id must be lowercase kebab-case`),displayName:z().min(1),kind:Bo([`anthropic-passthrough`,`openai-compatible`,`gemini`]),route:Bo([`gateway`,`direct`]),credentialClass:Bo([`api_key`,`subscription`,`none`]),baseUrl:z().url(),messagesPath:z().startsWith(`/`).optional(),modelsPath:z().startsWith(`/`).optional(),auth:Ao({header:Bo([`x-api-key`,`authorization-bearer`,`api-key`,`none`]),extraHeaders:Ro(z(),z()).optional()}),models:Oo(bs),defaultModel:z().min(1),modelAliases:Ro(z(),z()).optional(),helperModel:z().min(1).optional(),capabilities:Ao({streaming:So(),tools:So(),thinking:So(),vision:So(),countTokens:So(),promptCaching:So(),promptCacheTtlSec:vo().int().positive().optional()}),translate:Ao({maxTokensParam:Bo([`max_tokens`,`max_completion_tokens`]).optional(),reasoningEffortFromBudget:So().optional(),reasoningContentField:z().nullable().optional(),supportsParallelToolCalls:So().optional(),systemRole:Bo([`system`,`developer`]).optional(),streamIncludeUsage:So().optional(),wire:Bo([`chat`,`responses`]).optional()}).optional(),passthrough:Ao({stripCacheControl:So().optional(),cacheChain:So().optional(),toolSchemaRequiredArray:So().optional(),toolDescriptionRequired:So().optional(),allowedBetas:Oo(z()).optional(),anthropicVersion:z().optional()}).optional(),userBaseUrl:So().optional(),engineEnv:Ro(z(),z()).optional(),directCapable:So().optional(),subscriptionLogin:ys.optional(),phase:Mo([Ho(1),Ho(2)]),enabled:So(),docsUrl:z().url().optional(),notes:z().optional(),references:Oo(Ao({label:z().min(1),url:z().url(),kind:Bo([`docs`,`pricing`,`models`,`console`,`status`,`keys`,`signup`,`other`]).optional()})).optional(),keyFormat:z().optional(),credentialVariants:Oo(Ao({id:z().min(1),label:z().min(1),header:Bo([`x-api-key`,`authorization-bearer`,`api-key`,`none`]).optional(),extraHeaders:Ro(z(),z()).optional(),operatorOnly:So().optional(),requiresClaudeCodeIdentity:So().optional(),subscriptionLogin:ys.optional(),claudeCodeShape:Ao({betas:z().min(1),userAgent:z().min(1),billingHeader:z().min(1),headers:Ro(z(),z()).optional()}).optional(),baseUrl:z().url().optional(),keyFormat:z().optional(),notes:z().optional()})).optional(),adminGroup:z().optional(),clientGroup:z().optional(),recordLabel:z().optional(),effortLevels:Oo(Bo(me)).optional()});Ao({version:vo().int().positive(),updatedAt:z(),providers:Oo(xs)});function Ss(e){return/^claude-/i.test(e)}function Cs(e,t){return{images:e.models.find(e=>e.id===t)?.supportsVision??e.capabilities.vision,documents:Ss(t)}}function ws(e,t,n){let r=Cs(e,t),i=new Set;for(let e of n){let t=e?.type;(t===`image`||t===`document`)&&i.add(t)}let a=e.models.find(e=>e.id===t)?.displayName??t;return i.has(`image`)&&!r.images?`${a} cannot read images. Remove the image, or pick a model that can — the model details say which.`:i.has(`document`)&&!r.documents?`${a} cannot read PDF documents — only Anthropic's Claude models take a PDF. Attach it as text, or pick a Claude model.`:null}var Ts={messages:`/v1/messages`,countTokens:`/v1/messages/count_tokens`,models:`/v1/models`,providerMessages:e=>`/p/${e}/v1/messages`,providerCountTokens:e=>`/p/${e}/v1/messages/count_tokens`,providerModels:e=>`/p/${e}/v1/models`,health:`/api/health`,streamCheck:`/api/stream-check`,register:`/api/auth/register`,login:`/api/auth/login`,refresh:`/api/auth/refresh`,logout:`/api/auth/logout`,me:`/api/auth/me`,prelogin:`/api/auth/prelogin`,tokens:`/api/me/tokens`,token:e=>`/api/me/tokens/${e}`,tokenPurge:e=>`/api/me/tokens/${e}/purge`,tokenUsage:e=>`/api/me/tokens/${e}/usage`,providers:`/api/me/providers`,provider:e=>`/api/me/providers/${e}`,providerTest:e=>`/api/me/providers/${e}/test`,routing:`/api/me/routing`,usage:`/api/me/usage`,usageSession:e=>`/api/me/usage/sessions/${e}`,devices:`/api/me/devices`,pushToken:`/api/me/push-token`,hostNotify:`/api/me/hosts/notify`,device:e=>`/api/me/devices/${e}`,hosts:`/api/me/hosts`,hostHeartbeat:`/api/me/hosts/heartbeat`,hostVaultUnlock:e=>`/api/me/hosts/${encodeURIComponent(e)}/vault-unlock`,host:e=>`/api/me/hosts/${encodeURIComponent(e)}`,vault:`/api/me/vault`,vaultEvents:`/api/me/vault/events`,historySessions:`/api/me/history/sessions`,historySession:e=>`/api/me/history/sessions/${e}`,historyEntries:e=>`/api/me/history/sessions/${e}/entries`,registry:`/api/registry`,releasesLatest:`/api/releases/latest`,releasesHistory:`/api/releases`,team:`/api/me/team`,teamInvites:`/api/me/team/invites`,teamInvite:e=>`/api/me/team/invites/${e}`,teamInviteLookup:`/api/team/invites/lookup`,teamInviteDecline:`/api/team/invites/decline`,teamJoin:`/api/me/team/join`,teamInvitations:`/api/me/team/invitations`,teamInvitationAccept:e=>`/api/me/team/invitations/${e}/accept`,teamInvitationDecline:e=>`/api/me/team/invitations/${e}/decline`,teamMember:e=>`/api/me/team/members/${e}`,teamLeave:`/api/me/team/leave`,teamTransfer:`/api/me/team/transfer`,teamAudit:`/api/me/team/audit`,teamCheckout:`/api/me/team/checkout`,teamTopup:`/api/me/team/topup`,teamSeats:`/api/me/team/seats`,googleConfig:`/api/auth/google/config`,googleStart:`/api/auth/google/start`,googleCallback:`/api/auth/google/callback`,githubConfig:`/api/auth/github/config`,githubStart:`/api/auth/github/start`,githubCallback:`/api/auth/github/callback`,googleUnlink:`/api/me/google`,telegramConfig:`/api/auth/telegram/config`,telegramAuth:`/api/auth/telegram`,telegram:`/api/me/telegram`,telegramWebhook:`/api/webhooks/telegram`,passphraseSetup:`/api/auth/passphrase/setup`,passphraseRekey:`/api/me/passphrase/rekey`,recovery:`/api/me/recovery`,recoveryChallenge:`/api/auth/recovery/challenge`,recoveryConsume:`/api/auth/recovery/consume`,deviceApprovals:`/api/me/device-approvals`,deviceApproval:e=>`/api/me/device-approvals/${e}`,deviceApprovalApprove:e=>`/api/me/device-approvals/${e}/approve`,deviceApprovalDeny:e=>`/api/me/device-approvals/${e}/deny`,passwordResetRequest:`/api/auth/password-reset/request`,passwordResetConfirm:`/api/auth/password-reset/confirm`,vaultRekeyComplete:`/api/me/vault/rekey-complete`,vaultRekeyPending:`/api/me/vault/rekey-pending`,emailVerifySend:`/api/auth/email/verify/send`,emailVerifyConfirm:`/api/auth/email/verify/confirm`,emailVerifyWatch:`/api/auth/email/verify/watch`,twoFactor:`/api/me/2fa`,twoFactorEnroll:`/api/me/2fa/enroll`,twoFactorConfirm:`/api/me/2fa/confirm`,twoFactorDisable:`/api/me/2fa/disable`,twoFactorDisableRequest:`/api/me/2fa/disable/request`,twoFactorRecoveryCodes:`/api/me/2fa/recovery-codes`,twoFactorVerify:`/api/auth/2fa/verify`,deviceLinkStart:`/api/auth/device/start`,deviceLinkPoll:`/api/auth/device/poll`,deviceLinks:`/api/me/device-links`,deviceLink:e=>`/api/me/device-links/${e}`,deviceLinkApprove:e=>`/api/me/device-links/${e}/approve`,deviceLinkDeny:e=>`/api/me/device-links/${e}/deny`,hostLogs:`/api/me/hosts/logs`,errorReport:`/api/me/errors`,bugReports:`/api/me/bug-reports`,plans:`/api/plans`,myPlan:`/api/me/plan`,checkout:`/api/me/plan/checkout`,creditsTopup:`/api/me/credits/topup`,billing:`/api/me/billing`},Es=2048,Ds=16384,Os=8e3,ks=5242880,As=12582912;new Set(`BCDFGHJKLMNPQRSTVWXZ`.split(``));var js=`discard-my-vault-and-history`,Ms=`Anyone who can use this device can use your saved provider keys without your passphrase. Turn this off on shared or public computers. You can revoke it any time from Devices.`,Ns=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`],Ps=/^([01]\d|2[0-3]):[0-5]\d$/;Ao({tz:z().min(1),windows:Oo(Ao({from:z().regex(Ps,`HH:MM`),to:z().regex(Ps,`HH:MM`),days:Oo(Bo(Ns)).optional(),kind:Bo([`peak`,`offpeak`])})),offpeakDiscount:vo().nonnegative().max(1).optional()});var Fs=[`priceInputCacheMissPeak`,`priceInputCacheMissOffpeak`,`priceInputCacheHitPeak`,`priceInputCacheHitOffpeak`,`priceCacheWritePeak`,`priceCacheWriteOffpeak`,`priceOutputPeak`,`priceOutputOffpeak`],Is=Ao({inputCacheMiss:vo().nonnegative(),inputCacheHit:vo().nonnegative().optional(),cacheWrite:vo().nonnegative().optional(),output:vo().nonnegative()});Ao({by:Ho(`prompt_tokens`),tiers:Oo(Ao({upToPromptTokens:vo().int().positive().optional(),price:Is,cost:Is.optional()})).min(1),note:z().optional()}).superRefine((e,t)=>{let n=0;e.tiers.forEach((r,i)=>{let a=r.upToPromptTokens;if(a===void 0){i!==e.tiers.length-1&&t.addIssue({code:`custom`,message:`only the LAST tier may omit upToPromptTokens`,path:[`tiers`,i]});return}a<=n&&t.addIssue({code:`custom`,message:`tiers must ascend: ${a} does not exceed ${n}`,path:[`tiers`,i,`upToPromptTokens`]}),n=a})}),[...Fs];var Ls={oonacode:{hex:`#000000`,owner:`OonaCode`,d:`M0.72 12a11.28 11.28 0 1 0 22.56 0a11.28 11.28 0 1 0 -22.56 0ZM4.8 12a7.2 7.2 0 1 0 14.4 0a7.2 7.2 0 1 0 -14.4 0ZM7.44 12a4.56 4.56 0 1 0 9.12 0a4.56 4.56 0 1 0 -9.12 0Z`,fillRule:`evenodd`},anthropic:{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},"anthropic-subscription":{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},openai:{hex:`#000000`,owner:`OpenAI`,d:`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`},xai:{hex:`#000000`,owner:`xAI`,d:`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`},deepseek:{hex:`#5786FE`,owner:`DeepSeek`,d:`M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45`},kimi:{hex:`#000000`,owner:`Moonshot`,d:`M21.765.351C22.998.351 24 1.353 24 2.586S22.998 4.82 21.765 4.82h-1.974c-.15 0-.26-.12-.26-.26V2.586A2.237 2.237 0 0 1 21.765.35M9.41 13.388l8.447-8.377c.16-.16.07-.471-.14-.471h-4.55s-.1.02-.14.06l-9.099 9.029c-.14.14-.35.02-.35-.21V4.81c0-.15-.1-.27-.221-.27H.22c-.12 0-.22.12-.22.27v18.57c0 .15.1.27.22.27h3.137c.12 0 .22-.12.22-.27v-3.79c0-.08.03-.16.08-.21l2.826-2.796c.07-.07.16-.08.241-.03l7.546 5.551a8.9 8.9 0 0 0 4.018 1.493c.12.01.23-.11.23-.27V19.76c0-.14-.08-.25-.19-.26a5.8 5.8 0 0 1-2.355-.942l-6.533-4.73c-.14-.09-.15-.32-.03-.441`},qwen:{hex:`#6950EF`,owner:`Alibaba`,d:`M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z`},mimo:{hex:`#FF6900`,owner:`Xiaomi`,d:`M12 0C8.016 0 4.756.255 2.493 2.516.23 4.776 0 8.033 0 12.012c0 3.98.23 7.235 2.494 9.497C4.757 23.77 8.017 24 12 24c3.983 0 7.243-.23 9.506-2.491C23.77 19.247 24 15.99 24 12.012c0-3.984-.233-7.243-2.502-9.504C19.234.252 15.978 0 12 0zM4.906 7.405h5.624c1.47 0 3.007.068 3.764.827.746.746.827 2.233.83 3.676v4.54a.15.15 0 0 1-.152.147h-1.947a.15.15 0 0 1-.152-.148V11.83c-.002-.806-.048-1.634-.464-2.051-.358-.36-1.026-.441-1.72-.458H7.158a.15.15 0 0 0-.151.147v6.98a.15.15 0 0 1-.152.148H4.906a.15.15 0 0 1-.15-.148V7.554a.15.15 0 0 1 .15-.149zm12.131 0h1.949a.15.15 0 0 1 .15.15v8.892a.15.15 0 0 1-.15.148h-1.949a.15.15 0 0 1-.151-.148V7.554a.15.15 0 0 1 .151-.149zM8.92 10.948h2.046c.083 0 .15.066.15.147v5.352a.15.15 0 0 1-.15.148H8.92a.15.15 0 0 1-.152-.148v-5.352a.15.15 0 0 1 .152-.147Z`}};function Rs(e){return Ls[e]??null}function zs(e){let t=e.replace(/\(.*?\)/g,` `).split(/[\s/_-]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[1][0]}`.toUpperCase()}var Bs=[`stable`,`dev`];function Vs(e){return typeof e==`string`&&Bs.includes(e)}function Hs(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return Vs(t)?t:null}function Us(e){let t=Hs(e)??`stable`;return t===`stable`?Ts.releasesLatest:`${Ts.releasesLatest}?channel=${encodeURIComponent(t)}`}function Ws(e,t){let n=Hs(t)??`stable`;return n===`stable`?e:`${e} (${n})`}var Gs=5e4,Ks=[`bg`,`surface`,`surface-2`,`surface-3`,`border`,`fg`,`fg-muted`,`fg-faint`,`accent`,`accent-fg`,`accent-soft`,`project`,`ok`,`ok-soft`,`warn`,`warn-soft`,`danger`,`danger-soft`,`think`,`think-soft`,`code-bg`,`user-bubble`],qs={agentFinished:!1,permissionRequired:!0,errorOccurred:!0},Js={autoAcceptPermissions:!1,showReasoningSummaries:!0,notifications:qs,showAgentPicker:!0,transcriptWindowSize:500,openTabs:[],draftTabs:[],draftTitles:{},activeTab:null,remoteTabs:{},sessionPanelOpen:!1,explorerOpen:!1,dismissedUpdateVersion:null,lastSeenReleaseNotes:null,claudeImportOffered:!1,claudeImportOffers:0,collapsedProjects:[],themeColors:{light:{},dark:{}}};function Ys(e){return Math.min(Math.max(typeof e==`number`&&Number.isFinite(e)?Math.floor(e):0,0),3)}function Xs(e){return Math.min(Gs,Math.max(100,typeof e==`number`&&Number.isFinite(e)?Math.round(e):500))}function Zs(e,t){return typeof e==`boolean`?e:t}function Qs(e){return typeof e==`string`&&e.length>0&&e.length<=64?e:null}function $s(e,t=50){if(!Array.isArray(e))return[];let n=[];for(let r of e)if(!(typeof r!=`string`||r.length===0||r.length>200)&&!n.includes(r)&&(n.push(r),n.length>=t))break;return n}function ec(e,t=50){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n={};for(let[r,i]of Object.entries(e))if(!(r.length===0||r.length>200)&&!(typeof i!=`string`||i.length===0||i.length>200)&&(n[r]=i,Object.keys(n).length>=t))break;return n}function tc(e){if(typeof e!=`string`)return null;let t=e.trim();return/^#[0-9a-fA-F]{6}$/.test(t)?t.toLowerCase():null}function nc(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!Ks.includes(n))continue;let e=tc(r);e!==null&&(t[n]=e)}return t}function rc(e){let t=typeof e==`object`&&e?e:{};return{light:nc(t.light),dark:nc(t.dark)}}function ic(e){let t=typeof e==`object`&&e?e:{},n=typeof t.notifications==`object`&&t.notifications!==null?t.notifications:{},r=$s(t.openTabs),i=$s(t.draftTabs).filter(e=>!r.includes(e)),a={};for(let[e,n]of Object.entries(ec(t.draftTitles)))i.includes(e)&&(a[e]=n);let o=[...r,...i],s=t.activeTab,c=typeof s==`string`&&o.includes(s)?s:o[o.length-1]??null;return{autoAcceptPermissions:Zs(t.autoAcceptPermissions,Js.autoAcceptPermissions),showReasoningSummaries:Zs(t.showReasoningSummaries,Js.showReasoningSummaries),notifications:{agentFinished:Zs(n.agentFinished,qs.agentFinished),permissionRequired:Zs(n.permissionRequired,qs.permissionRequired),errorOccurred:Zs(n.errorOccurred,qs.errorOccurred)},showAgentPicker:Zs(t.showAgentPicker,Js.showAgentPicker),transcriptWindowSize:Xs(t.transcriptWindowSize),openTabs:r,draftTabs:i,draftTitles:a,activeTab:c,remoteTabs:ec(t.remoteTabs),sessionPanelOpen:Zs(t.sessionPanelOpen,Js.sessionPanelOpen),explorerOpen:Zs(t.explorerOpen,Js.explorerOpen),dismissedUpdateVersion:Qs(t.dismissedUpdateVersion),lastSeenReleaseNotes:Qs(t.lastSeenReleaseNotes),claudeImportOffered:Zs(t.claudeImportOffered,Js.claudeImportOffered),claudeImportOffers:Ys(t.claudeImportOffers),collapsedProjects:$s(t.collapsedProjects),themeColors:rc(t.themeColors)}}new Set(Object.keys(Js));var ac=[{version:`0.3.134`,date:`2026-09-23`,added:[],fixed:[`On the Android app, the model’s questions can be answered again. They come one at a time — “Question 2 of 3” — with Back, Next and Skip, and Answer sends them to your PC. The card used to show only the first question, hide the rest below it and wait for all of them, so it could not be sent.`]},{version:`0.3.133`,date:`2026-09-23`,added:[`Bring your Claude desktop app projects across: File → Import chats from other coding agents now lists every project the Claude app has opened on this PC. Each one arrives as an OonaCode project of the same name — its goal, instructions and what Claude noted about it become the project’s instructions — with its project chat and one chat per thread filed under it, ready to carry on.`,`A Claude Code chat you moved into a Claude app project is filed under that project here too.`,`A thread you never opened in the Claude app still comes across, with its task and every reply the project chat saw; open it once in the Claude app and import again for its whole conversation.`],fixed:[`Cursor chats appear in the import list again — they had been left out since September 10.`]},{version:`0.3.132`,date:`2026-09-23`,added:[`Reply to any part of a chat: select some text (or just right-click a block), choose Reply, and it is quoted in your message box — type your answer under it. A quote from a file the agent read names the file.`,`Right-click in a chat: copy what you selected, copy a whole reply or tool output, copy a code block or a link, find the selected words in the chat, or select a block.`,`Search in a chat opens the block its match is in — a folded tool card, a thought, a finished agent’s work — and scrolls to the words themselves.`,`Search matches are now bright orange, the current one strongest, so they stand out on code too.`,`The file viewer shows pictures (PNG, JPEG, GIF, WebP, SVG and more), plays audio and video, and shows Markdown formatted, with a switch to the source.`,`Right-click a file or folder in the explorer to copy its path or delete it.`],fixed:[`Moving a chat to another folder or project while it was working could delete the folder it was working in, start two agents at once, or send your next message to the old folder.`,`The working line no longer says a chat may be stuck while it waits for your approval or answer, or right after you send a message, and it counts time correctly (no more "4m 60s").`,`A date line no longer says "Today" for yesterday’s messages when the app stays open past midnight.`,"Installing with npm (`npm i -g oonacode`) installs this version again; earlier npm releases carried an old program.",`The What’s new window could open again on the next start, showing the same update a second time.`,`An older OonaCode window or VS Code extension no longer resets settings it does not know about, such as your theme colours or which project groups you folded.`,`A new install no longer opens with a list of changes; this window now appears only after an update.`,`The notification switch for permissions now says it also covers the agent’s questions.`]},{version:`0.3.131`,date:`2026-09-23`,added:[`Claude Opus 5.5 is here — the newest Opus, and cheaper to run than Opus 5. Choose it in the model picker, from the OonaCode pool or on your own Claude subscription. It runs on the newer Claude Code engine (2.1.280) that this update brings.`,`Every block in a chat shows its time at the bottom right, in your local time — hover it for the full date — and a date line marks where each day starts.`,`A running chat tells you how long the agent has been quiet, and after five minutes that it may be stuck and what to do.`,`After every update, OonaCode now opens this window to show you what changed.`],fixed:[`A reply that streamed in live had no time on it until the chat was opened again.`,`Chats open in tabs could fail to come back after a restart if a setting changed while they were being restored.`]}];function oc(e,t){let n=e=>{let[t,...n]=e.trim().replace(/^v/,``).split(`-`);return{nums:(t??``).split(`.`).map(e=>Number.parseInt(e,10)||0),pre:n.length>0?n.join(`-`):null}},r=n(e),i=n(t);for(let e=0;e<Math.max(r.nums.length,i.nums.length);e++){let t=(r.nums[e]??0)-(i.nums[e]??0);if(t!==0)return t}return r.pre===i.pre?0:r.pre===null?1:i.pre===null?-1:sc(r.pre,i.pre)}function sc(e,t){let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e],i=r[e];if(t===i)continue;if(t===void 0)return-1;if(i===void 0)return 1;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);if(a&&o){let e=Number(t)-Number(i);if(e!==0)return e;continue}return a===o?t<i?-1:1:a?-1:1}return 0}function cc(e,t,n=ac){if(!e||e===`0.0.0`)return[];let r=n.filter(t=>oc(t.version,e)<=0);return[...t===null?r.filter(t=>oc(t.version,e)===0):r.filter(e=>oc(e.version,t)>0)].sort((e,t)=>oc(t.version,e.version))}function lc(e,t,n,r=ac){if(!e||e===`0.0.0`)return{record:null,show:[]};let i=null;for(let e of r)(i===null||oc(e.version,i)>0)&&(i=e.version);let a=i!==null&&oc(e,i)>0?i:e;return{record:t===null||oc(a,t)>0?a:null,show:t===null&&!n?[]:cc(e,t,r)}}function uc(e,t){if(t==null)return[...e];if(t.length===0)return[];let n=new Set(t),r=e.filter(e=>n.has(e.id));return r.length>0?r:[...e]}var dc=`the user skipped the question`,fc=`(the user skipped this question)`;function pc(e){let t=e?.questions;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.question!=`string`)continue;let r=Array.isArray(t.options)?t.options.map(e=>e&&typeof e==`object`?e:null).filter(e=>e!==null&&typeof e.label==`string`).map(e=>({label:e.label,...typeof e.description==`string`?{description:e.description}:{}})):[];n.push({question:t.question,header:typeof t.header==`string`?t.header:``,options:r,multiSelect:t.multiSelect===!0})}return n}function mc(e,t,n={},r=new Set){let i={};return e.forEach((e,a)=>{if(r.has(a)){i[e.question]=fc;return}let o=[...t[a]??[]],s=(n[a]??``).trim();s&&o.push(s),i[e.question]=o.join(`, `)}),i}function hc(e,t,n){return n?`${e}::${n}::${t}`:`${e}::${t}`}function gc(e,t){return e===`oonacode`?-1:t}function _c(e){return e.filter(e=>e.definition.enabled&&e.configured&&T(e.definition.id)&&!D(e.definition.id)&&e.definition.models.length>0).map((e,t)=>({p:e,order:gc(e.definition.id,t)})).sort((e,t)=>e.order-t.order).map(e=>e.p)}function vc(e){let t=ps(e.definition);if(t.length<2)return[{variantId:null,suffix:``}];let n=new Set((e.credentials??[]).map(e=>e.variantId??`payg`)),r=t.filter(e=>n.has(e.id));return r.length<2?[{variantId:null,suffix:``}]:r.map(e=>({variantId:e.id,suffix:` ${yc(e.id,e.label)}`}))}function yc(e,t){return e===`token-plan`?`Subscription`:e===`payg`||e===`api-key`?`API`:t}function bc(e,t){let n=_c(e),r=e=>{let t=e.definition.clientGroup,r=(t?n.find(e=>e.definition.id===t)?.definition:void 0)?.displayName??e.definition.displayName,i=n.filter(n=>(n.definition.clientGroup??n.definition.id)===(t??e.definition.id));return e.definition.recordLabel&&i.length>1?`${r} ${e.definition.recordLabel}`:r};return n.flatMap(n=>{let i=uc(n.definition.models,t?.[n.definition.id]),a=r(n);return vc(n).map(t=>({providerId:n.definition.id,variantId:t.variantId,label:`${a}${t.suffix}`,route:n.definition.route,models:i.map(r=>({providerId:n.definition.id,variantId:t.variantId,modelId:r.id,label:r.displayName||r.id,value:hc(n.definition.id,r.id,t.variantId),free:r.free===!0,details:{...r.aaIntelligence===void 0?{}:{intelligence:r.aaIntelligence},...r.aaCoding===void 0?{}:{coding:r.aaCoding},...r.aaOutputTps===void 0?{}:{outputTps:r.aaOutputTps},...r.aaTtft===void 0?{}:{ttft:r.aaTtft},...r.contextWindow===void 0?{}:{contextWindow:r.contextWindow},...r.maxOutputTokens===void 0?{}:{maxOutputTokens:r.maxOutputTokens},...r.supportsThinking===void 0?{}:{thinking:r.supportsThinking},...r.supportsVision===void 0?{}:{vision:r.supportsVision},...r.supportsTools===void 0?{}:{tools:r.supportsTools},...r.inputPricePerM===void 0?{}:{inputPricePerM:r.inputPricePerM},...r.outputPricePerM===void 0?{}:{outputPricePerM:r.outputPricePerM},...r.notes===void 0?{}:{notes:r.notes},...r.aa===void 0?{}:{aa:r.aa},...r.servedBy===void 0?{}:{providers:r.servedBy.map(t=>{let n=e.find(e=>e.definition.id===t)?.definition,i=n?.displayName??t;if(!r.subscriptionServedBy?.includes(t))return i;let a=n?.credentialVariants?.find(e=>e.id===`token-plan`)?.label;return`${i} — ${a?a.replace(/\s*\(.*\)\s*$/,``):`subscription`}`})}}}))}))}).filter(e=>e.models.length>0)}function xc(e,t){let n=bc(e),r=n[0]??null,i=t.providerId??r?.providerId??null,a=t.variantId??(i?n.find(e=>e.providerId===i)?.variantId??null:r?.variantId??null);return i?t.model?{providerId:i,variantId:a,modelId:t.model}:{providerId:i,variantId:a,modelId:e.find(e=>e.definition.id===i)?.definition?.defaultModel||n.find(e=>e.providerId===i)?.models[0]?.modelId||null}:{providerId:null,variantId:a,modelId:t.model??null}}function Sc(e){if(!Number.isFinite(e))return`0 credits`;let t=Math.round(e*1e3)/1e3,n=t.toFixed(3).replace(/\.?0+$/,``);return`${n===``?`0`:n} credit${t===1?``:`s`}`}function Cc(e){if(typeof e!=`string`)return null;let t=/^API Error\b:?\s*(?:(\d{3})(?!\d)\s*)?([\s\S]*)$/i.exec(e.trim());return t?{status:t[1]===void 0?null:Number(t[1]),message:(t[2]??``).trim()}:null}function wc(e){return typeof e!=`string`||e===``?!1:/prompt is too long|maximum context length|context[ _-]?length[ _-]?exceeded|input token count exceeds|too many (?:input )?tokens|exceeds? the (?:maximum|model's) context/i.test(e)}var Tc=`chat too long for this model`;function Ec(e,t){if(wc(t))return Tc;switch(e){case 400:case 422:return`invalid request`;case 401:return`sign-in needed`;case 402:return`insufficient credits`;case 403:return`not allowed`;case 404:return`model not found`;case 408:case 504:return`timed out`;case 413:return`request too large`;case 429:return`rate limited`;default:return e!==null&&e>=500&&e<=599?`provider error`:`API error`}}var Dc={error_max_turns:`max turns reached`,error_max_budget_usd:`budget reached`,error_during_execution:`error during execution`,error_max_structured_output_retries:`structured output failed`,interrupted:`interrupted`,success:`error`};function Oc(e){if(!e.isError)return`turn complete`;let t=Cc(e.text);if(t)return Ec(t.status,t.message);let n=Dc[e.subtype];if(n!==void 0)return n;let r=e.subtype.replace(/_/g,` `).trim();return r===``?`error`:r}var kc={authentication_failed:`sign-in needed`,billing_error:`billing problem`,rate_limit:`rate limited`,invalid_request:`invalid request`,server_error:`provider error`};function Ac(e,t){if(typeof e!=`string`)return null;let n=e.trim();if(n===``)return null;if(wc(t))return Tc;let r=kc[n];if(r!==void 0)return r;if(n===`unknown`){let e=Cc(t);return e?Ec(e.status,e.message):wc(t)?Tc:`error`}return n.replace(/_/g,` `)}function jc(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function Mc(e,t){let n=typeof e==`object`&&e?e:{},r={input:jc(n.input_tokens),cached:jc(n.cache_read_input_tokens)+jc(n.cache_creation_input_tokens),output:jc(n.output_tokens)};if(r.input+r.cached+r.output>0||typeof t!=`object`||!t)return r;let i={input:0,cached:0,output:0};for(let e of Object.values(t)){if(typeof e!=`object`||!e)continue;let t=e;i.input+=jc(t.inputTokens),i.cached+=jc(t.cacheReadInputTokens)+jc(t.cacheCreationInputTokens),i.output+=jc(t.outputTokens)}return i}function Nc(e,t,n=140){let r=t??{};for(let t of[`command`,`file_path`,`pattern`,`query`,`url`,`path`,`prompt`]){let i=r[t];if(typeof i==`string`&&i.trim().length>0){let t=i.replace(/\s+/g,` `).trim();return`${e}: ${t.length>n?`${t.slice(0,n)}…`:t}`}}return e}var Pc={complete:`/api/v1/account/vault/rekey-complete`,revoke:`/api/v1/account/vault/rekey-revoke`,deviceUnlock:`/api/v1/account/device-unlock`};function Fc(e){return e?.deviceUnlock??`off`}function Ic(e){if(!e?.loggedIn)return null;let t=e;if(t.vaultStatus!==`pending_rekey`)return null;let n=t.vaultRekeyPending??null;return{pending:n,canFinishHere:t.canFinishRekey===!0,trustedDevices:n?.trustedDevices.map(e=>e.label||e.name)??[],since:n?.since??null,from:Lc(n)}}function Lc(e){if(!e)return null;let t=e.requestedFrom.device?.trim()||null,n=e.requestedFrom.ip?.trim()||null;return t&&n?`${t} (${n})`:t??n}function Rc(e){if(!e)return`an unknown date`;let t=Date.parse(e);if(Number.isNaN(t))return`an unknown date`;try{return new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}catch{return new Date(t).toISOString()}}function zc(e){let t=e.from?` from ${e.from}`:``;return`A password reset was started on ${Rc(e.since)}${t}. Your saved provider keys are still sealed under the old password.`}function Bc(e){return e.trustedDevices.length===0?`No device with "keep me unlocked" is left, so nothing here holds the key from before the reset.`:`Open OonaCode on ${Hc(e.trustedDevices)} to finish the reset — your saved keys are waiting there.`}var Vc=`Either way, your vault Recovery Key still works: sign in on the OonaCode website from any device and finish the reset there. Discarding is the last resort — it deletes your saved provider keys, your mirrored history and that Recovery Key for good.`;function Hc(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} or ${e[e.length-1]}`}function Uc(e){return e.canFinishHere?`A password reset is waiting: this PC can move your vault to the new password.`:e.trustedDevices.length>0?`A password reset is waiting — your saved keys stay locked until it is finished on ${Hc(e.trustedDevices)}.`:`A password reset is waiting and no PC holds the old key — finish it with your vault Recovery Key on the OonaCode website.`}var Wc=class extends Error{code;status;details;constructor(e,t,n,r){super(n),this.name=`HostApiError`,this.code=e,this.status=t,this.details=r}get isUnauthorized(){return this.status===401||this.code===`unauthorized`}get isEmailNotVerified(){return this.code===`email_not_verified`}};function Gc(e){if(!e)return``;let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function Kc(e){return e.trim().replace(/\/+$/,``)}function qc(e,t){let n=Kc(e.baseUrl),r=t??((e,t)=>fetch(e,t));async function i(t,i,a,o={}){let s={Authorization:`Bearer ${e.token}`,Accept:o.raw||o.bytes?`*/*`:`application/json`},c={method:t,headers:s,credentials:`omit`};a!==void 0&&(s[`Content-Type`]=`application/json`,c.body=JSON.stringify(a));let l;try{l=await r(`${n}${i}`,c)}catch(e){throw new Wc(`network`,0,`Cannot reach the host at ${n}: ${String(e?.message??e)}`)}if(!l.ok){let e=null,t=``;try{t=await l.text(),e=t?JSON.parse(t):null}catch{e=null}let n=e?.error?.code??(l.status===401?`unauthorized`:`internal`),r=e?.error?.message??(t||`${l.status} ${l.statusText}`);throw new Wc(n,l.status,r,e?.error?.details)}if(o.bytes)return await l.arrayBuffer();if(o.raw)return await l.text();if(l.status===204)return;let u=await l.text();if(u)try{return JSON.parse(u)}catch{throw new Wc(`parse`,l.status,`Host returned malformed JSON for ${t} ${i}`)}}let a=Te;return{health:()=>i(a.health,I.health),info:()=>i(a.info,I.info),listSessions:e=>i(a.listSessions,`${I.sessions}${Gc(e)}`),createSession:e=>i(a.createSession,I.sessions,e),getSession:e=>i(a.getSession,I.session(e)),updateSession:(e,t)=>i(a.updateSession,I.session(e),t),deleteSession:e=>i(a.deleteSession,I.session(e)),exportSessionsArchive:async t=>{let i=await r(`${n}${I.sessionsExportArchive}`,{method:`POST`,credentials:`omit`,headers:{Authorization:`Bearer ${e.token}`,Accept:`application/zip`,"Content-Type":`application/json`},body:JSON.stringify({password:t})});if(!i.ok){let e=await i.text().catch(()=>``),t=null;try{t=e?JSON.parse(e):null}catch{t=null}throw new Wc(t?.error?.code??`internal`,i.status,t?.error?.message??e??`the export failed`)}return i.blob()},listEntries:(e,t)=>i(a.listEntries,`${I.sessionEntries(e)}${Gc(t)}`),listMessages:e=>i(a.listMessages,I.sessionMessages(e)),prompt:(e,t)=>i(a.prompt,I.sessionPrompt(e),{...t,stream:!1}),interrupt:e=>i(a.interrupt,I.sessionInterrupt(e),{}),cancelQueued:(e,t)=>i(a.cancelQueued,I.sessionQueued(e,t)),forkSession:(e,t)=>i(a.fork,I.sessionFork(e),t??{}),exportSession:(e,t)=>i(a.export,`${I.sessionExport(e)}${Gc(t)}`,void 0,{raw:!0}),listProjects:()=>i(a.listProjects,I.projects),listVaultProjects:()=>i(a.listVaultProjects,I.vaultProjects),createVaultProject:e=>i(a.createVaultProject,I.vaultProjects,e),updateVaultProject:(e,t)=>i(a.updateVaultProject,I.vaultProject(e),t),deleteVaultProject:e=>i(a.deleteVaultProject,I.vaultProject(e)),scanClaudeSessions:()=>i(a.scanClaudeSessions,I.importClaude),importClaudeSessions:e=>i(a.importClaudeSessions,I.importClaude,e??{}),sessionLink:e=>i(a.sessionLink,I.sessionLink(e)),syncSessionDown:e=>i(a.syncSessionDown,I.sessionSyncDown(e),{}),inspectProject:e=>i(a.inspectProject,`${I.projectInspect}${Gc(e)}`),attachSessionProject:(e,t)=>i(a.attachSessionProject,I.sessionProject(e),t),listProviders:()=>i(a.listProviders,I.providers),setActiveProvider:e=>i(a.setActiveProvider,I.providersActive,e),testProvider:e=>i(a.providerTest,I.providerTest(e),{}),probeCredential:(e,t)=>i(a.providerProbe,I.providerProbe(e),t),listModels:e=>i(a.listModels,`${I.models}${Gc(e)}`),getSettings:()=>i(a.getSettings,I.settings),updateSettings:e=>i(a.updateSettings,I.settings,e),getAccount:()=>i(a.getAccount,I.account),login:e=>i(a.login,I.accountLogin,e),logout:()=>i(a.logout,I.accountLogout,{}),unlock:e=>i(a.unlock,I.accountUnlock,e),lock:()=>i(`POST`,I.accountLock,{reason:`user`}),plan:()=>i(`GET`,I.accountPlan),remoteUnlockHost:(e,t)=>i(`POST`,I.hostVaultUnlock(e),{password:t}),resendVerification:e=>i(a.resendVerification,I.accountResendVerification,e),startAccountLink:e=>i(a.linkStart,I.accountLinkStart,e??{}),accountLinkStatus:()=>i(a.linkStatus,I.accountLinkStatus),cancelAccountLink:()=>i(a.linkCancel,I.accountLinkCancel,{}),completeVaultRekey:e=>i(`POST`,Pc.complete,e),revokeVaultRekey:e=>i(`POST`,Pc.revoke,e),setDeviceUnlock:e=>i(`POST`,Pc.deviceUnlock,e),listCredentials:()=>i(a.listCredentials,I.credentials),addCredential:e=>i(a.addCredential,I.credentials,e),deleteCredential:e=>i(a.deleteCredential,I.credential(e)),testCredential:e=>i(a.credentialTest,I.credentialTest(e),{}),syncNow:()=>i(a.syncNow,I.syncNow,{}),claudeSubscriptionLogin:()=>i(a.claudeLogin,I.subscriptionClaudeLogin,{}),claudeSubscriptionStatus:()=>i(a.claudeStatus,I.subscriptionClaudeStatus),claudeLoginState:()=>i(a.claudeLoginState,I.subscriptionClaudeLoginState),claudeLoginCode:e=>i(a.claudeLoginCode,I.subscriptionClaudeLoginCode,e),claudeLoginCancel:()=>i(a.claudeLoginCancel,I.subscriptionClaudeLoginCancel,{}),oauthLoginStart:e=>i(a.oauthLogin,I.subscriptionOauthLogin(e),{}),oauthLoginState:e=>i(a.oauthLoginState,I.subscriptionOauthLoginState(e)),oauthLoginCancel:e=>i(a.oauthLoginCancel,I.subscriptionOauthLoginCancel(e),{}),doctor:()=>i(a.doctor,I.doctor),listHosts:()=>i(a.listHosts,I.hosts),listHostSessions:e=>i(a.listHostSessions,I.hostSessions(e)),deleteHostSession:(e,t)=>i(a.deleteHostSession,I.hostSession(e,t),{method:`DELETE`}),updateHost:(e,t)=>i(a.updateHost,I.host(e),t),listHostSessionEntries:(e,t,n)=>i(a.listHostSessionEntries,`${I.hostSessionEntries(e,t)}${Gc(n)}`),reportError:e=>i(a.errorReport,I.errorReport,e),sendBugReport:e=>i(a.bugReport,I.bugReport,e),listSessionFiles:(e,t)=>i(a.listSessionFiles,`${I.sessionFiles(e)}${Gc({path:t})}`),readSessionFile:(e,t)=>i(a.readSessionFile,`${I.sessionFile(e)}${Gc({path:t})}`,void 0,{raw:!0}),readSessionFileBytes:(e,t)=>i(a.readSessionFile,`${I.sessionFile(e)}${Gc({path:t})}`,void 0,{bytes:!0}),deleteSessionFile:(e,t)=>i(a.deleteSessionFile,`${I.sessionFile(e)}${Gc({path:t})}`)}}function Jc(e){return e instanceof Wc&&(e.status===404||e.status===501)}var Yc=120;function Xc(){return Yc}function Zc(e){let t=e.batchMs??120,n=e.hiddenBatchMs??1e3,r=e.isHidden??(()=>!1),i=e.now??(()=>Date.now()),a=e.setTimeout??((e,t)=>setTimeout(e,t)),o=e.clearTimeout??(e=>clearTimeout(e)),s=[],c=null,l=-1/0,u=!1,d=()=>{if(c!==null&&(o(c),c=null),s.length===0)return;let t=s;s=[],l=i(),e.deliver(t)};return{push(o){if(u)return;if(s.push(o),!e.isStreamFrame(o)){d();return}let f=r()?n:t;if(f<=0){d();return}if(c!==null)return;let p=i()-l;if(p>=f){d();return}c=a(()=>{c=null,d()},f-p)},flush:d,dispose(){u=!0,c!==null&&o(c),c=null,s=[]}}}function Qc(e){return e instanceof Wc&&e.code===`email_not_verified`}function $c(e){if(!Qc(e))return null;let t={error:{code:e.code,message:e.message,details:e.details}};return A(t)?t.error.details:null}function el(e){let t=e.trim(),n=t.indexOf(`@`);return n<=0?`***`:`${t.slice(0,1)}***${t.slice(n)}`}function tl(e,t){return e===void 0||!Number.isFinite(e)||e<=0?t:t+Math.ceil(e)*1e3}function nl(e,t){return Math.max(0,Math.ceil((e.resendAt-t)/1e3))}function rl(e,t){if(!Qc(e))return null;let n=t.now??Date.now(),r=$c(e),i=t.email.trim();return{email:i,displayEmail:r?.email||el(i),verification:r?.verification??`pending`,registered:t.registered===!0,resendAt:tl(r?.resendAfterSec,n)}}function il(e){let t=e.registered?`Account created. `:``;return e.verification===`unverified`?`${t}Confirm your email first — no link is outstanding for ${e.displayEmail}; send a new one.`:`${t}Confirm your email first — we sent a link to ${e.displayEmail}.`}function al(e=null){return{sessionId:e,session:null,items:[],index:new Map,status:`idle`,activeTurnId:null,init:null,statusText:null,pendingPermissions:[],lastSeq:null,totals:{costUsd:0,inputTokens:0,cachedInputTokens:0,outputTokens:0,turns:0},turnCachedTokens:0,hydrated:!1,agentActivity:{},hasSubagentItems:!1,hasOptimisticUser:!1,lastLocalPromptId:null,lastFrameAt:null,lastLiveUuid:null,engineSince:null,subpathParents:{},seen:new Set,streams:{},nextId:1}}function ol(e,t){let n=e.agentActivity[t.agentId],r={subpath:t.subpath,firstAt:n?Math.min(n.firstAt,t.at):t.at,at:n?Math.max(n.at,t.at):t.at,finished:t.finished,toolUses:(n?.toolUses??0)+t.toolUses};return{...e,agentActivity:{...e.agentActivity,[t.agentId]:r}}}function sl(e,t,n,r,i,a){let o=Hl.exec(t)?.[2];if(!o)return e;let s=i&&Date.parse(i)||0;if(n!==`assistant`)return ol(e,{agentId:o,subpath:t,at:s,finished:e.agentActivity[o]?.finished??!1,toolUses:0});let c=(Array.isArray(r)?r:[]).filter(e=>e.type===`tool_use`),l=c.length===0;return typeof a==`string`&&(l=a===`end_turn`||a===`stop_sequence`),c.some(e=>e.name===`StructuredOutput`)&&(l=!0),ol(e,{agentId:o,subpath:t,at:s,finished:l,toolUses:c.length})}function cl(e,t){switch(t.type){case`frame`:return ll(e,t.frame,t.receivedAt);case`hydrate`:return Rl(e,t.messages,t.session??null);case`entries`:return Bl(e,t.entries);case`session`:return H(e,t.session);case`local_prompt`:return ql(e,t);case`local_prompt_failed`:return Jl(e,t.requestId);case`local_permission`:return Ll(e,t.requestId,t.behavior,`local`);case`local_system`:{let n={kind:`system`,id:`sys:${e.nextId}`,uuid:null,parentToolUseId:null,turnId:null,timestamp:null,subtype:t.subtype,text:t.text};return tu({...e,nextId:e.nextId+1},n)}case`reset`:return al(e.sessionId)}}function ll(e,t,n){let r=ml(e,t,n);if(n===void 0||!dl(t,e,r))return r;let i=r.lastFrameAt;return i!==null&&n>=i&&n-i<1e3?r:{...r,lastFrameAt:n}}function ul(e){return e===`running`||e===`waiting_permission`}function dl(e,t,n){switch(e.type){case`agent`:return e.seq===null?e.message.type!==`system`||e.message.subtype!==`local_command`:!1;case`turn_started`:case`turn_finished`:case`prompt_delivered`:case`subagent_activity`:return!0;case`permission_request`:return n!==t;case`permission_resolved`:return!0;default:return!1}}function fl(e){if(e.lastFrameAt!==null||!e.hydrated||!ul(e.status))return e;let t=e.engineSince??0;for(let n=e.items.length-1;n>=0;n--){let r=e.items[n].timestamp,i=r?Date.parse(r):NaN;if(Number.isFinite(i)){i>t&&(t=i);break}}for(let n of Object.values(e.agentActivity))n.at>t&&(t=n.at);return t>0?{...e,lastFrameAt:t}:e}function pl(e,t,n){return t!==null||n===void 0||typeof e.timestamp==`string`?e:{...e,timestamp:new Date(n).toISOString()}}function ml(e,t,n){switch(t.type){case`agent`:{if(t.seq!==null&&e.seen.has(`seq:${t.seq}`))return e;let r=hl(e,pl(t.message,t.seq,n),{turnId:t.turnId,receivedAt:n});return t.seq!==null&&(r=au(r,`seq:${t.seq}`),(r.lastSeq===null||t.seq>r.lastSeq)&&(r={...r,lastSeq:t.seq})),r}case`turn_started`:{let n=`turnstart:${t.turnId}`;if(e.seen.has(n))return e;let r=au(e,n);if(r={...r,activeTurnId:t.turnId,status:`running`,statusText:null,turnCachedTokens:0},t.requestId){let e=r.items.findIndex(e=>e.kind===`user`&&e.requestId===t.requestId);if(e>=0){let n={...r.items[e],turnId:t.turnId,waiting:!1};r=e<r.items.length-1?tu(ru(r,new Set([n.id])),n):nu(r,e,n)}}return r}case`turn_finished`:return Ml(e,t.result,t.turnId);case`prompt_delivered`:return Ol(e,t.text,t.deliveredAt);case`prompt_cancelled`:{let n=e.items.filter(e=>e.kind===`user`&&!e.failed&&(e.requestId===t.requestId||(e.waiting||e.optimistic)&&e.deliveredAt===null&&e.text===t.text));return ru(e,new Set(n.map(e=>e.id)))}case`subagent_activity`:return ol(e,{agentId:t.agentId,subpath:t.subpath,at:Date.parse(t.at)||Date.now(),finished:t.finished,toolUses:t.toolUses});case`permission_request`:return Il(e,t.request,t.turnId,t.settled===!0);case`permission_resolved`:return Ll(e,t.requestId,t.behavior,t.resolvedBy);case`session_state`:{let n=t.session;return H((n.status===`idle`||n.status===`error`)&&e.pendingPermissions.length===0&&e.activeTurnId!==null?{...e,activeTurnId:null}:e,n)}case`error`:{if(t.code===`replay_truncated`||t.code===`replay_windowed`)return e;let r={kind:`error`,id:`err:${e.nextId}`,uuid:null,parentToolUseId:null,turnId:e.activeTurnId,timestamp:n===void 0?null:new Date(n).toISOString(),code:t.code,message:t.message,requestId:t.requestId??null};return tu({...e,nextId:e.nextId+1},r)}default:return e}}function hl(e,t,n){let r=typeof t.uuid==`string`?t.uuid:null,i=t.type===`stream_event`||t.type===`tool_progress`,a=r&&!i?`uuid:${r}`:null;if(i&&r!==null&&r===e.lastLiveUuid)return e;if(a&&e.seen.has(a))return t.type===`assistant`?bl(e,t):e;let o=e;switch(t.type){case`system`:o=gl(e,t,n);break;case`stream_event`:o=_l(e,t,n);break;case`assistant`:o=yl(e,t,n);break;case`user`:o=Tl(e,t,n);break;case`result`:o=jl(e,t,n);break;case`tool_progress`:o=Pl(e,t);break;case`auth_status`:o=Fl(e,t,n);break;default:return e}return a?o=au(o,a):i&&r!==null&&(o={...o,lastLiveUuid:r}),o}function gl(e,t,n){switch(t.subtype){case`init`:{let r={model:du(t.model),cwd:du(t.cwd),tools:Array.isArray(t.tools)?t.tools.filter(e=>typeof e==`string`):[],permissionMode:du(t.permissionMode),claudeCodeVersion:du(t.claude_code_version),apiKeySource:du(t.apiKeySource),sessionId:du(t.session_id),mcpServers:Array.isArray(t.mcp_servers)?t.mcp_servers:[]};return{...e,init:r,engineSince:n.receivedAt??Date.now()}}case`compact_boundary`:{let r=t.compact_metadata??{},i={kind:`compact`,id:su(e,`compact`,t),uuid:cu(t),parentToolUseId:lu(t),turnId:n.turnId,timestamp:uu(t),trigger:r.trigger===`manual`?`manual`:`auto`,preTokens:typeof r.pre_tokens==`number`?r.pre_tokens:0,postTokens:typeof r.post_tokens==`number`?r.post_tokens:null};return tu(ou(e),i)}case`status`:{let n=typeof t.status==`string`?t.status:null;return{...e,statusText:n}}case`task_notification`:{let r=fe({taskId:du(t.task_id)||null,toolUseId:du(t.tool_use_id)||null,status:du(t.status)||null,summary:du(t.summary)||null});if(Zl(e,r))return e;let i=cu(t),a={kind:`user`,id:i?`u:${i}`:`i${e.nextId}`,uuid:i,parentToolUseId:lu(t),turnId:n.turnId,timestamp:uu(t),text:r,attachments:[],requestId:null,optimistic:!1,failed:!1,waiting:!1,deliveredAt:null,compactSummary:!1,taskNotification:!0,engineNote:!1};return e.index.get(a.id)===void 0?tu(i?e:ou(e),a):e}case`permission_denied`:{let n=du(t.tool_use_id),r=du(t.message);return iu(e,n,e=>{let t=e.name===`AskUserQuestion`&&r===`the user skipped the question`;return{...e,status:t?`skipped`:`denied`,result:e.result??{content:r||`Permission denied`,isError:!t,structured:null}}})}case`rewind_boundary`:{let n={kind:`system`,id:`sys:${e.nextId}`,uuid:cu(t),parentToolUseId:lu(t),turnId:e.activeTurnId,timestamp:uu(t),subtype:`rewind`,text:typeof t.content==`string`&&t.content.trim()?t.content.trim():`Rewound here — the conversation was taken back to this point and continued differently.`};return tu({...e,nextId:e.nextId+1},n)}default:{let n=typeof t.content==`string`?t.content.trim():``,r=n?wl(n):null;if(!r||r.subtype===`caveat`)return e;let i={kind:`system`,id:`sys:${e.nextId}`,uuid:cu(t),parentToolUseId:lu(t),turnId:e.activeTurnId,timestamp:uu(t),subtype:r.subtype,text:r.text};return tu({...e,nextId:e.nextId+1},i)}}}function _l(e,t,n){let r=t.event;if(!r||typeof r!=`object`)return e;let i=lu(t),a=i??``,o=e.streams[a]??{messageId:null,model:null,blocks:{},unclaimed:[]};switch(r.type){case`message_start`:{let t=r.message,n={messageId:t?.id??null,model:t?.model??null,blocks:{},unclaimed:[]},i=e;for(let e of o.unclaimed)i=vl(i,e);return{...i,streams:{...i.streams,[a]:n}}}case`content_block_start`:{let s=r.content_block,c=e,l;if(s.type===`text`)l={kind:`assistant`,id:`i${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:uu(t),text:s.text??``,streaming:!0,model:o.model,messageId:o.messageId,error:null,aborted:!1},c=ou(c);else if(s.type===`thinking`||s.type===`redacted_thinking`)l={kind:`thinking`,id:`i${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:uu(t),text:s.type===`thinking`?s.thinking??``:``,streaming:!0,redacted:s.type===`redacted_thinking`},c=ou(c);else if(s.type===`tool_use`){let c=s;if(e.index.get(c.id)!==void 0){let t={...o.blocks,[r.index]:c.id};return{...e,streams:{...e.streams,[a]:{...o,blocks:t}}}}let u=c.input&&Object.keys(c.input).length>0;l={kind:`tool`,id:c.id,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:uu(t),toolUseId:c.id,name:c.name,input:u?c.input:null,inputJson:u?JSON.stringify(c.input):``,status:`streaming`,result:null,startedAt:n.receivedAt??null,finishedAt:null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:o.messageId}}else return e;c=tu(c,l);let u={...o.blocks,[r.index]:l.id},d=[...o.unclaimed,l.id];return{...c,streams:{...c.streams,[a]:{...o,blocks:u,unclaimed:d}}}}case`content_block_delta`:{let t=o.blocks[r.index];if(!t)return e;let n=e.index.get(t);if(n===void 0)return e;let i=e.items[n],a=r.delta;return a.type===`text_delta`&&i.kind===`assistant`?nu(e,n,{...i,text:i.text+a.text}):a.type===`thinking_delta`&&i.kind===`thinking`?nu(e,n,{...i,text:i.text+a.thinking}):a.type===`input_json_delta`&&i.kind===`tool`?nu(e,n,{...i,inputJson:i.inputJson+a.partial_json}):e}case`content_block_stop`:{let t=o.blocks[r.index];return t?vl(e,t,n.receivedAt):e}case`message_delta`:case`message_stop`:case`ping`:return e;case`error`:{let a={kind:`error`,id:`err:${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:uu(t),code:r.error?.type??`stream_error`,message:r.error?.message??`stream error`,requestId:null};return tu(ou(e),a)}default:return e}}function vl(e,t,n){let r=e.index.get(t);if(r===void 0)return e;let i=e.items[r];if(i.kind===`assistant`||i.kind===`thinking`)return i.streaming?nu(e,r,{...i,streaming:!1}):e;if(i.kind===`tool`&&i.status===`streaming`){let t=i.input??hu(i.inputJson);return nu(e,r,{...i,input:t,status:`running`,startedAt:i.startedAt??n??null})}return e}function yl(e,t,n){let r=t.message??{},i=pu(r.content),a=lu(t),o=a??``,s=cu(t),c=uu(t),l=typeof t.error==`string`?t.error:null,u=t.aborted===!0,d=e;{let e=fu(r.usage?.cache_read_input_tokens)+fu(r.usage?.cache_creation_input_tokens),t=`usage:${r.id??``}`;e>0&&r.id&&!d.seen.has(t)&&(d={...au(d,t),turnCachedTokens:d.turnCachedTokens+e})}let f=d.streams[o];for(let e of i){let t=f?xl(d,f,e):null;if(t){let n=d.index.get(t),i=d.items[n];d=nu(d,n,Sl(i,e,{uuid:s,timestamp:c,model:r.model??null,messageId:r.id??null,errorText:l,aborted:u})),f={...f,unclaimed:f.unclaimed.filter(e=>e!==t)},d={...d,streams:{...d.streams,[o]:f}};continue}let i=Cl(d,e,{uuid:s,timestamp:c,parentToolUseId:a,turnId:n.turnId,model:r.model??null,messageId:r.id??null,errorText:l,aborted:u,receivedAt:n.receivedAt});i&&(d=i)}if(i.length===0&&l){let e={kind:`error`,id:`err:${d.nextId}`,uuid:s,parentToolUseId:a,turnId:n.turnId,timestamp:c,code:`assistant_error`,message:l,requestId:null};d=tu(ou(d),e)}return d}function bl(e,t){let n=lu(t)??``,r=e.streams[n];if(!r||r.unclaimed.length===0)return e;let i=t.message??{},a=new Set,o=e,s=r;for(let e of pu(i.content)){let t=xl(o,s,e);t&&(a.add(t),s={...s,unclaimed:s.unclaimed.filter(e=>e!==t)},o={...o,streams:{...o.streams,[n]:s}})}return ru(e,a)}function xl(e,t,n){for(let r of t.unclaimed){let t=e.index.get(r);if(t===void 0)continue;let i=e.items[t];if(!i.uuid&&(n.type===`text`&&i.kind===`assistant`||(n.type===`thinking`||n.type===`redacted_thinking`)&&i.kind===`thinking`||n.type===`tool_use`&&i.kind===`tool`&&i.toolUseId===n.id))return r}return null}function Sl(e,t,n){if(e.kind===`assistant`&&t.type===`text`){let r=t.text??e.text;return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,text:r.length>=e.text.length?r:e.text,streaming:!1,model:n.model??e.model,messageId:n.messageId??e.messageId,error:n.errorText,aborted:n.aborted}}if(e.kind===`thinking`){let r=t.type===`thinking`?t.thinking??e.text:e.text;return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,text:r||e.text,streaming:!1}}if(e.kind===`tool`&&t.type===`tool_use`){let r=t,i=r.input&&Object.keys(r.input).length>0?r.input:e.input??hu(e.inputJson);return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,name:r.name??e.name,input:i,inputJson:e.inputJson||(i?JSON.stringify(i):``),status:e.status===`streaming`?`running`:e.status,messageId:n.messageId??e.messageId}}return e}function Cl(e,t,n){let r={uuid:n.uuid,parentToolUseId:n.parentToolUseId,turnId:n.turnId,timestamp:n.timestamp};if(t.type===`text`){let i={kind:`assistant`,id:`i${e.nextId}`,...r,text:t.text??``,streaming:!1,model:n.model,messageId:n.messageId,error:n.errorText,aborted:n.aborted};return tu(ou(e),i)}if(t.type===`thinking`||t.type===`redacted_thinking`){let n={kind:`thinking`,id:`i${e.nextId}`,...r,text:t.type===`thinking`?t.thinking??``:``,streaming:!1,redacted:t.type===`redacted_thinking`};return tu(ou(e),n)}if(t.type===`tool_use`){let i=t,a=e.index.get(i.id);if(a!==void 0){let r=e.items[a];return nu(e,a,Sl(r,t,n))}let o=i.input&&typeof i.input==`object`?i.input:null;return tu(e,{kind:`tool`,id:i.id,...r,toolUseId:i.id,name:i.name,input:o,inputJson:o?JSON.stringify(o):``,status:`running`,result:null,startedAt:n.receivedAt??null,finishedAt:null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:n.messageId})}return null}function wl(e){if(/^<local-command-caveat>/.test(e))return{subtype:`caveat`,text:``};let t=/^<local-command-(stdout|stderr)>([\s\S]*?)<\/local-command-\1>$/.exec(e);if(t){let e=t[2].replace(/\u001b\[[0-9;]*m/g,``).trim();return{subtype:t[1]===`stderr`?`local-command-error`:`local-command`,text:e}}let n=/<command-name>([^<]*)<\/command-name>/.exec(e);if(n&&/^<command-/.test(e)){let t=/<command-args>([^<]*)<\/command-args>/.exec(e)?.[1]?.trim()??``;return{subtype:`command`,text:`${n[1].trim()}${t?` `+t:``}`}}return null}function Tl(e,t,n){let r=t.message??{},i=lu(t),a=cu(t),o=uu(t),s=t.isSynthetic===!0,c=e,l=[],u=[],d=!1;if(typeof r.content==`string`)l.push(r.content);else for(let e of pu(r.content))if(e.type===`text`)l.push(e.text??``);else if(e.type===`tool_result`){d=!0;let r=e;c=kl(c,r.tool_use_id,{content:r.content??``,isError:r.is_error===!0,structured:t.tool_use_result??null},n.receivedAt)}else(e.type===`image`||e.type===`document`)&&u.push(e);let f=se(l.join(`
75
75
  `)).trim();if(ue(f)&&Zl(c,f))return c;let p=wl(f);if(p?.subtype===`caveat`)return c;if(p){let e={kind:`system`,id:`sys:${c.nextId}`,uuid:a,parentToolUseId:i,turnId:c.activeTurnId,timestamp:o,subtype:p.subtype,text:p.text};return tu({...c,nextId:c.nextId+1},e)}if(f.length===0&&u.length===0||d&&f.length===0||s&&d)return c;if(i===null&&!s&&c.hasOptimisticUser){let e=c.items.findIndex(e=>e.kind===`user`&&e.optimistic&&!e.failed&&e.text===f);if(e<0&&(c={...c,hasOptimisticUser:!1}),e>=0){let t=c.items[e],r={...t,uuid:a??t.uuid,timestamp:o??t.timestamp,optimistic:!1,turnId:t.turnId??n.turnId};return t.waiting&&e<c.items.length-1?tu(ru(c,new Set([t.id])),{...r,waiting:!1}):nu(c,e,r)}}let m=t.isMeta===!0||ie(f),h=t.isCompactSummary===!0||te(f)||ue(f),g={kind:`user`,id:a?`u:${a}`:`i${c.nextId}`,uuid:a,parentToolUseId:i,turnId:n.turnId,timestamp:o,text:f,attachments:u,requestId:null,optimistic:!1,failed:!1,waiting:!s&&!m&&!h&&i===null&&n.turnId!==null&&El(c,n.turnId),deliveredAt:null,compactSummary:t.isCompactSummary===!0||te(f),taskNotification:ue(f),engineNote:!te(f)&&!ue(f)&&m};return c.index.get(g.id)===void 0?tu(a?c:ou(c),g):c}function El(e,t){if(e.status!==`running`)return!1;for(let n=e.items.length-1;n>=0;n--){let r=e.items[n];if((t===null||r.turnId===null||r.turnId===t)&&(r.kind===`assistant`||r.kind===`thinking`||r.kind===`tool`))return!0}return!1}function Dl(e){let t=-1;for(let n=e.items.length-1;n>=0;n--){let r=e.items[n];if(r.kind===`user`&&r.waiting){t=n;break}}if(t<0)return e;let n=e.items.map(e=>e.kind===`user`&&e.waiting?{...e,waiting:!1}:e);return{...e,items:n}}function Ol(e,t,n){for(let r=e.items.length-1;r>=0;r--){let i=e.items[r];if(i.kind!==`user`||i.failed||i.text!==t)continue;if(!i.optimistic&&!i.waiting&&i.deliveredAt!==null)return e;let a={...i,optimistic:!1,waiting:!1,deliveredAt:n??i.deliveredAt??new Date().toISOString()};return i.waiting&&r<e.items.length-1?tu(ru(e,new Set([i.id])),a):nu(e,r,a)}return e}function kl(e,t,n,r){let i=e.index.get(t);if(i===void 0)return tu(e,{kind:`tool`,id:t,uuid:null,parentToolUseId:null,turnId:null,timestamp:null,toolUseId:t,name:`unknown`,input:null,inputJson:``,status:n.isError?`error`:`done`,result:n,startedAt:null,finishedAt:r??null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:null});let a=e.items[i];if(a.result&&a.status!==`running`&&a.status!==`streaming`&&a.status!==`pending`)return e;let o=r??null,s=a.startedAt!==null&&o!==null?Math.max(0,o-a.startedAt):a.durationMs;return nu(e,i,{...a,input:a.input??hu(a.inputJson),result:Al(a.name,n)?{...n,isError:!1}:n,status:Al(a.name,n)?`skipped`:n.isError?`error`:`done`,finishedAt:o,durationMs:s})}function Al(e,t){return!t.isError||e!==`AskUserQuestion`?!1:typeof t.content==`string`&&t.content.includes(`the user skipped the question`)}function jl(e,t,n){let r=Mc(t.usage,t.modelUsage),i=Array.isArray(t.permission_denials)?t.permission_denials:[],a=n.turnId;return Nl(e,{kind:`result`,id:a?`result:${a}`:cu(t)?`result:${cu(t)}`:`result:${e.nextId}`,uuid:cu(t),parentToolUseId:null,turnId:a,timestamp:uu(t),subtype:typeof t.subtype==`string`?t.subtype:`success`,isError:t.is_error===!0||typeof t.result==`string`&&/^API Error\b/i.test(t.result.trim()),costUsd:fu(t.total_cost_usd),durationMs:fu(t.duration_ms),durationApiMs:typeof t.duration_api_ms==`number`?t.duration_api_ms:null,numTurns:fu(t.num_turns),inputTokens:r.input,cachedInputTokens:r.cached||e.turnCachedTokens,outputTokens:r.output,text:typeof t.result==`string`?t.result:null,errors:Array.isArray(t.errors)?t.errors.map(String):[],stopReason:typeof t.stop_reason==`string`?t.stop_reason:null,structuredOutput:t.structured_output??null},new Set(i.map(e=>e.tool_use_id??``)),n.receivedAt)}function Ml(e,t,n){e=Dl(e);let r=`result:${n}`,i=e.index.get(r),a={kind:`result`,id:r,uuid:i===void 0?null:e.items[i].uuid,parentToolUseId:null,turnId:n,timestamp:i===void 0?null:e.items[i].timestamp,subtype:t.subtype,isError:t.isError,costUsd:t.totalCostUsd,durationMs:t.durationMs,durationApiMs:i===void 0?null:e.items[i].durationApiMs,numTurns:t.numTurns,inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens??(i===void 0?void 0:e.items[i].cachedInputTokens)??e.turnCachedTokens,outputTokens:t.outputTokens,text:t.result,errors:t.errors??[],stopReason:t.stopReason,structuredOutput:t.structuredOutput??null};return Nl(e,a,new Set,void 0)}function Nl(e,t,n,r){let i=e,a=i.index.get(t.id),o=a!==void 0;i=a===void 0?tu(ou(i),t):nu(i,a,t);let s=i.items.map(e=>{if((e.kind===`assistant`||e.kind===`thinking`)&&e.streaming)return{...e,streaming:!1};if(e.kind===`tool`&&e.result===null&&(e.status===`streaming`||e.status===`running`||e.status===`pending`)){let t=n.has(e.toolUseId)?`denied`:`cancelled`;return{...e,status:t,input:e.input??hu(e.inputJson),finishedAt:r??null}}return e}),c=o?i.totals:{costUsd:i.totals.costUsd+t.costUsd,inputTokens:i.totals.inputTokens+t.inputTokens,cachedInputTokens:i.totals.cachedInputTokens+(t.cachedInputTokens??0),outputTokens:i.totals.outputTokens+t.outputTokens,turns:i.totals.turns+1};return{...i,items:s,totals:c,status:t.isError?`error`:`idle`,activeTurnId:null,statusText:null,streams:{},pendingPermissions:[]}}function Pl(e,t){let n=du(t.tool_use_id),r=typeof t.elapsed_time_seconds==`number`?t.elapsed_time_seconds:null;return!n||r===null?e:iu(e,n,e=>e.result?e:{...e,elapsedSec:r})}function Fl(e,t,n){let r=Array.isArray(t.output)?t.output.map(String).join(`
76
76
  `):``,i=typeof t.error==`string`?t.error:null,a=i?`Authentication error: ${i}`:t.isAuthenticating?`Authenticating…\n${r}`.trim():r;if(!a)return e;let o={kind:`system`,id:`sys:${e.nextId}`,uuid:cu(t),parentToolUseId:null,turnId:n.turnId,timestamp:uu(t),subtype:`auth_status`,text:a};return tu(ou(e),o)}function Il(e,t,n,r=!1){let i=`perm:${t.requestId}`;if(e.index.get(i)!==void 0)return e;let a=e.index.get(t.toolUseId),o=a===void 0?void 0:e.items[a],s=tu(e,{kind:`permission`,id:i,uuid:null,parentToolUseId:o?.kind===`tool`?o.parentToolUseId:null,turnId:n,timestamp:t.createdAt,request:t,status:`pending`,resolvedBy:null});return s=iu(s,t.toolUseId,e=>({...e,permissionRequestId:t.requestId,status:e.result?e.status:`pending`})),r?{...s,activeTurnId:s.activeTurnId??n}:{...s,pendingPermissions:[...s.pendingPermissions.filter(e=>e.requestId!==t.requestId),t],status:`waiting_permission`,activeTurnId:s.activeTurnId??n}}function Ll(e,t,n,r){let i=`perm:${t}`,a=e.index.get(i),o=e,s=null;if(a!==void 0){let e=o.items[a];s=e.request.toolUseId,e.status===`pending`&&(o=nu(o,a,{...e,status:n===`allow`?`allowed`:`denied`,resolvedBy:r}))}let c=o.pendingPermissions.filter(e=>e.requestId!==t);s&&(o=iu(o,s,e=>e.result?e:{...e,status:n===`allow`?`running`:`denied`}));let l=c.length>0?`waiting_permission`:o.activeTurnId||o.status===`waiting_permission`?`running`:o.status;return{...o,pendingPermissions:c,status:l}}function Rl(e,t,n){return $l(e,e=>zl(e,t,n))}function zl(e,t,n){let r=e;for(let e of t){let t=e.parentToolUseId;if(e.subpath&&(r=sl(r,e.subpath,e.role,e.content,e.timestamp)),e.subpath&&(t===null||r.index.get(t)===void 0)){let n=V(r,e.subpath);r=n.state,t=n.parentToolUseId}let n={type:e.role===`assistant`?`assistant`:e.role===`user`?`user`:`system`,uuid:e.uuid,parent_tool_use_id:t,timestamp:e.timestamp??void 0};if(e.role===`system`){let t=typeof e.content==`string`?e.content:mu(pu(e.content));if(!t||r.seen.has(`uuid:${e.uuid}`))continue;let n={kind:`system`,id:`sys:${e.uuid}`,uuid:e.uuid,parentToolUseId:e.parentToolUseId,turnId:null,timestamp:e.timestamp,subtype:e.subtype===`rewind_boundary`?`rewind`:`history`,text:t};r.index.get(n.id)===void 0&&(r=au(tu(r,n),`uuid:${e.uuid}`));continue}let i=e.role===`assistant`?{id:null,role:`assistant`,model:e.model,content:pu(e.content)}:{role:`user`,content:typeof e.content==`string`?e.content:pu(e.content)};r=hl(r,{...n,message:i},{turnId:null,receivedAt:void 0})}return r={...r,hydrated:!0},r=n?H(r,n):Kl(r),fl(r)}function Bl(e,t){return $l(e,e=>Vl(e,t))}function Vl(e,t){let n=e;for(let e of t){let t=`seq:${e.seq}`;if(n.seen.has(t))continue;let r=e.entry,i=e.type||String(r.type??``);if(i===`attachment`){let t=ce(r);if(t!==null){let i={type:`user`,uuid:e.uuid??(typeof r.uuid==`string`?r.uuid:void 0),parent_tool_use_id:null,timestamp:e.timestamp??void 0,message:{role:`user`,content:t}};n=hl(n,i,{turnId:null,receivedAt:void 0})}}if(i===`queue-operation`){let e=F(r);e&&(n=Ol(n,e.text,e.deliveredAt))}if(i===`user`||i===`assistant`||i===`system`||i===`result`){let t=r.parent_tool_use_id??null;if(e.subpath){let t=r.message;n=sl(n,e.subpath,i,t?.content,e.timestamp,t?.stop_reason)}if(e.subpath&&(t===null||n.index.get(t)===void 0)){let r=V(n,e.subpath);n=r.state,t=r.parentToolUseId}let a={...r,type:i,uuid:e.uuid??(typeof r.uuid==`string`?r.uuid:void 0),parent_tool_use_id:t,timestamp:e.timestamp??void 0};n=hl(n,a,{turnId:null,receivedAt:void 0})}n=au(n,t),(n.lastSeq===null||e.seq>n.lastSeq)&&(n={...n,lastSeq:e.seq})}return fl(Kl({...n,hydrated:!0}))}var Hl=/^subagents\/(?:workflows\/([^/]+)\/)?agent-(.+?)(?:\.jsonl)?$/;function Ul(e){return`subagent:${e}`}function Wl(e){return`subagent:workflows/${e}`}function Gl(e,t,n,r){return{kind:`tool`,id:e,uuid:null,parentToolUseId:r,turnId:null,timestamp:null,toolUseId:e,name:t,input:{description:n},inputJson:``,status:`done`,result:null,startedAt:null,finishedAt:null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:null}}function V(e,t){if(!t)return{state:e,parentToolUseId:null};let n=e.subpathParents[t];if(n!==void 0&&e.index.get(n)!==void 0)return{state:e,parentToolUseId:n};let r=Hl.exec(t);if(!r)return{state:e,parentToolUseId:null};let i=r[1]??null,a=r[2],o=(e,n)=>({state:Ql?(e.subpathParents[t]=n,e):{...e,subpathParents:{...e.subpathParents,[t]:n}},parentToolUseId:n}),s=e.index.get(a);if(s!==void 0){let t=e.items[s];if(t?.kind===`tool`)return o(e,t.toolUseId)}if(i){for(let t of e.items)if(t.kind===`tool`&&t.name===`Workflow`&&t.result!==null&&gu(t.result).includes(i))return o(e,t.toolUseId)}let c=Ul(t);if(e.index.get(c)!==void 0)return o(e,c);let l=a.slice(0,8),u=e,d=null;i&&(d=Wl(i),u.index.get(d)===void 0&&(u=tu(u,Gl(d,`Workflow`,`Workflow run ${i} (transcript)`,null))));let f=Gl(c,`Agent`,i?`Agent ${l}`:`Agent ${l} (transcript)`,d);return o(tu(u,f),c)}function H(e,t){let n=e.pendingPermissions.length>0?`waiting_permission`:t.status,r=t.engineSince?Date.parse(t.engineSince):NaN,i=e.hydrated&&e.session!==null&&!ul(e.status)&&ul(n),a=fl(Kl({...e,session:t,sessionId:t.id,status:n,engineSince:Number.isFinite(r)?r:e.engineSince,...i?{lastFrameAt:null}:{}}));if(!i)return a;let o=Date.parse(t.updatedAt);return Number.isFinite(o)&&o>(a.lastFrameAt??0)?{...a,lastFrameAt:o}:a}function Kl(e){if(e.activeTurnId!==null||e.status!==`idle`&&e.status!==`error`)return e;let t=!1,n=e.items.map(e=>(e.kind===`assistant`||e.kind===`thinking`)&&e.streaming?(t=!0,{...e,streaming:!1}):e.kind===`tool`&&e.result===null&&(e.status===`streaming`||e.status===`running`||e.status===`pending`)?(t=!0,{...e,status:`cancelled`,input:e.input??hu(e.inputJson)}):e);return t?{...e,items:n}:e}function ql(e,t){let n=(t.attachments??[]).filter(e=>typeof e==`object`&&!!e&&typeof e.type==`string`),r={kind:`user`,id:`req:${t.requestId}`,uuid:null,parentToolUseId:null,turnId:null,timestamp:t.at??null,text:t.text,attachments:n,requestId:t.requestId,optimistic:!0,failed:!1,waiting:e.status===`running`,deliveredAt:null,compactSummary:!1,taskNotification:!1,engineNote:!1};if(e.index.get(r.id)!==void 0)return e;let i=new Set(e.items.filter(e=>e.kind===`user`&&e.failed&&e.text===t.text).map(e=>e.id)),a=!ul(e.status),o=t.at===void 0?NaN:Date.parse(t.at);return{...tu(ru(e,i),r),status:`running`,statusText:null,hasOptimisticUser:!0,lastLocalPromptId:r.id,...a?{lastFrameAt:Number.isFinite(o)?o:null}:{}}}function Jl(e,t){let n=e.index.get(`req:${t}`),r=e;if(n!==void 0){let t=e.items[n];t?.kind===`user`&&!t.failed&&(r=nu(e,n,{...t,failed:!0}))}return r.activeTurnId!==null||r.status!==`running`&&r.status!==`waiting_permission`?r:{...r,status:`error`,statusText:null}}function Yl(e,t){let n=new Map,r=new Map;for(let t of e){let e={item:t,children:[]};n.set(t.id,e),t.kind===`tool`&&r.set(t.toolUseId,e)}let i=[];for(let t of e){let e=n.get(t.id),a=t.parentToolUseId?r.get(t.parentToolUseId):void 0;a&&a!==e?a.children.push(e):i.push(e)}if(!t||t.length===0)return i;let a=new Map,o=e=>{for(let t of e)a.set(t.item.id,t),t.children.length>0&&o(t.children)};o(t);let s=new Map;for(let t=e.length-1;t>=0;t--){let r=n.get(e[t].id);for(let e=0;e<r.children.length;e++){let t=s.get(r.children[e]);t&&(r.children[e]=t)}let i=a.get(r.item.id);s.set(r,i&&Xl(i,r)?i:r)}let c=i.map(e=>s.get(e)??e);return c.length===t.length&&c.every((e,n)=>e===t[n])?t:c}function Xl(e,t){if(e.item!==t.item||e.children.length!==t.children.length)return!1;for(let n=0;n<t.children.length;n++)if(e.children[n]!==t.children[n])return!1;return!0}function Zl(e,t){let n=pe(t);if(!n.taskId)return!1;for(let t=e.items.length-1;t>=0;t--){let r=e.items[t];if(r.kind!==`user`||!r.taskNotification)continue;let i=pe(r.text);if(i.taskId===n.taskId&&(i.toolUseId??null)===(n.toolUseId??null))return!0}return!1}var Ql=!1;function $l(e,t){if(Ql)return t(e);Ql=!0;try{return t({...e,items:e.items.slice(),index:new Map(e.index),seen:new Set(e.seen),subpathParents:{...e.subpathParents}})}finally{Ql=!1}}var eu=new Set([`Task`,`Agent`,`Workflow`]);function tu(e,t){let n=e.hasSubagentItems||t.kind===`tool`&&eu.has(t.name);if(Ql)return e.items.push(t),e.index.set(t.id,e.items.length-1),e.hasSubagentItems=n,e;let r=[...e.items,t];return{...e,items:r,index:new Map(e.index).set(t.id,r.length-1),...n===e.hasSubagentItems?{}:{hasSubagentItems:n}}}function nu(e,t,n){if(Ql)return e.items[t]=n,e;let r=e.items.slice();return r[t]=n,{...e,items:r}}function ru(e,t){if(t.size===0)return e;let n=e.items.filter(e=>!t.has(e.id)),r=new Map;n.forEach((e,t)=>{r.set(e.id,t)});let i={};for(let[n,r]of Object.entries(e.streams)){let e={};for(let[n,i]of Object.entries(r.blocks))t.has(i)||(e[Number(n)]=i);i[n]={...r,blocks:e,unclaimed:r.unclaimed.filter(e=>!t.has(e))}}return{...e,items:n,index:r,streams:i}}function iu(e,t,n){let r=e.index.get(t);if(r===void 0)return e;let i=e.items[r];if(!i||i.kind!==`tool`)return e;let a=n(i);return a===i?e:nu(e,r,a)}function au(e,t){return e.seen.has(t)?e:Ql?(e.seen.add(t),e):{...e,seen:new Set(e.seen).add(t)}}function ou(e){return{...e,nextId:e.nextId+1}}function su(e,t,n){let r=cu(n);return r?`${t}:${r}`:`${t}:${e.nextId}`}function cu(e){return typeof e.uuid==`string`&&e.uuid?e.uuid:null}function lu(e){return typeof e.parent_tool_use_id==`string`&&e.parent_tool_use_id?e.parent_tool_use_id:null}function uu(e){return typeof e.timestamp==`string`?e.timestamp:null}function du(e){return typeof e==`string`?e:``}function fu(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function pu(e){return typeof e==`string`?e?[{type:`text`,text:e}]:[]:Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.type==`string`):[]}function mu(e){return e.map(e=>e.type===`text`?e.text??``:``).filter(Boolean).join(`
77
77
  `)}function hu(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);return typeof e==`object`&&e&&!Array.isArray(e)?e:null}catch{return null}}function gu(e){return e?typeof e.content==`string`?e.content:e.content.map(e=>e.type===`text`?e.text??``:e.type===`image`?`[image]`:`[${e.type}]`).join(`
package/web-ui/index.html CHANGED
@@ -104,7 +104,7 @@
104
104
  }
105
105
  }
106
106
  </style>
107
- <script type="module" crossorigin src="./assets/index-D_CZQTyy.js"></script>
107
+ <script type="module" crossorigin src="./assets/index-CeISFTaU.js"></script>
108
108
  <link rel="stylesheet" crossorigin href="./assets/index-DsdziiwW.css">
109
109
  </head>
110
110
  <body>