orc-ai 0.1.0 → 0.1.2

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 (2) hide show
  1. package/dist/index.js +1 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env bun
2
- #!/usr/bin/env bun
3
2
  // @bun
4
3
  var sI=Object.create;var{getPrototypeOf:aI,defineProperty:nG,getOwnPropertyNames:UD,getOwnPropertyDescriptor:eI}=Object,OD=Object.prototype.hasOwnProperty;function ND($){return this[$]}var $j,wj,pE=($,w,X)=>{var G=$!=null&&typeof $==="object";if(G){var E=w?$j??=new WeakMap:wj??=new WeakMap,J=E.get($);if(J)return J}X=$!=null?sI(aI($)):{};let W=w||!$||!$.__esModule?nG(X,"default",{value:$,enumerable:!0}):X;for(let Y of UD($))if(!OD.call(W,Y))nG(W,Y,{get:ND.bind($,Y),enumerable:!0});if(G)E.set($,W);return W},HD=($)=>{var w=(DD??=new WeakMap).get($),X;if(w)return w;if(w=nG({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var G of UD($))if(!OD.call(w,G))nG(w,G,{get:ND.bind($,G),enumerable:!(X=eI($,G))||X.enumerable})}return DD.set($,w),w},DD,b=($,w)=>()=>(w||$((w={exports:{}}).exports,w),w.exports);var Xj=($)=>$;function Gj($,w){this[$]=Xj.bind(null,w)}var e1=($,w)=>{for(var X in w)nG($,X,{get:w[X],enumerable:!0,configurable:!0,set:Gj.bind(w,X)})};var B=($,w)=>()=>($&&(w=$($=0)),w);var B$=import.meta.require;var Y0,W5,_,g1=($)=>{switch(typeof $){case"undefined":return _.undefined;case"string":return _.string;case"number":return Number.isNaN($)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":if(Array.isArray($))return _.array;if($===null)return _.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return _.promise;if(typeof Map<"u"&&$ instanceof Map)return _.map;if(typeof Set<"u"&&$ instanceof Set)return _.set;if(typeof Date<"u"&&$ instanceof Date)return _.date;return _.object;default:return _.unknown}};var pG=B(()=>{(function($){$.assertEqual=(E)=>{};function w(E){}$.assertIs=w;function X(E){throw Error()}$.assertNever=X,$.arrayToEnum=(E)=>{let J={};for(let W of E)J[W]=W;return J},$.getValidEnumValues=(E)=>{let J=$.objectKeys(E).filter((Y)=>typeof E[E[Y]]!=="number"),W={};for(let Y of J)W[Y]=E[Y];return $.objectValues(W)},$.objectValues=(E)=>{return $.objectKeys(E).map(function(J){return E[J]})},$.objectKeys=typeof Object.keys==="function"?(E)=>Object.keys(E):(E)=>{let J=[];for(let W in E)if(Object.prototype.hasOwnProperty.call(E,W))J.push(W);return J},$.find=(E,J)=>{for(let W of E)if(J(W))return W;return},$.isInteger=typeof Number.isInteger==="function"?(E)=>Number.isInteger(E):(E)=>typeof E==="number"&&Number.isFinite(E)&&Math.floor(E)===E;function G(E,J=" | "){return E.map((W)=>typeof W==="string"?`'${W}'`:W).join(J)}$.joinValues=G,$.jsonStringifyReplacer=(E,J)=>{if(typeof J==="bigint")return J.toString();return J}})(Y0||(Y0={}));(function($){$.mergeShapes=(w,X)=>{return{...w,...X}}})(W5||(W5={}));_=Y0.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var C,Ej=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")},_$;var rE=B(()=>{pG();C=Y0.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);_$=class _$ extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(X)=>{this.issues=[...this.issues,X]},this.addIssues=(X=[])=>{this.issues=[...this.issues,...X]};let w=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,w);else this.__proto__=w;this.name="ZodError",this.issues=$}format($){let w=$||function(E){return E.message},X={_errors:[]},G=(E)=>{for(let J of E.issues)if(J.code==="invalid_union")J.unionErrors.map(G);else if(J.code==="invalid_return_type")G(J.returnTypeError);else if(J.code==="invalid_arguments")G(J.argumentsError);else if(J.path.length===0)X._errors.push(w(J));else{let W=X,Y=0;while(Y<J.path.length){let A=J.path[Y];if(Y!==J.path.length-1)W[A]=W[A]||{_errors:[]};else W[A]=W[A]||{_errors:[]},W[A]._errors.push(w(J));W=W[A],Y++}}};return G(this),X}static assert($){if(!($ instanceof _$))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Y0.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(w)=>w.message){let w={},X=[];for(let G of this.issues)if(G.path.length>0){let E=G.path[0];w[E]=w[E]||[],w[E].push($(G))}else X.push($(G));return{formErrors:X,fieldErrors:w}}get formErrors(){return this.flatten()}};_$.create=($)=>{return new _$($)}});var Jj=($,w)=>{let X;switch($.code){case C.invalid_type:if($.received===_.undefined)X="Required";else X=`Expected ${$.expected}, received ${$.received}`;break;case C.invalid_literal:X=`Invalid literal value, expected ${JSON.stringify($.expected,Y0.jsonStringifyReplacer)}`;break;case C.unrecognized_keys:X=`Unrecognized key(s) in object: ${Y0.joinValues($.keys,", ")}`;break;case C.invalid_union:X="Invalid input";break;case C.invalid_union_discriminator:X=`Invalid discriminator value. Expected ${Y0.joinValues($.options)}`;break;case C.invalid_enum_value:X=`Invalid enum value. Expected ${Y0.joinValues($.options)}, received '${$.received}'`;break;case C.invalid_arguments:X="Invalid function arguments";break;case C.invalid_return_type:X="Invalid function return type";break;case C.invalid_date:X="Invalid date";break;case C.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(X=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")X=`${X} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)X=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)X=`Invalid input: must end with "${$.validation.endsWith}"`;else Y0.assertNever($.validation);else if($.validation!=="regex")X=`Invalid ${$.validation}`;else X="Invalid";break;case C.too_small:if($.type==="array")X=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")X=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")X=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")X=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")X=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else X="Invalid input";break;case C.too_big:if($.type==="array")X=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")X=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")X=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")X=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")X=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else X="Invalid input";break;case C.custom:X="Invalid input";break;case C.invalid_intersection_types:X="Intersection results could not be merged";break;case C.not_multiple_of:X=`Number must be a multiple of ${$.multipleOf}`;break;case C.not_finite:X="Number must be finite";break;default:X=w.defaultError,Y0.assertNever($)}return{message:X}},$w;var Y5=B(()=>{rE();pG();$w=Jj});function Wj($){LD=$}function IX(){return LD}var LD;var iE=B(()=>{Y5();LD=$w});function y($,w){let X=IX(),G=rG({issueData:w,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,X,X===$w?void 0:$w].filter((E)=>!!E)});$.common.issues.push(G)}class O${constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,w){let X=[];for(let G of w){if(G.status==="aborted")return i;if(G.status==="dirty")$.dirty();X.push(G.value)}return{status:$.value,value:X}}static async mergeObjectAsync($,w){let X=[];for(let G of w){let E=await G.key,J=await G.value;X.push({key:E,value:J})}return O$.mergeObjectSync($,X)}static mergeObjectSync($,w){let X={};for(let G of w){let{key:E,value:J}=G;if(E.status==="aborted")return i;if(J.status==="aborted")return i;if(E.status==="dirty")$.dirty();if(J.status==="dirty")$.dirty();if(E.value!=="__proto__"&&(typeof J.value<"u"||G.alwaysSet))X[E.value]=J.value}return{status:$.value,value:X}}}var rG=($)=>{let{data:w,path:X,errorMaps:G,issueData:E}=$,J=[...X,...E.path||[]],W={...E,path:J};if(E.message!==void 0)return{...E,path:J,message:E.message};let Y="",A=G.filter((D)=>!!D).slice().reverse();for(let D of A)Y=D(W,{data:w,defaultError:Y}).message;return{...E,path:J,message:Y}},Yj,i,dw=($)=>({status:"dirty",value:$}),K$=($)=>({status:"valid",value:$}),oE=($)=>$.status==="aborted",tE=($)=>$.status==="dirty",Kw=($)=>$.status==="valid",jX=($)=>typeof Promise<"u"&&$ instanceof Promise;var A5=B(()=>{iE();Y5();Yj=[];i=Object.freeze({status:"aborted"})});var FD=()=>{};var c;var MD=B(()=>{(function($){$.errToObj=(w)=>typeof w==="string"?{message:w}:w||{},$.toString=(w)=>typeof w==="string"?w:w?.message})(c||(c={}))});class K1{constructor($,w,X,G){this._cachedPath=[],this.parent=$,this.data=w,this._path=X,this._key=G}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function $0($){if(!$)return{};let{errorMap:w,invalid_type_error:X,required_error:G,description:E}=$;if(w&&(X||G))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(w)return{errorMap:w,description:E};return{errorMap:(W,Y)=>{let{message:A}=$;if(W.code==="invalid_enum_value")return{message:A??Y.defaultError};if(typeof Y.data>"u")return{message:A??G??Y.defaultError};if(W.code!=="invalid_type")return{message:Y.defaultError};return{message:A??X??Y.defaultError}},description:E}}class w0{get description(){return this._def.description}_getType($){return g1($.data)}_getOrReturnCtx($,w){return w||{common:$.parent.common,data:$.data,parsedType:g1($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new O$,ctx:{common:$.parent.common,data:$.data,parsedType:g1($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let w=this._parse($);if(jX(w))throw Error("Synchronous parse encountered promise.");return w}_parseAsync($){let w=this._parse($);return Promise.resolve(w)}parse($,w){let X=this.safeParse($,w);if(X.success)return X.data;throw X.error}safeParse($,w){let X={common:{issues:[],async:w?.async??!1,contextualErrorMap:w?.errorMap},path:w?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:g1($)},G=this._parseSync({data:$,path:X.path,parent:X});return zD(X,G)}"~validate"($){let w={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:g1($)};if(!this["~standard"].async)try{let X=this._parseSync({data:$,path:[],parent:w});return Kw(X)?{value:X.value}:{issues:w.common.issues}}catch(X){if(X?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;w.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:w}).then((X)=>Kw(X)?{value:X.value}:{issues:w.common.issues})}async parseAsync($,w){let X=await this.safeParseAsync($,w);if(X.success)return X.data;throw X.error}async safeParseAsync($,w){let X={common:{issues:[],contextualErrorMap:w?.errorMap,async:!0},path:w?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:g1($)},G=this._parse({data:$,path:X.path,parent:X}),E=await(jX(G)?G:Promise.resolve(G));return zD(X,E)}refine($,w){let X=(G)=>{if(typeof w==="string"||typeof w>"u")return{message:w};else if(typeof w==="function")return w(G);else return w};return this._refinement((G,E)=>{let J=$(G),W=()=>E.addIssue({code:C.custom,...X(G)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((Y)=>{if(!Y)return W(),!1;else return!0});if(!J)return W(),!1;else return!0})}refinement($,w){return this._refinement((X,G)=>{if(!$(X))return G.addIssue(typeof w==="function"?w(X,G):w),!1;else return!0})}_refinement($){return new V1({schema:this,typeName:d.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(w)=>this["~validate"](w)}}optional(){return B1.create(this,this._def)}nullable(){return Xw.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Q1.create(this)}promise(){return ew.create(this,this._def)}or($){return kX.create([this,$],this._def)}and($){return CX.create(this,$,this._def)}transform($){return new V1({...$0(this._def),schema:this,typeName:d.ZodEffects,effect:{type:"transform",transform:$}})}default($){let w=typeof $==="function"?$:()=>$;return new xX({...$0(this._def),innerType:this,defaultValue:w,typeName:d.ZodDefault})}brand(){return new lE({typeName:d.ZodBranded,type:this,...$0(this._def)})}catch($){let w=typeof $==="function"?$:()=>$;return new yX({...$0(this._def),innerType:this,catchValue:w,typeName:d.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return sG.create(this,$)}readonly(){return gX.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function KD($){let w="[0-5]\\d";if($.precision)w=`${w}\\.\\d{${$.precision}}`;else if($.precision==null)w=`${w}(\\.\\d+)?`;let X=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${w})${X}`}function Ij($){return new RegExp(`^${KD($)}$`)}function VD($){let w=`${BD}T${KD($)}`,X=[];if(X.push($.local?"Z?":"Z"),$.offset)X.push("([+-]\\d{2}:?\\d{2})");return w=`${w}(${X.join("|")})`,new RegExp(`^${w}$`)}function jj($,w){if((w==="v4"||!w)&&zj.test($))return!0;if((w==="v6"||!w)&&Bj.test($))return!0;return!1}function Pj($,w){if(!Hj.test($))return!1;try{let[X]=$.split(".");if(!X)return!1;let G=X.replace(/-/g,"+").replace(/_/g,"/").padEnd(X.length+(4-X.length%4)%4,"="),E=JSON.parse(atob(G));if(typeof E!=="object"||E===null)return!1;if("typ"in E&&E?.typ!=="JWT")return!1;if(!E.alg)return!1;if(w&&E.alg!==w)return!1;return!0}catch{return!1}}function qj($,w){if((w==="v4"||!w)&&Qj.test($))return!0;if((w==="v6"||!w)&&Kj.test($))return!0;return!1}function Sj($,w){let X=($.toString().split(".")[1]||"").length,G=(w.toString().split(".")[1]||"").length,E=X>G?X:G,J=Number.parseInt($.toFixed(E).replace(".","")),W=Number.parseInt(w.toFixed(E).replace(".",""));return J%W/10**E}function PX($){if($ instanceof m0){let w={};for(let X in $.shape){let G=$.shape[X];w[X]=B1.create(PX(G))}return new m0({...$._def,shape:()=>w})}else if($ instanceof Q1)return new Q1({...$._def,type:PX($.element)});else if($ instanceof B1)return B1.create(PX($.unwrap()));else if($ instanceof Xw)return Xw.create(PX($.unwrap()));else if($ instanceof u1)return u1.create($.items.map((w)=>PX(w)));else return $}function U5($,w){let X=g1($),G=g1(w);if($===w)return{valid:!0,data:$};else if(X===_.object&&G===_.object){let E=Y0.objectKeys(w),J=Y0.objectKeys($).filter((Y)=>E.indexOf(Y)!==-1),W={...$,...w};for(let Y of J){let A=U5($[Y],w[Y]);if(!A.valid)return{valid:!1};W[Y]=A.data}return{valid:!0,data:W}}else if(X===_.array&&G===_.array){if($.length!==w.length)return{valid:!1};let E=[];for(let J=0;J<$.length;J++){let W=$[J],Y=w[J],A=U5(W,Y);if(!A.valid)return{valid:!1};E.push(A.data)}return{valid:!0,data:E}}else if(X===_.date&&G===_.date&&+$===+w)return{valid:!0,data:$};else return{valid:!1}}function RD($,w){return new Iw({values:$,typeName:d.ZodEnum,...$0(w)})}function QD($,w){let X=typeof $==="function"?$(w):typeof $==="string"?{message:$}:$;return typeof X==="string"?{message:X}:X}function TD($,w={},X){if($)return sw.create().superRefine((G,E)=>{let J=$(G);if(J instanceof Promise)return J.then((W)=>{if(!W){let Y=QD(w,G),A=Y.fatal??X??!0;E.addIssue({code:"custom",...Y,fatal:A})}});if(!J){let W=QD(w,G),Y=W.fatal??X??!0;E.addIssue({code:"custom",...W,fatal:Y})}return});return sw.create()}var zD=($,w)=>{if(Kw(w))return{success:!0,data:w.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let X=new _$($.common.issues);return this._error=X,this._error}}}},Aj,Dj,Uj,Oj,Nj,Hj,Lj,Fj,Mj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",D5,zj,Qj,Bj,Kj,Vj,Rj,BD="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Tj,z1,Rw,Tw,SX,lw,iG,ZX,bX,sw,Vw,h1,oG,Q1,m0,kX,ww=($)=>{if($ instanceof vX)return ww($.schema);else if($ instanceof V1)return ww($.innerType());else if($ instanceof _X)return[$.value];else if($ instanceof Iw)return $.options;else if($ instanceof fX)return Y0.objectValues($.enum);else if($ instanceof xX)return ww($._def.innerType);else if($ instanceof ZX)return[void 0];else if($ instanceof bX)return[null];else if($ instanceof B1)return[void 0,...ww($.unwrap())];else if($ instanceof Xw)return[null,...ww($.unwrap())];else if($ instanceof lE)return ww($.unwrap());else if($ instanceof gX)return ww($.unwrap());else if($ instanceof yX)return ww($._def.innerType);else return[]},dE,CX,u1,tG,dG,aw,qX,vX,_X,Iw,fX,ew,V1,B1,Xw,xX,yX,lG,Zj,lE,sG,gX,bj,d,kj=($,w={message:`Input not instance of ${$.name}`})=>TD((X)=>X instanceof $,w),ID,jD,Cj,vj,PD,_j,fj,xj,yj,gj,hj,uj,cj,mj,nj,pj,rj,ij,oj,tj,dj,lj,sj,aj,ej,$P,wP,XP,GP,EP,JP,WP,YP,AP,DP=()=>ID().optional(),UP=()=>jD().optional(),OP=()=>PD().optional(),NP,HP;var qD=B(()=>{rE();iE();MD();A5();pG();Aj=/^c[^\s-]{8,}$/i,Dj=/^[0-9a-z]+$/,Uj=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Oj=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Nj=/^[a-z0-9_-]{21}$/i,Hj=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Lj=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Fj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Bj=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Kj=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Rj=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Tj=new RegExp(`^${BD}$`);z1=class z1 extends w0{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==_.string){let E=this._getOrReturnCtx($);return y(E,{code:C.invalid_type,expected:_.string,received:E.parsedType}),i}let X=new O$,G=void 0;for(let E of this._def.checks)if(E.kind==="min"){if($.data.length<E.value)G=this._getOrReturnCtx($,G),y(G,{code:C.too_small,minimum:E.value,type:"string",inclusive:!0,exact:!1,message:E.message}),X.dirty()}else if(E.kind==="max"){if($.data.length>E.value)G=this._getOrReturnCtx($,G),y(G,{code:C.too_big,maximum:E.value,type:"string",inclusive:!0,exact:!1,message:E.message}),X.dirty()}else if(E.kind==="length"){let J=$.data.length>E.value,W=$.data.length<E.value;if(J||W){if(G=this._getOrReturnCtx($,G),J)y(G,{code:C.too_big,maximum:E.value,type:"string",inclusive:!0,exact:!0,message:E.message});else if(W)y(G,{code:C.too_small,minimum:E.value,type:"string",inclusive:!0,exact:!0,message:E.message});X.dirty()}}else if(E.kind==="email"){if(!Fj.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"email",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="emoji"){if(!D5)D5=new RegExp(Mj,"u");if(!D5.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"emoji",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="uuid"){if(!Oj.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"uuid",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="nanoid"){if(!Nj.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"nanoid",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="cuid"){if(!Aj.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"cuid",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="cuid2"){if(!Dj.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"cuid2",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="ulid"){if(!Uj.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"ulid",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="url")try{new URL($.data)}catch{G=this._getOrReturnCtx($,G),y(G,{validation:"url",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="regex"){if(E.regex.lastIndex=0,!E.regex.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"regex",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="trim")$.data=$.data.trim();else if(E.kind==="includes"){if(!$.data.includes(E.value,E.position))G=this._getOrReturnCtx($,G),y(G,{code:C.invalid_string,validation:{includes:E.value,position:E.position},message:E.message}),X.dirty()}else if(E.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(E.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(E.kind==="startsWith"){if(!$.data.startsWith(E.value))G=this._getOrReturnCtx($,G),y(G,{code:C.invalid_string,validation:{startsWith:E.value},message:E.message}),X.dirty()}else if(E.kind==="endsWith"){if(!$.data.endsWith(E.value))G=this._getOrReturnCtx($,G),y(G,{code:C.invalid_string,validation:{endsWith:E.value},message:E.message}),X.dirty()}else if(E.kind==="datetime"){if(!VD(E).test($.data))G=this._getOrReturnCtx($,G),y(G,{code:C.invalid_string,validation:"datetime",message:E.message}),X.dirty()}else if(E.kind==="date"){if(!Tj.test($.data))G=this._getOrReturnCtx($,G),y(G,{code:C.invalid_string,validation:"date",message:E.message}),X.dirty()}else if(E.kind==="time"){if(!Ij(E).test($.data))G=this._getOrReturnCtx($,G),y(G,{code:C.invalid_string,validation:"time",message:E.message}),X.dirty()}else if(E.kind==="duration"){if(!Lj.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"duration",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="ip"){if(!jj($.data,E.version))G=this._getOrReturnCtx($,G),y(G,{validation:"ip",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="jwt"){if(!Pj($.data,E.alg))G=this._getOrReturnCtx($,G),y(G,{validation:"jwt",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="cidr"){if(!qj($.data,E.version))G=this._getOrReturnCtx($,G),y(G,{validation:"cidr",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="base64"){if(!Vj.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"base64",code:C.invalid_string,message:E.message}),X.dirty()}else if(E.kind==="base64url"){if(!Rj.test($.data))G=this._getOrReturnCtx($,G),y(G,{validation:"base64url",code:C.invalid_string,message:E.message}),X.dirty()}else Y0.assertNever(E);return{status:X.value,value:$.data}}_regex($,w,X){return this.refinement((G)=>$.test(G),{validation:w,code:C.invalid_string,...c.errToObj(X)})}_addCheck($){return new z1({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...c.errToObj($)})}url($){return this._addCheck({kind:"url",...c.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...c.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...c.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...c.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...c.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...c.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...c.errToObj($)})}base64($){return this._addCheck({kind:"base64",...c.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...c.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...c.errToObj($)})}ip($){return this._addCheck({kind:"ip",...c.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...c.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...c.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...c.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...c.errToObj($)})}regex($,w){return this._addCheck({kind:"regex",regex:$,...c.errToObj(w)})}includes($,w){return this._addCheck({kind:"includes",value:$,position:w?.position,...c.errToObj(w?.message)})}startsWith($,w){return this._addCheck({kind:"startsWith",value:$,...c.errToObj(w)})}endsWith($,w){return this._addCheck({kind:"endsWith",value:$,...c.errToObj(w)})}min($,w){return this._addCheck({kind:"min",value:$,...c.errToObj(w)})}max($,w){return this._addCheck({kind:"max",value:$,...c.errToObj(w)})}length($,w){return this._addCheck({kind:"length",value:$,...c.errToObj(w)})}nonempty($){return this.min(1,c.errToObj($))}trim(){return new z1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new z1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new z1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let w of this._def.checks)if(w.kind==="min"){if($===null||w.value>$)$=w.value}return $}get maxLength(){let $=null;for(let w of this._def.checks)if(w.kind==="max"){if($===null||w.value<$)$=w.value}return $}};z1.create=($)=>{return new z1({checks:[],typeName:d.ZodString,coerce:$?.coerce??!1,...$0($)})};Rw=class Rw extends w0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==_.number){let E=this._getOrReturnCtx($);return y(E,{code:C.invalid_type,expected:_.number,received:E.parsedType}),i}let X=void 0,G=new O$;for(let E of this._def.checks)if(E.kind==="int"){if(!Y0.isInteger($.data))X=this._getOrReturnCtx($,X),y(X,{code:C.invalid_type,expected:"integer",received:"float",message:E.message}),G.dirty()}else if(E.kind==="min"){if(E.inclusive?$.data<E.value:$.data<=E.value)X=this._getOrReturnCtx($,X),y(X,{code:C.too_small,minimum:E.value,type:"number",inclusive:E.inclusive,exact:!1,message:E.message}),G.dirty()}else if(E.kind==="max"){if(E.inclusive?$.data>E.value:$.data>=E.value)X=this._getOrReturnCtx($,X),y(X,{code:C.too_big,maximum:E.value,type:"number",inclusive:E.inclusive,exact:!1,message:E.message}),G.dirty()}else if(E.kind==="multipleOf"){if(Sj($.data,E.value)!==0)X=this._getOrReturnCtx($,X),y(X,{code:C.not_multiple_of,multipleOf:E.value,message:E.message}),G.dirty()}else if(E.kind==="finite"){if(!Number.isFinite($.data))X=this._getOrReturnCtx($,X),y(X,{code:C.not_finite,message:E.message}),G.dirty()}else Y0.assertNever(E);return{status:G.value,value:$.data}}gte($,w){return this.setLimit("min",$,!0,c.toString(w))}gt($,w){return this.setLimit("min",$,!1,c.toString(w))}lte($,w){return this.setLimit("max",$,!0,c.toString(w))}lt($,w){return this.setLimit("max",$,!1,c.toString(w))}setLimit($,w,X,G){return new Rw({...this._def,checks:[...this._def.checks,{kind:$,value:w,inclusive:X,message:c.toString(G)}]})}_addCheck($){return new Rw({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:c.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:c.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:c.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:c.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:c.toString($)})}multipleOf($,w){return this._addCheck({kind:"multipleOf",value:$,message:c.toString(w)})}finite($){return this._addCheck({kind:"finite",message:c.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:c.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:c.toString($)})}get minValue(){let $=null;for(let w of this._def.checks)if(w.kind==="min"){if($===null||w.value>$)$=w.value}return $}get maxValue(){let $=null;for(let w of this._def.checks)if(w.kind==="max"){if($===null||w.value<$)$=w.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&Y0.isInteger($.value))}get isFinite(){let $=null,w=null;for(let X of this._def.checks)if(X.kind==="finite"||X.kind==="int"||X.kind==="multipleOf")return!0;else if(X.kind==="min"){if(w===null||X.value>w)w=X.value}else if(X.kind==="max"){if($===null||X.value<$)$=X.value}return Number.isFinite(w)&&Number.isFinite($)}};Rw.create=($)=>{return new Rw({checks:[],typeName:d.ZodNumber,coerce:$?.coerce||!1,...$0($)})};Tw=class Tw extends w0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==_.bigint)return this._getInvalidInput($);let X=void 0,G=new O$;for(let E of this._def.checks)if(E.kind==="min"){if(E.inclusive?$.data<E.value:$.data<=E.value)X=this._getOrReturnCtx($,X),y(X,{code:C.too_small,type:"bigint",minimum:E.value,inclusive:E.inclusive,message:E.message}),G.dirty()}else if(E.kind==="max"){if(E.inclusive?$.data>E.value:$.data>=E.value)X=this._getOrReturnCtx($,X),y(X,{code:C.too_big,type:"bigint",maximum:E.value,inclusive:E.inclusive,message:E.message}),G.dirty()}else if(E.kind==="multipleOf"){if($.data%E.value!==BigInt(0))X=this._getOrReturnCtx($,X),y(X,{code:C.not_multiple_of,multipleOf:E.value,message:E.message}),G.dirty()}else Y0.assertNever(E);return{status:G.value,value:$.data}}_getInvalidInput($){let w=this._getOrReturnCtx($);return y(w,{code:C.invalid_type,expected:_.bigint,received:w.parsedType}),i}gte($,w){return this.setLimit("min",$,!0,c.toString(w))}gt($,w){return this.setLimit("min",$,!1,c.toString(w))}lte($,w){return this.setLimit("max",$,!0,c.toString(w))}lt($,w){return this.setLimit("max",$,!1,c.toString(w))}setLimit($,w,X,G){return new Tw({...this._def,checks:[...this._def.checks,{kind:$,value:w,inclusive:X,message:c.toString(G)}]})}_addCheck($){return new Tw({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:c.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:c.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:c.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:c.toString($)})}multipleOf($,w){return this._addCheck({kind:"multipleOf",value:$,message:c.toString(w)})}get minValue(){let $=null;for(let w of this._def.checks)if(w.kind==="min"){if($===null||w.value>$)$=w.value}return $}get maxValue(){let $=null;for(let w of this._def.checks)if(w.kind==="max"){if($===null||w.value<$)$=w.value}return $}};Tw.create=($)=>{return new Tw({checks:[],typeName:d.ZodBigInt,coerce:$?.coerce??!1,...$0($)})};SX=class SX extends w0{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==_.boolean){let X=this._getOrReturnCtx($);return y(X,{code:C.invalid_type,expected:_.boolean,received:X.parsedType}),i}return K$($.data)}};SX.create=($)=>{return new SX({typeName:d.ZodBoolean,coerce:$?.coerce||!1,...$0($)})};lw=class lw extends w0{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==_.date){let E=this._getOrReturnCtx($);return y(E,{code:C.invalid_type,expected:_.date,received:E.parsedType}),i}if(Number.isNaN($.data.getTime())){let E=this._getOrReturnCtx($);return y(E,{code:C.invalid_date}),i}let X=new O$,G=void 0;for(let E of this._def.checks)if(E.kind==="min"){if($.data.getTime()<E.value)G=this._getOrReturnCtx($,G),y(G,{code:C.too_small,message:E.message,inclusive:!0,exact:!1,minimum:E.value,type:"date"}),X.dirty()}else if(E.kind==="max"){if($.data.getTime()>E.value)G=this._getOrReturnCtx($,G),y(G,{code:C.too_big,message:E.message,inclusive:!0,exact:!1,maximum:E.value,type:"date"}),X.dirty()}else Y0.assertNever(E);return{status:X.value,value:new Date($.data.getTime())}}_addCheck($){return new lw({...this._def,checks:[...this._def.checks,$]})}min($,w){return this._addCheck({kind:"min",value:$.getTime(),message:c.toString(w)})}max($,w){return this._addCheck({kind:"max",value:$.getTime(),message:c.toString(w)})}get minDate(){let $=null;for(let w of this._def.checks)if(w.kind==="min"){if($===null||w.value>$)$=w.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let w of this._def.checks)if(w.kind==="max"){if($===null||w.value<$)$=w.value}return $!=null?new Date($):null}};lw.create=($)=>{return new lw({checks:[],coerce:$?.coerce||!1,typeName:d.ZodDate,...$0($)})};iG=class iG extends w0{_parse($){if(this._getType($)!==_.symbol){let X=this._getOrReturnCtx($);return y(X,{code:C.invalid_type,expected:_.symbol,received:X.parsedType}),i}return K$($.data)}};iG.create=($)=>{return new iG({typeName:d.ZodSymbol,...$0($)})};ZX=class ZX extends w0{_parse($){if(this._getType($)!==_.undefined){let X=this._getOrReturnCtx($);return y(X,{code:C.invalid_type,expected:_.undefined,received:X.parsedType}),i}return K$($.data)}};ZX.create=($)=>{return new ZX({typeName:d.ZodUndefined,...$0($)})};bX=class bX extends w0{_parse($){if(this._getType($)!==_.null){let X=this._getOrReturnCtx($);return y(X,{code:C.invalid_type,expected:_.null,received:X.parsedType}),i}return K$($.data)}};bX.create=($)=>{return new bX({typeName:d.ZodNull,...$0($)})};sw=class sw extends w0{constructor(){super(...arguments);this._any=!0}_parse($){return K$($.data)}};sw.create=($)=>{return new sw({typeName:d.ZodAny,...$0($)})};Vw=class Vw extends w0{constructor(){super(...arguments);this._unknown=!0}_parse($){return K$($.data)}};Vw.create=($)=>{return new Vw({typeName:d.ZodUnknown,...$0($)})};h1=class h1 extends w0{_parse($){let w=this._getOrReturnCtx($);return y(w,{code:C.invalid_type,expected:_.never,received:w.parsedType}),i}};h1.create=($)=>{return new h1({typeName:d.ZodNever,...$0($)})};oG=class oG extends w0{_parse($){if(this._getType($)!==_.undefined){let X=this._getOrReturnCtx($);return y(X,{code:C.invalid_type,expected:_.void,received:X.parsedType}),i}return K$($.data)}};oG.create=($)=>{return new oG({typeName:d.ZodVoid,...$0($)})};Q1=class Q1 extends w0{_parse($){let{ctx:w,status:X}=this._processInputParams($),G=this._def;if(w.parsedType!==_.array)return y(w,{code:C.invalid_type,expected:_.array,received:w.parsedType}),i;if(G.exactLength!==null){let J=w.data.length>G.exactLength.value,W=w.data.length<G.exactLength.value;if(J||W)y(w,{code:J?C.too_big:C.too_small,minimum:W?G.exactLength.value:void 0,maximum:J?G.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:G.exactLength.message}),X.dirty()}if(G.minLength!==null){if(w.data.length<G.minLength.value)y(w,{code:C.too_small,minimum:G.minLength.value,type:"array",inclusive:!0,exact:!1,message:G.minLength.message}),X.dirty()}if(G.maxLength!==null){if(w.data.length>G.maxLength.value)y(w,{code:C.too_big,maximum:G.maxLength.value,type:"array",inclusive:!0,exact:!1,message:G.maxLength.message}),X.dirty()}if(w.common.async)return Promise.all([...w.data].map((J,W)=>{return G.type._parseAsync(new K1(w,J,w.path,W))})).then((J)=>{return O$.mergeArray(X,J)});let E=[...w.data].map((J,W)=>{return G.type._parseSync(new K1(w,J,w.path,W))});return O$.mergeArray(X,E)}get element(){return this._def.type}min($,w){return new Q1({...this._def,minLength:{value:$,message:c.toString(w)}})}max($,w){return new Q1({...this._def,maxLength:{value:$,message:c.toString(w)}})}length($,w){return new Q1({...this._def,exactLength:{value:$,message:c.toString(w)}})}nonempty($){return this.min(1,$)}};Q1.create=($,w)=>{return new Q1({type:$,minLength:null,maxLength:null,exactLength:null,typeName:d.ZodArray,...$0(w)})};m0=class m0 extends w0{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),w=Y0.objectKeys($);return this._cached={shape:$,keys:w},this._cached}_parse($){if(this._getType($)!==_.object){let A=this._getOrReturnCtx($);return y(A,{code:C.invalid_type,expected:_.object,received:A.parsedType}),i}let{status:X,ctx:G}=this._processInputParams($),{shape:E,keys:J}=this._getCached(),W=[];if(!(this._def.catchall instanceof h1&&this._def.unknownKeys==="strip")){for(let A in G.data)if(!J.includes(A))W.push(A)}let Y=[];for(let A of J){let D=E[A],U=G.data[A];Y.push({key:{status:"valid",value:A},value:D._parse(new K1(G,U,G.path,A)),alwaysSet:A in G.data})}if(this._def.catchall instanceof h1){let A=this._def.unknownKeys;if(A==="passthrough")for(let D of W)Y.push({key:{status:"valid",value:D},value:{status:"valid",value:G.data[D]}});else if(A==="strict"){if(W.length>0)y(G,{code:C.unrecognized_keys,keys:W}),X.dirty()}else if(A==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let A=this._def.catchall;for(let D of W){let U=G.data[D];Y.push({key:{status:"valid",value:D},value:A._parse(new K1(G,U,G.path,D)),alwaysSet:D in G.data})}}if(G.common.async)return Promise.resolve().then(async()=>{let A=[];for(let D of Y){let U=await D.key,N=await D.value;A.push({key:U,value:N,alwaysSet:D.alwaysSet})}return A}).then((A)=>{return O$.mergeObjectSync(X,A)});else return O$.mergeObjectSync(X,Y)}get shape(){return this._def.shape()}strict($){return c.errToObj,new m0({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(w,X)=>{let G=this._def.errorMap?.(w,X).message??X.defaultError;if(w.code==="unrecognized_keys")return{message:c.errToObj($).message??G};return{message:G}}}:{}})}strip(){return new m0({...this._def,unknownKeys:"strip"})}passthrough(){return new m0({...this._def,unknownKeys:"passthrough"})}extend($){return new m0({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new m0({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:d.ZodObject})}setKey($,w){return this.augment({[$]:w})}catchall($){return new m0({...this._def,catchall:$})}pick($){let w={};for(let X of Y0.objectKeys($))if($[X]&&this.shape[X])w[X]=this.shape[X];return new m0({...this._def,shape:()=>w})}omit($){let w={};for(let X of Y0.objectKeys(this.shape))if(!$[X])w[X]=this.shape[X];return new m0({...this._def,shape:()=>w})}deepPartial(){return PX(this)}partial($){let w={};for(let X of Y0.objectKeys(this.shape)){let G=this.shape[X];if($&&!$[X])w[X]=G;else w[X]=G.optional()}return new m0({...this._def,shape:()=>w})}required($){let w={};for(let X of Y0.objectKeys(this.shape))if($&&!$[X])w[X]=this.shape[X];else{let E=this.shape[X];while(E instanceof B1)E=E._def.innerType;w[X]=E}return new m0({...this._def,shape:()=>w})}keyof(){return RD(Y0.objectKeys(this.shape))}};m0.create=($,w)=>{return new m0({shape:()=>$,unknownKeys:"strip",catchall:h1.create(),typeName:d.ZodObject,...$0(w)})};m0.strictCreate=($,w)=>{return new m0({shape:()=>$,unknownKeys:"strict",catchall:h1.create(),typeName:d.ZodObject,...$0(w)})};m0.lazycreate=($,w)=>{return new m0({shape:$,unknownKeys:"strip",catchall:h1.create(),typeName:d.ZodObject,...$0(w)})};kX=class kX extends w0{_parse($){let{ctx:w}=this._processInputParams($),X=this._def.options;function G(E){for(let W of E)if(W.result.status==="valid")return W.result;for(let W of E)if(W.result.status==="dirty")return w.common.issues.push(...W.ctx.common.issues),W.result;let J=E.map((W)=>new _$(W.ctx.common.issues));return y(w,{code:C.invalid_union,unionErrors:J}),i}if(w.common.async)return Promise.all(X.map(async(E)=>{let J={...w,common:{...w.common,issues:[]},parent:null};return{result:await E._parseAsync({data:w.data,path:w.path,parent:J}),ctx:J}})).then(G);else{let E=void 0,J=[];for(let Y of X){let A={...w,common:{...w.common,issues:[]},parent:null},D=Y._parseSync({data:w.data,path:w.path,parent:A});if(D.status==="valid")return D;else if(D.status==="dirty"&&!E)E={result:D,ctx:A};if(A.common.issues.length)J.push(A.common.issues)}if(E)return w.common.issues.push(...E.ctx.common.issues),E.result;let W=J.map((Y)=>new _$(Y));return y(w,{code:C.invalid_union,unionErrors:W}),i}}get options(){return this._def.options}};kX.create=($,w)=>{return new kX({options:$,typeName:d.ZodUnion,...$0(w)})};dE=class dE extends w0{_parse($){let{ctx:w}=this._processInputParams($);if(w.parsedType!==_.object)return y(w,{code:C.invalid_type,expected:_.object,received:w.parsedType}),i;let X=this.discriminator,G=w.data[X],E=this.optionsMap.get(G);if(!E)return y(w,{code:C.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[X]}),i;if(w.common.async)return E._parseAsync({data:w.data,path:w.path,parent:w});else return E._parseSync({data:w.data,path:w.path,parent:w})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,w,X){let G=new Map;for(let E of w){let J=ww(E.shape[$]);if(!J.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let W of J){if(G.has(W))throw Error(`Discriminator property ${String($)} has duplicate value ${String(W)}`);G.set(W,E)}}return new dE({typeName:d.ZodDiscriminatedUnion,discriminator:$,options:w,optionsMap:G,...$0(X)})}};CX=class CX extends w0{_parse($){let{status:w,ctx:X}=this._processInputParams($),G=(E,J)=>{if(oE(E)||oE(J))return i;let W=U5(E.value,J.value);if(!W.valid)return y(X,{code:C.invalid_intersection_types}),i;if(tE(E)||tE(J))w.dirty();return{status:w.value,value:W.data}};if(X.common.async)return Promise.all([this._def.left._parseAsync({data:X.data,path:X.path,parent:X}),this._def.right._parseAsync({data:X.data,path:X.path,parent:X})]).then(([E,J])=>G(E,J));else return G(this._def.left._parseSync({data:X.data,path:X.path,parent:X}),this._def.right._parseSync({data:X.data,path:X.path,parent:X}))}};CX.create=($,w,X)=>{return new CX({left:$,right:w,typeName:d.ZodIntersection,...$0(X)})};u1=class u1 extends w0{_parse($){let{status:w,ctx:X}=this._processInputParams($);if(X.parsedType!==_.array)return y(X,{code:C.invalid_type,expected:_.array,received:X.parsedType}),i;if(X.data.length<this._def.items.length)return y(X,{code:C.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i;if(!this._def.rest&&X.data.length>this._def.items.length)y(X,{code:C.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w.dirty();let E=[...X.data].map((J,W)=>{let Y=this._def.items[W]||this._def.rest;if(!Y)return null;return Y._parse(new K1(X,J,X.path,W))}).filter((J)=>!!J);if(X.common.async)return Promise.all(E).then((J)=>{return O$.mergeArray(w,J)});else return O$.mergeArray(w,E)}get items(){return this._def.items}rest($){return new u1({...this._def,rest:$})}};u1.create=($,w)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new u1({items:$,typeName:d.ZodTuple,rest:null,...$0(w)})};tG=class tG extends w0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:w,ctx:X}=this._processInputParams($);if(X.parsedType!==_.object)return y(X,{code:C.invalid_type,expected:_.object,received:X.parsedType}),i;let G=[],E=this._def.keyType,J=this._def.valueType;for(let W in X.data)G.push({key:E._parse(new K1(X,W,X.path,W)),value:J._parse(new K1(X,X.data[W],X.path,W)),alwaysSet:W in X.data});if(X.common.async)return O$.mergeObjectAsync(w,G);else return O$.mergeObjectSync(w,G)}get element(){return this._def.valueType}static create($,w,X){if(w instanceof w0)return new tG({keyType:$,valueType:w,typeName:d.ZodRecord,...$0(X)});return new tG({keyType:z1.create(),valueType:$,typeName:d.ZodRecord,...$0(w)})}};dG=class dG extends w0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:w,ctx:X}=this._processInputParams($);if(X.parsedType!==_.map)return y(X,{code:C.invalid_type,expected:_.map,received:X.parsedType}),i;let G=this._def.keyType,E=this._def.valueType,J=[...X.data.entries()].map(([W,Y],A)=>{return{key:G._parse(new K1(X,W,X.path,[A,"key"])),value:E._parse(new K1(X,Y,X.path,[A,"value"]))}});if(X.common.async){let W=new Map;return Promise.resolve().then(async()=>{for(let Y of J){let A=await Y.key,D=await Y.value;if(A.status==="aborted"||D.status==="aborted")return i;if(A.status==="dirty"||D.status==="dirty")w.dirty();W.set(A.value,D.value)}return{status:w.value,value:W}})}else{let W=new Map;for(let Y of J){let{key:A,value:D}=Y;if(A.status==="aborted"||D.status==="aborted")return i;if(A.status==="dirty"||D.status==="dirty")w.dirty();W.set(A.value,D.value)}return{status:w.value,value:W}}}};dG.create=($,w,X)=>{return new dG({valueType:w,keyType:$,typeName:d.ZodMap,...$0(X)})};aw=class aw extends w0{_parse($){let{status:w,ctx:X}=this._processInputParams($);if(X.parsedType!==_.set)return y(X,{code:C.invalid_type,expected:_.set,received:X.parsedType}),i;let G=this._def;if(G.minSize!==null){if(X.data.size<G.minSize.value)y(X,{code:C.too_small,minimum:G.minSize.value,type:"set",inclusive:!0,exact:!1,message:G.minSize.message}),w.dirty()}if(G.maxSize!==null){if(X.data.size>G.maxSize.value)y(X,{code:C.too_big,maximum:G.maxSize.value,type:"set",inclusive:!0,exact:!1,message:G.maxSize.message}),w.dirty()}let E=this._def.valueType;function J(Y){let A=new Set;for(let D of Y){if(D.status==="aborted")return i;if(D.status==="dirty")w.dirty();A.add(D.value)}return{status:w.value,value:A}}let W=[...X.data.values()].map((Y,A)=>E._parse(new K1(X,Y,X.path,A)));if(X.common.async)return Promise.all(W).then((Y)=>J(Y));else return J(W)}min($,w){return new aw({...this._def,minSize:{value:$,message:c.toString(w)}})}max($,w){return new aw({...this._def,maxSize:{value:$,message:c.toString(w)}})}size($,w){return this.min($,w).max($,w)}nonempty($){return this.min(1,$)}};aw.create=($,w)=>{return new aw({valueType:$,minSize:null,maxSize:null,typeName:d.ZodSet,...$0(w)})};qX=class qX extends w0{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:w}=this._processInputParams($);if(w.parsedType!==_.function)return y(w,{code:C.invalid_type,expected:_.function,received:w.parsedType}),i;function X(W,Y){return rG({data:W,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,IX(),$w].filter((A)=>!!A),issueData:{code:C.invalid_arguments,argumentsError:Y}})}function G(W,Y){return rG({data:W,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,IX(),$w].filter((A)=>!!A),issueData:{code:C.invalid_return_type,returnTypeError:Y}})}let E={errorMap:w.common.contextualErrorMap},J=w.data;if(this._def.returns instanceof ew){let W=this;return K$(async function(...Y){let A=new _$([]),D=await W._def.args.parseAsync(Y,E).catch((H)=>{throw A.addIssue(X(Y,H)),A}),U=await Reflect.apply(J,this,D);return await W._def.returns._def.type.parseAsync(U,E).catch((H)=>{throw A.addIssue(G(U,H)),A})})}else{let W=this;return K$(function(...Y){let A=W._def.args.safeParse(Y,E);if(!A.success)throw new _$([X(Y,A.error)]);let D=Reflect.apply(J,this,A.data),U=W._def.returns.safeParse(D,E);if(!U.success)throw new _$([G(D,U.error)]);return U.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new qX({...this._def,args:u1.create($).rest(Vw.create())})}returns($){return new qX({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,w,X){return new qX({args:$?$:u1.create([]).rest(Vw.create()),returns:w||Vw.create(),typeName:d.ZodFunction,...$0(X)})}};vX=class vX extends w0{get schema(){return this._def.getter()}_parse($){let{ctx:w}=this._processInputParams($);return this._def.getter()._parse({data:w.data,path:w.path,parent:w})}};vX.create=($,w)=>{return new vX({getter:$,typeName:d.ZodLazy,...$0(w)})};_X=class _X extends w0{_parse($){if($.data!==this._def.value){let w=this._getOrReturnCtx($);return y(w,{received:w.data,code:C.invalid_literal,expected:this._def.value}),i}return{status:"valid",value:$.data}}get value(){return this._def.value}};_X.create=($,w)=>{return new _X({value:$,typeName:d.ZodLiteral,...$0(w)})};Iw=class Iw extends w0{_parse($){if(typeof $.data!=="string"){let w=this._getOrReturnCtx($),X=this._def.values;return y(w,{expected:Y0.joinValues(X),received:w.parsedType,code:C.invalid_type}),i}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let w=this._getOrReturnCtx($),X=this._def.values;return y(w,{received:w.data,code:C.invalid_enum_value,options:X}),i}return K$($.data)}get options(){return this._def.values}get enum(){let $={};for(let w of this._def.values)$[w]=w;return $}get Values(){let $={};for(let w of this._def.values)$[w]=w;return $}get Enum(){let $={};for(let w of this._def.values)$[w]=w;return $}extract($,w=this._def){return Iw.create($,{...this._def,...w})}exclude($,w=this._def){return Iw.create(this.options.filter((X)=>!$.includes(X)),{...this._def,...w})}};Iw.create=RD;fX=class fX extends w0{_parse($){let w=Y0.getValidEnumValues(this._def.values),X=this._getOrReturnCtx($);if(X.parsedType!==_.string&&X.parsedType!==_.number){let G=Y0.objectValues(w);return y(X,{expected:Y0.joinValues(G),received:X.parsedType,code:C.invalid_type}),i}if(!this._cache)this._cache=new Set(Y0.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let G=Y0.objectValues(w);return y(X,{received:X.data,code:C.invalid_enum_value,options:G}),i}return K$($.data)}get enum(){return this._def.values}};fX.create=($,w)=>{return new fX({values:$,typeName:d.ZodNativeEnum,...$0(w)})};ew=class ew extends w0{unwrap(){return this._def.type}_parse($){let{ctx:w}=this._processInputParams($);if(w.parsedType!==_.promise&&w.common.async===!1)return y(w,{code:C.invalid_type,expected:_.promise,received:w.parsedType}),i;let X=w.parsedType===_.promise?w.data:Promise.resolve(w.data);return K$(X.then((G)=>{return this._def.type.parseAsync(G,{path:w.path,errorMap:w.common.contextualErrorMap})}))}};ew.create=($,w)=>{return new ew({type:$,typeName:d.ZodPromise,...$0(w)})};V1=class V1 extends w0{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===d.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:w,ctx:X}=this._processInputParams($),G=this._def.effect||null,E={addIssue:(J)=>{if(y(X,J),J.fatal)w.abort();else w.dirty()},get path(){return X.path}};if(E.addIssue=E.addIssue.bind(E),G.type==="preprocess"){let J=G.transform(X.data,E);if(X.common.async)return Promise.resolve(J).then(async(W)=>{if(w.value==="aborted")return i;let Y=await this._def.schema._parseAsync({data:W,path:X.path,parent:X});if(Y.status==="aborted")return i;if(Y.status==="dirty")return dw(Y.value);if(w.value==="dirty")return dw(Y.value);return Y});else{if(w.value==="aborted")return i;let W=this._def.schema._parseSync({data:J,path:X.path,parent:X});if(W.status==="aborted")return i;if(W.status==="dirty")return dw(W.value);if(w.value==="dirty")return dw(W.value);return W}}if(G.type==="refinement"){let J=(W)=>{let Y=G.refinement(W,E);if(X.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return W};if(X.common.async===!1){let W=this._def.schema._parseSync({data:X.data,path:X.path,parent:X});if(W.status==="aborted")return i;if(W.status==="dirty")w.dirty();return J(W.value),{status:w.value,value:W.value}}else return this._def.schema._parseAsync({data:X.data,path:X.path,parent:X}).then((W)=>{if(W.status==="aborted")return i;if(W.status==="dirty")w.dirty();return J(W.value).then(()=>{return{status:w.value,value:W.value}})})}if(G.type==="transform")if(X.common.async===!1){let J=this._def.schema._parseSync({data:X.data,path:X.path,parent:X});if(!Kw(J))return i;let W=G.transform(J.value,E);if(W instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:w.value,value:W}}else return this._def.schema._parseAsync({data:X.data,path:X.path,parent:X}).then((J)=>{if(!Kw(J))return i;return Promise.resolve(G.transform(J.value,E)).then((W)=>({status:w.value,value:W}))});Y0.assertNever(G)}};V1.create=($,w,X)=>{return new V1({schema:$,typeName:d.ZodEffects,effect:w,...$0(X)})};V1.createWithPreprocess=($,w,X)=>{return new V1({schema:w,effect:{type:"preprocess",transform:$},typeName:d.ZodEffects,...$0(X)})};B1=class B1 extends w0{_parse($){if(this._getType($)===_.undefined)return K$(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};B1.create=($,w)=>{return new B1({innerType:$,typeName:d.ZodOptional,...$0(w)})};Xw=class Xw extends w0{_parse($){if(this._getType($)===_.null)return K$(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};Xw.create=($,w)=>{return new Xw({innerType:$,typeName:d.ZodNullable,...$0(w)})};xX=class xX extends w0{_parse($){let{ctx:w}=this._processInputParams($),X=w.data;if(w.parsedType===_.undefined)X=this._def.defaultValue();return this._def.innerType._parse({data:X,path:w.path,parent:w})}removeDefault(){return this._def.innerType}};xX.create=($,w)=>{return new xX({innerType:$,typeName:d.ZodDefault,defaultValue:typeof w.default==="function"?w.default:()=>w.default,...$0(w)})};yX=class yX extends w0{_parse($){let{ctx:w}=this._processInputParams($),X={...w,common:{...w.common,issues:[]}},G=this._def.innerType._parse({data:X.data,path:X.path,parent:{...X}});if(jX(G))return G.then((E)=>{return{status:"valid",value:E.status==="valid"?E.value:this._def.catchValue({get error(){return new _$(X.common.issues)},input:X.data})}});else return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new _$(X.common.issues)},input:X.data})}}removeCatch(){return this._def.innerType}};yX.create=($,w)=>{return new yX({innerType:$,typeName:d.ZodCatch,catchValue:typeof w.catch==="function"?w.catch:()=>w.catch,...$0(w)})};lG=class lG extends w0{_parse($){if(this._getType($)!==_.nan){let X=this._getOrReturnCtx($);return y(X,{code:C.invalid_type,expected:_.nan,received:X.parsedType}),i}return{status:"valid",value:$.data}}};lG.create=($)=>{return new lG({typeName:d.ZodNaN,...$0($)})};Zj=Symbol("zod_brand");lE=class lE extends w0{_parse($){let{ctx:w}=this._processInputParams($),X=w.data;return this._def.type._parse({data:X,path:w.path,parent:w})}unwrap(){return this._def.type}};sG=class sG extends w0{_parse($){let{status:w,ctx:X}=this._processInputParams($);if(X.common.async)return(async()=>{let E=await this._def.in._parseAsync({data:X.data,path:X.path,parent:X});if(E.status==="aborted")return i;if(E.status==="dirty")return w.dirty(),dw(E.value);else return this._def.out._parseAsync({data:E.value,path:X.path,parent:X})})();else{let G=this._def.in._parseSync({data:X.data,path:X.path,parent:X});if(G.status==="aborted")return i;if(G.status==="dirty")return w.dirty(),{status:"dirty",value:G.value};else return this._def.out._parseSync({data:G.value,path:X.path,parent:X})}}static create($,w){return new sG({in:$,out:w,typeName:d.ZodPipeline})}};gX=class gX extends w0{_parse($){let w=this._def.innerType._parse($),X=(G)=>{if(Kw(G))G.value=Object.freeze(G.value);return G};return jX(w)?w.then((G)=>X(G)):X(w)}unwrap(){return this._def.innerType}};gX.create=($,w)=>{return new gX({innerType:$,typeName:d.ZodReadonly,...$0(w)})};bj={object:m0.lazycreate};(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(d||(d={}));ID=z1.create,jD=Rw.create,Cj=lG.create,vj=Tw.create,PD=SX.create,_j=lw.create,fj=iG.create,xj=ZX.create,yj=bX.create,gj=sw.create,hj=Vw.create,uj=h1.create,cj=oG.create,mj=Q1.create,nj=m0.create,pj=m0.strictCreate,rj=kX.create,ij=dE.create,oj=CX.create,tj=u1.create,dj=tG.create,lj=dG.create,sj=aw.create,aj=qX.create,ej=vX.create,$P=_X.create,wP=Iw.create,XP=fX.create,GP=ew.create,EP=V1.create,JP=B1.create,WP=Xw.create,YP=V1.createWithPreprocess,AP=sG.create,NP={string:($)=>z1.create({...$,coerce:!0}),number:($)=>Rw.create({...$,coerce:!0}),boolean:($)=>SX.create({...$,coerce:!0}),bigint:($)=>Tw.create({...$,coerce:!0}),date:($)=>lw.create({...$,coerce:!0})},HP=i});var O={};e1(O,{void:()=>cj,util:()=>Y0,unknown:()=>hj,union:()=>rj,undefined:()=>xj,tuple:()=>tj,transformer:()=>EP,symbol:()=>fj,string:()=>ID,strictObject:()=>pj,setErrorMap:()=>Wj,set:()=>sj,record:()=>dj,quotelessJson:()=>Ej,promise:()=>GP,preprocess:()=>YP,pipeline:()=>AP,ostring:()=>DP,optional:()=>JP,onumber:()=>UP,oboolean:()=>OP,objectUtil:()=>W5,object:()=>nj,number:()=>jD,nullable:()=>WP,null:()=>yj,never:()=>uj,nativeEnum:()=>XP,nan:()=>Cj,map:()=>lj,makeIssue:()=>rG,literal:()=>$P,lazy:()=>ej,late:()=>bj,isValid:()=>Kw,isDirty:()=>tE,isAsync:()=>jX,isAborted:()=>oE,intersection:()=>oj,instanceof:()=>kj,getParsedType:()=>g1,getErrorMap:()=>IX,function:()=>aj,enum:()=>wP,effect:()=>EP,discriminatedUnion:()=>ij,defaultErrorMap:()=>$w,datetimeRegex:()=>VD,date:()=>_j,custom:()=>TD,coerce:()=>NP,boolean:()=>PD,bigint:()=>vj,array:()=>mj,any:()=>gj,addIssueToContext:()=>y,ZodVoid:()=>oG,ZodUnknown:()=>Vw,ZodUnion:()=>kX,ZodUndefined:()=>ZX,ZodType:()=>w0,ZodTuple:()=>u1,ZodTransformer:()=>V1,ZodSymbol:()=>iG,ZodString:()=>z1,ZodSet:()=>aw,ZodSchema:()=>w0,ZodRecord:()=>tG,ZodReadonly:()=>gX,ZodPromise:()=>ew,ZodPipeline:()=>sG,ZodParsedType:()=>_,ZodOptional:()=>B1,ZodObject:()=>m0,ZodNumber:()=>Rw,ZodNullable:()=>Xw,ZodNull:()=>bX,ZodNever:()=>h1,ZodNativeEnum:()=>fX,ZodNaN:()=>lG,ZodMap:()=>dG,ZodLiteral:()=>_X,ZodLazy:()=>vX,ZodIssueCode:()=>C,ZodIntersection:()=>CX,ZodFunction:()=>qX,ZodFirstPartyTypeKind:()=>d,ZodError:()=>_$,ZodEnum:()=>Iw,ZodEffects:()=>V1,ZodDiscriminatedUnion:()=>dE,ZodDefault:()=>xX,ZodDate:()=>lw,ZodCatch:()=>yX,ZodBranded:()=>lE,ZodBoolean:()=>SX,ZodBigInt:()=>Tw,ZodArray:()=>Q1,ZodAny:()=>sw,Schema:()=>w0,ParseStatus:()=>O$,OK:()=>K$,NEVER:()=>HP,INVALID:()=>i,EMPTY_PATH:()=>Yj,DIRTY:()=>dw,BRAND:()=>Zj});var O5=B(()=>{iE();A5();FD();pG();qD();rE()});var aG=B(()=>{O5();O5()});import{existsSync as SD,readFileSync as LP}from"fs";import{homedir as kD}from"os";import{join as N5}from"path";function BP($){if($.startsWith("~/"))return N5(kD(),$.slice(2));return $}function bD($){try{return JSON.parse(LP($,"utf-8"))}catch{return{}}}function eG($,w){let X={...$};for(let[G,E]of Object.entries(w))if(E!==null&&typeof E==="object"&&!Array.isArray(E)&&typeof X[G]==="object"&&X[G]!==null)X[G]=eG(X[G],E);else X[G]=E;return X}function KP(){let $={};if(process.env.ORC_DB_PATH)$.db={path:process.env.ORC_DB_PATH};let w={};if(process.env.ORC_API_PORT)w.port=Number(process.env.ORC_API_PORT);if(process.env.ORC_API_HOST)w.host=process.env.ORC_API_HOST;if(process.env.ORC_API_SECRET)w.secret=process.env.ORC_API_SECRET;if(Object.keys(w).length)$.api=w;let X={};if(process.env.ORC_RUNNER_TIMEOUT)X.default_timeout_secs=Number(process.env.ORC_RUNNER_TIMEOUT);if(process.env.ORC_RUNNER_MAX_JOBS)X.max_concurrent_jobs=Number(process.env.ORC_RUNNER_MAX_JOBS);if(process.env.ORC_RUNNER_LOG_DAYS)X.log_retention_days=Number(process.env.ORC_RUNNER_LOG_DAYS);if(Object.keys(X).length)$.runner=X;let G={};if(process.env.ORC_SNAPSHOT_MAX_BYTES)G.snapshot_max_bytes=Number(process.env.ORC_SNAPSHOT_MAX_BYTES);if(process.env.ORC_LAYER1_TASKS)G.layer1_task_limit=Number(process.env.ORC_LAYER1_TASKS);if(process.env.ORC_LAYER1_MEMORIES)G.layer1_memory_limit=Number(process.env.ORC_LAYER1_MEMORIES);if(Object.keys(G).length)$.context=G;let E={};if(process.env.ORC_TELEGRAM_TOKEN)E.telegram={token:process.env.ORC_TELEGRAM_TOKEN,enabled:!0};if(process.env.ORC_SLACK_BOT_TOKEN||process.env.ORC_SLACK_APP_TOKEN)E.slack={bot_token:process.env.ORC_SLACK_BOT_TOKEN,app_token:process.env.ORC_SLACK_APP_TOKEN,enabled:!0};if(Object.keys(E).length)$.gateway=E;let J={};if(process.env.ORC_SPEECH_PROVIDER)J.provider=process.env.ORC_SPEECH_PROVIDER;if(process.env.ORC_SPEECH_LANGUAGE)J.language=process.env.ORC_SPEECH_LANGUAGE;if(process.env.ORC_OPENAI_API_KEY)J.openai={api_key:process.env.ORC_OPENAI_API_KEY};if(process.env.ORC_GROQ_API_KEY)J.groq={api_key:process.env.ORC_GROQ_API_KEY};if(process.env.ORC_QWEN_API_KEY)J.qwen={api_key:process.env.ORC_QWEN_API_KEY};if(Object.keys(J).length)J.enabled=!0,$.speech=J;let W={};if(process.env.ORC_TTS_PROVIDER)W.provider=process.env.ORC_TTS_PROVIDER;if(process.env.ORC_TTS_VOICE)W.voice=process.env.ORC_TTS_VOICE;if(process.env.ORC_TTS_MODE)W.mode=process.env.ORC_TTS_MODE;if(Object.keys(W).length)W.enabled=!0,$.tts=W;return $}function Q0($){if(sE&&!$)return sE;let w=N5(kD(),".orc","config.json"),X=N5(process.cwd(),".orc","config.json"),G={};if(SD(w))G=eG(G,bD(w));if(SD(X))G=eG(G,bD(X));if(G=eG(G,KP()),$)G=eG(G,$);if(G.bridge&&!G.gateway)G.gateway=G.bridge;delete G.bridge;let E=QP.safeParse(G);if(!E.success)throw Error(`Invalid orc config:
5
4
  ${E.error.message}`);return E.data.db.path=BP(E.data.db.path),sE=E.data,sE}var FP,ZD,$6,MP,zP,QP,sE=null;var d$=B(()=>{aG();FP=O.enum(["direct","agent:claude","agent:codex","agent:cursor","multi"]).or(O.string().startsWith("job:")).default("direct"),ZD=O.object({enabled:O.boolean().default(!1),token:O.string().optional(),bot_token:O.string().optional(),app_token:O.string().optional(),authorized_users:O.array(O.union([O.string(),O.number()])).default([]),default_chat_id:O.string().optional(),mode:FP,allow_channel_mentions:O.boolean().default(!0),share_session_in_channel:O.boolean().default(!1),streaming_preview:O.boolean().default(!0)}),$6=O.object({api_key:O.string().optional(),base_url:O.string().optional(),model:O.string().optional()}),MP=O.object({enabled:O.boolean().default(!1),provider:O.enum(["openai","groq","qwen"]).default("openai"),language:O.string().default(""),openai:$6.default({}),groq:$6.default({}),qwen:$6.default({})}),zP=O.object({enabled:O.boolean().default(!1),provider:O.enum(["openai","qwen"]).default("openai"),voice:O.string().default("alloy"),mode:O.enum(["voice_only","always"]).default("voice_only"),max_text_len:O.number().int().min(0).default(0),openai:$6.default({}),qwen:$6.default({})}),QP=O.object({db:O.object({path:O.string().default("~/.orc/orc.db")}).default({}),api:O.object({port:O.number().int().default(7700),host:O.string().default("127.0.0.1"),secret:O.string().optional()}).default({}),mcp:O.object({transport:O.enum(["stdio","http"]).default("stdio"),port:O.number().int().default(7701)}).default({}),gateway:O.object({telegram:ZD.default({}),slack:ZD.default({})}).default({}),runner:O.object({default_timeout_secs:O.number().int().default(300),max_concurrent_jobs:O.number().int().default(5),log_retention_days:O.number().int().default(30)}).default({}),context:O.object({snapshot_max_bytes:O.number().int().default(2048),layer1_task_limit:O.number().int().default(10),layer1_memory_limit:O.number().int().default(5)}).default({}),speech:MP.default({}),tts:zP.default({})})});var w6=b((VP)=>{class H5 extends Error{constructor($,w,X){super(X);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=w,this.exitCode=$,this.nestedError=void 0}}class CD extends H5{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}VP.CommanderError=H5;VP.InvalidArgumentError=CD});var aE=b((PP)=>{var{InvalidArgumentError:IP}=w6();class vD{constructor($,w){switch(this.description=w||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue($,w){if(w===this.defaultValue||!Array.isArray(w))return[$];return w.concat($)}default($,w){return this.defaultValue=$,this.defaultValueDescription=w,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(w,X)=>{if(!this.argChoices.includes(w))throw new IP(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(w,X);return w},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function jP($){let w=$.name()+($.variadic===!0?"...":"");return $.required?"<"+w+">":"["+w+"]"}PP.Argument=vD;PP.humanReadableArgName=jP});var L5=b((bP)=>{var{humanReadableArgName:ZP}=aE();class _D{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let w=$.commands.filter((G)=>!G._hidden),X=$._getHelpCommand();if(X&&!X._hidden)w.push(X);if(this.sortSubcommands)w.sort((G,E)=>{return G.name().localeCompare(E.name())});return w}compareOptions($,w){let X=(G)=>{return G.short?G.short.replace(/^-/,""):G.long.replace(/^--/,"")};return X($).localeCompare(X(w))}visibleOptions($){let w=$.options.filter((G)=>!G.hidden),X=$._getHelpOption();if(X&&!X.hidden){let G=X.short&&$._findOption(X.short),E=X.long&&$._findOption(X.long);if(!G&&!E)w.push(X);else if(X.long&&!E)w.push($.createOption(X.long,X.description));else if(X.short&&!G)w.push($.createOption(X.short,X.description))}if(this.sortOptions)w.sort(this.compareOptions);return w}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let w=[];for(let X=$.parent;X;X=X.parent){let G=X.options.filter((E)=>!E.hidden);w.push(...G)}if(this.sortOptions)w.sort(this.compareOptions);return w}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((w)=>{w.description=w.description||$._argsDescription[w.name()]||""});if($.registeredArguments.find((w)=>w.description))return $.registeredArguments;return[]}subcommandTerm($){let w=$.registeredArguments.map((X)=>ZP(X)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(w?" "+w:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,w){return w.visibleCommands($).reduce((X,G)=>{return Math.max(X,this.displayWidth(w.styleSubcommandTerm(w.subcommandTerm(G))))},0)}longestOptionTermLength($,w){return w.visibleOptions($).reduce((X,G)=>{return Math.max(X,this.displayWidth(w.styleOptionTerm(w.optionTerm(G))))},0)}longestGlobalOptionTermLength($,w){return w.visibleGlobalOptions($).reduce((X,G)=>{return Math.max(X,this.displayWidth(w.styleOptionTerm(w.optionTerm(G))))},0)}longestArgumentTermLength($,w){return w.visibleArguments($).reduce((X,G)=>{return Math.max(X,this.displayWidth(w.styleArgumentTerm(w.argumentTerm(G))))},0)}commandUsage($){let w=$._name;if($._aliases[0])w=w+"|"+$._aliases[0];let X="";for(let G=$.parent;G;G=G.parent)X=G.name()+" "+X;return X+w+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let w=[];if($.argChoices)w.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")w.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)w.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)w.push(`env: ${$.envVar}`);if(w.length>0)return`${$.description} (${w.join(", ")})`;return $.description}argumentDescription($){let w=[];if($.argChoices)w.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0)w.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(w.length>0){let X=`(${w.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}formatHelp($,w){let X=w.padWidth($,w),G=w.helpWidth??80;function E(U,N){return w.formatItem(U,X,N,w)}let J=[`${w.styleTitle("Usage:")} ${w.styleUsage(w.commandUsage($))}`,""],W=w.commandDescription($);if(W.length>0)J=J.concat([w.boxWrap(w.styleCommandDescription(W),G),""]);let Y=w.visibleArguments($).map((U)=>{return E(w.styleArgumentTerm(w.argumentTerm(U)),w.styleArgumentDescription(w.argumentDescription(U)))});if(Y.length>0)J=J.concat([w.styleTitle("Arguments:"),...Y,""]);let A=w.visibleOptions($).map((U)=>{return E(w.styleOptionTerm(w.optionTerm(U)),w.styleOptionDescription(w.optionDescription(U)))});if(A.length>0)J=J.concat([w.styleTitle("Options:"),...A,""]);if(w.showGlobalOptions){let U=w.visibleGlobalOptions($).map((N)=>{return E(w.styleOptionTerm(w.optionTerm(N)),w.styleOptionDescription(w.optionDescription(N)))});if(U.length>0)J=J.concat([w.styleTitle("Global Options:"),...U,""])}let D=w.visibleCommands($).map((U)=>{return E(w.styleSubcommandTerm(w.subcommandTerm(U)),w.styleSubcommandDescription(w.subcommandDescription(U)))});if(D.length>0)J=J.concat([w.styleTitle("Commands:"),...D,""]);return J.join(`
@@ -510,5 +509,5 @@ Events (${Y.length}/${J.events.length}):`);let A={file:"\uD83D\uDCC4",task:"\u27
510
509
  Snapshot:`),console.log(J.snapshot);else if(X.snapshot&&!J.snapshot)console.log(`
511
510
  No snapshot stored for this session.`)}),$.command("log <summary>").description("Log a session summary (calls session_log MCP tool)").option("-a, --agent <name>","Agent name","human").option("--agent-version <v>","Agent version string").action(async(w,X)=>{let G=Q0(),E=`http://${G.api.host}:${G.api.port}`,J={"Content-Type":"application/json"};if(G.api.secret)J.Authorization=`Bearer ${G.api.secret}`;let W=await fetch(`${E}/mcp/tool`,{method:"POST",headers:J,body:JSON.stringify({name:"session_log",args:{agent:X.agent,agent_version:X.agentVersion,summary:w}})}),Y=await W.json();if(!W.ok)return console.error("Error:",Y.error);console.log(Y.result)}),$}function AM(){return new V$("status").description("Show system status").action(async()=>{let $=r0(),{data:w,error:X}=await $.health.check();if(X){console.error("API unreachable \u2014 is `orc api` running?");return}console.log(`orc API \u25CF running v${w?.version} uptime: ${w?.uptime}s`);let{data:G}=await $.tasks.list({limit:100}),{data:E}=await $.jobs.list(),{data:J}=await $.memories.list(),W=Fv(G?.tasks??[],"status");console.log(`
512
511
  Tasks:`);for(let[Y,A]of Object.entries(W))console.log(` ${Y.padEnd(20)} ${A}`);console.log(`
513
- Jobs: ${E?.jobs.length??0} defined`),console.log(`Memory: ${J?.memories.length??0} recent entries`)})}function Fv($,w){return $.reduce((X,G)=>{let E=String(G[w]);return X[E]=(X[E]??0)+1,X},{})}async function yJ($,w){if(w.length===26)return w;let{data:X}=await $.tasks.list({limit:100}),G=(X?.tasks??[]).find((E)=>E.id.endsWith(w)||E.id===w);if(!G)return console.error(`Task not found: ${w}`),null;return G.id}function DM(){let $=new V$("task").description("Manage tasks");return $.command("list").description("List tasks").option("-p, --project <id>","Filter by project ID").option("-s, --status <status>","Filter by status").option("-l, --limit <n>","Max results","20").action(async(w)=>{let X=r0(),{data:G,error:E}=await X.tasks.list({project_id:w.project,status:w.status,limit:Number(w.limit)});if(E)return console.error("Error:",E);let J=G?.tasks??[];if(J.length===0)return console.log("No tasks found.");for(let W of J){let Y=Mv(W.status),A=zv(W.priority);if(console.log(`${Y} ${A} [${W.id.slice(-6)}] ${W.title}`),W.project_id)console.log(` project: ${W.project_id}`)}}),$.command("add <title>").description("Create a new task").option("-p, --project <id>","Project ID").option("--priority <p>","Priority (low/normal/high/critical)","normal").option("-b, --body <text>","Task body").action(async(w,X)=>{let G=r0(),{data:E,error:J}=await G.tasks.create({title:w,body:X.body,project_id:X.project,priority:X.priority});if(J)return console.error("Error:",J);console.log(`Created: [${E?.id.slice(-6)}] ${E?.title}`)}),$.command("done <id>").description("Mark task as done (accepts full ULID or last-6 suffix)").action(async(w)=>{let X=r0(),G=await yJ(X,w);if(!G)return;let{data:E,error:J}=await X.tasks.update(G,{status:"done"});if(J)return console.error("Error:",J);console.log(`Done: [${E?.id.slice(-6)}] ${E?.title}`)}),$.command("review <id>").description("Submit task for review").action(async(w)=>{let X=r0(),G=await yJ(X,w);if(!G)return;let{data:E,error:J}=await X.tasks.update(G,{status:"review"});if(J)return console.error("Error:",J);console.log(`In review: [${E?.id.slice(-6)}] ${E?.title}`)}),$.command("approve <id>").description("Approve a task in review (HITL)").option("-n, --note <text>","Optional note to add").action(async(w,X)=>{let G=r0(),E=await yJ(G,w);if(!E)return;let{data:J,error:W}=await G.tasks.get(E);if(W)return console.error("Error:",W);if(J?.status!=="review")return console.error(`Task is not in review (current: ${J?.status})`);let{data:Y,error:A}=await G.tasks.update(E,{status:"done"});if(A)return console.error("Error:",A);if(X.note)await G.tasks.addNote(E,X.note,"human");console.log(`Approved: [${Y?.id.slice(-6)}] ${Y?.title}`)}),$.command("reject <id>").description("Reject a task in review, request changes (HITL)").option("-r, --reason <text>","Reason for rejection").action(async(w,X)=>{let G=r0(),E=await yJ(G,w);if(!E)return;let{data:J,error:W}=await G.tasks.get(E);if(W)return console.error("Error:",W);if(J?.status!=="review")return console.error(`Task is not in review (current: ${J?.status})`);let{data:Y,error:A}=await G.tasks.update(E,{status:"changes_requested"});if(A)return console.error("Error:",A);if(X.reason)await G.tasks.addNote(E,X.reason,"human");console.log(`Changes requested: [${Y?.id.slice(-6)}] ${Y?.title}`)}),$}function Mv($){return{todo:"\u25CB",doing:"\u25D0",review:"\u25C9",changes_requested:"\u21A9",blocked:"\u2298",done:"\u25CF",cancelled:"\u2715"}[$]??"?"}function zv($){return{low:"\u2193",normal:"\u2192",high:"\u2191",critical:"\u203C"}[$]??" "}var M1=new V$().name("orc").description("Human + AI Orchestration Hub").version("0.0.1").option("--db <path>","DB file path (overrides ORC_DB_PATH / config.json)").option("--port <n>","API port (overrides ORC_API_PORT / config.json)").option("--host <host>","API host (overrides ORC_API_HOST / config.json)").option("--secret <secret>","API bearer secret (overrides ORC_API_SECRET / config.json)").option("--log-level <level>","Log level: debug|info|warn|error (overrides ORC_LOG_LEVEL)").option("--runner-timeout <secs>","Default job timeout in seconds (overrides ORC_RUNNER_TIMEOUT)").option("--runner-max-jobs <n>","Max concurrent jobs (overrides ORC_RUNNER_MAX_JOBS)").option("--snapshot-max-bytes <n>","Session snapshot budget bytes (overrides ORC_SNAPSHOT_MAX_BYTES)").hook("preSubcommand",($,w)=>{let X=M1.opts();if(X.db)process.env.ORC_DB_PATH=X.db;if(X.port)process.env.ORC_API_PORT=X.port;if(X.host)process.env.ORC_API_HOST=X.host;if(X.secret)process.env.ORC_API_SECRET=X.secret;if(X.logLevel)process.env.ORC_LOG_LEVEL=X.logLevel;if(X.runnerTimeout)process.env.ORC_RUNNER_TIMEOUT=X.runnerTimeout;if(X.runnerMaxJobs)process.env.ORC_RUNNER_MAX_JOBS=X.runnerMaxJobs;if(X.snapshotMaxBytes)process.env.ORC_SNAPSHOT_MAX_BYTES=X.snapshotMaxBytes});M1.addCommand(DM());M1.addCommand(JM());M1.addCommand(GM());M1.addCommand(YM());M1.addCommand(wM());M1.addCommand(XM());M1.addCommand(AM());M1.command("api").description("Start the API server (use --port / --host / --db / --secret to configure)").action(async()=>{await Promise.resolve().then(() => (U7(),D7)),await new Promise(()=>{})});M1.command("home").description("Show ~/.orc directory contents and daemon state").action(()=>{let $=Q0();console.log(`ORC home: ${xw}
512
+ Jobs: ${E?.jobs.length??0} defined`),console.log(`Memory: ${J?.memories.length??0} recent entries`)})}function Fv($,w){return $.reduce((X,G)=>{let E=String(G[w]);return X[E]=(X[E]??0)+1,X},{})}async function yJ($,w){if(w.length===26)return w;let{data:X}=await $.tasks.list({limit:100}),G=(X?.tasks??[]).find((E)=>E.id.endsWith(w)||E.id===w);if(!G)return console.error(`Task not found: ${w}`),null;return G.id}function DM(){let $=new V$("task").description("Manage tasks");return $.command("list").description("List tasks").option("-p, --project <id>","Filter by project ID").option("-s, --status <status>","Filter by status").option("-l, --limit <n>","Max results","20").action(async(w)=>{let X=r0(),{data:G,error:E}=await X.tasks.list({project_id:w.project,status:w.status,limit:Number(w.limit)});if(E)return console.error("Error:",E);let J=G?.tasks??[];if(J.length===0)return console.log("No tasks found.");for(let W of J){let Y=Mv(W.status),A=zv(W.priority);if(console.log(`${Y} ${A} [${W.id.slice(-6)}] ${W.title}`),W.project_id)console.log(` project: ${W.project_id}`)}}),$.command("add <title>").description("Create a new task").option("-p, --project <id>","Project ID").option("--priority <p>","Priority (low/normal/high/critical)","normal").option("-b, --body <text>","Task body").action(async(w,X)=>{let G=r0(),{data:E,error:J}=await G.tasks.create({title:w,body:X.body,project_id:X.project,priority:X.priority});if(J)return console.error("Error:",J);console.log(`Created: [${E?.id.slice(-6)}] ${E?.title}`)}),$.command("done <id>").description("Mark task as done (accepts full ULID or last-6 suffix)").action(async(w)=>{let X=r0(),G=await yJ(X,w);if(!G)return;let{data:E,error:J}=await X.tasks.update(G,{status:"done"});if(J)return console.error("Error:",J);console.log(`Done: [${E?.id.slice(-6)}] ${E?.title}`)}),$.command("review <id>").description("Submit task for review").action(async(w)=>{let X=r0(),G=await yJ(X,w);if(!G)return;let{data:E,error:J}=await X.tasks.update(G,{status:"review"});if(J)return console.error("Error:",J);console.log(`In review: [${E?.id.slice(-6)}] ${E?.title}`)}),$.command("approve <id>").description("Approve a task in review (HITL)").option("-n, --note <text>","Optional note to add").action(async(w,X)=>{let G=r0(),E=await yJ(G,w);if(!E)return;let{data:J,error:W}=await G.tasks.get(E);if(W)return console.error("Error:",W);if(J?.status!=="review")return console.error(`Task is not in review (current: ${J?.status})`);let{data:Y,error:A}=await G.tasks.update(E,{status:"done"});if(A)return console.error("Error:",A);if(X.note)await G.tasks.addNote(E,X.note,"human");console.log(`Approved: [${Y?.id.slice(-6)}] ${Y?.title}`)}),$.command("reject <id>").description("Reject a task in review, request changes (HITL)").option("-r, --reason <text>","Reason for rejection").action(async(w,X)=>{let G=r0(),E=await yJ(G,w);if(!E)return;let{data:J,error:W}=await G.tasks.get(E);if(W)return console.error("Error:",W);if(J?.status!=="review")return console.error(`Task is not in review (current: ${J?.status})`);let{data:Y,error:A}=await G.tasks.update(E,{status:"changes_requested"});if(A)return console.error("Error:",A);if(X.reason)await G.tasks.addNote(E,X.reason,"human");console.log(`Changes requested: [${Y?.id.slice(-6)}] ${Y?.title}`)}),$}function Mv($){return{todo:"\u25CB",doing:"\u25D0",review:"\u25C9",changes_requested:"\u21A9",blocked:"\u2298",done:"\u25CF",cancelled:"\u2715"}[$]??"?"}function zv($){return{low:"\u2193",normal:"\u2192",high:"\u2191",critical:"\u203C"}[$]??" "}var M1=new V$().name("orc").description("Human + AI Orchestration Hub").version("0.1.2").option("--db <path>","DB file path (overrides ORC_DB_PATH / config.json)").option("--port <n>","API port (overrides ORC_API_PORT / config.json)").option("--host <host>","API host (overrides ORC_API_HOST / config.json)").option("--secret <secret>","API bearer secret (overrides ORC_API_SECRET / config.json)").option("--log-level <level>","Log level: debug|info|warn|error (overrides ORC_LOG_LEVEL)").option("--runner-timeout <secs>","Default job timeout in seconds (overrides ORC_RUNNER_TIMEOUT)").option("--runner-max-jobs <n>","Max concurrent jobs (overrides ORC_RUNNER_MAX_JOBS)").option("--snapshot-max-bytes <n>","Session snapshot budget bytes (overrides ORC_SNAPSHOT_MAX_BYTES)").hook("preSubcommand",($,w)=>{let X=M1.opts();if(X.db)process.env.ORC_DB_PATH=X.db;if(X.port)process.env.ORC_API_PORT=X.port;if(X.host)process.env.ORC_API_HOST=X.host;if(X.secret)process.env.ORC_API_SECRET=X.secret;if(X.logLevel)process.env.ORC_LOG_LEVEL=X.logLevel;if(X.runnerTimeout)process.env.ORC_RUNNER_TIMEOUT=X.runnerTimeout;if(X.runnerMaxJobs)process.env.ORC_RUNNER_MAX_JOBS=X.runnerMaxJobs;if(X.snapshotMaxBytes)process.env.ORC_SNAPSHOT_MAX_BYTES=X.snapshotMaxBytes});M1.addCommand(DM());M1.addCommand(JM());M1.addCommand(GM());M1.addCommand(YM());M1.addCommand(wM());M1.addCommand(XM());M1.addCommand(AM());M1.command("api").description("Start the API server (use --port / --host / --db / --secret to configure)").action(async()=>{await Promise.resolve().then(() => (U7(),D7)),await new Promise(()=>{})});M1.command("home").description("Show ~/.orc directory contents and daemon state").action(()=>{let $=Q0();console.log(`ORC home: ${xw}
514
513
  `);let w=[{label:"DB",path:$.db.path},{label:"config",path:`${xw}/config.json`},{label:"pid",path:QG},{label:"daemon log",path:`${xw}/daemon.log`}];for(let G of w)if(np(G.path)){let E=Math.round(pp(G.path).size/1024);console.log(` \u2713 ${G.label.padEnd(12)} ${G.path} (${E}KB)`)}else console.log(` \xB7 ${G.label.padEnd(12)} ${G.path} (not found)`);let X=fJ();if(console.log(),X)try{process.kill(X,0),console.log(` daemon \u25CF running pid:${X}`)}catch{console.log(` daemon \u25CB stopped (stale pid: ${X})`)}else console.log(" daemon \u25CB not running");console.log(),console.log(` config port:${$.api.port} host:${$.api.host} secret:${$.api.secret?"***":"(none)"}`)});M1.command("mcp").description("Start the MCP server (stdio)").action(async()=>{let{startStdioServer:$}=await oI().then(() => iI);await $()});M1.parseAsync(process.argv).catch(($)=>{console.error($ instanceof Error?$.message:$),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orc-ai",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Human + AI Orchestration Hub — persistent memory, task management, session continuity and multi-agent collaboration for Cursor, Claude Code, and Codex",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,7 @@
10
10
  "dev": "bun run --watch src/index.ts",
11
11
  "start": "bun run src/index.ts",
12
12
  "typecheck": "tsc --noEmit",
13
- "build": "bun build src/index.ts --outfile dist/index.js --target bun --minify && node -e \"const fs=require('fs');const f='dist/index.js';fs.writeFileSync(f,'#!/usr/bin/env bun\\n'+fs.readFileSync(f,'utf8'))\"",
13
+ "build": "bun build src/index.ts --outfile dist/index.js --target bun --minify",
14
14
  "build:bin": "bun run build.ts",
15
15
  "prepublishOnly": "bun run build",
16
16
  "test": "bun test",
@@ -53,7 +53,7 @@
53
53
  "license": "MIT",
54
54
  "repository": {
55
55
  "type": "git",
56
- "url": "https://github.com/niradler/orc"
56
+ "url": "git+https://github.com/niradler/orc.git"
57
57
  },
58
58
  "homepage": "https://github.com/niradler/orc",
59
59
  "publishConfig": {