@easbot/utils 0.3.14 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/chunk-6GV3NECV.mjs +1 -0
- package/dist/chunks/{chunk-AGCTBLWP.cjs → chunk-AJU5GBQB.cjs} +1 -1
- package/dist/chunks/{chunk-WZHHFME6.mjs → chunk-GOEMY5AZ.mjs} +1 -1
- package/dist/chunks/{chunk-XP3JFKUF.cjs → chunk-IVVWAT7R.cjs} +1 -1
- package/dist/chunks/{chunk-QHS45ILC.mjs → chunk-JI7GHGIF.mjs} +2 -2
- package/dist/chunks/chunk-K7PV4FXJ.cjs +1 -0
- package/dist/chunks/{chunk-DSQTBBWA.cjs → chunk-PVTJQVMO.cjs} +2 -2
- package/dist/chunks/{chunk-BPUVSXJ3.cjs → chunk-QBLZGSTI.cjs} +5 -5
- package/dist/chunks/{chunk-YTLHVUQE.mjs → chunk-QNKOAEBG.mjs} +1 -1
- package/dist/chunks/{chunk-UAOGVWUY.mjs → chunk-ZA3GGWB3.mjs} +2 -2
- package/dist/chunks/filesystem-TBYCQ7D2.cjs +1 -0
- package/dist/chunks/filesystem-WCPIBXDN.mjs +1 -0
- package/dist/chunks/lock-FS4EHXSK.cjs +1 -0
- package/dist/chunks/lock-GNVDLOKR.mjs +1 -0
- package/dist/chunks/{main-SOMNF7JD.mjs → main-3SAATRGB.mjs} +5 -5
- package/dist/chunks/{main-OZA2GBZR.cjs → main-AFZUDH75.cjs} +6 -6
- package/dist/chunks/registry-7SGIVICB.cjs +1 -0
- package/dist/chunks/registry-ZZW4VHED.mjs +1 -0
- package/dist/chunks/shell-NYVVJ4D5.mjs +1 -0
- package/dist/chunks/shell-XYMW3MHM.cjs +1 -0
- package/dist/index.cjs +57 -21
- package/dist/index.d.cts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.mjs +57 -21
- package/package.json +12 -13
- package/dist/chunks/chunk-7WRC6YMO.cjs +0 -1
- package/dist/chunks/chunk-DFVKHBF4.mjs +0 -1
- package/dist/chunks/filesystem-KY73BNQF.cjs +0 -1
- package/dist/chunks/filesystem-WCWOAZ2P.mjs +0 -1
- package/dist/chunks/lock-4WFBTQ7Z.mjs +0 -1
- package/dist/chunks/lock-VSEYPNID.cjs +0 -1
- package/dist/chunks/registry-7U3Q3K5S.cjs +0 -1
- package/dist/chunks/registry-KZB3XXV6.mjs +0 -1
- package/dist/chunks/shell-JMQ5XY4J.mjs +0 -1
- package/dist/chunks/shell-LJEZM3TC.cjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,65 @@
|
|
|
1
|
-
export{a as Lock}from'./chunks/chunk-
|
|
2
|
-
Full ${
|
|
3
|
-
Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${
|
|
4
|
-
Use Read tool with offset/limit parameters to view specific sections.]`}async function
|
|
1
|
+
export{a as Lock}from'./chunks/chunk-GOEMY5AZ.mjs';import {b,D,a,G as G$1,c as c$1}from'./chunks/chunk-JI7GHGIF.mjs';export{H as $,j as HTTPException,d as Hono,c as Lazy,D as PKG,A as PkgShell,G as Shell,g as compress,e as cors,s as createNodeWebSocket,B as createPkgShell,p as createRESTServer,n as createRPCServer,m as createServer,r as createStreamingServer,q as createWebSocketServer,y as detectPlatform,w as escapeCommandArg,x as escapeCommandArgSafe,z as joinCommandArgs,a as lazy,b as lazyAsync,f as logger,u as needsShellExecution,t as parseCommand,v as parseCommandWithOptions,E as readableStreamToText,h as secureHeaders,C as shell,o as startServer,i as timeout,k as validator,F as whichSync,l as zValidator}from'./chunks/chunk-JI7GHGIF.mjs';import {d,b as b$2,a as a$1}from'./chunks/chunk-QNKOAEBG.mjs';export{d as Filesystem,b as Glob,c as MIME_TYPES,a as Wildcard}from'./chunks/chunk-QNKOAEBG.mjs';import {m,b as b$1}from'./chunks/chunk-ZA3GGWB3.mjs';export{m as Log,o as PackageRegistry,n as Semver,l as addMinutesInTimezone,a as formatLocalISO,b as formatLocalISOCompact,f as formatLogTime,g as formatLogTimeMs,h as getTimezoneOffset,i as getTimezoneParts,j as isValidTimezone,k as normalizeTimezone,c as now,d as nowLocalISO,e as parseLocalISO}from'./chunks/chunk-ZA3GGWB3.mjs';import {f,c,d as d$1}from'./chunks/chunk-6GV3NECV.mjs';import le,{readFile}from'fs/promises';import G,{z}from'zod';import {randomBytes}from'crypto';import {config}from'dotenv';import Pe,{dirname,join}from'path';import {existsSync,readdirSync,statSync}from'fs';import {xdgConfig}from'xdg-basedir';import {fileURLToPath}from'url';import ge from'gray-matter';import {ProxyAgent,getGlobalDispatcher,setGlobalDispatcher}from'undici';import {AsyncLocalStorage}from'async_hooks';f();f();function Et(t,r){for(let o=t.length-1;o>=0;o-=1){let n=t[o];if(n!==void 0&&r(n,o,t))return n}}f();var be;(o=>{function t(n,a,l){let h=0,s=n.length-1;for(;h<=s;){let c=Math.floor((h+s)/2),d=n[c];if(d===void 0)break;let x=l(d);if(x===a)return {found:true,index:c};x<a?h=c+1:s=c-1;}return {found:false,index:h}}o.search=t;function r(n,a,l){let h=l(a),s=0,c=n.length;for(;s<c;){let d=Math.floor((s+c)/2),x=n[d];if(x===void 0)break;l(x)<h?s=d+1:c=d;}return n.splice(s,0,a),n}o.insert=r;})(be||(be={}));f();var we;(l=>{function t(h){let s=new TextEncoder().encode(h),c=Array.from(s,d=>String.fromCharCode(d)).join("");return btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}l.base64Encode=t;function r(h){let s=atob(h.replace(/-/g,"+").replace(/_/g,"/")),c=Uint8Array.from(s,d=>d.charCodeAt(0));return new TextDecoder().decode(c)}l.base64Decode=r;async function o(h,s="SHA-256"){let d=new TextEncoder().encode(h),x=await crypto.subtle.digest(s,d);return Array.from(new Uint8Array(x)).map(g=>g.toString(16).padStart(2,"0")).join("")}l.hash=o;function n(h){if(!h)return;let s=2166136261;for(let c=0;c<h.length;c++)s^=h.charCodeAt(c),s=Math.imul(s,16777619);return (s>>>0).toString(36)}l.checksum=n;function a(h,s=5e5){if(!h)return;if(h.length<=s)return n(h);let c=4096,x=[0,Math.floor(h.length*.25),Math.floor(h.length*.5),Math.floor(h.length*.75),h.length-c].map(b=>{let E=Math.max(0,Math.min(h.length-c,b-Math.floor(c/2)));return n(h.slice(E,E+c))??""}).join(":");return `${h.length}:${x}`}l.sampledChecksum=a;})(we||(we={}));f();f();var V;(b=>{let t={event:"evt",session:"ses",message:"msg",permission:"per",question:"que",user:"usr",part:"prt",pty:"pty",tool:"tool",workspace:"wrk",command:"cmd",task:"task",heartbeat:"hb",agent:"ag",subagent:"sub",hook:"hok",compaction:"cmp",context:"ctx",experience:"exp",pattern:"pat",knowledge:"knw",evolution:"evo",result:"res"};function r(E){return G.string().startsWith(t[E])}b.schema=r;let o=26,n=0,a=0;function l(E,g){return s(E,false,g)}b.ascending=l;function h(E,g){return s(E,true,g)}b.descending=h;function s(E,g,w){if(!w)return d(E,g);if(!w.startsWith(t[E]))throw new Error(`ID ${w} does not start with ${t[E]}`);return w}function c(E){let g="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",w="",P=randomBytes(E);for(let O=0;O<E;O++){let C=P[O];C!==void 0&&(w+=g[C%62]);}return w}function d(E,g,w){let P=w??Date.now();P!==n&&(n=P,a=0),a++;let O=BigInt(P)*BigInt(4096)+BigInt(a);O=g?~O:O;let C=Buffer.alloc(6);for(let z=0;z<6;z++)C[z]=Number(O>>BigInt(40-8*z)&BigInt(255));return t[E]+"_"+C.toString("hex")+c(o-12)}b.create=d;function x(E){let g=E.split("_")[0];if(!g)return 0;let w=E.slice(g.length+1,g.length+13),P=BigInt("0x"+w);return Number(P/BigInt(4096))}b.timestamp=x;})(V||(V={}));var Te;(d$1=>{d$1.DEFAULT_MAX_CHARS=4e3,d$1.DIRECTION="head",d$1.DIR=d.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),d$1.GLOB=d.join(d$1.DIR,"*");let a=10080*60*1e3;function l(x,b,E){return E?`[Content truncated. Source: ${E}
|
|
2
|
+
Full ${b} saved to: ${x}
|
|
3
|
+
Use Read tool with offset/limit parameters to view specific sections.]`:`[Content truncated. Full ${b} saved to: ${x}
|
|
4
|
+
Use Read tool with offset/limit parameters to view specific sections.]`}async function h(x,b={}){let E=b.maxChars??4e3,g=b.direction??d$1.DIRECTION,w=b.label??"content",P=b.sourcePath,O=d.join(process.env.EASBOT_DATA_PATH??`${process.cwd()}/data`,"context-output"),C=b.dir??O;if(x.length<=E)return {content:x,truncated:false};let z=V.ascending("context"),B=d.join(C,z);await le.mkdir(C,{recursive:true}).catch(()=>{}),await le.writeFile(B,x,"utf-8");let Y=x.length-E,W;g==="head"?W=x.slice(0,E):W=x.slice(-E);let X=l(B,w,P),e=`${Y} characters truncated`;return {content:g==="head"?`${W}
|
|
5
5
|
|
|
6
|
-
...${
|
|
6
|
+
...${e}...
|
|
7
7
|
|
|
8
|
-
${
|
|
8
|
+
${X}`:`...${e}...
|
|
9
9
|
|
|
10
|
-
${
|
|
10
|
+
${X}
|
|
11
11
|
|
|
12
|
-
${
|
|
13
|
-
`):
|
|
12
|
+
${W}`,truncated:true,outputPath:B,originalLength:x.length,removedLength:Y,label:w}}d$1.truncate=h;function s(x){return x.truncated?l(x.outputPath,x.label):""}d$1.formatHint=s;async function c(){let x=V.timestamp(V.create("context",false,Date.now()-a)),E=(await le.readdir(d$1.DIR).catch(()=>[])).filter(g=>g.startsWith("context_"));for(let g of E)V.timestamp(g)>=x||await le.unlink(d.join(d$1.DIR,g)).catch(()=>{});}d$1.cleanup=c;})(Te||(Te={}));f();var Ee;(s=>{let t="New session - ",r="Child session - ";s.parentTitlePrefix=t,s.childTitlePrefix=r;function a(c=false){return (c?r:t)+b$1(new Date)}s.createDefault=a;function l(c){return new RegExp(`^(${t}|${r})\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}$`).test(c)}s.isDefault=l;function h(c){let d=c.match(/^(.+) \(fork #(\d+)\)$/);if(d){let x=d[1]??"",b=parseInt(d[2]??"0",10);return `${x} (fork #${b+1})`}return `${c} (fork #1)`}s.getForked=h;})(Ee||(Ee={}));f();var ie=class ie extends Error{static create(r,o){var l;let n=G.object({name:G.literal(r),data:o}).meta({ref:r}),a=(l=class extends ie{constructor(s,c$1){super(r,c$1);c(this,"data",s);c(this,"name",r);this.name=r;}static isInstance(s){return s!==null&&typeof s=="object"&&"name"in s&&s.name===r}schema(){return n}toObject(){return {name:r,data:this.data}}},c(l,"Schema",n),l);return Object.defineProperty(a,"name",{value:r}),a}};c(ie,"Unknown",ie.create("UnknownError",G.object({message:G.string()})));var ae=ie;f();var Re;(r=>{function t(o){return new Ae(o)}r.create=t;})(Re||(Re={}));var Ae=class{constructor(r){c(this,"rules",[]);c(this,"ignorecase");c(this,"debug");this.ignorecase=r?.ignorecase??false,this.debug=r?.debug??false;}add(r){let o=typeof r=="string"?r.split(`
|
|
13
|
+
`):r;for(let n=0;n<o.length;n++){let a=o[n];this.parseRule(a,n+1);}return this}parseRule(r,o){let n=r,a=r;if(n.length===0||n.startsWith("#"))return;let l=n.startsWith("!");if(l&&(n=n.slice(1)),n=n.trim(),n.length===0||(n.startsWith("\\#")&&(n=n.slice(1)),n.startsWith("#")))return;let h=n.startsWith("/");h&&(n=n.slice(1));let s=n.endsWith("/");s&&(n=n.slice(0,-1)),n.length!==0&&this.rules.push({pattern:n,negative:l,isDirectory:s,anchored:h,original:a,lineNumber:o});}ignores(r,o){let n=this.normalizePath(r),a=o??r.endsWith("/"),l=this.checkIgnore(n,a);return this.debug&&console.log(`Ignore.ignores("${r}", isDirectory=${a}) => ${l}`),l}checkIgnore(r,o){let n=false;for(let a of this.rules)a.isDirectory&&!o||this.matchPath(a,r)&&(a.negative?n=false:n=true);return n}matchPath(r,o){let n=this.ignorecase?o.toLowerCase():o,l=this.ignorecase?r.pattern.toLowerCase():r.pattern;if(r.anchored)return a$1.match(n,l);if(l.includes("/"))return a$1.match(n,l);let h=n.split("/");for(let s of h)if(a$1.match(s,l))return true;return false}filter(r){return r.filter(o=>!this.ignores(o))}createFilter(){return r=>!this.ignores(r)}normalizePath(r){let o=r.replace(/\\/g,"/");if(o==="/")return "";for(;o.startsWith("./");)o=o.slice(2);return o.endsWith("/")&&o.length>1&&(o=o.slice(0,-1)),o}};f();function Ge(t,r){let o=n=>{let a;try{a=t.parse(n);}catch(l){throw console.trace("schema validation failure stack trace:"),l instanceof z.ZodError&&console.error("schema validation issues:",JSON.stringify(l.issues,null,2)),l}return r(a)};return o.force=n=>r(n),o.schema=t,o}var Pt=Ge,ke;(r=>r.fn=Ge)(ke||(ke={}));f();function Ot(t={}){let r=t.isDevelopment??false,o=r?".env.dev":".env",n=t.globalConfigPath??(xdgConfig?Pe.join(xdgConfig,"easbot"):void 0),a=t.projectRoot??process.cwd(),l=a?Pe.join(a,".easbot"):void 0,h=[{root:n,label:"global"},{root:a,label:"project"},{root:l,label:"workspace"}];for(let{root:s}of h){if(!s)continue;let c=Pe.join(s,o);if(!existsSync(c))continue;let d=config({path:c,override:true,debug:r,encoding:"utf-8",quiet:!r});if(r&&d.parsed){let b=["XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_CACHE_HOME","XDG_STATE_HOME","XDG_RUNTIME_DIR","EASBOT_CONFIG_PATH","EASBOT_DATA_PATH","EASBOT_CACHE_PATH","EASBOT_STATE_PATH","EASBOT_LOG_PATH","EASBOT_BIN_PATH"].filter(E=>E in d.parsed);b.length>0&&console.warn(`[loadEnv] ${c} contains keys that have no effect: ${b.join(", ")}.
|
|
14
14
|
Reason: xdg-basedir caches XDG_* on import, so this .env file loads too late.
|
|
15
|
-
How to override: export them in the shell before loadEnv() runs, or set process.env directly.`);}}}f();async function
|
|
16
|
-
`),
|
|
17
|
-
`);return
|
|
15
|
+
How to override: export them in the shell before loadEnv() runs, or set process.env directly.`);}}}f();async function $t(t,r){if(process.env.EASBOT_CLIENT==="acp")try{let l=process.platform==="win32"?"cmd":void 0,h=G$1.spawn(l,`git ${t.join(" ")}`,{stdin:void 0,stdout:"pipe",stderr:"pipe",cwd:r.cwd,env:r.env?{...process.env,...r.env}:process.env}),[s,c,d]=await Promise.all([h.exited,new Response(h.stdout).arrayBuffer(),new Response(h.stderr).arrayBuffer()]),x=Buffer.from(c),b=Buffer.from(d);return {exitCode:s,text:()=>x.toString(),stdout:x,stderr:b}}catch(l){let h=Buffer.from(l instanceof Error?l.message:String(l));return {exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:h}}let o=r.env?{...process.env,...r.env}:void 0,n=G$1.$`git ${t.join(" ")}`.quiet().nothrow().cwd(r.cwd);o&&(n=n.env(o));let a=await n;return {exitCode:a.exitCode,text:()=>a.text(),stdout:a.stdout,stderr:a.stderr}}f();function qe(t){return t?dirname(fileURLToPath(t)):typeof d$1<"u"?d$1:process.cwd()}function Ue(t,r,o=3){function n(a,l){if(l>o||!existsSync(a))return null;try{let h=readdirSync(a);for(let s of h){let c=join(a,s);try{let d=statSync(c);if(d.isFile()&&c.endsWith(r))return c;if(d.isDirectory()&&l<o){let x=n(c,l+1);if(x)return x}}catch{}}}catch{}return null}return n(t,0)}function We(t,r){let o=join(t,r);if(existsSync(o))return o;let n=r.split("/").pop()||r,a=t;for(let l=0;l<5;l++){let h=join(a,"assets","txt");if(existsSync(h)){let d=Ue(h,n,5);if(d)return d}let s=join(a,"dist","assets","txt");if(existsSync(s)){let d=Ue(s,n,5);if(d)return d}let c=join(a,"..");if(c===a)break;a=c;}return o}function Lt(t,r){return c$1.lazy(()=>{try{let o=qe(r),n=We(o,t);return D.file(n).textSync()}catch(o){throw console.error(`Failed to load text file: ${t}`,o),o}})}function Ft(t,r){return c$1.lazy(async()=>{try{let o=qe(r),n=We(o,t);return await D.file(n).text()}catch(o){throw console.error(`Failed to load text file: ${t}`,o),o}})}f();function Ct(t){return t()}f();function jt(t){if(!t||typeof t!="string")return {provider:"",model:""};let r=t.indexOf("/");return r===-1?{provider:"",model:t}:{provider:t.substring(0,r),model:t.substring(r+1)}}f();var _e;(X=>{X.FILE_REGEX=/(?<![\w`])#(\S+)/g,X.SHELL_REGEX=/!`([^`]+)`/g;function o(e){return Array.from(e.matchAll(X.FILE_REGEX))}X.files=o;function n(e){return Array.from(e.matchAll(X.SHELL_REGEX))}X.shell=n;function a(e){if(!e||typeof e!="string")return typeof e=="string"?e:"";let i=e.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!i)return e;let p=i[0],u=(i[1]??"").split(`
|
|
16
|
+
`),y=[];for(let R of u){if(R.trim().startsWith("#")||R.trim()===""){y.push(R);continue}if(R.match(/^\s+/)){y.push(R);continue}let L=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*:\s*(.*)$/);if(!L){y.push(R);continue}let A=L[1],$=L?.[2]?.trim();if($===""||$===">"||$==="|"||$?.startsWith('"')||$?.startsWith("'")){y.push(R);continue}if($?.includes(":")){y.push(`${A}: |-`),y.push(` ${$}`);continue}y.push(R);}let T=y.join(`
|
|
17
|
+
`);return e.replace(p,`---
|
|
18
18
|
${T}
|
|
19
|
-
---`)}
|
|
20
|
-
Content-Type: ${
|
|
19
|
+
---`)}X.fallbackSanitization=a;function l(e){if(typeof e!="string")return null;if(!e)return {data:{},content:""};try{let i=ge(e);return {data:i.data??{},content:i.content??""}}catch{try{let i=ge(a(e));return {data:i.data??{},content:i.content??""}}catch{return null}}}async function h(e){let i=await readFile(e,"utf-8"),p=l(i);if(!p){let f=`${e}: Failed to parse YAML frontmatter`;throw new X.FrontmatterError({path:e,message:f},{cause:new Error(f)})}return p}X.parse=h;function s(e){if(!e||typeof e!="string")return {frontmatter:{},content:typeof e=="string"?e:""};let i=l(e);return i?{frontmatter:i.data,content:i.content}:{frontmatter:{},content:e}}X.extractFrontmatter=s;function c(e,i){let p=e??"";return !i||Object.keys(i).length===0?ge.stringify(p,void 0):ge.stringify(p,i)}X.format=c,X.FrontmatterError=ae.create("ConfigFrontmatterError",z.object({path:z.string(),message:z.string()}));function x(e,i){return b(e,i)}X.replaceVariables=x;function b(e,i){return E(e,i)}X.renderTemplate=b;function E(e,i){let p=e;return p=g(p,i),p=O(p,i),p=B(p,i),p=z$1(p,i),p=p.replace(/\{\{([^}]*)\}\}/g,(f,u)=>{let y=u.trim();if(!y)return "";let T=he(y,i);return T!==void 0?String(W(T)):""}),p}function g(e,i){let p=e.replace(/\{\{#if\s+\((eq|ne|gt|lt|gte|lte)\s+([^)]+)\)\}\}([\s\S]*?)\{\{(?:else)\}\}([\s\S]*?)\{\{\/if\}\}/g,(f,u,y,T,R)=>{if(!u||!y||!T||!R)return f;let{a:L,b:A}=w(y,i);return L===void 0||A===void 0?f:P(u,L,A)?T:R});return p=p.replace(/\{\{#if\s+\((eq|ne|gt|lt|gte|lte)\s+([^)]+)\)\}\}([\s\S]*?)\{\{\/if\}\}/g,(f,u,y,T)=>{if(!u||!y||!T)return f;let{a:R,b:L}=w(y,i);return R===void 0||L===void 0?f:P(u,R,L)?T:""}),p}function w(e,i){let p=/"([^"]*)"|(\w+(?:\.\w+|\[\d+\])*)/g,f=[],u;for(;(u=p.exec(e))!==null;)u[1]!==void 0?f.push(u[1]):u[2]!==void 0&&f.push(u[2]);if(f.length<2)return {a:void 0,b:void 0};let y=he(f[0],i),T=he(f[1],i);return {a:y,b:T}}function P(e,i,p){switch(e){case "eq":return i===p;case "ne":return i!==p;case "gt":return Number(i)>Number(p);case "lt":return Number(i)<Number(p);case "gte":return Number(i)>=Number(p);case "lte":return Number(i)<=Number(p);default:return false}}function O(e,i){let p=e.replace(/\{\{#unless\s+(\w+)\}\}([\s\S]*?)\{\{(?:else)\}\}([\s\S]*?)\{\{\/unless\}\}/g,(f,u,y,T)=>{if(!u||!y||!T)return f;let R=i[u];return C(R)?y:T});return p=p.replace(/\{\{#unless\s+(\w+)\}\}([\s\S]*?)\{\{\/unless\}\}/g,(f,u,y)=>{if(!u||!y)return f;let T=i[u];return C(T)?y:""}),p}function C(e){return e==null||e===false||e===""}function z$1(e,i){let p=e.replace(/\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{(?:else)\}\}([\s\S]*?)\{\{\/if\}\}/g,(f,u,y,T)=>{if(!u||!y||!T)return f;let R=u in i?i[u]:void 0;return C(R)?T:y});return p=p.replace(/\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{\/if\}\}/g,(f,u,y)=>{if(!u||!y)return f;let T=u in i?i[u]:void 0;return C(T)?"":y}),p}function B(e,i){let p=e.match(/\{\{#each\s+([\w.]+)\}\}/);if(!p?.[1])return e;let f=p[1],u=he(f,i),y=p[0],T=p.index,R=e.slice(T+y.length),L;if(Array.isArray(u))L=u.map((k,v)=>({key:String(v),value:k}));else if(u!==null&&typeof u=="object")L=Object.entries(u).map(([k,v])=>({key:k,value:v}));else return Y(e,T,y,R);let A=1,$=-1,D=/\{\{#each\s+[\w.]+\}\}|\{\{\/each\}\}/g,N;for(D.lastIndex=0;(N=D.exec(R))!==null;)if(N[0].startsWith("{{#each"))A++;else if(A--,A===0){$=N.index;break}if($===-1)return e;let j=R.slice(0,$),U=e.slice(T,T+y.length+$+"{{/each}}".length);if(L.length===0)return e.replace(U,"");let I=L.map(({key:k,value:v},M)=>{let F={...i};return typeof v=="object"&&v!==null?(Object.assign(F,v),F.this=v,F["@value"]=v,F["@index"]=M,F["@key"]=k):(F.this=v,F["@value"]=v,F["@index"]=M,F["@key"]=k),E(j,F)});return e.replace(U,I.join(""))}function Y(e,i,p,f,u){let y=/\{\{#each\s+[\w.]+\}\}|\{\{\/each\}\}/g,T=1,R=-1,L;for(y.lastIndex=0;(L=y.exec(f))!==null;)if(L[0].startsWith("{{#each"))T++;else if(T--,T===0){R=L.index;break}if(R===-1)return e;let $=e.slice(i,i+p.length+R+"{{/each}}".length);return e.replace($,"")}function W(e){return e instanceof Date?b$1(e):Array.isArray(e)?e.map(W).join(", "):e!==null&&typeof e=="object"?JSON.stringify(e,null,2):String(e)}X.formatVariableValue=W;})(_e||(_e={}));function he(t,r){let o=/(@\w+)|(\w+)|\[(\d+)\]/g,n=r,a;for(;(a=o.exec(t))!==null;){if(n==null)return;if(a[1]!==void 0){let l=a[1];n=r[l];}else if(a[2]!==void 0){let l=a[2];if(typeof n=="object"&&n!==null)n=n[l];else return}else if(a[3]!==void 0){let l=Number(a[3]);if(Array.isArray(n)&&l>=0&&l<n.length)n=n[l];else return}}return n}f();function Xe(t){if(!t)return "";let o=t.replace(/[/\\]+$/,"").split(/[/\\]/);return o[o.length-1]??""}function zt(t){if(!t)return "";let o=t.replace(/[/\\]+$/,"").split(/[/\\]/);return o.slice(0,o.length-1).join("/")+"/"}function Bt(t){if(!t)return "";let r=t.split(".");return r[r.length-1]}function Gt(t,r=20){let o=Xe(t);if(o.length<=r)return o;let n=o.lastIndexOf("."),a=n<=0?"":o.slice(n),l=r-a.length-1;return l<=0?o.slice(0,r-1)+"\u2026":o.slice(0,l)+"\u2026"+a}function Ht(t,r=20){if(t.length<=r)return t;let o=r-1,n=Math.ceil(o/2),a=Math.floor(o/2);return t.slice(0,n)+"\u2026"+t.slice(-a)}f();var Ut=["load failed","network connection was lost","network request failed","failed to fetch","econnreset","econnrefused","etimedout","socket hang up"];function qt(t){if(!t)return false;let r=String(t instanceof Error?t.message:t).toLowerCase();return Ut.some(o=>r.includes(o))}async function Oe(t,r={}){let{attempts:o=3,delay:n=500,factor:a=2,maxDelay:l=1e4,retryIf:h=qt}=r,s;for(let c=0;c<o;c++)try{return await t()}catch(d){if(s=d,c===o-1||!h(d))throw d;let x=Math.min(n*a**c,l);await new Promise(b=>setTimeout(b,x));}throw s}f();var $e;(p=>{let t=m.create({service:"fetch"}),r=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"],o=false,n=null;function a(){return r.some(f=>{let u=process.env[f];return typeof u=="string"&&u.trim().length>0})}p.hasProxyConfigured=a;function l(){let f=process.env.http_proxy||process.env.HTTP_PROXY;return process.env.https_proxy||process.env.HTTPS_PROXY||f}p.getProxyUrl=l;function h(f={}){let u=f.httpProxy||f.httpsProxy||l();if(!u){t.warn("[Fetch] No proxy configured, HTTP_PROXY/HTTPS_PROXY environment variables not set");return}let y=new ProxyAgent({uri:u,connectTimeout:f.connectTimeout||1e4,keepAliveTimeout:f.keepAliveTimeout||3e4});n=getGlobalDispatcher(),setGlobalDispatcher(y),o=true,t.info(`[Fetch] Global proxy enabled: ${u}`);}p.enableProxy=h;function s(){!o||!n||(setGlobalDispatcher(n),o=false,n=null,t.info("[Fetch] \u5168\u5C40\u4EE3\u7406\u5DF2\u7981\u7528"));}p.disableProxy=s;function c(){return o}p.isProxyEnabled=c;async function d$1(f,u){let y=u?.timeout||3e4,T=u?.responseType||"json",{timeout:R,responseType:L,...A}=u||{},$=null,D=null;try{A.signal||($=new AbortController,D=setTimeout(()=>$.abort(),y));let N=await fetch(f,{...A,signal:A.signal||$.signal});D&&clearTimeout(D);let j;switch(T){case "arrayBuffer":j=await N.arrayBuffer();break;case "blob":j=await N.blob();break;case "buffer":{let H=await N.arrayBuffer();j=Buffer.from(H);break}case "text":j=await N.text();break;default:{let H=await N.text();try{j=JSON.parse(H);}catch{j=H;}break}}return {ok:N.ok,status:N.status,statusText:N.statusText,headers:N.headers,data:j,url:N.url}}catch(N){throw D&&clearTimeout(D),N}}async function x(f,u){let y=u?.retries??0,T=u?.retryDelay??1e3,{retries:R,retryDelay:L,responseType:A,...$}=u||{};return Oe(()=>d$1(f,{...$,responseType:u?.responseType}),{attempts:y+1,delay:T,maxDelay:T*2**(y+1)})}async function b(f,u){return x(f,{method:"GET",...u})}p.get=b;async function E(f,u,y){return x(f,{method:"POST",headers:{"Content-Type":"application/json",...y?.headers},body:u?JSON.stringify(u):void 0,...y})}p.post=E;async function g(f,u,y){return x(f,{method:"PUT",headers:{"Content-Type":"application/json",...y?.headers},body:u?JSON.stringify(u):void 0,...y})}p.put=g;async function w(f,u,y){return x(f,{method:"DELETE",headers:{"Content-Type":"application/json",...y?.headers},body:u?JSON.stringify(u):void 0,...y})}p.del=w;async function P(f,u,y){return x(f,{method:"PATCH",headers:{"Content-Type":"application/json",...y?.headers},body:u?JSON.stringify(u):void 0,...y})}p.patch=P;async function O(f,u){return x(f,u)}p.request=O;function C(f={}){return a()?(h(f),true):false}p.autoProxy=C;let z=5*1024*1024;function B(f){return new TextEncoder().encode(f)}function Y(f){return d.mimeType(f)}function W(f){return f.startsWith("file://")}async function X(f){let u=fileURLToPath(f);return await D.file(u).bytes()}async function e(f,u,y){let T=`----FetchFormBoundary${Date.now()}`,R=[],A=u.some(I=>I.filename||I.value instanceof Uint8Array||Buffer.isBuffer(I.value))&&!y?.timeout?3e5:y?.timeout;for(let I of u){let k=I.maxSize??z,v=I.filename,M=`Content-Disposition: form-data; name="${I.name}"${v?`; filename="${v}"`:""}`;v&&(M+=`\r
|
|
20
|
+
Content-Type: ${Y(v)}`),M+=`\r
|
|
21
21
|
\r
|
|
22
|
-
`,
|
|
23
|
-
--${T}--`),
|
|
22
|
+
`,R.push(B(M));let F=I.value;if(typeof F=="string")if(W(F)){let ye=await X(F);if(v||(v=F.split("/").pop()||"file"),ye.byteLength>k)throw new Error(`File size ${ye.byteLength} exceeds limit ${k} bytes: ${v}`);R.push(ye);}else R.push(B(F));else if(Buffer.isBuffer(F)){if(F.byteLength>k)throw new Error(`Buffer size ${F.byteLength} exceeds limit ${k} bytes: ${I.name}`);R.push(new Uint8Array(F.buffer,F.byteOffset,F.byteLength));}else if(F instanceof Uint8Array){if(F.byteLength>k)throw new Error(`File size ${F.byteLength} exceeds limit ${k} bytes: ${I.name}`);R.push(F);}}let $=B(`\r
|
|
23
|
+
--${T}--`),D=B(`\r
|
|
24
24
|
--${T}\r
|
|
25
|
-
`),
|
|
26
|
-
`));for(let
|
|
27
|
-
`)));
|
|
28
|
-
`);
|
|
29
|
-
`)}I.tree=o;async function u(i){let h=await e();return h?b$1(h,i):(t.debug("ripgrep not available, using pure JS fallback for search()",{cwd:i.cwd,pattern:i.pattern}),w(i))}I.search=u;async function b$1(i,h){let _=["--json","--glob=!.git/*"];if(h.follow&&_.push("--follow"),h.glob)for(let a of h.glob)_.push(`--glob=${a}`);h.limit&&_.push(`--max-count=${h.limit}`),_.push("--"),_.push(h.pattern);let C=await D.run([i,..._],{cwd:h.cwd});if(C.code!==0)return [];let U=h.hidden!==false,j=C.stdout.split(/\r?\n/).filter(Boolean),$=[];for(let a of j)try{let x=JSON.parse(a);if(x?.type!=="match")continue;let f=x.data;if(!f?.path?.text||!f?.lines?.text)continue;let d$1=d.toUnixPath(f.path.text);if(!U&&d$1.split("/").some(c=>c.startsWith(".")))continue;if($.push({path:d$1,lines:f.lines.text,line_number:f.line_number,absolute_offset:f.absolute_offset??0}),h.limit&&$.length>=h.limit)break}catch{}return $}async function w(i){let h;try{h=new RegExp(i.pattern);}catch{return []}try{if(!(await ie.stat(i.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${i.cwd}'`),{code:"ENOTDIR",errno:-20,path:i.cwd})}catch(f){throw f.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${i.cwd}'`),{code:"ENOENT",errno:-2,path:i.cwd}):f}let _=[],C=[];if(i.glob)for(let f of i.glob)f.startsWith("!")?C.push(f.slice(1)):_.push(f);let U=i.hidden!==false,j=[],$=_.length>0?_:["**/*"],a=new Set,x=[];for(let f of $){i.signal?.throwIfAborted();let d=await b$2.scan(f,{cwd:i.cwd,absolute:false,include:"file",dot:U,symlink:i.follow??false,maxDepth:void 0,ignore:C});for(let c of d)a.has(c)||(a.add(c),x.push(c));}for(let f of x){if(i.signal?.throwIfAborted(),i.limit&&j.length>=i.limit)break;let d$1=d.join(i.cwd,f),c;try{c=await ie.readFile(d$1,"utf-8");}catch{continue}let p=c.split(/\r?\n/),T=0;for(let P=0;P<p.length;P++){let D=p[P]??"";if(h.test(D)&&(j.push({path:f,lines:D,line_number:P+1,absolute_offset:T}),i.limit&&j.length>=i.limit))break;T+=Buffer.byteLength(D,"utf-8")+1;}}return j}function S(i,h){return a$1.match(i,h)}I.match=S;let R=a(async()=>await e());async function m$1(){return await R()}I.filepathCached=m$1,I._ready=a(async()=>{let i=await e();return t.debug("Grep initialized",{ripgrep:i?"available":"fallback (pure JS)"}),i});})(Ie||(Ie={}));f();var Ne;(y=>{function t(o,u){if(o===u)return true;if(typeof o!="object"||typeof u!="object"||o===null||u===null)return false;let b=Object.keys(o),w=Object.keys(u);if(b.length!==w.length)return false;for(let S of b)if(!w.includes(S)||!t(o[S],u[S]))return false;return true}function e(o){return {...o,super:o.super??false}}function r(o,u){return o?t(e(o),e(u)):false}y.match=r;function n(o,u=false){return {name:o.name,ctrl:o.ctrl,meta:o.meta,shift:o.shift,super:o.super??false,leader:u}}y.fromParsedKey=n;function s(o){if(!o)return "";let u=[];o.ctrl&&u.push("ctrl"),o.meta&&u.push("alt"),o.super&&u.push("super"),o.shift&&u.push("shift"),o.name&&(o.name==="delete"?u.push("del"):u.push(o.name));let b=u.join("+");return o.leader&&(b=b?`<leader> ${b}`:"<leader>"),b}y.keyToString=s;function l(o){return o==="none"?[]:o.split(",").map(u=>{let w=u.replace(/<leader>/g,"leader+").toLowerCase().split("+"),S={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let R of w)switch(R){case "ctrl":S.ctrl=true;break;case "alt":case "meta":case "option":S.meta=true;break;case "super":S.super=true;break;case "shift":S.shift=true;break;case "leader":S.leader=true;break;case "esc":S.name="escape";break;default:S.name=R;break}return S})}y.parse=l;})(Ne||(Ne={}));f();var ee;(R=>{R.SUPPORTED_LANGS=["zh-CN","en-US"],R.DEFAULT_LANG="zh-CN";function r(m,A="EASBOT_LANG"){let I=[m,process.env[A]?.trim()];for(let i of I)if(i&&R.SUPPORTED_LANGS.includes(i))return i;return R.DEFAULT_LANG}R.resolveLocaleLang=r;function n(m){return m.replace(/\b\w/g,A=>A.toUpperCase())}R.titlecase=n;function s(m){return new Date(m).toLocaleTimeString(void 0,{timeStyle:"short"})}R.time=s;function l(m){let A=new Date(m),I=s(m),i=A.toLocaleDateString();return `${I} \xB7 ${i}`}R.datetime=l;function y(m){let A=new Date(m),I=new Date;return A.getFullYear()===I.getFullYear()&&A.getMonth()===I.getMonth()&&A.getDate()===I.getDate()?s(m):l(m)}R.todayTimeOrDateTime=y;function o(m){return m>=1e6?(m/1e6).toFixed(1)+"M":m>=1e3?(m/1e3).toFixed(1)+"K":m.toString()}R.number=o;function u(m){if(m<1e3)return `${m}ms`;if(m<6e4)return `${(m/1e3).toFixed(1)}s`;if(m<36e5){let i=Math.floor(m/6e4),h=Math.floor(m%6e4/1e3);return `${i}m ${h}s`}if(m<864e5){let i=Math.floor(m/36e5),h=Math.floor(m%36e5/6e4);return `${i}h ${h}m`}let A=Math.floor(m/36e5);return `${Math.floor(m%36e5/864e5)}d ${A}h`}R.duration=u;function b(m,A){return m.length<=A?m:m.slice(0,A-1)+"\u2026"}R.truncate=b;function w(m,A=35){if(m.length<=A)return m;let I="\u2026",i=Math.ceil((A-I.length)/2),h=Math.floor((A-I.length)/2);return m.slice(0,i)+I+m.slice(-h)}R.truncateMiddle=w;function S(m,A,I){return (m===1?A:I).replace("{}",m.toString())}R.pluralize=S;})(ee||(ee={}));var qt=ee.resolveLocaleLang,Wt=ee.SUPPORTED_LANGS,Xt=ee.DEFAULT_LANG;f();var Jt=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function Yt(){return Jt.some(t=>process.env[t])}function Zt(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function Vt(){let t=process.env.HTTP_PROXY||process.env.http_proxy,e=process.env.HTTPS_PROXY||process.env.https_proxy;return {http:t,https:e,enabled:!!(t||e)}}f();var Fe=class{constructor(){c(this,"queue",[]);c(this,"resolvers",[]);}push(e){let r=this.resolvers.shift();r?r(e):this.queue.push(e);}async next(){return this.queue.length>0?this.queue.shift():new Promise(e=>this.resolvers.push(e))}async*[Symbol.asyncIterator](){for(;;)yield await this.next();}};async function Kt(t,e,r){let n=[...e];await Promise.all(Array.from({length:t},async()=>{for(;;){let s=n.pop();if(s===void 0)return;await r(s);}}));}f();function Qt(){let t,e=new Promise(r=>t=r);return {trigger(){return t()},wait(){return e}}}f();function er(t,e){let r;return Promise.race([t.then(n=>(clearTimeout(r),n)),new Promise((n,s)=>{r=setTimeout(()=>{s(new Error(`Operation timed out after ${e}ms`));},e);})])}f();var Le;(y=>{let r=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function n(o){if(!o)return 0;let u=String(o),b=(u.match(r)||[]).length,w=u.length-b,S=Math.round(b/1.5),R=Math.round(w/4);return Math.max(0,S+R)}y.estimate=n;function s(o){if(o==null)return 0;try{let u=typeof o=="string"?o:JSON.stringify(o);return n(u)}catch{return 0}}y.estimateObject=s;function l(o){if(o.total!==void 0&&o.total>0)return o.total;let u=o.input??0,b=o.output??0,w=o.cache?.read??0,S=o.cache?.write??0;return u+b+w+S}y.total=l;})(Le||(Le={}));f();function rr(t){let e={},r=t.shape??t.required().shape;for(let[n,s]of Object.entries(r))e[n]=s.nullable().optional();return ue.object(e)}export{ve as Archive,Fe as AsyncQueue,he as Binary,_e as Color,$e as Context,Xt as DEFAULT_LANG,xe as Encode,De as EventLoop,ke as Fetch,Ee as Fn,Ie as Grep,Z as Identifier,we as Ignore,Ne as Keybind,ee as Locale,Se as Markdown,oe as NamedError,Wt as SUPPORTED_LANGS,be as SessionTitle,Oe as Slug,Le as Token,ye as TruncateContent,Ge as abortAfter,zt as abortAfterAny,Bt as defer,gt as findLast,yt as fn,Gt as formatDuration,Dt as getDirectory,It as getFileExtension,Ue as getFilename,Nt as getFilenameTruncated,Vt as getProxyConfig,Zt as getProxyUrl,Et as git,vt as iife,Tt as loadEnv,kt as loadTextFile,Ot as loadTextFileAsync,_t as parseModelId,Yt as proxied,qt as resolveLocaleLang,Ae as retry,Qt as signal,Ft as truncateMiddle,rr as updateSchema,er as withTimeout,Kt as work};
|
|
25
|
+
`),N=[];N.push(B(`--${T}\r
|
|
26
|
+
`));for(let I=0;I<R.length;I++)N.push(R[I]),I%2===1&&I<R.length-1&&(N.push(D),N.push(B(`--${T}\r
|
|
27
|
+
`)));N.push($);let j=N.reduce((I,k)=>I+k.length,0),H=new Uint8Array(j),U=0;for(let I of N)H.set(I,U),U+=I.length;return x(f,{method:"POST",headers:{"Content-Type":`multipart/form-data; boundary=${T}`,...y?.headers},body:H,timeout:A,...y})}p.postForm=e;function i(f,u,y){let T=new AbortController,R=T.signal;return (async()=>{try{let A={Accept:"text/event-stream",...y?.headers||{}},$=await fetch(f,{...y,headers:A,signal:R});if(!$.ok)throw new Error(`SSE connection failed: ${$.status}`);let D=$.body?.getReader();if(!D)throw new Error("SSE stream not available");let N=new TextDecoder("utf-8"),j="";for(;!R.aborted;){let{done:H,value:U}=await D.read();if(H)break;let I=N.decode(U,{stream:!0});j+=I;let k=j.split(`
|
|
28
|
+
`);j=k.pop()??"";for(let v of k)if(v.startsWith("data: ")){let M=v.slice(6);if(M==="[DONE]"){u.onComplete?.();return}u.onMessage?.(M);}}u.onComplete?.();}catch(A){A.name!=="AbortError"&&u.onError?.(A);}})(),()=>{T.abort();}}p.sse=i;})($e||($e={}));f();var ve;(n=>{let t=["brave","calm","clever","cosmic","crisp","curious","eager","gentle","glowing","happy","hidden","jolly","kind","lucky","mighty","misty","neon","nimble","playful","proud","quick","quiet","shiny","silent","stellar","sunny","swift","tidy","witty"],r=["cabin","cactus","canyon","circuit","comet","eagle","engine","falcon","forest","garden","harbor","island","knight","lagoon","meadow","moon","mountain","nebula","orchid","otter","panda","pixel","planet","river","rocket","sailor","squid","star","tiger","wizard","wolf"];function o(){return [t[Math.floor(Math.random()*t.length)],r[Math.floor(Math.random()*r.length)]].join("-")}n.create=o;})(ve||(ve={}));f();var De;(a=>(a.positiveInt=G.union([G.number(),G.string().regex(/^\d+$/,"must be a positive integer (digits only)")]).transform(l=>typeof l=="number"?l:Number.parseInt(l,10)).pipe(G.number().int().positive()),a.nonNegativeInt=G.union([G.number(),G.string().regex(/^\d+$/,"must be a non-negative integer (digits only)")]).transform(l=>typeof l=="number"?l:Number.parseInt(l,10)).pipe(G.number().int().nonnegative()),a.booleanLike=G.union([G.boolean(),G.string()]).transform((l,h)=>{if(typeof l=="boolean")return l;let s=l.trim().toLowerCase();return ["true","1","yes","on"].includes(s)?true:["false","0","no","off"].includes(s)?false:(h.addIssue({code:"custom",message:`invalid boolean string: ${JSON.stringify(l)}`}),G.NEVER)}).pipe(G.boolean()),a.stringArray=(l=",")=>G.union([G.array(G.string()),G.string()]).transform(h=>Array.isArray(h)?h:h.split(l).map(c=>c.trim()).filter(c=>c.length>0)).pipe(G.array(G.string()))))(De||(De={}));f();function Ye(t){let r=new AbortController,o=setTimeout(r.abort.bind(r),t);return {controller:r,signal:r.signal,clearTimeout:()=>globalThis.clearTimeout(o)}}function Yt(t,...r){let o=Ye(t);return {signal:AbortSignal.any([o.signal,...r]),clearTimeout:o.clearTimeout}}f();var Ie;(r=>{async function t(o,n){if(process.platform==="win32"){let a=Pe.resolve(o),l=Pe.resolve(n),h=`Expand-Archive -Path '${a}' -DestinationPath '${l}' -Force`,s=await G$1.run("powershell",`-NoProfile -NonInteractive -Command "$global:ProgressPreference = 'SilentlyContinue'; ${h}"`);if(s.code!==0)throw new Error(`PowerShell exited with code ${s.code}: ${s.stderr}`)}else {let a=`unzip -o -q ${o} -d ${n}`,l=await G$1.run(void 0,a);if(l.code!==0)throw new Error(`unzip exited with code ${l.code}: ${l.stderr}`)}}r.extractZip=t;})(Ie||(Ie={}));f();var Ne;(n=>{function t(a){return a?/^#[0-9a-fA-F]{6}$/.test(a):false}n.isValidHex=t;function r(a){let l=parseInt(a.slice(1,3),16),h=parseInt(a.slice(3,5),16),s=parseInt(a.slice(5,7),16);return {r:l,g:h,b:s}}n.hexToRgb=r;function o(a){if(!t(a))return;let{r:l,g:h,b:s}=r(a);return `\x1B[38;2;${l};${h};${s}m\x1B[1m`}n.hexToAnsiBold=o;})(Ne||(Ne={}));f();var Le;(o=>{class t extends Error{constructor(l){super(`No context found for ${l}`);c(this,"name",l);}}o.NotFound=t;function r(n){let a=new AsyncLocalStorage;return {use(){let l=a.getStore();if(!l)throw new t(n);return l},provide(l,h){return a.run(l,h)}}}o.create=r;})(Le||(Le={}));f();function Kt(t){return {[Symbol.dispose](){t();},[Symbol.asyncDispose](){return Promise.resolve(t())}}}f();var Fe;(r=>{async function t(){return new Promise(o=>{let n=()=>{process._getActiveHandles().length===0&&process._getActiveRequests().length===0?o():setImmediate(n);};n();})}r.wait=t;})(Fe||(Fe={}));f();function Vt(t){if(t<=0)return "";if(t<60)return `${t}s`;if(t<3600){let o=Math.floor(t/60),n=t%60;return n>0?`${o}m ${n}s`:`${o}m`}if(t<86400){let o=Math.floor(t/3600),n=Math.floor(t%3600/60);return n>0?`${o}h ${n}m`:`${o}h`}if(t<604800){let o=Math.floor(t/86400);return o===1?"~1 day":`~${o} days`}let r=Math.floor(t/604800);return r===1?"~1 week":`~${r} weeks`}f();var Ce;(X=>{let t=m.create({service:"grep"});async function r(){return o()}X.filepath=r;let o=b(async()=>{let e=await D.which("rg");if(!e)return null;try{if(!(await le.stat(e)).isFile())return null}catch{return null}try{let i=await D.run([e,"--version"],{timeout:5e3});if(i.code!==0||!i.stdout.startsWith("ripgrep "))return t.warn("rg failed self-test, falling back to pure JS",{filepath:e,code:i.code,stderr:i.stderr.slice(0,200)}),null}catch(i){return t.warn("rg spawn failed during self-test, falling back to pure JS",{filepath:e,error:i.message.slice(0,200)}),null}return e});async function n(){return await r()!==null}X.isUsingRipgrep=n;async function*a$2(e){e.signal?.throwIfAborted();let i=await r();i?yield*l(i,e):(t.debug("ripgrep not available, using pure JS fallback for files()",{cwd:e.cwd}),yield*h(e));}X.files=a$2;async function*l(e,i){i.signal?.throwIfAborted();let p=["--files","--glob=!.git/*"];i.follow&&p.push("--follow");let f=i.hidden!==false;if(i.maxDepth!==void 0&&p.push(`--max-depth=${i.maxDepth}`),i.glob)for(let T of i.glob)p.push(`--glob=${T}`);try{if(!(await le.stat(i.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${i.cwd}'`),{code:"ENOTDIR",errno:-20,path:i.cwd})}catch(T){throw T.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${i.cwd}'`),{code:"ENOENT",errno:-2,path:i.cwd}):T}let u=await D.run([e,...p],{cwd:i.cwd});if(u.code!==0&&u.code!==1)return;let y=u.stdout.split(/\r?\n/);for(let T of y){i.signal?.throwIfAborted();let R=T.trim();if(!R)continue;let L=d.toUnixPath(R);!f&&L.split("/").some(A=>A.startsWith("."))||(yield L);}}async function*h(e){e.signal?.throwIfAborted();try{if(!(await le.stat(e.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${e.cwd}'`),{code:"ENOTDIR",errno:-20,path:e.cwd})}catch(A){throw A.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${e.cwd}'`),{code:"ENOENT",errno:-2,path:e.cwd}):A}let i=[],p=[];if(e.glob)for(let A of e.glob)A.startsWith("!")?p.push(A.slice(1)):i.push(A);let f=i.length>0?w(i):["**/*"],u=e.hidden!==false,y=new Set,T=b$2.DEFAULT_MAX_DEPTH,R;e.maxDepth===void 0?R=T:e.maxDepth<0?R=1:R=e.maxDepth+1;let L=Math.min(Math.max(R,1),T);for(let A of f){e.signal?.throwIfAborted();let $=await b$2.scan(A,{cwd:e.cwd,absolute:false,include:"file",dot:u,symlink:e.follow??false,maxDepth:L,ignore:p});for(let D of $)!u&&D.split("/").some(N=>N.startsWith("."))||y.add(D);}for(let A of Array.from(y).sort())e.signal?.throwIfAborted(),yield A;e.signal?.throwIfAborted();}async function s(e){t.debug("tree",{cwd:e.cwd}),e.signal?.throwIfAborted();let i=e.hidden!==false,p=e.glob??[],f=p.filter(k=>!k.startsWith("!")),u=p.filter(k=>k.startsWith("!")).map(k=>k.slice(1)),y=f.length>0?f:["**/*"],T=new Set,R=[];for(let k of y){e.signal?.throwIfAborted();let v=await b$2.scan(k,{cwd:e.cwd,absolute:false,include:"file",dot:i,symlink:false,maxDepth:b$2.DEFAULT_MAX_DEPTH});for(let M of v)T.has(M)||(T.add(M),R.push(M));}let L=R.filter(k=>{for(let v of u)if(b$2.match(v,k))return false;return true});function A(k,v){let M=k.children.get(v);if(M)return M;let F={name:v,children:new Map};return k.children.set(v,F),F}let $={children:new Map};for(let k of L){let v=k.split("/");if(v.length<2)continue;let M=$;for(let F of v.slice(0,-1))M=A(M,F);}let D=Array.from($.children.values()).sort((k,v)=>k.name.localeCompare(v.name)),N=e.limit??Number.POSITIVE_INFINITY,j=[],H=D.map(k=>({node:k,path:k.name})),U=0,I=0;for(;H.length>0;){let k=H.shift();if(!k)break;if(U++,I<N){j.push(k.path),I++;for(let v of Array.from(k.node.children.values()).sort((M,F)=>M.name.localeCompare(F.name))){if(I>=N)break;H.push({node:v,path:`${k.path}/${v.name}`});}}}return U>I&&j.push(`[${I}/${U} shown, ${U-I} truncated]`),j.join(`
|
|
29
|
+
`)}X.tree=s;async function c(e){let i=await r();return i?d$1(i,e):(t.debug("ripgrep not available, using pure JS fallback for search()",{cwd:e.cwd,pattern:e.pattern}),x(e))}X.search=c;async function d$1(e,i){let p=["--json","--glob=!.git/*"];if(i.follow&&p.push("--follow"),i.glob)for(let R of i.glob)p.push(`--glob=${R}`);i.limit&&p.push(`--max-count=${i.limit}`),p.push("--"),p.push(i.pattern);let f=await D.run([e,...p],{cwd:i.cwd});if(f.code!==0)return [];let u=i.hidden!==false,y=f.stdout.split(/\r?\n/).filter(Boolean),T=[];for(let R of y)try{let L=JSON.parse(R);if(L?.type!=="match")continue;let A=L.data;if(!A?.path?.text||!A?.lines?.text)continue;let $=d.toUnixPath(A.path.text);if(!u&&$.split("/").some(D=>D.startsWith(".")))continue;if(T.push({path:$,lines:A.lines.text,line_number:A.line_number,absolute_offset:A.absolute_offset??0}),i.limit&&T.length>=i.limit)break}catch{}return T}async function x(e){let i;try{i=new RegExp(e.pattern);}catch{return []}try{if(!(await le.stat(e.cwd)).isDirectory())throw Object.assign(new Error(`Not a directory: '${e.cwd}'`),{code:"ENOTDIR",errno:-20,path:e.cwd})}catch(D){throw D.code==="ENOENT"?Object.assign(new Error(`No such file or directory: '${e.cwd}'`),{code:"ENOENT",errno:-2,path:e.cwd}):D}let p=[],f=[];if(e.glob)for(let D of e.glob)D.startsWith("!")?f.push(D):p.push(D);let y=w(f).map(D=>D.startsWith("!")?D.slice(1):D),T=e.hidden!==false,R=[],L=p.length>0?w(p):["**/*"],A=new Set,$=[];for(let D of L){e.signal?.throwIfAborted();let N=await b$2.scan(D,{cwd:e.cwd,absolute:false,include:"file",dot:T,symlink:e.follow??false,maxDepth:void 0,ignore:y});for(let j of N)A.has(j)||(A.add(j),$.push(j));}for(let D of $){if(e.signal?.throwIfAborted(),e.limit&&R.length>=e.limit)break;let N=d.join(e.cwd,D),j;try{j=await le.readFile(N,"utf-8");}catch{continue}let H=j.split(/\r?\n/),U=0;for(let I=0;I<H.length;I++){let k=H[I]??"";if(i.test(k)&&(R.push({path:D,lines:k,line_number:I+1,absolute_offset:U}),e.limit&&R.length>=e.limit))break;U+=Buffer.byteLength(k,"utf-8")+1;}}return R}function b$1(e,i){return a$1.match(e,i)}X.match=b$1;let E=a(async()=>await r());async function g(){return await E()}X.filepathCached=g;function w(e){let i=[];for(let p of e){if(p.startsWith("!")){let u=p.slice(1);i.push(`!${P(u)}`);continue}let f=O(p);for(let u of f)i.push(C(u));}return i}function P(e){return !e||e.startsWith("**")||e.includes("/")?e:/[*?[\]]/.test(e)?`**/${e}`:`**/${e}/**`}function O(e){let i=z(e);if(i===-1)return [e];let p=B(e,i);if(p===-1)return [e];let f=e.slice(i+1,p),u=Y(f);if(!u||u.length<=1)return [e];let y=e.slice(0,i),T=e.slice(p+1);return u.map(R=>y+R+T)}function C(e){return !e||e.includes("/")||e.startsWith("**")?e:`**/${e}`}function z(e){for(let p=0;p<e.length;p++){let f=e[p];if(f==="\\"){p++;continue}if(f==="{"){return p;}}return -1}function B(e,i){for(let p=i+1;p<e.length;p++){let f=e[p];if(f==="\\"){p++;continue}if(f==="}")return p}return -1}function Y(e){return e?e.split(","):null}X._ready=a(async()=>{let e=await r();return t.debug("Grep initialized",{ripgrep:e?"available":"fallback (pure JS)"}),e});})(Ce||(Ce={}));f();var je;(h=>{function t(s,c){if(s===c)return true;if(typeof s!="object"||typeof c!="object"||s===null||c===null)return false;let d=Object.keys(s),x=Object.keys(c);if(d.length!==x.length)return false;for(let b of d)if(!x.includes(b)||!t(s[b],c[b]))return false;return true}function r(s){return {...s,super:s.super??false}}function o(s,c){return s?t(r(s),r(c)):false}h.match=o;function n(s,c=false){return {name:s.name,ctrl:s.ctrl,meta:s.meta,shift:s.shift,super:s.super??false,leader:c}}h.fromParsedKey=n;function a(s){if(!s)return "";let c=[];s.ctrl&&c.push("ctrl"),s.meta&&c.push("alt"),s.super&&c.push("super"),s.shift&&c.push("shift"),s.name&&(s.name==="delete"?c.push("del"):c.push(s.name));let d=c.join("+");return s.leader&&(d=d?`<leader> ${d}`:"<leader>"),d}h.keyToString=a;function l(s){return s==="none"?[]:s.split(",").map(c=>{let x=c.replace(/<leader>/g,"leader+").toLowerCase().split("+"),b={ctrl:false,meta:false,shift:false,super:false,leader:false,name:""};for(let E of x)switch(E){case "ctrl":b.ctrl=true;break;case "alt":case "meta":case "option":b.meta=true;break;case "super":b.super=true;break;case "shift":b.shift=true;break;case "leader":b.leader=true;break;case "esc":b.name="escape";break;default:b.name=E;break}return b})}h.parse=l;})(je||(je={}));f();var ne;(E=>{E.SUPPORTED_LANGS=["zh-CN","en-US"],E.DEFAULT_LANG="zh-CN";function o(g,w="EASBOT_LANG"){let P=[g,process.env[w]?.trim()];for(let O of P)if(O&&E.SUPPORTED_LANGS.includes(O))return O;return E.DEFAULT_LANG}E.resolveLocaleLang=o;function n(g){return g.replace(/\b\w/g,w=>w.toUpperCase())}E.titlecase=n;function a(g){return new Date(g).toLocaleTimeString(void 0,{timeStyle:"short"})}E.time=a;function l(g){let w=new Date(g),P=a(g),O=w.toLocaleDateString();return `${P} \xB7 ${O}`}E.datetime=l;function h(g){let w=new Date(g),P=new Date;return w.getFullYear()===P.getFullYear()&&w.getMonth()===P.getMonth()&&w.getDate()===P.getDate()?a(g):l(g)}E.todayTimeOrDateTime=h;function s(g){return g>=1e6?(g/1e6).toFixed(1)+"M":g>=1e3?(g/1e3).toFixed(1)+"K":g.toString()}E.number=s;function c(g){if(g<1e3)return `${g}ms`;if(g<6e4)return `${(g/1e3).toFixed(1)}s`;if(g<36e5){let O=Math.floor(g/6e4),C=Math.floor(g%6e4/1e3);return `${O}m ${C}s`}if(g<864e5){let O=Math.floor(g/36e5),C=Math.floor(g%36e5/6e4);return `${O}h ${C}m`}let w=Math.floor(g/36e5);return `${Math.floor(g%36e5/864e5)}d ${w}h`}E.duration=c;function d(g,w){return g.length<=w?g:g.slice(0,w-1)+"\u2026"}E.truncate=d;function x(g,w=35){if(g.length<=w)return g;let P="\u2026",O=Math.ceil((w-P.length)/2),C=Math.floor((w-P.length)/2);return g.slice(0,O)+P+g.slice(-C)}E.truncateMiddle=x;function b(g,w,P){return (g===1?w:P).replace("{}",g.toString())}E.pluralize=b;})(ne||(ne={}));var Qt=ne.resolveLocaleLang,er=ne.SUPPORTED_LANGS,tr=ne.DEFAULT_LANG;f();var rr=["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy"];function nr(){return rr.some(t=>process.env[t])}function or(){return process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy}function sr(){let t=process.env.HTTP_PROXY||process.env.http_proxy,r=process.env.HTTPS_PROXY||process.env.https_proxy;return {http:t,https:r,enabled:!!(t||r)}}f();var Me=class{constructor(){c(this,"queue",[]);c(this,"resolvers",[]);}push(r){let o=this.resolvers.shift();o?o(r):this.queue.push(r);}async next(){return this.queue.length>0?this.queue.shift():new Promise(r=>this.resolvers.push(r))}async*[Symbol.asyncIterator](){for(;;)yield await this.next();}};async function ir(t,r,o){let n=[...r];await Promise.all(Array.from({length:t},async()=>{for(;;){let a=n.pop();if(a===void 0)return;await o(a);}}));}f();function ar(){let t,r=new Promise(o=>t=o);return {trigger(){return t()},wait(){return r}}}f();function cr(t,r){let o;return Promise.race([t.then(n=>(clearTimeout(o),n)),new Promise((n,a)=>{o=setTimeout(()=>{a(new Error(`Operation timed out after ${r}ms`));},r);})])}f();var ze;(h=>{let o=/[\u4e00-\u9fff\u3400-\u4dbf]/g;function n(s){if(!s)return 0;let c=String(s),d=(c.match(o)||[]).length,x=c.length-d,b=Math.round(d/1.5),E=Math.round(x/4);return Math.max(0,b+E)}h.estimate=n;function a(s){if(s==null)return 0;try{let c=typeof s=="string"?s:JSON.stringify(s);return n(c)}catch{return 0}}h.estimateObject=a;function l(s){if(s.total!==void 0&&s.total>0)return s.total;let c=s.input??0,d=s.output??0,x=s.cache?.read??0,b=s.cache?.write??0;return c+d+x+b}h.total=l;})(ze||(ze={}));f();function ur(t){let r={},o=t.shape??t.required().shape;for(let[n,a]of Object.entries(o))r[n]=a.nullable().optional();return G.object(r)}f();f();function Q(t){return /(\.md|\.ts|\.json|readme|doc|spec|guideline)/i.test(t)?"document":/(deadline|date|day|week|month|year|q[1-4]|sprint)/i.test(t)?"time":/(file|model|dataset|artifact|resource|tool|sdk|ollama|sqlite|embedding|vector|fts)/i.test(t)?"object":/(event|incident|release|meeting|migration|launch)/i.test(t)?"event":/(api|service|system|engine|pipeline|server|db|database|memorysystem|contextengine)/i.test(t)?"process":/(team|group|org|company|inc|ltd|corp)/i.test(t)?"organization":/(concept|principle|policy|method|pattern|strategy)/i.test(t)?"concept":/(score|rate|ratio|latency|accuracy|recall|precision|throughput|kpi)/i.test(t)?"metric":/(task|issue|ticket|todo|action)/i.test(t)?"task":/(process|workflow|procedure|flow|lifecycle)/i.test(t)?"process":/[A-Z]/.test(t)?"object":"keyword"}function re(t){return t.trim().replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu,"").replace(/\s+/g," ").slice(0,120)}f();var fr=/([A-Za-z][\w.-]{1,80})\s+(is_a|part_of|has_attribute|located_in|occurs_in|causes|influences|owned_by|member_of|uses|depends_on|related_to)\s+([A-Za-z][\w.-]{1,80})/g;function Ke(t){let r=[],o=[],n=new Set,a=new Set;for(let s of t.matchAll(fr)){let c=re(s[1]??""),d=(s[2]??"related_to").trim(),x=re(s[3]??"");if(!c||!x||c===x)continue;let b=c.toLowerCase(),E=x.toLowerCase();n.has(b)||(n.add(b),r.push({name:c,type:Q(c),properties:{source:"rule_extracted"}})),n.has(E)||(n.add(E),r.push({name:x,type:Q(x),properties:{source:"rule_extracted"}}));let g=`${b}|${E}|${d}`;a.has(g)||(a.add(g),o.push({source:c,target:x,relation:d}));}let l=t.split(/\n\s*\n/);for(let s of l){if(s.trim().length<20)continue;let c=[];for(let d of s.match(/[\p{L}\p{N}][\p{L}\p{N}_.-]{2,80}/gu)??[]){let x=re(d);if(!x)continue;let b=x.toLowerCase();n.has(b)&&(c.some(E=>E.key===b)||c.push({key:b,name:x}));}for(let d=0;d<c.length;d++)for(let x=d+1;x<c.length;x++){let b=c[d],E=c[x];if(!b||!E||b.key===E.key)continue;let g=Q(b.name),w=Q(E.name),P="related_to";g==="document"&&w==="object"?P="defines":g==="object"&&w==="document"?P="referenced_in":g==="process"&&w==="object"?P="uses":g==="object"&&w==="process"?P="used_by":g==="concept"&&(P="relates_to");let O=`${b.key}|${E.key}|${P}`;a.has(O)||(a.add(O),o.push({source:b.name,target:E.name,relation:P}));}}let h=t.match(/[\p{L}\p{N}][\p{L}\p{N}_.-]{1,80}/gu)??[];for(let s of h){let c=re(s);if(!c)continue;let d=c.toLowerCase();n.has(d)||(n.add(d),r.push({name:c,type:Q(c),properties:{source:"keyword_extracted"}}));}return {summary:"",entities:r,relations:o}}f();function Ve(t,r,o,n={}){let{maxContentLength:a=2e3,maxChunks:l=5,includeSummary:h=true}=n,s=r.map(b=>`- ${b.type}: ${b.rule}`).join(`
|
|
30
|
+
`),c=o.map(b=>`- ${b.type}: ${b.rule}`).join(`
|
|
31
|
+
`),d=t.slice(0,l).join(`
|
|
32
|
+
|
|
33
|
+
`).slice(0,a);return `You are an information extraction engine for a general-purpose memory graph.
|
|
34
|
+
|
|
35
|
+
Extract entities and directed relations from the text${h?", and generate a concise summary":""}.
|
|
36
|
+
|
|
37
|
+
Entity type taxonomy:
|
|
38
|
+
${s}
|
|
39
|
+
|
|
40
|
+
Relation type taxonomy:
|
|
41
|
+
${c}
|
|
42
|
+
|
|
43
|
+
Extraction rules:
|
|
44
|
+
- Output valid JSON only. Do not include markdown, prose, or code fences.
|
|
45
|
+
${h?`- summary: A concise summary (max 250 characters) describing the main topic and key points.
|
|
46
|
+
`:""}- Use canonical, concise entity names (deduplicated, case-insensitive).
|
|
47
|
+
- Prefer specific entity types over "keyword".
|
|
48
|
+
- Include relation only if both source and target entities are present in the entities list.
|
|
49
|
+
- Do not invent facts not grounded in the input text.
|
|
50
|
+
- Keep relation direction meaningful (source -> target).
|
|
51
|
+
- properties should contain short factual attributes only (plain JSON object).
|
|
52
|
+
|
|
53
|
+
Return this exact JSON shape:
|
|
54
|
+
{
|
|
55
|
+
${h?` "summary": "A concise summary of the text content (max 250 characters)",
|
|
56
|
+
`:""} "entities": [
|
|
57
|
+
{ "name": "string", "type": "one_of_entity_types", "properties": {} }
|
|
58
|
+
],
|
|
59
|
+
"relations": [
|
|
60
|
+
{ "source": "entity_name", "target": "entity_name", "relation": "one_of_relation_types" }
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Input text:
|
|
65
|
+
${d}`}f();function Qe(t,r,o){try{let n=t.match(/\{[\s\S]*\}/);if(n){let a=JSON.parse(n[0]);return Be(a,r,o)}}catch{}return {summary:"",entities:[],relations:[]}}function Be(t,r,o){let n=t,a=new Set(r.map(w=>w.type)),l=new Set(o.map(w=>w.type)),h=typeof n.summary=="string"?n.summary.trim():"",s=Array.isArray(n.entities)?n.entities:[],c=Array.isArray(n.relations)?n.relations:[],d=[],x=new Set,b=new Map;for(let w of s){let P=typeof w?.name=="string"?w.name.trim():"";if(!P)continue;let O=P.toLowerCase();if(x.has(O))continue;x.add(O),b.set(O,P);let C=typeof w?.type=="string"?w.type.trim():"",z=a.has(C)?C:"keyword",B=w?.properties&&typeof w.properties=="object"&&!Array.isArray(w.properties)?w.properties:{};d.push({name:P,type:z,properties:B});}let E=[],g=new Set;for(let w of c){let P=typeof w?.source=="string"?w.source.trim():"",O=typeof w?.target=="string"?w.target.trim():"";if(!P||!O)continue;let C=b.get(P.toLowerCase()),z=b.get(O.toLowerCase());if(!C||!z||C===z)continue;let B=typeof w?.relation=="string"?w.relation.trim():"",Y=l.has(B)?B:"related_to",W=`${C.toLowerCase()}|${z.toLowerCase()}|${Y}`;g.has(W)||(g.add(W),E.push({source:C,target:z,relation:Y}));}return {summary:h,entities:d,relations:E}}export{Ie as Archive,Me as AsyncQueue,be as Binary,Ne as Color,Le as Context,tr as DEFAULT_LANG,we as Encode,Fe as EventLoop,$e as Fetch,ke as Fn,Ce as Grep,V as Identifier,Re as Ignore,je as Keybind,ne as Locale,_e as Markdown,ae as NamedError,er as SUPPORTED_LANGS,De as Schema,Ee as SessionTitle,ve as Slug,ze as Token,Te as TruncateContent,Ye as abortAfter,Yt as abortAfterAny,Ve as buildEntityExtractionPrompt,Kt as defer,Ke as extractEntitiesByRules,Et as findLast,Pt as fn,Vt as formatDuration,zt as getDirectory,Bt as getFileExtension,Xe as getFilename,Gt as getFilenameTruncated,sr as getProxyConfig,or as getProxyUrl,$t as git,Ct as iife,Q as inferEntityType,Ot as loadEnv,Lt as loadTextFile,Ft as loadTextFileAsync,Be as normalizeExtractionResult,Qe as parseEntityExtractionResult,jt as parseModelId,nr as proxied,Qt as resolveLocaleLang,Oe as retry,re as sanitizeEntityToken,ar as signal,Ht as truncateMiddle,ur as updateSchema,cr as withTimeout,ir as work};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easbot/utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.17",
|
|
4
4
|
"description": "Shared utilities library for EASBOT ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -41,34 +41,32 @@
|
|
|
41
41
|
"LICENSE"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@hono/node-server": "^2.
|
|
45
|
-
"@hono/node-ws": "^1.3.
|
|
46
|
-
"@hono/standard-validator": "^0.
|
|
47
|
-
"@hono/zod-validator": "^0.
|
|
44
|
+
"@hono/node-server": "^2.1.1",
|
|
45
|
+
"@hono/node-ws": "^1.3.1",
|
|
46
|
+
"@hono/standard-validator": "^0.4.0",
|
|
47
|
+
"@hono/zod-validator": "^0.9.0",
|
|
48
48
|
"dotenv": "^17.4.2",
|
|
49
|
-
"picocolors": "1.1.1",
|
|
50
49
|
"glob": "^13.0.6",
|
|
51
50
|
"gray-matter": "^4.0.3",
|
|
52
|
-
"hono": "^4.
|
|
53
|
-
"hono-openapi": "^1.3.
|
|
51
|
+
"hono": "^4.13.2",
|
|
52
|
+
"hono-openapi": "^1.3.1",
|
|
54
53
|
"markdown-it": "^14.1.1",
|
|
55
|
-
"undici": "^8.
|
|
54
|
+
"undici": "^8.10.0",
|
|
56
55
|
"ws": "^8.20.0",
|
|
57
56
|
"xdg-basedir": "^5.1.0",
|
|
58
|
-
"yaml": "^2.9.0",
|
|
59
57
|
"zod": "^4.4.3",
|
|
60
|
-
"@easbot/types": "0.3.
|
|
58
|
+
"@easbot/types": "0.3.17"
|
|
61
59
|
},
|
|
62
60
|
"devDependencies": {
|
|
63
61
|
"@types/markdown-it": "^14.1.2",
|
|
64
|
-
"@types/node": "^25.
|
|
62
|
+
"@types/node": "^25.9.5",
|
|
65
63
|
"@types/ws": "^8.18.1",
|
|
66
64
|
"tsup": "^8.5.1",
|
|
67
65
|
"typescript": "^6.0.3",
|
|
68
66
|
"vitest": "^4.1.5"
|
|
69
67
|
},
|
|
70
68
|
"engines": {
|
|
71
|
-
"node": ">=22.22.
|
|
69
|
+
"node": ">=22.22.2"
|
|
72
70
|
},
|
|
73
71
|
"publishConfig": {
|
|
74
72
|
"access": "public"
|
|
@@ -84,6 +82,7 @@
|
|
|
84
82
|
"test": "vitest",
|
|
85
83
|
"test:run": "vitest run",
|
|
86
84
|
"test:coverage": "vitest run --coverage",
|
|
85
|
+
"test:clean": "tsx scripts/clean-test-fixtures.ts",
|
|
87
86
|
"lint": "biome check .",
|
|
88
87
|
"lint:fix": "biome check --write .",
|
|
89
88
|
"lint:report": "biome check --reporter=summary .",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var n=Object.defineProperty;var c=(t,e,r)=>e in t?n(t,e,{enumerable:true,configurable:true,writable:true,value:r}):t[e]=r;var u=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var o=(t,e)=>()=>(t&&(e=t(t=0)),e);var a=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var i=(t,e,r)=>c(t,typeof e!="symbol"?e+"":e,r);var m;exports.d=void 0;var p=o(()=>{m=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,exports.d=m();});exports.a=u;exports.b=a;exports.c=i;exports.e=p;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import a from'path';import {fileURLToPath}from'url';var r=Object.defineProperty;var i=(e,t,o)=>t in e?r(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o;var l=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var n=(e,t)=>()=>(e&&(t=e(e=0)),t);var s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var _=(e,t,o)=>i(e,typeof t!="symbol"?t+"":t,o);var m,c,x,u,f=n(()=>{m=()=>fileURLToPath(import.meta.url),c=()=>a.dirname(m()),x=c(),u=m();});export{l as a,s as b,_ as c,x as d,u as e,f};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkAGCTBLWP_cjs=require('./chunk-AGCTBLWP.cjs');require('./chunk-7WRC6YMO.cjs');Object.defineProperty(exports,"Filesystem",{enumerable:true,get:function(){return chunkAGCTBLWP_cjs.d}});Object.defineProperty(exports,"MIME_TYPES",{enumerable:true,get:function(){return chunkAGCTBLWP_cjs.c}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{d as Filesystem,c as MIME_TYPES}from'./chunk-YTLHVUQE.mjs';import'./chunk-DFVKHBF4.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as Lock}from'./chunk-WZHHFME6.mjs';import'./chunk-DFVKHBF4.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkXP3JFKUF_cjs=require('./chunk-XP3JFKUF.cjs');require('./chunk-7WRC6YMO.cjs');Object.defineProperty(exports,"Lock",{enumerable:true,get:function(){return chunkXP3JFKUF_cjs.a}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkDSQTBBWA_cjs=require('./chunk-DSQTBBWA.cjs');require('./chunk-7WRC6YMO.cjs');Object.defineProperty(exports,"PackageRegistry",{enumerable:true,get:function(){return chunkDSQTBBWA_cjs.o}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{o as PackageRegistry}from'./chunk-UAOGVWUY.mjs';import'./chunk-DFVKHBF4.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{H as $,G as Shell}from'./chunk-QHS45ILC.mjs';import'./chunk-YTLHVUQE.mjs';import'./chunk-UAOGVWUY.mjs';import'./chunk-DFVKHBF4.mjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkBPUVSXJ3_cjs=require('./chunk-BPUVSXJ3.cjs');require('./chunk-AGCTBLWP.cjs'),require('./chunk-DSQTBBWA.cjs'),require('./chunk-7WRC6YMO.cjs');Object.defineProperty(exports,"$",{enumerable:true,get:function(){return chunkBPUVSXJ3_cjs.H}});Object.defineProperty(exports,"Shell",{enumerable:true,get:function(){return chunkBPUVSXJ3_cjs.G}});
|