@karlorz/codexhost-cli-darwin-x64 0.21.0-1 → 0.22.0-1

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.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +1 -0
  4. package/app/console-web.js +2 -1
  5. package/app/cpa-live-voice-hook.js +213 -181
  6. package/app/desktop-controller.mjs +4 -1
  7. package/app/host-runtime.mjs +96 -26
  8. package/app/overlay-voice-bootstrap.js +1 -1616
  9. package/app/plugins/antigravity/plugin.mjs +1144 -1254
  10. package/app/plugins/claude-code/plugin.mjs +389 -80
  11. package/app/plugins/codebuddy/plugin.mjs +1 -0
  12. package/app/plugins/codex-usage/plugin.mjs +1 -0
  13. package/app/plugins/copilot/plugin.mjs +1 -0
  14. package/app/plugins/cursor-cli/plugin.mjs +1 -0
  15. package/app/plugins/deepseek-harness/plugin.mjs +1 -0
  16. package/app/plugins/devin/plugin.mjs +1 -0
  17. package/app/plugins/grok/plugin.mjs +232 -217
  18. package/app/plugins/hermes/plugin.mjs +1 -0
  19. package/app/plugins/kimi-code/plugin.mjs +1 -0
  20. package/app/plugins/kiro-cli/plugin.mjs +1 -0
  21. package/app/plugins/omp/plugin.mjs +108 -22
  22. package/app/plugins/opencode/plugin.mjs +1 -0
  23. package/app/plugins/pi/plugin.mjs +119 -23
  24. package/app/plugins/qoder/plugin.mjs +1 -0
  25. package/app/plugins/qoder-cn/plugin.mjs +1 -0
  26. package/app/plugins/qwen-code/plugin.mjs +1 -0
  27. package/app/plugins/workbuddy/plugin.mjs +1 -0
  28. package/app/plugins/zcode/plugin.mjs +1 -0
  29. package/app/renderer-extension.js +764 -477
  30. package/app/voice-qualification.json +10 -10
  31. package/app/web/assets/index-CYo5zTz_.js +201 -0
  32. package/app/web/codexhost-settings.js +2 -1
  33. package/app/web/index.html +1 -1
  34. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +3 -3
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +9 -9
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +2 -2
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +1 -1
  40. package/app/web-modules/server.mjs +130 -74
  41. package/bin/codexhost +0 -0
  42. package/libexec/codexhost-shim +0 -0
  43. package/libexec/codexhost-updater +0 -0
  44. package/package.json +1 -1
  45. package/app/web/assets/index-DLXdvkWR.js +0 -201
@@ -119,7 +119,7 @@ function di(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...w(n)})}//
119
119
  function fi(e,t){let n=/* @__PURE__ */ pi(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 pi(e,t){let n=new Ct({check:`custom`,...w(t)});return n._zod.check=e,n}function mi(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??lr,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 D(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,D(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`&&O(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 hi(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 gi(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:vi(t,`input`,e.processors),output:vi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function O(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 O(r.element,n);if(r.type===`set`)return O(r.valueType,n);if(r.type===`lazy`)return O(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 O(r.innerType,n);if(r.type===`intersection`)return O(r.left,n)||O(r.right,n);if(r.type===`record`||r.type===`map`)return O(r.keyType,n)||O(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:O(r.in,n)||O(r.out,n);if(r.type===`object`){for(let e in r.shape)if(O(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(O(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(O(e,n))return!0;return!!(r.rest&&O(r.rest,n))}return!1}let _i=(e,t={})=>n=>{let r=mi({...n,processors:t});return D(e,r),hi(r,e),gi(r,e)},vi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=mi({...i??{},target:a,io:t,processors:n});return D(e,o),hi(o,e),gi(o,e)},yi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},bi=(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=yi[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}))])}},xi=(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)},Si=(e,t,n,r)=>{n.type=`boolean`},Ci=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},wi=(e,t,n,r)=>{n.not={}},Ti=(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},Ei=(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}},Di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Oi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ki=(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=D(a.element,t,{...r,path:[...r.path,`items`]})},Ai=(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]=D(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=D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ji=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Mi=(e,t,n,r)=>{let i=e._zod.def,a=D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=D(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]]},Ni=(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)=>D(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?D(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)},Pi=(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=D(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=D(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=D(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)}},Fi=(e,t,n,r)=>{let i=e._zod.def,a=D(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`}]},Ii=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Li=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ri=(e,t,n,r)=>{let i=e._zod.def;D(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)))},zi=(e,t,n,r)=>{let i=e._zod.def;D(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},Bi=(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;D(o,t,r);let s=t.seen.get(e);s.ref=o},Vi=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Hi=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ui=(e,t,n,r)=>{let i=e._zod.innerType;D(i,t,r);let a=t.seen.get(e);a.ref=i},Wi=/*@__PURE__*/ u(`ZodISODateTime`,(e,t)=>{en.init(e,t),j.init(e,t)});function Gi(e){return/* @__PURE__ */ Nr(Wi,e)}let Ki=/*@__PURE__*/ u(`ZodISODate`,(e,t)=>{tn.init(e,t),j.init(e,t)});function qi(e){return/* @__PURE__ */ Pr(Ki,e)}let Ji=/*@__PURE__*/ u(`ZodISOTime`,(e,t)=>{nn.init(e,t),j.init(e,t)});function Yi(e){return/* @__PURE__ */ Fr(Ji,e)}let Xi=/*@__PURE__*/ u(`ZodISODuration`,(e,t)=>{rn.init(e,t),j.init(e,t)});function Zi(e){return/* @__PURE__ */ Ir(Xi,e)}let Qi=/*@__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}),$i=/* @__PURE__ */ Me(Qi),ea=/* @__PURE__ */ Ne(Qi),ta=/* @__PURE__ */ Pe(Qi),na=/* @__PURE__ */ Ie(Qi),ra=/* @__PURE__ */ Re(Qi),ia=/* @__PURE__ */ ze(Qi),aa=/* @__PURE__ */ Be(Qi),oa=/* @__PURE__ */ Ve(Qi),sa=/* @__PURE__ */ He(Qi),ca=/* @__PURE__ */ Ue(Qi),la=/* @__PURE__ */ We(Qi),ua=/* @__PURE__ */ Ge(Qi),da=/* @__PURE__ */ new WeakMap;function fa(e,t,n){let r=Object.getPrototypeOf(e),i=da.get(r);if(i||(i=/* @__PURE__ */ new Set,da.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 k=/*@__PURE__*/ u(`ZodType`,(e,t)=>(T.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:vi(e,`input`),output:vi(e,`output`)}}),e.toJSONSchema=_i(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>$i(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ta(e,t,n),e.parseAsync=async(t,n)=>ea(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>na(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ra(e,t,n),e.decode=(t,n)=>ia(e,t,n),e.encodeAsync=async(t,n)=>aa(e,t,n),e.decodeAsync=async(t,n)=>oa(e,t,n),e.safeEncode=(t,n)=>sa(e,t,n),e.safeDecode=(t,n)=>ca(e,t,n),e.safeEncodeAsync=async(t,n)=>la(e,t,n),e.safeDecodeAsync=async(t,n)=>ua(e,t,n),fa(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__ */ ri(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 P(this)},or(e){return Ja([this,e])},and(e){return Za(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 lr.add(t,{description:e}),t},meta(...e){if(e.length===0)return lr.get(this);let t=this.clone();return lr.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 lr.get(e)?.description},configurable:!0}),e)),pa=/*@__PURE__*/ u(`_ZodString`,(e,t)=>{Ht.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,fa(e,`_ZodString`,{regex(...e){return this.check(/* @__PURE__ */ Zr(...e))},includes(...e){return this.check(/* @__PURE__ */ ei(...e))},startsWith(...e){return this.check(/* @__PURE__ */ ti(...e))},endsWith(...e){return this.check(/* @__PURE__ */ ni(...e))},min(...e){return this.check(/* @__PURE__ */ Yr(...e))},max(...e){return this.check(/* @__PURE__ */ Jr(...e))},length(...e){return this.check(/* @__PURE__ */ Xr(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Yr(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Qr(e))},uppercase(e){return this.check(/* @__PURE__ */ $r(e))},trim(){return this.check(/* @__PURE__ */ ai())},normalize(...e){return this.check(/* @__PURE__ */ ii(...e))},toLowerCase(){return this.check(/* @__PURE__ */ oi())},toUpperCase(){return this.check(/* @__PURE__ */ si())},slugify(){return this.check(/* @__PURE__ */ ci())}})}),ma=/*@__PURE__*/ u(`ZodString`,(e,t)=>{Ht.init(e,t),pa.init(e,t),e.email=t=>e.check(/* @__PURE__ */ dr(ha,t)),e.url=t=>e.check(/* @__PURE__ */ _r(va,t)),e.jwt=t=>e.check(/* @__PURE__ */ Mr(Pa,t)),e.emoji=t=>e.check(/* @__PURE__ */ vr(ba,t)),e.guid=t=>e.check(/* @__PURE__ */ fr(ga,t)),e.uuid=t=>e.check(/* @__PURE__ */ pr(_a,t)),e.uuidv4=t=>e.check(/* @__PURE__ */ mr(_a,t)),e.uuidv6=t=>e.check(/* @__PURE__ */ hr(_a,t)),e.uuidv7=t=>e.check(/* @__PURE__ */ gr(_a,t)),e.nanoid=t=>e.check(/* @__PURE__ */ yr(xa,t)),e.guid=t=>e.check(/* @__PURE__ */ fr(ga,t)),e.cuid=t=>e.check(/* @__PURE__ */ br(Sa,t)),e.cuid2=t=>e.check(/* @__PURE__ */ xr(Ca,t)),e.ulid=t=>e.check(/* @__PURE__ */ Sr(wa,t)),e.base64=t=>e.check(/* @__PURE__ */ kr(ja,t)),e.base64url=t=>e.check(/* @__PURE__ */ Ar(Ma,t)),e.xid=t=>e.check(/* @__PURE__ */ Cr(Ta,t)),e.ksuid=t=>e.check(/* @__PURE__ */ wr(Ea,t)),e.ipv4=t=>e.check(/* @__PURE__ */ Tr(Da,t)),e.ipv6=t=>e.check(/* @__PURE__ */ Er(Oa,t)),e.cidrv4=t=>e.check(/* @__PURE__ */ Dr(ka,t)),e.cidrv6=t=>e.check(/* @__PURE__ */ Or(Aa,t)),e.e164=t=>e.check(/* @__PURE__ */ jr(Na,t)),e.datetime=t=>e.check(Gi(t)),e.date=t=>e.check(qi(t)),e.time=t=>e.check(Yi(t)),e.duration=t=>e.check(Zi(t))});function A(e){return/* @__PURE__ */ ur(ma,e)}let j=/*@__PURE__*/ u(`ZodStringFormat`,(e,t)=>{E.init(e,t),pa.init(e,t)}),ha=/*@__PURE__*/ u(`ZodEmail`,(e,t)=>{Gt.init(e,t),j.init(e,t)}),ga=/*@__PURE__*/ u(`ZodGUID`,(e,t)=>{Ut.init(e,t),j.init(e,t)}),_a=/*@__PURE__*/ u(`ZodUUID`,(e,t)=>{Wt.init(e,t),j.init(e,t)}),va=/*@__PURE__*/ u(`ZodURL`,(e,t)=>{Kt.init(e,t),j.init(e,t)});function ya(e){return/* @__PURE__ */ _r(va,e)}let ba=/*@__PURE__*/ u(`ZodEmoji`,(e,t)=>{qt.init(e,t),j.init(e,t)}),xa=/*@__PURE__*/ u(`ZodNanoID`,(e,t)=>{Jt.init(e,t),j.init(e,t)}),Sa=/*@__PURE__*/ u(`ZodCUID`,(e,t)=>{Yt.init(e,t),j.init(e,t)}),Ca=/*@__PURE__*/ u(`ZodCUID2`,(e,t)=>{Xt.init(e,t),j.init(e,t)}),wa=/*@__PURE__*/ u(`ZodULID`,(e,t)=>{Zt.init(e,t),j.init(e,t)}),Ta=/*@__PURE__*/ u(`ZodXID`,(e,t)=>{Qt.init(e,t),j.init(e,t)}),Ea=/*@__PURE__*/ u(`ZodKSUID`,(e,t)=>{$t.init(e,t),j.init(e,t)}),Da=/*@__PURE__*/ u(`ZodIPv4`,(e,t)=>{an.init(e,t),j.init(e,t)}),Oa=/*@__PURE__*/ u(`ZodIPv6`,(e,t)=>{on.init(e,t),j.init(e,t)}),ka=/*@__PURE__*/ u(`ZodCIDRv4`,(e,t)=>{sn.init(e,t),j.init(e,t)}),Aa=/*@__PURE__*/ u(`ZodCIDRv6`,(e,t)=>{cn.init(e,t),j.init(e,t)}),ja=/*@__PURE__*/ u(`ZodBase64`,(e,t)=>{un.init(e,t),j.init(e,t)}),Ma=/*@__PURE__*/ u(`ZodBase64URL`,(e,t)=>{fn.init(e,t),j.init(e,t)}),Na=/*@__PURE__*/ u(`ZodE164`,(e,t)=>{pn.init(e,t),j.init(e,t)}),Pa=/*@__PURE__*/ u(`ZodJWT`,(e,t)=>{hn.init(e,t),j.init(e,t)}),Fa=/*@__PURE__*/ u(`ZodNumber`,(e,t)=>{gn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),fa(e,`ZodNumber`,{gt(e,t){return this.check(/* @__PURE__ */ Gr(e,t))},gte(e,t){return this.check(/* @__PURE__ */ Kr(e,t))},min(e,t){return this.check(/* @__PURE__ */ Kr(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Ur(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Wr(e,t))},max(e,t){return this.check(/* @__PURE__ */ Wr(e,t))},int(e){return this.check(La(e))},safe(e){return this.check(La(e))},positive(e){return this.check(/* @__PURE__ */ Gr(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ Kr(0,e))},negative(e){return this.check(/* @__PURE__ */ Ur(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Wr(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ qr(e,t))},step(e,t){return this.check(/* @__PURE__ */ qr(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 M(e){return/* @__PURE__ */ Lr(Fa,e)}let Ia=/*@__PURE__*/ u(`ZodNumberFormat`,(e,t)=>{_n.init(e,t),Fa.init(e,t)});function La(e){return/* @__PURE__ */ Rr(Ia,e)}let Ra=/*@__PURE__*/ u(`ZodBoolean`,(e,t)=>{vn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r)});function N(e){return/* @__PURE__ */ zr(Ra,e)}let za=/*@__PURE__*/ u(`ZodNull`,(e,t)=>{yn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r)});function Ba(e){return/* @__PURE__ */ Br(za,e)}let Va=/*@__PURE__*/ u(`ZodUnknown`,(e,t)=>{bn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ha(){return/* @__PURE__ */ Vr(Va)}let Ua=/*@__PURE__*/ u(`ZodNever`,(e,t)=>{xn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function Wa(e){return/* @__PURE__ */ Hr(Ua,e)}let Ga=/*@__PURE__*/ u(`ZodArray`,(e,t)=>{Cn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.element=t.element,fa(e,`ZodArray`,{min(e,t){return this.check(/* @__PURE__ */ Yr(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Yr(1,e))},max(e,t){return this.check(/* @__PURE__ */ Jr(e,t))},length(e,t){return this.check(/* @__PURE__ */ Xr(e,t))},unwrap(){return this.element}})});function P(e,t){return/* @__PURE__ */ li(Ga,e,t)}let Ka=/*@__PURE__*/ u(`ZodObject`,(e,t)=>{On.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),x(e,`shape`,()=>t.shape),fa(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:Ha()})},loose(){return this.clone({...this._zod.def,catchall:Ha()})},strict(){return this.clone({...this._zod.def,catchall:Wa()})},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 F(e,t){let n={type:`object`,shape:e??{},...w(t)};return new Ka(n)}function I(e,t){return new Ka({type:`object`,shape:e,catchall:Wa(),...w(t)})}let qa=/*@__PURE__*/ u(`ZodUnion`,(e,t)=>{An.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.options=t.options});function Ja(e,t){return new qa({type:`union`,options:e,...w(t)})}let Ya=/*@__PURE__*/ u(`ZodDiscriminatedUnion`,(e,t)=>{qa.init(e,t),jn.init(e,t)});function L(e,t,n){return new Ya({type:`union`,options:t,discriminator:e,...w(n)})}let Xa=/*@__PURE__*/ u(`ZodIntersection`,(e,t)=>{Mn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r)});function Za(e,t){return new Xa({type:`intersection`,left:e,right:t})}let Qa=/*@__PURE__*/ u(`ZodTuple`,(e,t)=>{Fn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function $a(e,t,n){let r=t instanceof T;return new Qa({type:`tuple`,items:e,rest:r?t:null,...w(r?n:t)})}let eo=/*@__PURE__*/ u(`ZodRecord`,(e,t)=>{zn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function R(e,t,n){return!t||!t._zod?new eo({type:`record`,keyType:A(),valueType:e,...w(t)}):new eo({type:`record`,keyType:e,valueType:t,...w(n)})}let to=/*@__PURE__*/ u(`ZodEnum`,(e,t)=>{Bn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(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)=>{Vn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(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)=>{Hn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(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)=>{Wn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(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)=>{Gn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(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)=>{Kn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(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)=>{qn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(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)=>{Yn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(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)=>{Xn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(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)=>{Qn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(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)=>{$n.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(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)=>{tr.init(e,t),k.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:`readonly`,innerType:e})}let wo=/*@__PURE__*/ u(`ZodLazy`,(e,t)=>{rr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(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)=>{ir.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r)});function Do(e,t){return/* @__PURE__ */ ui(Eo,e??(()=>!0),t)}function Oo(e,t={}){return/* @__PURE__ */ di(Eo,e,t)}function ko(e,t){return/* @__PURE__ */ fi(e,t)}let Ao=z([`active`,`paused`,`blocked`,`usageLimited`,`budgetLimited`,`complete`]),jo=M().int().nonnegative().safe();F({objective:A().min(1),status:Ao,tokenBudget:jo.positive().nullable(),tokensUsed:jo,timeUsedSeconds:jo,createdAt:jo,updatedAt:jo});let Mo=z([`user`,`automatic`]).nullable();F({objective:A().min(1).optional(),status:z([`active`,`paused`]).optional(),tokenBudget:jo.positive().nullable().optional(),origin:Mo});let No=/^[A-Za-z0-9_-]{1,128}$/u,Po=A().min(1).max(128);L(`operation`,[F({operation:B(`create`),requestId:Po,body:A().min(1).max(16<<20),headers:R(A(),A()).default({})}),F({operation:B(`cancel`),requestId:Po}),F({operation:B(`hangup`),callId:A().regex(No)})]),F({status:M().int().min(200).max(599),body:A(),headers:R(A(),A())});let Fo=I({threadId:A().trim().min(1).max(128),verbs:P(z([`read`,`watch`,`send`,`cancel`])).min(1).max(4)}),Io=I({enrollmentId:A().trim().min(1).max(128),threadId:A().trim().min(1).max(128),clientId:A().trim().min(1).max(64),executablePath:A().min(1).max(4096),endpoint:A().min(1).max(2048),issuedAt:A().min(1).max(64),expiresAt:A().min(1).max(64),pairing:z([`session`,`machine`]),allowlist:P(Fo).max(64)});I({}),I({enrollments:P(Io).max(256)}),I({enrollmentId:A().trim().min(1).max(128)}),I({enrollmentId:A().trim().min(1).max(128),revoked:B(!0)}),I({v:B(1),secret:A().min(1).max(4096)}),I({v:B(1),ok:B(!0)}),I({requestId:A().min(1).max(128),deadlineMs:M().int().positive(),route:A().min(1).max(128),body:R(A(),Ha()),operationalClient:A().min(1).max(64).optional(),oauthClientId:A().min(1).max(128).optional(),dispatchGrant:z([`legacy-four`,`full-dispatch`]).optional()});let Lo=I({code:A().min(1).max(64),message:A().max(2048),details:Ha().optional()});I({requestId:A().min(1).max(128),status:M().int().min(100).max(599).optional(),body:Ha().optional(),error:Lo.optional()}),I({threadId:A().min(1),view:z([`result`,`messages`]).optional(),cursor:A().optional(),limit:M().int().min(1).max(100).optional()}),I({threadId:A().min(1),timeoutMs:M().int().min(1).max(25e3).optional(),view:z([`result`,`messages`]).optional(),cursor:A().optional(),limit:M().int().min(1).max(100).optional()}),I({threadId:A().min(1),message:A().min(1).max(2097152)}),I({}),I({clientId:A().min(1),pairing:z([`machine`,`session`]),expiresAt:A().min(1),allowlist:P(I({threadId:A().min(1),verbs:P(A().min(1)).min(1)})),threadId:A().min(1),link:z([`online`,`offline`]),runtime:z([`reachable`,`unreachable`])});let Ro=A().trim().min(1).max(64).regex(/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/u),zo=z([`all-threads`,`selected-workspaces`]),Bo=z([`public-relay`,`local`,`direct`]),Vo=z([`legacy-four`,`full-dispatch`]),Ho=A().trim().min(1).max(4096),Uo=A().trim().max(2048),Wo=I({name:Ro,createdAt:A().min(1).max(64),access:zo,workspaces:P(Ho).max(64),connectionMode:Bo,dispatchGrant:Vo,oauthClientId:A().trim().min(1).max(128).optional(),directUrl:Uo.optional(),mcpUrl:A().min(1).max(2048).optional(),mcpUrlNote:A().min(1).max(512).optional()});I({}),I({clients:P(Wo).max(256)});let Go=I({access:zo.optional(),workspaces:P(Ho).max(64).optional(),connectionMode:Bo.optional(),dispatchGrant:Vo.optional(),oauthClientId:A().trim().min(1).max(128).optional(),directUrl:Uo.optional()});Go.extend({name:Ro}),Wo.extend({token:A().min(1).max(256).optional()}),Go.extend({name:Ro,clearOauthClientId:B(!0).optional()}),I({name:Ro}),I({name:Ro,revoked:B(!0)}),F({}).strict(),F({enabled:N().optional(),browser:N().optional()}).strict().refine(e=>e.enabled!==void 0||e.browser!==void 0,{message:`Expected enabled or browser`}),F({enabled:N(),available:N(),unavailableReason:A().min(1).max(500).optional(),browser:N().optional(),browserFilesPresent:N().optional(),browserAvailable:N().optional(),browserUnavailableReason:A().min(1).max(500).optional(),applyFailed:N().optional(),applyError:A().min(1).max(500).optional()}).strict();function Ko(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 qo=Ja([A(),M(),N(),Ba()]);function Jo(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 Yo=Do(Jo,{message:`JSON value must not contain circular references`}),Xo=To(()=>Ja([qo,P(Xo),R(A(),Xo)])),Zo=Yo.pipe(Xo);Yo.pipe(P(Xo));let Qo=Yo.pipe(R(A(),Xo)),$o=I({code:A().min(1),message:A().min(1),retryable:N(),diagnostic:A().min(1).optional(),stage:A().min(1).optional(),durationMs:M().int().nonnegative().optional(),stderrTail:A().min(1).optional()}).superRefine(Ko([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),es=A().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),ts=e=>A().min(1).max(e).refine(e=>e.trim().length>0),ns=R(es,F({label:ts(256).optional(),description:ts(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),rs=R(es,ts(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),is=A().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),V=is.brand(),H=is.brand(),as=is.brand(),os=is.brand(),ss=is.brand(),cs=A().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),ls=cs.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),us=F({modes:P(F({id:ls,label:cs.max(256),description:cs.max(1024).optional(),dangerous:N().optional(),localizations:ns.optional()}).strict()).min(1).max(32),defaultModeId:ls}).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`]})});F({threadId:H,permissionModeId:ls}).strict();let U=M().int().safe().nonnegative(),ds=M().finite().nonnegative(),fs=M().finite().min(0).max(100),ps=F({version:Ja([B(3),B(4)]).optional(),requestId:A().min(1),turnId:A().min(1).max(1024),outputTokens:U,startedAtMs:U,completedAtMs:U}).strict().refine(e=>e.completedAtMs>e.startedAtMs),ms=F({version:Ja([B(2),B(3),B(4)]).optional(),value:ds,turnId:A().min(1).max(1024),at:U}).strict();F({outputTimings:P(ps).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:ms.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:ms.extend({value:U}).optional()}).strict();let hs=e=>rs.refine(t=>Object.values(t).every(t=>t.length<=e)),gs=F({composerIndicators:P(F({kind:B(`countdown`),id:A().min(1).max(64),expiresAtUnix:U,label:hs(256).optional(),tooltip:hs(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:ds.optional(),sessionOutputTokensPerSecond:ds.optional(),apiOutputTokensPerSecond:ds.optional(),reasoningOutputTokens:U.optional(),totalTokens:U.optional(),totalCostUsd:ds.optional(),totalCredits:ds.optional(),contextUsagePercent:ds.optional(),cacheHitRatePercent:fs.optional(),contextWindowTokens:U.optional(),contextUsedTokens:U.optional(),planFiveHourUsedPercent:fs.optional(),planFiveHourResetsAtUnix:U.optional(),planSevenDayUsedPercent:fs.optional(),planSevenDayResetsAtUnix:U.optional(),sessionCacheHitRatePercent:fs.optional(),timeToFirstOutputMs:U.optional(),costSource:z([`publicPrice`,`native`]).optional(),unpricedModels:P(A().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`]})}),_s=M().finite().min(0).max(100),vs=z([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),ys=F({id:A().min(1).max(256),label:A().min(1).max(256),localizations:ns.optional()}).strict(),bs=F({product:A().min(1),periodType:vs.optional(),scope:ys.optional(),localizations:ns.optional(),used:M().finite().nonnegative().optional(),limit:M().finite().nonnegative().optional(),unit:A().min(1).max(32).optional(),usagePercent:_s,resetsAt:A().min(1).optional()}).strict(),xs=F({availableCount:M().int().safe().positive(),nextExpiresAt:A().min(1).optional(),expiresAt:P(A().min(1)).min(1).max(32).optional()}).strict(),Ss=F({used:M().finite().nonnegative().optional(),limit:M().finite().nonnegative().optional(),unit:A().min(1).max(32).optional(),label:A().min(1).optional(),scope:ys.optional(),localizations:ns.optional(),usedPercent:_s,resetsAt:A().min(1).optional(),periodType:vs,productUsage:P(bs).min(1).optional(),resetCredits:xs.optional()}).strict();F({threadId:H,refresh:B(`exact`).optional()}).strict(),F({threadId:H,usage:gs.nullable(),accountCredits:Ss.optional(),accountCreditsSupported:N().optional()}).strict();let Cs=A().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),ws=F({id:Cs.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),Ts=Cs.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),Es=Cs.max(256),Ds=F({id:Ts,label:Cs.max(256)}).strict(),Os=F({ref:ws,label:Cs.max(256),resolvedModelLabel:Es.optional(),fastModel:ws.optional(),supportedThinkingOptionIds:P(Ts).optional()}).strict(),ks=P(Ds).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)}),As=F({models:P(Os),defaultModel:ws.optional(),thinkingOptions:ks,defaultThinkingOptionId:Ts.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`]})}),js=F({fork:N(),forkAcrossCwd:N(),rollbackLastTurn:N(),rollbackToCheckpoint:N().optional()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),Ms=z([`live`,`atCreate`]),Ns=F({configuration:F({selectModel:N(),selectThinkingOption:N(),selectPermissionMode:N(),permissionModeScope:Ms.default(`live`)}).strict(),history:js,subagents:F({observe:N(),readTranscript:N()}).strict().optional(),autonomousTurns:F({observe:N()}).strict().optional(),steer:N().optional()}).strict();F({effectiveModel:ws.optional(),resolvedModelLabel:Es.optional(),effectiveThinkingOptionId:Ts.optional(),availableThinkingOptions:ks.optional(),effectivePermissionModeId:ls.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 Ps=F({open:B(!0)}).strict();Ja([F({status:B(`ready`),catalog:As,permissionModes:us.optional(),capabilities:Ns,webUi:Ps.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`]})}),F({status:z([`notInstalled`,`unavailable`,`error`]),error:$o}).strict()]),F({harnessId:V,cwd:Cs.max(16384).optional(),refresh:N().optional(),purpose:B(`availability`).optional()}).strict(),F({harnessId:V}).strict(),F({}).strict(),F({threadId:H,model:ws}).strict(),F({threadId:H,thinkingOptionId:Ts}).strict(),F({threadId:H,includeReferenceCapability:N().optional()}).strict(),L(`owner`,[F({owner:B(`codex`),locked:N(),effectiveModel:ws.optional(),resolvedModelLabel:Es.optional(),effectiveThinkingOptionId:Ts.optional(),effectivePermissionModeId:ls.optional(),history:js.optional(),supportsThreadReferences:B(!0).optional()}).strict(),F({owner:B(`external`),harnessId:Cs.max(256),transportModelId:Cs.max(1024),effectiveModel:ws.optional(),resolvedModelLabel:Es.optional(),effectiveThinkingOptionId:Ts.optional(),availableThinkingOptions:ks.optional(),effectivePermissionModeId:ls.optional(),history:js,usage:gs.optional(),locked:B(!0)}).strict()]),F({threadIds:P(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 Fs=L(`owner`,[F({threadId:H,owner:B(`codex`)}).strict(),F({threadId:H,owner:B(`external`),harnessId:A().max(256).pipe(V)}).strict()]);F({threads:P(Fs).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)}),F({threadId:H,text:A().optional()}).strict(),F({kind:B(`application`),value:A().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),l}}).pipe(F({expectedTurnId:as,clientUserMessageId:A().min(1),delivery:z([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),z([`activeTurn`,`newTurn`]),F({delivery:z([`official`,`activeTurn`,`newTurn`])}).strict();let Is=I({chatExperience:z([`chatgpt`,`codex`]),chatConnection:z([`desktop`,`gateway`]),workConnection:z([`desktop`,`gateway`])});Object.freeze({chatExperience:`chatgpt`,chatConnection:`desktop`,workConnection:`gateway`});let Ls=Is.extend({inject:N()});L(`operation`,[I({operation:B(`get`),runtime:I({id:A().uuid(),revision:A().max(64),activeCall:N()}).optional()}),I({operation:B(`migrate`),routes:Is}),I({operation:B(`set`),settings:Ls,revision:A().max(64)}),I({operation:B(`restart`),confirm:B(!0)})]),I({settings:Ls,initialized:N(),revision:A(),activeInject:N().nullable(),envOverride:z([`0`,`1`]).nullable(),activeEnvOverride:z([`0`,`1`]).nullable(),routesActive:N().nullable(),activeCall:N().nullable(),gatewayReady:N().nullable(),restartAvailable:N(),restart:I({phase:z([`idle`,`restarting`,`succeeded`,`failed`]),error:A().nullable()})}),F({threadId:H}).strict(),F({confirmed:N()}).strict(),F({threadIds:P(A().min(1))}).strict(),F({threadId:A().min(1).max(1024),pinned:N()}).strict(),F({}).strict(),F({parents:R(A().min(1),A().min(1))}).strict(),F({prompt:A().max(16384).optional()}).strict(),F({projects:P(F({id:A(),name:A(),rootPaths:P(A())})),assignments:R(A(),A()),projectless:P(A()),pinned:P(A())});let Rs=R(A(),Ha()),zs=F({epoch:A().uuid(),sequence:M().int().nonnegative()});L(`type`,[F({type:B(`skills-changed`),cursor:zs,cwd:A().optional()}),F({type:B(`harness-inspection-changed`),cursor:zs,harnessId:A().min(1)}),F({type:B(`display-settings-changed`),cursor:zs}),F({type:B(`preferences-changed`),cursor:zs,revision:M().int().nonnegative()}),F({type:B(`hello`),version:B(1),cursor:zs,reset:N()}),F({type:B(`changed`),cursor:zs,threadId:A().min(1),method:A().min(1)})]);let Bs=L(`type`,[F({type:B(`text`),id:A(),prompt:A(),secret:N().optional(),optional:N().optional()}),F({type:B(`choice`),id:A(),prompt:A(),multiple:N(),allowOther:N(),optional:N().optional(),options:P(F({value:A(),label:A(),description:A().optional()}))})]),Vs=L(`type`,[F({type:B(`approval`),title:A(),description:A().optional(),subject:Ha().optional(),actions:P(F({id:A(),label:A(),effect:A()}))}),F({type:B(`question`),title:A().optional(),questions:P(Bs)})]),Hs=F({requestId:Ja([A(),M().int()]),threadId:A(),kind:z([`approval`,`question`]),interaction:Vs,request:Rs}),Us=F({id:A().min(1),clientUserMessageId:A().min(1),input:P(Rs),presentationInput:P(Rs).nullable().optional()}).passthrough();F({fields:P(F({path:P(Ja([A(),M().int().nonnegative()])),originalLength:M().int().nonnegative()}))});let Ws=F({id:A().min(1),status:A().min(1),codexhostTurnOutcome:F({status:B(`unknown`),reason:A()}).optional(),items:P(F({id:A().min(1),type:A().min(1)}).passthrough()),codexhostFileOperations:P(F({beforeItemId:A().nullable(),item:F({id:A().min(1),type:A().min(1)}).passthrough()})).optional(),error:F({message:A().optional()}).passthrough().nullable().optional(),fingerprint:A().min(1).optional(),unchanged:B(!0).optional()}).passthrough(),Gs=F({id:A().min(1).max(512),fingerprint:A().min(1).max(128)});F({threadId:A().min(1),knownTurns:P(Gs).max(64).optional(),truncateToolOutput:N().optional()});let Ks=F({harnessId:A().min(1),nativeSessionId:A().min(1)});F({cursor:zs,activeTurnId:A().min(1).nullable().optional(),command:F({name:A().min(1),turn:Ws,subsequentTurnId:A().min(1).optional()}).optional(),thread:F({id:A().min(1),cwd:A(),modelProvider:A().min(1),createdAt:M(),updatedAt:M(),status:F({type:A()}).passthrough(),name:A().nullable().optional(),preview:A().optional(),codexhostImportSource:Ks.optional(),turns:P(Ws).length(0)}).passthrough(),turnsPage:F({data:P(Ws).max(5),nextCursor:A().nullable()}),configuration:F({native:F({model:A().min(1).max(1024).optional(),reasoningEffort:A().min(1).max(128).optional()}).optional(),effectiveModel:ws.optional(),effectiveThinkingOptionId:Ts.optional(),effectivePermissionModeId:ls.optional()}),queue:F({items:P(Us),pausedReason:z([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:P(Hs)}),F({version:B(1),owner:B(`service`).optional(),pid:M().int().positive(),port:M().int().min(1).max(65535),token:A().regex(/^[0-9a-f]{64}$/u),startedAt:M(),epoch:A().uuid()}),F({epoch:A().uuid(),threadId:A().min(1),requestId:Ja([A(),M().int()]),result:Rs}),F({includeArchived:N().optional(),officialCursor:F({live:A().nullable(),archived:A().nullable().optional()}).strict().optional()}).strict(),F({threads:P(Qo),ownership:P(Fs),archivedThreadIds:P(H),officialCursor:F({live:A().nullable(),archived:A().nullable().optional()}).strict().optional()}).strict();let qs=A().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);F({available:N()}).strict(),F({path:A().min(1),mimeType:qs}).strict();let Js=z([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);L(`ok`,[F({ok:B(!0),text:A()}).strict(),F({ok:B(!1),error:F({code:Js}).strict()}).strict()]),F({threadId:H.optional(),cwd:A().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let Ys=F({name:A().min(1).regex(/^[^\s[\]]+$/u),description:A().optional(),path:A().min(1),scope:z([`project`,`global`]),source:A().min(1)}).strict();F({revision:M().int().nonnegative(),complete:N(),skills:P(Ys),warnings:P(A()).optional()}).strict(),F({cwd:A().min(1).optional()}).strict();let Xs=F({kind:z([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:A().min(1)}).strict(),Zs=L(`status`,[F({status:B(`not-installed`)}),F({status:B(`not-running`)}),F({status:B(`not-logged-in`)}),F({status:B(`https-disabled`)}),F({status:B(`not-serving`),command:A()}),F({status:B(`occupied`),target:A()}),F({status:B(`serving`),url:A(),funnel:N()}),F({status:B(`error`),message:A()})]);F({state:Zs,error:A().optional()}).strict();let Qs=L(`status`,[F({status:B(`on`)}),F({status:B(`off`)}),F({status:B(`invalid`),reason:A()})]),$s=F({lan:N(),autostart:Qs}).strict(),ec=F({expiresAt:A().optional(),issuing:N(),failure:F({detail:A().optional(),retryAt:A(),paused:N()}).optional()}),tc=L(`status`,[F({status:B(`off`),reason:z([`invite`,`name-taken`,`banned`]).optional()}),F({status:B(`connecting`),reason:z([`full`,`unreachable`]).optional()}),F({status:B(`connected`),url:A(),certificate:ec}),F({status:B(`missing-certificate`),url:A(),certificate:ec}),F({status:B(`stopped`),reason:z([`replaced`,`rejected`,`unsupported-version`])})]);A().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()),A().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let nc=z([`official`,`self-hosted`]);F({secret:A().min(1),lastUsedAt:M().nullable(),networkUrls:P(Xs),directCandidates:P(Xs).optional(),tailscale:Zs,background:$s.optional(),relay:F({state:tc,enabled:N(),kind:nc,officialHost:A(),customHost:A().optional(),officialHostname:A().optional(),customHostname:A().optional(),quotaUntil:A().optional()}).strict().optional()}).strict();let rc=I({threadId:A().min(1).max(1024),view:z([`result`,`messages`]),from:M().int().min(1).max(2**53-1).optional(),to:M().int().min(1).max(2**53-1).optional()}),ic=F({id:A().min(1).max(256),harnessId:A().min(1),label:A().min(1).max(512),provider:z([`openai-codex`,`xai`])}).strict(),ac=A().regex(/^[a-z][a-z0-9-]{0,47}$/),oc=F({name:ac,source:ic,importedAt:A()}).strict(),sc=L(`action`,[F({action:B(`list`)}).strict(),F({action:B(`import`),sourceId:A().min(1).max(256),name:ac,confirmed:B(!0)}).strict(),F({action:B(`reimport`),sourceId:A().min(1).max(256),name:ac,confirmed:B(!0)}).strict(),F({action:B(`remove`),name:ac,confirmed:B(!0)}).strict()]),cc=F({provider:A().min(1).max(128),type:z([`oauth`,`api_key`,`unknown`]),label:A().min(1).max(512).optional(),vendor:z([`openai-codex`,`xai`]).optional()}).strict();F({sources:P(ic),targets:P(F({harnessId:A(),providers:P(z([`openai-codex`,`xai`])),imports:P(oc),others:P(cc).default([])}).strict())}).strict(),F({targetHarnessId:A().min(1).max(128).optional(),request:sc}).strict(),F({events:N()});let lc=P(I({agent:A().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`);I({entries:lc.nullable()}),I({}),I({entries:lc,initializeOnly:N().optional()});let uc=I({enabled:N(),timeoutMinutes:M().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let dc=A().regex(/^external$/u),fc=V.transform(e=>String(e)),pc=I({model:ws.optional(),thinkingOptionId:Ts.optional(),permissionModeId:ls.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),mc=I({lastHarness:V.optional(),byHarness:R(fc,pc)}),hc=A().min(1).max(1024),gc=I({idleRelease:uc.optional(),favorites:R(fc,P(hc).max(2048)).default({}),newThread:mc.optional()});I({scope:dc,revision:M().int().nonnegative(),values:gc}),I({scope:dc.default(`external`)});let _c=L(`kind`,[I({kind:B(`idleRelease`),value:uc}),I({kind:B(`favorite`),harnessId:V,modelId:hc,enabled:N()}),I({kind:B(`favorites`),harnessId:V,modelIds:P(hc).max(2048)}),I({kind:B(`newThread`),lastHarness:V.optional(),harnessId:V.optional(),configuration:pc.optional()})]);I({scope:dc.default(`external`),operations:P(_c).min(1).max(256),initializeOnly:N().optional(),expectedRevision:M().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`})}),I({version:B(1),revision:M().int().nonnegative(),scopes:R(dc,gc)});let vc=M().finite().nonnegative(),yc=I({input:vc,output:vc,cacheRead:vc.optional(),cacheWrite:vc.optional(),cacheWrite1h:vc.optional()}),bc=A().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);I({path:A(),entries:P(I({key:A(),price:yc})),error:A().nullable()}),I({}),I({key:bc,price:yc.nullable(),previousKey:bc.optional()}),I({model:bc});let xc=I({official:N().optional(),canonicalModelId:A().min(1).optional(),provider:A().min(1).max(512),model:A().min(1).max(512),price:yc});I({price:yc.nullable(),suggestions:P(xc).max(6).optional()});let Sc=[`today`,`7d`,`30d`,`90d`,`all`],W=M().int().min(0).max(2**53-1),Cc=A().regex(/^\d{4}-\d{2}-\d{2}$/u),wc=A().min(1).max(128),Tc=A().min(1).max(512),Ec=A().min(1).max(4096);I({range:z(Sc),timeZone:A().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:wc.optional(),model:Tc.nullable().optional(),project:Ec.nullable().optional(),date:Cc.optional()});let Dc=I({requests:W,inputTokens:W,cachedInputTokens:W,cacheWriteInputTokens:W,cacheKnownInputTokens:W,cacheHitCachedInputTokens:W,cacheHitInputTokens:W,outputTokens:W,reasoningOutputTokens:W,costUsd:M().finite().min(0),unpricedRequests:W,unmeteredRequests:W}),Oc=Dc.shape,kc=I({harness:wc,sessionId:A().min(1).max(512),project:Ec.nullable(),title:A().min(1).max(200).optional(),models:P(Tc).max(16),firstAtMs:W,lastAtMs:W,...Oc});I({range:z(Sc),from:Cc.nullable(),to:Cc,filters:I({harness:wc.nullable(),model:Tc.nullable(),unknownModel:N(),project:Ec.nullable(),unknownProject:N(),date:Cc.nullable()}),reading:I({complete:N(),sources:W,read:W}),failures:P(I({harness:wc,message:A().max(2048)})).max(256),options:I({harnesses:P(wc).max(256),models:P(Tc.nullable()).max(4096),projects:P(Ec.nullable()).max(4096)}),modelLabels:P(I({harness:wc,model:Tc,label:Tc})).max(4096).optional(),credits:P(I({harness:wc,model:Tc.nullable(),credits:M().finite().min(0),reportedRequests:W,requests:W})).max(4096).optional(),totals:Dc,daily:P(I({date:Cc,harness:wc,...Oc})).max(2e5),hourly:P(I({weekday:M().int().min(0).max(6),hour:M().int().min(0).max(23),...Oc})).max(168),byHarness:P(I({harness:wc,...Oc})).max(256),byModel:P(I({model:Tc.nullable(),...Oc,harnessPricedRequests:W})).max(4096),byProject:P(I({project:Ec.nullable(),...Oc})).max(4096),sessions:P(kc).max(100),recentSessions:P(kc).max(100).optional()}),F({threadId:H}),F({discarded:N()}),I({threadId:H,unobserved:B(!0).optional()});let Ac={id:A().min(1),prompt:A(),optional:N()},jc=I({deadlineUnixMs:M().int().min(0).max(864e13),action:z([`recommended`,`decline`]),resetOnActivity:N().optional()}),Mc=L(`type`,[I({...Ac,type:B(`choice`),multiple:N(),allowOther:N(),options:P(I({value:A().min(1),label:A(),description:A().optional()})).min(1)}),I({...Ac,type:B(`text`),multiline:N(),secret:B(!1),placeholder:A().optional(),prefill:A().optional()})]);I({questions:P(I({interactionId:ss,turnId:as,title:A().optional(),expiresAt:A().optional(),autoResolution:jc.optional(),questions:P(Mc).min(1)}))});let Nc=z([`answered`,`skipped`,`closedByHarness`,`expired`,`turnEnded`]),Pc=I({interactionId:ss,turnId:as,itemId:os,title:A().optional(),questions:P(Mc).min(1),outcome:Nc,answers:R(A(),P(A()))}),Fc=I({interactionId:ss,turnId:as,itemId:os});I({records:P(Pc),pendingAnchors:P(Fc)}),I({threadId:H,interactionId:ss,turnId:as,answers:R(A(),P(A())),cancelled:N().optional()}),I({accepted:B(!0)}),I({threadId:H,interactionId:ss,turnId:as}),I({autoResolution:jc.nullable()});let Ic=F({path:A(),oldText:A().nullable(),newText:A()});F({sessionId:A().min(1),turn:M().int().nonnegative(),path:A().min(1).optional()}),F({diffs:P(Ic)}),I({}),I({});let Lc=F({reference:F({sessionId:A().min(1),epoch:A().min(1),turn:M().int().nonnegative(),seq:M().int().nonnegative(),callId:A().min(1),part:M().int().nonnegative(),version:A().min(1)}),length:M().int().nonnegative(),bytes:M().int().nonnegative()});function Rc(e){if(typeof e!=`object`||!e||!(`codexhostOutput`in e))return[];let t=P(Lc).safeParse(e.codexhostOutput);return t.success?t.data:[]}I({title:A().trim().min(1).max(200),type:z([`info`,`warning`,`danger`]),body:A().trim().min(1).max(16384)}),I({}),I({url:A().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/voice/gateway-status.codexhost/enrollment/list.codexhost/enrollment/revoke.codexhost/external-clients/list.codexhost/external-clients/create.codexhost/external-clients/update.codexhost/external-clients/revoke.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/grok-computer-use/get.codexhost/harness/grok-computer-use/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 zc=z([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Bc=z([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);I({threadId:A(),title:A(),harnessId:A(),state:zc,reason:Bc,inactiveMs:M().nonnegative()}),I({threadId:H,turnId:as});let Vc=F({amount:M().finite().nonnegative(),currency:A().trim().min(1).max(8),label:A().trim().min(1).max(128).optional()}).strict(),Hc=F({email:A().trim().min(1).max(320).optional(),label:A().trim().min(1).max(256).optional(),plan:A().trim().min(1).max(128).optional(),credits:Ss.optional(),balance:Vc.optional()}).strict();function Uc(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 Wc=Uc(Hc),Gc={harnessId:V,harnessName:A().trim().min(1).max(128)},Kc=F(Gc).strict();F({}).strict(),F({sources:P(Kc).max(128)}).strict(),F({harnessId:V,refresh:N().optional()}).strict(),F({...Gc,account:Wc.nullable(),accounts:P(Wc).max(8).optional()}).strict(),F({refresh:N().optional()}).strict(),F({accounts:P(Uc(Hc.extend(Gc))).max(128)}).strict();let qc=A().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(V),Jc=qc.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Yc=A().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`),Xc=ya().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Zc=F({en:A().max(4096),"zh-CN":A().max(4096).optional()}).strict(),Qc=F({commands:P(F({terminal:A().max(256),command:A().max(4096)}).strict()).max(8),before:Zc.optional(),after:Zc.optional(),downloads:P(F({label:A().max(128),url:Xc}).strict()).max(8).optional()}).strict(),$c={id:qc,name:A().trim().min(1).max(128),version:A().min(1).max(128),kind:B(`usage`).optional(),iconStyle:F({vector:F({viewBox:A().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:A().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:P(F({d:A().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:z([`evenodd`,`nonzero`]).optional(),fill:A().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:A().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:M().min(0).max(50).optional(),paddingRatio:M().min(0).max(.25).optional()}).strict().optional(),installation:Qc.optional(),notice:Zc.optional(),launchCommand:B(!0).optional(),links:F({website:Xc.optional(),documentation:Xc.optional(),installation:Xc.optional()}).strict().optional()};F({manifestVersion:B(1),...$c,adapterApiVersion:M().int().positive(),entry:Yc,icon:Yc.optional()}).strict();let el=A().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),tl=F({...$c,icon:el.optional()}).strict();F({}).strict(),F({plugins:P(tl.extend({id:Jc})).max(128)}).strict(),F({version:B(1),enabled:P(qc).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),F({harnessId:Jc,model:ws.optional(),thinkingOptionId:Ts.optional(),permissionModeId:ls.optional(),prewarm:B(!0).optional()}).strict();let nl=A().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);F({harnessId:Jc}).strict().extend({path:nl.nullable()}),F({path:nl.nullable(),restartRequired:N()}).strict(),F({harnessId:V,action:z([`check`,`update`,`install`])}).strict();let rl=F({currentVersion:A().min(1).max(128),latestVersion:A().min(1).max(128),updateAvailable:N(),canUpdate:N(),versionKind:z([`cli`,`application`]).optional(),manualUpdateUrl:ya().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:A().max(2048).optional(),messageCode:A().min(1).max(128).optional(),notice:rs.optional(),latestVersionKind:z([`unknown`,`tracking-branch`]).optional()}).strict();F({taskId:A().uuid()}).strict(),L(`status`,[F({taskId:A().uuid(),status:B(`running`)}).strict(),F({taskId:A().uuid(),status:B(`succeeded`),result:rl}).strict(),F({taskId:A().uuid(),status:B(`failed`),error:F({code:M().int(),message:A().min(1).max(2048)}).strict()}).strict()]);let il=A().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),al=A().trim().min(1),ol=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`]),sl=F({accountId:il,label:al.max(256),email:A().email().max(320).optional(),planType:ol.optional()}).strict(),cl=z([`ready`,`unavailable`]);F({version:B(2),currentAccountId:il.nullable(),phase:cl,revision:M().int().nonnegative(),instanceId:al.max(1024).optional(),accounts:P(sl).max(1)}).strict(),F({accountId:il,refresh:N().optional()}).strict(),F({accountId:il,usage:gs.nullable(),accountCredits:Ss.optional(),freshness:z([`live`,`cached`]),observedAt:A().datetime().nullable()}).strict();let ll=1e3,ul=A().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),dl=ul.max(1024),fl=F({nativeSessionId:dl,title:ul.max(4096).nullable(),updatedAt:M().int().nonnegative().max(864e13),cwd:ul.max(16384),running:N().nullable()}).strict();F({}).strict(),F({harnesses:P(F({harnessId:Jc,name:ul.max(128)}).strict()).max(128)}).strict(),F({harnessId:Jc,query:A().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:M().int().nonnegative().safe().optional(),limit:M().int().min(1).max(ll).optional()}).strict(),F({candidates:P(fl).max(ll),total:M().int().nonnegative().safe()}).strict(),F({harnessId:Jc,nativeSessionId:dl}).strict(),F({threadId:ul.max(1024).pipe(H)}).strict();let pl=A().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),ml=dl,hl=fl;F({}).strict(),F({candidates:P(hl).max(1e3)}).strict(),F({nativeSessionId:ml}).strict(),F({threadId:pl.max(1024).pipe(H)}).strict(),F({threadId:H,lastTurnId:as}).strict(),F({threadId:H}).strict();let gl=A().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();F({commands:P(F({id:gl,invocation:A().min(1).max(128),label:A().trim().min(1).max(128),description:A().trim().min(1).max(512).optional(),localizations:ns.optional(),argumentMode:z([`none`,`text`]),kind:z([`command`,`skill`]).optional()}).strict()),warnings:P(A().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)}),F({harnessId:V,cwd:A().min(1).optional()}).strict(),F({threadId:H}).strict(),F({threadId:H,commandId:gl,turnId:as.optional(),arguments:Qo.optional()}).strict(),F({accepted:B(!0),turnId:as.optional()}).strict();let _l=B(`2.0`).optional(),vl=Wa().optional(),yl=A().min(1),bl=Ja([A(),M().int()]),xl=F({code:M().int(),message:A(),data:Zo.optional()}).catchall(Zo).superRefine(Ko([`data`]));Ja([F({jsonrpc:_l,id:bl,method:yl,params:Zo.optional(),result:vl,error:vl}).catchall(Zo).superRefine(Ko([`jsonrpc`,`params`,`result`,`error`])),F({jsonrpc:_l,id:vl,method:yl,params:Zo.optional(),result:vl,error:vl}).catchall(Zo).superRefine(Ko([`jsonrpc`,`id`,`params`,`result`,`error`])),F({jsonrpc:_l,id:bl,method:vl,params:vl,result:Zo,error:vl}).catchall(Zo).superRefine(Ko([`jsonrpc`,`method`,`params`,`error`])),F({jsonrpc:_l,id:bl,method:vl,params:vl,result:vl,error:xl}).catchall(Zo).superRefine(Ko([`jsonrpc`,`method`,`params`,`result`]))]);let Sl=A().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});I({harnessId:V,nativeSessionId:Sl,locator:Zo.optional(),formatVersion:B(1)}).superRefine(Ko([`locator`])),I({harnessId:V,nativeSessionId:Sl,nativeTurnKey:Sl,formatVersion:B(1)}),I({harnessId:V,nativeSessionId:Sl,checkpointId:Sl,locator:Zo.optional(),formatVersion:B(1)}).superRefine(Ko([`locator`]));let Cl=A().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),wl=z([`npm`,`windows-installer`,`macos-dmg`]),Tl=I({version:Cl,installation:wl,phase:z([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),updatedAt:M().int().nonnegative(),downloadedBytes:M().int().nonnegative().optional(),totalBytes:M().int().positive().optional(),error:A().min(1).max(500).nullable(),serviceStopOutput:A().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`})});I({});let El=A().max(300).regex(/^https:\/\/github\.com\/karlorz\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);I({currentVersion:Cl,installation:wl.nullable(),latestVersion:Cl.nullable(),updateAvailable:N(),installationAvailable:N(),releaseNotes:A().min(1).max(2e4).nullable(),releaseNotesUrl:El.nullable(),status:Tl.nullable(),error:A().min(1).max(500).nullable()}),I({status:Tl}),I({status:Tl.nullable()}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let Dl=z([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);F({runningVersion:A().nullable(),installedVersion:A().nullable(),restartRequired:N(),remote:N(),updateSupported:N(),update:F({phase:Dl,targetVersion:A().nullable(),error:A().nullable()})});let Ol=F({version:A().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();F({hostname:A().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:M().int().min(1).max(65535).nullable(),identity:A().max(4096).nullable(),action:z([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:N().optional(),version:A().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),F({state:z([`installed`,`not-installed`])}).strict();let G=A().min(1).max(1024),kl={hostId:G.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},Al={...kl,threadId:G},jl=L(`kind`,[I({kind:B(`hosts`)}),I({kind:B(`status`),...Al}),I({kind:B(`list`),...kl,cursor:A().nullable(),archived:N()}),I({kind:B(`read`),...Al,page:I({cursor:A().min(1).max(8192).nullable(),epoch:G.optional(),sortDirection:z([`asc`,`desc`]).optional(),limit:M().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),I({kind:B(`configure`),...Al,epoch:G,modelId:G.optional(),thinkingOptionId:G.optional(),permissionModeId:G.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`),I({kind:B(`prompt`),...Al,epoch:G,text:A().min(1).max(8e3),requestId:G.optional()}),I({kind:B(`interrupt`),...Al,epoch:G,turnId:G}),I({kind:B(`rename`),...Al,epoch:G,name:A().min(1).max(512)}),I({kind:B(`archive`),...Al,epoch:G,archived:N()}),I({kind:B(`respond`),...Al,epoch:G,requestId:Ja([G,M().int()]),result:R(A(),Ha())})]),Ml=A().min(1).max(1024),Nl=F({hostId:Ml,displayName:A().min(1).max(1024),source:z([`codex-managed`,`discovered`]),sshAlias:A().max(1024).nullable(),sshHost:A().min(1).max(1024),sshPort:M().int().min(1).max(65535).nullable(),identity:A().max(4096).nullable(),autoConnect:N(),connectionAnalyticsId:A().max(1024).optional()}),Pl=I({displayName:A().min(1).max(1024),hostname:A().min(1).max(1024),sshPort:M().int().min(1).max(65535).nullable(),identity:A().max(4096).nullable()});L(`action`,[I({action:B(`session`),operation:jl}),I({action:B(`list`)}),I({action:B(`catalog`)}),I({action:B(`read-thread`),hostId:Ml.refine(e=>e!==`local`),input:rc}),I({action:B(`save`),draft:Pl,previous:Nl.nullable()}),I({action:B(`remove`),previous:Nl}),I({action:B(`connect`),hostId:Ml,enabled:N()}),I({action:B(`state`),hostId:Ml}),I({action:B(`runtime`),hostId:Ml}),I({action:B(`update`),hostId:Ml.refine(e=>e!==`local`),version:Ol.shape.version})]),Ja([I({result:Zo}),I({error:I({code:M().int(),message:A()})})]),I({prompt:A().trim().min(1).max(2e3),cwd:A().max(4096).nullable()}),A().trim().min(1).max(60).nullable();let Fl=A().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Il=Ja([A(),F({en:A()}).catchall(A())]),Ll=F({title:Il.optional(),description:Il.optional(),icon:A().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:A().optional()});F({extensions:P(F({id:Fl,name:A().min(1).max(214),version:A().min(1).max(128),format:B(`dsh`),supportedTargets:$a([B(`web`)]),enabledTargets:P(B(`web`)).max(1),source:A().min(1).max(4096),projectUrl:A().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:A(),meta:Ll.optional(),loadError:A().optional()})),loadedIds:P(Fl),safeMode:N(),storeError:A().optional()});let Rl=A().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}/`);F({spec:A().trim().min(1).max(4096),registry:Rl.optional()}).strict(),F({id:Fl,enabled:N()}).strict(),F({id:Fl}).strict();let zl=I({id:A().min(1),kind:z([`task`,`monitor`,`loop`,`subagent`]),label:A(),status:z([`running`,`scheduled`,`completed`,`failed`,`cancelled`,`unknown`]),canStop:N(),commandItemId:os.optional(),schedule:A().optional(),nextRunAt:A().datetime({offset:!0}).optional(),relatedActivityId:A().optional(),threadId:H.optional()});I({activity:zl,output:A(),truncated:N()}),I({threadId:H}).extend({activityId:A().min(1)}),I({supported:N(),activities:P(zl)}),I({outcome:z([`stopped`,`alreadyStopped`,`notFound`])}),B(1);function Bl({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 gi(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:vi(t,`input`,e.processors),output:vi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function O(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 O(r.element,n);if(r.type===`set`)return O(r.valueType,n);if(r.type===`lazy`)return O(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 O(r.innerType,n);if(r.type===`intersection`)return O(r.left,n)||O(r.right,n);if(r.type===`record`||r.type===`map`)return O(r.keyType,n)||O(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:O(r.in,n)||O(r.out,n);if(r.type===`object`){for(let e in r.shape)if(O(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(O(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(O(e,n))return!0;return!!(r.rest&&O(r.rest,n))}return!1}let _i=(e,t={})=>n=>{let r=mi({...n,processors:t});return D(e,r),hi(r,e),gi(r,e)},vi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=mi({...i??{},target:a,io:t,processors:n});return D(e,o),hi(o,e),gi(o,e)},yi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},bi=(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=yi[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}))])}},xi=(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)},Si=(e,t,n,r)=>{n.type=`boolean`},Ci=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},wi=(e,t,n,r)=>{n.not={}},Ti=(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},Ei=(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}},Di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Oi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ki=(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=D(a.element,t,{...r,path:[...r.path,`items`]})},Ai=(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]=D(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=D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ji=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Mi=(e,t,n,r)=>{let i=e._zod.def,a=D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=D(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]]},Ni=(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)=>D(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?D(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)},Pi=(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=D(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=D(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=D(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)}},Fi=(e,t,n,r)=>{let i=e._zod.def,a=D(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`}]},Ii=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Li=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ri=(e,t,n,r)=>{let i=e._zod.def;D(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)))},zi=(e,t,n,r)=>{let i=e._zod.def;D(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},Bi=(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;D(o,t,r);let s=t.seen.get(e);s.ref=o},Vi=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Hi=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ui=(e,t,n,r)=>{let i=e._zod.innerType;D(i,t,r);let a=t.seen.get(e);a.ref=i},Wi=/*@__PURE__*/ u(`ZodISODateTime`,(e,t)=>{en.init(e,t),j.init(e,t)});function Gi(e){return/* @__PURE__ */ Nr(Wi,e)}let Ki=/*@__PURE__*/ u(`ZodISODate`,(e,t)=>{tn.init(e,t),j.init(e,t)});function qi(e){return/* @__PURE__ */ Pr(Ki,e)}let Ji=/*@__PURE__*/ u(`ZodISOTime`,(e,t)=>{nn.init(e,t),j.init(e,t)});function Yi(e){return/* @__PURE__ */ Fr(Ji,e)}let Xi=/*@__PURE__*/ u(`ZodISODuration`,(e,t)=>{rn.init(e,t),j.init(e,t)});function Zi(e){return/* @__PURE__ */ Ir(Xi,e)}let Qi=/*@__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}),$i=/* @__PURE__ */ Me(Qi),ea=/* @__PURE__ */ Ne(Qi),ta=/* @__PURE__ */ Pe(Qi),na=/* @__PURE__ */ Ie(Qi),ra=/* @__PURE__ */ Re(Qi),ia=/* @__PURE__ */ ze(Qi),aa=/* @__PURE__ */ Be(Qi),oa=/* @__PURE__ */ Ve(Qi),sa=/* @__PURE__ */ He(Qi),ca=/* @__PURE__ */ Ue(Qi),la=/* @__PURE__ */ We(Qi),ua=/* @__PURE__ */ Ge(Qi),da=/* @__PURE__ */ new WeakMap;function fa(e,t,n){let r=Object.getPrototypeOf(e),i=da.get(r);if(i||(i=/* @__PURE__ */ new Set,da.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 k=/*@__PURE__*/ u(`ZodType`,(e,t)=>(T.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:vi(e,`input`),output:vi(e,`output`)}}),e.toJSONSchema=_i(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>$i(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ta(e,t,n),e.parseAsync=async(t,n)=>ea(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>na(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ra(e,t,n),e.decode=(t,n)=>ia(e,t,n),e.encodeAsync=async(t,n)=>aa(e,t,n),e.decodeAsync=async(t,n)=>oa(e,t,n),e.safeEncode=(t,n)=>sa(e,t,n),e.safeDecode=(t,n)=>ca(e,t,n),e.safeEncodeAsync=async(t,n)=>la(e,t,n),e.safeDecodeAsync=async(t,n)=>ua(e,t,n),fa(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__ */ ri(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 P(this)},or(e){return Ja([this,e])},and(e){return Za(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 lr.add(t,{description:e}),t},meta(...e){if(e.length===0)return lr.get(this);let t=this.clone();return lr.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 lr.get(e)?.description},configurable:!0}),e)),pa=/*@__PURE__*/ u(`_ZodString`,(e,t)=>{Ht.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,fa(e,`_ZodString`,{regex(...e){return this.check(/* @__PURE__ */ Zr(...e))},includes(...e){return this.check(/* @__PURE__ */ ei(...e))},startsWith(...e){return this.check(/* @__PURE__ */ ti(...e))},endsWith(...e){return this.check(/* @__PURE__ */ ni(...e))},min(...e){return this.check(/* @__PURE__ */ Yr(...e))},max(...e){return this.check(/* @__PURE__ */ Jr(...e))},length(...e){return this.check(/* @__PURE__ */ Xr(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Yr(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Qr(e))},uppercase(e){return this.check(/* @__PURE__ */ $r(e))},trim(){return this.check(/* @__PURE__ */ ai())},normalize(...e){return this.check(/* @__PURE__ */ ii(...e))},toLowerCase(){return this.check(/* @__PURE__ */ oi())},toUpperCase(){return this.check(/* @__PURE__ */ si())},slugify(){return this.check(/* @__PURE__ */ ci())}})}),ma=/*@__PURE__*/ u(`ZodString`,(e,t)=>{Ht.init(e,t),pa.init(e,t),e.email=t=>e.check(/* @__PURE__ */ dr(ha,t)),e.url=t=>e.check(/* @__PURE__ */ _r(va,t)),e.jwt=t=>e.check(/* @__PURE__ */ Mr(Pa,t)),e.emoji=t=>e.check(/* @__PURE__ */ vr(ba,t)),e.guid=t=>e.check(/* @__PURE__ */ fr(ga,t)),e.uuid=t=>e.check(/* @__PURE__ */ pr(_a,t)),e.uuidv4=t=>e.check(/* @__PURE__ */ mr(_a,t)),e.uuidv6=t=>e.check(/* @__PURE__ */ hr(_a,t)),e.uuidv7=t=>e.check(/* @__PURE__ */ gr(_a,t)),e.nanoid=t=>e.check(/* @__PURE__ */ yr(xa,t)),e.guid=t=>e.check(/* @__PURE__ */ fr(ga,t)),e.cuid=t=>e.check(/* @__PURE__ */ br(Sa,t)),e.cuid2=t=>e.check(/* @__PURE__ */ xr(Ca,t)),e.ulid=t=>e.check(/* @__PURE__ */ Sr(wa,t)),e.base64=t=>e.check(/* @__PURE__ */ kr(ja,t)),e.base64url=t=>e.check(/* @__PURE__ */ Ar(Ma,t)),e.xid=t=>e.check(/* @__PURE__ */ Cr(Ta,t)),e.ksuid=t=>e.check(/* @__PURE__ */ wr(Ea,t)),e.ipv4=t=>e.check(/* @__PURE__ */ Tr(Da,t)),e.ipv6=t=>e.check(/* @__PURE__ */ Er(Oa,t)),e.cidrv4=t=>e.check(/* @__PURE__ */ Dr(ka,t)),e.cidrv6=t=>e.check(/* @__PURE__ */ Or(Aa,t)),e.e164=t=>e.check(/* @__PURE__ */ jr(Na,t)),e.datetime=t=>e.check(Gi(t)),e.date=t=>e.check(qi(t)),e.time=t=>e.check(Yi(t)),e.duration=t=>e.check(Zi(t))});function A(e){return/* @__PURE__ */ ur(ma,e)}let j=/*@__PURE__*/ u(`ZodStringFormat`,(e,t)=>{E.init(e,t),pa.init(e,t)}),ha=/*@__PURE__*/ u(`ZodEmail`,(e,t)=>{Gt.init(e,t),j.init(e,t)}),ga=/*@__PURE__*/ u(`ZodGUID`,(e,t)=>{Ut.init(e,t),j.init(e,t)}),_a=/*@__PURE__*/ u(`ZodUUID`,(e,t)=>{Wt.init(e,t),j.init(e,t)}),va=/*@__PURE__*/ u(`ZodURL`,(e,t)=>{Kt.init(e,t),j.init(e,t)});function ya(e){return/* @__PURE__ */ _r(va,e)}let ba=/*@__PURE__*/ u(`ZodEmoji`,(e,t)=>{qt.init(e,t),j.init(e,t)}),xa=/*@__PURE__*/ u(`ZodNanoID`,(e,t)=>{Jt.init(e,t),j.init(e,t)}),Sa=/*@__PURE__*/ u(`ZodCUID`,(e,t)=>{Yt.init(e,t),j.init(e,t)}),Ca=/*@__PURE__*/ u(`ZodCUID2`,(e,t)=>{Xt.init(e,t),j.init(e,t)}),wa=/*@__PURE__*/ u(`ZodULID`,(e,t)=>{Zt.init(e,t),j.init(e,t)}),Ta=/*@__PURE__*/ u(`ZodXID`,(e,t)=>{Qt.init(e,t),j.init(e,t)}),Ea=/*@__PURE__*/ u(`ZodKSUID`,(e,t)=>{$t.init(e,t),j.init(e,t)}),Da=/*@__PURE__*/ u(`ZodIPv4`,(e,t)=>{an.init(e,t),j.init(e,t)}),Oa=/*@__PURE__*/ u(`ZodIPv6`,(e,t)=>{on.init(e,t),j.init(e,t)}),ka=/*@__PURE__*/ u(`ZodCIDRv4`,(e,t)=>{sn.init(e,t),j.init(e,t)}),Aa=/*@__PURE__*/ u(`ZodCIDRv6`,(e,t)=>{cn.init(e,t),j.init(e,t)}),ja=/*@__PURE__*/ u(`ZodBase64`,(e,t)=>{un.init(e,t),j.init(e,t)}),Ma=/*@__PURE__*/ u(`ZodBase64URL`,(e,t)=>{fn.init(e,t),j.init(e,t)}),Na=/*@__PURE__*/ u(`ZodE164`,(e,t)=>{pn.init(e,t),j.init(e,t)}),Pa=/*@__PURE__*/ u(`ZodJWT`,(e,t)=>{hn.init(e,t),j.init(e,t)}),Fa=/*@__PURE__*/ u(`ZodNumber`,(e,t)=>{gn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),fa(e,`ZodNumber`,{gt(e,t){return this.check(/* @__PURE__ */ Gr(e,t))},gte(e,t){return this.check(/* @__PURE__ */ Kr(e,t))},min(e,t){return this.check(/* @__PURE__ */ Kr(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Ur(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Wr(e,t))},max(e,t){return this.check(/* @__PURE__ */ Wr(e,t))},int(e){return this.check(La(e))},safe(e){return this.check(La(e))},positive(e){return this.check(/* @__PURE__ */ Gr(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ Kr(0,e))},negative(e){return this.check(/* @__PURE__ */ Ur(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Wr(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ qr(e,t))},step(e,t){return this.check(/* @__PURE__ */ qr(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 M(e){return/* @__PURE__ */ Lr(Fa,e)}let Ia=/*@__PURE__*/ u(`ZodNumberFormat`,(e,t)=>{_n.init(e,t),Fa.init(e,t)});function La(e){return/* @__PURE__ */ Rr(Ia,e)}let Ra=/*@__PURE__*/ u(`ZodBoolean`,(e,t)=>{vn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r)});function N(e){return/* @__PURE__ */ zr(Ra,e)}let za=/*@__PURE__*/ u(`ZodNull`,(e,t)=>{yn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r)});function Ba(e){return/* @__PURE__ */ Br(za,e)}let Va=/*@__PURE__*/ u(`ZodUnknown`,(e,t)=>{bn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ha(){return/* @__PURE__ */ Vr(Va)}let Ua=/*@__PURE__*/ u(`ZodNever`,(e,t)=>{xn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function Wa(e){return/* @__PURE__ */ Hr(Ua,e)}let Ga=/*@__PURE__*/ u(`ZodArray`,(e,t)=>{Cn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.element=t.element,fa(e,`ZodArray`,{min(e,t){return this.check(/* @__PURE__ */ Yr(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Yr(1,e))},max(e,t){return this.check(/* @__PURE__ */ Jr(e,t))},length(e,t){return this.check(/* @__PURE__ */ Xr(e,t))},unwrap(){return this.element}})});function P(e,t){return/* @__PURE__ */ li(Ga,e,t)}let Ka=/*@__PURE__*/ u(`ZodObject`,(e,t)=>{On.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),x(e,`shape`,()=>t.shape),fa(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:Ha()})},loose(){return this.clone({...this._zod.def,catchall:Ha()})},strict(){return this.clone({...this._zod.def,catchall:Wa()})},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 F(e,t){let n={type:`object`,shape:e??{},...w(t)};return new Ka(n)}function I(e,t){return new Ka({type:`object`,shape:e,catchall:Wa(),...w(t)})}let qa=/*@__PURE__*/ u(`ZodUnion`,(e,t)=>{An.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.options=t.options});function Ja(e,t){return new qa({type:`union`,options:e,...w(t)})}let Ya=/*@__PURE__*/ u(`ZodDiscriminatedUnion`,(e,t)=>{qa.init(e,t),jn.init(e,t)});function L(e,t,n){return new Ya({type:`union`,options:t,discriminator:e,...w(n)})}let Xa=/*@__PURE__*/ u(`ZodIntersection`,(e,t)=>{Mn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r)});function Za(e,t){return new Xa({type:`intersection`,left:e,right:t})}let Qa=/*@__PURE__*/ u(`ZodTuple`,(e,t)=>{Fn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function $a(e,t,n){let r=t instanceof T;return new Qa({type:`tuple`,items:e,rest:r?t:null,...w(r?n:t)})}let eo=/*@__PURE__*/ u(`ZodRecord`,(e,t)=>{zn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function R(e,t,n){return!t||!t._zod?new eo({type:`record`,keyType:A(),valueType:e,...w(t)}):new eo({type:`record`,keyType:e,valueType:t,...w(n)})}let to=/*@__PURE__*/ u(`ZodEnum`,(e,t)=>{Bn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(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)=>{Vn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(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)=>{Hn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(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)=>{Wn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(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)=>{Gn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(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)=>{Kn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(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)=>{qn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(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)=>{Yn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(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)=>{Xn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(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)=>{Qn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(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)=>{$n.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(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)=>{tr.init(e,t),k.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:`readonly`,innerType:e})}let wo=/*@__PURE__*/ u(`ZodLazy`,(e,t)=>{rr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(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)=>{ir.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r)});function Do(e,t){return/* @__PURE__ */ ui(Eo,e??(()=>!0),t)}function Oo(e,t={}){return/* @__PURE__ */ di(Eo,e,t)}function ko(e,t){return/* @__PURE__ */ fi(e,t)}let Ao=z([`active`,`paused`,`blocked`,`usageLimited`,`budgetLimited`,`complete`]),jo=M().int().nonnegative().safe();F({objective:A().min(1),status:Ao,tokenBudget:jo.positive().nullable(),tokensUsed:jo,timeUsedSeconds:jo,createdAt:jo,updatedAt:jo});let Mo=z([`user`,`automatic`]).nullable();F({objective:A().min(1).optional(),status:z([`active`,`paused`]).optional(),tokenBudget:jo.positive().nullable().optional(),origin:Mo});let No=/^[A-Za-z0-9_-]{1,128}$/u,Po=A().min(1).max(128);L(`operation`,[F({operation:B(`create`),requestId:Po,body:A().min(1).max(16<<20),headers:R(A(),A()).default({})}),F({operation:B(`cancel`),requestId:Po}),F({operation:B(`hangup`),callId:A().regex(No)})]),F({status:M().int().min(200).max(599),body:A(),headers:R(A(),A())});let Fo=I({threadId:A().trim().min(1).max(128),verbs:P(z([`read`,`watch`,`send`,`cancel`])).min(1).max(4)}),Io=I({enrollmentId:A().trim().min(1).max(128),threadId:A().trim().min(1).max(128),clientId:A().trim().min(1).max(64),executablePath:A().min(1).max(4096),endpoint:A().min(1).max(2048),issuedAt:A().min(1).max(64),expiresAt:A().min(1).max(64),pairing:z([`session`,`machine`]),allowlist:P(Fo).max(64)});I({}),I({enrollments:P(Io).max(256)}),I({enrollmentId:A().trim().min(1).max(128)}),I({enrollmentId:A().trim().min(1).max(128),revoked:B(!0)}),I({v:B(1),secret:A().min(1).max(4096)}),I({v:B(1),ok:B(!0)}),I({requestId:A().min(1).max(128),deadlineMs:M().int().positive(),route:A().min(1).max(128),body:R(A(),Ha()),operationalClient:A().min(1).max(64).optional(),oauthClientId:A().min(1).max(128).optional(),dispatchGrant:z([`legacy-four`,`full-dispatch`]).optional()});let Lo=I({code:A().min(1).max(64),message:A().max(2048),details:Ha().optional()});I({requestId:A().min(1).max(128),status:M().int().min(100).max(599).optional(),body:Ha().optional(),error:Lo.optional()}),I({threadId:A().min(1),view:z([`result`,`messages`]).optional(),cursor:A().optional(),limit:M().int().min(1).max(100).optional()}),I({threadId:A().min(1),timeoutMs:M().int().min(1).max(25e3).optional(),view:z([`result`,`messages`]).optional(),cursor:A().optional(),limit:M().int().min(1).max(100).optional()}),I({threadId:A().min(1),message:A().min(1).max(2097152)}),I({}),I({clientId:A().min(1),pairing:z([`machine`,`session`]),expiresAt:A().min(1),allowlist:P(I({threadId:A().min(1),verbs:P(A().min(1)).min(1)})),threadId:A().min(1),link:z([`online`,`offline`]),runtime:z([`reachable`,`unreachable`])});let Ro=A().trim().min(1).max(64).regex(/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/u),zo=z([`all-threads`,`selected-workspaces`]),Bo=z([`public-relay`,`local`,`direct`]),Vo=z([`legacy-four`,`full-dispatch`]),Ho=A().trim().min(1).max(4096),Uo=A().trim().max(2048),Wo=I({name:Ro,createdAt:A().min(1).max(64),access:zo,workspaces:P(Ho).max(64),connectionMode:Bo,dispatchGrant:Vo,oauthClientId:A().trim().min(1).max(128).optional(),directUrl:Uo.optional(),mcpUrl:A().min(1).max(2048).optional(),mcpUrlNote:A().min(1).max(512).optional()});I({}),I({clients:P(Wo).max(256)});let Go=I({access:zo.optional(),workspaces:P(Ho).max(64).optional(),connectionMode:Bo.optional(),dispatchGrant:Vo.optional(),oauthClientId:A().trim().min(1).max(128).optional(),directUrl:Uo.optional()});Go.extend({name:Ro}),Wo.extend({token:A().min(1).max(256).optional()}),Go.extend({name:Ro,clearOauthClientId:B(!0).optional()}),I({name:Ro}),I({name:Ro,revoked:B(!0)}),F({}).strict(),F({enabled:N().optional(),browser:N().optional()}).strict().refine(e=>e.enabled!==void 0||e.browser!==void 0,{message:`Expected enabled or browser`}),F({enabled:N(),available:N(),unavailableReason:A().min(1).max(500).optional(),browser:N().optional(),browserFilesPresent:N().optional(),browserAvailable:N().optional(),browserUnavailableReason:A().min(1).max(500).optional(),applyFailed:N().optional(),applyError:A().min(1).max(500).optional()}).strict();function Ko(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 qo=Ja([A(),M(),N(),Ba()]);function Jo(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 Yo=Do(Jo,{message:`JSON value must not contain circular references`}),Xo=To(()=>Ja([qo,P(Xo),R(A(),Xo)])),Zo=Yo.pipe(Xo);Yo.pipe(P(Xo));let Qo=Yo.pipe(R(A(),Xo)),$o=I({code:A().min(1),message:A().min(1),retryable:N(),diagnostic:A().min(1).optional(),stage:A().min(1).optional(),durationMs:M().int().nonnegative().optional(),stderrTail:A().min(1).optional()}).superRefine(Ko([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),es=A().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),ts=e=>A().min(1).max(e).refine(e=>e.trim().length>0),ns=R(es,F({label:ts(256).optional(),description:ts(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),rs=R(es,ts(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),is=A().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),V=is.brand(),H=is.brand(),as=is.brand(),os=is.brand(),ss=is.brand(),cs=A().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),ls=cs.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),us=F({modes:P(F({id:ls,label:cs.max(256),description:cs.max(1024).optional(),dangerous:N().optional(),localizations:ns.optional()}).strict()).min(1).max(32),defaultModeId:ls}).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`]})});F({threadId:H,permissionModeId:ls}).strict();let U=M().int().safe().nonnegative(),ds=M().finite().nonnegative(),fs=M().finite().min(0).max(100),ps=F({version:Ja([B(3),B(4)]).optional(),requestId:A().min(1),turnId:A().min(1).max(1024),outputTokens:U,startedAtMs:U,completedAtMs:U}).strict().refine(e=>e.completedAtMs>e.startedAtMs),ms=F({version:Ja([B(2),B(3),B(4)]).optional(),value:ds,turnId:A().min(1).max(1024),at:U}).strict();F({outputTimings:P(ps).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:ms.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:ms.extend({value:U}).optional()}).strict();let hs=e=>rs.refine(t=>Object.values(t).every(t=>t.length<=e)),gs=F({composerIndicators:P(F({kind:B(`countdown`),id:A().min(1).max(64),expiresAtUnix:U,label:hs(256).optional(),tooltip:hs(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:ds.optional(),sessionOutputTokensPerSecond:ds.optional(),apiOutputTokensPerSecond:ds.optional(),reasoningOutputTokens:U.optional(),totalTokens:U.optional(),totalCostUsd:ds.optional(),totalCredits:ds.optional(),contextUsagePercent:ds.optional(),cacheHitRatePercent:fs.optional(),contextWindowTokens:U.optional(),contextUsedTokens:U.optional(),planFiveHourUsedPercent:fs.optional(),planFiveHourResetsAtUnix:U.optional(),planSevenDayUsedPercent:fs.optional(),planSevenDayResetsAtUnix:U.optional(),sessionCacheHitRatePercent:fs.optional(),timeToFirstOutputMs:U.optional(),costSource:z([`publicPrice`,`native`]).optional(),unpricedModels:P(A().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`]})}),_s=M().finite().min(0).max(100),vs=z([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),ys=F({id:A().min(1).max(256),label:A().min(1).max(256),localizations:ns.optional()}).strict(),bs=F({product:A().min(1),periodType:vs.optional(),scope:ys.optional(),localizations:ns.optional(),used:M().finite().nonnegative().optional(),limit:M().finite().nonnegative().optional(),unit:A().min(1).max(32).optional(),usagePercent:_s,resetsAt:A().min(1).optional()}).strict(),xs=F({availableCount:M().int().safe().positive(),nextExpiresAt:A().min(1).optional(),expiresAt:P(A().min(1)).min(1).max(32).optional()}).strict(),Ss=F({used:M().finite().nonnegative().optional(),limit:M().finite().nonnegative().optional(),unit:A().min(1).max(32).optional(),label:A().min(1).optional(),scope:ys.optional(),localizations:ns.optional(),usedPercent:_s,resetsAt:A().min(1).optional(),periodType:vs,productUsage:P(bs).min(1).optional(),resetCredits:xs.optional()}).strict();F({threadId:H,refresh:B(`exact`).optional()}).strict(),F({threadId:H,usage:gs.nullable(),accountCredits:Ss.optional(),accountCreditsSupported:N().optional()}).strict();let Cs=A().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),ws=F({id:Cs.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),Ts=Cs.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),Es=Cs.max(256),Ds=F({id:Ts,label:Cs.max(256)}).strict(),Os=F({ref:ws,label:Cs.max(256),resolvedModelLabel:Es.optional(),fastModel:ws.optional(),supportedThinkingOptionIds:P(Ts).optional()}).strict(),ks=P(Ds).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)}),As=F({models:P(Os),defaultModel:ws.optional(),thinkingOptions:ks,defaultThinkingOptionId:Ts.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`]})}),js=F({fork:N(),forkAcrossCwd:N(),rollbackLastTurn:N(),rollbackToCheckpoint:N().optional()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),Ms=z([`live`,`atCreate`]),Ns=F({configuration:F({selectModel:N(),selectThinkingOption:N(),selectPermissionMode:N(),permissionModeScope:Ms.default(`live`)}).strict(),history:js,subagents:F({observe:N(),readTranscript:N()}).strict().optional(),autonomousTurns:F({observe:N()}).strict().optional(),steer:N().optional()}).strict();F({effectiveModel:ws.optional(),resolvedModelLabel:Es.optional(),effectiveThinkingOptionId:Ts.optional(),availableThinkingOptions:ks.optional(),effectivePermissionModeId:ls.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 Ps=F({open:B(!0)}).strict();Ja([F({status:B(`ready`),catalog:As,permissionModes:us.optional(),capabilities:Ns,webUi:Ps.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`]})}),F({status:z([`notInstalled`,`unavailable`,`error`]),error:$o}).strict()]),F({harnessId:V,cwd:Cs.max(16384).optional(),refresh:N().optional(),purpose:B(`availability`).optional()}).strict(),F({harnessId:V}).strict(),F({}).strict(),F({threadId:H,model:ws}).strict(),F({threadId:H,thinkingOptionId:Ts}).strict(),F({threadId:H,includeReferenceCapability:N().optional()}).strict(),L(`owner`,[F({owner:B(`codex`),locked:N(),effectiveModel:ws.optional(),resolvedModelLabel:Es.optional(),effectiveThinkingOptionId:Ts.optional(),effectivePermissionModeId:ls.optional(),history:js.optional(),supportsThreadReferences:B(!0).optional()}).strict(),F({owner:B(`external`),harnessId:Cs.max(256),transportModelId:Cs.max(1024),effectiveModel:ws.optional(),resolvedModelLabel:Es.optional(),effectiveThinkingOptionId:Ts.optional(),availableThinkingOptions:ks.optional(),effectivePermissionModeId:ls.optional(),history:js,usage:gs.optional(),locked:B(!0)}).strict()]),F({threadIds:P(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 Fs=L(`owner`,[F({threadId:H,owner:B(`codex`)}).strict(),F({threadId:H,owner:B(`external`),harnessId:A().max(256).pipe(V)}).strict()]);F({threads:P(Fs).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)}),F({threadId:H,text:A().optional()}).strict(),F({kind:B(`application`),value:A().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),l}}).pipe(F({expectedTurnId:as,clientUserMessageId:A().min(1),delivery:z([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),z([`activeTurn`,`newTurn`]),F({delivery:z([`official`,`activeTurn`,`newTurn`])}).strict();let Is=I({chatExperience:z([`chatgpt`,`codex`]),chatConnection:z([`desktop`,`gateway`]),workConnection:z([`desktop`,`gateway`])});Object.freeze({chatExperience:`chatgpt`,chatConnection:`desktop`,workConnection:`gateway`});let Ls=Is.extend({inject:N()});L(`operation`,[I({operation:B(`get`),runtime:I({id:A().uuid(),revision:A().max(64),activeCall:N()}).optional()}),I({operation:B(`migrate`),routes:Is}),I({operation:B(`set`),settings:Ls,revision:A().max(64)}),I({operation:B(`restart`),confirm:B(!0)})]),I({settings:Ls,initialized:N(),revision:A(),activeInject:N().nullable(),envOverride:z([`0`,`1`]).nullable(),activeEnvOverride:z([`0`,`1`]).nullable(),routesActive:N().nullable(),activeCall:N().nullable(),gatewayReady:N().nullable(),restartAvailable:N(),restart:I({phase:z([`idle`,`restarting`,`succeeded`,`failed`]),error:A().nullable()})}),F({threadId:H}).strict(),F({confirmed:N()}).strict(),F({threadIds:P(A().min(1))}).strict(),F({threadId:A().min(1).max(1024),pinned:N()}).strict(),F({}).strict(),F({parents:R(A().min(1),A().min(1))}).strict(),F({prompt:A().max(16384).optional()}).strict(),F({projects:P(F({id:A(),name:A(),rootPaths:P(A())})),assignments:R(A(),A()),projectless:P(A()),pinned:P(A())});let Rs=R(A(),Ha()),zs=F({epoch:A().uuid(),sequence:M().int().nonnegative()});L(`type`,[F({type:B(`skills-changed`),cursor:zs,cwd:A().optional()}),F({type:B(`harness-inspection-changed`),cursor:zs,harnessId:A().min(1)}),F({type:B(`display-settings-changed`),cursor:zs}),F({type:B(`preferences-changed`),cursor:zs,revision:M().int().nonnegative()}),F({type:B(`hello`),version:B(1),cursor:zs,reset:N()}),F({type:B(`changed`),cursor:zs,threadId:A().min(1),method:A().min(1)})]);let Bs=L(`type`,[F({type:B(`text`),id:A(),prompt:A(),secret:N().optional(),optional:N().optional()}),F({type:B(`choice`),id:A(),prompt:A(),multiple:N(),allowOther:N(),optional:N().optional(),options:P(F({value:A(),label:A(),description:A().optional()}))})]),Vs=L(`type`,[F({type:B(`approval`),title:A(),description:A().optional(),subject:Ha().optional(),actions:P(F({id:A(),label:A(),effect:A()}))}),F({type:B(`question`),title:A().optional(),questions:P(Bs)})]),Hs=F({requestId:Ja([A(),M().int()]),threadId:A(),kind:z([`approval`,`question`]),interaction:Vs,request:Rs}),Us=F({id:A().min(1),clientUserMessageId:A().min(1),input:P(Rs),presentationInput:P(Rs).nullable().optional()}).passthrough();F({fields:P(F({path:P(Ja([A(),M().int().nonnegative()])),originalLength:M().int().nonnegative()}))});let Ws=F({id:A().min(1),status:A().min(1),codexhostTurnOutcome:F({status:B(`unknown`),reason:A()}).optional(),items:P(F({id:A().min(1),type:A().min(1)}).passthrough()),codexhostFileOperations:P(F({beforeItemId:A().nullable(),item:F({id:A().min(1),type:A().min(1)}).passthrough()})).optional(),error:F({message:A().optional()}).passthrough().nullable().optional(),fingerprint:A().min(1).optional(),unchanged:B(!0).optional()}).passthrough(),Gs=F({id:A().min(1).max(512),fingerprint:A().min(1).max(128)});F({threadId:A().min(1),knownTurns:P(Gs).max(64).optional(),truncateToolOutput:N().optional()});let Ks=F({harnessId:A().min(1),nativeSessionId:A().min(1)});F({cursor:zs,activeTurnId:A().min(1).nullable().optional(),command:F({name:A().min(1),turn:Ws,subsequentTurnId:A().min(1).optional()}).optional(),thread:F({id:A().min(1),cwd:A(),modelProvider:A().min(1),createdAt:M(),updatedAt:M(),status:F({type:A()}).passthrough(),name:A().nullable().optional(),preview:A().optional(),codexhostImportSource:Ks.optional(),turns:P(Ws).length(0)}).passthrough(),turnsPage:F({data:P(Ws).max(5),nextCursor:A().nullable()}),configuration:F({native:F({model:A().min(1).max(1024).optional(),reasoningEffort:A().min(1).max(128).optional()}).optional(),effectiveModel:ws.optional(),effectiveThinkingOptionId:Ts.optional(),effectivePermissionModeId:ls.optional()}),queue:F({items:P(Us),pausedReason:z([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:P(Hs)}),F({version:B(1),owner:B(`service`).optional(),pid:M().int().positive(),port:M().int().min(1).max(65535),token:A().regex(/^[0-9a-f]{64}$/u),startedAt:M(),epoch:A().uuid()}),F({epoch:A().uuid(),threadId:A().min(1),requestId:Ja([A(),M().int()]),result:Rs}),F({includeArchived:N().optional(),officialCursor:F({live:A().nullable(),archived:A().nullable().optional()}).strict().optional()}).strict(),F({threads:P(Qo),ownership:P(Fs),archivedThreadIds:P(H),officialCursor:F({live:A().nullable(),archived:A().nullable().optional()}).strict().optional()}).strict();let qs=A().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);F({available:N()}).strict(),F({path:A().min(1),mimeType:qs}).strict();let Js=z([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);L(`ok`,[F({ok:B(!0),text:A()}).strict(),F({ok:B(!1),error:F({code:Js}).strict()}).strict()]),F({threadId:H.optional(),cwd:A().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let Ys=F({name:A().min(1).regex(/^[^\s[\]]+$/u),description:A().optional(),path:A().min(1),scope:z([`project`,`global`]),source:A().min(1)}).strict();F({revision:M().int().nonnegative(),complete:N(),skills:P(Ys),warnings:P(A()).optional()}).strict(),F({cwd:A().min(1).optional()}).strict();let Xs=F({kind:z([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:A().min(1)}).strict(),Zs=L(`status`,[F({status:B(`not-installed`)}),F({status:B(`not-running`)}),F({status:B(`not-logged-in`)}),F({status:B(`https-disabled`)}),F({status:B(`not-serving`),command:A()}),F({status:B(`occupied`),target:A()}),F({status:B(`serving`),url:A(),funnel:N()}),F({status:B(`error`),message:A()})]);F({state:Zs,error:A().optional()}).strict();let Qs=L(`status`,[F({status:B(`on`)}),F({status:B(`off`)}),F({status:B(`invalid`),reason:A()})]),$s=F({lan:N(),autostart:Qs}).strict(),ec=F({expiresAt:A().optional(),issuing:N(),failure:F({detail:A().optional(),retryAt:A(),paused:N()}).optional()}),tc=L(`status`,[F({status:B(`off`),reason:z([`invite`,`name-taken`,`banned`]).optional()}),F({status:B(`connecting`),reason:z([`full`,`unreachable`]).optional()}),F({status:B(`connected`),url:A(),certificate:ec}),F({status:B(`missing-certificate`),url:A(),certificate:ec}),F({status:B(`stopped`),reason:z([`replaced`,`rejected`,`unsupported-version`])})]);A().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()),A().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let nc=z([`official`,`self-hosted`]);F({secret:A().min(1),lastUsedAt:M().nullable(),networkUrls:P(Xs),directCandidates:P(Xs).optional(),tailscale:Zs,background:$s.optional(),relay:F({state:tc,enabled:N(),kind:nc,officialHost:A(),customHost:A().optional(),officialHostname:A().optional(),customHostname:A().optional(),quotaUntil:A().optional()}).strict().optional()}).strict();let rc=I({threadId:A().min(1).max(1024),view:z([`result`,`messages`]),from:M().int().min(1).max(2**53-1).optional(),to:M().int().min(1).max(2**53-1).optional()}),ic=F({id:A().min(1).max(256),harnessId:A().min(1),label:A().min(1).max(512),provider:z([`openai-codex`,`xai`])}).strict(),ac=A().regex(/^[a-z][a-z0-9-]{0,47}$/),oc=F({name:ac,source:ic,importedAt:A()}).strict(),sc=L(`action`,[F({action:B(`list`)}).strict(),F({action:B(`import`),sourceId:A().min(1).max(256),name:ac,confirmed:B(!0)}).strict(),F({action:B(`reimport`),sourceId:A().min(1).max(256),name:ac,confirmed:B(!0)}).strict(),F({action:B(`remove`),name:ac,confirmed:B(!0)}).strict()]),cc=F({provider:A().min(1).max(128),type:z([`oauth`,`api_key`,`unknown`]),label:A().min(1).max(512).optional(),vendor:z([`openai-codex`,`xai`]).optional()}).strict();F({sources:P(ic),targets:P(F({harnessId:A(),providers:P(z([`openai-codex`,`xai`])),imports:P(oc),others:P(cc).default([])}).strict())}).strict(),F({targetHarnessId:A().min(1).max(128).optional(),request:sc}).strict(),F({events:N()});let lc=P(I({agent:A().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`);I({entries:lc.nullable()}),I({}),I({entries:lc,initializeOnly:N().optional()});let uc=I({enabled:N(),timeoutMinutes:M().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let dc=A().regex(/^external$/u),fc=V.transform(e=>String(e)),pc=I({model:ws.optional(),thinkingOptionId:Ts.optional(),permissionModeId:ls.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),mc=I({lastHarness:V.optional(),byHarness:R(fc,pc)}),hc=A().min(1).max(1024),gc=I({idleRelease:uc.optional(),favorites:R(fc,P(hc).max(2048)).default({}),newThread:mc.optional()});I({scope:dc,revision:M().int().nonnegative(),values:gc}),I({scope:dc.default(`external`)});let _c=L(`kind`,[I({kind:B(`idleRelease`),value:uc}),I({kind:B(`favorite`),harnessId:V,modelId:hc,enabled:N()}),I({kind:B(`favorites`),harnessId:V,modelIds:P(hc).max(2048)}),I({kind:B(`newThread`),lastHarness:V.optional(),harnessId:V.optional(),configuration:pc.optional()})]);I({scope:dc.default(`external`),operations:P(_c).min(1).max(256),initializeOnly:N().optional(),expectedRevision:M().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`})}),I({version:B(1),revision:M().int().nonnegative(),scopes:R(dc,gc)});let vc=M().finite().nonnegative(),yc=I({input:vc,output:vc,cacheRead:vc.optional(),cacheWrite:vc.optional(),cacheWrite1h:vc.optional()}),bc=A().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);I({path:A(),entries:P(I({key:A(),price:yc})),error:A().nullable()}),I({}),I({key:bc,price:yc.nullable(),previousKey:bc.optional()}),I({model:bc});let xc=I({official:N().optional(),canonicalModelId:A().min(1).optional(),provider:A().min(1).max(512),model:A().min(1).max(512),price:yc});I({price:yc.nullable(),suggestions:P(xc).max(6).optional()});let Sc=[`today`,`7d`,`30d`,`90d`,`all`],W=M().int().min(0).max(2**53-1),Cc=A().regex(/^\d{4}-\d{2}-\d{2}$/u),wc=A().min(1).max(128),Tc=A().min(1).max(512),Ec=A().min(1).max(4096);I({range:z(Sc),timeZone:A().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:wc.optional(),model:Tc.nullable().optional(),project:Ec.nullable().optional(),date:Cc.optional()});let Dc=I({requests:W,inputTokens:W,cachedInputTokens:W,cacheWriteInputTokens:W,cacheKnownInputTokens:W,cacheHitCachedInputTokens:W,cacheHitInputTokens:W,outputTokens:W,reasoningOutputTokens:W,costUsd:M().finite().min(0),unpricedRequests:W,unmeteredRequests:W}),Oc=Dc.shape,kc=I({harness:wc,sessionId:A().min(1).max(512),project:Ec.nullable(),title:A().min(1).max(200).optional(),models:P(Tc).max(16),firstAtMs:W,lastAtMs:W,...Oc});I({range:z(Sc),from:Cc.nullable(),to:Cc,filters:I({harness:wc.nullable(),model:Tc.nullable(),unknownModel:N(),project:Ec.nullable(),unknownProject:N(),date:Cc.nullable()}),reading:I({complete:N(),sources:W,read:W}),failures:P(I({harness:wc,message:A().max(2048)})).max(256),options:I({harnesses:P(wc).max(256),models:P(Tc.nullable()).max(4096),projects:P(Ec.nullable()).max(4096)}),modelLabels:P(I({harness:wc,model:Tc,label:Tc})).max(4096).optional(),credits:P(I({harness:wc,model:Tc.nullable(),credits:M().finite().min(0),reportedRequests:W,requests:W})).max(4096).optional(),totals:Dc,daily:P(I({date:Cc,harness:wc,...Oc})).max(2e5),hourly:P(I({weekday:M().int().min(0).max(6),hour:M().int().min(0).max(23),...Oc})).max(168),byHarness:P(I({harness:wc,...Oc})).max(256),byModel:P(I({model:Tc.nullable(),...Oc,harnessPricedRequests:W})).max(4096),byProject:P(I({project:Ec.nullable(),...Oc})).max(4096),sessions:P(kc).max(100),recentSessions:P(kc).max(100).optional()}),F({threadId:H}),F({discarded:N()}),I({threadId:H,unobserved:B(!0).optional()});let Ac={id:A().min(1),prompt:A(),optional:N()},jc=I({deadlineUnixMs:M().int().min(0).max(864e13),action:z([`recommended`,`decline`]),resetOnActivity:N().optional()}),Mc=L(`type`,[I({...Ac,type:B(`choice`),multiple:N(),allowOther:N(),options:P(I({value:A().min(1),label:A(),description:A().optional()})).min(1)}),I({...Ac,type:B(`text`),multiline:N(),secret:B(!1),placeholder:A().optional(),prefill:A().optional()})]);I({questions:P(I({interactionId:ss,turnId:as,title:A().optional(),expiresAt:A().optional(),autoResolution:jc.optional(),questions:P(Mc).min(1)}))});let Nc=z([`answered`,`skipped`,`closedByHarness`,`expired`,`turnEnded`]),Pc=I({interactionId:ss,turnId:as,itemId:os,title:A().optional(),questions:P(Mc).min(1),outcome:Nc,answers:R(A(),P(A()))}),Fc=I({interactionId:ss,turnId:as,itemId:os});I({records:P(Pc),pendingAnchors:P(Fc)}),I({threadId:H,interactionId:ss,turnId:as,answers:R(A(),P(A())),cancelled:N().optional()}),I({accepted:B(!0)}),I({threadId:H,interactionId:ss,turnId:as}),I({autoResolution:jc.nullable()});let Ic=F({path:A(),oldText:A().nullable(),newText:A()});F({sessionId:A().min(1),turn:M().int().nonnegative(),path:A().min(1).optional()}),F({diffs:P(Ic)}),I({}),I({});let Lc=F({reference:F({sessionId:A().min(1),epoch:A().min(1),turn:M().int().nonnegative(),seq:M().int().nonnegative(),callId:A().min(1),part:M().int().nonnegative(),version:A().min(1)}),length:M().int().nonnegative(),bytes:M().int().nonnegative()});function Rc(e){if(typeof e!=`object`||!e||!(`codexhostOutput`in e))return[];let t=P(Lc).safeParse(e.codexhostOutput);return t.success?t.data:[]}I({title:A().trim().min(1).max(200),type:z([`info`,`warning`,`danger`]),body:A().trim().min(1).max(16384)}),I({}),I({url:A().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/voice/gateway-status.codexhost/enrollment/list.codexhost/enrollment/revoke.codexhost/external-clients/list.codexhost/external-clients/create.codexhost/external-clients/update.codexhost/external-clients/revoke.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/grok-computer-use/get.codexhost/harness/grok-computer-use/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 zc=z([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Bc=z([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);I({threadId:A(),title:A(),harnessId:A(),state:zc,reason:Bc,inactiveMs:M().nonnegative()}),I({threadId:H,turnId:as});let Vc=F({amount:M().finite().nonnegative(),currency:A().trim().min(1).max(8),label:A().trim().min(1).max(128).optional()}).strict(),Hc=F({email:A().trim().min(1).max(320).optional(),label:A().trim().min(1).max(256).optional(),plan:A().trim().min(1).max(128).optional(),credits:Ss.optional(),balance:Vc.optional()}).strict();function Uc(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 Wc=Uc(Hc),Gc={harnessId:V,harnessName:A().trim().min(1).max(128)},Kc=F(Gc).strict();F({}).strict(),F({sources:P(Kc).max(128)}).strict(),F({harnessId:V,refresh:N().optional()}).strict(),F({...Gc,account:Wc.nullable(),accounts:P(Wc).max(8).optional()}).strict(),F({refresh:N().optional()}).strict(),F({accounts:P(Uc(Hc.extend(Gc))).max(128)}).strict();let qc=A().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(V),Jc=qc.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Yc=A().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`),Xc=ya().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Zc=F({en:A().max(4096),"zh-CN":A().max(4096).optional()}).strict(),Qc=F({commands:P(F({terminal:A().max(256),command:A().max(4096)}).strict()).max(8),before:Zc.optional(),after:Zc.optional(),downloads:P(F({label:A().max(128),url:Xc}).strict()).max(8).optional()}).strict(),$c={id:qc,name:A().trim().min(1).max(128),version:A().min(1).max(128),kind:B(`usage`).optional(),iconStyle:F({vector:F({viewBox:A().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:A().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:P(F({d:A().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:z([`evenodd`,`nonzero`]).optional(),fill:A().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:A().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:M().min(0).max(50).optional(),paddingRatio:M().min(0).max(.25).optional()}).strict().optional(),installation:Qc.optional(),notice:Zc.optional(),launchCommand:B(!0).optional(),links:F({website:Xc.optional(),documentation:Xc.optional(),installation:Xc.optional()}).strict().optional()};F({manifestVersion:B(1),...$c,adapterApiVersion:M().int().positive(),entry:Yc,icon:Yc.optional()}).strict();let el=A().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),tl=F({...$c,icon:el.optional()}).strict();F({}).strict(),F({plugins:P(tl.extend({id:Jc})).max(128)}).strict(),F({version:B(1),enabled:P(qc).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),F({harnessId:Jc,model:ws.optional(),thinkingOptionId:Ts.optional(),permissionModeId:ls.optional(),prewarm:B(!0).optional()}).strict();let nl=A().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);F({harnessId:Jc}).strict().extend({path:nl.nullable()}),F({path:nl.nullable(),restartRequired:N()}).strict(),F({harnessId:V,action:z([`check`,`update`,`install`])}).strict();let rl=F({currentVersion:A().min(1).max(128),latestVersion:A().min(1).max(128),updateAvailable:N(),canUpdate:N(),versionKind:z([`cli`,`application`]).optional(),manualUpdateUrl:ya().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:A().max(2048).optional(),messageCode:A().min(1).max(128).optional(),notice:rs.optional(),latestVersionKind:z([`unknown`,`tracking-branch`]).optional()}).strict();F({taskId:A().uuid()}).strict(),L(`status`,[F({taskId:A().uuid(),status:B(`running`)}).strict(),F({taskId:A().uuid(),status:B(`succeeded`),result:rl}).strict(),F({taskId:A().uuid(),status:B(`failed`),error:F({code:M().int(),message:A().min(1).max(2048)}).strict()}).strict()]);let il=A().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),al=A().trim().min(1),ol=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`]),sl=F({accountId:il,label:al.max(256),email:A().email().max(320).optional(),planType:ol.optional()}).strict(),cl=z([`ready`,`unavailable`]);F({version:B(2),currentAccountId:il.nullable(),phase:cl,revision:M().int().nonnegative(),instanceId:al.max(1024).optional(),accounts:P(sl).max(1)}).strict(),F({accountId:il,refresh:N().optional()}).strict(),F({accountId:il,usage:gs.nullable(),accountCredits:Ss.optional(),freshness:z([`live`,`cached`]),observedAt:A().datetime().nullable()}).strict();let ll=1e3,ul=A().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),dl=ul.max(1024),fl=F({nativeSessionId:dl,title:ul.max(4096).nullable(),updatedAt:M().int().nonnegative().max(864e13),cwd:ul.max(16384),running:N().nullable()}).strict();F({}).strict(),F({harnesses:P(F({harnessId:Jc,name:ul.max(128)}).strict()).max(128)}).strict(),F({harnessId:Jc,query:A().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:M().int().nonnegative().safe().optional(),limit:M().int().min(1).max(ll).optional()}).strict(),F({candidates:P(fl).max(ll),total:M().int().nonnegative().safe()}).strict(),F({harnessId:Jc,nativeSessionId:dl}).strict(),F({threadId:ul.max(1024).pipe(H)}).strict();let pl=A().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),ml=dl,hl=fl;F({}).strict(),F({candidates:P(hl).max(1e3)}).strict(),F({nativeSessionId:ml}).strict(),F({threadId:pl.max(1024).pipe(H)}).strict(),F({threadId:H,lastTurnId:as}).strict(),F({threadId:H}).strict();let gl=A().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();F({commands:P(F({id:gl,invocation:A().min(1).max(128),label:A().trim().min(1).max(128),description:A().trim().min(1).max(512).optional(),localizations:ns.optional(),argumentMode:z([`none`,`text`]),kind:z([`command`,`skill`]).optional()}).strict()),warnings:P(A().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)}),F({harnessId:V,cwd:A().min(1).optional()}).strict(),F({threadId:H}).strict(),F({threadId:H,commandId:gl,turnId:as.optional(),arguments:Qo.optional()}).strict(),F({accepted:B(!0),turnId:as.optional()}).strict();let _l=B(`2.0`).optional(),vl=Wa().optional(),yl=A().min(1),bl=Ja([A(),M().int()]),xl=F({code:M().int(),message:A(),data:Zo.optional()}).catchall(Zo).superRefine(Ko([`data`]));Ja([F({jsonrpc:_l,id:bl,method:yl,params:Zo.optional(),result:vl,error:vl}).catchall(Zo).superRefine(Ko([`jsonrpc`,`params`,`result`,`error`])),F({jsonrpc:_l,id:vl,method:yl,params:Zo.optional(),result:vl,error:vl}).catchall(Zo).superRefine(Ko([`jsonrpc`,`id`,`params`,`result`,`error`])),F({jsonrpc:_l,id:bl,method:vl,params:vl,result:Zo,error:vl}).catchall(Zo).superRefine(Ko([`jsonrpc`,`method`,`params`,`error`])),F({jsonrpc:_l,id:bl,method:vl,params:vl,result:vl,error:xl}).catchall(Zo).superRefine(Ko([`jsonrpc`,`method`,`params`,`result`]))]);let Sl=A().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});I({harnessId:V,nativeSessionId:Sl,locator:Zo.optional(),formatVersion:B(1)}).superRefine(Ko([`locator`])),I({harnessId:V,nativeSessionId:Sl,nativeTurnKey:Sl,formatVersion:B(1)}),I({harnessId:V,nativeSessionId:Sl,checkpointId:Sl,locator:Zo.optional(),formatVersion:B(1)}).superRefine(Ko([`locator`]));let Cl=A().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),wl=z([`npm`,`windows-installer`,`macos-dmg`]),Tl=I({version:Cl,installation:wl,phase:z([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),updatedAt:M().int().nonnegative(),downloadedBytes:M().int().nonnegative().optional(),totalBytes:M().int().positive().optional(),error:A().min(1).max(500).nullable(),serviceStopOutput:A().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`})});I({});let El=A().max(300).regex(/^https:\/\/github\.com\/karlorz\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);I({currentVersion:Cl,installation:wl.nullable(),latestVersion:Cl.nullable(),updateAvailable:N(),installationAvailable:N(),releaseNotes:A().min(1).max(2e4).nullable(),releaseNotesUrl:El.nullable(),status:Tl.nullable(),error:A().min(1).max(500).nullable()}),I({status:Tl}),I({status:Tl.nullable()}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let Dl=z([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);F({runningVersion:A().nullable(),installedVersion:A().nullable(),restartRequired:N(),remote:N(),updateSupported:N(),update:F({phase:Dl,targetVersion:A().nullable(),error:A().nullable()})});let Ol=F({version:A().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();F({hostname:A().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:M().int().min(1).max(65535).nullable(),identity:A().max(4096).nullable(),action:z([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:N().optional(),version:A().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),F({state:z([`installed`,`not-installed`])}).strict();let G=A().min(1).max(1024),kl={hostId:G.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},Al={...kl,threadId:G},jl=L(`kind`,[I({kind:B(`hosts`)}),I({kind:B(`status`),...Al}),I({kind:B(`list`),...kl,cursor:A().nullable(),archived:N()}),I({kind:B(`read`),...Al,page:I({cursor:A().min(1).max(8192).nullable(),epoch:G.optional(),sortDirection:z([`asc`,`desc`]).optional(),limit:M().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),I({kind:B(`usage`),...Al,epoch:G}),I({kind:B(`configure`),...Al,epoch:G,modelId:G.optional(),thinkingOptionId:G.optional(),permissionModeId:G.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`),I({kind:B(`prompt`),...Al,epoch:G,text:A().min(1).max(8e3),requestId:G.optional()}),I({kind:B(`interrupt`),...Al,epoch:G,turnId:G}),I({kind:B(`rename`),...Al,epoch:G,name:A().min(1).max(512)}),I({kind:B(`archive`),...Al,epoch:G,archived:N()}),I({kind:B(`respond`),...Al,epoch:G,requestId:Ja([G,M().int()]),result:R(A(),Ha())})]),Ml=A().min(1).max(1024),Nl=F({hostId:Ml,displayName:A().min(1).max(1024),source:z([`codex-managed`,`discovered`]),sshAlias:A().max(1024).nullable(),sshHost:A().min(1).max(1024),sshPort:M().int().min(1).max(65535).nullable(),identity:A().max(4096).nullable(),autoConnect:N(),connectionAnalyticsId:A().max(1024).optional()}),Pl=I({displayName:A().min(1).max(1024),hostname:A().min(1).max(1024),sshPort:M().int().min(1).max(65535).nullable(),identity:A().max(4096).nullable()});L(`action`,[I({action:B(`session`),operation:jl}),I({action:B(`list`)}),I({action:B(`catalog`)}),I({action:B(`read-thread`),hostId:Ml.refine(e=>e!==`local`),input:rc}),I({action:B(`save`),draft:Pl,previous:Nl.nullable()}),I({action:B(`remove`),previous:Nl}),I({action:B(`connect`),hostId:Ml,enabled:N()}),I({action:B(`state`),hostId:Ml}),I({action:B(`runtime`),hostId:Ml}),I({action:B(`update`),hostId:Ml.refine(e=>e!==`local`),version:Ol.shape.version})]),Ja([I({result:Zo}),I({error:I({code:M().int(),message:A()})})]),I({prompt:A().trim().min(1).max(2e3),cwd:A().max(4096).nullable()}),A().trim().min(1).max(60).nullable();let Fl=A().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Il=Ja([A(),F({en:A()}).catchall(A())]),Ll=F({title:Il.optional(),description:Il.optional(),icon:A().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:A().optional()});F({extensions:P(F({id:Fl,name:A().min(1).max(214),version:A().min(1).max(128),format:B(`dsh`),supportedTargets:$a([B(`web`)]),enabledTargets:P(B(`web`)).max(1),source:A().min(1).max(4096),projectUrl:A().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:A(),meta:Ll.optional(),loadError:A().optional()})),loadedIds:P(Fl),safeMode:N(),storeError:A().optional()});let Rl=A().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}/`);F({spec:A().trim().min(1).max(4096),registry:Rl.optional()}).strict(),F({id:Fl,enabled:N()}).strict(),F({id:Fl}).strict();let zl=I({id:A().min(1),kind:z([`task`,`monitor`,`loop`,`subagent`]),label:A(),status:z([`running`,`scheduled`,`completed`,`failed`,`cancelled`,`unknown`]),canStop:N(),commandItemId:os.optional(),schedule:A().optional(),nextRunAt:A().datetime({offset:!0}).optional(),relatedActivityId:A().optional(),threadId:H.optional()});I({activity:zl,output:A(),truncated:N()}),I({threadId:H}).extend({activityId:A().min(1)}),I({supported:N(),activities:P(zl)}),I({outcome:z([`stopped`,`alreadyStopped`,`notFound`])}),B(1);function Bl({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 Vl(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function Hl(e){return e.startsWith(`/`)||Vl(e)}function Ul(e,t){if(Hl(t)||e===void 0||e===``)return t;let n=Vl(e)&&e.includes(`\\`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t.replace(/^[/\\]+/,``)}`}function Wl(e,t){if(t===void 0||t===``||Vl(e)||Vl(t))return e;let n=t.replace(/\/+$/,``);return n===``||n===`/`?e:e.replace(/\/+$/,``)===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function Gl(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 Kl={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`},ql={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`},Jl={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 ql[e]??`others`}function Xl(e){return Jl[e]??Kl[Yl(e)]}function Zl(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 Ql(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 $l(e){try{return JSON.parse(e)}catch{return}}function eu(e){let t=e.indexOf(`
125
125
  `);return t===-1?e:e.slice(0,t)}function tu(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t!==``)return t}}let nu={bash:[`description`,`command`],read:[`path`,`file_path`,`url`],search:[`query`,`pattern`,`url`],write:[`path`,`file_path`],edit:[`path`,`file_path`],code:[`description`],others:[]};function ru(e,t){let n=$l(t);if(typeof n!=`object`||!n)return eu(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(eu).join(`, `)}let i=tu(r,nu[e]);if(i!==void 0)return eu(i);for(let e of Object.values(r))if(typeof e==`string`&&e!==``)return eu(e);return eu(t)}let iu=[`path`,`file_path`],au=/* @__PURE__ */ new Set([`read`,`write`,`edit`]);function ou(e,t,n,r){if(au.has(e)){let e=t.complete(`file_path`)?t.text(`file_path`):void 0,i=e!==void 0&&e!==``&&t.complete(`file_path`)?eu(e):void 0;return{summary:i===void 0?``:Wl(Gl(i,n),r),filePath:i}}let i=t.text(`description`);return{summary:i===void 0?``:eu(i),filePath:void 0}}function su(e,t){if(!au.has(e))return;let n=$l(t);if(typeof n!=`object`||!n)return;let r=tu(n,iu);return r===void 0?void 0:eu(r)}function cu(e,t){if(t===``)return null;let n=$l(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 lu(e,t,n,r){let i=Yl(e),a=Xl(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=ou(i,t.args,n,r),u=l.summary!==``||s===null?l.summary:s===``?t.callId:Wl(Gl(ru(i,s),n),r),d=[a===`tool.title.generic`?e:``,u].filter(Boolean).join(` · `),f=o&&Ql(t)||null,p=c===`error`&&f!==null?eu(f):null,m=s===``?null:s;return{variant:i,titleKey:a,summary:d,filePath:l.filePath??(s===null?void 0:su(i,s)),bodyRaw:m,output:f,errorSummary:p,autoReviewDenial:Zl(t),state:c}}let uu=/* @__PURE__ */ new WeakMap;function du(e){if(!(`kind`in e)&&e.phase===`preparing`)return null;let t=uu.get(e);if(t!==void 0||uu.has(e))return t??null;let n=`kind`in e?e.call:e;if(n===null)return uu.set(e,null),null;let r;try{r=JSON.parse(n.argsRaw)}catch{return uu.set(e,null),null}if(typeof r!=`object`||!r||Array.isArray(r))return uu.set(e,null),null;let i={name:n.name,args:r};return uu.set(e,i),i}function fu(e){if(e.content.length!==1)return;let t=e.content[0];return t?.type===`text`?t.text:void 0}function pu(e){return typeof e==`number`&&Number.isInteger(e)&&e>=1}function mu(e){let t=du(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&&!pu(r)||i!==void 0&&!pu(i))}function hu(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 gu(e){if(!mu(e))return;let{offset:t}=du(e)?.args??{};return pu(t)?t:void 0}function _u(e,t,n){if(e.parentCallId!==void 0||!(`kind`in e)||e.isError||!mu(e))return null;let r=hu(e.meta);if(r===null)return null;let i=fu(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:Wl(Gl(r.path,t),n),lines:r.lines,totalLines:r.totalLines,lang:r.lang}}function vu(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 yu(e){let t=du(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 bu(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 xu(e){let t=du(e);if(t===null)return null;if(t.name===`str_replace_editor`){let t=yu(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=bu(n);if(t===null)return null;e.push(t)}return{tool:t.name,diffs:e}}let n=yu(e);return n===null?null:{tool:n.tool,diffs:[n.diff]}}function Su(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e.diffs;return Array.isArray(t)?t.length===0?`empty`:vu(t):null}function Cu(e){if(e.parentCallId!==void 0)return null;let t=xu(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=Su(e.meta);return n!==null&&n!==`empty`?{card:{diffs:n}}:t===null?null:t.tool===`write`?{card:{diffs:t.diffs}}:null}function wu(e){let t=du(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`||!Tu(e)))return null}return t.name}function Tu(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 Eu(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 Du(e){let t=e.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`