memindex 1.4.6 → 1.5.0

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 (39) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.qoder-plugin/plugin.json +1 -1
  5. package/README.md +1 -1
  6. package/dist/bug-report/index.js +55 -55
  7. package/dist/npx-cli/index.js +300 -299
  8. package/dist/opencode-plugin/index.js +40 -40
  9. package/dist/pi-extension/index.js +6 -6
  10. package/integrations/dsh/lib/index.js +19 -19
  11. package/integrations/dsh/package.json +1 -1
  12. package/integrations/openclaw/install.sh +16 -10
  13. package/integrations/openclaw/openclaw.plugin.json +1 -1
  14. package/integrations/openclaw/test-install.sh +20 -13
  15. package/package.json +1 -1
  16. package/plugin/.claude-plugin/plugin.json +1 -1
  17. package/plugin/.codex-plugin/plugin.json +1 -1
  18. package/plugin/.qoder-plugin/plugin.json +1 -1
  19. package/plugin/hooks/codex-hooks.json +12 -0
  20. package/plugin/package.json +1 -1
  21. package/plugin/scripts/context-generator.cjs +55 -54
  22. package/plugin/scripts/context-generator.cjs.map +3 -3
  23. package/plugin/scripts/mcp-server.cjs +71 -70
  24. package/plugin/scripts/mcp-server.cjs.map +3 -3
  25. package/plugin/scripts/statusline.cjs +1 -1
  26. package/plugin/scripts/transcript-watcher.cjs +36 -35
  27. package/plugin/scripts/transcript-watcher.cjs.map +3 -3
  28. package/plugin/scripts/worker-service.cjs +664 -632
  29. package/plugin/scripts/worker-service.cjs.map +3 -3
  30. package/plugin/skills/cloud-sync/SKILL.md +5 -5
  31. package/plugin/skills/mode-creator/SKILL.md +7 -1
  32. package/plugin/skills/timeline-report/SKILL.md +8 -8
  33. package/plugin/skills/weekly-digests/SKILL.md +5 -5
  34. package/plugin/skills/worker-request.mjs +45 -0
  35. package/plugin/sqlite/SessionStore.js +109 -109
  36. package/plugin/sqlite/SessionStore.js.map +3 -3
  37. package/plugin/sqlite/observations/files.js +12 -9
  38. package/plugin/sqlite/observations/files.js.map +3 -3
  39. package/plugin/ui/viewer-bundle.js +18 -18
@@ -1 +1 @@
1
- "use strict";var K=require("os");var _=require("fs"),k=require("http"),A=require("path"),G=900*1e3,q="note writing is paused (MEMINDEX_OBSERVER_ENABLED is false). Search and past memory still work";function N(t){let e=typeof t=="string"?t.trim():"";return e&&e!=="localhost"&&e!=="0.0.0.0"&&e!=="::"?e:"127.0.0.1"}function T(t,e=Date.now()){try{let r=JSON.parse((0,_.readFileSync)((0,A.join)(t,"state","hook-failures.json"),"utf-8")),n=typeof r.consecutiveFailures=="number"?Math.floor(r.consecutiveFailures):0,o=typeof r.lastFailureAt=="number"?r.lastFailureAt:0;if(n>0&&e-o<G)return{count:n,lastFailureAt:o}}catch{}return null}function M(t,e,r){return new Promise(n=>{let o=!1,s=d=>{o||(o=!0,clearTimeout(f),n(d))},a=(0,k.request)({host:t,port:e,path:"/api/readiness",method:"GET"},d=>{let O=[];d.on("data",g=>O.push(g)),d.on("end",()=>{let g={};try{let x=JSON.parse(Buffer.concat(O).toString("utf-8"));x&&typeof x=="object"&&(g=x)}catch{}s({reachable:!0,httpStatus:d.statusCode??0,body:g})}),d.on("error",()=>s({reachable:!1}))}),f=setTimeout(()=>{s({reachable:!1}),a.destroy()},r);a.on("error",()=>s({reachable:!1})),a.end()})}function I(t,e){if(!t.reachable)return{saving:!1,reason:"the memory worker is not running. Run: npx memindex start"};if(t.httpStatus!==200||t.body.status!=="ready")return t.body.status==="failed"&&t.body.reason?{saving:!1,reason:t.body.reason}:{saving:!1,reason:"the memory worker is still starting. If this stays, run: npx memindex doctor"};if(t.body.notesPaused)return{saving:!1,paused:!0,reason:q};if(e){let r=e.count===1?"save has":"saves have";return{saving:!1,reason:`${e.count} ${r} failed in the last 15 minutes. Run: npx memindex doctor`}}return{saving:!0,lastSavedAt:typeof t.body.lastSavedAt=="number"?t.body.lastSavedAt:null}}function V(t,e){let r=Math.max(0,Math.floor((e-t)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)} min ago`:r<86400?`${Math.floor(r/3600)} h ago`:`${Math.floor(r/86400)} d ago`}function W(t,e){let r="\x1B[1;31m",n="\x1B[32m",o="\x1B[33m",s="\x1B[2m",a="\x1B[0m";return t.paused?`${o}memory: notes paused${a} ${s}(MEMINDEX_OBSERVER_ENABLED is false; search still works)${a}`:t.saving?t.lastSavedAt===null?`${n}memory: ready, nothing saved yet${a}`:`${n}memory: saved ${V(t.lastSavedAt,e)}${a}`:`${r}\u2717 MEMORY NOT SAVING${a} ${s}(${t.reason})${a}`}var H=require("fs"),C=require("path");var i=require("fs");var mt=Promise.resolve();var St=process.platform==="win32";function z(t){return t.replace(/^\uFEFF/,"")}function Y(t){return JSON.parse(z(t))}function m(t){return Y((0,i.readFileSync)(t,"utf-8"))}var J=require("fs"),B=require("os"),b=require("path");var S="MEMINDEX_",Q="AGENT_MEM_",y=[Q];function P(t){return t.startsWith(S)||y.some(e=>t.startsWith(e))}function Z(t=process.env){for(let e of y)for(let r of Object.keys(t)){if(!r.startsWith(e))continue;let n=S+r.slice(e.length);t[n]===void 0&&(t[n]=t[r])}}function F(t){let e=null;for(let r of y)for(let n of Object.keys(t)){if(!n.startsWith(r))continue;let o=S+n.slice(r.length);(e??t)[o]===void 0&&(e??={...t},e[o]=t[n])}return e??t}Z();var $=require("os"),j=require("path");function h(t,e=process.platform,r=(0,$.homedir)()){return typeof t!="string"||t.length===0?t:t==="~"?r:t.startsWith("~/")||e==="win32"&&t.startsWith("~\\")?(0,j.join)(r,t.slice(2)):t}var tt=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);function et(t){let e=t.env;return tt(e)&&Object.keys(e).some(P)?"nested":"flat"}function E(t){return et(t)==="nested"?t.env:t}function l(t=process.env,e=(0,B.homedir)()){if(t.MEMINDEX_DATA_DIR)return h(t.MEMINDEX_DATA_DIR,process.platform,e);let r=(0,b.join)(e,".memindex"),n=(0,b.join)(r,"settings.json");try{if((0,J.existsSync)(n)){let o=m(n);if(o===null||typeof o!="object"||Array.isArray(o))return r;let s=F(E(o));if(typeof s.MEMINDEX_DATA_DIR=="string"&&s.MEMINDEX_DATA_DIR)return h(s.MEMINDEX_DATA_DIR,process.platform,e)}}catch{}return r}var D=require("crypto"),L=require("fs"),c=require("os"),u=require("path");var rt=4e4,nt=9e3,ot=["/tmp","/private/tmp","/var/folders","/private/var/folders"];function p(t){let e=(0,u.resolve)(t),r=[],n=e;for(;;)try{return(0,u.join)(L.realpathSync.native(n),...r.reverse())}catch{let o=(0,u.dirname)(n);if(o===n)return e;r.push((0,u.basename)(n)),n=o}}function st(t,e){let r=p(e);return t===r||t.startsWith(r.endsWith(u.sep)?r:r+u.sep)}function it(t,e=(0,c.homedir)()){let r=p(t),n=p(e);return(process.platform==="win32"?[(0,c.tmpdir)()]:[(0,c.tmpdir)(),...ot]).some(s=>p(s)!==n&&st(r,s))}function w(t=process.env,e=(0,c.homedir)()){return t.MEMINDEX_TEST_FORBIDDEN_DATA_DIR?!0:it(l(t,e),e)}var at=39e3,ut=500;function ct(t){return(0,D.createHash)("sha256").update(u.win32.resolve(t).toLowerCase()).digest().readUInt32BE(0)%ut}function v(t=process.platform,e=(0,c.homedir)()){return t==="win32"?at+ct(e):38700+(process.getuid?.()??77)%100}function R(t){let e=(0,D.createHash)("sha256").update(p(t)).digest();return rt+e.readUInt32BE(0)%nt}function X(t=process.env,e=(0,c.homedir)()){return w(t,e)?R(l(t,e)):v(process.platform,e)}function U(t,e){let r=l(t,e),n={};try{let a=(0,C.join)(r,"settings.json");if((0,H.existsSync)(a)){let f=m(a);f&&typeof f=="object"&&!Array.isArray(f)&&(n=E(f))}}catch{}let o=parseInt(String(t.MEMINDEX_WORKER_PORT??n.MEMINDEX_WORKER_PORT??""),10),s=Number.isFinite(o)?o:X(t,e);return s===v(process.platform,e)&&w(t,e)&&(s=R(r)),{dataDir:r,host:N(t.MEMINDEX_WORKER_HOST??n.MEMINDEX_WORKER_HOST),port:s}}async function ft(){process.stdin.resume();let t=Date.now(),{dataDir:e,host:r,port:n}=U(process.env,(0,K.homedir)()),o=await M(r,n,500);process.stdout.write(W(I(o,T(e,t)),t)),process.exit(0)}ft();
1
+ "use strict";var K=require("os");var _=require("fs"),A=require("http"),N=require("path"),G=900*1e3,Y="note writing is paused (MEMINDEX_OBSERVER_ENABLED is false). Search and past memory still work";function k(t){let e=typeof t=="string"?t.trim():"";return e&&e!=="localhost"&&e!=="0.0.0.0"&&e!=="::"?e:"127.0.0.1"}function M(t,e=Date.now()){try{let r=JSON.parse((0,_.readFileSync)((0,N.join)(t,"state","hook-failures.json"),"utf-8")),n=typeof r.consecutiveFailures=="number"?Math.floor(r.consecutiveFailures):0,o=typeof r.lastFailureAt=="number"?r.lastFailureAt:0;if(n>0&&e-o<G)return{count:n,lastFailureAt:o}}catch{}return null}function T(t,e,r){return new Promise(n=>{let o=!1,s=d=>{o||(o=!0,clearTimeout(f),n(d))},a=(0,A.request)({host:t,port:e,path:"/api/readiness",method:"GET"},d=>{let O=[];d.on("data",g=>O.push(g)),d.on("end",()=>{let g={};try{let x=JSON.parse(Buffer.concat(O).toString("utf-8"));x&&typeof x=="object"&&(g=x)}catch{}s({reachable:!0,httpStatus:d.statusCode??0,body:g})}),d.on("error",()=>s({reachable:!1}))}),f=setTimeout(()=>{s({reachable:!1}),a.destroy()},r);a.on("error",()=>s({reachable:!1})),a.end()})}function I(t,e){if(!t.reachable)return{saving:!1,reason:"the memory worker is not running. Run: npx memindex start"};if(t.httpStatus!==200||t.body.status!=="ready")return t.body.status==="failed"&&t.body.reason?{saving:!1,reason:t.body.reason}:{saving:!1,reason:"the memory worker is still starting. If this stays, run: npx memindex doctor"};if(t.body.notesPaused)return{saving:!1,paused:!0,reason:Y};if(e){let r=e.count===1?"save has":"saves have";return{saving:!1,reason:`${e.count} ${r} failed in the last 15 minutes. Run: npx memindex doctor`}}return{saving:!0,lastSavedAt:typeof t.body.lastSavedAt=="number"?t.body.lastSavedAt:null}}function q(t,e){let r=Math.max(0,Math.floor((e-t)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)} min ago`:r<86400?`${Math.floor(r/3600)} h ago`:`${Math.floor(r/86400)} d ago`}function W(t,e){let r="\x1B[1;31m",n="\x1B[32m",o="\x1B[33m",s="\x1B[2m",a="\x1B[0m";return t.paused?`${o}memory: notes paused${a} ${s}(MEMINDEX_OBSERVER_ENABLED is false; search still works)${a}`:t.saving?t.lastSavedAt===null?`${n}memory: ready, nothing saved yet${a}`:`${n}memory: saved ${q(t.lastSavedAt,e)}${a}`:`${r}\u2717 MEMORY NOT SAVING${a} ${s}(${t.reason})${a}`}var H=require("fs"),C=require("path");var i=require("fs");var mt=Promise.resolve();var St=process.platform==="win32";function V(t){return t.replace(/^\uFEFF/,"")}function z(t){return JSON.parse(V(t))}function m(t){return z((0,i.readFileSync)(t,"utf-8"))}var B=require("fs"),J=require("os"),w=require("path");var S="MEMINDEX_",Q="AGENT_MEM_",y=[Q];function P(t){return t.startsWith(S)||y.some(e=>t.startsWith(e))}function Z(t=process.env){for(let e of y)for(let r of Object.keys(t)){if(!r.startsWith(e))continue;let n=S+r.slice(e.length);t[n]===void 0&&(t[n]=t[r])}}function F(t){let e=null;for(let r of y)for(let n of Object.keys(t)){if(!n.startsWith(r))continue;let o=S+n.slice(r.length);(e??t)[o]===void 0&&(e??={...t},e[o]=t[n])}return e??t}Z();var $=require("os"),j=require("path");function h(t,e=process.platform,r=(0,$.homedir)()){return typeof t!="string"||t.length===0?t:t==="~"?r:t.startsWith("~/")||e==="win32"&&t.startsWith("~\\")?(0,j.join)(r,t.slice(2)):t}var tt=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);function et(t){let e=t.env;return tt(e)&&Object.keys(e).some(P)?"nested":"flat"}function E(t){return et(t)==="nested"?t.env:t}function l(t=process.env,e=(0,J.homedir)()){if(t.MEMINDEX_DATA_DIR)return h(t.MEMINDEX_DATA_DIR,process.platform,e);let r=(0,w.join)(e,".memindex"),n=(0,w.join)(r,"settings.json");try{if((0,B.existsSync)(n)){let o=m(n);if(o===null||typeof o!="object"||Array.isArray(o))return r;let s=F(E(o));if(typeof s.MEMINDEX_DATA_DIR=="string"&&s.MEMINDEX_DATA_DIR)return h(s.MEMINDEX_DATA_DIR,process.platform,e)}}catch{}return r}var D=require("crypto"),L=require("fs"),c=require("os"),u=require("path");var rt=4e4,nt=9e3,ot=["/tmp","/private/tmp","/var/folders","/private/var/folders"];function p(t){let e=(0,u.resolve)(t),r=[],n=e;for(;;)try{return(0,u.join)(L.realpathSync.native(n),...r.reverse())}catch{let o=(0,u.dirname)(n);if(o===n)return e;r.push((0,u.basename)(n)),n=o}}function st(t,e){let r=p(e);return t===r||t.startsWith(r.endsWith(u.sep)?r:r+u.sep)}function it(t,e=(0,c.homedir)()){let r=p(t),n=p(e);return(process.platform==="win32"?[(0,c.tmpdir)()]:[(0,c.tmpdir)(),...ot]).some(s=>p(s)!==n&&st(r,s))}function b(t=process.env,e=(0,c.homedir)()){return t.MEMINDEX_TEST_FORBIDDEN_DATA_DIR?!0:it(l(t,e),e)}var at=39e3,ut=500;function ct(t){return(0,D.createHash)("sha256").update(u.win32.resolve(t).toLowerCase()).digest().readUInt32BE(0)%ut}function R(t=process.platform,e=(0,c.homedir)()){return t==="win32"?at+ct(e):38700+(process.getuid?.()??77)%100}function v(t){let e=(0,D.createHash)("sha256").update(p(t)).digest();return rt+e.readUInt32BE(0)%nt}function X(t=process.env,e=(0,c.homedir)()){return b(t,e)?v(l(t,e)):R(process.platform,e)}function U(t,e){let r=l(t,e),n={};try{let a=(0,C.join)(r,"settings.json");if((0,H.existsSync)(a)){let f=m(a);f&&typeof f=="object"&&!Array.isArray(f)&&(n=E(f))}}catch{}let o=parseInt(String(t.MEMINDEX_WORKER_PORT??n.MEMINDEX_WORKER_PORT??""),10),s=Number.isFinite(o)?o:X(t,e);return s===R(process.platform,e)&&b(t,e)&&(s=v(r)),{dataDir:r,host:k(t.MEMINDEX_WORKER_HOST??n.MEMINDEX_WORKER_HOST),port:s}}async function ft(){process.stdin.resume();let t=Date.now(),{dataDir:e,host:r,port:n}=U(process.env,(0,K.homedir)()),o=await T(r,n,500);process.stdout.write(W(I(o,M(e,t)),t)),process.exit(0)}ft();