@easbot/memory 0.3.37 → 0.3.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.en.md +126 -81
  2. package/README.md +52 -36
  3. package/dist/assets/txt/src/plugin/tool/memory.txt +1 -1
  4. package/dist/chunks/{chunk-ISYAE6B7.cjs → chunk-4CMSRWL3.cjs} +12 -12
  5. package/dist/chunks/{chunk-QAEIHJOF.cjs → chunk-77ERAHDK.cjs} +16 -16
  6. package/dist/chunks/{chunk-4G4FSAFY.cjs → chunk-BHGAFQCX.cjs} +1 -1
  7. package/dist/chunks/{chunk-FZ3RTYIJ.mjs → chunk-LM6WT4CO.mjs} +11 -11
  8. package/dist/chunks/{chunk-AEAMQDNV.mjs → chunk-LQ4OZPZI.mjs} +16 -16
  9. package/dist/chunks/{chunk-YUWHNHAY.mjs → chunk-NBPDJQIR.mjs} +1 -1
  10. package/dist/chunks/cli-handler-EA6B2IET.mjs +1 -0
  11. package/dist/chunks/cli-handler-F67HXX57.cjs +1 -0
  12. package/dist/chunks/{consolidate-OOAMW7XW.mjs → consolidate-I5KIRN4Q.mjs} +1 -1
  13. package/dist/chunks/{consolidate-IKQVVWIQ.cjs → consolidate-V5B7US3A.cjs} +1 -1
  14. package/dist/chunks/{doctor-ZGHICE2Q.mjs → doctor-GYFZEOFU.mjs} +1 -1
  15. package/dist/chunks/{doctor-N6HHFR6Y.cjs → doctor-WB5IFSAX.cjs} +1 -1
  16. package/dist/chunks/{extract-7DQ6OV34.cjs → extract-NKDG4CRZ.cjs} +1 -1
  17. package/dist/chunks/{extract-AJY2ETKE.mjs → extract-PRZC6J42.mjs} +1 -1
  18. package/dist/chunks/{forget-4KGLTQ5Q.cjs → forget-HMP73OMP.cjs} +1 -1
  19. package/dist/chunks/{forget-NIBBY6FG.mjs → forget-ZETWU236.mjs} +1 -1
  20. package/dist/chunks/{graph-OG23VZZM.cjs → graph-RPU4LN35.cjs} +1 -1
  21. package/dist/chunks/{graph-4K56ZAVL.mjs → graph-XCIX6M4X.mjs} +1 -1
  22. package/dist/chunks/{init-HWR4SD6N.mjs → init-65BD6AXC.mjs} +1 -1
  23. package/dist/chunks/{init-UQTPANNI.cjs → init-EB7XE4QK.cjs} +1 -1
  24. package/dist/chunks/{mcp-ONIMP7FB.cjs → mcp-EPQG2OIZ.cjs} +1 -1
  25. package/dist/chunks/{mcp-ZWZYH52C.mjs → mcp-KUQ55KNY.mjs} +1 -1
  26. package/dist/chunks/{recall-BRXHJPR4.mjs → recall-ARCQ5XUX.mjs} +1 -1
  27. package/dist/chunks/{recall-KZRYTTWA.cjs → recall-SEYESB2W.cjs} +1 -1
  28. package/dist/chunks/{remember-GLOJH457.cjs → remember-22SZ6PPM.cjs} +1 -1
  29. package/dist/chunks/{remember-3XSYCWKK.mjs → remember-KAVRIPMH.mjs} +1 -1
  30. package/dist/chunks/{status-POX2GWSQ.cjs → status-6724XOPA.cjs} +1 -1
  31. package/dist/chunks/{status-SW5BUHJ3.mjs → status-SKORJWEX.mjs} +1 -1
  32. package/dist/chunks/stdio-server-5HTVIDF7.mjs +1 -0
  33. package/dist/chunks/{stdio-server-W52CMVJO.cjs → stdio-server-AHIGDFUH.cjs} +1 -1
  34. package/dist/chunks/{sync-I423W5G7.cjs → sync-RNULQHQD.cjs} +1 -1
  35. package/dist/chunks/{sync-EE4ZD3WB.mjs → sync-UVNIQMEQ.mjs} +1 -1
  36. package/dist/cli.cjs +1 -1
  37. package/dist/cli.mjs +1 -1
  38. package/dist/index.cjs +35 -25
  39. package/dist/index.d.cts +134 -50
  40. package/dist/index.d.ts +134 -50
  41. package/dist/index.mjs +35 -25
  42. package/package.json +11 -11
  43. package/dist/chunks/cli-handler-JHSDGJHK.mjs +0 -1
  44. package/dist/chunks/cli-handler-USK4CPAU.cjs +0 -1
  45. package/dist/chunks/stdio-server-3A3H4YJ7.mjs +0 -1
@@ -1 +1 @@
1
- import {f}from'./chunk-HX3TV7FD.mjs';import {Log,errorMeta}from'@easbot/utils';import {renderLines,printHuman,emitJsonError,emitJsonOk,formatKnowledgeDoctor,formatKnowledgeStatus,formatKnowledgeInit}from'@easbot/terminal';var w=Log.create({service:"memory.cli"}),v=[{i18nKey:"cli.cmd.init.description",name:"init",description:"Initialize memory workspace (.easbot/memory.db)",group:"lifecycle"},{i18nKey:"cli.cmd.status.description",name:"status",description:"Show memory state / db stats / facts by category",group:"lifecycle"},{i18nKey:"cli.cmd.doctor.description",name:"doctor",description:"Run health checks (backend, FTS, schema, lock)",group:"lifecycle"},{i18nKey:"cli.cmd.recall.description",name:"recall",description:"Hybrid search (FTS + vector) over memory facts",group:"memory"},{i18nKey:"cli.cmd.remember.description",name:"remember",description:"Persist a new memory fact (with dedup + KG extraction)",group:"memory"},{i18nKey:"cli.cmd.forget.description",name:"forget",description:"Delete memory facts (factId / category / timeRange / dryRun)",group:"memory"},{i18nKey:"cli.cmd.sync.description",name:"sync",description:"Sync facts to .md files (idempotent) and archive expired active files (default 30 days)",group:"memory"},{i18nKey:"cli.cmd.extract.description",name:"extract",description:"Extract facts from a session (sessionId + lastN)",group:"session"},{i18nKey:"cli.cmd.consolidate.description",name:"consolidate",description:"Run consolidation pipeline (extract \u2192 dedup \u2192 archive)",group:"session"},{i18nKey:"cli.cmd.graph.description",name:"graph",description:"KG query (nodes / edges / neighbors with scope \u4E09\u6863)",group:"graph"},{i18nKey:"cli.cmd.config.description",name:"config",description:"Show / validate memory configuration (dry-read)",group:"external"},{i18nKey:"cli.cmd.mcp.description",name:"mcp",description:"Start stdio MCP server (exposes 10 memory tools)",group:"external"}];function g(l,t){let e=v.filter(s=>s.group===l);return renderLines({title:t,flat:e.map(s=>`$ easbot-memory ${s.name.padEnd(14)} ${s.description}`)})}function j(){let l=[renderLines({title:"easbot-memory \xB7 Memory & Knowledge Module for EASBot",flat:["Usage: easbot-memory <command> [options]"]}),"",g("lifecycle","Commands (lifecycle):"),"",g("memory","Commands (memory):"),"",g("session","Commands (session):"),"",g("graph","Commands (graph query):"),"",g("external","External:")];printHuman(l);}function C(){j(),printHuman(["",renderLines({title:"Global flags & invocation",flat:["--cwd <dir> --config <path> --log-level <L> --print-logs --debug","Standalone CLI: easbot-memory <command>","Agent CLI: easbot memory <command>"]})]);}async function M(){try{let{Llm:l}=await import('./llm-BRSMYENV.mjs'),{MemoryCache:t}=await import('./cache-U5YYUDWO.mjs'),e=await t.getMemoryJson();l.init({models:{embedding:e?.embedding_model??void 0,graph:e?.graph_model??void 0}});}catch(l){w.warn("Llm init failed; Llm-related features will be disabled",{error:errorMeta(l)});}}async function U(l,t){let [e,...s]=l;t?.cwd??process.cwd();let c=t?.agentId??"default";if(!e)return C(),{code:0,handled:true,command:null};await M();let m=s.includes("--json");try{switch(e){case "init":{let{parseInitOptions:i,runInit:a}=await import('./init-HWR4SD6N.mjs'),n=i(s);if(n.help)return console.log("Usage: easbot-memory init [--force] [--json]"),{code:0,handled:!0,command:e};let o=await a({...n,agentId:c});if(n.json)emitJsonOk(o,{command:e});else {let r=o;printHuman([formatKnowledgeInit({packageName:"memory",configPath:r.configPath??r.dbPath,backend:"better-sqlite3",schemaVersion:r.schemaVersion,extras:{dbPath:r.dbPath,migrationsApplied:r.migrationsApplied,tablesCreated:r.tablesCreated,durationMs:`${r.durationMs}ms`}})],{title:"init memory workspace",boxed:!0});}return {code:0,handled:!0,command:e}}case "recall":{let{parseRecallOptions:i,runRecall:a,formatRecallText:n}=await import('./recall-BRXHJPR4.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory recall --query <q> [--limit <n>] [--category <c>] [--min-importance <n>] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:`recall (agentId=${c??"default"})`}),{code:0,handled:!0,command:e}}case "remember":{let{parseRememberOptions:i,runRemember:a,formatRememberText:n}=await import('./remember-3XSYCWKK.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory remember --content <text> --category <c> --importance <1-10> [--tag <t>] [--session <s>] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"remember (persist fact)"}),{code:0,handled:!0,command:e}}case "forget":{let{parseForgetOptions:i,runForget:a,formatForgetText:n}=await import('./forget-NIBBY6FG.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory forget (--fact-id <id> | --category <c> | --from <ISO> --to <ISO>) [--max-delete <n>] [--dry-run] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"forget (delete facts)"}),{code:0,handled:!0,command:e}}case "extract":{let{parseExtractOptions:i,runExtract:a,formatExtractText:n}=await import('./extract-AJY2ETKE.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory extract --session <sessionId> [--last-n <n>] [--from-msg <id>] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"extract (from session)"}),{code:0,handled:!0,command:e}}case "consolidate":{let{parseConsolidateOptions:i,runConsolidate:a,formatConsolidateText:n}=await import('./consolidate-OOAMW7XW.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory consolidate [--window-days <n>] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"consolidate (pipeline)"}),{code:0,handled:!0,command:e}}case "sync":{let{parseSyncOptions:i,runSync:a,formatSyncText:n}=await import('./sync-EE4ZD3WB.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory sync [--window-days <n>] [--dry-run] [--json]"),console.log("Two-stage pipeline: (A) db \u2192 .md (idempotent skip on existing), (B) archive active/ files older than windowDays."),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"sync (db \u2192 .md + archive)"}),{code:0,handled:!0,command:e}}case "graph":{let{parseGraphOptions:i,runGraph:a,formatGraphText:n}=await import('./graph-4K56ZAVL.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory graph [--query <q>] [--node-id <id>] [--max-depth <n>] [--max-nodes <n>] [--max-edges-per-node <n>] [--json]\n (note: `--depth` is an alias for `--max-depth`; old `--kind` / `--start-node` / `--scope` flags removed since service schema is strict)"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"graph_query"}),{code:0,handled:!0,command:e}}case "status":{let{parseStatusOptions:i,runStatus:a}=await import('./status-SW5BUHJ3.mjs'),n=i(s);if(n.help)return console.log("Usage: easbot-memory status [--json]"),{code:0,handled:!0,command:e};let o=await a({...n,agentId:c});return n.json?emitJsonOk(o,{command:e}):printHuman([formatKnowledgeStatus(K(o))],{title:"memory status",boxed:!0}),{code:0,handled:!0,command:e}}case "doctor":{let{parseDoctorOptions:i,runDoctor:a}=await import('./doctor-ZGHICE2Q.mjs'),n=i(s);if(n.help)return console.log("Usage: easbot-memory doctor [--repair] [--json]"),{code:0,handled:!0,command:e};let o=await a({...n});return n.json?emitJsonOk(o,{command:e}):printHuman([formatKnowledgeDoctor(R(o))],{title:"memory doctor",boxed:!0}),{code:0,handled:!0,command:e}}case "config":{let{parseConfigOptions:i,runConfig:a,formatConfigText:n}=await import('./config-5P7O45FH.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory config [--json]"),{code:0,handled:!0,command:e};let r=a(o);return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"memory config"}),{code:0,handled:!0,command:e}}case "mcp":{let{parseMcpOptions:i,runMcp:a}=await import('./mcp-ZWZYH52C.mjs'),n=i(s);if(n.help)return console.log("Usage: easbot-memory mcp [start]"),console.log("Start a stdio MCP server exposing 10 memory tools:"),console.log(" recall / remember / forget / extract / consolidate"),console.log(" graph_query / status / doctor / init / sync"),{code:0,handled:!0,command:e};let o=await a(n);return n.json?emitJsonOk(o,{command:e}):printHuman([`memory mcp started (tools: ${o.tools.length})`],{title:"memory mcp server"}),{code:0,handled:!0,command:e}}default:return m?emitJsonError(e??"__unknown__",`Unknown command: ${e}`):(console.error(`Unknown command: ${e}`),console.error("Run `easbot-memory --help` for available commands.")),{code:2,handled:!1,command:null}}}catch(i){let a=errorMeta(i);w.error("memory CLI command failed",{command:e,error:a});let n=t?.cwd??f().worktree;return m?emitJsonError(e??"__unknown__",a.message):console.error(`[memory] ${n} :: ${e} failed: ${a.message}`),{code:1,handled:true,command:e}}}function K(l){let t=l;return {packageName:"memory",rootDir:t.workspaceDir??"",configPath:t.configPath??"",configExists:typeof t.configExists=="boolean"?t.configExists:true,dbPath:t.dbPath??"",dbExists:typeof t.dbExists=="boolean"?t.dbExists:true,dbSize:typeof t.dbSize=="number"?t.dbSize:void 0,indexState:t.indexState,schemaVersion:typeof t.schemaVersion=="number"?t.schemaVersion:void 0,extractionVersion:typeof t.extractionVersion=="number"?t.extractionVersion:void 0,lastSyncAt:t.lastSyncAt,vectorEnabled:typeof t.vectorEnabled=="boolean"?t.vectorEnabled:void 0,embeddingDims:typeof t.embeddingDims=="number"?t.embeddingDims:void 0,llm:t.llm??{initialized:false,capabilities:{}},backend:t.backend,healthy:typeof t.healthy=="boolean"?t.healthy:true,recommendation:t.recommendation,dbStats:(()=>{let e=t.dbStats;if(e&&typeof e=="object"&&Object.keys(e).length>0)return {...e};let s=t.integrityStats;if(s&&typeof s=="object"&&Object.keys(s).length>0)return {...s}})(),extras:(()=>{let e={};if(typeof t.agentId=="string"&&(e.agent_id=t.agentId),typeof t.ftsAvailable=="boolean"&&(e.fts_available=t.ftsAvailable?"yes":"no"),t.factsByCategory&&typeof t.factsByCategory=="object"){let s=t.factsByCategory;for(let[u,c]of Object.entries(s))typeof c=="number"&&c>0&&(e[`facts/${u}`]=c);}if(t.meta&&typeof t.meta=="object")for(let[s,u]of Object.entries(t.meta))e[`meta/${s}`]=u===void 0?"\u2205":u;return Object.keys(e).length>0?e:void 0})()}}function R(l){let t=l,e=Array.isArray(t.checks)?t.checks:[],s=t.integrityStats,u=t.backendAvailable,c=s?{...s}:void 0;return {packageName:"memory",healthy:typeof t.healthy=="boolean"?t.healthy:false,durationMs:typeof t.durationMs=="number"?t.durationMs:0,checks:e.map(m=>({code:typeof m.code=="string"?m.code:"",severity:m.severity??"info",name:typeof m.name=="string"?m.name:"",message:typeof m.message=="string"?m.message:"",durationMs:typeof m.durationMs=="number"?m.durationMs:void 0,details:m.details})),dbStats:c,backendAvailable:u}}export{v as a,j as b,C as c,U as d,R as e};
1
+ import {f}from'./chunk-HX3TV7FD.mjs';import {Log,errorMeta}from'@easbot/utils';import {renderLines,printHuman,emitJsonError,emitJsonOk,formatKnowledgeDoctor,formatKnowledgeStatus,formatKnowledgeInit}from'@easbot/terminal';var w=Log.create({service:"memory.cli"}),v=[{i18nKey:"cli.cmd.init.description",name:"init",description:"Initialize memory workspace (.easbot/memory.db)",group:"lifecycle"},{i18nKey:"cli.cmd.status.description",name:"status",description:"Show memory state / db stats / facts by category",group:"lifecycle"},{i18nKey:"cli.cmd.doctor.description",name:"doctor",description:"Run health checks (backend, FTS, schema, lock)",group:"lifecycle"},{i18nKey:"cli.cmd.recall.description",name:"recall",description:"Hybrid search (FTS + vector) over memory facts",group:"memory"},{i18nKey:"cli.cmd.remember.description",name:"remember",description:"Persist a new memory fact (with dedup + KG extraction)",group:"memory"},{i18nKey:"cli.cmd.forget.description",name:"forget",description:"Delete memory facts (factId / category / timeRange / dryRun)",group:"memory"},{i18nKey:"cli.cmd.sync.description",name:"sync",description:"Sync facts to .md files (idempotent) and archive expired active files (default 30 days)",group:"memory"},{i18nKey:"cli.cmd.extract.description",name:"extract",description:"Extract facts from a session (sessionId + lastN)",group:"session"},{i18nKey:"cli.cmd.consolidate.description",name:"consolidate",description:"Run consolidation pipeline (extract \u2192 dedup \u2192 archive)",group:"session"},{i18nKey:"cli.cmd.graph.description",name:"graph",description:"KG query (nodes / edges / neighbors with scope \u4E09\u6863)",group:"graph"},{i18nKey:"cli.cmd.config.description",name:"config",description:"Show / validate memory configuration (dry-read)",group:"external"},{i18nKey:"cli.cmd.mcp.description",name:"mcp",description:"Start stdio MCP server (exposes 10 memory tools)",group:"external"}];function g(l,t){let e=v.filter(s=>s.group===l);return renderLines({title:t,flat:e.map(s=>`$ easbot-memory ${s.name.padEnd(14)} ${s.description}`)})}function j(){let l=[renderLines({title:"easbot-memory \xB7 Memory & Knowledge Module for EASBot",flat:["Usage: easbot-memory <command> [options]"]}),"",g("lifecycle","Commands (lifecycle):"),"",g("memory","Commands (memory):"),"",g("session","Commands (session):"),"",g("graph","Commands (graph query):"),"",g("external","External:")];printHuman(l);}function C(){j(),printHuman(["",renderLines({title:"Global flags & invocation",flat:["--cwd <dir> --config <path> --log-level <L> --print-logs --debug","Standalone CLI: easbot-memory <command>","Agent CLI: easbot memory <command>"]})]);}async function M(){try{let{Llm:l}=await import('./llm-BRSMYENV.mjs'),{MemoryCache:t}=await import('./cache-U5YYUDWO.mjs'),e=await t.getMemoryJson();l.init({models:{embedding:e?.embedding_model??void 0,graph:e?.graph_model??void 0}});}catch(l){w.warn("Llm init failed; Llm-related features will be disabled",{error:errorMeta(l)});}}async function U(l,t){let [e,...s]=l;t?.cwd??process.cwd();let c=t?.agentId??"default";if(!e)return C(),{code:0,handled:true,command:null};await M();let m=s.includes("--json");try{switch(e){case "init":{let{parseInitOptions:i,runInit:a}=await import('./init-65BD6AXC.mjs'),n=i(s);if(n.help)return console.log("Usage: easbot-memory init [--force] [--json]"),{code:0,handled:!0,command:e};let o=await a({...n,agentId:c});if(n.json)emitJsonOk(o,{command:e});else {let r=o;printHuman([formatKnowledgeInit({packageName:"memory",configPath:r.configPath??r.dbPath,backend:"better-sqlite3",schemaVersion:r.schemaVersion,extras:{dbPath:r.dbPath,migrationsApplied:r.migrationsApplied,tablesCreated:r.tablesCreated,durationMs:`${r.durationMs}ms`}})],{title:"init memory workspace",boxed:!0});}return {code:0,handled:!0,command:e}}case "recall":{let{parseRecallOptions:i,runRecall:a,formatRecallText:n}=await import('./recall-ARCQ5XUX.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory recall --query <q> [--limit <n>] [--category <c>] [--min-importance <n>] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:`recall (agentId=${c??"default"})`}),{code:0,handled:!0,command:e}}case "remember":{let{parseRememberOptions:i,runRemember:a,formatRememberText:n}=await import('./remember-KAVRIPMH.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory remember --content <text> --category <c> --importance <1-10> [--tag <t>] [--session <s>] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"remember (persist fact)"}),{code:0,handled:!0,command:e}}case "forget":{let{parseForgetOptions:i,runForget:a,formatForgetText:n}=await import('./forget-ZETWU236.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory forget (--fact-id <id> | --category <c> | --from <ISO> --to <ISO>) [--max-delete <n>] [--dry-run] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"forget (delete facts)"}),{code:0,handled:!0,command:e}}case "extract":{let{parseExtractOptions:i,runExtract:a,formatExtractText:n}=await import('./extract-PRZC6J42.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory extract --session <sessionId> [--last-n <n>] [--from-msg <id>] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"extract (from session)"}),{code:0,handled:!0,command:e}}case "consolidate":{let{parseConsolidateOptions:i,runConsolidate:a,formatConsolidateText:n}=await import('./consolidate-I5KIRN4Q.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory consolidate [--window-days <n>] [--json]"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"consolidate (pipeline)"}),{code:0,handled:!0,command:e}}case "sync":{let{parseSyncOptions:i,runSync:a,formatSyncText:n}=await import('./sync-UVNIQMEQ.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory sync [--window-days <n>] [--dry-run] [--json]"),console.log("Two-stage pipeline: (A) db \u2192 .md (idempotent skip on existing), (B) archive active/ files older than windowDays."),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"sync (db \u2192 .md + archive)"}),{code:0,handled:!0,command:e}}case "graph":{let{parseGraphOptions:i,runGraph:a,formatGraphText:n}=await import('./graph-XCIX6M4X.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory graph [--query <q>] [--node-id <id>] [--max-depth <n>] [--max-nodes <n>] [--max-edges-per-node <n>] [--json]\n (note: `--depth` is an alias for `--max-depth`; old `--kind` / `--start-node` / `--scope` flags removed since service schema is strict)"),{code:0,handled:!0,command:e};let r=await a({...o,agentId:c});return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"graph_query"}),{code:0,handled:!0,command:e}}case "status":{let{parseStatusOptions:i,runStatus:a}=await import('./status-SKORJWEX.mjs'),n=i(s);if(n.help)return console.log("Usage: easbot-memory status [--json]"),{code:0,handled:!0,command:e};let o=await a({...n,agentId:c});return n.json?emitJsonOk(o,{command:e}):printHuman([formatKnowledgeStatus(K(o))],{title:"memory status",boxed:!0}),{code:0,handled:!0,command:e}}case "doctor":{let{parseDoctorOptions:i,runDoctor:a}=await import('./doctor-GYFZEOFU.mjs'),n=i(s);if(n.help)return console.log("Usage: easbot-memory doctor [--repair] [--json]"),{code:0,handled:!0,command:e};let o=await a({...n});return n.json?emitJsonOk(o,{command:e}):printHuman([formatKnowledgeDoctor(R(o))],{title:"memory doctor",boxed:!0}),{code:0,handled:!0,command:e}}case "config":{let{parseConfigOptions:i,runConfig:a,formatConfigText:n}=await import('./config-5P7O45FH.mjs'),o=i(s);if(o.help)return console.log("Usage: easbot-memory config [--json]"),{code:0,handled:!0,command:e};let r=a(o);return o.json?emitJsonOk(r,{command:e}):printHuman([n(r)],{title:"memory config"}),{code:0,handled:!0,command:e}}case "mcp":{let{parseMcpOptions:i,runMcp:a}=await import('./mcp-KUQ55KNY.mjs'),n=i(s);if(n.help)return console.log("Usage: easbot-memory mcp [start]"),console.log("Start a stdio MCP server exposing 10 memory tools:"),console.log(" recall / remember / forget / extract / consolidate"),console.log(" graph_query / status / doctor / init / sync"),{code:0,handled:!0,command:e};let o=await a(n);return n.json?emitJsonOk(o,{command:e}):printHuman([`memory mcp started (tools: ${o.tools.length})`],{title:"memory mcp server"}),{code:0,handled:!0,command:e}}default:return m?emitJsonError(e??"__unknown__",`Unknown command: ${e}`):(console.error(`Unknown command: ${e}`),console.error("Run `easbot-memory --help` for available commands.")),{code:2,handled:!1,command:null}}}catch(i){let a=errorMeta(i);w.error("memory CLI command failed",{command:e,error:a});let n=t?.cwd??f().worktree;return m?emitJsonError(e??"__unknown__",a.message):console.error(`[memory] ${n} :: ${e} failed: ${a.message}`),{code:1,handled:true,command:e}}}function K(l){let t=l;return {packageName:"memory",rootDir:t.workspaceDir??"",configPath:t.configPath??"",configExists:typeof t.configExists=="boolean"?t.configExists:true,dbPath:t.dbPath??"",dbExists:typeof t.dbExists=="boolean"?t.dbExists:true,dbSize:typeof t.dbSize=="number"?t.dbSize:void 0,indexState:t.indexState,schemaVersion:typeof t.schemaVersion=="number"?t.schemaVersion:void 0,extractionVersion:typeof t.extractionVersion=="number"?t.extractionVersion:void 0,lastSyncAt:t.lastSyncAt,vectorEnabled:typeof t.vectorEnabled=="boolean"?t.vectorEnabled:void 0,embeddingDims:typeof t.embeddingDims=="number"?t.embeddingDims:void 0,llm:t.llm??{initialized:false,capabilities:{}},backend:t.backend,healthy:typeof t.healthy=="boolean"?t.healthy:true,recommendation:t.recommendation,dbStats:(()=>{let e=t.dbStats;if(e&&typeof e=="object"&&Object.keys(e).length>0)return {...e};let s=t.integrityStats;if(s&&typeof s=="object"&&Object.keys(s).length>0)return {...s}})(),extras:(()=>{let e={};if(typeof t.agentId=="string"&&(e.agent_id=t.agentId),typeof t.ftsAvailable=="boolean"&&(e.fts_available=t.ftsAvailable?"yes":"no"),t.factsByCategory&&typeof t.factsByCategory=="object"){let s=t.factsByCategory;for(let[u,c]of Object.entries(s))typeof c=="number"&&c>0&&(e[`facts/${u}`]=c);}if(t.meta&&typeof t.meta=="object")for(let[s,u]of Object.entries(t.meta))e[`meta/${s}`]=u===void 0?"\u2205":u;return Object.keys(e).length>0?e:void 0})()}}function R(l){let t=l,e=Array.isArray(t.checks)?t.checks:[],s=t.integrityStats,u=t.backendAvailable,c=s?{...s}:void 0;return {packageName:"memory",healthy:typeof t.healthy=="boolean"?t.healthy:false,durationMs:typeof t.durationMs=="number"?t.durationMs:0,checks:e.map(m=>({code:typeof m.code=="string"?m.code:"",severity:m.severity??"info",name:typeof m.name=="string"?m.name:"",message:typeof m.message=="string"?m.message:"",durationMs:typeof m.durationMs=="number"?m.durationMs:void 0,details:m.details})),dbStats:c,backendAvailable:u}}export{v as a,j as b,C as c,U as d,R as e};
@@ -0,0 +1 @@
1
+ export{a as COMMANDS_HELP,d as handleMemoryCli,e as mapMemoryDoctor,b as renderBanner,c as renderHelp}from'./chunk-NBPDJQIR.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkBHGAFQCX_cjs=require('./chunk-BHGAFQCX.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');Object.defineProperty(exports,"COMMANDS_HELP",{enumerable:true,get:function(){return chunkBHGAFQCX_cjs.a}});Object.defineProperty(exports,"handleMemoryCli",{enumerable:true,get:function(){return chunkBHGAFQCX_cjs.d}});Object.defineProperty(exports,"mapMemoryDoctor",{enumerable:true,get:function(){return chunkBHGAFQCX_cjs.e}});Object.defineProperty(exports,"renderBanner",{enumerable:true,get:function(){return chunkBHGAFQCX_cjs.b}});Object.defineProperty(exports,"renderHelp",{enumerable:true,get:function(){return chunkBHGAFQCX_cjs.c}});
@@ -1,2 +1,2 @@
1
- import {b as b$1,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function h(o){let t=o.agentId?.trim();if(!t)throw new NameErrors.MissingFieldError({field:"agentId",message:"consolidate: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let n=await d.getRootDir();return z("consolidate",{windowDays:o.windowDays??30,dryRun:false},B(t,n))}function b(o){let t=o;return [b$1("consolidate",{},"Consolidation complete ({{totalFacts}} total / deduped {{dedupedCount}} / archived {{archivedCount}}):"),c("consolidate",{totalFacts:String(t.totalFacts),dedupedCount:String(t.dedupedCount),archivedCount:String(t.archivedCount)}," - total: {{totalFacts}}, deduped: {{dedupedCount}}, archived: {{archivedCount}}"),` - skipped: ${t.skippedCount}, duration: ${t.durationMs}ms`].join(`
1
+ import {b as b$1,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function h(o){let t=o.agentId?.trim();if(!t)throw new NameErrors.MissingFieldError({field:"agentId",message:"consolidate: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let n=await d.getRootDir();return z("consolidate",{windowDays:o.windowDays??30,dryRun:false},B(t,n))}function b(o){let t=o;return [b$1("consolidate",{},"Consolidation complete ({{totalFacts}} total / deduped {{dedupedCount}} / archived {{archivedCount}}):"),c("consolidate",{totalFacts:String(t.totalFacts),dedupedCount:String(t.dedupedCount),archivedCount:String(t.archivedCount)}," - total: {{totalFacts}}, deduped: {{dedupedCount}}, archived: {{archivedCount}}"),` - skipped: ${t.skippedCount}, duration: ${t.durationMs}ms`].join(`
2
2
  `)}function y(o){let t={};for(let n=0;n<o.length;n++){let e=o[n];if(e===void 0)continue;let u=o[n+1];e==="--agent"?n++:e==="--window-days"?(t.windowDays=Number(u),n++):e==="--json"?t.json=true:(e==="--help"||e==="-h")&&(t.help=true);}return t}export{b as formatConsolidateText,y as parseConsolidateOptions,h as runConsolidate};
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function g(o){let t=o.agentId?.trim();if(!t)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"consolidate: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let n=await chunkNHRRIJFK_cjs.d.getRootDir();return chunkQAEIHJOF_cjs.z("consolidate",{windowDays:o.windowDays??30,dryRun:false},chunkQAEIHJOF_cjs.B(t,n))}function h(o){let t=o;return [chunk4GSXSIV5_cjs.b("consolidate",{},"Consolidation complete ({{totalFacts}} total / deduped {{dedupedCount}} / archived {{archivedCount}}):"),chunk4GSXSIV5_cjs.c("consolidate",{totalFacts:String(t.totalFacts),dedupedCount:String(t.dedupedCount),archivedCount:String(t.archivedCount)}," - total: {{totalFacts}}, deduped: {{dedupedCount}}, archived: {{archivedCount}}"),` - skipped: ${t.skippedCount}, duration: ${t.durationMs}ms`].join(`
1
+ 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function g(o){let t=o.agentId?.trim();if(!t)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"consolidate: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let n=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("consolidate",{windowDays:o.windowDays??30,dryRun:false},chunk77ERAHDK_cjs.B(t,n))}function h(o){let t=o;return [chunk4GSXSIV5_cjs.b("consolidate",{},"Consolidation complete ({{totalFacts}} total / deduped {{dedupedCount}} / archived {{archivedCount}}):"),chunk4GSXSIV5_cjs.c("consolidate",{totalFacts:String(t.totalFacts),dedupedCount:String(t.dedupedCount),archivedCount:String(t.archivedCount)}," - total: {{totalFacts}}, deduped: {{dedupedCount}}, archived: {{archivedCount}}"),` - skipped: ${t.skippedCount}, duration: ${t.durationMs}ms`].join(`
2
2
  `)}function b(o){let t={};for(let n=0;n<o.length;n++){let e=o[n];if(e===void 0)continue;let u=o[n+1];e==="--agent"?n++:e==="--window-days"?(t.windowDays=Number(u),n++):e==="--json"?t.json=true:(e==="--help"||e==="-h")&&(t.help=true);}return t}exports.formatConsolidateText=h;exports.parseConsolidateOptions=b;exports.runConsolidate=g;
@@ -1 +1 @@
1
- import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';async function l(t){let o=t.agentId,r=await d.getRootDir();return z("doctor",{},B(o,r))}function g(t){return ""}function m(t){let o={};for(let r=0;r<t.length;r++){let n=t[r];n!==void 0&&(n==="--repair"?o.repair=true:n==="--json"?o.json=true:(n==="--help"||n==="-h")&&(o.help=true));}return o}export{g as formatDoctorText,m as parseDoctorOptions,l as runDoctor};
1
+ import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';async function l(t){let o=t.agentId,r=await d.getRootDir();return z("doctor",{},B(o,r))}function g(t){return ""}function m(t){let o={};for(let r=0;r<t.length;r++){let n=t[r];n!==void 0&&(n==="--repair"?o.repair=true:n==="--json"?o.json=true:(n==="--help"||n==="-h")&&(o.help=true));}return o}export{g as formatDoctorText,m as parseDoctorOptions,l as runDoctor};
@@ -1 +1 @@
1
- 'use strict';var chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');async function f(t){let o=t.agentId,r=await chunkNHRRIJFK_cjs.d.getRootDir();return chunkQAEIHJOF_cjs.z("doctor",{},chunkQAEIHJOF_cjs.B(o,r))}function l(t){return ""}function g(t){let o={};for(let r=0;r<t.length;r++){let n=t[r];n!==void 0&&(n==="--repair"?o.repair=true:n==="--json"?o.json=true:(n==="--help"||n==="-h")&&(o.help=true));}return o}exports.formatDoctorText=l;exports.parseDoctorOptions=g;exports.runDoctor=f;
1
+ 'use strict';var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');async function f(t){let o=t.agentId,r=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("doctor",{},chunk77ERAHDK_cjs.B(o,r))}function l(t){return ""}function g(t){let o={};for(let r=0;r<t.length;r++){let n=t[r];n!==void 0&&(n==="--repair"?o.repair=true:n==="--json"?o.json=true:(n==="--help"||n==="-h")&&(o.help=true));}return o}exports.formatDoctorText=l;exports.parseDoctorOptions=g;exports.runDoctor=f;
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function I(r){if(!r.sessionId?.trim())throw new utils.NameErrors.MissingFieldError({field:"sessionId",message:"extract: --session is required"});let e=r.agentId?.trim();if(!e)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"extract: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await chunkNHRRIJFK_cjs.d.getRootDir();return chunkQAEIHJOF_cjs.z("extract",{sessionId:r.sessionId,lastN:r.lastN??10,fromMessageId:r.fromMessageId},chunkQAEIHJOF_cjs.B(e,t))}function h(r){let e=r,t=[chunk4GSXSIV5_cjs.b("extract",{extractedCount:e.extractedCount},"Extracted {{extractedCount}} fact(s) from {{fromMessageId}}..{{toMessageId}}")];for(let s of e.factIds)t.push(chunk4GSXSIV5_cjs.c("extract",{id:s}," - {{id}}"));if(e.entities&&e.entities.length>0){t.push(""),t.push("entities:");for(let s of e.entities)t.push(` - ${s.name} (${s.type})`);}if(e.relations&&e.relations.length>0){t.push(""),t.push("relations:");for(let s of e.relations)t.push(` - ${s.source} --${s.relation}--> ${s.target}`);}return t.join(`
1
+ 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function I(r){if(!r.sessionId?.trim())throw new utils.NameErrors.MissingFieldError({field:"sessionId",message:"extract: --session is required"});let e=r.agentId?.trim();if(!e)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"extract: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("extract",{sessionId:r.sessionId,lastN:r.lastN??10,fromMessageId:r.fromMessageId},chunk77ERAHDK_cjs.B(e,t))}function h(r){let e=r,t=[chunk4GSXSIV5_cjs.b("extract",{extractedCount:e.extractedCount},"Extracted {{extractedCount}} fact(s) from {{fromMessageId}}..{{toMessageId}}")];for(let s of e.factIds)t.push(chunk4GSXSIV5_cjs.c("extract",{id:s}," - {{id}}"));if(e.entities&&e.entities.length>0){t.push(""),t.push("entities:");for(let s of e.entities)t.push(` - ${s.name} (${s.type})`);}if(e.relations&&e.relations.length>0){t.push(""),t.push("relations:");for(let s of e.relations)t.push(` - ${s.source} --${s.relation}--> ${s.target}`);}return t.join(`
2
2
  `)}function E(r){let e={};for(let t=0;t<r.length;t++){let s=r[t];if(s===void 0)continue;let n=r[t+1];s==="--agent"?t++:s==="--session"?(e.sessionId=n,t++):s==="--last-n"?(e.lastN=Number(n),t++):s==="--from-msg"?(e.fromMessageId=n,t++):s==="--json"?e.json=true:(s==="--help"||s==="-h")&&(e.help=true);}return e}exports.formatExtractText=h;exports.parseExtractOptions=E;exports.runExtract=I;
@@ -1,2 +1,2 @@
1
- import {b,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function h(r){if(!r.sessionId?.trim())throw new NameErrors.MissingFieldError({field:"sessionId",message:"extract: --session is required"});let e=r.agentId?.trim();if(!e)throw new NameErrors.MissingFieldError({field:"agentId",message:"extract: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await d.getRootDir();return z("extract",{sessionId:r.sessionId,lastN:r.lastN??10,fromMessageId:r.fromMessageId},B(e,t))}function E(r){let e=r,t=[b("extract",{extractedCount:e.extractedCount},"Extracted {{extractedCount}} fact(s) from {{fromMessageId}}..{{toMessageId}}")];for(let s of e.factIds)t.push(c("extract",{id:s}," - {{id}}"));if(e.entities&&e.entities.length>0){t.push(""),t.push("entities:");for(let s of e.entities)t.push(` - ${s.name} (${s.type})`);}if(e.relations&&e.relations.length>0){t.push(""),t.push("relations:");for(let s of e.relations)t.push(` - ${s.source} --${s.relation}--> ${s.target}`);}return t.join(`
1
+ import {b,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function h(r){if(!r.sessionId?.trim())throw new NameErrors.MissingFieldError({field:"sessionId",message:"extract: --session is required"});let e=r.agentId?.trim();if(!e)throw new NameErrors.MissingFieldError({field:"agentId",message:"extract: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await d.getRootDir();return z("extract",{sessionId:r.sessionId,lastN:r.lastN??10,fromMessageId:r.fromMessageId},B(e,t))}function E(r){let e=r,t=[b("extract",{extractedCount:e.extractedCount},"Extracted {{extractedCount}} fact(s) from {{fromMessageId}}..{{toMessageId}}")];for(let s of e.factIds)t.push(c("extract",{id:s}," - {{id}}"));if(e.entities&&e.entities.length>0){t.push(""),t.push("entities:");for(let s of e.entities)t.push(` - ${s.name} (${s.type})`);}if(e.relations&&e.relations.length>0){t.push(""),t.push("relations:");for(let s of e.relations)t.push(` - ${s.source} --${s.relation}--> ${s.target}`);}return t.join(`
2
2
  `)}function M(r){let e={};for(let t=0;t<r.length;t++){let s=r[t];if(s===void 0)continue;let n=r[t+1];s==="--agent"?t++:s==="--session"?(e.sessionId=n,t++):s==="--last-n"?(e.lastN=Number(n),t++):s==="--from-msg"?(e.fromMessageId=n,t++):s==="--json"?e.json=true:(s==="--help"||s==="-h")&&(e.help=true);}return e}export{E as formatExtractText,M as parseExtractOptions,h as runExtract};
@@ -1,3 +1,3 @@
1
- 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function x(r){let e=r.agentId?.trim();if(!e)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"forget: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await chunkNHRRIJFK_cjs.d.getRootDir();return chunkQAEIHJOF_cjs.z("forget",{factId:r.factId,category:r.category,fromTime:r.fromTime,toTime:r.toTime,maxDelete:r.maxDelete??1e3,dryRun:r.dryRun??false},chunkQAEIHJOF_cjs.B(e,t))}function C(r){let e=r,t=[];if(e.deletedCount===0&&e.deletedIds.length===0)return t.push(chunk4GSXSIV5_cjs.a("forget","(no records to delete)")),t.join(`
1
+ 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function x(r){let e=r.agentId?.trim();if(!e)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"forget: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("forget",{factId:r.factId,category:r.category,fromTime:r.fromTime,toTime:r.toTime,maxDelete:r.maxDelete??1e3,dryRun:r.dryRun??false},chunk77ERAHDK_cjs.B(e,t))}function C(r){let e=r,t=[];if(e.deletedCount===0&&e.deletedIds.length===0)return t.push(chunk4GSXSIV5_cjs.a("forget","(no records to delete)")),t.join(`
2
2
  `);t.push(chunk4GSXSIV5_cjs.b("forget",{deletedCount:e.deletedCount,dryRun:String(e.dryRun)},e.dryRun?"[DRY RUN] Would delete {{deletedCount}}":"Deleted {{deletedCount}}")),e.truncatedCount>0&&t.push(`(truncated: ${e.truncatedCount} more)`);for(let n of e.deletedIds)t.push(chunk4GSXSIV5_cjs.c("forget",{id:n}," - {{id}}"));return t.join(`
3
3
  `)}function h(r){let e={};for(let t=0;t<r.length;t++){let n=r[t];if(n===void 0)continue;let o=r[t+1];n==="--agent"?t++:n==="--fact-id"?(e.factId=o,t++):n==="--category"?(e.category=o,t++):n==="--from"?(e.fromTime=o,t++):n==="--to"?(e.toTime=o,t++):n==="--max-delete"?(e.maxDelete=Number(o),t++):n==="--dry-run"?e.dryRun=true:n==="--json"?e.json=true:(n==="--help"||n==="-h")&&(e.help=true);}return e}exports.formatForgetText=C;exports.parseForgetOptions=h;exports.runForget=x;
@@ -1,3 +1,3 @@
1
- import {a,b,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function C(r){let e=r.agentId?.trim();if(!e)throw new NameErrors.MissingFieldError({field:"agentId",message:"forget: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await d.getRootDir();return z("forget",{factId:r.factId,category:r.category,fromTime:r.fromTime,toTime:r.toTime,maxDelete:r.maxDelete??1e3,dryRun:r.dryRun??false},B(e,t))}function h(r){let e=r,t=[];if(e.deletedCount===0&&e.deletedIds.length===0)return t.push(a("forget","(no records to delete)")),t.join(`
1
+ import {a,b,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function C(r){let e=r.agentId?.trim();if(!e)throw new NameErrors.MissingFieldError({field:"agentId",message:"forget: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await d.getRootDir();return z("forget",{factId:r.factId,category:r.category,fromTime:r.fromTime,toTime:r.toTime,maxDelete:r.maxDelete??1e3,dryRun:r.dryRun??false},B(e,t))}function h(r){let e=r,t=[];if(e.deletedCount===0&&e.deletedIds.length===0)return t.push(a("forget","(no records to delete)")),t.join(`
2
2
  `);t.push(b("forget",{deletedCount:e.deletedCount,dryRun:String(e.dryRun)},e.dryRun?"[DRY RUN] Would delete {{deletedCount}}":"Deleted {{deletedCount}}")),e.truncatedCount>0&&t.push(`(truncated: ${e.truncatedCount} more)`);for(let n of e.deletedIds)t.push(c("forget",{id:n}," - {{id}}"));return t.join(`
3
3
  `)}function R(r){let e={};for(let t=0;t<r.length;t++){let n=r[t];if(n===void 0)continue;let o=r[t+1];n==="--agent"?t++:n==="--fact-id"?(e.factId=o,t++):n==="--category"?(e.category=o,t++):n==="--from"?(e.fromTime=o,t++):n==="--to"?(e.toTime=o,t++):n==="--max-delete"?(e.maxDelete=Number(o),t++):n==="--dry-run"?e.dryRun=true:n==="--json"?e.json=true:(n==="--help"||n==="-h")&&(e.help=true);}return e}export{h as formatForgetText,R as parseForgetOptions,C as runForget};
@@ -1,3 +1,3 @@
1
- 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function b(o){let r=o.agentId?.trim();if(!r)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"graph_query: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let n=await chunkNHRRIJFK_cjs.d.getRootDir();return chunkQAEIHJOF_cjs.z("graph_query",{...o.query?{query:o.query}:{},...o.nodeId?{nodeId:o.nodeId}:{},...o.maxDepth!==void 0?{maxDepth:o.maxDepth}:{},...o.maxNodes?{maxNodes:o.maxNodes}:{},...o.maxEdgesPerNode!==void 0?{maxEdgesPerNode:o.maxEdgesPerNode}:{}},chunkQAEIHJOF_cjs.B(r,n))}function y(o){let r=o,n=[chunk4GSXSIV5_cjs.b("graph",{totalNodes:r.totalNodes??r.nodes.length},"KG query (scope={{scope}}, {{totalNodes}} node(s)):")];if(r.nodes.length===0)return n.push(chunk4GSXSIV5_cjs.a("graph","(no nodes matched)")),n.join(`
1
+ 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function b(o){let r=o.agentId?.trim();if(!r)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"graph_query: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let n=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("graph_query",{...o.query?{query:o.query}:{},...o.nodeId?{nodeId:o.nodeId}:{},...o.maxDepth!==void 0?{maxDepth:o.maxDepth}:{},...o.maxNodes?{maxNodes:o.maxNodes}:{},...o.maxEdgesPerNode!==void 0?{maxEdgesPerNode:o.maxEdgesPerNode}:{}},chunk77ERAHDK_cjs.B(r,n))}function y(o){let r=o,n=[chunk4GSXSIV5_cjs.b("graph",{totalNodes:r.totalNodes??r.nodes.length},"KG query (scope={{scope}}, {{totalNodes}} node(s)):")];if(r.nodes.length===0)return n.push(chunk4GSXSIV5_cjs.a("graph","(no nodes matched)")),n.join(`
2
2
  `);n.push(`nodes (${r.nodes.length}):`);for(let e of r.nodes){e.ownerAgentId?` [owner=${e.ownerAgentId}]`:" [shared]";n.push(chunk4GSXSIV5_cjs.c("graph",{id:String(e.id),name:e.name,type:e.type}," - #{{id}} {{name}} ({{type}})"));}n.push(`edges (${r.edges.length}):`);for(let e of r.edges)n.push(` - #${e.id} ${e.source} --${e.relation}--> ${e.target}`);return n.join(`
3
3
  `)}function I(o){let r={};for(let n=0;n<o.length;n++){let e=o[n];if(e===void 0)continue;let s=o[n+1];if(e==="--agent")n++;else if(e==="--query")r.query=s,n++;else if(e==="--node-id")r.nodeId=Number(s),n++;else if(e==="--max-depth"||e==="--depth"){let t=Number(s);Number.isFinite(t)&&t>=1&&t<=5&&(r.maxDepth=Math.floor(t)),n++;}else if(e==="--max-nodes")r.maxNodes=Number(s),n++;else if(e==="--max-edges-per-node"){let t=Number(s);Number.isFinite(t)&&t>=1&&t<=100&&(r.maxEdgesPerNode=Math.floor(t)),n++;}else e==="--json"?r.json=true:(e==="--help"||e==="-h")&&(r.help=true);}return r}exports.formatGraphText=y;exports.parseGraphOptions=I;exports.runGraph=b;
@@ -1,3 +1,3 @@
1
- import {b,a,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function y(o){let r=o.agentId?.trim();if(!r)throw new NameErrors.MissingFieldError({field:"agentId",message:"graph_query: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let n=await d.getRootDir();return z("graph_query",{...o.query?{query:o.query}:{},...o.nodeId?{nodeId:o.nodeId}:{},...o.maxDepth!==void 0?{maxDepth:o.maxDepth}:{},...o.maxNodes?{maxNodes:o.maxNodes}:{},...o.maxEdgesPerNode!==void 0?{maxEdgesPerNode:o.maxEdgesPerNode}:{}},B(r,n))}function I(o){let r=o,n=[b("graph",{totalNodes:r.totalNodes??r.nodes.length},"KG query (scope={{scope}}, {{totalNodes}} node(s)):")];if(r.nodes.length===0)return n.push(a("graph","(no nodes matched)")),n.join(`
1
+ import {b,a,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function y(o){let r=o.agentId?.trim();if(!r)throw new NameErrors.MissingFieldError({field:"agentId",message:"graph_query: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let n=await d.getRootDir();return z("graph_query",{...o.query?{query:o.query}:{},...o.nodeId?{nodeId:o.nodeId}:{},...o.maxDepth!==void 0?{maxDepth:o.maxDepth}:{},...o.maxNodes?{maxNodes:o.maxNodes}:{},...o.maxEdgesPerNode!==void 0?{maxEdgesPerNode:o.maxEdgesPerNode}:{}},B(r,n))}function I(o){let r=o,n=[b("graph",{totalNodes:r.totalNodes??r.nodes.length},"KG query (scope={{scope}}, {{totalNodes}} node(s)):")];if(r.nodes.length===0)return n.push(a("graph","(no nodes matched)")),n.join(`
2
2
  `);n.push(`nodes (${r.nodes.length}):`);for(let e of r.nodes){e.ownerAgentId?` [owner=${e.ownerAgentId}]`:" [shared]";n.push(c("graph",{id:String(e.id),name:e.name,type:e.type}," - #{{id}} {{name}} ({{type}})"));}n.push(`edges (${r.edges.length}):`);for(let e of r.edges)n.push(` - #${e.id} ${e.source} --${e.relation}--> ${e.target}`);return n.join(`
3
3
  `)}function w(o){let r={};for(let n=0;n<o.length;n++){let e=o[n];if(e===void 0)continue;let s=o[n+1];if(e==="--agent")n++;else if(e==="--query")r.query=s,n++;else if(e==="--node-id")r.nodeId=Number(s),n++;else if(e==="--max-depth"||e==="--depth"){let t=Number(s);Number.isFinite(t)&&t>=1&&t<=5&&(r.maxDepth=Math.floor(t)),n++;}else if(e==="--max-nodes")r.maxNodes=Number(s),n++;else if(e==="--max-edges-per-node"){let t=Number(s);Number.isFinite(t)&&t>=1&&t<=100&&(r.maxEdgesPerNode=Math.floor(t)),n++;}else e==="--json"?r.json=true:(e==="--help"||e==="-h")&&(r.help=true);}return r}export{I as formatGraphText,w as parseGraphOptions,y as runGraph};
@@ -1 +1 @@
1
- import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import {j}from'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';async function g(o){let t=await d.getRootDir(),e=o.agentId?.trim()??"";return z("init",{workspaceDir:t,dbPath:j(t),force:o.force??false},B(e,t))}function I(o){let t={};for(let e=0;e<o.length;e++){let n=o[e];n!==void 0&&(n==="--agent"?e++:n==="--force"?t.force=true:n==="--json"?t.json=true:(n==="--help"||n==="-h")&&(t.help=true));}return t}export{I as parseInitOptions,g as runInit};
1
+ import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import {j}from'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';async function g(o){let t=await d.getRootDir(),e=o.agentId?.trim()??"";return z("init",{workspaceDir:t,dbPath:j(t),force:o.force??false},B(e,t))}function I(o){let t={};for(let e=0;e<o.length;e++){let n=o[e];n!==void 0&&(n==="--agent"?e++:n==="--force"?t.force=true:n==="--json"?t.json=true:(n==="--help"||n==="-h")&&(t.help=true));}return t}export{I as parseInitOptions,g as runInit};
@@ -1 +1 @@
1
- 'use strict';var chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs'),chunkGCVKM3RJ_cjs=require('./chunk-GCVKM3RJ.cjs');require('./chunk-R32346OA.cjs');async function m(o){let t=await chunkNHRRIJFK_cjs.d.getRootDir(),e=o.agentId?.trim()??"";return chunkQAEIHJOF_cjs.z("init",{workspaceDir:t,dbPath:chunkGCVKM3RJ_cjs.j(t),force:o.force??false},chunkQAEIHJOF_cjs.B(e,t))}function g(o){let t={};for(let e=0;e<o.length;e++){let n=o[e];n!==void 0&&(n==="--agent"?e++:n==="--force"?t.force=true:n==="--json"?t.json=true:(n==="--help"||n==="-h")&&(t.help=true));}return t}exports.parseInitOptions=g;exports.runInit=m;
1
+ 'use strict';var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs'),chunkGCVKM3RJ_cjs=require('./chunk-GCVKM3RJ.cjs');require('./chunk-R32346OA.cjs');async function m(o){let t=await chunkNHRRIJFK_cjs.d.getRootDir(),e=o.agentId?.trim()??"";return chunk77ERAHDK_cjs.z("init",{workspaceDir:t,dbPath:chunkGCVKM3RJ_cjs.j(t),force:o.force??false},chunk77ERAHDK_cjs.B(e,t))}function g(o){let t={};for(let e=0;e<o.length;e++){let n=o[e];n!==void 0&&(n==="--agent"?e++:n==="--force"?t.force=true:n==="--json"?t.json=true:(n==="--help"||n==="-h")&&(t.help=true));}return t}exports.parseInitOptions=g;exports.runInit=m;
@@ -1 +1 @@
1
- 'use strict';require('./chunk-URADAZYW.cjs');var chunkIP7VEKQY_cjs=require('./chunk-IP7VEKQY.cjs');require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs'),chunkGCVKM3RJ_cjs=require('./chunk-GCVKM3RJ.cjs'),chunkR32346OA_cjs=require('./chunk-R32346OA.cjs'),path=require('path'),fs=require('fs'),url=require('url'),mcp=require('@easbot/mcp'),utils=require('@easbot/utils');function A(i){let t={};for(let o=0;o<i.length;o++){let e=i[o];e!==void 0&&(e==="--help"||e==="-h"?t.help=true:e==="--json"&&(t.json=true));}return t}async function E(i){let t=await chunkNHRRIJFK_cjs.d.getRootDir(),o=chunkGCVKM3RJ_cjs.j(t),e="0.0.0";try{let r=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));for(let n=0;n<8;n++){try{let a=JSON.parse(fs.readFileSync(path.join(r,"package.json"),"utf-8"));if(a?.name==="@easbot/memory"&&typeof a.version=="string"){e=a.version;break}}catch{}let s=path.dirname(r);if(s===r||s==="."||n===7)break;r=s;}}catch{}let u={id:"easbot-memory-mcp",name:"EASBot Memory MCP",version:e,transportType:mcp.ServerTransportType.STDIO};await utils.Filesystem.mkdir(path.dirname(o));let c=new chunkIP7VEKQY_cjs.e(o);await c.initialize(),c.close();let{MemoryStdioServer:d}=await import('./stdio-server-W52CMVJO.cjs'),g=process.env.EASBOT_AGENT_ID?.trim()||"default",M=await d.start(u,{agentId:g,dbPath:o,workspaceDir:t,isRemote:false});return {rootDir:t,tools:M.tools}}exports.parseMcpOptions=A;exports.runMcp=E;
1
+ 'use strict';require('./chunk-URADAZYW.cjs');var chunkIP7VEKQY_cjs=require('./chunk-IP7VEKQY.cjs');require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs'),chunkGCVKM3RJ_cjs=require('./chunk-GCVKM3RJ.cjs'),chunkR32346OA_cjs=require('./chunk-R32346OA.cjs'),path=require('path'),fs=require('fs'),url=require('url'),mcp=require('@easbot/mcp'),utils=require('@easbot/utils');function A(i){let t={};for(let o=0;o<i.length;o++){let e=i[o];e!==void 0&&(e==="--help"||e==="-h"?t.help=true:e==="--json"&&(t.json=true));}return t}async function E(i){let t=await chunkNHRRIJFK_cjs.d.getRootDir(),o=chunkGCVKM3RJ_cjs.j(t),e="0.0.0";try{let r=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));for(let n=0;n<8;n++){try{let a=JSON.parse(fs.readFileSync(path.join(r,"package.json"),"utf-8"));if(a?.name==="@easbot/memory"&&typeof a.version=="string"){e=a.version;break}}catch{}let s=path.dirname(r);if(s===r||s==="."||n===7)break;r=s;}}catch{}let u={id:"easbot-memory-mcp",name:"EASBot Memory MCP",version:e,transportType:mcp.ServerTransportType.STDIO};await utils.Filesystem.mkdir(path.dirname(o));let c=new chunkIP7VEKQY_cjs.e(o);await c.initialize(),c.close();let{MemoryStdioServer:d}=await import('./stdio-server-AHIGDFUH.cjs'),g=process.env.EASBOT_AGENT_ID?.trim()||"default",M=await d.start(u,{agentId:g,dbPath:o,workspaceDir:t,isRemote:false});return {rootDir:t,tools:M.tools}}exports.parseMcpOptions=A;exports.runMcp=E;
@@ -1 +1 @@
1
- import'./chunk-QF5S5MG7.mjs';import {e}from'./chunk-YJLHS7JB.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import {j}from'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {dirname,join}from'path';import {readFileSync}from'fs';import {fileURLToPath}from'url';import {ServerTransportType}from'@easbot/mcp';import {Filesystem}from'@easbot/utils';function E(i){let t={};for(let o=0;o<i.length;o++){let e=i[o];e!==void 0&&(e==="--help"||e==="-h"?t.help=true:e==="--json"&&(t.json=true));}return t}async function I(i){let t=await d.getRootDir(),o=j(t),e$1="0.0.0";try{let r=dirname(fileURLToPath(import.meta.url));for(let n=0;n<8;n++){try{let a=JSON.parse(readFileSync(join(r,"package.json"),"utf-8"));if(a?.name==="@easbot/memory"&&typeof a.version=="string"){e$1=a.version;break}}catch{}let s=dirname(r);if(s===r||s==="."||n===7)break;r=s;}}catch{}let y={id:"easbot-memory-mcp",name:"EASBot Memory MCP",version:e$1,transportType:ServerTransportType.STDIO};await Filesystem.mkdir(dirname(o));let c=new e(o);await c.initialize(),c.close();let{MemoryStdioServer:u}=await import('./stdio-server-3A3H4YJ7.mjs'),M=process.env.EASBOT_AGENT_ID?.trim()||"default",d$1=await u.start(y,{agentId:M,dbPath:o,workspaceDir:t,isRemote:false});return {rootDir:t,tools:d$1.tools}}export{E as parseMcpOptions,I as runMcp};
1
+ import'./chunk-QF5S5MG7.mjs';import {e}from'./chunk-YJLHS7JB.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import {j}from'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {dirname,join}from'path';import {readFileSync}from'fs';import {fileURLToPath}from'url';import {ServerTransportType}from'@easbot/mcp';import {Filesystem}from'@easbot/utils';function E(i){let t={};for(let o=0;o<i.length;o++){let e=i[o];e!==void 0&&(e==="--help"||e==="-h"?t.help=true:e==="--json"&&(t.json=true));}return t}async function I(i){let t=await d.getRootDir(),o=j(t),e$1="0.0.0";try{let r=dirname(fileURLToPath(import.meta.url));for(let n=0;n<8;n++){try{let a=JSON.parse(readFileSync(join(r,"package.json"),"utf-8"));if(a?.name==="@easbot/memory"&&typeof a.version=="string"){e$1=a.version;break}}catch{}let s=dirname(r);if(s===r||s==="."||n===7)break;r=s;}}catch{}let y={id:"easbot-memory-mcp",name:"EASBot Memory MCP",version:e$1,transportType:ServerTransportType.STDIO};await Filesystem.mkdir(dirname(o));let c=new e(o);await c.initialize(),c.close();let{MemoryStdioServer:u}=await import('./stdio-server-5HTVIDF7.mjs'),M=process.env.EASBOT_AGENT_ID?.trim()||"default",d$1=await u.start(y,{agentId:M,dbPath:o,workspaceDir:t,isRemote:false});return {rootDir:t,tools:d$1.tools}}export{E as parseMcpOptions,I as runMcp};
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function b(e){if(!e.query?.trim())throw new NameErrors.MissingFieldError({field:"query",message:"recall: --query is required"});let n=e.agentId?.trim();if(!n)throw new NameErrors.MissingFieldError({field:"agentId",message:"recall: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let i=await d.getRootDir();return z("recall",{query:e.query,maxResults:e.limit??10,category:e.category,minImportance:e.minImportance,...e.minScore!==void 0?{minScore:e.minScore}:{},...e.includeGraph!==void 0?{includeGraph:e.includeGraph}:{},...e.maxDepth!==void 0?{maxDepth:e.maxDepth}:{},...e.maxEdgesPerNode!==void 0?{maxEdgesPerNode:e.maxEdgesPerNode}:{},...e.includeShared!==void 0?{includeShared:e.includeShared}:{}},B(n,i))}function x(e){let n=e;if(n.total===0)return a("memory.recall.empty",{fallback:"(no facts)"});let i=[a("memory.recall.summary",{vars:{total:n.total},fallback:`Found ${n.total} fact(s):`})];for(let r of n.hits)i.push(a("memory.recall.item",{vars:{id:r.memoryId,category:r.category,importance:String(r.importance),score:r.score.toFixed(3),content:r.snippet},fallback:" - {{id}} [{{category}}/imp={{importance}}/score={{score}}] {{content}}"}));return i.join(`
1
+ import {a}from'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function b(e){if(!e.query?.trim())throw new NameErrors.MissingFieldError({field:"query",message:"recall: --query is required"});let n=e.agentId?.trim();if(!n)throw new NameErrors.MissingFieldError({field:"agentId",message:"recall: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let i=await d.getRootDir();return z("recall",{query:e.query,maxResults:e.limit??10,category:e.category,minImportance:e.minImportance,...e.minScore!==void 0?{minScore:e.minScore}:{},...e.includeGraph!==void 0?{includeGraph:e.includeGraph}:{},...e.maxDepth!==void 0?{maxDepth:e.maxDepth}:{},...e.maxEdgesPerNode!==void 0?{maxEdgesPerNode:e.maxEdgesPerNode}:{},...e.includeShared!==void 0?{includeShared:e.includeShared}:{}},B(n,i))}function x(e){let n=e;if(n.total===0)return a("memory.recall.empty",{fallback:"(no facts)"});let i=[a("memory.recall.summary",{vars:{total:n.total},fallback:`Found ${n.total} fact(s):`})];for(let r of n.hits)i.push(a("memory.recall.item",{vars:{id:r.memoryId,category:r.category,importance:String(r.importance),score:r.score.toFixed(3),content:r.snippet},fallback:" - {{id}} [{{category}}/imp={{importance}}/score={{score}}] {{content}}"}));return i.join(`
2
2
  `)}function N(e){let n={};for(let i=0;i<e.length;i++){let r=e[i];if(r===void 0)continue;let o=e[i+1];if(r==="--agent")i++;else if(r==="--query")n.query=o,i++;else if(r==="--limit")n.limit=Number(o),i++;else if(r==="--category")n.category=o,i++;else if(r==="--min-importance")n.minImportance=Number(o),i++;else if(r==="--min-score"){let t=Number(o);Number.isFinite(t)&&t>=0&&t<=1&&(n.minScore=t),i++;}else if(r==="--include-graph")n.includeGraph=true;else if(r==="--depth"||r==="--max-depth"){let t=Number(o);Number.isFinite(t)&&t>=1&&t<=5&&(n.maxDepth=Math.floor(t)),i++;}else if(r==="--max-edges-per-node"){let t=Number(o);Number.isFinite(t)&&t>=1&&t<=100&&(n.maxEdgesPerNode=Math.floor(t)),i++;}else r==="--include-shared"?n.includeShared=true:r==="--json"?n.json=true:(r==="--help"||r==="-h")&&(n.help=true);}return n}export{x as formatRecallText,N as parseRecallOptions,b as runRecall};
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkWQB4D6DZ_cjs=require('./chunk-WQB4D6DZ.cjs'),chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function y(e){if(!e.query?.trim())throw new utils.NameErrors.MissingFieldError({field:"query",message:"recall: --query is required"});let n=e.agentId?.trim();if(!n)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"recall: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let i=await chunkNHRRIJFK_cjs.d.getRootDir();return chunkQAEIHJOF_cjs.z("recall",{query:e.query,maxResults:e.limit??10,category:e.category,minImportance:e.minImportance,...e.minScore!==void 0?{minScore:e.minScore}:{},...e.includeGraph!==void 0?{includeGraph:e.includeGraph}:{},...e.maxDepth!==void 0?{maxDepth:e.maxDepth}:{},...e.maxEdgesPerNode!==void 0?{maxEdgesPerNode:e.maxEdgesPerNode}:{},...e.includeShared!==void 0?{includeShared:e.includeShared}:{}},chunkQAEIHJOF_cjs.B(n,i))}function b(e){let n=e;if(n.total===0)return chunkWQB4D6DZ_cjs.a("memory.recall.empty",{fallback:"(no facts)"});let i=[chunkWQB4D6DZ_cjs.a("memory.recall.summary",{vars:{total:n.total},fallback:`Found ${n.total} fact(s):`})];for(let r of n.hits)i.push(chunkWQB4D6DZ_cjs.a("memory.recall.item",{vars:{id:r.memoryId,category:r.category,importance:String(r.importance),score:r.score.toFixed(3),content:r.snippet},fallback:" - {{id}} [{{category}}/imp={{importance}}/score={{score}}] {{content}}"}));return i.join(`
1
+ 'use strict';var chunkWQB4D6DZ_cjs=require('./chunk-WQB4D6DZ.cjs'),chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function y(e){if(!e.query?.trim())throw new utils.NameErrors.MissingFieldError({field:"query",message:"recall: --query is required"});let n=e.agentId?.trim();if(!n)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"recall: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let i=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("recall",{query:e.query,maxResults:e.limit??10,category:e.category,minImportance:e.minImportance,...e.minScore!==void 0?{minScore:e.minScore}:{},...e.includeGraph!==void 0?{includeGraph:e.includeGraph}:{},...e.maxDepth!==void 0?{maxDepth:e.maxDepth}:{},...e.maxEdgesPerNode!==void 0?{maxEdgesPerNode:e.maxEdgesPerNode}:{},...e.includeShared!==void 0?{includeShared:e.includeShared}:{}},chunk77ERAHDK_cjs.B(n,i))}function b(e){let n=e;if(n.total===0)return chunkWQB4D6DZ_cjs.a("memory.recall.empty",{fallback:"(no facts)"});let i=[chunkWQB4D6DZ_cjs.a("memory.recall.summary",{vars:{total:n.total},fallback:`Found ${n.total} fact(s):`})];for(let r of n.hits)i.push(chunkWQB4D6DZ_cjs.a("memory.recall.item",{vars:{id:r.memoryId,category:r.category,importance:String(r.importance),score:r.score.toFixed(3),content:r.snippet},fallback:" - {{id}} [{{category}}/imp={{importance}}/score={{score}}] {{content}}"}));return i.join(`
2
2
  `)}function x(e){let n={};for(let i=0;i<e.length;i++){let r=e[i];if(r===void 0)continue;let o=e[i+1];if(r==="--agent")i++;else if(r==="--query")n.query=o,i++;else if(r==="--limit")n.limit=Number(o),i++;else if(r==="--category")n.category=o,i++;else if(r==="--min-importance")n.minImportance=Number(o),i++;else if(r==="--min-score"){let t=Number(o);Number.isFinite(t)&&t>=0&&t<=1&&(n.minScore=t),i++;}else if(r==="--include-graph")n.includeGraph=true;else if(r==="--depth"||r==="--max-depth"){let t=Number(o);Number.isFinite(t)&&t>=1&&t<=5&&(n.maxDepth=Math.floor(t)),i++;}else if(r==="--max-edges-per-node"){let t=Number(o);Number.isFinite(t)&&t>=1&&t<=100&&(n.maxEdgesPerNode=Math.floor(t)),i++;}else r==="--include-shared"?n.includeShared=true:r==="--json"?n.json=true:(r==="--help"||r==="-h")&&(n.help=true);}return n}exports.formatRecallText=b;exports.parseRecallOptions=x;exports.runRecall=y;
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function y(r){if(!r.content?.trim())throw new utils.NameErrors.MissingFieldError({field:"content",message:"remember: --content is required"});if(!r.category?.trim())throw new utils.NameErrors.MissingFieldError({field:"category",message:"remember: --category is required"});if(r.importance===void 0)throw new utils.NameErrors.MissingFieldError({field:"importance",message:"remember: --importance is required (1-10)"});let e=r.agentId?.trim();if(!e)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"remember: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await chunkNHRRIJFK_cjs.d.getRootDir();return chunkQAEIHJOF_cjs.z("remember",{content:r.content,category:r.category,importance:r.importance,tags:r.tags,sessionId:r.sessionId},chunkQAEIHJOF_cjs.B(e,t))}function w(r){let e=r,t=[chunk4GSXSIV5_cjs.b("remember",{},"Memory persisted:"),chunk4GSXSIV5_cjs.c("remember",{id:e.fact.id,category:e.fact.category,importance:String(e.fact.importance??5)}," - id={{id}} category={{category}} importance={{importance}}"),` - createdAt: ${e.fact.createdAt}`];return e.deduplicated&&t.push(" - (deduplicated; no new fact inserted)"),t.join(`
1
+ 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function y(r){if(!r.content?.trim())throw new utils.NameErrors.MissingFieldError({field:"content",message:"remember: --content is required"});if(!r.category?.trim())throw new utils.NameErrors.MissingFieldError({field:"category",message:"remember: --category is required"});if(r.importance===void 0)throw new utils.NameErrors.MissingFieldError({field:"importance",message:"remember: --importance is required (1-10)"});let e=r.agentId?.trim();if(!e)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"remember: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("remember",{content:r.content,category:r.category,importance:r.importance,tags:r.tags,sessionId:r.sessionId},chunk77ERAHDK_cjs.B(e,t))}function w(r){let e=r,t=[chunk4GSXSIV5_cjs.b("remember",{},"Memory persisted:"),chunk4GSXSIV5_cjs.c("remember",{id:e.fact.id,category:e.fact.category,importance:String(e.fact.importance??5)}," - id={{id}} category={{category}} importance={{importance}}"),` - createdAt: ${e.fact.createdAt}`];return e.deduplicated&&t.push(" - (deduplicated; no new fact inserted)"),t.join(`
2
2
  `)}function h(r){let e={};for(let t=0;t<r.length;t++){let i=r[t];if(i===void 0)continue;let n=r[t+1];i==="--agent"&&n!==void 0?t++:i==="--content"&&n!==void 0?(e.content=n,t++):i==="--category"&&n!==void 0?(e.category=n,t++):i==="--importance"&&n!==void 0?(e.importance=Number(n),t++):i==="--tag"&&n!==void 0?(e.tags=[...e.tags??[],n],t++):i==="--session"&&n!==void 0?(e.sessionId=n,t++):i==="--json"?e.json=true:(i==="--help"||i==="-h")&&(e.help=true);}return e}exports.formatRememberText=w;exports.parseRememberOptions=h;exports.runRemember=y;
@@ -1,2 +1,2 @@
1
- import {b,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function w(r){if(!r.content?.trim())throw new NameErrors.MissingFieldError({field:"content",message:"remember: --content is required"});if(!r.category?.trim())throw new NameErrors.MissingFieldError({field:"category",message:"remember: --category is required"});if(r.importance===void 0)throw new NameErrors.MissingFieldError({field:"importance",message:"remember: --importance is required (1-10)"});let e=r.agentId?.trim();if(!e)throw new NameErrors.MissingFieldError({field:"agentId",message:"remember: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await d.getRootDir();return z("remember",{content:r.content,category:r.category,importance:r.importance,tags:r.tags,sessionId:r.sessionId},B(e,t))}function h(r){let e=r,t=[b("remember",{},"Memory persisted:"),c("remember",{id:e.fact.id,category:e.fact.category,importance:String(e.fact.importance??5)}," - id={{id}} category={{category}} importance={{importance}}"),` - createdAt: ${e.fact.createdAt}`];return e.deduplicated&&t.push(" - (deduplicated; no new fact inserted)"),t.join(`
1
+ import {b,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function w(r){if(!r.content?.trim())throw new NameErrors.MissingFieldError({field:"content",message:"remember: --content is required"});if(!r.category?.trim())throw new NameErrors.MissingFieldError({field:"category",message:"remember: --category is required"});if(r.importance===void 0)throw new NameErrors.MissingFieldError({field:"importance",message:"remember: --importance is required (1-10)"});let e=r.agentId?.trim();if(!e)throw new NameErrors.MissingFieldError({field:"agentId",message:"remember: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let t=await d.getRootDir();return z("remember",{content:r.content,category:r.category,importance:r.importance,tags:r.tags,sessionId:r.sessionId},B(e,t))}function h(r){let e=r,t=[b("remember",{},"Memory persisted:"),c("remember",{id:e.fact.id,category:e.fact.category,importance:String(e.fact.importance??5)}," - id={{id}} category={{category}} importance={{importance}}"),` - createdAt: ${e.fact.createdAt}`];return e.deduplicated&&t.push(" - (deduplicated; no new fact inserted)"),t.join(`
2
2
  `)}function I(r){let e={};for(let t=0;t<r.length;t++){let i=r[t];if(i===void 0)continue;let n=r[t+1];i==="--agent"&&n!==void 0?t++:i==="--content"&&n!==void 0?(e.content=n,t++):i==="--category"&&n!==void 0?(e.category=n,t++):i==="--importance"&&n!==void 0?(e.importance=Number(n),t++):i==="--tag"&&n!==void 0?(e.tags=[...e.tags??[],n],t++):i==="--session"&&n!==void 0?(e.sessionId=n,t++):i==="--json"?e.json=true:(i==="--help"||i==="-h")&&(e.help=true);}return e}export{h as formatRememberText,I as parseRememberOptions,w as runRemember};
@@ -1 +1 @@
1
- 'use strict';var chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');async function l(n){let e=await chunkNHRRIJFK_cjs.d.getRootDir(),t=n.agentId?.trim()??"default";return chunkQAEIHJOF_cjs.z("status",{},chunkQAEIHJOF_cjs.B(t,e))}function m(n){return ""}function g(n){let e={};for(let t=0;t<n.length;t++){let o=n[t];if(o===void 0)continue;n[t+1];o==="--agent"?t++:o==="--json"?e.json=true:(o==="--help"||o==="-h")&&(e.help=true);}return e}exports.formatStatusText=m;exports.parseStatusOptions=g;exports.runStatus=l;
1
+ 'use strict';var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');async function l(n){let e=await chunkNHRRIJFK_cjs.d.getRootDir(),t=n.agentId?.trim()??"default";return chunk77ERAHDK_cjs.z("status",{},chunk77ERAHDK_cjs.B(t,e))}function m(n){return ""}function g(n){let e={};for(let t=0;t<n.length;t++){let o=n[t];if(o===void 0)continue;n[t+1];o==="--agent"?t++:o==="--json"?e.json=true:(o==="--help"||o==="-h")&&(e.help=true);}return e}exports.formatStatusText=m;exports.parseStatusOptions=g;exports.runStatus=l;
@@ -1 +1 @@
1
- import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';async function m(n){let e=await d.getRootDir(),t=n.agentId?.trim()??"default";return z("status",{},B(t,e))}function g(n){return ""}function x(n){let e={};for(let t=0;t<n.length;t++){let o=n[t];if(o===void 0)continue;n[t+1];o==="--agent"?t++:o==="--json"?e.json=true:(o==="--help"||o==="-h")&&(e.help=true);}return e}export{g as formatStatusText,x as parseStatusOptions,m as runStatus};
1
+ import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';async function m(n){let e=await d.getRootDir(),t=n.agentId?.trim()??"default";return z("status",{},B(t,e))}function g(n){return ""}function x(n){let e={};for(let t=0;t<n.length;t++){let o=n[t];if(o===void 0)continue;n[t+1];o==="--agent"?t++:o==="--json"?e.json=true:(o==="--help"||o==="-h")&&(e.help=true);}return e}export{g as formatStatusText,x as parseStatusOptions,m as runStatus};
@@ -0,0 +1 @@
1
+ export{b as MemoryStdioServer}from'./chunk-LM6WT4CO.mjs';import'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';
@@ -1 +1 @@
1
- 'use strict';var chunkISYAE6B7_cjs=require('./chunk-ISYAE6B7.cjs');require('./chunk-QAEIHJOF.cjs'),require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs'),require('./chunk-NHRRIJFK.cjs'),require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');Object.defineProperty(exports,"MemoryStdioServer",{enumerable:true,get:function(){return chunkISYAE6B7_cjs.b}});
1
+ 'use strict';var chunk4CMSRWL3_cjs=require('./chunk-4CMSRWL3.cjs');require('./chunk-77ERAHDK.cjs'),require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs'),require('./chunk-NHRRIJFK.cjs'),require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');Object.defineProperty(exports,"MemoryStdioServer",{enumerable:true,get:function(){return chunk4CMSRWL3_cjs.b}});
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunkQAEIHJOF_cjs=require('./chunk-QAEIHJOF.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function h(e){let n=e.agentId?.trim();if(!n)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"sync: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let r=await chunkNHRRIJFK_cjs.d.getRootDir();return chunkQAEIHJOF_cjs.z("sync",{windowDays:e.windowDays,dryRun:e.dryRun??false},chunkQAEIHJOF_cjs.B(n,r))}function C(e){let n=e;return [chunk4GSXSIV5_cjs.b("sync",{windowDays:String(n.windowDays),dryRun:String(n.dryRun)},"sync complete (windowDays={{windowDays}}, dryRun={{dryRun}}):"),chunk4GSXSIV5_cjs.c("sync",{generatedCount:String(n.generatedCount),skippedCount:String(n.skippedCount),failedGenerateCount:String(n.failedGenerateCount),archivedCount:String(n.archivedCount),archiveThreshold:n.archiveThreshold}," - generated: {{generatedCount}}, skipped: {{skippedCount}}, failed: {{failedGenerateCount}}, archived: {{archivedCount}} (threshold: {{archiveThreshold}})"),` - duration: ${n.durationMs}ms`].join(`
1
+ 'use strict';var chunk4GSXSIV5_cjs=require('./chunk-4GSXSIV5.cjs');require('./chunk-WQB4D6DZ.cjs');var chunk77ERAHDK_cjs=require('./chunk-77ERAHDK.cjs');require('./chunk-IP7VEKQY.cjs'),require('./chunk-EKSLNNMF.cjs'),require('./chunk-AVECFV5K.cjs');var chunkNHRRIJFK_cjs=require('./chunk-NHRRIJFK.cjs');require('./chunk-GCVKM3RJ.cjs'),require('./chunk-R32346OA.cjs');var utils=require('@easbot/utils');async function h(e){let n=e.agentId?.trim();if(!n)throw new utils.NameErrors.MissingFieldError({field:"agentId",message:"sync: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let r=await chunkNHRRIJFK_cjs.d.getRootDir();return chunk77ERAHDK_cjs.z("sync",{windowDays:e.windowDays,dryRun:e.dryRun??false},chunk77ERAHDK_cjs.B(n,r))}function C(e){let n=e;return [chunk4GSXSIV5_cjs.b("sync",{windowDays:String(n.windowDays),dryRun:String(n.dryRun)},"sync complete (windowDays={{windowDays}}, dryRun={{dryRun}}):"),chunk4GSXSIV5_cjs.c("sync",{generatedCount:String(n.generatedCount),skippedCount:String(n.skippedCount),failedGenerateCount:String(n.failedGenerateCount),archivedCount:String(n.archivedCount),archiveThreshold:n.archiveThreshold}," - generated: {{generatedCount}}, skipped: {{skippedCount}}, failed: {{failedGenerateCount}}, archived: {{archivedCount}} (threshold: {{archiveThreshold}})"),` - duration: ${n.durationMs}ms`].join(`
2
2
  `)}function b(e){let n={};for(let r=0;r<e.length;r++){let t=e[r];if(t===void 0)continue;let i=e[r+1];if(t==="--agent")r++;else if(t==="--window-days"){let o=Number(i);if(Number.isNaN(o)||o<1||o>3650)throw new utils.NameErrors.InvalidArgumentError({param:"window-days",message:`--window-days must be an integer in [1, 3650], got: ${i??"(empty)"}`});n.windowDays=o,r++;}else t==="--dry-run"?n.dryRun=true:t==="--json"?n.json=true:(t==="--help"||t==="-h")&&(n.help=true);}return n}exports.formatSyncText=C;exports.parseSyncOptions=b;exports.runSync=h;
@@ -1,2 +1,2 @@
1
- import {b as b$1,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-AEAMQDNV.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function C(e){let n=e.agentId?.trim();if(!n)throw new NameErrors.MissingFieldError({field:"agentId",message:"sync: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let r=await d.getRootDir();return z("sync",{windowDays:e.windowDays,dryRun:e.dryRun??false},B(n,r))}function b(e){let n=e;return [b$1("sync",{windowDays:String(n.windowDays),dryRun:String(n.dryRun)},"sync complete (windowDays={{windowDays}}, dryRun={{dryRun}}):"),c("sync",{generatedCount:String(n.generatedCount),skippedCount:String(n.skippedCount),failedGenerateCount:String(n.failedGenerateCount),archivedCount:String(n.archivedCount),archiveThreshold:n.archiveThreshold}," - generated: {{generatedCount}}, skipped: {{skippedCount}}, failed: {{failedGenerateCount}}, archived: {{archivedCount}} (threshold: {{archiveThreshold}})"),` - duration: ${n.durationMs}ms`].join(`
1
+ import {b as b$1,c}from'./chunk-QYBWHFOX.mjs';import'./chunk-SWYQLQ7Z.mjs';import {z,B}from'./chunk-LQ4OZPZI.mjs';import'./chunk-YJLHS7JB.mjs';import'./chunk-HH7EA2UE.mjs';import'./chunk-AJDMZTCQ.mjs';import {d}from'./chunk-SE3F5YQE.mjs';import'./chunk-HX3TV7FD.mjs';import'./chunk-S4DPVKMV.mjs';import {NameErrors}from'@easbot/utils';async function C(e){let n=e.agentId?.trim();if(!n)throw new NameErrors.MissingFieldError({field:"agentId",message:"sync: agentId is required (ctx environment; agent CLI / standalone CLI must inject)"});let r=await d.getRootDir();return z("sync",{windowDays:e.windowDays,dryRun:e.dryRun??false},B(n,r))}function b(e){let n=e;return [b$1("sync",{windowDays:String(n.windowDays),dryRun:String(n.dryRun)},"sync complete (windowDays={{windowDays}}, dryRun={{dryRun}}):"),c("sync",{generatedCount:String(n.generatedCount),skippedCount:String(n.skippedCount),failedGenerateCount:String(n.failedGenerateCount),archivedCount:String(n.archivedCount),archiveThreshold:n.archiveThreshold}," - generated: {{generatedCount}}, skipped: {{skippedCount}}, failed: {{failedGenerateCount}}, archived: {{archivedCount}} (threshold: {{archiveThreshold}})"),` - duration: ${n.durationMs}ms`].join(`
2
2
  `)}function S(e){let n={};for(let r=0;r<e.length;r++){let t=e[r];if(t===void 0)continue;let i=e[r+1];if(t==="--agent")r++;else if(t==="--window-days"){let o=Number(i);if(Number.isNaN(o)||o<1||o>3650)throw new NameErrors.InvalidArgumentError({param:"window-days",message:`--window-days must be an integer in [1, 3650], got: ${i??"(empty)"}`});n.windowDays=o,r++;}else t==="--dry-run"?n.dryRun=true:t==="--json"?n.json=true:(t==="--help"||t==="-h")&&(n.help=true);}return n}export{b as formatSyncText,S as parseSyncOptions,C as runSync};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';var chunkR32346OA_cjs=require('./chunks/chunk-R32346OA.cjs'),fs=require('fs'),path=require('path'),url=require('url'),terminal=require('@easbot/terminal');var N=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));function C(){try{let t=path.join(N,"..","package.json");return JSON.parse(fs.readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var u=new Set(["DEBUG","INFO","WARN","ERROR"]);function D(t){let o={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<t.length;s++){let e=t[s];if(e)if(e==="--cwd"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.cwd=n,s++);}else if(e.startsWith("--cwd="))o.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.configPath=n,s++);}else if(e.startsWith("--config="))o.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let n=t[s+1];if(n&&!n.startsWith("-")){let c=n.toUpperCase();u.has(c)&&(o.logLevel=c,s++);}}else if(e.startsWith("--log-level=")){let n=e.slice(12).toUpperCase();u.has(n)&&(o.logLevel=n);}else e==="--print-logs"?o.printLogs=true:e==="--debug"&&(o.debug=true);}return o}async function R(){let t=process.argv.slice(2),o=C(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=D(t),{Log:n}=await import('@easbot/utils'),{getXdgData:c}=await import('./chunks/interfaces-LDOE5ZTS.cjs'),L=path.join(c(),"memory","log");if(await n.init({logDir:L,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:a}=await import('./chunks/cli-handler-USK4CPAU.cjs');a();return}if(t[0]==="--help"||t[0]==="-h"){let{renderHelp:a}=await import('./chunks/cli-handler-USK4CPAU.cjs');a();return}if(t[0]==="--version"||t[0]==="-v"){terminal.printHuman([terminal.formatInfo(o)]);return}let i=e.cwd??process.cwd(),{handleMemoryCli:b}=await import('./chunks/cli-handler-USK4CPAU.cjs'),{setInstanceAdapter:v}=await import('./chunks/interfaces-LDOE5ZTS.cjs');v({directory:i,worktree:i});let{setAdapterRegistry:y}=await import('@easbot/llm'),{getGlobal:r,getInstance:p}=await import('./chunks/interfaces-LDOE5ZTS.cjs');y({config:void 0,instance:{getDirectory:()=>p().directory,getWorktree:()=>p().worktree},global:{home:r().Path.home,data:r().Path.data,cache:r().Path.cache,config:r().Path.config,state:r().Path.state,log:r().Path.log,bin:r().Path.bin},installation:{getVersion:()=>o,getChannel:()=>"local",getUserAgent:()=>`easbot-memory/${o}`}});let d=n.create({service:"memory.cli.standalone"}),l;try{let{readFileSync:a}=await import('fs'),{join:g}=await import('path'),m=g(i,".easbot","protocol.json"),O=a(m,"utf-8");l=JSON.parse(O)?.metadata?.agentId?.trim()||void 0,d.debug("standalone CLI: resolved hostAgentId from protocol.json",{hostAgentId:l,protocolPath:m});}catch(a){let{errorMeta:g}=await import('@easbot/utils');d.errorDegradable("standalone CLI: read protocol.json failed; hostAgentId stays undefined",{cwd:i,error:g(a)});}let f=await b(t,{version:o,cwd:i,agentId:l});f.code!==0&&(process.exitCode=f.code);}R().catch(async t=>{try{let{Log:o,errorMeta:s}=await import('@easbot/utils');o.create({service:"memory.cli.standalone"}).error("memory CLI crashed",{error:s(t)});}catch{console.error(t);}process.exitCode=1;}).finally(async()=>{try{let{Log:t}=await import('@easbot/utils');await t.close();}catch{}process.exit(process.exitCode??0);});
2
+ 'use strict';var chunkR32346OA_cjs=require('./chunks/chunk-R32346OA.cjs'),fs=require('fs'),path=require('path'),url=require('url'),terminal=require('@easbot/terminal');var N=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));function C(){try{let t=path.join(N,"..","package.json");return JSON.parse(fs.readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var u=new Set(["DEBUG","INFO","WARN","ERROR"]);function D(t){let o={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<t.length;s++){let e=t[s];if(e)if(e==="--cwd"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.cwd=n,s++);}else if(e.startsWith("--cwd="))o.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.configPath=n,s++);}else if(e.startsWith("--config="))o.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let n=t[s+1];if(n&&!n.startsWith("-")){let c=n.toUpperCase();u.has(c)&&(o.logLevel=c,s++);}}else if(e.startsWith("--log-level=")){let n=e.slice(12).toUpperCase();u.has(n)&&(o.logLevel=n);}else e==="--print-logs"?o.printLogs=true:e==="--debug"&&(o.debug=true);}return o}async function R(){let t=process.argv.slice(2),o=C(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=D(t),{Log:n}=await import('@easbot/utils'),{getXdgData:c}=await import('./chunks/interfaces-LDOE5ZTS.cjs'),L=path.join(c(),"memory","log");if(await n.init({logDir:L,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:a}=await import('./chunks/cli-handler-F67HXX57.cjs');a();return}if(t[0]==="--help"||t[0]==="-h"){let{renderHelp:a}=await import('./chunks/cli-handler-F67HXX57.cjs');a();return}if(t[0]==="--version"||t[0]==="-v"){terminal.printHuman([terminal.formatInfo(o)]);return}let i=e.cwd??process.cwd(),{handleMemoryCli:b}=await import('./chunks/cli-handler-F67HXX57.cjs'),{setInstanceAdapter:v}=await import('./chunks/interfaces-LDOE5ZTS.cjs');v({directory:i,worktree:i});let{setAdapterRegistry:y}=await import('@easbot/llm'),{getGlobal:r,getInstance:p}=await import('./chunks/interfaces-LDOE5ZTS.cjs');y({config:void 0,instance:{getDirectory:()=>p().directory,getWorktree:()=>p().worktree},global:{home:r().Path.home,data:r().Path.data,cache:r().Path.cache,config:r().Path.config,state:r().Path.state,log:r().Path.log,bin:r().Path.bin},installation:{getVersion:()=>o,getChannel:()=>"local",getUserAgent:()=>`easbot-memory/${o}`}});let d=n.create({service:"memory.cli.standalone"}),l;try{let{readFileSync:a}=await import('fs'),{join:g}=await import('path'),m=g(i,".easbot","protocol.json"),O=a(m,"utf-8");l=JSON.parse(O)?.metadata?.agentId?.trim()||void 0,d.debug("standalone CLI: resolved hostAgentId from protocol.json",{hostAgentId:l,protocolPath:m});}catch(a){let{errorMeta:g}=await import('@easbot/utils');d.errorDegradable("standalone CLI: read protocol.json failed; hostAgentId stays undefined",{cwd:i,error:g(a)});}let f=await b(t,{version:o,cwd:i,agentId:l});f.code!==0&&(process.exitCode=f.code);}R().catch(async t=>{try{let{Log:o,errorMeta:s}=await import('@easbot/utils');o.create({service:"memory.cli.standalone"}).error("memory CLI crashed",{error:s(t)});}catch{console.error(t);}process.exitCode=1;}).finally(async()=>{try{let{Log:t}=await import('@easbot/utils');await t.close();}catch{}process.exit(process.exitCode??0);});
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import {readFileSync}from'fs';import {dirname,join}from'path';import {fileURLToPath}from'url';import {printHuman,formatInfo}from'@easbot/terminal';var E=dirname(fileURLToPath(import.meta.url));function N(){try{let t=join(E,"..","package.json");return JSON.parse(readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var h=new Set(["DEBUG","INFO","WARN","ERROR"]);function C(t){let o={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<t.length;s++){let e=t[s];if(e)if(e==="--cwd"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.cwd=n,s++);}else if(e.startsWith("--cwd="))o.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.configPath=n,s++);}else if(e.startsWith("--config="))o.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let n=t[s+1];if(n&&!n.startsWith("-")){let c=n.toUpperCase();h.has(c)&&(o.logLevel=c,s++);}}else if(e.startsWith("--log-level=")){let n=e.slice(12).toUpperCase();h.has(n)&&(o.logLevel=n);}else e==="--print-logs"?o.printLogs=true:e==="--debug"&&(o.debug=true);}return o}async function D(){let t=process.argv.slice(2),o=N(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=C(t),{Log:n}=await import('@easbot/utils'),{getXdgData:c}=await import('./chunks/interfaces-OFM2XGSG.mjs'),w=join(c(),"memory","log");if(await n.init({logDir:w,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:a}=await import('./chunks/cli-handler-JHSDGJHK.mjs');a();return}if(t[0]==="--help"||t[0]==="-h"){let{renderHelp:a}=await import('./chunks/cli-handler-JHSDGJHK.mjs');a();return}if(t[0]==="--version"||t[0]==="-v"){printHuman([formatInfo(o)]);return}let i=e.cwd??process.cwd(),{handleMemoryCli:L}=await import('./chunks/cli-handler-JHSDGJHK.mjs'),{setInstanceAdapter:b}=await import('./chunks/interfaces-OFM2XGSG.mjs');b({directory:i,worktree:i});let{setAdapterRegistry:v}=await import('@easbot/llm'),{getGlobal:r,getInstance:p}=await import('./chunks/interfaces-OFM2XGSG.mjs');v({config:void 0,instance:{getDirectory:()=>p().directory,getWorktree:()=>p().worktree},global:{home:r().Path.home,data:r().Path.data,cache:r().Path.cache,config:r().Path.config,state:r().Path.state,log:r().Path.log,bin:r().Path.bin},installation:{getVersion:()=>o,getChannel:()=>"local",getUserAgent:()=>`easbot-memory/${o}`}});let d=n.create({service:"memory.cli.standalone"}),l;try{let{readFileSync:a}=await import('fs'),{join:g}=await import('path'),m=g(i,".easbot","protocol.json"),y=a(m,"utf-8");l=JSON.parse(y)?.metadata?.agentId?.trim()||void 0,d.debug("standalone CLI: resolved hostAgentId from protocol.json",{hostAgentId:l,protocolPath:m});}catch(a){let{errorMeta:g}=await import('@easbot/utils');d.errorDegradable("standalone CLI: read protocol.json failed; hostAgentId stays undefined",{cwd:i,error:g(a)});}let f=await L(t,{version:o,cwd:i,agentId:l});f.code!==0&&(process.exitCode=f.code);}D().catch(async t=>{try{let{Log:o,errorMeta:s}=await import('@easbot/utils');o.create({service:"memory.cli.standalone"}).error("memory CLI crashed",{error:s(t)});}catch{console.error(t);}process.exitCode=1;}).finally(async()=>{try{let{Log:t}=await import('@easbot/utils');await t.close();}catch{}process.exit(process.exitCode??0);});
2
+ import {readFileSync}from'fs';import {dirname,join}from'path';import {fileURLToPath}from'url';import {printHuman,formatInfo}from'@easbot/terminal';var E=dirname(fileURLToPath(import.meta.url));function N(){try{let t=join(E,"..","package.json");return JSON.parse(readFileSync(t,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var h=new Set(["DEBUG","INFO","WARN","ERROR"]);function C(t){let o={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<t.length;s++){let e=t[s];if(e)if(e==="--cwd"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.cwd=n,s++);}else if(e.startsWith("--cwd="))o.cwd=e.slice(6);else if(e==="--config"&&s+1<t.length){let n=t[s+1];n&&!n.startsWith("-")&&(o.configPath=n,s++);}else if(e.startsWith("--config="))o.configPath=e.slice(9);else if(e==="--log-level"&&s+1<t.length){let n=t[s+1];if(n&&!n.startsWith("-")){let c=n.toUpperCase();h.has(c)&&(o.logLevel=c,s++);}}else if(e.startsWith("--log-level=")){let n=e.slice(12).toUpperCase();h.has(n)&&(o.logLevel=n);}else e==="--print-logs"?o.printLogs=true:e==="--debug"&&(o.debug=true);}return o}async function D(){let t=process.argv.slice(2),o=N(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let e=C(t),{Log:n}=await import('@easbot/utils'),{getXdgData:c}=await import('./chunks/interfaces-OFM2XGSG.mjs'),w=join(c(),"memory","log");if(await n.init({logDir:w,print:e.printLogs,dev:e.debug||false,level:e.logLevel}),t.length===0){let{renderBanner:a}=await import('./chunks/cli-handler-EA6B2IET.mjs');a();return}if(t[0]==="--help"||t[0]==="-h"){let{renderHelp:a}=await import('./chunks/cli-handler-EA6B2IET.mjs');a();return}if(t[0]==="--version"||t[0]==="-v"){printHuman([formatInfo(o)]);return}let i=e.cwd??process.cwd(),{handleMemoryCli:L}=await import('./chunks/cli-handler-EA6B2IET.mjs'),{setInstanceAdapter:b}=await import('./chunks/interfaces-OFM2XGSG.mjs');b({directory:i,worktree:i});let{setAdapterRegistry:v}=await import('@easbot/llm'),{getGlobal:r,getInstance:p}=await import('./chunks/interfaces-OFM2XGSG.mjs');v({config:void 0,instance:{getDirectory:()=>p().directory,getWorktree:()=>p().worktree},global:{home:r().Path.home,data:r().Path.data,cache:r().Path.cache,config:r().Path.config,state:r().Path.state,log:r().Path.log,bin:r().Path.bin},installation:{getVersion:()=>o,getChannel:()=>"local",getUserAgent:()=>`easbot-memory/${o}`}});let d=n.create({service:"memory.cli.standalone"}),l;try{let{readFileSync:a}=await import('fs'),{join:g}=await import('path'),m=g(i,".easbot","protocol.json"),y=a(m,"utf-8");l=JSON.parse(y)?.metadata?.agentId?.trim()||void 0,d.debug("standalone CLI: resolved hostAgentId from protocol.json",{hostAgentId:l,protocolPath:m});}catch(a){let{errorMeta:g}=await import('@easbot/utils');d.errorDegradable("standalone CLI: read protocol.json failed; hostAgentId stays undefined",{cwd:i,error:g(a)});}let f=await L(t,{version:o,cwd:i,agentId:l});f.code!==0&&(process.exitCode=f.code);}D().catch(async t=>{try{let{Log:o,errorMeta:s}=await import('@easbot/utils');o.create({service:"memory.cli.standalone"}).error("memory CLI crashed",{error:s(t)});}catch{console.error(t);}process.exitCode=1;}).finally(async()=>{try{let{Log:t}=await import('@easbot/utils');await t.close();}catch{}process.exit(process.exitCode??0);});