@codexhost/cli-darwin-arm64 0.18.0-beta.3 → 0.18.0-beta.4
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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +9 -4
- package/app/console-web.js +9 -4
- package/app/desktop-controller.mjs +9 -4
- package/app/host-runtime.mjs +4751 -2746
- package/app/plugins/antigravity/plugin.mjs +9 -4
- package/app/plugins/claude-code/plugin.mjs +129 -58
- package/app/plugins/codebuddy/plugin.mjs +9 -4
- package/app/plugins/codex-usage/plugin.mjs +9 -4
- package/app/plugins/copilot/plugin.mjs +9 -4
- package/app/plugins/cursor-cli/plugin.mjs +9 -4
- package/app/plugins/deepseek-harness/plugin.mjs +9 -4
- package/app/plugins/devin/plugin.mjs +9 -4
- package/app/plugins/grok/plugin.mjs +9 -4
- package/app/plugins/hermes/plugin.mjs +9 -4
- package/app/plugins/kimi-code/plugin.mjs +9 -4
- package/app/plugins/kiro-cli/plugin.mjs +9 -4
- package/app/plugins/omp/plugin.mjs +9 -4
- package/app/plugins/opencode/plugin.mjs +9 -4
- package/app/plugins/pi/plugin.mjs +9 -4
- package/app/plugins/qoder/plugin.mjs +9 -4
- package/app/plugins/qoder-cn/plugin.mjs +9 -4
- package/app/plugins/qwen-code/plugin.mjs +9 -4
- package/app/plugins/workbuddy/plugin.mjs +9 -4
- package/app/plugins/zcode/plugin.mjs +9 -4
- package/app/renderer-extension.js +9 -4
- package/app/web/assets/{index-aKvkfNJN.js → index-D1dOzBMI.js} +2 -2
- package/app/web/codexhost-settings.js +9 -4
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +63 -63
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +8 -12
- package/app/web/plugins.json +4 -0
- package/app/web-modules/server.mjs +374 -154
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -119,7 +119,7 @@ function ui(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...w(n)})}//
|
|
|
119
119
|
function di(e,t){let n=/* @__PURE__ */ fi(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ee(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(Ee(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
|
|
120
120
|
function fi(e,t){let n=new T({check:`custom`,...w(t)});return n._zod.check=e,n}function pi(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??cr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function O(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,O(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`&&k(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 mi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=/* @__PURE__ */ 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>
|
|
121
121
|
|
|
122
|
-
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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}}function hi(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:_i(t,`input`,e.processors),output:_i(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function k(e,t){let n=t??{seen:/* @__PURE__ */ 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 k(r.element,n);if(r.type===`set`)return k(r.valueType,n);if(r.type===`lazy`)return k(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 k(r.innerType,n);if(r.type===`intersection`)return k(r.left,n)||k(r.right,n);if(r.type===`record`||r.type===`map`)return k(r.keyType,n)||k(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:k(r.in,n)||k(r.out,n);if(r.type===`object`){for(let e in r.shape)if(k(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(k(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(k(e,n))return!0;return!!(r.rest&&k(r.rest,n))}return!1}let gi=(e,t={})=>n=>{let r=pi({...n,processors:t});return O(e,r),mi(r,e),hi(r,e)},_i=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=pi({...i??{},target:a,io:t,processors:n});return O(e,o),mi(o,e),hi(o,e)},vi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},yi=(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=vi[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}))])}},bi=(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)},xi=(e,t,n,r)=>{n.type=`boolean`},Si=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ci=(e,t,n,r)=>{n.not={}},wi=(e,t,n,r)=>{let i=e._zod.def,a=h(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ti=(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}},Ei=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Oi=(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=O(a.element,t,{...r,path:[...r.path,`items`]})},ki=(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]=O(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=O(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ai=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>O(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ji=(e,t,n,r)=>{let i=e._zod.def,a=O(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=O(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]]},Mi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>O(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?O(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Ni=(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=O(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=O(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=O(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)}},Pi=(e,t,n,r)=>{let i=e._zod.def,a=O(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`}]},Fi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ii=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Li=(e,t,n,r)=>{let i=e._zod.def;O(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)))},Ri=(e,t,n,r)=>{let i=e._zod.def;O(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},zi=(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;O(o,t,r);let s=t.seen.get(e);s.ref=o},Bi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Vi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Hi=(e,t,n,r)=>{let i=e._zod.innerType;O(i,t,r);let a=t.seen.get(e);a.ref=i},Ui=/*@__PURE__*/ u(`ZodISODateTime`,(e,t)=>{$t.init(e,t),M.init(e,t)});function Wi(e){return/* @__PURE__ */ Mr(Ui,e)}let Gi=/*@__PURE__*/ u(`ZodISODate`,(e,t)=>{en.init(e,t),M.init(e,t)});function Ki(e){return/* @__PURE__ */ Nr(Gi,e)}let qi=/*@__PURE__*/ u(`ZodISOTime`,(e,t)=>{tn.init(e,t),M.init(e,t)});function Ji(e){return/* @__PURE__ */ Pr(qi,e)}let Yi=/*@__PURE__*/ u(`ZodISODuration`,(e,t)=>{nn.init(e,t),M.init(e,t)});function Xi(e){return/* @__PURE__ */ Fr(Yi,e)}let Zi=/*@__PURE__*/ u(`ZodError`,(e,t)=>{Oe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>je(e,t)},flatten:{value:t=>Ae(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,g,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,g,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Qi=/* @__PURE__ */ Me(Zi),$i=/* @__PURE__ */ Ne(Zi),ea=/* @__PURE__ */ Pe(Zi),ta=/* @__PURE__ */ Ie(Zi),na=/* @__PURE__ */ Re(Zi),ra=/* @__PURE__ */ ze(Zi),ia=/* @__PURE__ */ Be(Zi),aa=/* @__PURE__ */ Ve(Zi),oa=/* @__PURE__ */ He(Zi),sa=/* @__PURE__ */ Ue(Zi),ca=/* @__PURE__ */ We(Zi),la=/* @__PURE__ */ Ge(Zi),ua=/* @__PURE__ */ new WeakMap;function da(e,t,n){let r=Object.getPrototypeOf(e),i=ua.get(r);if(i||(i=/* @__PURE__ */ new Set,ua.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})}})}}}let A=/*@__PURE__*/ u(`ZodType`,(e,t)=>(E.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:_i(e,`input`),output:_i(e,`output`)}}),e.toJSONSchema=gi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Qi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ea(e,t,n),e.parseAsync=async(t,n)=>$i(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ta(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>na(e,t,n),e.decode=(t,n)=>ra(e,t,n),e.encodeAsync=async(t,n)=>ia(e,t,n),e.decodeAsync=async(t,n)=>aa(e,t,n),e.safeEncode=(t,n)=>oa(e,t,n),e.safeDecode=(t,n)=>sa(e,t,n),e.safeEncodeAsync=async(t,n)=>ca(e,t,n),e.safeDecodeAsync=async(t,n)=>la(e,t,n),da(e,`ZodType`,{check(...e){let t=this.def;return this.clone(C(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 ue(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Oo(e,t))},superRefine(e,t){return this.check(ko(e,t))},overwrite(e){return this.check(/* @__PURE__ */ ni(e))},optional(){return oo(this)},exactOptional(){return co(this)},nullable(){return uo(this)},nullish(){return oo(uo(this))},nonoptional(e){return _o(this,e)},array(){return F(this)},or(e){return qa([this,e])},and(e){return Xa(this,e)},transform(e){return xo(this,io(e))},default(e){return po(this,e)},prefault(e){return ho(this,e)},catch(e){return yo(this,e)},pipe(e){return xo(this,e)},readonly(){return Co(this)},describe(e){let t=this.clone();return cr.add(t,{description:e}),t},meta(...e){if(e.length===0)return cr.get(this);let t=this.clone();return cr.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 cr.get(e)?.description},configurable:!0}),e)),fa=/*@__PURE__*/ u(`_ZodString`,(e,t)=>{Vt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,da(e,`_ZodString`,{regex(...e){return this.check(/* @__PURE__ */ Xr(...e))},includes(...e){return this.check(/* @__PURE__ */ $r(...e))},startsWith(...e){return this.check(/* @__PURE__ */ ei(...e))},endsWith(...e){return this.check(/* @__PURE__ */ ti(...e))},min(...e){return this.check(/* @__PURE__ */ Jr(...e))},max(...e){return this.check(/* @__PURE__ */ qr(...e))},length(...e){return this.check(/* @__PURE__ */ Yr(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Jr(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Zr(e))},uppercase(e){return this.check(/* @__PURE__ */ Qr(e))},trim(){return this.check(/* @__PURE__ */ ii())},normalize(...e){return this.check(/* @__PURE__ */ ri(...e))},toLowerCase(){return this.check(/* @__PURE__ */ ai())},toUpperCase(){return this.check(/* @__PURE__ */ oi())},slugify(){return this.check(/* @__PURE__ */ si())}})}),pa=/*@__PURE__*/ u(`ZodString`,(e,t)=>{Vt.init(e,t),fa.init(e,t),e.email=t=>e.check(/* @__PURE__ */ ur(ma,t)),e.url=t=>e.check(/* @__PURE__ */ gr(_a,t)),e.jwt=t=>e.check(/* @__PURE__ */ jr(Na,t)),e.emoji=t=>e.check(/* @__PURE__ */ _r(ya,t)),e.guid=t=>e.check(/* @__PURE__ */ dr(ha,t)),e.uuid=t=>e.check(/* @__PURE__ */ fr(ga,t)),e.uuidv4=t=>e.check(/* @__PURE__ */ pr(ga,t)),e.uuidv6=t=>e.check(/* @__PURE__ */ mr(ga,t)),e.uuidv7=t=>e.check(/* @__PURE__ */ hr(ga,t)),e.nanoid=t=>e.check(/* @__PURE__ */ vr(ba,t)),e.guid=t=>e.check(/* @__PURE__ */ dr(ha,t)),e.cuid=t=>e.check(/* @__PURE__ */ yr(xa,t)),e.cuid2=t=>e.check(/* @__PURE__ */ br(Sa,t)),e.ulid=t=>e.check(/* @__PURE__ */ xr(Ca,t)),e.base64=t=>e.check(/* @__PURE__ */ Or(Aa,t)),e.base64url=t=>e.check(/* @__PURE__ */ kr(ja,t)),e.xid=t=>e.check(/* @__PURE__ */ Sr(wa,t)),e.ksuid=t=>e.check(/* @__PURE__ */ Cr(Ta,t)),e.ipv4=t=>e.check(/* @__PURE__ */ wr(Ea,t)),e.ipv6=t=>e.check(/* @__PURE__ */ Tr(Da,t)),e.cidrv4=t=>e.check(/* @__PURE__ */ Er(Oa,t)),e.cidrv6=t=>e.check(/* @__PURE__ */ Dr(ka,t)),e.e164=t=>e.check(/* @__PURE__ */ Ar(Ma,t)),e.datetime=t=>e.check(Wi(t)),e.date=t=>e.check(Ki(t)),e.time=t=>e.check(Ji(t)),e.duration=t=>e.check(Xi(t))});function j(e){return/* @__PURE__ */ lr(pa,e)}let M=/*@__PURE__*/ u(`ZodStringFormat`,(e,t)=>{D.init(e,t),fa.init(e,t)}),ma=/*@__PURE__*/ u(`ZodEmail`,(e,t)=>{Wt.init(e,t),M.init(e,t)}),ha=/*@__PURE__*/ u(`ZodGUID`,(e,t)=>{Ht.init(e,t),M.init(e,t)}),ga=/*@__PURE__*/ u(`ZodUUID`,(e,t)=>{Ut.init(e,t),M.init(e,t)}),_a=/*@__PURE__*/ u(`ZodURL`,(e,t)=>{Gt.init(e,t),M.init(e,t)});function va(e){return/* @__PURE__ */ gr(_a,e)}let ya=/*@__PURE__*/ u(`ZodEmoji`,(e,t)=>{Kt.init(e,t),M.init(e,t)}),ba=/*@__PURE__*/ u(`ZodNanoID`,(e,t)=>{qt.init(e,t),M.init(e,t)}),xa=/*@__PURE__*/ u(`ZodCUID`,(e,t)=>{Jt.init(e,t),M.init(e,t)}),Sa=/*@__PURE__*/ u(`ZodCUID2`,(e,t)=>{Yt.init(e,t),M.init(e,t)}),Ca=/*@__PURE__*/ u(`ZodULID`,(e,t)=>{Xt.init(e,t),M.init(e,t)}),wa=/*@__PURE__*/ u(`ZodXID`,(e,t)=>{Zt.init(e,t),M.init(e,t)}),Ta=/*@__PURE__*/ u(`ZodKSUID`,(e,t)=>{Qt.init(e,t),M.init(e,t)}),Ea=/*@__PURE__*/ u(`ZodIPv4`,(e,t)=>{rn.init(e,t),M.init(e,t)}),Da=/*@__PURE__*/ u(`ZodIPv6`,(e,t)=>{an.init(e,t),M.init(e,t)}),Oa=/*@__PURE__*/ u(`ZodCIDRv4`,(e,t)=>{on.init(e,t),M.init(e,t)}),ka=/*@__PURE__*/ u(`ZodCIDRv6`,(e,t)=>{sn.init(e,t),M.init(e,t)}),Aa=/*@__PURE__*/ u(`ZodBase64`,(e,t)=>{ln.init(e,t),M.init(e,t)}),ja=/*@__PURE__*/ u(`ZodBase64URL`,(e,t)=>{dn.init(e,t),M.init(e,t)}),Ma=/*@__PURE__*/ u(`ZodE164`,(e,t)=>{fn.init(e,t),M.init(e,t)}),Na=/*@__PURE__*/ u(`ZodJWT`,(e,t)=>{mn.init(e,t),M.init(e,t)}),Pa=/*@__PURE__*/ u(`ZodNumber`,(e,t)=>{hn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),da(e,`ZodNumber`,{gt(e,t){return this.check(/* @__PURE__ */ Wr(e,t))},gte(e,t){return this.check(/* @__PURE__ */ Gr(e,t))},min(e,t){return this.check(/* @__PURE__ */ Gr(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Hr(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Ur(e,t))},max(e,t){return this.check(/* @__PURE__ */ Ur(e,t))},int(e){return this.check(Ia(e))},safe(e){return this.check(Ia(e))},positive(e){return this.check(/* @__PURE__ */ Wr(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ Gr(0,e))},negative(e){return this.check(/* @__PURE__ */ Hr(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Ur(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ Kr(e,t))},step(e,t){return this.check(/* @__PURE__ */ Kr(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 N(e){return/* @__PURE__ */ Ir(Pa,e)}let Fa=/*@__PURE__*/ u(`ZodNumberFormat`,(e,t)=>{gn.init(e,t),Pa.init(e,t)});function Ia(e){return/* @__PURE__ */ Lr(Fa,e)}let La=/*@__PURE__*/ u(`ZodBoolean`,(e,t)=>{_n.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r)});function P(e){return/* @__PURE__ */ Rr(La,e)}let Ra=/*@__PURE__*/ u(`ZodNull`,(e,t)=>{vn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r)});function za(e){return/* @__PURE__ */ zr(Ra,e)}let Ba=/*@__PURE__*/ u(`ZodUnknown`,(e,t)=>{yn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Va(){return/* @__PURE__ */ Br(Ba)}let Ha=/*@__PURE__*/ u(`ZodNever`,(e,t)=>{bn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r)});function Ua(e){return/* @__PURE__ */ Vr(Ha,e)}let Wa=/*@__PURE__*/ u(`ZodArray`,(e,t)=>{Sn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.element=t.element,da(e,`ZodArray`,{min(e,t){return this.check(/* @__PURE__ */ Jr(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Jr(1,e))},max(e,t){return this.check(/* @__PURE__ */ qr(e,t))},length(e,t){return this.check(/* @__PURE__ */ Yr(e,t))},unwrap(){return this.element}})});function F(e,t){return/* @__PURE__ */ ci(Wa,e,t)}let Ga=/*@__PURE__*/ u(`ZodObject`,(e,t)=>{Dn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),x(e,`shape`,()=>t.shape),da(e,`ZodObject`,{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Va()})},loose(){return this.clone({...this._zod.def,catchall:Va()})},strict(){return this.clone({...this._zod.def,catchall:Ua()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return he(this,e)},safeExtend(e){return ge(this,e)},merge(e){return _e(this,e)},pick(e){return pe(this,e)},omit(e){return me(this,e)},partial(...e){return ve(ao,this,e[0])},required(...e){return ye(go,this,e[0])}})});function I(e,t){let n={type:`object`,shape:e??{},...w(t)};return new Ga(n)}function L(e,t){return new Ga({type:`object`,shape:e,catchall:Ua(),...w(t)})}let Ka=/*@__PURE__*/ u(`ZodUnion`,(e,t)=>{kn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.options=t.options});function qa(e,t){return new Ka({type:`union`,options:e,...w(t)})}let Ja=/*@__PURE__*/ u(`ZodDiscriminatedUnion`,(e,t)=>{Ka.init(e,t),An.init(e,t)});function R(e,t,n){return new Ja({type:`union`,options:t,discriminator:e,...w(n)})}let Ya=/*@__PURE__*/ u(`ZodIntersection`,(e,t)=>{jn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r)});function Xa(e,t){return new Ya({type:`intersection`,left:e,right:t})}let Za=/*@__PURE__*/ u(`ZodTuple`,(e,t)=>{Pn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Qa(e,t,n){let r=t instanceof E;return new Za({type:`tuple`,items:e,rest:r?t:null,...w(r?n:t)})}let $a=/*@__PURE__*/ u(`ZodRecord`,(e,t)=>{Rn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function eo(e,t,n){return!t||!t._zod?new $a({type:`record`,keyType:j(),valueType:e,...w(t)}):new $a({type:`record`,keyType:e,valueType:t,...w(n)})}let to=/*@__PURE__*/ u(`ZodEnum`,(e,t)=>{zn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(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 to({...t,checks:[],...w(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 to({...t,checks:[],...w(r),entries:i})}});function z(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new to({type:`enum`,entries:n,...w(t)})}let no=/*@__PURE__*/ u(`ZodLiteral`,(e,t)=>{Bn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(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 B(e,t){return new no({type:`literal`,values:Array.isArray(e)?e:[e],...w(t)})}let ro=/*@__PURE__*/ u(`ZodTransform`,(e,t)=>{Vn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new f(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ee(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(Ee(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 io(e){return new ro({type:`transform`,transform:e})}let ao=/*@__PURE__*/ u(`ZodOptional`,(e,t)=>{Un.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oo(e){return new ao({type:`optional`,innerType:e})}let so=/*@__PURE__*/ u(`ZodExactOptional`,(e,t)=>{Wn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function co(e){return new so({type:`optional`,innerType:e})}let lo=/*@__PURE__*/ u(`ZodNullable`,(e,t)=>{Gn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uo(e){return new lo({type:`nullable`,innerType:e})}let fo=/*@__PURE__*/ u(`ZodDefault`,(e,t)=>{Kn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function po(e,t){return new fo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}let mo=/*@__PURE__*/ u(`ZodPrefault`,(e,t)=>{Jn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ho(e,t){return new mo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}let go=/*@__PURE__*/ u(`ZodNonOptional`,(e,t)=>{Yn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _o(e,t){return new go({type:`nonoptional`,innerType:e,...w(t)})}let vo=/*@__PURE__*/ u(`ZodCatch`,(e,t)=>{Zn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yo(e,t){return new vo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let bo=/*@__PURE__*/ u(`ZodPipe`,(e,t)=>{Qn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e.in=t.in,e.out=t.out});function xo(e,t){return new bo({type:`pipe`,in:e,out:t})}let So=/*@__PURE__*/ u(`ZodReadonly`,(e,t)=>{er.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Co(e){return new So({type:`readonly`,innerType:e})}let wo=/*@__PURE__*/ u(`ZodLazy`,(e,t)=>{nr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function To(e){return new wo({type:`lazy`,getter:e})}let Eo=/*@__PURE__*/ u(`ZodCustom`,(e,t)=>{rr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r)});function Do(e,t){return/* @__PURE__ */ li(Eo,e??(()=>!0),t)}function Oo(e,t={}){return/* @__PURE__ */ ui(Eo,e,t)}function ko(e,t){return/* @__PURE__ */ di(e,t)}function Ao(e){return(t,n)=>{for(let r of e)Object.hasOwn(t,r)&&t[r]===void 0&&n.addIssue({code:`custom`,path:[r],message:`Explicit undefined is not valid JSON`})}}let jo=qa([j(),N(),P(),za()]);function Mo(e){let t=/* @__PURE__ */ new WeakSet,n=[{value:e,leaving:!1}];try{for(;n.length>0;){let e=n.pop();if(!e)break;if(e.leaving)t.delete(e.value);else if(typeof e.value==`object`&&e.value!==null){if(t.has(e.value))return!1;t.add(e.value),n.push({value:e.value,leaving:!0});for(let t of Object.values(e.value))n.push({value:t,leaving:!1})}}}catch{return!1}return!0}let No=Do(Mo,{message:`JSON value must not contain circular references`}),Po=To(()=>qa([jo,F(Po),eo(j(),Po)])),Fo=No.pipe(Po);No.pipe(F(Po));let Io=No.pipe(eo(j(),Po)),Lo=L({code:j().min(1),message:j().min(1),retryable:P(),diagnostic:j().min(1).optional(),stage:j().min(1).optional(),durationMs:N().int().nonnegative().optional(),stderrTail:j().min(1).optional()}).superRefine(Ao([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Ro=j().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),zo=e=>j().min(1).max(e).refine(e=>e.trim().length>0),Bo=eo(Ro,I({label:zo(256).optional(),description:zo(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Vo=eo(Ro,zo(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Ho=j().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),V=Ho.brand(),H=Ho.brand(),Uo=Ho.brand();Ho.brand(),Ho.brand();let Wo=j().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Go=Wo.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Ko=I({modes:F(I({id:Go,label:Wo.max(256),description:Wo.max(1024).optional(),dangerous:P().optional(),localizations:Bo.optional()}).strict()).min(1).max(32),defaultModeId:Go}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.modes.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Permission Mode IDs must be unique`,path:[`modes`,r,`id`]}),n.add(i.id);n.has(e.defaultModeId)||t.addIssue({code:`custom`,message:`Default Permission Mode must exist in the catalog`,path:[`defaultModeId`]})});I({threadId:H,permissionModeId:Go}).strict();let U=N().int().safe().nonnegative(),qo=N().finite().nonnegative(),Jo=N().finite().min(0).max(100),Yo=I({value:qo,turnId:j().min(1).max(1024),at:U}).strict();I({outputTokensPerSecond:Yo.optional(),timeToFirstOutputMs:Yo.extend({value:U}).optional()}).strict();let Xo=e=>Vo.refine(t=>Object.values(t).every(t=>t.length<=e)),Zo=I({composerIndicators:F(I({kind:B(`countdown`),id:j().min(1).max(64),expiresAtUnix:U,label:Xo(256).optional(),tooltip:Xo(1024).optional()}).strict()).max(2).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,{message:`Composer indicator IDs must be unique`}).optional(),inputTokens:U.optional(),cachedInputTokens:U.optional(),cacheWriteInputTokens:U.optional(),outputTokens:U.optional(),outputTokensPerSecond:qo.optional(),apiOutputTokensPerSecond:qo.optional(),reasoningOutputTokens:U.optional(),totalTokens:U.optional(),totalCostUsd:qo.optional(),totalCredits:qo.optional(),contextUsagePercent:qo.optional(),cacheHitRatePercent:Jo.optional(),contextWindowTokens:U.optional(),contextUsedTokens:U.optional(),planFiveHourUsedPercent:Jo.optional(),planFiveHourResetsAtUnix:U.optional(),planSevenDayUsedPercent:Jo.optional(),planSevenDayResetsAtUnix:U.optional(),sessionCacheHitRatePercent:Jo.optional(),timeToFirstOutputMs:U.optional(),costSource:z([`publicPrice`,`native`]).optional(),unpricedModels:F(j().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{Object.keys(e).length===0&&t.addIssue({code:`custom`,message:`Thread Usage must contain a reliable field`});let n=e.contextUsedTokens!==void 0;n!==(e.contextWindowTokens!==void 0)&&t.addIssue({code:`custom`,message:`Thread Usage context fields must be provided together`,path:[n?`contextWindowTokens`:`contextUsedTokens`]}),e.contextWindowTokens===0&&t.addIssue({code:`custom`,message:`Thread Usage contextWindowTokens must be greater than zero`,path:[`contextWindowTokens`]}),e.costSource!==void 0&&e.totalCostUsd===void 0&&t.addIssue({code:`custom`,message:`Thread Usage costSource must be provided with totalCostUsd`,path:[`costSource`]}),e.unpricedModels!==void 0&&e.costSource!==`publicPrice`&&t.addIssue({code:`custom`,message:`Thread Usage unpricedModels must be provided with a publicPrice cost`,path:[`unpricedModels`]}),e.planFiveHourResetsAtUnix!==void 0&&e.planFiveHourUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent`,path:[`planFiveHourResetsAtUnix`]}),e.planSevenDayResetsAtUnix!==void 0&&e.planSevenDayUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent`,path:[`planSevenDayResetsAtUnix`]})}),Qo=N().finite().min(0).max(100),$o=z([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),es=I({id:j().min(1).max(256),label:j().min(1).max(256),localizations:Bo.optional()}).strict(),ts=I({product:j().min(1),periodType:$o.optional(),scope:es.optional(),localizations:Bo.optional(),used:N().finite().nonnegative().optional(),limit:N().finite().nonnegative().optional(),unit:j().min(1).max(32).optional(),usagePercent:Qo,resetsAt:j().min(1).optional()}).strict(),ns=I({availableCount:N().int().safe().positive(),nextExpiresAt:j().min(1).optional(),expiresAt:F(j().min(1)).min(1).max(32).optional()}).strict(),rs=I({used:N().finite().nonnegative().optional(),limit:N().finite().nonnegative().optional(),unit:j().min(1).max(32).optional(),label:j().min(1).optional(),scope:es.optional(),localizations:Bo.optional(),usedPercent:Qo,resetsAt:j().min(1).optional(),periodType:$o,productUsage:F(ts).min(1).optional(),resetCredits:ns.optional()}).strict();I({threadId:H,refresh:B(`exact`).optional()}).strict(),I({threadId:H,usage:Zo.nullable(),accountCredits:rs.optional(),accountCreditsSupported:P().optional()}).strict();let is=j().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),as=I({id:is.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),os=is.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),ss=is.max(256),cs=I({id:os,label:is.max(256)}).strict(),ls=I({ref:as,label:is.max(256),resolvedModelLabel:ss.optional(),fastModel:as.optional(),supportedThinkingOptionIds:F(os).optional()}).strict(),us=F(cs).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Thinking option IDs must be unique`,path:[r,`id`]}),n.add(i.id)}),ds=I({models:F(ls),defaultModel:as.optional(),thinkingOptions:us,defaultThinkingOptionId:os.optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set,r=new Set(e.thinkingOptions.map(({id:e})=>e));for(let[i,a]of e.models.entries()){n.has(a.ref.id)&&t.addIssue({code:`custom`,message:`Model Catalog refs must be unique`,path:[`models`,i,`ref`,`id`]}),n.add(a.ref.id),a.fastModel&&((n.has(a.fastModel.id)||e.models.some(e=>e.ref.id===a.fastModel?.id))&&t.addIssue({code:`custom`,message:`Fast Model refs must be distinct and unique`,path:[`models`,i,`fastModel`]}),n.add(a.fastModel.id));let o=/* @__PURE__ */ new Set;for(let[e,n]of(a.supportedThinkingOptionIds??[]).entries())o.has(n)&&t.addIssue({code:`custom`,message:`Supported Thinking option IDs must be unique per Model`,path:[`models`,i,`supportedThinkingOptionIds`,e]}),o.add(n),r.has(n)||t.addIssue({code:`custom`,message:`Supported Thinking option must exist in the catalog`,path:[`models`,i,`supportedThinkingOptionIds`,e]})}e.defaultModel&&!n.has(e.defaultModel.id)&&t.addIssue({code:`custom`,message:`Default Model must exist in the Model Catalog`,path:[`defaultModel`,`id`]}),e.defaultThinkingOptionId&&!r.has(e.defaultThinkingOptionId)&&t.addIssue({code:`custom`,message:`Default Thinking option must exist in the catalog`,path:[`defaultThinkingOptionId`]})}),fs=I({fork:P(),forkAcrossCwd:P(),rollbackLastTurn:P()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),ps=z([`live`,`atCreate`]),ms=I({configuration:I({selectModel:P(),selectThinkingOption:P(),selectPermissionMode:P(),permissionModeScope:ps.default(`live`)}).strict(),history:fs,subagents:I({observe:P(),readTranscript:P()}).strict().optional(),autonomousTurns:I({observe:P()}).strict().optional(),steer:P().optional()}).strict();I({effectiveModel:as.optional(),resolvedModelLabel:ss.optional(),effectiveThinkingOptionId:os.optional(),availableThinkingOptions:us.optional(),effectivePermissionModeId:Go.optional()}).strict().superRefine((e,t)=>{e.effectiveThinkingOptionId&&e.availableThinkingOptions&&!e.availableThinkingOptions.some(({id:t})=>t===e.effectiveThinkingOptionId)&&t.addIssue({code:`custom`,message:`Effective Thinking option must be currently available`,path:[`effectiveThinkingOptionId`]})});let hs=I({open:B(!0)}).strict();qa([I({status:B(`ready`),catalog:ds,permissionModes:Ko.optional(),capabilities:ms,webUi:hs.optional()}).strict().superRefine((e,t)=>{let n=e.capabilities.configuration.selectPermissionMode;n!==!!e.permissionModes&&t.addIssue({code:`custom`,message:`Permission Mode catalog and capability must agree`,path:n?[`permissionModes`]:[`capabilities`,`configuration`,`selectPermissionMode`]})}),I({status:z([`notInstalled`,`unavailable`,`error`]),error:Lo}).strict()]),I({harnessId:V,cwd:is.max(16384).optional(),refresh:P().optional(),purpose:B(`availability`).optional()}).strict(),I({harnessId:V}).strict(),I({}).strict(),I({threadId:H,model:as}).strict(),I({threadId:H,thinkingOptionId:os}).strict(),I({threadId:H,includeReferenceCapability:P().optional()}).strict(),R(`owner`,[I({owner:B(`codex`),locked:P(),effectiveModel:as.optional(),resolvedModelLabel:ss.optional(),effectiveThinkingOptionId:os.optional(),effectivePermissionModeId:Go.optional(),history:fs.optional(),supportsThreadReferences:B(!0).optional()}).strict(),I({owner:B(`external`),harnessId:is.max(256),transportModelId:is.max(1024),effectiveModel:as.optional(),resolvedModelLabel:ss.optional(),effectiveThinkingOptionId:os.optional(),availableThinkingOptions:us.optional(),effectivePermissionModeId:Go.optional(),history:fs,usage:Zo.optional(),locked:B(!0)}).strict()]),I({threadIds:F(H).min(1).max(100)}).strict().superRefine(({threadIds:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i)&&t.addIssue({code:`custom`,message:`Thread ownership-list IDs must be unique`,path:[`threadIds`,r]}),n.add(i)});let gs=R(`owner`,[I({threadId:H,owner:B(`codex`)}).strict(),I({threadId:H,owner:B(`external`),harnessId:j().max(256).pipe(V)}).strict()]);I({threads:F(gs).min(1).max(100)}).strict().superRefine(({threads:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.threadId)&&t.addIssue({code:`custom`,message:`Thread ownership-list results must be unique`,path:[`threads`,r,`threadId`]}),n.add(i.threadId)}),I({threadId:H,text:j().optional()}).strict(),I({kind:B(`application`),value:j().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),l}}).pipe(I({expectedTurnId:Uo,clientUserMessageId:j().min(1),delivery:z([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),z([`activeTurn`,`newTurn`]),I({delivery:z([`official`,`activeTurn`,`newTurn`])}).strict(),I({threadIds:F(j().min(1))}).strict(),I({threadId:j().min(1).max(1024),pinned:P()}).strict(),I({prompt:j().max(16384).optional()}).strict(),I({projects:F(I({id:j(),name:j(),rootPaths:F(j())})),assignments:eo(j(),j()),projectless:F(j()),pinned:F(j())});let _s=eo(j(),Va()),vs=I({epoch:j().uuid(),sequence:N().int().nonnegative()});R(`type`,[I({type:B(`display-settings-changed`),cursor:vs}),I({type:B(`preferences-changed`),cursor:vs,revision:N().int().nonnegative()}),I({type:B(`hello`),version:B(1),cursor:vs,reset:P()}),I({type:B(`changed`),cursor:vs,threadId:j().min(1),method:j().min(1)})]);let ys=R(`type`,[I({type:B(`text`),id:j(),prompt:j(),secret:P().optional(),optional:P().optional()}),I({type:B(`choice`),id:j(),prompt:j(),multiple:P(),allowOther:P(),optional:P().optional(),options:F(I({value:j(),label:j(),description:j().optional()}))})]),bs=R(`type`,[I({type:B(`approval`),title:j(),description:j().optional(),subject:Va().optional(),actions:F(I({id:j(),label:j(),effect:j()}))}),I({type:B(`question`),title:j().optional(),questions:F(ys)})]),xs=I({requestId:qa([j(),N().int()]),threadId:j(),kind:z([`approval`,`question`]),interaction:bs,request:_s}),Ss=I({id:j().min(1),clientUserMessageId:j().min(1),input:F(_s),presentationInput:F(_s).nullable().optional()}).passthrough();I({fields:F(I({path:F(qa([j(),N().int().nonnegative()])),originalLength:N().int().nonnegative()}))});let Cs=I({id:j().min(1),status:j().min(1),items:F(I({id:j().min(1),type:j().min(1)}).passthrough()),codexhostFileOperations:F(I({beforeItemId:j().nullable(),item:I({id:j().min(1),type:j().min(1)}).passthrough()})).optional(),error:I({message:j().optional()}).passthrough().nullable().optional(),fingerprint:j().min(1).optional(),unchanged:B(!0).optional()}).passthrough(),ws=I({id:j().min(1).max(512),fingerprint:j().min(1).max(128)});I({threadId:j().min(1),knownTurns:F(ws).max(64).optional(),truncateToolOutput:P().optional()});let Ts=I({harnessId:j().min(1),nativeSessionId:j().min(1)});I({cursor:vs,activeTurnId:j().min(1).nullable().optional(),command:I({name:j().min(1),turn:Cs}).optional(),thread:I({id:j().min(1),cwd:j(),modelProvider:j().min(1),createdAt:N(),updatedAt:N(),status:I({type:j()}).passthrough(),name:j().nullable().optional(),preview:j().optional(),codexhostImportSource:Ts.optional(),turns:F(Cs).length(0)}).passthrough(),turnsPage:I({data:F(Cs).max(5),nextCursor:j().nullable()}),configuration:I({native:I({model:j().min(1).max(1024).optional(),reasoningEffort:j().min(1).max(128).optional()}).optional(),effectiveModel:as.optional(),effectiveThinkingOptionId:os.optional(),effectivePermissionModeId:Go.optional()}),queue:I({items:F(Ss),pausedReason:z([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:F(xs)}),I({version:B(1),owner:B(`service`).optional(),pid:N().int().positive(),port:N().int().min(1).max(65535),token:j().regex(/^[0-9a-f]{64}$/u),startedAt:N(),epoch:j().uuid()}),I({epoch:j().uuid(),threadId:j().min(1),requestId:qa([j(),N().int()]),result:_s}),I({includeArchived:P().optional()}).strict(),I({threads:F(Io),ownership:F(gs),archivedThreadIds:F(H)}).strict();let Es=j().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);I({available:P()}).strict(),I({path:j().min(1),mimeType:Es}).strict();let Ds=z([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);R(`ok`,[I({ok:B(!0),text:j()}).strict(),I({ok:B(!1),error:I({code:Ds}).strict()}).strict()]);let Os=I({kind:z([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:j().min(1)}).strict(),ks=R(`status`,[I({status:B(`not-installed`)}),I({status:B(`not-running`)}),I({status:B(`not-logged-in`)}),I({status:B(`https-disabled`)}),I({status:B(`not-serving`),command:j()}),I({status:B(`occupied`),target:j()}),I({status:B(`serving`),url:j(),funnel:P()}),I({status:B(`error`),message:j()})]);I({state:ks,error:j().optional()}).strict();let As=R(`status`,[I({status:B(`on`)}),I({status:B(`off`)}),I({status:B(`invalid`),reason:j()})]),js=I({lan:P(),autostart:As}).strict(),Ms=I({expiresAt:j().optional(),issuing:P(),failure:I({detail:j().optional(),retryAt:j(),paused:P()}).optional()}),Ns=R(`status`,[I({status:B(`off`),reason:z([`invite`,`name-taken`,`banned`]).optional()}),I({status:B(`connecting`),reason:z([`full`,`unreachable`]).optional()}),I({status:B(`connected`),url:j(),certificate:Ms}),I({status:B(`missing-certificate`),url:j(),certificate:Ms}),I({status:B(`stopped`),reason:z([`replaced`,`rejected`,`unsupported-version`])})]);j().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i).transform(e=>e.toLowerCase()),j().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let Ps=z([`official`,`self-hosted`]);I({secret:j().min(1),lastUsedAt:N().nullable(),networkUrls:F(Os),directCandidates:F(Os).optional(),tailscale:ks,background:js.optional(),relay:I({state:Ns,enabled:P(),kind:Ps,officialHost:j(),customHost:j().optional(),officialHostname:j().optional(),customHostname:j().optional(),quotaUntil:j().optional()}).strict().optional()}).strict(),I({url:j()}).strict();let Fs=L({threadId:j().min(1).max(1024),view:z([`result`,`messages`]),cursor:j().min(1).max(8192).optional(),limit:N().int().min(1).max(100).optional()}),Is=I({id:j().min(1).max(256),harnessId:j().min(1),label:j().min(1).max(512),provider:z([`openai-codex`,`xai`])}).strict(),Ls=j().regex(/^[a-z][a-z0-9-]{0,47}$/),Rs=I({name:Ls,source:Is,importedAt:j()}).strict(),zs=R(`action`,[I({action:B(`list`)}).strict(),I({action:B(`import`),sourceId:j().min(1).max(256),name:Ls,confirmed:B(!0)}).strict(),I({action:B(`reimport`),sourceId:j().min(1).max(256),name:Ls,confirmed:B(!0)}).strict(),I({action:B(`remove`),name:Ls,confirmed:B(!0)}).strict()]),Bs=I({provider:j().min(1).max(128),type:z([`oauth`,`api_key`,`unknown`]),label:j().min(1).max(512).optional(),vendor:z([`openai-codex`,`xai`]).optional()}).strict();I({sources:F(Is),targets:F(I({harnessId:j(),providers:F(z([`openai-codex`,`xai`])),imports:F(Rs),others:F(Bs).default([])}).strict())}).strict(),I({targetHarnessId:j().min(1).max(128).optional(),request:zs}).strict(),I({events:P()});let Vs=F(L({agent:j().min(1).max(128),section:z([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);L({entries:Vs.nullable()}),L({}),L({entries:Vs,initializeOnly:P().optional()});let Hs=L({enabled:P(),timeoutMinutes:N().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:30});let Us=j().regex(/^external$/u),Ws=V.transform(e=>String(e)),Gs=L({model:as.optional(),thinkingOptionId:os.optional(),permissionModeId:Go.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),Ks=L({lastHarness:V.optional(),byHarness:eo(Ws,Gs)}),qs=j().min(1).max(1024),Js=L({idleRelease:Hs.optional(),favorites:eo(Ws,F(qs).max(2048)).default({}),newThread:Ks.optional()});L({scope:Us,revision:N().int().nonnegative(),values:Js}),L({scope:Us.default(`external`)});let Ys=R(`kind`,[L({kind:B(`idleRelease`),value:Hs}),L({kind:B(`favorite`),harnessId:V,modelId:qs,enabled:P()}),L({kind:B(`favorites`),harnessId:V,modelIds:F(qs).max(2048)}),L({kind:B(`newThread`),lastHarness:V.optional(),harnessId:V.optional(),configuration:Gs.optional()})]);L({scope:Us.default(`external`),operations:F(Ys).min(1).max(256),initializeOnly:P().optional(),expectedRevision:N().int().nonnegative().optional()}).superRefine((e,t)=>{for(let n of e.operations)n.kind===`newThread`&&(!n.lastHarness&&!n.configuration||!!n.harnessId!=!!n.configuration)&&t.addIssue({code:`custom`,message:`A default Harness or complete configuration is required`})}),L({version:B(1),revision:N().int().nonnegative(),scopes:eo(Us,Js)});let Xs=N().finite().nonnegative(),Zs=L({input:Xs,output:Xs,cacheRead:Xs.optional(),cacheWrite:Xs.optional(),cacheWrite1h:Xs.optional()}),Qs=j().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);L({path:j(),entries:F(L({key:j(),price:Zs})),error:j().nullable()}),L({}),L({key:Qs,price:Zs.nullable(),previousKey:Qs.optional()}),L({model:Qs});let $s=L({official:P().optional(),canonicalModelId:j().min(1).optional(),provider:j().min(1).max(512),model:j().min(1).max(512),price:Zs});L({price:Zs.nullable(),suggestions:F($s).max(6).optional()});let ec=[`today`,`7d`,`30d`,`90d`,`all`],W=N().int().min(0).max(2**53-1),tc=j().regex(/^\d{4}-\d{2}-\d{2}$/u),nc=j().min(1).max(128),rc=j().min(1).max(512),ic=j().min(1).max(4096);L({range:z(ec),timeZone:j().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:nc.optional(),model:rc.nullable().optional(),project:ic.nullable().optional(),date:tc.optional()});let ac=L({requests:W,inputTokens:W,cachedInputTokens:W,cacheWriteInputTokens:W,cacheKnownInputTokens:W,cacheHitCachedInputTokens:W,cacheHitInputTokens:W,outputTokens:W,reasoningOutputTokens:W,costUsd:N().finite().min(0),unpricedRequests:W,unmeteredRequests:W}),oc=ac.shape,sc=L({harness:nc,sessionId:j().min(1).max(512),project:ic.nullable(),title:j().min(1).max(200).optional(),models:F(rc).max(16),firstAtMs:W,lastAtMs:W,...oc});L({range:z(ec),from:tc.nullable(),to:tc,filters:L({harness:nc.nullable(),model:rc.nullable(),unknownModel:P(),project:ic.nullable(),unknownProject:P(),date:tc.nullable()}),reading:L({complete:P(),sources:W,read:W}),failures:F(L({harness:nc,message:j().max(2048)})).max(256),options:L({harnesses:F(nc).max(256),models:F(rc.nullable()).max(4096),projects:F(ic.nullable()).max(4096)}),modelLabels:F(L({harness:nc,model:rc,label:rc})).max(4096).optional(),credits:F(L({harness:nc,model:rc.nullable(),credits:N().finite().min(0),reportedRequests:W,requests:W})).max(4096).optional(),totals:ac,daily:F(L({date:tc,harness:nc,...oc})).max(2e5),hourly:F(L({weekday:N().int().min(0).max(6),hour:N().int().min(0).max(23),...oc})).max(168),byHarness:F(L({harness:nc,...oc})).max(256),byModel:F(L({model:rc.nullable(),...oc,harnessPricedRequests:W})).max(4096),byProject:F(L({project:ic.nullable(),...oc})).max(4096),sessions:F(sc).max(100),recentSessions:F(sc).max(100).optional()}),I({threadId:H}),I({discarded:P()});let cc=R(`type`,[I({id:j().min(1),type:B(`choice`),prompt:j(),options:F(I({value:j().min(1),label:j(),description:j().optional()})).min(1),multiple:P(),allowOther:P(),optional:P()}),I({id:j().min(1),type:B(`text`),prompt:j(),multiline:P(),secret:B(!1),optional:P(),placeholder:j().optional(),prefill:j().optional()})]),lc=I({interactionId:j().min(1),turnId:j().min(1),title:j().optional(),questions:F(cc).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});L({threadId:j().min(1)}),I({questions:F(lc)}),L({threadId:j().min(1),turnId:j().min(1),interactionId:j().min(1),answers:eo(j(),F(j())),cancelled:P().default(!1)}),I({accepted:B(!0)});let uc=I({path:j(),oldText:j().nullable(),newText:j()});I({sessionId:j().min(1),turn:N().int().nonnegative(),path:j().min(1).optional()}),I({diffs:F(uc)}),L({}),L({});let dc=I({reference:I({sessionId:j().min(1),epoch:j().min(1),turn:N().int().nonnegative(),seq:N().int().nonnegative(),callId:j().min(1),part:N().int().nonnegative(),version:j().min(1)}),length:N().int().nonnegative(),bytes:N().int().nonnegative()});function fc(e){if(typeof e!=`object`||!e||!(`codexhostOutput`in e))return[];let t=F(dc).safeParse(e.codexhostOutput);return t.success?t.data:[]}L({title:j().trim().min(1).max(200),type:z([`info`,`warning`,`danger`]),body:j().trim().min(1).max(16384)}),L({}),L({url:j().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/web-ui/open.codexhost/harness/accounts/sources.codexhost/harness/accounts/list.codexhost/harness/accounts/inspect.codexhost/harness/credential-imports.codexhost/harness/session-import/sources.codexhost/harness/session-import/list.codexhost/harness/session-import/import.codexhost/account/list.codexhost/account/refresh.codexhost/account/usage/inspect.codexhost/usage/model-prices/get.codexhost/usage/model-prices/set.codexhost/usage/model-prices/default.codexhost/usage/statistics/get.codexhost/update/check.codexhost/update/start.codexhost/update/status`.split(`.`));let pc=z([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),mc=z([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);L({threadId:j(),title:j(),harnessId:j(),state:pc,reason:mc,inactiveMs:N().nonnegative()}),L({threadId:H,turnId:Uo});let hc=I({amount:N().finite().nonnegative(),currency:j().trim().min(1).max(8),label:j().trim().min(1).max(128).optional()}).strict(),gc=I({email:j().trim().min(1).max(320).optional(),label:j().trim().min(1).max(256).optional(),plan:j().trim().min(1).max(128).optional(),credits:rs.optional(),balance:hc.optional()}).strict();function _c(e){return e.refine(e=>{let t=e;return t.credits!==void 0||t.balance!==void 0},{message:`Account must report either credits or a balance`})}let vc=_c(gc),yc={harnessId:V,harnessName:j().trim().min(1).max(128)},bc=I(yc).strict();I({}).strict(),I({sources:F(bc).max(128)}).strict(),I({harnessId:V,refresh:P().optional()}).strict(),I({...yc,account:vc.nullable(),accounts:F(vc).max(8).optional()}).strict(),I({refresh:P().optional()}).strict(),I({accounts:F(_c(gc.extend(yc))).max(128)}).strict();let xc=j().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(V),Sc=xc.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Cc=j().min(1).max(512).refine(e=>!/[\\\u0000:#?]/u.test(e)&&!e.startsWith(`/`)&&!e.split(`/`).some(e=>e===`..`||e===``),`Plugin resources must be relative paths inside the plugin`),wc=va().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Tc=I({en:j().max(4096),"zh-CN":j().max(4096).optional()}).strict(),Ec=I({commands:F(I({terminal:j().max(256),command:j().max(4096)}).strict()).max(8),before:Tc.optional(),after:Tc.optional(),downloads:F(I({label:j().max(128),url:wc}).strict()).max(8).optional()}).strict(),Dc={id:xc,name:j().trim().min(1).max(128),version:j().min(1).max(128),kind:B(`usage`).optional(),iconStyle:I({vector:I({viewBox:j().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:j().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:F(I({d:j().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:z([`evenodd`,`nonzero`]).optional(),fill:j().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:j().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:N().min(0).max(50).optional(),paddingRatio:N().min(0).max(.25).optional()}).strict().optional(),installation:Ec.optional(),notice:Tc.optional(),launchCommand:B(!0).optional(),links:I({website:wc.optional(),documentation:wc.optional(),installation:wc.optional()}).strict().optional()};I({manifestVersion:B(1),...Dc,adapterApiVersion:N().int().positive(),entry:Cc,icon:Cc.optional()}).strict();let Oc=j().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),kc=I({...Dc,icon:Oc.optional()}).strict();I({}).strict(),I({plugins:F(kc.extend({id:Sc})).max(128)}).strict(),I({version:B(1),enabled:F(xc).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),I({harnessId:Sc,model:as.optional(),thinkingOptionId:os.optional(),permissionModeId:Go.optional(),prewarm:B(!0).optional()}).strict();let Ac=j().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);I({harnessId:Sc}).strict().extend({path:Ac.nullable()}),I({path:Ac.nullable(),restartRequired:P()}).strict(),I({harnessId:V,action:z([`check`,`update`,`install`])}).strict();let jc=I({currentVersion:j().min(1).max(128),latestVersion:j().min(1).max(128),updateAvailable:P(),canUpdate:P(),versionKind:z([`cli`,`application`]).optional(),manualUpdateUrl:va().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:j().max(2048).optional(),messageCode:j().min(1).max(128).optional(),notice:Vo.optional(),latestVersionKind:z([`unknown`,`tracking-branch`]).optional()}).strict();I({taskId:j().uuid()}).strict(),R(`status`,[I({taskId:j().uuid(),status:B(`running`)}).strict(),I({taskId:j().uuid(),status:B(`succeeded`),result:jc}).strict(),I({taskId:j().uuid(),status:B(`failed`),error:I({code:N().int(),message:j().min(1).max(2048)}).strict()}).strict()]);let Mc=j().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Nc=j().trim().min(1),Pc=z([`free`,`go`,`plus`,`pro`,`prolite`,`team`,`self_serve_business_prolite`,`self_serve_business_usage_based`,`business`,`ent26`,`enterprise_cbp_automation`,`enterprise_cbp_usage_based`,`enterprise`,`edu`,`edu_plus`,`edu_pro`,`unknown`]),Fc=I({accountId:Mc,label:Nc.max(256),email:j().email().max(320).optional(),planType:Pc.optional()}).strict(),Ic=z([`ready`,`unavailable`]);I({version:B(2),currentAccountId:Mc.nullable(),phase:Ic,revision:N().int().nonnegative(),instanceId:Nc.max(1024).optional(),accounts:F(Fc).max(1)}).strict(),I({accountId:Mc,refresh:P().optional()}).strict(),I({accountId:Mc,usage:Zo.nullable(),accountCredits:rs.optional(),freshness:z([`live`,`cached`]),observedAt:j().datetime().nullable()}).strict();let Lc=1e3,Rc=j().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),zc=Rc.max(1024),Bc=I({nativeSessionId:zc,title:Rc.max(4096).nullable(),updatedAt:N().int().nonnegative().max(864e13),cwd:Rc.max(16384),running:P().nullable()}).strict();I({}).strict(),I({harnesses:F(I({harnessId:Sc,name:Rc.max(128)}).strict()).max(128)}).strict(),I({harnessId:Sc,query:j().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:N().int().nonnegative().safe().optional(),limit:N().int().min(1).max(Lc).optional()}).strict(),I({candidates:F(Bc).max(Lc),total:N().int().nonnegative().safe()}).strict(),I({harnessId:Sc,nativeSessionId:zc}).strict(),I({threadId:Rc.max(1024).pipe(H)}).strict();let Vc=j().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Hc=zc,Uc=Bc;I({}).strict(),I({candidates:F(Uc).max(1e3)}).strict(),I({nativeSessionId:Hc}).strict(),I({threadId:Vc.max(1024).pipe(H)}).strict(),I({threadId:H,lastTurnId:Uo}).strict(),I({threadId:H}).strict();let Wc=j().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();I({commands:F(I({id:Wc,invocation:j().min(1).max(128),label:j().trim().min(1).max(128),description:j().trim().min(1).max(512).optional(),localizations:Bo.optional(),argumentMode:z([`none`,`text`]),kind:z([`command`,`skill`]).optional()}).strict()),warnings:F(j().min(1)).optional(),source:z([`live`,`static`]).optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.commands.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Harness command IDs must be unique`,path:[`commands`,r,`id`]}),n.add(i.id)}),I({harnessId:V,cwd:j().min(1).optional()}).strict(),I({threadId:H}).strict(),I({threadId:H,commandId:Wc,turnId:Uo.optional(),arguments:Io.optional()}).strict(),I({accepted:B(!0),turnId:Uo.optional()}).strict();let Gc=B(`2.0`).optional(),Kc=Ua().optional(),qc=j().min(1),Jc=qa([j(),N().int()]),Yc=I({code:N().int(),message:j(),data:Fo.optional()}).catchall(Fo).superRefine(Ao([`data`]));qa([I({jsonrpc:Gc,id:Jc,method:qc,params:Fo.optional(),result:Kc,error:Kc}).catchall(Fo).superRefine(Ao([`jsonrpc`,`params`,`result`,`error`])),I({jsonrpc:Gc,id:Kc,method:qc,params:Fo.optional(),result:Kc,error:Kc}).catchall(Fo).superRefine(Ao([`jsonrpc`,`id`,`params`,`result`,`error`])),I({jsonrpc:Gc,id:Jc,method:Kc,params:Kc,result:Fo,error:Kc}).catchall(Fo).superRefine(Ao([`jsonrpc`,`method`,`params`,`error`])),I({jsonrpc:Gc,id:Jc,method:Kc,params:Kc,result:Kc,error:Yc}).catchall(Fo).superRefine(Ao([`jsonrpc`,`method`,`params`,`result`]))]);let Xc=j().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});L({harnessId:V,nativeSessionId:Xc,locator:Fo.optional(),formatVersion:B(1)}).superRefine(Ao([`locator`])),L({harnessId:V,nativeSessionId:Xc,nativeTurnKey:Xc,formatVersion:B(1)}),L({harnessId:V,nativeSessionId:Xc,checkpointId:Xc,locator:Fo.optional(),formatVersion:B(1)}).superRefine(Ao([`locator`]));let Zc=j().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),Qc=z([`npm`,`windows-installer`,`macos-dmg`]),$c=L({version:Zc,installation:Qc,phase:z([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),updatedAt:N().int().nonnegative(),downloadedBytes:N().int().nonnegative().optional(),totalBytes:N().int().positive().optional(),error:j().min(1).max(500).nullable(),serviceStopOutput:j().optional()}).superRefine((e,t)=>{e.downloadedBytes!==void 0&&e.totalBytes!==void 0&&e.downloadedBytes>e.totalBytes&&t.addIssue({code:`custom`,path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`})});L({});let el=j().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);L({currentVersion:Zc,installation:Qc.nullable(),latestVersion:Zc.nullable(),updateAvailable:P(),installationAvailable:P(),releaseNotes:j().min(1).max(2e4).nullable(),releaseNotesUrl:el.nullable(),status:$c.nullable(),error:j().min(1).max(500).nullable()}),L({status:$c}),L({status:$c.nullable()});let tl=z([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);I({runningVersion:j().nullable(),installedVersion:j().nullable(),restartRequired:P(),remote:P(),updateSupported:P(),update:I({phase:tl,targetVersion:j().nullable(),error:j().nullable()})});let nl=I({version:j().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();I({hostname:j().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:N().int().min(1).max(65535).nullable(),identity:j().max(4096).nullable(),action:z([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:P().optional(),version:j().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),I({state:z([`installed`,`not-installed`])}).strict();let rl=j().min(1).max(1024),il=I({hostId:rl,displayName:j().min(1).max(1024),source:z([`codex-managed`,`discovered`]),sshAlias:j().max(1024).nullable(),sshHost:j().min(1).max(1024),sshPort:N().int().min(1).max(65535).nullable(),identity:j().max(4096).nullable(),autoConnect:P(),connectionAnalyticsId:j().max(1024).optional()}),al=L({displayName:j().min(1).max(1024),hostname:j().min(1).max(1024),sshPort:N().int().min(1).max(65535).nullable(),identity:j().max(4096).nullable()});R(`action`,[L({action:B(`list`)}),L({action:B(`read-thread`),hostId:rl.refine(e=>e!==`local`),input:Fs}),L({action:B(`save`),draft:al,previous:il.nullable()}),L({action:B(`remove`),previous:il}),L({action:B(`connect`),hostId:rl,enabled:P()}),L({action:B(`state`),hostId:rl}),L({action:B(`runtime`),hostId:rl}),L({action:B(`update`),hostId:rl.refine(e=>e!==`local`),version:nl.shape.version})]),qa([L({result:Fo}),L({error:L({code:N().int(),message:j()})})]);let ol=j().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),sl=qa([j(),I({en:j()}).catchall(j())]),cl=I({title:sl.optional(),description:sl.optional(),icon:j().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:j().optional()});I({extensions:F(I({id:ol,name:j().min(1).max(214),version:j().min(1).max(128),format:B(`dsh`),supportedTargets:Qa([B(`web`)]),enabledTargets:F(B(`web`)).max(1),source:j().min(1).max(4096),projectUrl:j().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:j(),meta:cl.optional(),loadError:j().optional()})),loadedIds:F(ol),safeMode:P(),storeError:j().optional()});let ll=j().trim().max(2048).url({protocol:/^https?$/u,normalize:!0}).refine(e=>!/[\s\\?#]/u.test(e)&&!e.split(`/`)[2]?.includes(`@`),`Use an HTTP(S) registry URL without credentials, a query, or a fragment.`).transform(e=>e.endsWith(`/`)?e:`${e}/`);I({spec:j().trim().min(1).max(4096),registry:ll.optional()}).strict(),I({id:ol,enabled:P()}).strict(),I({id:ol}).strict(),B(1);function ul({block:e,previews:t,read:n,useDisclosure:o,t:s,children:c}){let l=o(),[u,d]=(0,r.useState)(),[f,p]=(0,r.useState)(!1),[m,h]=(0,r.useState)(!1),[g,_]=(0,r.useState)(),v=Math.ceil(t.reduce((e,t)=>e+t.bytes,0)/1024);async function y(){if(u)return u;h(!0),_(void 0);try{let r=await Promise.all(t.map(({reference:e})=>n(e))),i=new Map(t.map((e,t)=>[e.reference.part,r[t]])),a={...e,content:e.content.map((e,t)=>e.type===`text`&&i.has(t)?{...e,text:i.get(t)}:e)};return d(a),a}catch(e){throw _(typeof e==`object`&&e&&`code`in e&&e.code===`session/tool-output-stale`?s(`tool.output.stale`):s(`tool.output.failed`)),e}finally{h(!1)}}async function ee(){try{await y(),l.setExpanded(!0),p(!0)}catch{return}}async function b(){return(await y()).content.map(e=>e.type===`text`?e.text:``).join(`
|
|
122
|
+
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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}}function hi(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:_i(t,`input`,e.processors),output:_i(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function k(e,t){let n=t??{seen:/* @__PURE__ */ 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 k(r.element,n);if(r.type===`set`)return k(r.valueType,n);if(r.type===`lazy`)return k(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 k(r.innerType,n);if(r.type===`intersection`)return k(r.left,n)||k(r.right,n);if(r.type===`record`||r.type===`map`)return k(r.keyType,n)||k(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:k(r.in,n)||k(r.out,n);if(r.type===`object`){for(let e in r.shape)if(k(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(k(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(k(e,n))return!0;return!!(r.rest&&k(r.rest,n))}return!1}let gi=(e,t={})=>n=>{let r=pi({...n,processors:t});return O(e,r),mi(r,e),hi(r,e)},_i=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=pi({...i??{},target:a,io:t,processors:n});return O(e,o),mi(o,e),hi(o,e)},vi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},yi=(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=vi[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}))])}},bi=(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)},xi=(e,t,n,r)=>{n.type=`boolean`},Si=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ci=(e,t,n,r)=>{n.not={}},wi=(e,t,n,r)=>{let i=e._zod.def,a=h(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ti=(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}},Ei=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Oi=(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=O(a.element,t,{...r,path:[...r.path,`items`]})},ki=(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]=O(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=O(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ai=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>O(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ji=(e,t,n,r)=>{let i=e._zod.def,a=O(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=O(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]]},Mi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>O(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?O(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Ni=(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=O(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=O(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=O(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)}},Pi=(e,t,n,r)=>{let i=e._zod.def,a=O(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`}]},Fi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ii=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Li=(e,t,n,r)=>{let i=e._zod.def;O(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)))},Ri=(e,t,n,r)=>{let i=e._zod.def;O(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},zi=(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;O(o,t,r);let s=t.seen.get(e);s.ref=o},Bi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Vi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Hi=(e,t,n,r)=>{let i=e._zod.innerType;O(i,t,r);let a=t.seen.get(e);a.ref=i},Ui=/*@__PURE__*/ u(`ZodISODateTime`,(e,t)=>{$t.init(e,t),M.init(e,t)});function Wi(e){return/* @__PURE__ */ Mr(Ui,e)}let Gi=/*@__PURE__*/ u(`ZodISODate`,(e,t)=>{en.init(e,t),M.init(e,t)});function Ki(e){return/* @__PURE__ */ Nr(Gi,e)}let qi=/*@__PURE__*/ u(`ZodISOTime`,(e,t)=>{tn.init(e,t),M.init(e,t)});function Ji(e){return/* @__PURE__ */ Pr(qi,e)}let Yi=/*@__PURE__*/ u(`ZodISODuration`,(e,t)=>{nn.init(e,t),M.init(e,t)});function Xi(e){return/* @__PURE__ */ Fr(Yi,e)}let Zi=/*@__PURE__*/ u(`ZodError`,(e,t)=>{Oe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>je(e,t)},flatten:{value:t=>Ae(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,g,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,g,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Qi=/* @__PURE__ */ Me(Zi),$i=/* @__PURE__ */ Ne(Zi),ea=/* @__PURE__ */ Pe(Zi),ta=/* @__PURE__ */ Ie(Zi),na=/* @__PURE__ */ Re(Zi),ra=/* @__PURE__ */ ze(Zi),ia=/* @__PURE__ */ Be(Zi),aa=/* @__PURE__ */ Ve(Zi),oa=/* @__PURE__ */ He(Zi),sa=/* @__PURE__ */ Ue(Zi),ca=/* @__PURE__ */ We(Zi),la=/* @__PURE__ */ Ge(Zi),ua=/* @__PURE__ */ new WeakMap;function da(e,t,n){let r=Object.getPrototypeOf(e),i=ua.get(r);if(i||(i=/* @__PURE__ */ new Set,ua.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})}})}}}let A=/*@__PURE__*/ u(`ZodType`,(e,t)=>(E.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:_i(e,`input`),output:_i(e,`output`)}}),e.toJSONSchema=gi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Qi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ea(e,t,n),e.parseAsync=async(t,n)=>$i(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ta(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>na(e,t,n),e.decode=(t,n)=>ra(e,t,n),e.encodeAsync=async(t,n)=>ia(e,t,n),e.decodeAsync=async(t,n)=>aa(e,t,n),e.safeEncode=(t,n)=>oa(e,t,n),e.safeDecode=(t,n)=>sa(e,t,n),e.safeEncodeAsync=async(t,n)=>ca(e,t,n),e.safeDecodeAsync=async(t,n)=>la(e,t,n),da(e,`ZodType`,{check(...e){let t=this.def;return this.clone(C(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 ue(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Oo(e,t))},superRefine(e,t){return this.check(ko(e,t))},overwrite(e){return this.check(/* @__PURE__ */ ni(e))},optional(){return oo(this)},exactOptional(){return co(this)},nullable(){return uo(this)},nullish(){return oo(uo(this))},nonoptional(e){return _o(this,e)},array(){return F(this)},or(e){return qa([this,e])},and(e){return Xa(this,e)},transform(e){return xo(this,io(e))},default(e){return po(this,e)},prefault(e){return ho(this,e)},catch(e){return yo(this,e)},pipe(e){return xo(this,e)},readonly(){return Co(this)},describe(e){let t=this.clone();return cr.add(t,{description:e}),t},meta(...e){if(e.length===0)return cr.get(this);let t=this.clone();return cr.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 cr.get(e)?.description},configurable:!0}),e)),fa=/*@__PURE__*/ u(`_ZodString`,(e,t)=>{Vt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,da(e,`_ZodString`,{regex(...e){return this.check(/* @__PURE__ */ Xr(...e))},includes(...e){return this.check(/* @__PURE__ */ $r(...e))},startsWith(...e){return this.check(/* @__PURE__ */ ei(...e))},endsWith(...e){return this.check(/* @__PURE__ */ ti(...e))},min(...e){return this.check(/* @__PURE__ */ Jr(...e))},max(...e){return this.check(/* @__PURE__ */ qr(...e))},length(...e){return this.check(/* @__PURE__ */ Yr(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Jr(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Zr(e))},uppercase(e){return this.check(/* @__PURE__ */ Qr(e))},trim(){return this.check(/* @__PURE__ */ ii())},normalize(...e){return this.check(/* @__PURE__ */ ri(...e))},toLowerCase(){return this.check(/* @__PURE__ */ ai())},toUpperCase(){return this.check(/* @__PURE__ */ oi())},slugify(){return this.check(/* @__PURE__ */ si())}})}),pa=/*@__PURE__*/ u(`ZodString`,(e,t)=>{Vt.init(e,t),fa.init(e,t),e.email=t=>e.check(/* @__PURE__ */ ur(ma,t)),e.url=t=>e.check(/* @__PURE__ */ gr(_a,t)),e.jwt=t=>e.check(/* @__PURE__ */ jr(Na,t)),e.emoji=t=>e.check(/* @__PURE__ */ _r(ya,t)),e.guid=t=>e.check(/* @__PURE__ */ dr(ha,t)),e.uuid=t=>e.check(/* @__PURE__ */ fr(ga,t)),e.uuidv4=t=>e.check(/* @__PURE__ */ pr(ga,t)),e.uuidv6=t=>e.check(/* @__PURE__ */ mr(ga,t)),e.uuidv7=t=>e.check(/* @__PURE__ */ hr(ga,t)),e.nanoid=t=>e.check(/* @__PURE__ */ vr(ba,t)),e.guid=t=>e.check(/* @__PURE__ */ dr(ha,t)),e.cuid=t=>e.check(/* @__PURE__ */ yr(xa,t)),e.cuid2=t=>e.check(/* @__PURE__ */ br(Sa,t)),e.ulid=t=>e.check(/* @__PURE__ */ xr(Ca,t)),e.base64=t=>e.check(/* @__PURE__ */ Or(Aa,t)),e.base64url=t=>e.check(/* @__PURE__ */ kr(ja,t)),e.xid=t=>e.check(/* @__PURE__ */ Sr(wa,t)),e.ksuid=t=>e.check(/* @__PURE__ */ Cr(Ta,t)),e.ipv4=t=>e.check(/* @__PURE__ */ wr(Ea,t)),e.ipv6=t=>e.check(/* @__PURE__ */ Tr(Da,t)),e.cidrv4=t=>e.check(/* @__PURE__ */ Er(Oa,t)),e.cidrv6=t=>e.check(/* @__PURE__ */ Dr(ka,t)),e.e164=t=>e.check(/* @__PURE__ */ Ar(Ma,t)),e.datetime=t=>e.check(Wi(t)),e.date=t=>e.check(Ki(t)),e.time=t=>e.check(Ji(t)),e.duration=t=>e.check(Xi(t))});function j(e){return/* @__PURE__ */ lr(pa,e)}let M=/*@__PURE__*/ u(`ZodStringFormat`,(e,t)=>{D.init(e,t),fa.init(e,t)}),ma=/*@__PURE__*/ u(`ZodEmail`,(e,t)=>{Wt.init(e,t),M.init(e,t)}),ha=/*@__PURE__*/ u(`ZodGUID`,(e,t)=>{Ht.init(e,t),M.init(e,t)}),ga=/*@__PURE__*/ u(`ZodUUID`,(e,t)=>{Ut.init(e,t),M.init(e,t)}),_a=/*@__PURE__*/ u(`ZodURL`,(e,t)=>{Gt.init(e,t),M.init(e,t)});function va(e){return/* @__PURE__ */ gr(_a,e)}let ya=/*@__PURE__*/ u(`ZodEmoji`,(e,t)=>{Kt.init(e,t),M.init(e,t)}),ba=/*@__PURE__*/ u(`ZodNanoID`,(e,t)=>{qt.init(e,t),M.init(e,t)}),xa=/*@__PURE__*/ u(`ZodCUID`,(e,t)=>{Jt.init(e,t),M.init(e,t)}),Sa=/*@__PURE__*/ u(`ZodCUID2`,(e,t)=>{Yt.init(e,t),M.init(e,t)}),Ca=/*@__PURE__*/ u(`ZodULID`,(e,t)=>{Xt.init(e,t),M.init(e,t)}),wa=/*@__PURE__*/ u(`ZodXID`,(e,t)=>{Zt.init(e,t),M.init(e,t)}),Ta=/*@__PURE__*/ u(`ZodKSUID`,(e,t)=>{Qt.init(e,t),M.init(e,t)}),Ea=/*@__PURE__*/ u(`ZodIPv4`,(e,t)=>{rn.init(e,t),M.init(e,t)}),Da=/*@__PURE__*/ u(`ZodIPv6`,(e,t)=>{an.init(e,t),M.init(e,t)}),Oa=/*@__PURE__*/ u(`ZodCIDRv4`,(e,t)=>{on.init(e,t),M.init(e,t)}),ka=/*@__PURE__*/ u(`ZodCIDRv6`,(e,t)=>{sn.init(e,t),M.init(e,t)}),Aa=/*@__PURE__*/ u(`ZodBase64`,(e,t)=>{ln.init(e,t),M.init(e,t)}),ja=/*@__PURE__*/ u(`ZodBase64URL`,(e,t)=>{dn.init(e,t),M.init(e,t)}),Ma=/*@__PURE__*/ u(`ZodE164`,(e,t)=>{fn.init(e,t),M.init(e,t)}),Na=/*@__PURE__*/ u(`ZodJWT`,(e,t)=>{mn.init(e,t),M.init(e,t)}),Pa=/*@__PURE__*/ u(`ZodNumber`,(e,t)=>{hn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),da(e,`ZodNumber`,{gt(e,t){return this.check(/* @__PURE__ */ Wr(e,t))},gte(e,t){return this.check(/* @__PURE__ */ Gr(e,t))},min(e,t){return this.check(/* @__PURE__ */ Gr(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Hr(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Ur(e,t))},max(e,t){return this.check(/* @__PURE__ */ Ur(e,t))},int(e){return this.check(Ia(e))},safe(e){return this.check(Ia(e))},positive(e){return this.check(/* @__PURE__ */ Wr(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ Gr(0,e))},negative(e){return this.check(/* @__PURE__ */ Hr(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Ur(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ Kr(e,t))},step(e,t){return this.check(/* @__PURE__ */ Kr(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 N(e){return/* @__PURE__ */ Ir(Pa,e)}let Fa=/*@__PURE__*/ u(`ZodNumberFormat`,(e,t)=>{gn.init(e,t),Pa.init(e,t)});function Ia(e){return/* @__PURE__ */ Lr(Fa,e)}let La=/*@__PURE__*/ u(`ZodBoolean`,(e,t)=>{_n.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r)});function P(e){return/* @__PURE__ */ Rr(La,e)}let Ra=/*@__PURE__*/ u(`ZodNull`,(e,t)=>{vn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r)});function za(e){return/* @__PURE__ */ zr(Ra,e)}let Ba=/*@__PURE__*/ u(`ZodUnknown`,(e,t)=>{yn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Va(){return/* @__PURE__ */ Br(Ba)}let Ha=/*@__PURE__*/ u(`ZodNever`,(e,t)=>{bn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r)});function Ua(e){return/* @__PURE__ */ Vr(Ha,e)}let Wa=/*@__PURE__*/ u(`ZodArray`,(e,t)=>{Sn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.element=t.element,da(e,`ZodArray`,{min(e,t){return this.check(/* @__PURE__ */ Jr(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Jr(1,e))},max(e,t){return this.check(/* @__PURE__ */ qr(e,t))},length(e,t){return this.check(/* @__PURE__ */ Yr(e,t))},unwrap(){return this.element}})});function F(e,t){return/* @__PURE__ */ ci(Wa,e,t)}let Ga=/*@__PURE__*/ u(`ZodObject`,(e,t)=>{Dn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),x(e,`shape`,()=>t.shape),da(e,`ZodObject`,{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Va()})},loose(){return this.clone({...this._zod.def,catchall:Va()})},strict(){return this.clone({...this._zod.def,catchall:Ua()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return he(this,e)},safeExtend(e){return ge(this,e)},merge(e){return _e(this,e)},pick(e){return pe(this,e)},omit(e){return me(this,e)},partial(...e){return ve(ao,this,e[0])},required(...e){return ye(go,this,e[0])}})});function I(e,t){let n={type:`object`,shape:e??{},...w(t)};return new Ga(n)}function L(e,t){return new Ga({type:`object`,shape:e,catchall:Ua(),...w(t)})}let Ka=/*@__PURE__*/ u(`ZodUnion`,(e,t)=>{kn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.options=t.options});function qa(e,t){return new Ka({type:`union`,options:e,...w(t)})}let Ja=/*@__PURE__*/ u(`ZodDiscriminatedUnion`,(e,t)=>{Ka.init(e,t),An.init(e,t)});function R(e,t,n){return new Ja({type:`union`,options:t,discriminator:e,...w(n)})}let Ya=/*@__PURE__*/ u(`ZodIntersection`,(e,t)=>{jn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r)});function Xa(e,t){return new Ya({type:`intersection`,left:e,right:t})}let Za=/*@__PURE__*/ u(`ZodTuple`,(e,t)=>{Pn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Qa(e,t,n){let r=t instanceof E;return new Za({type:`tuple`,items:e,rest:r?t:null,...w(r?n:t)})}let $a=/*@__PURE__*/ u(`ZodRecord`,(e,t)=>{Rn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function eo(e,t,n){return!t||!t._zod?new $a({type:`record`,keyType:j(),valueType:e,...w(t)}):new $a({type:`record`,keyType:e,valueType:t,...w(n)})}let to=/*@__PURE__*/ u(`ZodEnum`,(e,t)=>{zn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(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 to({...t,checks:[],...w(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 to({...t,checks:[],...w(r),entries:i})}});function z(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new to({type:`enum`,entries:n,...w(t)})}let no=/*@__PURE__*/ u(`ZodLiteral`,(e,t)=>{Bn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(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 B(e,t){return new no({type:`literal`,values:Array.isArray(e)?e:[e],...w(t)})}let ro=/*@__PURE__*/ u(`ZodTransform`,(e,t)=>{Vn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new f(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ee(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(Ee(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 io(e){return new ro({type:`transform`,transform:e})}let ao=/*@__PURE__*/ u(`ZodOptional`,(e,t)=>{Un.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oo(e){return new ao({type:`optional`,innerType:e})}let so=/*@__PURE__*/ u(`ZodExactOptional`,(e,t)=>{Wn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function co(e){return new so({type:`optional`,innerType:e})}let lo=/*@__PURE__*/ u(`ZodNullable`,(e,t)=>{Gn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uo(e){return new lo({type:`nullable`,innerType:e})}let fo=/*@__PURE__*/ u(`ZodDefault`,(e,t)=>{Kn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function po(e,t){return new fo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}let mo=/*@__PURE__*/ u(`ZodPrefault`,(e,t)=>{Jn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ho(e,t){return new mo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}let go=/*@__PURE__*/ u(`ZodNonOptional`,(e,t)=>{Yn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _o(e,t){return new go({type:`nonoptional`,innerType:e,...w(t)})}let vo=/*@__PURE__*/ u(`ZodCatch`,(e,t)=>{Zn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yo(e,t){return new vo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let bo=/*@__PURE__*/ u(`ZodPipe`,(e,t)=>{Qn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e.in=t.in,e.out=t.out});function xo(e,t){return new bo({type:`pipe`,in:e,out:t})}let So=/*@__PURE__*/ u(`ZodReadonly`,(e,t)=>{er.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Co(e){return new So({type:`readonly`,innerType:e})}let wo=/*@__PURE__*/ u(`ZodLazy`,(e,t)=>{nr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function To(e){return new wo({type:`lazy`,getter:e})}let Eo=/*@__PURE__*/ u(`ZodCustom`,(e,t)=>{rr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r)});function Do(e,t){return/* @__PURE__ */ li(Eo,e??(()=>!0),t)}function Oo(e,t={}){return/* @__PURE__ */ ui(Eo,e,t)}function ko(e,t){return/* @__PURE__ */ di(e,t)}function Ao(e){return(t,n)=>{for(let r of e)Object.hasOwn(t,r)&&t[r]===void 0&&n.addIssue({code:`custom`,path:[r],message:`Explicit undefined is not valid JSON`})}}let jo=qa([j(),N(),P(),za()]);function Mo(e){let t=/* @__PURE__ */ new WeakSet,n=[{value:e,leaving:!1}];try{for(;n.length>0;){let e=n.pop();if(!e)break;if(e.leaving)t.delete(e.value);else if(typeof e.value==`object`&&e.value!==null){if(t.has(e.value))return!1;t.add(e.value),n.push({value:e.value,leaving:!0});for(let t of Object.values(e.value))n.push({value:t,leaving:!1})}}}catch{return!1}return!0}let No=Do(Mo,{message:`JSON value must not contain circular references`}),Po=To(()=>qa([jo,F(Po),eo(j(),Po)])),Fo=No.pipe(Po);No.pipe(F(Po));let Io=No.pipe(eo(j(),Po)),Lo=L({code:j().min(1),message:j().min(1),retryable:P(),diagnostic:j().min(1).optional(),stage:j().min(1).optional(),durationMs:N().int().nonnegative().optional(),stderrTail:j().min(1).optional()}).superRefine(Ao([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Ro=j().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),zo=e=>j().min(1).max(e).refine(e=>e.trim().length>0),Bo=eo(Ro,I({label:zo(256).optional(),description:zo(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Vo=eo(Ro,zo(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Ho=j().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),V=Ho.brand(),H=Ho.brand(),Uo=Ho.brand();Ho.brand(),Ho.brand();let Wo=j().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Go=Wo.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Ko=I({modes:F(I({id:Go,label:Wo.max(256),description:Wo.max(1024).optional(),dangerous:P().optional(),localizations:Bo.optional()}).strict()).min(1).max(32),defaultModeId:Go}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.modes.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Permission Mode IDs must be unique`,path:[`modes`,r,`id`]}),n.add(i.id);n.has(e.defaultModeId)||t.addIssue({code:`custom`,message:`Default Permission Mode must exist in the catalog`,path:[`defaultModeId`]})});I({threadId:H,permissionModeId:Go}).strict();let U=N().int().safe().nonnegative(),qo=N().finite().nonnegative(),Jo=N().finite().min(0).max(100),Yo=I({value:qo,turnId:j().min(1).max(1024),at:U}).strict();I({outputTokensPerSecond:Yo.optional(),timeToFirstOutputMs:Yo.extend({value:U}).optional()}).strict();let Xo=e=>Vo.refine(t=>Object.values(t).every(t=>t.length<=e)),Zo=I({composerIndicators:F(I({kind:B(`countdown`),id:j().min(1).max(64),expiresAtUnix:U,label:Xo(256).optional(),tooltip:Xo(1024).optional()}).strict()).max(2).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,{message:`Composer indicator IDs must be unique`}).optional(),inputTokens:U.optional(),cachedInputTokens:U.optional(),cacheWriteInputTokens:U.optional(),outputTokens:U.optional(),outputTokensPerSecond:qo.optional(),apiOutputTokensPerSecond:qo.optional(),reasoningOutputTokens:U.optional(),totalTokens:U.optional(),totalCostUsd:qo.optional(),totalCredits:qo.optional(),contextUsagePercent:qo.optional(),cacheHitRatePercent:Jo.optional(),contextWindowTokens:U.optional(),contextUsedTokens:U.optional(),planFiveHourUsedPercent:Jo.optional(),planFiveHourResetsAtUnix:U.optional(),planSevenDayUsedPercent:Jo.optional(),planSevenDayResetsAtUnix:U.optional(),sessionCacheHitRatePercent:Jo.optional(),timeToFirstOutputMs:U.optional(),costSource:z([`publicPrice`,`native`]).optional(),unpricedModels:F(j().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{Object.keys(e).length===0&&t.addIssue({code:`custom`,message:`Thread Usage must contain a reliable field`});let n=e.contextUsedTokens!==void 0;n!==(e.contextWindowTokens!==void 0)&&t.addIssue({code:`custom`,message:`Thread Usage context fields must be provided together`,path:[n?`contextWindowTokens`:`contextUsedTokens`]}),e.contextWindowTokens===0&&t.addIssue({code:`custom`,message:`Thread Usage contextWindowTokens must be greater than zero`,path:[`contextWindowTokens`]}),e.costSource!==void 0&&e.totalCostUsd===void 0&&t.addIssue({code:`custom`,message:`Thread Usage costSource must be provided with totalCostUsd`,path:[`costSource`]}),e.unpricedModels!==void 0&&e.costSource!==`publicPrice`&&t.addIssue({code:`custom`,message:`Thread Usage unpricedModels must be provided with a publicPrice cost`,path:[`unpricedModels`]}),e.planFiveHourResetsAtUnix!==void 0&&e.planFiveHourUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent`,path:[`planFiveHourResetsAtUnix`]}),e.planSevenDayResetsAtUnix!==void 0&&e.planSevenDayUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent`,path:[`planSevenDayResetsAtUnix`]})}),Qo=N().finite().min(0).max(100),$o=z([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),es=I({id:j().min(1).max(256),label:j().min(1).max(256),localizations:Bo.optional()}).strict(),ts=I({product:j().min(1),periodType:$o.optional(),scope:es.optional(),localizations:Bo.optional(),used:N().finite().nonnegative().optional(),limit:N().finite().nonnegative().optional(),unit:j().min(1).max(32).optional(),usagePercent:Qo,resetsAt:j().min(1).optional()}).strict(),ns=I({availableCount:N().int().safe().positive(),nextExpiresAt:j().min(1).optional(),expiresAt:F(j().min(1)).min(1).max(32).optional()}).strict(),rs=I({used:N().finite().nonnegative().optional(),limit:N().finite().nonnegative().optional(),unit:j().min(1).max(32).optional(),label:j().min(1).optional(),scope:es.optional(),localizations:Bo.optional(),usedPercent:Qo,resetsAt:j().min(1).optional(),periodType:$o,productUsage:F(ts).min(1).optional(),resetCredits:ns.optional()}).strict();I({threadId:H,refresh:B(`exact`).optional()}).strict(),I({threadId:H,usage:Zo.nullable(),accountCredits:rs.optional(),accountCreditsSupported:P().optional()}).strict();let is=j().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),as=I({id:is.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),os=is.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),ss=is.max(256),cs=I({id:os,label:is.max(256)}).strict(),ls=I({ref:as,label:is.max(256),resolvedModelLabel:ss.optional(),fastModel:as.optional(),supportedThinkingOptionIds:F(os).optional()}).strict(),us=F(cs).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Thinking option IDs must be unique`,path:[r,`id`]}),n.add(i.id)}),ds=I({models:F(ls),defaultModel:as.optional(),thinkingOptions:us,defaultThinkingOptionId:os.optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set,r=new Set(e.thinkingOptions.map(({id:e})=>e));for(let[i,a]of e.models.entries()){n.has(a.ref.id)&&t.addIssue({code:`custom`,message:`Model Catalog refs must be unique`,path:[`models`,i,`ref`,`id`]}),n.add(a.ref.id),a.fastModel&&((n.has(a.fastModel.id)||e.models.some(e=>e.ref.id===a.fastModel?.id))&&t.addIssue({code:`custom`,message:`Fast Model refs must be distinct and unique`,path:[`models`,i,`fastModel`]}),n.add(a.fastModel.id));let o=/* @__PURE__ */ new Set;for(let[e,n]of(a.supportedThinkingOptionIds??[]).entries())o.has(n)&&t.addIssue({code:`custom`,message:`Supported Thinking option IDs must be unique per Model`,path:[`models`,i,`supportedThinkingOptionIds`,e]}),o.add(n),r.has(n)||t.addIssue({code:`custom`,message:`Supported Thinking option must exist in the catalog`,path:[`models`,i,`supportedThinkingOptionIds`,e]})}e.defaultModel&&!n.has(e.defaultModel.id)&&t.addIssue({code:`custom`,message:`Default Model must exist in the Model Catalog`,path:[`defaultModel`,`id`]}),e.defaultThinkingOptionId&&!r.has(e.defaultThinkingOptionId)&&t.addIssue({code:`custom`,message:`Default Thinking option must exist in the catalog`,path:[`defaultThinkingOptionId`]})}),fs=I({fork:P(),forkAcrossCwd:P(),rollbackLastTurn:P()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),ps=z([`live`,`atCreate`]),ms=I({configuration:I({selectModel:P(),selectThinkingOption:P(),selectPermissionMode:P(),permissionModeScope:ps.default(`live`)}).strict(),history:fs,subagents:I({observe:P(),readTranscript:P()}).strict().optional(),autonomousTurns:I({observe:P()}).strict().optional(),steer:P().optional()}).strict();I({effectiveModel:as.optional(),resolvedModelLabel:ss.optional(),effectiveThinkingOptionId:os.optional(),availableThinkingOptions:us.optional(),effectivePermissionModeId:Go.optional()}).strict().superRefine((e,t)=>{e.effectiveThinkingOptionId&&e.availableThinkingOptions&&!e.availableThinkingOptions.some(({id:t})=>t===e.effectiveThinkingOptionId)&&t.addIssue({code:`custom`,message:`Effective Thinking option must be currently available`,path:[`effectiveThinkingOptionId`]})});let hs=I({open:B(!0)}).strict();qa([I({status:B(`ready`),catalog:ds,permissionModes:Ko.optional(),capabilities:ms,webUi:hs.optional()}).strict().superRefine((e,t)=>{let n=e.capabilities.configuration.selectPermissionMode;n!==!!e.permissionModes&&t.addIssue({code:`custom`,message:`Permission Mode catalog and capability must agree`,path:n?[`permissionModes`]:[`capabilities`,`configuration`,`selectPermissionMode`]})}),I({status:z([`notInstalled`,`unavailable`,`error`]),error:Lo}).strict()]),I({harnessId:V,cwd:is.max(16384).optional(),refresh:P().optional(),purpose:B(`availability`).optional()}).strict(),I({harnessId:V}).strict(),I({}).strict(),I({threadId:H,model:as}).strict(),I({threadId:H,thinkingOptionId:os}).strict(),I({threadId:H,includeReferenceCapability:P().optional()}).strict(),R(`owner`,[I({owner:B(`codex`),locked:P(),effectiveModel:as.optional(),resolvedModelLabel:ss.optional(),effectiveThinkingOptionId:os.optional(),effectivePermissionModeId:Go.optional(),history:fs.optional(),supportsThreadReferences:B(!0).optional()}).strict(),I({owner:B(`external`),harnessId:is.max(256),transportModelId:is.max(1024),effectiveModel:as.optional(),resolvedModelLabel:ss.optional(),effectiveThinkingOptionId:os.optional(),availableThinkingOptions:us.optional(),effectivePermissionModeId:Go.optional(),history:fs,usage:Zo.optional(),locked:B(!0)}).strict()]),I({threadIds:F(H).min(1).max(100)}).strict().superRefine(({threadIds:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i)&&t.addIssue({code:`custom`,message:`Thread ownership-list IDs must be unique`,path:[`threadIds`,r]}),n.add(i)});let gs=R(`owner`,[I({threadId:H,owner:B(`codex`)}).strict(),I({threadId:H,owner:B(`external`),harnessId:j().max(256).pipe(V)}).strict()]);I({threads:F(gs).min(1).max(100)}).strict().superRefine(({threads:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.threadId)&&t.addIssue({code:`custom`,message:`Thread ownership-list results must be unique`,path:[`threads`,r,`threadId`]}),n.add(i.threadId)}),I({threadId:H,text:j().optional()}).strict(),I({kind:B(`application`),value:j().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),l}}).pipe(I({expectedTurnId:Uo,clientUserMessageId:j().min(1),delivery:z([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),z([`activeTurn`,`newTurn`]),I({delivery:z([`official`,`activeTurn`,`newTurn`])}).strict(),I({threadIds:F(j().min(1))}).strict(),I({threadId:j().min(1).max(1024),pinned:P()}).strict(),I({prompt:j().max(16384).optional()}).strict(),I({projects:F(I({id:j(),name:j(),rootPaths:F(j())})),assignments:eo(j(),j()),projectless:F(j()),pinned:F(j())});let _s=eo(j(),Va()),vs=I({epoch:j().uuid(),sequence:N().int().nonnegative()});R(`type`,[I({type:B(`display-settings-changed`),cursor:vs}),I({type:B(`preferences-changed`),cursor:vs,revision:N().int().nonnegative()}),I({type:B(`hello`),version:B(1),cursor:vs,reset:P()}),I({type:B(`changed`),cursor:vs,threadId:j().min(1),method:j().min(1)})]);let ys=R(`type`,[I({type:B(`text`),id:j(),prompt:j(),secret:P().optional(),optional:P().optional()}),I({type:B(`choice`),id:j(),prompt:j(),multiple:P(),allowOther:P(),optional:P().optional(),options:F(I({value:j(),label:j(),description:j().optional()}))})]),bs=R(`type`,[I({type:B(`approval`),title:j(),description:j().optional(),subject:Va().optional(),actions:F(I({id:j(),label:j(),effect:j()}))}),I({type:B(`question`),title:j().optional(),questions:F(ys)})]),xs=I({requestId:qa([j(),N().int()]),threadId:j(),kind:z([`approval`,`question`]),interaction:bs,request:_s}),Ss=I({id:j().min(1),clientUserMessageId:j().min(1),input:F(_s),presentationInput:F(_s).nullable().optional()}).passthrough();I({fields:F(I({path:F(qa([j(),N().int().nonnegative()])),originalLength:N().int().nonnegative()}))});let Cs=I({id:j().min(1),status:j().min(1),items:F(I({id:j().min(1),type:j().min(1)}).passthrough()),codexhostFileOperations:F(I({beforeItemId:j().nullable(),item:I({id:j().min(1),type:j().min(1)}).passthrough()})).optional(),error:I({message:j().optional()}).passthrough().nullable().optional(),fingerprint:j().min(1).optional(),unchanged:B(!0).optional()}).passthrough(),ws=I({id:j().min(1).max(512),fingerprint:j().min(1).max(128)});I({threadId:j().min(1),knownTurns:F(ws).max(64).optional(),truncateToolOutput:P().optional()});let Ts=I({harnessId:j().min(1),nativeSessionId:j().min(1)});I({cursor:vs,activeTurnId:j().min(1).nullable().optional(),command:I({name:j().min(1),turn:Cs}).optional(),thread:I({id:j().min(1),cwd:j(),modelProvider:j().min(1),createdAt:N(),updatedAt:N(),status:I({type:j()}).passthrough(),name:j().nullable().optional(),preview:j().optional(),codexhostImportSource:Ts.optional(),turns:F(Cs).length(0)}).passthrough(),turnsPage:I({data:F(Cs).max(5),nextCursor:j().nullable()}),configuration:I({native:I({model:j().min(1).max(1024).optional(),reasoningEffort:j().min(1).max(128).optional()}).optional(),effectiveModel:as.optional(),effectiveThinkingOptionId:os.optional(),effectivePermissionModeId:Go.optional()}),queue:I({items:F(Ss),pausedReason:z([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:F(xs)}),I({version:B(1),owner:B(`service`).optional(),pid:N().int().positive(),port:N().int().min(1).max(65535),token:j().regex(/^[0-9a-f]{64}$/u),startedAt:N(),epoch:j().uuid()}),I({epoch:j().uuid(),threadId:j().min(1),requestId:qa([j(),N().int()]),result:_s}),I({includeArchived:P().optional(),officialCursor:I({live:j().nullable(),archived:j().nullable().optional()}).strict().optional()}).strict(),I({threads:F(Io),ownership:F(gs),archivedThreadIds:F(H),officialCursor:I({live:j().nullable(),archived:j().nullable().optional()}).strict().optional()}).strict();let Es=j().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);I({available:P()}).strict(),I({path:j().min(1),mimeType:Es}).strict();let Ds=z([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);R(`ok`,[I({ok:B(!0),text:j()}).strict(),I({ok:B(!1),error:I({code:Ds}).strict()}).strict()]);let Os=I({kind:z([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:j().min(1)}).strict(),ks=R(`status`,[I({status:B(`not-installed`)}),I({status:B(`not-running`)}),I({status:B(`not-logged-in`)}),I({status:B(`https-disabled`)}),I({status:B(`not-serving`),command:j()}),I({status:B(`occupied`),target:j()}),I({status:B(`serving`),url:j(),funnel:P()}),I({status:B(`error`),message:j()})]);I({state:ks,error:j().optional()}).strict();let As=R(`status`,[I({status:B(`on`)}),I({status:B(`off`)}),I({status:B(`invalid`),reason:j()})]),js=I({lan:P(),autostart:As}).strict(),Ms=I({expiresAt:j().optional(),issuing:P(),failure:I({detail:j().optional(),retryAt:j(),paused:P()}).optional()}),Ns=R(`status`,[I({status:B(`off`),reason:z([`invite`,`name-taken`,`banned`]).optional()}),I({status:B(`connecting`),reason:z([`full`,`unreachable`]).optional()}),I({status:B(`connected`),url:j(),certificate:Ms}),I({status:B(`missing-certificate`),url:j(),certificate:Ms}),I({status:B(`stopped`),reason:z([`replaced`,`rejected`,`unsupported-version`])})]);j().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i).transform(e=>e.toLowerCase()),j().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let Ps=z([`official`,`self-hosted`]);I({secret:j().min(1),lastUsedAt:N().nullable(),networkUrls:F(Os),directCandidates:F(Os).optional(),tailscale:ks,background:js.optional(),relay:I({state:Ns,enabled:P(),kind:Ps,officialHost:j(),customHost:j().optional(),officialHostname:j().optional(),customHostname:j().optional(),quotaUntil:j().optional()}).strict().optional()}).strict(),I({url:j()}).strict();let Fs=L({threadId:j().min(1).max(1024),view:z([`result`,`messages`]),cursor:j().min(1).max(8192).optional(),limit:N().int().min(1).max(100).optional()}),Is=I({id:j().min(1).max(256),harnessId:j().min(1),label:j().min(1).max(512),provider:z([`openai-codex`,`xai`])}).strict(),Ls=j().regex(/^[a-z][a-z0-9-]{0,47}$/),Rs=I({name:Ls,source:Is,importedAt:j()}).strict(),zs=R(`action`,[I({action:B(`list`)}).strict(),I({action:B(`import`),sourceId:j().min(1).max(256),name:Ls,confirmed:B(!0)}).strict(),I({action:B(`reimport`),sourceId:j().min(1).max(256),name:Ls,confirmed:B(!0)}).strict(),I({action:B(`remove`),name:Ls,confirmed:B(!0)}).strict()]),Bs=I({provider:j().min(1).max(128),type:z([`oauth`,`api_key`,`unknown`]),label:j().min(1).max(512).optional(),vendor:z([`openai-codex`,`xai`]).optional()}).strict();I({sources:F(Is),targets:F(I({harnessId:j(),providers:F(z([`openai-codex`,`xai`])),imports:F(Rs),others:F(Bs).default([])}).strict())}).strict(),I({targetHarnessId:j().min(1).max(128).optional(),request:zs}).strict(),I({events:P()});let Vs=F(L({agent:j().min(1).max(128),section:z([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);L({entries:Vs.nullable()}),L({}),L({entries:Vs,initializeOnly:P().optional()});let Hs=L({enabled:P(),timeoutMinutes:N().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let Us=j().regex(/^external$/u),Ws=V.transform(e=>String(e)),Gs=L({model:as.optional(),thinkingOptionId:os.optional(),permissionModeId:Go.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),Ks=L({lastHarness:V.optional(),byHarness:eo(Ws,Gs)}),qs=j().min(1).max(1024),Js=L({idleRelease:Hs.optional(),favorites:eo(Ws,F(qs).max(2048)).default({}),newThread:Ks.optional()});L({scope:Us,revision:N().int().nonnegative(),values:Js}),L({scope:Us.default(`external`)});let Ys=R(`kind`,[L({kind:B(`idleRelease`),value:Hs}),L({kind:B(`favorite`),harnessId:V,modelId:qs,enabled:P()}),L({kind:B(`favorites`),harnessId:V,modelIds:F(qs).max(2048)}),L({kind:B(`newThread`),lastHarness:V.optional(),harnessId:V.optional(),configuration:Gs.optional()})]);L({scope:Us.default(`external`),operations:F(Ys).min(1).max(256),initializeOnly:P().optional(),expectedRevision:N().int().nonnegative().optional()}).superRefine((e,t)=>{for(let n of e.operations)n.kind===`newThread`&&(!n.lastHarness&&!n.configuration||!!n.harnessId!=!!n.configuration)&&t.addIssue({code:`custom`,message:`A default Harness or complete configuration is required`})}),L({version:B(1),revision:N().int().nonnegative(),scopes:eo(Us,Js)});let Xs=N().finite().nonnegative(),Zs=L({input:Xs,output:Xs,cacheRead:Xs.optional(),cacheWrite:Xs.optional(),cacheWrite1h:Xs.optional()}),Qs=j().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);L({path:j(),entries:F(L({key:j(),price:Zs})),error:j().nullable()}),L({}),L({key:Qs,price:Zs.nullable(),previousKey:Qs.optional()}),L({model:Qs});let $s=L({official:P().optional(),canonicalModelId:j().min(1).optional(),provider:j().min(1).max(512),model:j().min(1).max(512),price:Zs});L({price:Zs.nullable(),suggestions:F($s).max(6).optional()});let ec=[`today`,`7d`,`30d`,`90d`,`all`],W=N().int().min(0).max(2**53-1),tc=j().regex(/^\d{4}-\d{2}-\d{2}$/u),nc=j().min(1).max(128),rc=j().min(1).max(512),ic=j().min(1).max(4096);L({range:z(ec),timeZone:j().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:nc.optional(),model:rc.nullable().optional(),project:ic.nullable().optional(),date:tc.optional()});let ac=L({requests:W,inputTokens:W,cachedInputTokens:W,cacheWriteInputTokens:W,cacheKnownInputTokens:W,cacheHitCachedInputTokens:W,cacheHitInputTokens:W,outputTokens:W,reasoningOutputTokens:W,costUsd:N().finite().min(0),unpricedRequests:W,unmeteredRequests:W}),oc=ac.shape,sc=L({harness:nc,sessionId:j().min(1).max(512),project:ic.nullable(),title:j().min(1).max(200).optional(),models:F(rc).max(16),firstAtMs:W,lastAtMs:W,...oc});L({range:z(ec),from:tc.nullable(),to:tc,filters:L({harness:nc.nullable(),model:rc.nullable(),unknownModel:P(),project:ic.nullable(),unknownProject:P(),date:tc.nullable()}),reading:L({complete:P(),sources:W,read:W}),failures:F(L({harness:nc,message:j().max(2048)})).max(256),options:L({harnesses:F(nc).max(256),models:F(rc.nullable()).max(4096),projects:F(ic.nullable()).max(4096)}),modelLabels:F(L({harness:nc,model:rc,label:rc})).max(4096).optional(),credits:F(L({harness:nc,model:rc.nullable(),credits:N().finite().min(0),reportedRequests:W,requests:W})).max(4096).optional(),totals:ac,daily:F(L({date:tc,harness:nc,...oc})).max(2e5),hourly:F(L({weekday:N().int().min(0).max(6),hour:N().int().min(0).max(23),...oc})).max(168),byHarness:F(L({harness:nc,...oc})).max(256),byModel:F(L({model:rc.nullable(),...oc,harnessPricedRequests:W})).max(4096),byProject:F(L({project:ic.nullable(),...oc})).max(4096),sessions:F(sc).max(100),recentSessions:F(sc).max(100).optional()}),I({threadId:H}),I({discarded:P()});let cc=R(`type`,[I({id:j().min(1),type:B(`choice`),prompt:j(),options:F(I({value:j().min(1),label:j(),description:j().optional()})).min(1),multiple:P(),allowOther:P(),optional:P()}),I({id:j().min(1),type:B(`text`),prompt:j(),multiline:P(),secret:B(!1),optional:P(),placeholder:j().optional(),prefill:j().optional()})]),lc=I({interactionId:j().min(1),turnId:j().min(1),title:j().optional(),questions:F(cc).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});L({threadId:j().min(1)}),I({questions:F(lc)}),L({threadId:j().min(1),turnId:j().min(1),interactionId:j().min(1),answers:eo(j(),F(j())),cancelled:P().default(!1)}),I({accepted:B(!0)});let uc=I({path:j(),oldText:j().nullable(),newText:j()});I({sessionId:j().min(1),turn:N().int().nonnegative(),path:j().min(1).optional()}),I({diffs:F(uc)}),L({}),L({});let dc=I({reference:I({sessionId:j().min(1),epoch:j().min(1),turn:N().int().nonnegative(),seq:N().int().nonnegative(),callId:j().min(1),part:N().int().nonnegative(),version:j().min(1)}),length:N().int().nonnegative(),bytes:N().int().nonnegative()});function fc(e){if(typeof e!=`object`||!e||!(`codexhostOutput`in e))return[];let t=F(dc).safeParse(e.codexhostOutput);return t.success?t.data:[]}L({title:j().trim().min(1).max(200),type:z([`info`,`warning`,`danger`]),body:j().trim().min(1).max(16384)}),L({}),L({url:j().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/web-ui/open.codexhost/harness/accounts/sources.codexhost/harness/accounts/list.codexhost/harness/accounts/inspect.codexhost/harness/credential-imports.codexhost/harness/session-import/sources.codexhost/harness/session-import/list.codexhost/harness/session-import/import.codexhost/account/list.codexhost/account/refresh.codexhost/account/usage/inspect.codexhost/usage/model-prices/get.codexhost/usage/model-prices/set.codexhost/usage/model-prices/default.codexhost/usage/statistics/get.codexhost/update/check.codexhost/update/start.codexhost/update/status`.split(`.`));let pc=z([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),mc=z([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);L({threadId:j(),title:j(),harnessId:j(),state:pc,reason:mc,inactiveMs:N().nonnegative()}),L({threadId:H,turnId:Uo});let hc=I({amount:N().finite().nonnegative(),currency:j().trim().min(1).max(8),label:j().trim().min(1).max(128).optional()}).strict(),gc=I({email:j().trim().min(1).max(320).optional(),label:j().trim().min(1).max(256).optional(),plan:j().trim().min(1).max(128).optional(),credits:rs.optional(),balance:hc.optional()}).strict();function _c(e){return e.refine(e=>{let t=e;return t.credits!==void 0||t.balance!==void 0},{message:`Account must report either credits or a balance`})}let vc=_c(gc),yc={harnessId:V,harnessName:j().trim().min(1).max(128)},bc=I(yc).strict();I({}).strict(),I({sources:F(bc).max(128)}).strict(),I({harnessId:V,refresh:P().optional()}).strict(),I({...yc,account:vc.nullable(),accounts:F(vc).max(8).optional()}).strict(),I({refresh:P().optional()}).strict(),I({accounts:F(_c(gc.extend(yc))).max(128)}).strict();let xc=j().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(V),Sc=xc.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Cc=j().min(1).max(512).refine(e=>!/[\\\u0000:#?]/u.test(e)&&!e.startsWith(`/`)&&!e.split(`/`).some(e=>e===`..`||e===``),`Plugin resources must be relative paths inside the plugin`),wc=va().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Tc=I({en:j().max(4096),"zh-CN":j().max(4096).optional()}).strict(),Ec=I({commands:F(I({terminal:j().max(256),command:j().max(4096)}).strict()).max(8),before:Tc.optional(),after:Tc.optional(),downloads:F(I({label:j().max(128),url:wc}).strict()).max(8).optional()}).strict(),Dc={id:xc,name:j().trim().min(1).max(128),version:j().min(1).max(128),kind:B(`usage`).optional(),iconStyle:I({vector:I({viewBox:j().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:j().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:F(I({d:j().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:z([`evenodd`,`nonzero`]).optional(),fill:j().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:j().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:N().min(0).max(50).optional(),paddingRatio:N().min(0).max(.25).optional()}).strict().optional(),installation:Ec.optional(),notice:Tc.optional(),launchCommand:B(!0).optional(),links:I({website:wc.optional(),documentation:wc.optional(),installation:wc.optional()}).strict().optional()};I({manifestVersion:B(1),...Dc,adapterApiVersion:N().int().positive(),entry:Cc,icon:Cc.optional()}).strict();let Oc=j().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),kc=I({...Dc,icon:Oc.optional()}).strict();I({}).strict(),I({plugins:F(kc.extend({id:Sc})).max(128)}).strict(),I({version:B(1),enabled:F(xc).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),I({harnessId:Sc,model:as.optional(),thinkingOptionId:os.optional(),permissionModeId:Go.optional(),prewarm:B(!0).optional()}).strict();let Ac=j().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);I({harnessId:Sc}).strict().extend({path:Ac.nullable()}),I({path:Ac.nullable(),restartRequired:P()}).strict(),I({harnessId:V,action:z([`check`,`update`,`install`])}).strict();let jc=I({currentVersion:j().min(1).max(128),latestVersion:j().min(1).max(128),updateAvailable:P(),canUpdate:P(),versionKind:z([`cli`,`application`]).optional(),manualUpdateUrl:va().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:j().max(2048).optional(),messageCode:j().min(1).max(128).optional(),notice:Vo.optional(),latestVersionKind:z([`unknown`,`tracking-branch`]).optional()}).strict();I({taskId:j().uuid()}).strict(),R(`status`,[I({taskId:j().uuid(),status:B(`running`)}).strict(),I({taskId:j().uuid(),status:B(`succeeded`),result:jc}).strict(),I({taskId:j().uuid(),status:B(`failed`),error:I({code:N().int(),message:j().min(1).max(2048)}).strict()}).strict()]);let Mc=j().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Nc=j().trim().min(1),Pc=z([`free`,`go`,`plus`,`pro`,`prolite`,`team`,`self_serve_business_prolite`,`self_serve_business_usage_based`,`business`,`ent26`,`enterprise_cbp_automation`,`enterprise_cbp_usage_based`,`enterprise`,`edu`,`edu_plus`,`edu_pro`,`unknown`]),Fc=I({accountId:Mc,label:Nc.max(256),email:j().email().max(320).optional(),planType:Pc.optional()}).strict(),Ic=z([`ready`,`unavailable`]);I({version:B(2),currentAccountId:Mc.nullable(),phase:Ic,revision:N().int().nonnegative(),instanceId:Nc.max(1024).optional(),accounts:F(Fc).max(1)}).strict(),I({accountId:Mc,refresh:P().optional()}).strict(),I({accountId:Mc,usage:Zo.nullable(),accountCredits:rs.optional(),freshness:z([`live`,`cached`]),observedAt:j().datetime().nullable()}).strict();let Lc=1e3,Rc=j().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),zc=Rc.max(1024),Bc=I({nativeSessionId:zc,title:Rc.max(4096).nullable(),updatedAt:N().int().nonnegative().max(864e13),cwd:Rc.max(16384),running:P().nullable()}).strict();I({}).strict(),I({harnesses:F(I({harnessId:Sc,name:Rc.max(128)}).strict()).max(128)}).strict(),I({harnessId:Sc,query:j().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:N().int().nonnegative().safe().optional(),limit:N().int().min(1).max(Lc).optional()}).strict(),I({candidates:F(Bc).max(Lc),total:N().int().nonnegative().safe()}).strict(),I({harnessId:Sc,nativeSessionId:zc}).strict(),I({threadId:Rc.max(1024).pipe(H)}).strict();let Vc=j().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Hc=zc,Uc=Bc;I({}).strict(),I({candidates:F(Uc).max(1e3)}).strict(),I({nativeSessionId:Hc}).strict(),I({threadId:Vc.max(1024).pipe(H)}).strict(),I({threadId:H,lastTurnId:Uo}).strict(),I({threadId:H}).strict();let Wc=j().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();I({commands:F(I({id:Wc,invocation:j().min(1).max(128),label:j().trim().min(1).max(128),description:j().trim().min(1).max(512).optional(),localizations:Bo.optional(),argumentMode:z([`none`,`text`]),kind:z([`command`,`skill`]).optional()}).strict()),warnings:F(j().min(1)).optional(),source:z([`live`,`static`]).optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.commands.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Harness command IDs must be unique`,path:[`commands`,r,`id`]}),n.add(i.id)}),I({harnessId:V,cwd:j().min(1).optional()}).strict(),I({threadId:H}).strict(),I({threadId:H,commandId:Wc,turnId:Uo.optional(),arguments:Io.optional()}).strict(),I({accepted:B(!0),turnId:Uo.optional()}).strict();let Gc=B(`2.0`).optional(),Kc=Ua().optional(),qc=j().min(1),Jc=qa([j(),N().int()]),Yc=I({code:N().int(),message:j(),data:Fo.optional()}).catchall(Fo).superRefine(Ao([`data`]));qa([I({jsonrpc:Gc,id:Jc,method:qc,params:Fo.optional(),result:Kc,error:Kc}).catchall(Fo).superRefine(Ao([`jsonrpc`,`params`,`result`,`error`])),I({jsonrpc:Gc,id:Kc,method:qc,params:Fo.optional(),result:Kc,error:Kc}).catchall(Fo).superRefine(Ao([`jsonrpc`,`id`,`params`,`result`,`error`])),I({jsonrpc:Gc,id:Jc,method:Kc,params:Kc,result:Fo,error:Kc}).catchall(Fo).superRefine(Ao([`jsonrpc`,`method`,`params`,`error`])),I({jsonrpc:Gc,id:Jc,method:Kc,params:Kc,result:Kc,error:Yc}).catchall(Fo).superRefine(Ao([`jsonrpc`,`method`,`params`,`result`]))]);let Xc=j().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});L({harnessId:V,nativeSessionId:Xc,locator:Fo.optional(),formatVersion:B(1)}).superRefine(Ao([`locator`])),L({harnessId:V,nativeSessionId:Xc,nativeTurnKey:Xc,formatVersion:B(1)}),L({harnessId:V,nativeSessionId:Xc,checkpointId:Xc,locator:Fo.optional(),formatVersion:B(1)}).superRefine(Ao([`locator`]));let Zc=j().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),Qc=z([`npm`,`windows-installer`,`macos-dmg`]),$c=L({version:Zc,installation:Qc,phase:z([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),updatedAt:N().int().nonnegative(),downloadedBytes:N().int().nonnegative().optional(),totalBytes:N().int().positive().optional(),error:j().min(1).max(500).nullable(),serviceStopOutput:j().optional()}).superRefine((e,t)=>{e.downloadedBytes!==void 0&&e.totalBytes!==void 0&&e.downloadedBytes>e.totalBytes&&t.addIssue({code:`custom`,path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`})});L({});let el=j().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);L({currentVersion:Zc,installation:Qc.nullable(),latestVersion:Zc.nullable(),updateAvailable:P(),installationAvailable:P(),releaseNotes:j().min(1).max(2e4).nullable(),releaseNotesUrl:el.nullable(),status:$c.nullable(),error:j().min(1).max(500).nullable()}),L({status:$c}),L({status:$c.nullable()});let tl=z([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);I({runningVersion:j().nullable(),installedVersion:j().nullable(),restartRequired:P(),remote:P(),updateSupported:P(),update:I({phase:tl,targetVersion:j().nullable(),error:j().nullable()})});let nl=I({version:j().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();I({hostname:j().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:N().int().min(1).max(65535).nullable(),identity:j().max(4096).nullable(),action:z([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:P().optional(),version:j().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),I({state:z([`installed`,`not-installed`])}).strict();let rl=j().min(1).max(1024),il=I({hostId:rl,displayName:j().min(1).max(1024),source:z([`codex-managed`,`discovered`]),sshAlias:j().max(1024).nullable(),sshHost:j().min(1).max(1024),sshPort:N().int().min(1).max(65535).nullable(),identity:j().max(4096).nullable(),autoConnect:P(),connectionAnalyticsId:j().max(1024).optional()}),al=L({displayName:j().min(1).max(1024),hostname:j().min(1).max(1024),sshPort:N().int().min(1).max(65535).nullable(),identity:j().max(4096).nullable()});R(`action`,[L({action:B(`list`)}),L({action:B(`read-thread`),hostId:rl.refine(e=>e!==`local`),input:Fs}),L({action:B(`save`),draft:al,previous:il.nullable()}),L({action:B(`remove`),previous:il}),L({action:B(`connect`),hostId:rl,enabled:P()}),L({action:B(`state`),hostId:rl}),L({action:B(`runtime`),hostId:rl}),L({action:B(`update`),hostId:rl.refine(e=>e!==`local`),version:nl.shape.version})]),qa([L({result:Fo}),L({error:L({code:N().int(),message:j()})})]);let ol=j().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),sl=qa([j(),I({en:j()}).catchall(j())]),cl=I({title:sl.optional(),description:sl.optional(),icon:j().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:j().optional()});I({extensions:F(I({id:ol,name:j().min(1).max(214),version:j().min(1).max(128),format:B(`dsh`),supportedTargets:Qa([B(`web`)]),enabledTargets:F(B(`web`)).max(1),source:j().min(1).max(4096),projectUrl:j().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:j(),meta:cl.optional(),loadError:j().optional()})),loadedIds:F(ol),safeMode:P(),storeError:j().optional()});let ll=j().trim().max(2048).url({protocol:/^https?$/u,normalize:!0}).refine(e=>!/[\s\\?#]/u.test(e)&&!e.split(`/`)[2]?.includes(`@`),`Use an HTTP(S) registry URL without credentials, a query, or a fragment.`).transform(e=>e.endsWith(`/`)?e:`${e}/`);I({spec:j().trim().min(1).max(4096),registry:ll.optional()}).strict(),I({id:ol,enabled:P()}).strict(),I({id:ol}).strict(),B(1);function ul({block:e,previews:t,read:n,useDisclosure:o,t:s,children:c}){let l=o(),[u,d]=(0,r.useState)(),[f,p]=(0,r.useState)(!1),[m,h]=(0,r.useState)(!1),[g,_]=(0,r.useState)(),v=Math.ceil(t.reduce((e,t)=>e+t.bytes,0)/1024);async function y(){if(u)return u;h(!0),_(void 0);try{let r=await Promise.all(t.map(({reference:e})=>n(e))),i=new Map(t.map((e,t)=>[e.reference.part,r[t]])),a={...e,content:e.content.map((e,t)=>e.type===`text`&&i.has(t)?{...e,text:i.get(t)}:e)};return d(a),a}catch(e){throw _(typeof e==`object`&&e&&`code`in e&&e.code===`session/tool-output-stale`?s(`tool.output.stale`):s(`tool.output.failed`)),e}finally{h(!1)}}async function ee(){try{await y(),l.setExpanded(!0),p(!0)}catch{return}}async function b(){return(await y()).content.map(e=>e.type===`text`?e.text:``).join(`
|
|
123
123
|
`)}return/* @__PURE__ */ (0,a.jsxs)(`div`,{"data-tool-output-preview":!0,children:[c(f&&u?u:e,b,()=>l),!f&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`ghost`,size:`sm`,disabled:m,onClick:()=>void ee(),children:m?s(`tool.output.loading`):g?s(`tool.output.retry`):s(`tool.output.showFull`,{size:String(v)})}),m&&/* @__PURE__ */ (0,a.jsx)(`span`,{role:`status`,children:s(`tool.output.loading`)}),g&&/* @__PURE__ */ (0,a.jsx)(`p`,{role:`alert`,children:g})]})}function dl(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function fl(e){return e.startsWith(`/`)||dl(e)}function pl(e,t){if(fl(t)||e===void 0||e===``)return t;let n=dl(e)&&e.includes(`\\`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t.replace(/^[/\\]+/,``)}`}function ml(e,t){if(t===void 0||t===``||dl(e)||dl(t))return e;let n=t.replace(/\/+$/,``);return n===``||n===`/`?e:e.replace(/\/+$/,``)===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function hl(e,t){if(t===void 0||t===``)return e;let n=t.replace(/[/\\]+$/,``);return e.startsWith(`${n}/`)||e.startsWith(`${n}\\`)?e.slice(n.length+1):e}let gl={search:`tool.title.search`,read:`tool.title.read`,bash:`tool.title.bash`,write:`tool.title.write`,edit:`tool.title.edit`,code:`tool.title.code`,others:`tool.title.generic`},_l={bash:`bash`,pwsh:`bash`,read:`read`,read_image:`read`,web_fetch:`read`,web_search:`search`,grep:`search`,glob:`search`,write:`write`,edit:`edit`,run_code:`code`,cordis_package_inspect:`read`,cordis_runtime_inspect:`read`,cordis_run:`others`,cordis_stop:`others`,cordis_undefine:`others`},vl={cordis_package_inspect:`tool.title.inspect`,cordis_runtime_inspect:`tool.title.inspect`,cordis_run:`tool.title.runCordis`,cordis_stop:`tool.title.stopCordis`,cordis_undefine:`tool.title.removeCordis`,pwsh:`tool.title.pwsh`,read_image:`tool.title.readImage`,todo_write:`todo.rowTitle`,ask_user_question:`ask.rowTitle`,create_goal:`tool.title.createGoal`,get_goal:`tool.title.getGoal`,update_goal:`tool.title.updateGoal`,schedule_create:`tool.title.createSchedule`,schedule_list:`tool.title.listSchedules`,schedule_delete:`tool.title.deleteSchedule`,schedule_update:`tool.title.updateSchedule`,cordis_inspect_list:`tool.title.inspectProviders`,cordis_inspect_query:`tool.title.queryRuntime`,cordis_inspect_self:`tool.title.inspectPlugins`,workflow:`tool.title.workflow`,ralph:`tool.title.ralph`,session_event_read:`tool.title.readEvent`,session_event_search:`tool.title.searchEvents`,session_event_trace:`tool.title.traceEvent`,session_search:`tool.title.searchSessions`,session_trace:`tool.title.traceSession`,list_subagent_models:`tool.title.listModels`,subagent:`tool.title.subagent`,list_agents:`tool.title.listAgents`,send_message:`tool.title.sendMessage`,interrupt_agent:`tool.title.interruptAgent`,job_list:`tool.title.listJobs`,job_output:`tool.title.readJob`,job_kill:`tool.title.killJob`,terminal_open:`tool.title.openTerminal`,terminal_read:`tool.title.readTerminal`,terminal_list:`tool.title.listTerminals`,terminal_signal:`tool.title.signalTerminal`,terminal_close:`tool.title.closeTerminal`,lsp:`tool.title.lsp`,spawn_teammate:`tool.title.spawnTeammate`,team_task_create:`tool.title.createTeamTask`,team_task_get:`tool.title.getTeamTask`,team_task_update:`tool.title.updateTeamTask`,team_task_list:`tool.title.listTeamTasks`,wait_agent:`tool.title.waitAgent`};function yl(e){return _l[e]??`others`}function bl(e){return vl[e]??gl[yl(e)]}function xl(e){if(!(`kind`in e)||!e.isError)return null;let t=e.error;return t?.name!==`AutoReviewDeniedError`||t.code!==`AUTO_REVIEW_DENIED`?null:{reason:typeof t.reason==`string`?t.reason:null}}function Sl(e){let t=[];for(let n of e.content)n.type===`text`?t.push(n.text):t.push(JSON.stringify(n,null,2));return t.length===0&&e.error!==void 0&&t.push(`${e.error.name}: ${e.error.code}`),t.join(`
|
|
124
124
|
`)}function Cl(e){try{return JSON.parse(e)}catch{return}}function wl(e){let t=e.indexOf(`
|
|
125
125
|
`);return t===-1?e:e.slice(0,t)}function Tl(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t!==``)return t}}let El={bash:[`description`,`command`],read:[`path`,`file_path`,`url`],search:[`query`,`pattern`,`url`],write:[`path`,`file_path`],edit:[`path`,`file_path`],code:[`description`],others:[]};function Dl(e,t){let n=Cl(t);if(typeof n!=`object`||!n)return wl(t);let r=n;if(e===`search`&&Array.isArray(r.queries)){let e=r.queries.filter(e=>typeof e==`string`&&e!==``);if(e.length>0)return e.map(wl).join(`, `)}let i=Tl(r,El[e]);if(i!==void 0)return wl(i);for(let e of Object.values(r))if(typeof e==`string`&&e!==``)return wl(e);return wl(t)}let Ol=[`path`,`file_path`],kl=/* @__PURE__ */ new Set([`read`,`write`,`edit`]);function Al(e,t,n,r){if(kl.has(e)){let e=t.complete(`file_path`)?t.text(`file_path`):void 0,i=e!==void 0&&e!==``&&t.complete(`file_path`)?wl(e):void 0;return{summary:i===void 0?``:ml(hl(i,n),r),filePath:i}}let i=t.text(`description`);return{summary:i===void 0?``:wl(i),filePath:void 0}}function jl(e,t){if(!kl.has(e))return;let n=Cl(t);if(typeof n!=`object`||!n)return;let r=Tl(n,Ol);return r===void 0?void 0:wl(r)}function Ml(e,t){if(t===``)return null;let n=Cl(t);if(n===void 0)return t;if(e===`code`&&typeof n==`object`&&n){let e=n.code;if(typeof e==`string`&&e!==``)return e}return JSON.stringify(n,null,2)}function Nl(e,t,n,r){let i=yl(e),a=bl(e),o=`kind`in t,s=o?t.call?.argsRaw??``:t.phase===`start`?t.argsRaw:null,c=o?t.error?.code===`interrupted`?`stopped`:t.isError?`error`:`ok`:t.phase===`preparing`?`preparing`:`running`,l=Al(i,t.args,n,r),u=l.summary!==``||s===null?l.summary:s===``?t.callId:ml(hl(Dl(i,s),n),r),d=[a===`tool.title.generic`?e:``,u].filter(Boolean).join(` · `),f=o&&Sl(t)||null,p=c===`error`&&f!==null?wl(f):null,m=s===``?null:s;return{variant:i,titleKey:a,summary:d,filePath:l.filePath??(s===null?void 0:jl(i,s)),bodyRaw:m,output:f,errorSummary:p,autoReviewDenial:xl(t),state:c}}let Pl=/* @__PURE__ */ new WeakMap;function G(e){if(!(`kind`in e)&&e.phase===`preparing`)return null;let t=Pl.get(e);if(t!==void 0||Pl.has(e))return t??null;let n=`kind`in e?e.call:e;if(n===null)return Pl.set(e,null),null;let r;try{r=JSON.parse(n.argsRaw)}catch{return Pl.set(e,null),null}if(typeof r!=`object`||!r||Array.isArray(r))return Pl.set(e,null),null;let i={name:n.name,args:r};return Pl.set(e,i),i}function Fl(e){if(e.content.length!==1)return;let t=e.content[0];return t?.type===`text`?t.text:void 0}function Il(e){return typeof e==`number`&&Number.isInteger(e)&&e>=1}function Ll(e){let t=G(e);if(t?.name!==`read`)return!1;let{file_path:n,offset:r,limit:i}=t.args;return!(typeof n!=`string`||n.trim()===``||r!==void 0&&!Il(r)||i!==void 0&&!Il(i))}function Rl(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let{path:t,offset:n,lines:r,totalLines:i,lang:a}=e;if(typeof t!=`string`||typeof n!=`number`||!Number.isInteger(n)||n<1||typeof i!=`number`||!Number.isInteger(i)||i<0||!Array.isArray(r)||a!==void 0&&typeof a!=`string`)return null;let o=[],s=n-1;for(let e of r){if(typeof e!=`object`||!e||Array.isArray(e))return null;let{number:t,text:n}=e;if(typeof t!=`number`||!Number.isInteger(t)||t<1||t<=s||t>i||typeof n!=`string`)return null;s=t,o.push({number:t,text:n})}return{path:t,offset:n,lines:o,totalLines:i,...a===void 0?{}:{lang:a}}}function zl(e){if(!Ll(e))return;let{offset:t}=G(e)?.args??{};return Il(t)?t:void 0}function Bl(e,t,n){if(e.parentCallId!==void 0||!(`kind`in e)||e.isError||!Ll(e))return null;let r=Rl(e.meta);if(r===null)return null;let i=Fl(e);return i===void 0||/^<path>[^\n]*<\/path>\n<type>file<\/type>\n<content>\n([\s\S]*)\n<\/content>$/u.exec(i)?.[1]===void 0?null:{label:ml(hl(r.path,t),n),lines:r.lines,totalLines:r.totalLines,lang:r.lang}}function Vl(e){if(!Array.isArray(e)||e.length===0)return null;let t=[];for(let n of e){if(typeof n!=`object`||!n)return null;let{path:e,oldText:r,newText:i}=n;if(typeof e!=`string`||r!==null&&typeof r!=`string`||typeof i!=`string`)return null;t.push({path:e,oldText:r,newText:i})}return t}function Hl(e){let t=G(e);if(t===null)return null;if(t.name===`str_replace_editor`){let{command:e,path:n,file_text:r,old_str:i,new_str:a}=t.args;return typeof n!=`string`||n.trim()===``?null:e===`create`?r!==void 0&&typeof r!=`string`?null:{tool:`str_replace_editor`,diff:{path:n,oldText:null,newText:r??``}}:e===`str_replace`?i!==void 0&&typeof i!=`string`||a!==void 0&&typeof a!=`string`?null:{tool:`str_replace_editor`,diff:{path:n,oldText:i??null,newText:a??``}}:null}let n=typeof t.args.file_path==`string`?t.args.file_path:t.args.path;if(typeof n!=`string`||n.trim()===``)return null;if(t.name===`write`){let{content:e}=t.args;return typeof e==`string`?{tool:`write`,diff:{path:n,oldText:null,newText:e}}:null}if(t.name!==`edit`)return null;let{old_string:r,new_string:i,replace_all:a}=t.args;return typeof r!=`string`||typeof i!=`string`||a!==void 0&&typeof a!=`boolean`?null:{tool:`edit`,diff:{path:n,oldText:r||null,newText:i}}}function Ul(e){if(typeof e!=`object`||!e)return null;let t=e,n=typeof t.path==`string`?t.path:typeof t.file_path==`string`?t.file_path:``;return n.trim()===``?null:t.kind===`add`||typeof t.content==`string`&&t.old_string===void 0?{path:n,oldText:null,newText:typeof t.content==`string`?t.content:typeof t.new_string==`string`?t.new_string:``}:typeof t.old_string==`string`&&typeof t.new_string==`string`?{path:n,oldText:t.old_string||null,newText:t.new_string}:null}function Wl(e){let t=G(e);if(t===null)return null;if(t.name===`str_replace_editor`){let t=Hl(e);return t===null?null:{tool:t.tool,diffs:[t.diff]}}if(t.name!==`edit`&&t.name!==`write`)return null;if(Array.isArray(t.args.files)&&t.args.files.length>0){let e=[];for(let n of t.args.files){let t=Ul(n);if(t===null)return null;e.push(t)}return{tool:t.name,diffs:e}}let n=Hl(e);return n===null?null:{tool:n.tool,diffs:[n.diff]}}function Gl(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e.diffs;return Array.isArray(t)?t.length===0?`empty`:Vl(t):null}function Kl(e){if(e.parentCallId!==void 0)return null;let t=Wl(e);if(!(`kind`in e))return t===null?null:{card:{diffs:t.diffs}};if(t?.tool===`str_replace_editor`||e.isError)return null;let n=Gl(e.meta);return n!==null&&n!==`empty`?{card:{diffs:n}}:t===null?null:t.tool===`write`?{card:{diffs:t.diffs}}:null}function ql(e){let t=G(e);if(t===null)return null;let{pattern:n,path:r}=t.args;if(typeof n!=`string`||t.name===`grep`&&n===``||t.name===`glob`&&n.trim()===``||t.name!==`grep`&&t.name!==`glob`||r!==void 0&&(typeof r!=`string`||r.trim()===``))return null;if(t.name===`grep`){let{include:e}=t.args;if(e!==void 0&&(typeof e!=`string`||!Jl(e)))return null}return t.name}function Jl(e){if(e.trim()===``||e.startsWith(`!`))return!1;let t=0;for(let n of e)if(n===`{`)t+=1;else if(n===`}`)t=Math.max(0,t-1);else if(n===`,`&&t===0)return!1;return!0}function Yl(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(typeof n!=`object`||!n||Array.isArray(n))return null;let{path:e,matches:r}=n;if(typeof e!=`string`||!Array.isArray(r))return null;let i=[];for(let e of r){if(typeof e!=`object`||!e||Array.isArray(e))return null;let{lineNumber:t,line:n}=e;if(typeof t!=`number`||!Number.isInteger(t)||t<1||typeof n!=`string`)return null;i.push({lineNumber:t,line:n})}t.push({path:e,matches:i})}return t}function Xl(e){let t=e.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|