UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

2 lines 18.4 kB
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=t({BIGINT_FORMAT_RANGES:()=>k,CONSTANT_CATCH:()=>J,Class:()=>Te,NUMBER_FORMAT_RANGES:()=>O,aborted:()=>L,allowsEval:()=>le,assert:()=>c,assertEqual:()=>r,assertIs:()=>o,assertNever:()=>s,assertNotEqual:()=>i,assignProp:()=>_,attachSchema:()=>V,base64ToUint8Array:()=>ye,base64urlToUint8Array:()=>xe,cached:()=>f,captureStackTrace:()=>ce,cleanEnum:()=>ve,cleanRegex:()=>m,clone:()=>w,cloneDef:()=>ne,codePointLength:()=>W,constantCatch:()=>Ne,createTransparentProxy:()=>pe,defineLazy:()=>g,defineLazyInternal:()=>je,esc:()=>oe,escapeRegex:()=>C,explicitlyAborted:()=>R,extend:()=>M,finalizeIssue:()=>H,floatSafeRemainder:()=>ee,getElementAtPath:()=>re,getEnumValues:()=>l,getLengthableOrigin:()=>he,getParsedType:()=>de,getSizableOrigin:()=>U,hexToUint8Array:()=>Ce,hide:()=>De,installLazyProp:()=>Me,isObject:()=>y,isPlainObject:()=>b,issue:()=>_e,joinValues:()=>u,jsonStringifyReplacer:()=>d,members:()=>Ee,merge:()=>P,mergeDefs:()=>v,normalizeParams:()=>T,nullish:()=>p,numKeys:()=>ue,objectClone:()=>te,omit:()=>j,optionalKeys:()=>D,own:()=>G,parsedType:()=>ge,partial:()=>F,pick:()=>A,prefixIssues:()=>z,primitiveTypes:()=>S,promiseAllObject:()=>ie,propertyKeyTypes:()=>fe,randomString:()=>ae,required:()=>I,safeExtend:()=>N,shallowClone:()=>x,slugify:()=>se,stringifyPrimitive:()=>E,toZod:()=>a,uint8ArrayToBase64:()=>be,uint8ArrayToBase64url:()=>Se,uint8ArrayToHex:()=>we,unwrapMessage:()=>B});function r(e){return e}function i(e){return e}function a(){return e=>e}function o(e){}function s(e){throw Error(`Unexpected value in exhaustive check`)}function c(e){}function l(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function u(e,t=`|`){return e.map(e=>E(e)).join(t)}function d(e,t){return typeof t==`bigint`?t.toString():t}function f(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function p(e){return e==null}function m(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ee(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const h=Symbol(`evaluating`);function g(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==h)return r===void 0&&(r=h,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function te(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function _(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function v(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ne(e){return v(e._zod.def)}function re(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function ie(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function ae(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function oe(e){return JSON.stringify(e)}function se(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const ce=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const le=f(()=>{if(Z.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function b(e){if(y(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return y(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function x(e){return b(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function ue(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const de=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},fe=new Set([`string`,`number`,`symbol`]),S=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function C(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function w(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function T(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function pe(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function E(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function D(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const O={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},k={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function A(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return w(e,v(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&_(e,r,n.shape[r])}return _(this,`shape`,e),e},checks:[]}))}function j(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return w(e,v(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return _(this,`shape`,r),r},checks:[]}))}function M(e,t){if(!b(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return w(e,v(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return _(this,`shape`,n),n}}))}function N(e,t){if(!b(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return w(e,v(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return _(this,`shape`,n),n}}))}function P(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return w(e,v(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return _(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function F(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return w(t,v(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return _(this,`shape`,i),i},checks:[]}))}function I(e,t,n){return w(t,v(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return _(this,`shape`,i),i}}))}function L(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function R(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function z(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function B(e){return typeof e==`string`?e:e?.message}function V(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function H(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:B(e.inst?._zod.def?.error?.(e))??B(a?.(e))??B(t?.error?.(e))??B(n.customError?.(e))??B(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}function U(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}const me=/[\uD800-\uDBFF]/;function W(e){let t=e.length;if(!me.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function he(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ge(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function _e(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function ve(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function ye(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function be(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function xe(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return ye(t+`=`.repeat((4-t.length%4)%4))}function Se(e){return be(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Ce(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function we(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var Te=class{constructor(...e){}};function Ee(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Oe(e,n,r.value)}}function G(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function De(e,t,n){return G(e,t,n,!1)}function Oe(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:G(this,t,n.bind(this))},set(e){G(this,t,e)}})}function ke(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let K,q=!1;const Ae={configurable:!0,get(){q=!0}};function je(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&K!==e._zod){K=void 0;return}K=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ae);let e=q;q=!1;try{let r=n(this);return q?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),q||=e,r}catch(n){throw delete this[t],q||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Me(e,t,n,r){let i=ke(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}const J=`~constantCatch`;function Ne(e){let t=()=>e;return t[J]=!0,t}var Pe;const Fe=Object.freeze({status:`aborted`}),Y={value:void 0,enumerable:!1};let Ie=`captureStackTrace`in Error?Error:null;function Le(e){let t=Ie;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ie=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function X(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Y.value=new a(r);try{Object.defineProperty(n,"_zod",Y)}finally{Y.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Ee(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Le(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}const Re=Symbol(`zod_brand`);var ze=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Be=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Pe=globalThis).__zod_globalConfig??(Pe.__zod_globalConfig={});const Z=globalThis.__zod_globalConfig;function Ve(e){return e&&Object.assign(Z,e),Z}function He(){let e=this._zod;return e.message??=JSON.stringify(e.def,d,2),e.message}function Ue(e){this._zod.message=e}const We={get:He,set:Ue,enumerable:!0,configurable:!0},Q={value:void 0,enumerable:!1},$={value:void 0,enumerable:!1},Ge=new WeakSet([Object.prototype,Error.prototype]),Ke=(e,t)=>{e.name=`$ZodError`,Q.value=e._zod,Object.defineProperty(e,"_zod",Q),$.value=t,Object.defineProperty(e,"issues",$),Q.value=void 0,$.value=void 0,Object.defineProperty(e,"message",We);let n=Object.getPrototypeOf(e);Ge.has(n)||(Ge.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},qe=X(`$ZodError`,Ke),Je=X(`$ZodError`,Ke,void 0,{Parent:Error});function Ye(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Xe(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Ye(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ze(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Qe(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a;for(let o of e.issues)if(o.code===`invalid_union`&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if(o.code===`invalid_key`)r({issues:o.issues},[...i,...o.path]);else if(o.code===`invalid_element`)r({issues:o.issues},[...i,...o.path]);else{let e=[...i,...o.path];if(e.length===0){n.errors.push(t(o));continue}let r=n,s=0;for(;s<e.length;){let n=e[s],i=s===e.length-1;typeof n==`string`?(r.properties??(r.properties={}),Object.prototype.hasOwnProperty.call(r.properties,n)||Object.defineProperty(r.properties,n,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),r=r.properties[n]):(r.items??(r.items=[]),(a=r.items)[n]??(a[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(o)),s++}}};return r(e),n}function $e(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function et(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${$e(e.path)}`);return t.join(` `)}export{ge as $,oe as A,Me as B,ce as C,Ne as D,W as E,ee as F,d as G,b as H,l as I,T as J,P as K,he as L,R as M,M as N,g as O,H as P,G as Q,U as R,f as S,w as T,_e as U,y as V,u as W,j as X,p as Y,D as Z,O as _,et as a,I as at,_ as b,ze as c,se as ct,X as d,n as dt,F as et,Fe as f,t as ft,J as g,k as h,Ze as i,fe as it,C as j,je as k,Be as l,E as lt,Z as m,Je as n,z as nt,$e as o,N as ot,Ve as p,v as q,Xe as r,S as rt,Qe as s,x as st,qe as t,A as tt,Re as u,a as ut,L as v,m as w,V as x,le as y,De as z};