claude-mem 12.4.3 → 12.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/npx-cli/index.js +189 -181
- package/dist/opencode-plugin/index.js +1 -1
- package/openclaw/dist/index.js +13 -13
- package/openclaw/src/index.test.ts +1 -8
- package/openclaw/src/index.ts +3 -28
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/hooks.json +0 -12
- package/plugin/package.json +1 -1
- package/plugin/scripts/context-generator.cjs +14 -2
- package/plugin/scripts/mcp-server.cjs +37 -37
- package/plugin/scripts/worker-service.cjs +459 -426
- package/plugin/ui/viewer-bundle.js +35 -23
- package/dist/binaries/worker-service-v10.3.1-win-x64.exe +0 -0
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -8
- package/dist/sdk/index.d.ts +0 -109
- package/dist/sdk/index.js +0 -183
package/dist/npx-cli/index.js
CHANGED
|
@@ -1,65 +1,73 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`,"utf-8")}var
|
|
4
|
-
`).split(`
|
|
5
|
-
`).
|
|
6
|
-
`)
|
|
7
|
-
`),o=e.split(`
|
|
8
|
-
`),s=[];for(let i=0;i<Math.max(r.length,o.length);i++)r[i]!==o[i]&&s.push(i);return s}function ee(t){return t===tr}function Dt(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function Sn({input:t=mn,output:e=gn,overwrite:r=!0,hideCursor:o=!0}={}){let s=Q.createInterface({input:t,output:e,prompt:"",tabSize:1});Q.emitKeypressEvents(t,s),t.isTTY&&t.setRawMode(!0);let i=(n,{name:u,sequence:c})=>{let d=String(n);if(or([d,u,c],"cancel")){o&&e.write(k.cursor.show),process.exit(0);return}if(!r)return;Q.moveCursor(e,u==="return"?0:-1,u==="return"?-1:0,()=>{Q.clearLine(e,1,()=>{t.once("keypress",i)})})};return o&&e.write(k.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),o&&e.write(k.cursor.show),t.isTTY&&!oi&&t.setRawMode(!1),s.terminal=!1,s.close()}}var k,Gs,En,Ws,Hs,Ks,Js,Qt,un,an,cn,C,Ys,Vs,zs,gt,qs,rr,hn,Zs,Fn,nr,ln,Dn,Qs,er,ei,ti,ri,dt,oi,tr,si,ii,O,pt,mt,ui,ai,pn,yn,sr=m(()=>{k=ie(Zt(),1);Gs=Us();En={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(o){var s=o.charCodeAt(0),i=o.length==2?o.charCodeAt(1):0,n=s;return 55296<=s&&s<=56319&&56320<=i&&i<=57343&&(s&=1023,i&=1023,n=s<<10|i,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":n==8361||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||n==172||n==175||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":n==161||n==164||167<=n&&n<=168||n==170||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||n==198||n==208||215<=n&&n<=216||222<=n&&n<=225||n==230||232<=n&&n<=234||236<=n&&n<=237||n==240||242<=n&&n<=243||247<=n&&n<=250||n==252||n==254||n==257||n==273||n==275||n==283||294<=n&&n<=295||n==299||305<=n&&n<=307||n==312||319<=n&&n<=322||n==324||328<=n&&n<=331||n==333||338<=n&&n<=339||358<=n&&n<=359||n==363||n==462||n==464||n==466||n==468||n==470||n==472||n==474||n==476||n==593||n==609||n==708||n==711||713<=n&&n<=715||n==717||n==720||728<=n&&n<=731||n==733||n==735||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||n==1025||1040<=n&&n<=1103||n==1105||n==8208||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||n==8240||8242<=n&&n<=8243||n==8245||n==8251||n==8254||n==8308||n==8319||8321<=n&&n<=8324||n==8364||n==8451||n==8453||n==8457||n==8467||n==8470||8481<=n&&n<=8482||n==8486||n==8491||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||n==8585||8592<=n&&n<=8601||8632<=n&&n<=8633||n==8658||n==8660||n==8679||n==8704||8706<=n&&n<=8707||8711<=n&&n<=8712||n==8715||n==8719||n==8721||n==8725||n==8730||8733<=n&&n<=8736||n==8739||n==8741||8743<=n&&n<=8748||n==8750||8756<=n&&n<=8759||8764<=n&&n<=8765||n==8776||n==8780||n==8786||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||n==8853||n==8857||n==8869||n==8895||n==8978||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||n==9675||9678<=n&&n<=9681||9698<=n&&n<=9701||n==9711||9733<=n&&n<=9734||n==9737||9742<=n&&n<=9743||9748<=n&&n<=9749||n==9756||n==9758||n==9792||n==9794||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||n==9839||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||n==9955||9960<=n&&n<=9983||n==10045||n==10071||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||n==65533||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},e.characterLength=function(o){var s=this.eastAsianWidth(o);return s=="F"||s=="W"||s=="A"?2:1};function r(o){return o.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(o){for(var s=r(o),i=0,n=0;n<s.length;n++)i=i+this.characterLength(s[n]);return i},e.slice=function(o,s,i){textLen=e.length(o),s=s||0,i=i||1,s<0&&(s=textLen+s),i<0&&(i=textLen+i);for(var n="",u=0,c=r(o),d=0;d<c.length;d++){var p=c[d],D=e.length(p);if(u>=s-(D==2?1:0))if(u+D<=i)n+=p;else break;u+=D}return n}})(En);Ws=En.exports,Hs=Cn(Ws),Ks=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Js=Cn(Ks);Qt=10,un=(t=0)=>e=>`\x1B[${e+t}m`,an=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,cn=(t=0)=>(e,r,o)=>`\x1B[${38+t};2;${e};${r};${o}m`,C={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(C.modifier);Ys=Object.keys(C.color),Vs=Object.keys(C.bgColor);[...Ys,...Vs];zs=Xs(),gt=new Set(["\x1B","\x9B"]),qs=39,rr="\x07",hn="[",Zs="]",Fn="m",nr=`${Zs}8;;`,ln=t=>`${gt.values().next().value}${hn}${t}${Fn}`,Dn=t=>`${gt.values().next().value}${nr}${t}${rr}`,Qs=t=>t.split(" ").map(e=>Pe(e)),er=(t,e,r)=>{let o=[...e],s=!1,i=!1,n=Pe(fn(t[t.length-1]));for(let[u,c]of o.entries()){let d=Pe(c);if(n+d<=r?t[t.length-1]+=c:(t.push(c),n=0),gt.has(c)&&(s=!0,i=o.slice(u+1).join("").startsWith(nr)),s){i?c===rr&&(s=!1,i=!1):c===Fn&&(s=!1);continue}n+=d,n===r&&u<o.length-1&&(t.push(""),n=0)}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},ei=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Pe(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},ti=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let o="",s,i,n=Qs(t),u=[""];for(let[d,p]of t.split(" ").entries()){r.trim!==!1&&(u[u.length-1]=u[u.length-1].trimStart());let D=Pe(u[u.length-1]);if(d!==0&&(D>=e&&(r.wordWrap===!1||r.trim===!1)&&(u.push(""),D=0),(D>0||r.trim===!1)&&(u[u.length-1]+=" ",D++)),r.hard&&n[d]>e){let E=e-D,v=1+Math.floor((n[d]-E-1)/e);Math.floor((n[d]-1)/e)<v&&u.push(""),er(u,p,e);continue}if(D+n[d]>e&&D>0&&n[d]>0){if(r.wordWrap===!1&&D<e){er(u,p,e);continue}u.push("")}if(D+n[d]>e&&r.wordWrap===!1){er(u,p,e);continue}u[u.length-1]+=p}r.trim!==!1&&(u=u.map(d=>ei(d)));let c=[...u.join(`
|
|
9
|
-
`)];for(let[
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
`),
|
|
13
|
-
`).length-1;this.output.write(
|
|
14
|
-
`);this.output.write(
|
|
15
|
-
`).slice(o);this.output.write(
|
|
16
|
-
`)),this._prevFrame=e;return}this.output.write(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
${
|
|
21
|
-
|
|
22
|
-
${
|
|
23
|
-
${
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`).map((i,n)=>n===0?`${l.default.yellow(Oe)} ${l.default.yellow(i)}`:` ${i}`).join(`
|
|
27
|
-
`);return`${r+l.default.yellow(S)} ${kn({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:o}).join(`
|
|
28
|
-
${l.default.yellow(S)} `)}
|
|
29
|
-
${s}
|
|
30
|
-
`}default:return`${r}${l.default.cyan(S)} ${kn({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:o}).join(`
|
|
31
|
-
${l.default.cyan(S)} `)}
|
|
32
|
-
${l.default.cyan(Oe)}
|
|
33
|
-
`}}}).prompt()},Be=(t="",e="")=>{let r=`
|
|
34
|
-
${t}
|
|
35
|
-
`.split(`
|
|
36
|
-
`),o=ir(e).length,s=Math.max(r.reduce((n,u)=>{let c=ir(u);return c.length>n?c.length:n},0),o)+2,i=r.map(n=>`${l.default.gray(S)} ${l.default.dim(n)}${" ".repeat(s-ir(n).length)}${l.default.gray(S)}`).join(`
|
|
37
|
-
`);process.stdout.write(`${l.default.gray(S)}
|
|
38
|
-
${l.default.green(Ct)} ${l.default.reset(e)} ${l.default.gray(xn.repeat(Math.max(s-o-1,1))+mi)}
|
|
39
|
-
${i}
|
|
40
|
-
${l.default.gray(gi+xn.repeat(s+2)+fi)}
|
|
41
|
-
`)},Ne=(t="")=>{process.stdout.write(`${l.default.gray(Oe)} ${l.default.red(t)}
|
|
42
|
-
|
|
43
|
-
`)},Et=(t="")=>{process.stdout.write(`${l.default.gray(Di)} ${t}
|
|
44
|
-
`)},ce=(t="")=>{process.stdout.write(`${l.default.gray(S)}
|
|
45
|
-
${l.default.gray(Oe)} ${t}
|
|
46
|
-
|
|
47
|
-
`)},M={message:(t="",{symbol:e=l.default.gray(S)}={})=>{let r=[`${l.default.gray(S)}`];if(t){let[o,...s]=t.split(`
|
|
48
|
-
`);r.push(`${e} ${o}`,...s.map(i=>`${l.default.gray(S)} ${i}`))}process.stdout.write(`${r.join(`
|
|
2
|
+
var Xo=Object.create;var pr=Object.defineProperty;var qo=Object.getOwnPropertyDescriptor;var zo=Object.getOwnPropertyNames;var Zo=Object.getPrototypeOf,Qo=Object.prototype.hasOwnProperty;var ei=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var S=(e,t)=>()=>(e&&(t=e(e=0)),t);var _n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),se=(e,t)=>{for(var r in t)pr(e,r,{get:t[r],enumerable:!0})},ti=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of zo(t))!Qo.call(e,s)&&s!==r&&pr(e,s,{get:()=>t[s],enumerable:!(n=qo(t,s))||n.enumerable});return e};var Ie=(e,t,r)=>(r=e!=null?Xo(Zo(e)):{},ti(t||!e||!e.__esModule?pr(r,"default",{value:e,enumerable:!0}):r,e));var Ke=_n((Hl,mr)=>{var kt=process||{},xn=kt.argv||[],It=kt.env||{},ri=!(It.NO_COLOR||xn.includes("--no-color"))&&(!!It.FORCE_COLOR||xn.includes("--color")||kt.platform==="win32"||(kt.stdout||{}).isTTY&&It.TERM!=="dumb"||!!It.CI),ni=(e,t,r=e)=>n=>{let s=""+n,o=s.indexOf(t,e.length);return~o?e+si(s,t,r,o)+t:e+s+t},si=(e,t,r,n)=>{let s="",o=0;do s+=e.substring(o,n)+r,o=n+t.length,n=e.indexOf(t,o);while(~n);return s+e.substring(o)},$n=(e=ri)=>{let t=e?ni:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};mr.exports=$n();mr.exports.createColors=$n});import{existsSync as oi,readFileSync as ii}from"fs";function ee(e,t){if(!oi(e))return t;try{return JSON.parse(ii(e,"utf-8"))}catch(r){throw new Error(`Corrupt JSON file, refusing to overwrite: ${e}: ${r instanceof Error?r.message:String(r)}`)}}var Ve=S(()=>{"use strict"});import{existsSync as Je,mkdirSync as ai,readFileSync as In,writeFileSync as ci}from"fs";import{homedir as li}from"os";import{dirname as kn,join as J}from"path";import{fileURLToPath as ui}from"url";function gr(){return process.env.CLAUDE_CONFIG_DIR||J(li(),".claude")}function G(){return J(gr(),"plugins","marketplaces","thedotmack")}function ve(){return J(gr(),"plugins")}function ke(){return J(ve(),"known_marketplaces.json")}function Me(){return J(ve(),"installed_plugins.json")}function be(){return J(gr(),"settings.json")}function fr(e){return J(ve(),"cache","thedotmack","claude-mem",e)}function Mt(){let e=ui(import.meta.url),t=J(kn(e),"..","..");if(!Je(J(t,"package.json")))throw new Error(`npmPackageRootDirectory: expected package.json at ${t}. Bundle structure may have changed \u2014 update the path walk.`);return t}function hr(){return J(Mt(),"plugin")}function Ye(){let e=J(hr(),".claude-plugin","plugin.json");if(Je(e))try{let r=JSON.parse(In(e,"utf-8"));if(r.version)return r.version}catch{}let t=J(Mt(),"package.json");if(Je(t))try{let r=JSON.parse(In(t,"utf-8"));if(r.version)return r.version}catch{}return"0.0.0"}function bt(){let e=G();return Je(J(e,"plugin",".claude-plugin","plugin.json"))}function Xe(e){Je(e)||ai(e,{recursive:!0})}function pe(e,t){Xe(kn(e)),ci(e,JSON.stringify(t,null,2)+`
|
|
3
|
+
`,"utf-8")}var de,_e=S(()=>{"use strict";Ve();de=process.platform==="win32"});var Mn,bn,Tn,An=S(()=>{Mn=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,bn=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Tn=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141});var Er,Tt,At,Sr,Rt,di,pi,Rn,Dn,On=S(()=>{An();Er=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,Tt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,At=/\t{1,1000}/y,Sr=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),Rt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,di=new RegExp("\\p{M}+","gu"),pi={limit:1/0,ellipsis:""},Rn=(e,t={},r={})=>{let n=t.limit??1/0,s=t.ellipsis??"",o=t?.ellipsisWidth??(s?Rn(s,pi,r).width:0),i=r.ansiWidth??0,a=r.controlWidth??0,c=r.tabWidth??8,p=r.ambiguousWidth??1,m=r.emojiWidth??2,d=r.fullWidthWidth??2,g=r.regularWidth??1,E=r.wideWidth??2,f=0,h=0,T=e.length,D=0,P=!1,I=T,R=Math.max(0,n-o),w=0,A=0,C=0,x=0;e:for(;;){if(A>w||h>=T&&h>f){let ce=e.slice(w,A)||e.slice(f,h);D=0;for(let ye of ce.replaceAll(di,"")){let we=ye.codePointAt(0)||0;if(bn(we)?x=d:Tn(we)?x=E:p!==g&&Mn(we)?x=p:x=g,C+x>R&&(I=Math.min(I,Math.max(w,f)+D)),C+x>n){P=!0;break e}D+=ye.length,C+=x}w=A=0}if(h>=T)break;if(Rt.lastIndex=h,Rt.test(e)){if(D=Rt.lastIndex-h,x=D*g,C+x>R&&(I=Math.min(I,h+Math.floor((R-C)/g))),C+x>n){P=!0;break}C+=x,w=f,A=h,h=f=Rt.lastIndex;continue}if(Er.lastIndex=h,Er.test(e)){if(C+i>R&&(I=Math.min(I,h)),C+i>n){P=!0;break}C+=i,w=f,A=h,h=f=Er.lastIndex;continue}if(Tt.lastIndex=h,Tt.test(e)){if(D=Tt.lastIndex-h,x=D*a,C+x>R&&(I=Math.min(I,h+Math.floor((R-C)/a))),C+x>n){P=!0;break}C+=x,w=f,A=h,h=f=Tt.lastIndex;continue}if(At.lastIndex=h,At.test(e)){if(D=At.lastIndex-h,x=D*c,C+x>R&&(I=Math.min(I,h+Math.floor((R-C)/c))),C+x>n){P=!0;break}C+=x,w=f,A=h,h=f=At.lastIndex;continue}if(Sr.lastIndex=h,Sr.test(e)){if(C+m>R&&(I=Math.min(I,h)),C+m>n){P=!0;break}C+=m,w=f,A=h,h=f=Sr.lastIndex;continue}h+=1}return{width:P?R:C,index:P?I:T,truncated:P,ellipsed:P&&n>=o}},Dn=Rn});var mi,gi,W,Cr=S(()=>{On();mi={limit:1/0,ellipsis:"",ellipsisWidth:0},gi=(e,t={})=>Dn(e,mi,t).width,W=gi});function oe(e,t,r){return String(e).normalize().split(Ci).map(n=>Si(n,t,r)).join(`
|
|
4
|
+
`)}var Dt,Un,fi,wr,jn,hi,Gn,vr,Pn,Fn,Ln,Nn,yr,Ei,Si,Ci,_r=S(()=>{Cr();Dt="\x1B",Un="\x9B",fi=39,wr="\x07",jn="[",hi="]",Gn="m",vr=`${hi}8;;`,Pn=new RegExp(`(?:\\${jn}(?<code>\\d+)m|\\${vr}(?<uri>.*)${wr})`,"y"),Fn=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ln=e=>`${Dt}${jn}${e}${Gn}`,Nn=e=>`${Dt}${vr}${e}${wr}`,yr=(e,t,r)=>{let n=t[Symbol.iterator](),s=!1,o=!1,i=e.at(-1),a=i===void 0?0:W(i),c=n.next(),p=n.next(),m=0;for(;!c.done;){let d=c.value,g=W(d);a+g<=r?e[e.length-1]+=d:(e.push(d),a=0),(d===Dt||d===Un)&&(s=!0,o=t.startsWith(vr,m+1)),s?o?d===wr&&(s=!1,o=!1):d===Gn&&(s=!1):(a+=g,a===r&&!p.done&&(e.push(""),a=0)),c=p,p=n.next(),m+=d.length}i=e.at(-1),!a&&i!==void 0&&i.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ei=e=>{let t=e.split(" "),r=t.length;for(;r&&!W(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Si=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",s,o,i=e.split(" "),a=[""],c=0;for(let d=0;d<i.length;d++){let g=i[d];if(r.trim!==!1){let f=a.at(-1)??"",h=f.trimStart();f.length!==h.length&&(a[a.length-1]=h,c=W(h))}d!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),c=0),(c||r.trim===!1)&&(a[a.length-1]+=" ",c++));let E=W(g);if(r.hard&&E>t){let f=t-c,h=1+Math.floor((E-f-1)/t);Math.floor((E-1)/t)<h&&a.push(""),yr(a,g,t),c=W(a.at(-1)??"");continue}if(c+E>t&&c&&E){if(r.wordWrap===!1&&c<t){yr(a,g,t),c=W(a.at(-1)??"");continue}a.push(""),c=0}if(c+E>t&&r.wordWrap===!1){yr(a,g,t),c=W(a.at(-1)??"");continue}a[a.length-1]+=g,c+=E}r.trim!==!1&&(a=a.map(d=>Ei(d)));let p=a.join(`
|
|
5
|
+
`),m=!1;for(let d=0;d<p.length;d++){let g=p[d];if(n+=g,!m)m=g>="\uD800"&&g<="\uDBFF";else continue;if(g===Dt||g===Un){Pn.lastIndex=d+1;let f=Pn.exec(p)?.groups;if(f?.code!==void 0){let h=Number.parseFloat(f.code);s=h===fi?void 0:h}else f?.uri!==void 0&&(o=f.uri.length===0?void 0:f.uri)}if(p[d+1]===`
|
|
6
|
+
`){o&&(n+=Nn(""));let E=s?Fn(s):void 0;s&&E&&(n+=Ln(E))}else g===`
|
|
7
|
+
`&&(s&&Fn(s)&&(n+=Ln(s)),o&&(n+=Nn(o)))}return n},Ci=/\r?\n/});var $r=_n((ou,Wn)=>{"use strict";var xr={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let r="";return e<0?r+=`\x1B[${-e}D`:e>0&&(r+=`\x1B[${e}C`),t<0?r+=`\x1B[${-t}A`:t>0&&(r+=`\x1B[${t}B`),r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},yi={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},wi={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?xr.up():"");return e&&(t+=xr.left),t}};Wn.exports={cursor:xr,scroll:yi,erase:wi,beep:"\x07"}});import{stdout as kr,stdin as Bn}from"node:process";import*as me from"node:readline";import vi from"node:readline";import{ReadStream as Hn}from"node:tty";function Pt(e,t,r){if(!r.some(i=>!i.disabled))return e;let n=e+t,s=Math.max(r.length-1,0),o=n<0?s:n>s?0:n;return r[o].disabled?Pt(o,t<0?-1:1,r):o}function Mr(e,t){if(typeof e=="string")return U.aliases.get(e)===t;for(let r of e)if(r!==void 0&&Mr(r,t))return!0;return!1}function $i(e,t){if(e===t)return;let r=e.split(`
|
|
8
|
+
`),n=t.split(`
|
|
9
|
+
`),s=Math.max(r.length,n.length),o=[];for(let i=0;i<s;i++)r[i]!==n[i]&&o.push(i);return{lines:o,numLinesBefore:r.length,numLinesAfter:n.length,numLines:s}}function ge(e){return e===Ir}function Ot(e,t){let r=e;r.isTTY&&r.setRawMode(t)}function Kn({input:e=Bn,output:t=kr,overwrite:r=!0,hideCursor:n=!0}={}){let s=me.createInterface({input:e,output:t,prompt:"",tabSize:1});me.emitKeypressEvents(e,s),e instanceof Hn&&e.isTTY&&e.setRawMode(!0);let o=(i,{name:a,sequence:c})=>{let p=String(i);if(Mr([p,a,c],"cancel")){n&&t.write(N.cursor.show),process.exit(0);return}if(!r)return;me.moveCursor(t,a==="return"?0:-1,a==="return"?-1:0,()=>{me.clearLine(t,1,()=>{e.once("keypress",o)})})};return n&&t.write(N.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),n&&t.write(N.cursor.show),e instanceof Hn&&e.isTTY&&!Ii&&e.setRawMode(!1),s.terminal=!1,s.close()}}function ze(e,t,r,n=r){let s=qe(e??kr);return oe(t,s-r.length,{hard:!0,trim:!1}).split(`
|
|
10
|
+
`).map((o,i)=>`${i===0?n:r}${o}`).join(`
|
|
11
|
+
`)}var N,_i,xi,U,Ii,Ir,qe,br,Vn,Ft,Jn,Tr=S(()=>{_r();N=Ie($r(),1);_i=["up","down","left","right","space","enter","cancel"],xi=["January","February","March","April","May","June","July","August","September","October","November","December"],U={actions:new Set(_i),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...xi],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};Ii=globalThis.process.platform.startsWith("win"),Ir=Symbol("clack:cancel");qe=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,br=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;Vn=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:r=Bn,output:n=kr,render:s,signal:o,...i}=e;this.opts=i,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=s.bind(this),this._track=t,this._abortSignal=o,this.input=r,this.output=n}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let r=this._subscribers.get(e)??[];r.push(t),this._subscribers.set(e,r)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let r=this._subscribers.get(e)??[],n=[];for(let s of r)s.cb(...t),s.once&&n.push(()=>r.splice(r.indexOf(s),1));for(let s of n)s()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Ir);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=vi.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),Ot(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(N.cursor.show),this.output.off("resize",this.render),Ot(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(N.cursor.show),this.output.off("resize",this.render),Ot(this.input,!1),e(Ir)})})}_isActionKey(e,t){return e===" "}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&U.aliases.has(t.name)&&this.emit("cursor",U.aliases.get(t.name)),U.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),t),t?.name==="return"){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}Mr([e,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
12
|
+
`),Ot(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=oe(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
13
|
+
`).length-1;this.output.write(N.cursor.move(-999,e*-1))}render(){let e=oe(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(N.cursor.hide);else{let t=$i(this._prevFrame,e),r=br(this.output);if(this.restoreCursor(),t){let n=Math.max(0,t.numLinesAfter-r),s=Math.max(0,t.numLinesBefore-r),o=t.lines.find(i=>i>=n);if(o===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(N.cursor.move(0,o-s)),this.output.write(N.erase.lines(1));let i=e.split(`
|
|
14
|
+
`);this.output.write(i[o]),this._prevFrame=e,this.output.write(N.cursor.move(0,i.length-o-1));return}else if(t.lines.length>1){if(n<s)o=n;else{let a=o-s;a>0&&this.output.write(N.cursor.move(0,a))}this.output.write(N.erase.down());let i=e.split(`
|
|
15
|
+
`).slice(o);this.output.write(i.join(`
|
|
16
|
+
`)),this._prevFrame=e;return}}this.output.write(N.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Ft=class extends Vn{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(N.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},Jn=class extends Vn{options;cursor=0;get _value(){return this.options[this.cursor].value}get _enabledOptions(){return this.options.filter(e=>e.disabled!==!0)}toggleAll(){let e=this._enabledOptions,t=this.value!==void 0&&this.value.length===e.length;this.value=t?[]:e.map(r=>r.value)}toggleInvert(){let e=this.value;if(!e)return;let t=this._enabledOptions.filter(r=>!e.includes(r.value));this.value=t.map(r=>r.value)}toggleValue(){this.value===void 0&&(this.value=[]);let e=this.value.includes(this._value);this.value=e?this.value.filter(t=>t!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];let t=Math.max(this.options.findIndex(({value:r})=>r===e.cursorAt),0);this.cursor=this.options[t].disabled?Pt(t,1,this.options):t,this.on("key",r=>{r==="a"&&this.toggleAll(),r==="i"&&this.toggleInvert()}),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=Pt(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=Pt(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}}});import{styleText as u,stripVTControlCharacters as _u}from"node:util";import q from"node:process";function ki(){return q.platform!=="win32"?q.env.TERM!=="linux":!!q.env.CI||!!q.env.WT_SESSION||!!q.env.TERMINUS_SUBLIME||q.env.ConEmuTask==="{cmd::Cmder}"||q.env.TERM_PROGRAM==="Terminus-Sublime"||q.env.TERM_PROGRAM==="vscode"||q.env.TERM==="xterm-256color"||q.env.TERM==="alacritty"||q.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Qe,Ar,Mi,v,bi,es,ts,Lt,Ti,$,et,ku,Mu,Yn,Xn,Ai,qn,zn,bu,Zn,Ri,Di,Oi,Pi,Tu,Fi,Li,Ni,Ui,rs,ji,Gi,Qn,tt,H,rt,Nt,xe,Ze,ns,Wi,Hi,nt,Bi,Ki,Au,Ru,Ut,Rr=S(()=>{Tr();Tr();_r();Cr();Qe=Ie($r(),1);Ar=ki(),Mi=()=>process.env.CI==="true",v=(e,t)=>Ar?e:t,bi=v("\u25C6","*"),es=v("\u25A0","x"),ts=v("\u25B2","x"),Lt=v("\u25C7","o"),Ti=v("\u250C","T"),$=v("\u2502","|"),et=v("\u2514","\u2014"),ku=v("\u2510","T"),Mu=v("\u2518","\u2014"),Yn=v("\u25CF",">"),Xn=v("\u25CB"," "),Ai=v("\u25FB","[\u2022]"),qn=v("\u25FC","[+]"),zn=v("\u25FB","[ ]"),bu=v("\u25AA","\u2022"),Zn=v("\u2500","-"),Ri=v("\u256E","+"),Di=v("\u251C","+"),Oi=v("\u256F","+"),Pi=v("\u2570","+"),Tu=v("\u256D","+"),Fi=v("\u25CF","\u2022"),Li=v("\u25C6","*"),Ni=v("\u25B2","!"),Ui=v("\u25A0","x"),rs=e=>{switch(e){case"initial":case"active":return u("cyan",bi);case"cancel":return u("red",es);case"error":return u("yellow",ts);case"submit":return u("green",Lt)}},ji=e=>{switch(e){case"initial":case"active":return u("cyan",$);case"cancel":return u("red",$);case"error":return u("yellow",$);case"submit":return u("green",$)}},Gi=(e,t,r,n,s)=>{let o=t,i=0;for(let a=r;a<n;a++){let c=e[a];if(o=o-c.length,i++,o<=s)break}return{lineCount:o,removals:i}},Qn=({cursor:e,options:t,style:r,output:n=process.stdout,maxItems:s=Number.POSITIVE_INFINITY,columnPadding:o=0,rowPadding:i=4})=>{let a=qe(n)-o,c=br(n),p=u("dim","..."),m=Math.max(c-i,0),d=Math.max(Math.min(s,m),5),g=0;e>=d-3&&(g=Math.max(Math.min(e-d+3,t.length-d),0));let E=d<t.length&&g>0,f=d<t.length&&g+d<t.length,h=Math.min(g+d,t.length),T=[],D=0;E&&D++,f&&D++;let P=g+(E?1:0),I=h-(f?1:0);for(let w=P;w<I;w++){let A=oe(r(t[w],w===e),a,{hard:!0,trim:!1}).split(`
|
|
17
|
+
`);T.push(A),D+=A.length}if(D>m){let w=0,A=0,C=D,x=e-P,ce=(ye,we)=>Gi(T,C,ye,we,m);E?({lineCount:C,removals:w}=ce(0,x),C>m&&({lineCount:C,removals:A}=ce(x+1,T.length))):({lineCount:C,removals:A}=ce(x+1,T.length),C>m&&({lineCount:C,removals:w}=ce(0,x))),w>0&&(E=!0,T.splice(0,w)),A>0&&(f=!0,T.splice(T.length-A,A))}let R=[];E&&R.push(p);for(let w of T)for(let A of w)R.push(A);return f&&R.push(p),R},tt=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new Ft({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let n=e.withGuide??U.withGuide,s=`${rs(this.state)} `,o=n?`${u("gray",$)} `:"",i=ze(e.output,e.message,o,s),a=`${n?`${u("gray",$)}
|
|
18
|
+
`:""}${i}
|
|
19
|
+
`,c=this.value?t:r;switch(this.state){case"submit":{let p=n?`${u("gray",$)} `:"";return`${a}${p}${u("dim",c)}`}case"cancel":{let p=n?`${u("gray",$)} `:"";return`${a}${p}${u(["strikethrough","dim"],c)}${n?`
|
|
20
|
+
${u("gray",$)}`:""}`}default:{let p=n?`${u("cyan",$)} `:"",m=n?u("cyan",et):"";return`${a}${p}${this.value?`${u("green",Yn)} ${t}`:`${u("dim",Xn)} ${u("dim",t)}`}${e.vertical?n?`
|
|
21
|
+
${u("cyan",$)} `:`
|
|
22
|
+
`:` ${u("dim","/")} `}${this.value?`${u("dim",Xn)} ${u("dim",r)}`:`${u("green",Yn)} ${r}`}
|
|
23
|
+
${m}
|
|
24
|
+
`}}}}).prompt()},H={message:(e=[],{symbol:t=u("gray",$),secondarySymbol:r=u("gray",$),output:n=process.stdout,spacing:s=1,withGuide:o}={})=>{let i=[],a=o??U.withGuide,c=a?r:"",p=a?`${t} `:"",m=a?`${r} `:"";for(let g=0;g<s;g++)i.push(c);let d=Array.isArray(e)?e:e.split(`
|
|
25
|
+
`);if(d.length>0){let[g,...E]=d;g.length>0?i.push(`${p}${g}`):i.push(a?t:"");for(let f of E)f.length>0?i.push(`${m}${f}`):i.push(a?r:"")}n.write(`${i.join(`
|
|
49
26
|
`)}
|
|
50
|
-
`)},info:t=>{
|
|
51
|
-
|
|
52
|
-
`)
|
|
53
|
-
`)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),p=d?`${d[1].split("/").pop()}:${d[2]}`:"unknown",D={...o,location:p};return this.warn(e,`[HAPPY-PATH] ${r}`,D,s),i}},a=new lr});function Ln(t){return process.platform==="win32"?Math.round(t*Ge.WINDOWS_MULTIPLIER):t}var Ge,Dr=m(()=>{"use strict";Ge={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:15e3,READINESS_WAIT:3e4,PORT_IN_USE_WAIT:3e3,WORKER_STARTUP_WAIT:1e3,PRE_RESTART_SETTLE_DELAY:2e3,POWERSHELL_COMMAND:1e4,WINDOWS_MULTIPLIER:1.5}});import{readFileSync as bi,writeFileSync as Bn,existsSync as Nn,mkdirSync as Mi}from"fs";import{join as jn,dirname as Ii}from"path";import{homedir as Un}from"os";var te,dr=m(()=>{"use strict";te=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-6",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:String(37700+(process.getuid?.()??77)%100),CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_CLAUDE_AUTH_METHOD:"cli",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_GEMINI_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_GEMINI_MAX_TOKENS:"100000",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_OPENROUTER_MAX_TOKENS:"100000",CLAUDE_MEM_DATA_DIR:jn(Un(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_FULL_COUNT:"0",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false",CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT:"true",CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED:"false",CLAUDE_MEM_FOLDER_USE_LOCAL_MD:"false",CLAUDE_MEM_TRANSCRIPTS_ENABLED:"true",CLAUDE_MEM_TRANSCRIPTS_CONFIG_PATH:jn(Un(),".claude-mem","transcript-watch.json"),CLAUDE_MEM_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_HOOK_FAIL_LOUD_THRESHOLD:"3",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",CLAUDE_MEM_SEMANTIC_INJECT:"false",CLAUDE_MEM_SEMANTIC_INJECT_LIMIT:"5",CLAUDE_MEM_TIER_ROUTING_ENABLED:"true",CLAUDE_MEM_TIER_SIMPLE_MODEL:"haiku",CLAUDE_MEM_TIER_SUMMARY_MODEL:"",CLAUDE_MEM_CHROMA_ENABLED:"true",CLAUDE_MEM_CHROMA_MODE:"local",CLAUDE_MEM_CHROMA_HOST:"127.0.0.1",CLAUDE_MEM_CHROMA_PORT:"8000",CLAUDE_MEM_CHROMA_SSL:"false",CLAUDE_MEM_CHROMA_API_KEY:"",CLAUDE_MEM_CHROMA_TENANT:"default_tenant",CLAUDE_MEM_CHROMA_DATABASE:"default_database",CLAUDE_MEM_TELEGRAM_ENABLED:"true",CLAUDE_MEM_TELEGRAM_BOT_TOKEN:"",CLAUDE_MEM_TELEGRAM_CHAT_ID:"",CLAUDE_MEM_TELEGRAM_TRIGGER_TYPES:"security_alert",CLAUDE_MEM_TELEGRAM_TRIGGER_CONCEPTS:""};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return process.env[e]??this.DEFAULTS[e]}static getInt(e){let r=this.get(e);return parseInt(r,10)}static getBool(e){let r=this.get(e);return r==="true"||r===!0}static applyEnvOverrides(e){let r={...e};for(let o of Object.keys(this.DEFAULTS))process.env[o]!==void 0&&(r[o]=process.env[o]);return r}static loadFromFile(e){try{if(!Nn(e)){let n=this.getAllDefaults();try{let u=Ii(e);Nn(u)||Mi(u,{recursive:!0}),Bn(e,JSON.stringify(n,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",e)}catch(u){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",e,u instanceof Error?u.message:String(u))}return this.applyEnvOverrides(n)}let r=bi(e,"utf-8"),o=JSON.parse(r),s=o;if(o.env&&typeof o.env=="object"){s=o.env;try{Bn(e,JSON.stringify(s,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",e)}catch(n){console.warn("[SETTINGS] Failed to auto-migrate settings file:",e,n instanceof Error?n.message:String(n))}}let i={...this.DEFAULTS};for(let n of Object.keys(this.DEFAULTS))s[n]!==void 0&&(i[n]=s[n]);return this.applyEnvOverrides(i)}catch(r){return console.warn("[SETTINGS] Failed to load settings, using defaults:",e,r instanceof Error?r.message:String(r)),this.applyEnvOverrides(this.getAllDefaults())}}}});import{join as A,dirname as $i,basename as Ti}from"path";import{homedir as Gn}from"os";import{existsSync as Ri,mkdirSync as ll}from"fs";import{execSync as dl}from"child_process";import{fileURLToPath as Pi}from"url";function Oi(){return typeof __dirname<"u"?__dirname:$i(Pi(import.meta.url))}function Li(){if(process.env.CLAUDE_MEM_DATA_DIR)return process.env.CLAUDE_MEM_DATA_DIR;let t=A(Gn(),".claude-mem"),e=A(t,"settings.json");try{if(Ri(e)){let{readFileSync:r}=ks("fs"),o=JSON.parse(r(e,"utf-8")),s=o.env??o;if(s.CLAUDE_MEM_DATA_DIR)return s.CLAUDE_MEM_DATA_DIR}}catch{}return t}var gl,R,fe,St,fl,Cl,El,hl,Fl,Bi,Sl,yl,Ni,wl,vl,_l,xl,We=m(()=>{"use strict";T();gl=Oi();R=Li(),fe=process.env.CLAUDE_CONFIG_DIR||A(Gn(),".claude"),St=A(fe,"plugins","marketplaces","thedotmack"),fl=A(R,"archives"),Cl=A(R,"logs"),El=A(R,"trash"),hl=A(R,"backups"),Fl=A(R,"modes"),Bi=A(R,"settings.json"),Sl=A(R,"claude-mem.db"),yl=A(R,"vector-db"),Ni=A(R,"observer-sessions"),wl=Ti(Ni),vl=A(fe,"settings.json"),_l=A(fe,"commands"),xl=A(fe,"CLAUDE.md")});var Wn=m(()=>{"use strict";dr();We()});var Hn=m(()=>{"use strict"});import{spawn as Pl,spawnSync as ji}from"child_process";import{existsSync as Ui,mkdirSync as Kn,readFileSync as Jn,writeFileSync as Gi}from"fs";import{homedir as Wi}from"os";import yt from"path";function V(t){if(!Number.isInteger(t)||t<0||t===0)return!1;try{return process.kill(t,0),!0}catch(e){if(e instanceof Error){let r=e.code;return r==="EPERM"?!0:(a.debug("SYSTEM","PID check failed",{pid:t,code:r}),!1)}return a.warn("SYSTEM","PID check threw non-Error",{pid:t,error:String(e)}),!1}}function Vi(t){if(!Number.isInteger(t)||t<=0)return null;if(process.platform==="linux")try{let e=Jn(`/proc/${t}/stat`,"utf-8"),r=e.lastIndexOf(") ");if(r<0)return null;let s=e.slice(r+2).split(" ")[19];return s&&/^\d+$/.test(s)?s:null}catch(e){return a.debug("SYSTEM","captureProcessStartToken: /proc read failed",{pid:t,error:e instanceof Error?e.message:String(e)}),null}if(process.platform==="win32")return null;try{let e=ji("ps",["-p",String(t),"-o","lstart="],{encoding:"utf-8",timeout:2e3,env:{...process.env,LC_ALL:"C",LANG:"C"}});if(e.status!==0)return null;let r=e.stdout.trim();return r.length>0?r:null}catch(e){return a.debug("SYSTEM","captureProcessStartToken: ps exec failed",{pid:t,error:e instanceof Error?e.message:String(e)}),null}}function Yn(t){if(!t||!V(t.pid))return!1;if(!t.startToken)return!0;let e=Vi(t.pid);if(e===null)return!0;let r=e===t.startToken;return r||a.debug("SYSTEM","verifyPidFileOwnership: start-token mismatch (PID reused)",{pid:t.pid,stored:t.startToken,current:e}),r}function wt(){return pr||(pr=new mr),pr}var Hi,Ki,Ji,Yi,mr,pr,vt=m(()=>{"use strict";T();Hn();Hi=5e3,Ki=1e3,Ji=yt.join(Wi(),".claude-mem"),Yi=yt.join(Ji,"supervisor.json");mr=class{registryPath;entries=new Map;runtimeProcesses=new Map;initialized=!1;constructor(e=Yi){this.registryPath=e}initialize(){if(this.initialized)return;if(this.initialized=!0,Kn(yt.dirname(this.registryPath),{recursive:!0}),!Ui(this.registryPath)){this.persist();return}try{let o=JSON.parse(Jn(this.registryPath,"utf-8")).processes??{};for(let[s,i]of Object.entries(o))this.entries.set(s,i)}catch(r){r instanceof Error?a.warn("SYSTEM","Failed to parse supervisor registry, rebuilding",{path:this.registryPath},r):a.warn("SYSTEM","Failed to parse supervisor registry, rebuilding",{path:this.registryPath,error:String(r)}),this.entries.clear()}let e=this.pruneDeadEntries();e>0&&a.info("SYSTEM","Removed dead processes from supervisor registry",{removed:e}),this.persist()}register(e,r,o){this.initialize(),this.entries.set(e,r),o&&this.runtimeProcesses.set(e,o),this.persist()}unregister(e){this.initialize(),this.entries.delete(e),this.runtimeProcesses.delete(e),this.persist()}clear(){this.entries.clear(),this.runtimeProcesses.clear(),this.persist()}getAll(){return this.initialize(),Array.from(this.entries.entries()).map(([e,r])=>({id:e,...r})).sort((e,r)=>{let o=Date.parse(e.startedAt),s=Date.parse(r.startedAt);return(Number.isNaN(o)?0:o)-(Number.isNaN(s)?0:s)})}getBySession(e){let r=String(e);return this.getAll().filter(o=>o.sessionId!==void 0&&String(o.sessionId)===r)}getRuntimeProcess(e){return this.runtimeProcesses.get(e)}getByPid(e){return this.getAll().filter(r=>r.pid===e)}pruneDeadEntries(){this.initialize();let e=0;for(let[r,o]of this.entries)V(o.pid)||(this.entries.delete(r),this.runtimeProcesses.delete(r),e+=1);return e>0&&this.persist(),e}async reapSession(e){this.initialize();let r=this.getBySession(e);if(r.length===0)return 0;let o=typeof e=="number"?e:Number(e)||void 0;a.info("SYSTEM",`Reaping ${r.length} process(es) for session ${e}`,{sessionId:o,pids:r.map(u=>u.pid)});let s=r.filter(u=>V(u.pid));for(let u of s)try{typeof u.pgid=="number"&&process.platform!=="win32"?process.kill(-u.pgid,"SIGTERM"):process.kill(u.pid,"SIGTERM")}catch(c){c instanceof Error?c.code!=="ESRCH"&&a.debug("SYSTEM",`Failed to SIGTERM session process PID ${u.pid}`,{pid:u.pid,pgid:u.pgid},c):a.warn("SYSTEM",`Failed to SIGTERM session process PID ${u.pid} (non-Error)`,{pid:u.pid,pgid:u.pgid,error:String(c)})}let i=Date.now()+Hi;for(;Date.now()<i&&s.filter(c=>V(c.pid)).length!==0;)await new Promise(c=>setTimeout(c,100));let n=s.filter(u=>V(u.pid));for(let u of n){a.warn("SYSTEM",`Session process PID ${u.pid} did not exit after SIGTERM, sending SIGKILL`,{pid:u.pid,pgid:u.pgid,sessionId:o});try{typeof u.pgid=="number"&&process.platform!=="win32"?process.kill(-u.pgid,"SIGKILL"):process.kill(u.pid,"SIGKILL")}catch(c){c instanceof Error?c.code!=="ESRCH"&&a.debug("SYSTEM",`Failed to SIGKILL session process PID ${u.pid}`,{pid:u.pid,pgid:u.pgid},c):a.warn("SYSTEM",`Failed to SIGKILL session process PID ${u.pid} (non-Error)`,{pid:u.pid,pgid:u.pgid,error:String(c)})}}if(n.length>0){let u=Date.now()+Ki;for(;Date.now()<u&&n.filter(d=>V(d.pid)).length!==0;)await new Promise(d=>setTimeout(d,100))}for(let u of r)this.entries.delete(u.id),this.runtimeProcesses.delete(u.id);return this.persist(),a.info("SYSTEM",`Reaped ${r.length} process(es) for session ${e}`,{sessionId:o,reaped:r.length}),r.length}persist(){let e={processes:Object.fromEntries(this.entries.entries())};Kn(yt.dirname(this.registryPath),{recursive:!0}),Gi(this.registryPath,JSON.stringify(e,null,2))}},pr=null});import{execFile as Xi}from"child_process";import{rmSync as zi}from"fs";import{homedir as qi}from"os";import zn from"path";import{promisify as Zi}from"util";async function qn(t){let e=t.currentPid??process.pid,r=t.pidFilePath??tu,o=t.registry.getAll(),s=[...o].filter(n=>n.pid!==e).sort((n,u)=>Date.parse(u.startedAt)-Date.parse(n.startedAt));for(let n of s){if(!V(n.pid)){t.registry.unregister(n.id);continue}try{await Xn(n,"SIGTERM")}catch(u){u instanceof Error?a.debug("SYSTEM","Failed to send SIGTERM to child process",{pid:n.pid,pgid:n.pgid,type:n.type},u):a.warn("SYSTEM","Failed to send SIGTERM to child process (non-Error)",{pid:n.pid,pgid:n.pgid,type:n.type,error:String(u)})}}await Vn(s,5e3);let i=s.filter(n=>V(n.pid));for(let n of i)try{await Xn(n,"SIGKILL")}catch(u){u instanceof Error?a.debug("SYSTEM","Failed to force kill child process",{pid:n.pid,pgid:n.pgid,type:n.type},u):a.warn("SYSTEM","Failed to force kill child process (non-Error)",{pid:n.pid,pgid:n.pgid,type:n.type,error:String(u)})}await Vn(i,1e3);for(let n of s)t.registry.unregister(n.id);for(let n of o.filter(u=>u.pid===e))t.registry.unregister(n.id);try{zi(r,{force:!0})}catch(n){n instanceof Error?a.debug("SYSTEM","Failed to remove PID file during shutdown",{pidFilePath:r},n):a.warn("SYSTEM","Failed to remove PID file during shutdown (non-Error)",{pidFilePath:r,error:String(n)})}t.registry.pruneDeadEntries()}async function Vn(t,e){let r=Date.now()+e;for(;Date.now()<r;){if(t.filter(s=>V(s.pid)).length===0)return;await new Promise(s=>setTimeout(s,100))}}async function Xn(t,e){let{pid:r,pgid:o}=t;if(process.platform!=="win32"){try{typeof o=="number"?process.kill(-o,e):process.kill(r,e)}catch(n){if(n instanceof Error&&n.code==="ESRCH")return;throw n}return}if(e==="SIGTERM"){try{process.kill(r,e)}catch(n){if(n instanceof Error&&n.code==="ESRCH")return;throw n}return}let s=await ru();if(s){await new Promise((n,u)=>{s(r,e,c=>{if(!c){n();return}if(c.code==="ESRCH"){n();return}u(c)})});return}let i=["/PID",String(r),"/T"];e==="SIGKILL"&&i.push("/F"),await Qi("taskkill",i,{timeout:Ge.POWERSHELL_COMMAND,windowsHide:!0})}async function ru(){let t="tree-kill";try{let e=await import(t);return e.default??e}catch(e){return a.debug("SYSTEM","tree-kill module not available, using fallback",{},e instanceof Error?e:void 0),null}}var Qi,eu,tu,Zn=m(()=>{"use strict";T();Dr();vt();Qi=Zi(Xi),eu=zn.join(qi(),".claude-mem"),tu=zn.join(eu,"worker.pid")});function nu(){let e=wt().pruneDeadEntries();e>0&&a.info("SYSTEM",`Health check: pruned ${e} dead process(es) from registry`)}function eo(){Ce===null&&(Ce=setInterval(nu,Qn),Ce.unref(),a.debug("SYSTEM","Health checker started",{intervalMs:Qn}))}function to(){Ce!==null&&(clearInterval(Ce),Ce=null,a.debug("SYSTEM","Health checker stopped"))}var Qn,Ce,ro=m(()=>{"use strict";T();vt();Qn=3e4,Ce=null});import{existsSync as ou,readFileSync as su,rmSync as no}from"fs";import{homedir as iu}from"os";import oo from"path";function so(t={}){let e=t.pidFilePath??au;if(!ou(e))return"missing";let r=null;try{r=JSON.parse(su(e,"utf-8"))}catch(s){return s instanceof Error?a.warn("SYSTEM","Failed to parse worker PID file, removing it",{path:e},s):a.warn("SYSTEM","Failed to parse worker PID file, removing it",{path:e,error:String(s)}),no(e,{force:!0}),"invalid"}return Yn(r)&&r?((t.logAlive??!0)&&a.info("SYSTEM","Worker already running (PID alive)",{existingPid:r.pid,existingPort:r.port,startedAt:r.startedAt}),"alive"):(a.info("SYSTEM","Removing stale PID file (worker process is dead or PID has been reused)",{pid:r?.pid,port:r?.port,startedAt:r?.startedAt}),no(e,{force:!0}),"stale")}var uu,au,gr,uD,io=m(()=>{"use strict";T();vt();Zn();ro();uu=oo.join(iu(),".claude-mem"),au=oo.join(uu,"worker.pid"),gr=class{registry;started=!1;stopPromise=null;signalHandlersRegistered=!1;shutdownInitiated=!1;shutdownHandler=null;constructor(e){this.registry=e}async start(){if(this.started)return;if(this.registry.initialize(),so({logAlive:!1})==="alive")throw new Error("Worker already running");this.started=!0,eo()}configureSignalHandlers(e){if(this.shutdownHandler=e,this.signalHandlersRegistered)return;this.signalHandlersRegistered=!0;let r=async o=>{if(this.shutdownInitiated){a.warn("SYSTEM",`Received ${o} but shutdown already in progress`);return}this.shutdownInitiated=!0,a.info("SYSTEM",`Received ${o}, shutting down...`);try{this.shutdownHandler?await this.shutdownHandler():await this.stop()}catch(s){s instanceof Error?a.error("SYSTEM","Error during shutdown",{},s):a.error("SYSTEM","Error during shutdown (non-Error)",{error:String(s)});try{await this.stop()}catch(i){i instanceof Error?a.debug("SYSTEM","Supervisor shutdown fallback failed",{},i):a.debug("SYSTEM","Supervisor shutdown fallback failed",{error:String(i)})}}process.exit(0)};process.on("SIGTERM",()=>{r("SIGTERM")}),process.on("SIGINT",()=>{r("SIGINT")}),process.platform!=="win32"&&(process.argv.includes("--daemon")?process.on("SIGHUP",()=>{a.debug("SYSTEM","Ignoring SIGHUP in daemon mode")}):process.on("SIGHUP",()=>{r("SIGHUP")}))}async stop(){if(this.stopPromise){await this.stopPromise;return}to(),this.stopPromise=qn({registry:this.registry,currentPid:process.pid}).finally(()=>{this.started=!1,this.stopPromise=null}),await this.stopPromise}assertCanSpawn(e){if(this.stopPromise!==null)throw new Error(`Supervisor is shutting down, refusing to spawn ${e}`)}registerProcess(e,r,o){this.registry.register(e,r,o)}unregisterProcess(e){this.registry.unregister(e)}getRegistry(){return this.registry}},uD=new gr(wt())});import uo from"path";import{readFileSync as pD,existsSync as mD,writeFileSync as gD,renameSync as fD,mkdirSync as CD}from"fs";import{spawn as hD,execSync as FD}from"child_process";function lu(t,e={},r){return new Promise((o,s)=>{let i=setTimeout(()=>s(new Error(`Request timed out after ${r}ms`)),r);fetch(t,e).then(n=>{clearTimeout(i),o(n)},n=>{clearTimeout(i),s(n)})})}function He(){if(_t!==null)return _t;let t=uo.join(te.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=te.loadFromFile(t);return _t=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),_t}function Du(){if(xt!==null)return xt;let t=uo.join(te.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return xt=te.loadFromFile(t).CLAUDE_MEM_WORKER_HOST,xt}function du(t){return`http://${Du()}:${He()}${t}`}function kt(t,e={}){let r=e.method??"GET",o=e.timeoutMs??cu,s=du(t),i={method:r};return e.headers&&(i.headers=e.headers),e.body&&(i.body=e.body),o>0?lu(s,i,o):fetch(s,i)}var cu,_t,xt,At=m(()=>{"use strict";T();Dr();dr();We();Wn();io();cu=(()=>{let t=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(t){let e=parseInt(t,10);if(Number.isFinite(e)&&e>=500&&e<=3e5)return e;a.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:t,min:500,max:3e5})}return Ln(Ge.HEALTH_CHECK)})();_t=null,xt=null});import{existsSync as pu,readFileSync as mu,writeFileSync as ao,mkdirSync as co,renameSync as gu}from"fs";import{join as fr,basename as MD}from"path";function lo(t){try{return pu(t)?JSON.parse(mu(t,"utf-8")):{}}catch(e){return a.error("CONFIG","Failed to read Cursor registry, using empty registry",{file:t,error:e instanceof Error?e.message:String(e)}),{}}}function Do(t,e){let r=fr(t,"..");co(r,{recursive:!0}),ao(t,JSON.stringify(e,null,2))}function Cr(t,e){let r=fr(t,".cursor","rules"),o=fr(r,"claude-mem-context.mdc"),s=`${o}.tmp`;co(r,{recursive:!0});let i=`---
|
|
27
|
+
`)},info:(e,t)=>{H.message(e,{...t,symbol:u("blue",Fi)})},success:(e,t)=>{H.message(e,{...t,symbol:u("green",Li)})},step:(e,t)=>{H.message(e,{...t,symbol:u("green",Lt)})},warn:(e,t)=>{H.message(e,{...t,symbol:u("yellow",Ni)})},warning:(e,t)=>{H.warn(e,t)},error:(e,t)=>{H.message(e,{...t,symbol:u("red",Ui)})}},rt=(e="",t)=>{let r=t?.output??process.stdout,n=t?.withGuide??U.withGuide?`${u("gray",et)} `:"";r.write(`${n}${u("red",e)}
|
|
28
|
+
|
|
29
|
+
`)},Nt=(e="",t)=>{let r=t?.output??process.stdout,n=t?.withGuide??U.withGuide?`${u("gray",Ti)} `:"";r.write(`${n}${e}
|
|
30
|
+
`)},xe=(e="",t)=>{let r=t?.output??process.stdout,n=t?.withGuide??U.withGuide?`${u("gray",$)}
|
|
31
|
+
${u("gray",et)} `:"";r.write(`${n}${e}
|
|
32
|
+
|
|
33
|
+
`)},Ze=(e,t)=>e.split(`
|
|
34
|
+
`).map(r=>t(r)).join(`
|
|
35
|
+
`),ns=e=>{let t=(n,s)=>{let o=n.label??String(n.value);return s==="disabled"?`${u("gray",zn)} ${Ze(o,i=>u(["strikethrough","gray"],i))}${n.hint?` ${u("dim",`(${n.hint??"disabled"})`)}`:""}`:s==="active"?`${u("cyan",Ai)} ${o}${n.hint?` ${u("dim",`(${n.hint})`)}`:""}`:s==="selected"?`${u("green",qn)} ${Ze(o,i=>u("dim",i))}${n.hint?` ${u("dim",`(${n.hint})`)}`:""}`:s==="cancelled"?`${Ze(o,i=>u(["strikethrough","dim"],i))}`:s==="active-selected"?`${u("green",qn)} ${o}${n.hint?` ${u("dim",`(${n.hint})`)}`:""}`:s==="submitted"?`${Ze(o,i=>u("dim",i))}`:`${u("dim",zn)} ${Ze(o,i=>u("dim",i))}`},r=e.required??!0;return new Jn({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:r,cursorAt:e.cursorAt,validate(n){if(r&&(n===void 0||n.length===0))return`Please select at least one option.
|
|
36
|
+
${u("reset",u("dim",`Press ${u(["gray","bgWhite","inverse"]," space ")} to select, ${u("gray",u("bgWhite",u("inverse"," enter ")))} to submit`))}`},render(){let n=e.withGuide??U.withGuide,s=ze(e.output,e.message,n?`${ji(this.state)} `:"",`${rs(this.state)} `),o=`${n?`${u("gray",$)}
|
|
37
|
+
`:""}${s}
|
|
38
|
+
`,i=this.value??[],a=(c,p)=>{if(c.disabled)return t(c,"disabled");let m=i.includes(c.value);return p&&m?t(c,"active-selected"):m?t(c,"selected"):t(c,p?"active":"inactive")};switch(this.state){case"submit":{let c=this.options.filter(({value:m})=>i.includes(m)).map(m=>t(m,"submitted")).join(u("dim",", "))||u("dim","none"),p=ze(e.output,c,n?`${u("gray",$)} `:"");return`${o}${p}`}case"cancel":{let c=this.options.filter(({value:m})=>i.includes(m)).map(m=>t(m,"cancelled")).join(u("dim",", "));if(c.trim()==="")return`${o}${u("gray",$)}`;let p=ze(e.output,c,n?`${u("gray",$)} `:"");return`${o}${p}${n?`
|
|
39
|
+
${u("gray",$)}`:""}`}case"error":{let c=n?`${u("yellow",$)} `:"",p=this.error.split(`
|
|
40
|
+
`).map((g,E)=>E===0?`${n?`${u("yellow",et)} `:""}${u("yellow",g)}`:` ${g}`).join(`
|
|
41
|
+
`),m=o.split(`
|
|
42
|
+
`).length,d=p.split(`
|
|
43
|
+
`).length+1;return`${o}${c}${Qn({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:c.length,rowPadding:m+d,style:a}).join(`
|
|
44
|
+
${c}`)}
|
|
45
|
+
${p}
|
|
46
|
+
`}default:{let c=n?`${u("cyan",$)} `:"",p=o.split(`
|
|
47
|
+
`).length,m=n?2:1;return`${o}${c}${Qn({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:c.length,rowPadding:p+m,style:a}).join(`
|
|
48
|
+
${c}`)}
|
|
49
|
+
${n?u("cyan",et):""}
|
|
50
|
+
`}}}}).prompt()},Wi=e=>u("dim",e),Hi=(e,t,r)=>{let n={hard:!0,trim:!1},s=oe(e,t,n).split(`
|
|
51
|
+
`),o=s.reduce((c,p)=>Math.max(W(p),c),0),i=s.map(r).reduce((c,p)=>Math.max(W(p),c),0),a=t-(i-o);return oe(e,a,n)},nt=(e="",t="",r)=>{let n=r?.output??q.stdout,s=r?.withGuide??U.withGuide,o=r?.format??Wi,i=["",...Hi(e,qe(n)-6,o).split(`
|
|
52
|
+
`).map(o),""],a=W(t),c=Math.max(i.reduce((g,E)=>{let f=W(E);return f>g?f:g},0),a)+2,p=i.map(g=>`${u("gray",$)} ${g}${" ".repeat(c-W(g))}${u("gray",$)}`).join(`
|
|
53
|
+
`),m=s?`${u("gray",$)}
|
|
54
|
+
`:"",d=s?Di:Pi;n.write(`${m}${u("green",Lt)} ${u("reset",t)} ${u("gray",Zn.repeat(Math.max(c-a-1,1))+Ri)}
|
|
55
|
+
${p}
|
|
56
|
+
${u("gray",d+Zn.repeat(c+2)+Oi)}
|
|
57
|
+
`)},Bi=e=>u("magenta",e),Ki=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:n,errorMessage:s,frames:o=Ar?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:i=Ar?80:120,signal:a,...c}={})=>{let p=Mi(),m,d,g=!1,E=!1,f="",h,T=performance.now(),D=qe(r),P=c?.styleFrame??Bi,I=k=>{let X=k>1?s??U.messages.error:n??U.messages.cancel;E=k===1,g&&(Be(X,k),E&&typeof t=="function"&&t())},R=()=>I(2),w=()=>I(1),A=()=>{process.on("uncaughtExceptionMonitor",R),process.on("unhandledRejection",R),process.on("SIGINT",w),process.on("SIGTERM",w),process.on("exit",I),a&&a.addEventListener("abort",w)},C=()=>{process.removeListener("uncaughtExceptionMonitor",R),process.removeListener("unhandledRejection",R),process.removeListener("SIGINT",w),process.removeListener("SIGTERM",w),process.removeListener("exit",I),a&&a.removeEventListener("abort",w)},x=()=>{if(h===void 0)return;p&&r.write(`
|
|
58
|
+
`);let k=oe(h,D,{hard:!0,trim:!1}).split(`
|
|
59
|
+
`);k.length>1&&r.write(Qe.cursor.up(k.length-1)),r.write(Qe.cursor.to(0)),r.write(Qe.erase.down())},ce=k=>k.replace(/\.+$/,""),ye=k=>{let X=(performance.now()-k)/1e3,le=Math.floor(X/60),ue=Math.floor(X%60);return le>0?`[${le}m ${ue}s]`:`[${ue}s]`},we=c.withGuide??U.withGuide,Vo=(k="")=>{g=!0,m=Kn({output:r}),f=ce(k),T=performance.now(),we&&r.write(`${u("gray",$)}
|
|
60
|
+
`);let X=0,le=0;A(),d=setInterval(()=>{if(p&&f===h)return;x(),h=f;let ue=P(o[X]),$t;if(p)$t=`${ue} ${f}...`;else if(e==="timer")$t=`${ue} ${f} ${ye(T)}`;else{let Yo=".".repeat(Math.floor(le)).slice(0,3);$t=`${ue} ${f}${Yo}`}let Jo=oe($t,D,{hard:!0,trim:!1});r.write(Jo),X=X+1<o.length?X+1:0,le=le<4?le+.125:0},i)},Be=(k="",X=0,le=!1)=>{if(!g)return;g=!1,clearInterval(d),x();let ue=X===0?u("green",Lt):X===1?u("red",es):u("red",ts);f=k??f,le||(e==="timer"?r.write(`${ue} ${f} ${ye(T)}
|
|
61
|
+
`):r.write(`${ue} ${f}
|
|
62
|
+
`)),C(),m()};return{start:Vo,stop:(k="")=>Be(k,0),message:(k="")=>{f=ce(k??f)},cancel:(k="")=>Be(k,1),error:(k="")=>Be(k,2),clear:()=>Be("",0,!0),get isCancelled(){return E}}},Au={light:v("\u2500","-"),heavy:v("\u2501","="),block:v("\u2588","#")},Ru=`${u("gray",$)} `,Ut=async(e,t)=>{for(let r of e){if(r.enabled===!1)continue;let n=Ki(t);n.start(r.title);let s=await r.task(n.message);n.stop(s||r.title)}}});import{execSync as Vi}from"child_process";import{existsSync as te,readdirSync as Ji}from"fs";import{homedir as os}from"os";import{join as re}from"path";function st(e){try{return Vi(`${de?"where":"which"} ${e}`,{stdio:"pipe"}),!0}catch(t){return process.env.DEBUG&&console.error(`[ide-detection] ${e} not in PATH:`,t instanceof Error?t.message:String(t)),!1}}function Yi(e){let t=re(os(),".vscode","extensions");if(!te(t))return!1;try{return Ji(t).some(n=>n.toLowerCase().includes(e.toLowerCase()))}catch(r){return console.warn("[ide-detection] Failed to read VS Code extensions directory:",r instanceof Error?r.message:String(r)),!1}}function ot(){let e=os();return[{id:"claude-code",label:"Claude Code",detected:te(re(e,".claude")),supported:!0,hint:"recommended"},{id:"gemini-cli",label:"Gemini CLI",detected:te(re(e,".gemini")),supported:!0},{id:"opencode",label:"OpenCode",detected:te(re(e,".config","opencode"))||st("opencode"),supported:!0,hint:"plugin-based integration"},{id:"openclaw",label:"OpenClaw",detected:te(re(e,".openclaw")),supported:!0,hint:"plugin-based integration"},{id:"windsurf",label:"Windsurf",detected:te(re(e,".codeium","windsurf")),supported:!0},{id:"codex-cli",label:"Codex CLI",detected:te(re(e,".codex")),supported:!0,hint:"transcript-based integration"},{id:"cursor",label:"Cursor",detected:te(re(e,".cursor")),supported:!0,hint:"hooks + MCP integration"},{id:"copilot-cli",label:"Copilot CLI",detected:st("copilot"),supported:!0,hint:"MCP-based integration"},{id:"antigravity",label:"Antigravity",detected:te(re(e,".gemini","antigravity")),supported:!0,hint:"MCP-based integration"},{id:"goose",label:"Goose",detected:te(re(e,".config","goose"))||st("goose"),supported:!0,hint:"MCP-based integration"},{id:"crush",label:"Crush",detected:st("crush"),supported:!0,hint:"MCP-based integration"},{id:"roo-code",label:"Roo Code",detected:Yi("roo-code"),supported:!0,hint:"MCP-based integration"},{id:"warp",label:"Warp",detected:te(re(e,".warp"))||st("warp"),supported:!0,hint:"MCP-based integration"}]}var is=S(()=>{"use strict";_e()});import{appendFileSync as Xi,existsSync as as,mkdirSync as qi,readFileSync as zi}from"fs";import{join as jt}from"path";import{homedir as Zi}from"os";var Dr,cs,Or,l,K=S(()=>{"use strict";Dr=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o[o.SILENT=4]="SILENT",o))(Dr||{}),cs=jt(Zi(),".claude-mem"),Or=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let t=jt(cs,"logs");as(t)||qi(t,{recursive:!0});let r=new Date().toISOString().split("T")[0];this.logFilePath=jt(t,`claude-mem-${r}.log`)}catch(t){console.error("[LOGGER] Failed to initialize log file:",t instanceof Error?t.message:String(t)),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let t=jt(cs,"settings.json");if(as(t)){let r=zi(t,"utf-8"),s=(JSON.parse(r).CLAUDE_MEM_LOG_LEVEL||"INFO").toUpperCase();this.level=Dr[s]??1}else this.level=1}catch(t){console.error("[LOGGER] Failed to load log level from settings:",t instanceof Error?t.message:String(t)),this.level=1}return this.level}correlationId(t,r){return`obs-${t}-${r}`}sessionId(t){return`session-${t}`}formatData(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return t.toString();if(typeof t=="object"){if(t instanceof Error)return this.getLevel()===0?`${t.message}
|
|
63
|
+
${t.stack}`:t.message;if(Array.isArray(t))return`[${t.length} items]`;let r=Object.keys(t);return r.length===0?"{}":r.length<=3?JSON.stringify(t):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(t)}formatTool(t,r){if(!r)return t;let n=r;if(typeof r=="string")try{n=JSON.parse(r)}catch{n=r}if(t==="Bash"&&n.command)return`${t}(${n.command})`;if(n.file_path)return`${t}(${n.file_path})`;if(n.notebook_path)return`${t}(${n.notebook_path})`;if(t==="Glob"&&n.pattern)return`${t}(${n.pattern})`;if(t==="Grep"&&n.pattern)return`${t}(${n.pattern})`;if(n.url)return`${t}(${n.url})`;if(n.query)return`${t}(${n.query})`;if(t==="Task"){if(n.subagent_type)return`${t}(${n.subagent_type})`;if(n.description)return`${t}(${n.description})`}return t==="Skill"&&n.skill?`${t}(${n.skill})`:t==="LSP"&&n.operation?`${t}(${n.operation})`:t}formatTimestamp(t){let r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),a=String(t.getSeconds()).padStart(2,"0"),c=String(t.getMilliseconds()).padStart(3,"0");return`${r}-${n}-${s} ${o}:${i}:${a}.${c}`}log(t,r,n,s,o){if(t<this.getLevel())return;this.ensureLogFileInitialized();let i=this.formatTimestamp(new Date),a=Dr[t].padEnd(5),c=r.padEnd(6),p="";s?.correlationId?p=`[${s.correlationId}] `:s?.sessionId&&(p=`[session-${s.sessionId}] `);let m="";o!=null&&(o instanceof Error?m=this.getLevel()===0?`
|
|
64
|
+
${o.message}
|
|
65
|
+
${o.stack}`:` ${o.message}`:this.getLevel()===0&&typeof o=="object"?m=`
|
|
66
|
+
`+JSON.stringify(o,null,2):m=" "+this.formatData(o));let d="";if(s){let{sessionId:E,memorySessionId:f,correlationId:h,...T}=s;Object.keys(T).length>0&&(d=` {${Object.entries(T).map(([P,I])=>`${P}=${I}`).join(", ")}}`)}let g=`[${i}] [${a}] [${c}] ${p}${n}${d}${m}`;if(this.logFilePath)try{Xi(this.logFilePath,g+`
|
|
67
|
+
`,"utf8")}catch(E){process.stderr.write(`[LOGGER] Failed to write to log file: ${E instanceof Error?E.message:String(E)}
|
|
68
|
+
`)}else process.stderr.write(g+`
|
|
69
|
+
`)}debug(t,r,n,s){this.log(0,t,r,n,s)}info(t,r,n,s){this.log(1,t,r,n,s)}warn(t,r,n,s){this.log(2,t,r,n,s)}error(t,r,n,s){this.log(3,t,r,n,s)}dataIn(t,r,n,s){this.info(t,`\u2192 ${r}`,n,s)}dataOut(t,r,n,s){this.info(t,`\u2190 ${r}`,n,s)}success(t,r,n,s){this.info(t,`\u2713 ${r}`,n,s)}failure(t,r,n,s){this.error(t,`\u2717 ${r}`,n,s)}timing(t,r,n,s){this.info(t,`\u23F1 ${r}`,s,{duration:`${n}ms`})}happyPathError(t,r,n,s,o=""){let p=((new Error().stack||"").split(`
|
|
70
|
+
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),m=p?`${p[1].split("/").pop()}:${p[2]}`:"unknown",d={...n,location:m};return this.warn(t,`[HAPPY-PATH] ${r}`,d,s),o}},l=new Or});function ls(e){return process.platform==="win32"?Math.round(e*it.WINDOWS_MULTIPLIER):e}var it,Pr=S(()=>{"use strict";it={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:15e3,READINESS_WAIT:3e4,PORT_IN_USE_WAIT:3e3,WORKER_STARTUP_WAIT:1e3,PRE_RESTART_SETTLE_DELAY:2e3,POWERSHELL_COMMAND:1e4,WINDOWS_MULTIPLIER:1.5}});import{readFileSync as Qi,writeFileSync as us,existsSync as ds,mkdirSync as ea}from"fs";import{join as ps,dirname as ta}from"path";import{homedir as ms}from"os";var fe,Fr=S(()=>{"use strict";fe=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-6",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:String(37700+(process.getuid?.()??77)%100),CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_CLAUDE_AUTH_METHOD:"cli",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_GEMINI_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_GEMINI_MAX_TOKENS:"100000",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_OPENROUTER_MAX_TOKENS:"100000",CLAUDE_MEM_DATA_DIR:ps(ms(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_FULL_COUNT:"0",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false",CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT:"true",CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED:"false",CLAUDE_MEM_FOLDER_USE_LOCAL_MD:"false",CLAUDE_MEM_TRANSCRIPTS_ENABLED:"true",CLAUDE_MEM_TRANSCRIPTS_CONFIG_PATH:ps(ms(),".claude-mem","transcript-watch.json"),CLAUDE_MEM_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_HOOK_FAIL_LOUD_THRESHOLD:"3",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",CLAUDE_MEM_SEMANTIC_INJECT:"false",CLAUDE_MEM_SEMANTIC_INJECT_LIMIT:"5",CLAUDE_MEM_TIER_ROUTING_ENABLED:"true",CLAUDE_MEM_TIER_SIMPLE_MODEL:"haiku",CLAUDE_MEM_TIER_SUMMARY_MODEL:"",CLAUDE_MEM_CHROMA_ENABLED:"true",CLAUDE_MEM_CHROMA_MODE:"local",CLAUDE_MEM_CHROMA_HOST:"127.0.0.1",CLAUDE_MEM_CHROMA_PORT:"8000",CLAUDE_MEM_CHROMA_SSL:"false",CLAUDE_MEM_CHROMA_API_KEY:"",CLAUDE_MEM_CHROMA_TENANT:"default_tenant",CLAUDE_MEM_CHROMA_DATABASE:"default_database",CLAUDE_MEM_TELEGRAM_ENABLED:"true",CLAUDE_MEM_TELEGRAM_BOT_TOKEN:"",CLAUDE_MEM_TELEGRAM_CHAT_ID:"",CLAUDE_MEM_TELEGRAM_TRIGGER_TYPES:"security_alert",CLAUDE_MEM_TELEGRAM_TRIGGER_CONCEPTS:""};static getAllDefaults(){return{...this.DEFAULTS}}static get(t){return process.env[t]??this.DEFAULTS[t]}static getInt(t){let r=this.get(t);return parseInt(r,10)}static getBool(t){let r=this.get(t);return r==="true"||r===!0}static applyEnvOverrides(t){let r={...t};for(let n of Object.keys(this.DEFAULTS))process.env[n]!==void 0&&(r[n]=process.env[n]);return r}static loadFromFile(t){try{if(!ds(t)){let i=this.getAllDefaults();try{let a=ta(t);ds(a)||ea(a,{recursive:!0}),us(t,JSON.stringify(i,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",t)}catch(a){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",t,a instanceof Error?a.message:String(a))}return this.applyEnvOverrides(i)}let r=Qi(t,"utf-8"),n=JSON.parse(r),s=n;if(n.env&&typeof n.env=="object"){s=n.env;try{us(t,JSON.stringify(s,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",t)}catch(i){console.warn("[SETTINGS] Failed to auto-migrate settings file:",t,i instanceof Error?i.message:String(i))}}let o={...this.DEFAULTS};for(let i of Object.keys(this.DEFAULTS))s[i]!==void 0&&(o[i]=s[i]);return this.applyEnvOverrides(o)}catch(r){return console.warn("[SETTINGS] Failed to load settings, using defaults:",t,r instanceof Error?r.message:String(r)),this.applyEnvOverrides(this.getAllDefaults())}}}});import{join as j,dirname as ra,basename as na}from"path";import{homedir as gs}from"os";import{existsSync as sa,mkdirSync as Qu}from"fs";import{execSync as td}from"child_process";import{fileURLToPath as oa}from"url";function ia(){return typeof __dirname<"u"?__dirname:ra(oa(import.meta.url))}function aa(){if(process.env.CLAUDE_MEM_DATA_DIR)return process.env.CLAUDE_MEM_DATA_DIR;let e=j(gs(),".claude-mem"),t=j(e,"settings.json");try{if(sa(t)){let{readFileSync:r}=ei("fs"),n=JSON.parse(r(t,"utf-8")),s=n.env??n;if(s.CLAUDE_MEM_DATA_DIR)return s.CLAUDE_MEM_DATA_DIR}}catch{}return e}var sd,V,Te,Gt,od,id,ad,cd,ld,ca,ud,dd,la,pd,md,gd,fd,at=S(()=>{"use strict";K();sd=ia();V=aa(),Te=process.env.CLAUDE_CONFIG_DIR||j(gs(),".claude"),Gt=j(Te,"plugins","marketplaces","thedotmack"),od=j(V,"archives"),id=j(V,"logs"),ad=j(V,"trash"),cd=j(V,"backups"),ld=j(V,"modes"),ca=j(V,"settings.json"),ud=j(V,"claude-mem.db"),dd=j(V,"vector-db"),la=j(V,"observer-sessions"),pd=na(la),md=j(Te,"settings.json"),gd=j(Te,"commands"),fd=j(Te,"CLAUDE.md")});var fs=S(()=>{"use strict";Fr();at()});var hs=S(()=>{"use strict"});import{spawn as xd,spawnSync as ua}from"child_process";import{existsSync as da,mkdirSync as Es,readFileSync as Ss,writeFileSync as pa}from"fs";import{homedir as ma}from"os";import Wt from"path";function ie(e){if(!Number.isInteger(e)||e<0||e===0)return!1;try{return process.kill(e,0),!0}catch(t){if(t instanceof Error){let r=t.code;return r==="EPERM"?!0:(l.debug("SYSTEM","PID check failed",{pid:e,code:r}),!1)}return l.warn("SYSTEM","PID check threw non-Error",{pid:e,error:String(t)}),!1}}function Sa(e){if(!Number.isInteger(e)||e<=0)return null;if(process.platform==="linux")try{let t=Ss(`/proc/${e}/stat`,"utf-8"),r=t.lastIndexOf(") ");if(r<0)return null;let s=t.slice(r+2).split(" ")[19];return s&&/^\d+$/.test(s)?s:null}catch(t){return l.debug("SYSTEM","captureProcessStartToken: /proc read failed",{pid:e,error:t instanceof Error?t.message:String(t)}),null}if(process.platform==="win32")return null;try{let t=ua("ps",["-p",String(e),"-o","lstart="],{encoding:"utf-8",timeout:2e3,env:{...process.env,LC_ALL:"C",LANG:"C"}});if(t.status!==0)return null;let r=t.stdout.trim();return r.length>0?r:null}catch(t){return l.debug("SYSTEM","captureProcessStartToken: ps exec failed",{pid:e,error:t instanceof Error?t.message:String(t)}),null}}function Cs(e){if(!e||!ie(e.pid))return!1;if(!e.startToken)return!0;let t=Sa(e.pid);if(t===null)return!0;let r=t===e.startToken;return r||l.debug("SYSTEM","verifyPidFileOwnership: start-token mismatch (PID reused)",{pid:e.pid,stored:e.startToken,current:t}),r}function Ht(){return Lr||(Lr=new Nr),Lr}var ga,fa,ha,Ea,Nr,Lr,Bt=S(()=>{"use strict";K();hs();ga=5e3,fa=1e3,ha=Wt.join(ma(),".claude-mem"),Ea=Wt.join(ha,"supervisor.json");Nr=class{registryPath;entries=new Map;runtimeProcesses=new Map;initialized=!1;constructor(t=Ea){this.registryPath=t}initialize(){if(this.initialized)return;if(this.initialized=!0,Es(Wt.dirname(this.registryPath),{recursive:!0}),!da(this.registryPath)){this.persist();return}try{let n=JSON.parse(Ss(this.registryPath,"utf-8")).processes??{};for(let[s,o]of Object.entries(n))this.entries.set(s,o)}catch(r){r instanceof Error?l.warn("SYSTEM","Failed to parse supervisor registry, rebuilding",{path:this.registryPath},r):l.warn("SYSTEM","Failed to parse supervisor registry, rebuilding",{path:this.registryPath,error:String(r)}),this.entries.clear()}let t=this.pruneDeadEntries();t>0&&l.info("SYSTEM","Removed dead processes from supervisor registry",{removed:t}),this.persist()}register(t,r,n){this.initialize(),this.entries.set(t,r),n&&this.runtimeProcesses.set(t,n),this.persist()}unregister(t){this.initialize(),this.entries.delete(t),this.runtimeProcesses.delete(t),this.persist()}clear(){this.entries.clear(),this.runtimeProcesses.clear(),this.persist()}getAll(){return this.initialize(),Array.from(this.entries.entries()).map(([t,r])=>({id:t,...r})).sort((t,r)=>{let n=Date.parse(t.startedAt),s=Date.parse(r.startedAt);return(Number.isNaN(n)?0:n)-(Number.isNaN(s)?0:s)})}getBySession(t){let r=String(t);return this.getAll().filter(n=>n.sessionId!==void 0&&String(n.sessionId)===r)}getRuntimeProcess(t){return this.runtimeProcesses.get(t)}getByPid(t){return this.getAll().filter(r=>r.pid===t)}pruneDeadEntries(){this.initialize();let t=0;for(let[r,n]of this.entries)ie(n.pid)||(this.entries.delete(r),this.runtimeProcesses.delete(r),t+=1);return t>0&&this.persist(),t}async reapSession(t){this.initialize();let r=this.getBySession(t);if(r.length===0)return 0;let n=typeof t=="number"?t:Number(t)||void 0;l.info("SYSTEM",`Reaping ${r.length} process(es) for session ${t}`,{sessionId:n,pids:r.map(a=>a.pid)});let s=r.filter(a=>ie(a.pid));for(let a of s)try{typeof a.pgid=="number"&&process.platform!=="win32"?process.kill(-a.pgid,"SIGTERM"):process.kill(a.pid,"SIGTERM")}catch(c){c instanceof Error?c.code!=="ESRCH"&&l.debug("SYSTEM",`Failed to SIGTERM session process PID ${a.pid}`,{pid:a.pid,pgid:a.pgid},c):l.warn("SYSTEM",`Failed to SIGTERM session process PID ${a.pid} (non-Error)`,{pid:a.pid,pgid:a.pgid,error:String(c)})}let o=Date.now()+ga;for(;Date.now()<o&&s.filter(c=>ie(c.pid)).length!==0;)await new Promise(c=>setTimeout(c,100));let i=s.filter(a=>ie(a.pid));for(let a of i){l.warn("SYSTEM",`Session process PID ${a.pid} did not exit after SIGTERM, sending SIGKILL`,{pid:a.pid,pgid:a.pgid,sessionId:n});try{typeof a.pgid=="number"&&process.platform!=="win32"?process.kill(-a.pgid,"SIGKILL"):process.kill(a.pid,"SIGKILL")}catch(c){c instanceof Error?c.code!=="ESRCH"&&l.debug("SYSTEM",`Failed to SIGKILL session process PID ${a.pid}`,{pid:a.pid,pgid:a.pgid},c):l.warn("SYSTEM",`Failed to SIGKILL session process PID ${a.pid} (non-Error)`,{pid:a.pid,pgid:a.pgid,error:String(c)})}}if(i.length>0){let a=Date.now()+fa;for(;Date.now()<a&&i.filter(p=>ie(p.pid)).length!==0;)await new Promise(p=>setTimeout(p,100))}for(let a of r)this.entries.delete(a.id),this.runtimeProcesses.delete(a.id);return this.persist(),l.info("SYSTEM",`Reaped ${r.length} process(es) for session ${t}`,{sessionId:n,reaped:r.length}),r.length}persist(){let t={processes:Object.fromEntries(this.entries.entries())};Es(Wt.dirname(this.registryPath),{recursive:!0}),pa(this.registryPath,JSON.stringify(t,null,2))}},Lr=null});import{execFile as Ca}from"child_process";import{rmSync as ya}from"fs";import{homedir as wa}from"os";import vs from"path";import{promisify as va}from"util";async function _s(e){let t=e.currentPid??process.pid,r=e.pidFilePath??$a,n=e.registry.getAll(),s=[...n].filter(i=>i.pid!==t).sort((i,a)=>Date.parse(a.startedAt)-Date.parse(i.startedAt));for(let i of s){if(!ie(i.pid)){e.registry.unregister(i.id);continue}try{await ws(i,"SIGTERM")}catch(a){a instanceof Error?l.debug("SYSTEM","Failed to send SIGTERM to child process",{pid:i.pid,pgid:i.pgid,type:i.type},a):l.warn("SYSTEM","Failed to send SIGTERM to child process (non-Error)",{pid:i.pid,pgid:i.pgid,type:i.type,error:String(a)})}}await ys(s,5e3);let o=s.filter(i=>ie(i.pid));for(let i of o)try{await ws(i,"SIGKILL")}catch(a){a instanceof Error?l.debug("SYSTEM","Failed to force kill child process",{pid:i.pid,pgid:i.pgid,type:i.type},a):l.warn("SYSTEM","Failed to force kill child process (non-Error)",{pid:i.pid,pgid:i.pgid,type:i.type,error:String(a)})}await ys(o,1e3);for(let i of s)e.registry.unregister(i.id);for(let i of n.filter(a=>a.pid===t))e.registry.unregister(i.id);try{ya(r,{force:!0})}catch(i){i instanceof Error?l.debug("SYSTEM","Failed to remove PID file during shutdown",{pidFilePath:r},i):l.warn("SYSTEM","Failed to remove PID file during shutdown (non-Error)",{pidFilePath:r,error:String(i)})}e.registry.pruneDeadEntries()}async function ys(e,t){let r=Date.now()+t;for(;Date.now()<r;){if(e.filter(s=>ie(s.pid)).length===0)return;await new Promise(s=>setTimeout(s,100))}}async function ws(e,t){let{pid:r,pgid:n}=e;if(process.platform!=="win32"){try{typeof n=="number"?process.kill(-n,t):process.kill(r,t)}catch(i){if(i instanceof Error&&i.code==="ESRCH")return;throw i}return}if(t==="SIGTERM"){try{process.kill(r,t)}catch(i){if(i instanceof Error&&i.code==="ESRCH")return;throw i}return}let s=await Ia();if(s){await new Promise((i,a)=>{s(r,t,c=>{if(!c){i();return}if(c.code==="ESRCH"){i();return}a(c)})});return}let o=["/PID",String(r),"/T"];t==="SIGKILL"&&o.push("/F"),await _a("taskkill",o,{timeout:it.POWERSHELL_COMMAND,windowsHide:!0})}async function Ia(){let e="tree-kill";try{let t=await import(e);return t.default??t}catch(t){return l.debug("SYSTEM","tree-kill module not available, using fallback",{},t instanceof Error?t:void 0),null}}var _a,xa,$a,xs=S(()=>{"use strict";K();Pr();Bt();_a=va(Ca),xa=vs.join(wa(),".claude-mem"),$a=vs.join(xa,"worker.pid")});function ka(){let t=Ht().pruneDeadEntries();t>0&&l.info("SYSTEM",`Health check: pruned ${t} dead process(es) from registry`)}function Is(){Ae===null&&(Ae=setInterval(ka,$s),Ae.unref(),l.debug("SYSTEM","Health checker started",{intervalMs:$s}))}function ks(){Ae!==null&&(clearInterval(Ae),Ae=null,l.debug("SYSTEM","Health checker stopped"))}var $s,Ae,Ms=S(()=>{"use strict";K();Bt();$s=3e4,Ae=null});import{existsSync as Ma,readFileSync as ba,rmSync as bs}from"fs";import{homedir as Ta}from"os";import Ts from"path";function As(e={}){let t=e.pidFilePath??Ra;if(!Ma(t))return"missing";let r=null;try{r=JSON.parse(ba(t,"utf-8"))}catch(s){return s instanceof Error?l.warn("SYSTEM","Failed to parse worker PID file, removing it",{path:t},s):l.warn("SYSTEM","Failed to parse worker PID file, removing it",{path:t,error:String(s)}),bs(t,{force:!0}),"invalid"}return Cs(r)&&r?((e.logAlive??!0)&&l.info("SYSTEM","Worker already running (PID alive)",{existingPid:r.pid,existingPort:r.port,startedAt:r.startedAt}),"alive"):(l.info("SYSTEM","Removing stale PID file (worker process is dead or PID has been reused)",{pid:r?.pid,port:r?.port,startedAt:r?.startedAt}),bs(t,{force:!0}),"stale")}var Aa,Ra,Ur,qd,Rs=S(()=>{"use strict";K();Bt();xs();Ms();Aa=Ts.join(Ta(),".claude-mem"),Ra=Ts.join(Aa,"worker.pid"),Ur=class{registry;started=!1;stopPromise=null;signalHandlersRegistered=!1;shutdownInitiated=!1;shutdownHandler=null;constructor(t){this.registry=t}async start(){if(this.started)return;if(this.registry.initialize(),As({logAlive:!1})==="alive")throw new Error("Worker already running");this.started=!0,Is()}configureSignalHandlers(t){if(this.shutdownHandler=t,this.signalHandlersRegistered)return;this.signalHandlersRegistered=!0;let r=async n=>{if(this.shutdownInitiated){l.warn("SYSTEM",`Received ${n} but shutdown already in progress`);return}this.shutdownInitiated=!0,l.info("SYSTEM",`Received ${n}, shutting down...`);try{this.shutdownHandler?await this.shutdownHandler():await this.stop()}catch(s){s instanceof Error?l.error("SYSTEM","Error during shutdown",{},s):l.error("SYSTEM","Error during shutdown (non-Error)",{error:String(s)});try{await this.stop()}catch(o){o instanceof Error?l.debug("SYSTEM","Supervisor shutdown fallback failed",{},o):l.debug("SYSTEM","Supervisor shutdown fallback failed",{error:String(o)})}}process.exit(0)};process.on("SIGTERM",()=>{r("SIGTERM")}),process.on("SIGINT",()=>{r("SIGINT")}),process.platform!=="win32"&&(process.argv.includes("--daemon")?process.on("SIGHUP",()=>{l.debug("SYSTEM","Ignoring SIGHUP in daemon mode")}):process.on("SIGHUP",()=>{r("SIGHUP")}))}async stop(){if(this.stopPromise){await this.stopPromise;return}ks(),this.stopPromise=_s({registry:this.registry,currentPid:process.pid}).finally(()=>{this.started=!1,this.stopPromise=null}),await this.stopPromise}assertCanSpawn(t){if(this.stopPromise!==null)throw new Error(`Supervisor is shutting down, refusing to spawn ${t}`)}registerProcess(t,r,n){this.registry.register(t,r,n)}unregisterProcess(t){this.registry.unregister(t)}getRegistry(){return this.registry}},qd=new Ur(Ht())});import Ds from"path";import{readFileSync as rp,existsSync as np,writeFileSync as sp,renameSync as op,mkdirSync as ip}from"fs";import{spawn as cp,execSync as lp}from"child_process";function Oa(e,t={},r){return new Promise((n,s)=>{let o=setTimeout(()=>s(new Error(`Request timed out after ${r}ms`)),r);fetch(e,t).then(i=>{clearTimeout(o),n(i)},i=>{clearTimeout(o),s(i)})})}function ct(){if(Kt!==null)return Kt;let e=Ds.join(fe.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),t=fe.loadFromFile(e);return Kt=parseInt(t.CLAUDE_MEM_WORKER_PORT,10),Kt}function Pa(){if(Vt!==null)return Vt;let e=Ds.join(fe.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return Vt=fe.loadFromFile(e).CLAUDE_MEM_WORKER_HOST,Vt}function Fa(e){return`http://${Pa()}:${ct()}${e}`}function Jt(e,t={}){let r=t.method??"GET",n=t.timeoutMs??Da,s=Fa(e),o={method:r};return t.headers&&(o.headers=t.headers),t.body&&(o.body=t.body),n>0?Oa(s,o,n):fetch(s,o)}var Da,Kt,Vt,Yt=S(()=>{"use strict";K();Pr();Fr();at();fs();Rs();Da=(()=>{let e=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(e){let t=parseInt(e,10);if(Number.isFinite(t)&&t>=500&&t<=3e5)return t;l.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:e,min:500,max:3e5})}return ls(it.HEALTH_CHECK)})();Kt=null,Vt=null});import{existsSync as La,readFileSync as Na,writeFileSync as Os,mkdirSync as Ps,renameSync as Ua}from"fs";import{join as jr,basename as Cp}from"path";function Fs(e){try{return La(e)?JSON.parse(Na(e,"utf-8")):{}}catch(t){return l.error("CONFIG","Failed to read Cursor registry, using empty registry",{file:e,error:t instanceof Error?t.message:String(t)}),{}}}function Ls(e,t){let r=jr(e,"..");Ps(r,{recursive:!0}),Os(e,JSON.stringify(t,null,2))}function Gr(e,t){let r=jr(e,".cursor","rules"),n=jr(r,"claude-mem-context.mdc"),s=`${n}.tmp`;Ps(r,{recursive:!0});let o=`---
|
|
63
71
|
alwaysApply: true
|
|
64
72
|
description: "Claude-mem context from past sessions (auto-updated)"
|
|
65
73
|
---
|
|
@@ -68,14 +76,14 @@ description: "Claude-mem context from past sessions (auto-updated)"
|
|
|
68
76
|
|
|
69
77
|
The following context is from claude-mem, a persistent memory system that tracks your coding sessions.
|
|
70
78
|
|
|
71
|
-
${
|
|
79
|
+
${t}
|
|
72
80
|
|
|
73
81
|
---
|
|
74
82
|
*Updated after last session. Use claude-mem's MCP search tools for more detailed queries.*
|
|
75
|
-
`;
|
|
76
|
-
Installing Claude-Mem Cursor hooks (${
|
|
77
|
-
`);let
|
|
78
|
-
Installation failed: ${
|
|
83
|
+
`;Os(s,o),Ua(s,n)}var Ns=S(()=>{"use strict";K()});var Js={};se(Js,{checkCursorHooksStatus:()=>Vs,configureCursorMcp:()=>Ka,detectClaudeCode:()=>qa,detectPlatform:()=>Gs,findBunPath:()=>De,findMcpServerPath:()=>lt,findWorkerServicePath:()=>Re,getScriptExtension:()=>Ha,getTargetDir:()=>zt,handleCursorCommand:()=>za,installCursorHooks:()=>Bs,readCursorRegistry:()=>qt,registerCursorProject:()=>Ws,uninstallCursorHooks:()=>Ks,unregisterCursorProject:()=>Hs,updateCursorContextForProject:()=>Ba,writeCursorRegistry:()=>Kr});import y from"path";import{homedir as Xt}from"os";import{existsSync as z,readFileSync as Us,writeFileSync as Hr,unlinkSync as Wr,mkdirSync as Br}from"fs";import{exec as ja}from"child_process";import{promisify as Ga}from"util";function Gs(){return process.platform==="win32"?"windows":"unix"}function Ha(){return Gs()==="windows"?".ps1":".sh"}function qt(){return Fs(js)}function Kr(e){Ls(js,e)}function Ws(e,t){let r=qt();r[e]={workspacePath:t,installedAt:new Date().toISOString()},Kr(r),l.info("CURSOR","Registered project for auto-context updates",{projectName:e,workspacePath:t})}function Hs(e){let t=qt();t[e]&&(delete t[e],Kr(t),l.info("CURSOR","Unregistered project",{projectName:e}))}async function Ba(e,t){let n=qt()[e];if(n)try{let s=await Jt(`/api/context/inject?project=${encodeURIComponent(e)}`);if(!s.ok)return;let o=await s.text();if(!o||!o.trim())return;Gr(n.workspacePath,o),l.debug("CURSOR","Updated context file",{projectName:e,workspacePath:n.workspacePath})}catch(s){s instanceof Error?l.error("WORKER","Failed to update context file",{projectName:e},s):l.error("WORKER","Failed to update context file",{projectName:e},new Error(String(s)))}}function lt(){let e=[y.join(Gt,"plugin","scripts","mcp-server.cjs"),y.join(process.cwd(),"plugin","scripts","mcp-server.cjs")];for(let t of e)if(z(t))return t;return null}function Re(){let e=[y.join(Gt,"plugin","scripts","worker-service.cjs"),y.join(process.cwd(),"plugin","scripts","worker-service.cjs")];for(let t of e)if(z(t))return t;return null}function De(){let e=[y.join(Xt(),".bun","bin","bun"),"/usr/local/bin/bun","/usr/bin/bun",...process.platform==="win32"?[y.join(Xt(),".bun","bin","bun.exe"),y.join(process.env.LOCALAPPDATA||"","bun","bun.exe")]:[]];for(let t of e)if(t&&z(t))return t;return"bun"}function zt(e){switch(e){case"project":return y.join(process.cwd(),".cursor");case"user":return y.join(Xt(),".cursor");case"enterprise":return process.platform==="darwin"?"/Library/Application Support/Cursor":process.platform==="linux"?"/etc/cursor":process.platform==="win32"?y.join(process.env.ProgramData||"C:\\ProgramData","Cursor"):null;default:return null}}function Ka(e){let t=lt();if(!t)return console.error("Could not find MCP server script"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"),1;let r=zt(e);if(!r)return console.error(`Invalid target: ${e}. Use: project or user`),1;let n=y.join(r,"mcp.json");try{Br(r,{recursive:!0});let s={mcpServers:{}};if(z(n))try{s=JSON.parse(Us(n,"utf-8")),s.mcpServers||(s.mcpServers={})}catch(o){o instanceof Error?l.error("WORKER","Corrupt mcp.json, creating new config",{path:n},o):l.error("WORKER","Corrupt mcp.json, creating new config",{path:n},new Error(String(o))),s={mcpServers:{}}}return s.mcpServers["claude-mem"]={command:"node",args:[t]},Hr(n,JSON.stringify(s,null,2)),console.log(` Configured MCP server in ${e==="user"?"~/.cursor":".cursor"}/mcp.json`),console.log(` Server path: ${t}`),0}catch(s){return console.error(`Failed to configure MCP: ${s.message}`),1}}async function Bs(e){console.log(`
|
|
84
|
+
Installing Claude-Mem Cursor hooks (${e} level)...
|
|
85
|
+
`);let t=zt(e);if(!t)return console.error(`Invalid target: ${e}. Use: project, user, or enterprise`),1;let r=Re();if(!r)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let n=process.cwd(),s=y.join(t,"hooks.json"),o=De(),i=o.replace(/\\/g,"\\\\"),a=r.replace(/\\/g,"\\\\"),c=m=>`"${i}" "${a}" hook cursor ${m}`;console.log(` Using Bun runtime: ${o}`);let p={version:1,hooks:{beforeSubmitPrompt:[{command:c("session-init")},{command:c("context")}],afterMCPExecution:[{command:c("observation")}],afterShellExecution:[{command:c("observation")}],afterFileEdit:[{command:c("file-edit")}],stop:[{command:c("summarize")}]}};try{return Br(t,{recursive:!0}),await Va(s,p,r,e,t,n),0}catch(m){let d=m instanceof Error?m.message:String(m);return console.error(`
|
|
86
|
+
Installation failed: ${d}`),e==="enterprise"&&console.error(" Tip: Enterprise installation may require sudo/admin privileges"),1}}async function Va(e,t,r,n,s,o){Hr(e,JSON.stringify(t,null,2)),console.log(" Created hooks.json (unified CLI mode)"),console.log(` Worker service: ${r}`),n==="project"&&await Ja(s,o),console.log(`
|
|
79
87
|
Installation complete!
|
|
80
88
|
|
|
81
89
|
Hooks installed to: ${s}/hooks.json
|
|
@@ -89,7 +97,7 @@ Next steps:
|
|
|
89
97
|
Context Injection:
|
|
90
98
|
Context from past sessions is stored in .cursor/rules/claude-mem-context.mdc
|
|
91
99
|
and automatically included in every chat. It updates after each session ends.
|
|
92
|
-
`)}async function
|
|
100
|
+
`)}async function Ja(e,t){let r=y.join(e,"rules");Br(r,{recursive:!0});let n=y.basename(t),s=!1;console.log(" Generating initial context...");try{s=await Ya(n,t)}catch(o){o instanceof Error?l.debug("WORKER","Worker not running during install",{},o):l.debug("WORKER","Worker not running during install",{},new Error(String(o)))}if(!s){let o=y.join(r,"claude-mem-context.mdc");Hr(o,`---
|
|
93
101
|
alwaysApply: true
|
|
94
102
|
description: "Claude-mem context from past sessions (auto-updated)"
|
|
95
103
|
---
|
|
@@ -99,15 +107,15 @@ description: "Claude-mem context from past sessions (auto-updated)"
|
|
|
99
107
|
*No context yet. Complete your first session and context will appear here.*
|
|
100
108
|
|
|
101
109
|
Use claude-mem's MCP search tools for manual memory queries.
|
|
102
|
-
`),console.log(" Created placeholder context file (will populate after first session)")}
|
|
103
|
-
Uninstalling Claude-Mem Cursor hooks (${
|
|
104
|
-
`);let
|
|
105
|
-
Uninstallation failed: ${c}`),1}}function
|
|
110
|
+
`),console.log(" Created placeholder context file (will populate after first session)")}Ws(n,t),console.log(" Registered for auto-context updates")}async function Ya(e,t){if(!(await Jt("/api/readiness")).ok)return!1;let n=await Jt(`/api/context/inject?project=${encodeURIComponent(e)}`);if(!n.ok)return!1;let s=await n.text();return s&&s.trim()?(Gr(t,s),console.log(" Generated initial context from existing memory"),!0):!1}function Ks(e){console.log(`
|
|
111
|
+
Uninstalling Claude-Mem Cursor hooks (${e} level)...
|
|
112
|
+
`);let t=zt(e);if(!t)return console.error(`Invalid target: ${e}`),1;let r=y.join(t,"hooks"),n=y.join(t,"hooks.json"),s=["common.sh","session-init.sh","context-inject.sh","save-observation.sh","save-file-edit.sh","session-summary.sh"],o=["common.ps1","session-init.ps1","context-inject.ps1","save-observation.ps1","save-file-edit.ps1","session-summary.ps1"],i=[...s,...o];try{return Xa(r,i,n,e,t),0}catch(a){let c=a instanceof Error?a.message:String(a);return console.error(`
|
|
113
|
+
Uninstallation failed: ${c}`),1}}function Xa(e,t,r,n,s){for(let o of t){let i=y.join(e,o);z(i)&&(Wr(i),console.log(` Removed legacy script: ${o}`))}if(z(r)&&(Wr(r),console.log(" Removed hooks.json")),n==="project"){let o=y.join(s,"rules","claude-mem-context.mdc");z(o)&&(Wr(o),console.log(" Removed context file"));let i=y.basename(process.cwd());Hs(i),console.log(" Unregistered from auto-context updates")}console.log(`
|
|
106
114
|
Uninstallation complete!
|
|
107
|
-
`),console.log("Restart Cursor to apply changes.")}function
|
|
115
|
+
`),console.log("Restart Cursor to apply changes.")}function Vs(){console.log(`
|
|
108
116
|
Claude-Mem Cursor Hooks Status
|
|
109
|
-
`);let
|
|
110
|
-
`),0}async function
|
|
117
|
+
`);let e=[{name:"Project",dir:y.join(process.cwd(),".cursor")},{name:"User",dir:y.join(Xt(),".cursor")}];process.platform==="darwin"?e.push({name:"Enterprise",dir:"/Library/Application Support/Cursor"}):process.platform==="linux"&&e.push({name:"Enterprise",dir:"/etc/cursor"});let t=!1;for(let r of e){let n=y.join(r.dir,"hooks.json"),s=y.join(r.dir,"hooks");if(z(n)){t=!0,console.log(`${r.name}: Installed`),console.log(` Config: ${n}`);let o=null;try{o=JSON.parse(Us(n,"utf-8"))}catch(i){i instanceof Error?l.error("WORKER","Unable to parse hooks.json",{path:n},i):l.error("WORKER","Unable to parse hooks.json",{path:n},new Error(String(i))),console.log(" Mode: Unable to parse hooks.json")}if(o){let i=o?.hooks?.beforeSubmitPrompt?.[0]?.command||"";if(i.includes("worker-service.cjs")&&i.includes("hook cursor"))console.log(" Mode: Unified CLI (bun worker-service.cjs)");else{let a=["session-init.sh","context-inject.sh","save-observation.sh"],c=["session-init.ps1","context-inject.ps1","save-observation.ps1"],p=a.some(d=>z(y.join(s,d))),m=c.some(d=>z(y.join(s,d)));p||m?(console.log(" Mode: Legacy shell scripts (consider reinstalling for unified CLI)"),p&&m?console.log(" Platform: Both (bash + PowerShell)"):p?console.log(" Platform: Unix (bash)"):m&&console.log(" Platform: Windows (PowerShell)")):console.log(" Mode: Unknown configuration")}}if(r.name==="Project"){let i=y.join(r.dir,"rules","claude-mem-context.mdc");z(i)?console.log(" Context: Active"):console.log(" Context: Not yet generated (will be created on first prompt)")}}else console.log(`${r.name}: Not installed`);console.log("")}return t||console.log(`No hooks installed. Run: claude-mem cursor install
|
|
118
|
+
`),0}async function qa(){try{let{stdout:t}=await Wa("which claude || where claude",{timeout:5e3});if(t.trim())return!0}catch(t){t instanceof Error?l.debug("WORKER","Claude CLI not in PATH",{},t):l.debug("WORKER","Claude CLI not in PATH",{},new Error(String(t)))}let e=y.join(Te,"plugins");return!!z(e)}async function za(e,t){switch(e){case"install":{let r=t[0]||"project";return Bs(r)}case"uninstall":{let r=t[0]||"project";return Ks(r)}case"status":return Vs();case"setup":return console.log("Use the main entry point for setup"),0;default:return console.log(`
|
|
111
119
|
Claude-Mem Cursor Integration
|
|
112
120
|
|
|
113
121
|
Usage: claude-mem cursor <command> [options]
|
|
@@ -131,23 +139,23 @@ Examples:
|
|
|
131
139
|
claude-mem cursor status # Check if hooks are installed
|
|
132
140
|
|
|
133
141
|
For more info: https://docs.claude-mem.ai/cursor
|
|
134
|
-
`),0}}var
|
|
135
|
-
`)}function
|
|
142
|
+
`),0}}var Wa,js,ut=S(()=>{"use strict";K();Yt();at();Ns();Wa=Ga(ja),js=y.join(V,"cursor-projects.json")});var Xr={};se(Xr,{checkGeminiCliHooksStatus:()=>Zs,handleGeminiCliCommand:()=>ic,installGeminiCliHooks:()=>qs,uninstallGeminiCliHooks:()=>zs});import Vr from"path";import{homedir as Za}from"os";import{existsSync as Oe,readFileSync as Zt,writeFileSync as Jr,mkdirSync as Ys}from"fs";function ec(e,t,r){let n=Pe[r];if(!n)throw new Error(`Unknown Gemini CLI event: ${r}`);let s=e.replace(/\\/g,"\\\\"),o=t.replace(/\\/g,"\\\\");return`"${s}" "${o}" hook gemini-cli ${n}`}function tc(e){return{matcher:"*",hooks:[{name:dt,type:"command",command:e,timeout:Qa}]}}function Yr(){if(!Oe(B))return{};let e=Zt(B,"utf-8");try{return JSON.parse(e)}catch(t){throw t instanceof Error?l.error("WORKER","Corrupt JSON in Gemini settings",{path:B},t):l.error("WORKER","Corrupt JSON in Gemini settings",{path:B},new Error(String(t))),new Error(`Corrupt JSON in ${B}, refusing to overwrite user settings`)}}function Xs(e){Ys(Qt,{recursive:!0}),Jr(B,JSON.stringify(e,null,2)+`
|
|
143
|
+
`)}function rc(e,t){let r={...e};r.hooks||(r.hooks={});for(let[n,s]of Object.entries(t)){let o=r.hooks[n]??[];for(let i of s){let a=o.findIndex(c=>c.hooks.some(p=>p.name===dt));if(a>=0){let c=o[a],p=c.hooks.findIndex(m=>m.name===dt);p>=0?c.hooks[p]=i.hooks[0]:c.hooks.push(i.hooks[0])}else o.push(i)}r.hooks[n]=o}return r}function nc(){let e="<claude-mem-context>",r=`${e}
|
|
136
144
|
# Memory Context from Past Sessions
|
|
137
145
|
|
|
138
146
|
*No context yet. Complete your first session and context will appear here.*
|
|
139
|
-
</claude-mem-context>`,
|
|
147
|
+
</claude-mem-context>`,n="";if(Oe(ne)&&(n=Zt(ne,"utf-8")),n.includes(e))return;let s=n.length>0&&!n.endsWith(`
|
|
140
148
|
`)?`
|
|
141
149
|
|
|
142
|
-
`:
|
|
143
|
-
`:"",
|
|
144
|
-
`;
|
|
150
|
+
`:n.length>0?`
|
|
151
|
+
`:"",o=n+s+r+`
|
|
152
|
+
`;Ys(Qt,{recursive:!0}),Jr(ne,o)}async function qs(){console.log(`
|
|
145
153
|
Installing Claude-Mem Gemini CLI hooks...
|
|
146
|
-
`);let
|
|
147
|
-
Installation failed: ${
|
|
154
|
+
`);let e=Re();if(!e)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let t=De();console.log(` Using Bun runtime: ${t}`),console.log(` Worker service: ${e}`);try{let r={};for(let o of Object.keys(Pe)){let i=ec(t,e,o);r[o]=[tc(i)]}let n=Yr(),s=rc(n,r);return sc(s),0}catch(r){let n=r instanceof Error?r.message:String(r);return console.error(`
|
|
155
|
+
Installation failed: ${n}`),1}}function sc(e){Xs(e),console.log(` Merged hooks into ${B}`),nc(),console.log(` Setup context injection in ${ne}`);let t=Object.keys(Pe);console.log(` Registered ${t.length} hook events:`);for(let r of t){let n=Pe[r];console.log(` ${r} \u2192 ${n}`)}console.log(`
|
|
148
156
|
Installation complete!
|
|
149
157
|
|
|
150
|
-
Hooks installed to: ${
|
|
158
|
+
Hooks installed to: ${B}
|
|
151
159
|
Using unified CLI: bun worker-service.cjs hook gemini-cli <event>
|
|
152
160
|
|
|
153
161
|
Next steps:
|
|
@@ -158,21 +166,21 @@ Next steps:
|
|
|
158
166
|
Context Injection:
|
|
159
167
|
Context from past sessions is injected via ~/.gemini/GEMINI.md
|
|
160
168
|
and automatically included in Gemini CLI conversations.
|
|
161
|
-
`)}function
|
|
169
|
+
`)}function zs(){if(console.log(`
|
|
162
170
|
Uninstalling Claude-Mem Gemini CLI hooks...
|
|
163
|
-
`),!
|
|
164
|
-
Uninstallation failed: ${
|
|
171
|
+
`),!Oe(B))return console.log(" No Gemini CLI settings found \u2014 nothing to uninstall."),0;try{let e=Yr();if(!e.hooks)return console.log(" No hooks found in Gemini CLI settings \u2014 nothing to uninstall."),0;let t=0;for(let[r,n]of Object.entries(e.hooks)){let s=n.map(o=>{let i=o.hooks.filter(a=>a.name!==dt);return t+=o.hooks.length-i.length,{...o,hooks:i}}).filter(o=>o.hooks.length>0);s.length>0?e.hooks[r]=s:delete e.hooks[r]}return Object.keys(e.hooks).length===0&&delete e.hooks,oc(e,t),0}catch(e){let t=e instanceof Error?e.message:String(e);return console.error(`
|
|
172
|
+
Uninstallation failed: ${t}`),1}}function oc(e,t){if(Xs(e),console.log(` Removed ${t} claude-mem hook(s) from ${B}`),Oe(ne)){let r=Zt(ne,"utf-8"),n=/\n?<claude-mem-context>[\s\S]*?<\/claude-mem-context>\n?/;n.test(r)&&(r=r.replace(n,""),Jr(ne,r),console.log(` Removed context section from ${ne}`))}console.log(`
|
|
165
173
|
Uninstallation complete!
|
|
166
|
-
`),console.log("Restart Gemini CLI to apply changes.")}function
|
|
174
|
+
`),console.log("Restart Gemini CLI to apply changes.")}function Zs(){if(console.log(`
|
|
167
175
|
Claude-Mem Gemini CLI Hooks Status
|
|
168
|
-
`),!
|
|
176
|
+
`),!Oe(B))return console.log("Gemini CLI settings: Not found"),console.log(` Expected at: ${B}
|
|
169
177
|
`),console.log(`No hooks installed. Run: claude-mem install --ide gemini-cli
|
|
170
|
-
`),0;let
|
|
171
|
-
`),0}if(!
|
|
178
|
+
`),0;let e;try{e=Yr()}catch(r){let n=r instanceof Error?r.message:String(r);return r instanceof Error?l.error("WORKER","Failed to read Gemini CLI settings",{path:B},r):l.error("WORKER","Failed to read Gemini CLI settings",{path:B},new Error(String(r))),console.log(`Gemini CLI settings: ${n}
|
|
179
|
+
`),0}if(!e.hooks)return console.log(`Gemini CLI settings: Found, but no hooks configured
|
|
172
180
|
`),console.log(`No hooks installed. Run: claude-mem install --ide gemini-cli
|
|
173
|
-
`),0;let
|
|
181
|
+
`),0;let t=[];for(let[r,n]of Object.entries(e.hooks))n.some(o=>o.hooks.some(i=>i.name===dt))&&t.push(r);if(t.length===0)return console.log(`Gemini CLI settings: Found, but no claude-mem hooks
|
|
174
182
|
`),console.log(`Run: claude-mem install --ide gemini-cli
|
|
175
|
-
`),0;console.log(`Settings: ${
|
|
183
|
+
`),0;console.log(`Settings: ${B}`),console.log("Mode: Unified CLI (bun worker-service.cjs hook gemini-cli)"),console.log(`Events: ${t.length} of ${Object.keys(Pe).length} mapped`);for(let r of t){let n=Pe[r]??"unknown";console.log(` ${r} \u2192 ${n}`)}return Oe(ne)?Zt(ne,"utf-8").includes("<claude-mem-context>")?console.log(`Context: Active (${ne})`):console.log("Context: GEMINI.md exists but missing claude-mem section"):console.log("Context: No GEMINI.md found"),console.log(""),0}async function ic(e,t){switch(e){case"install":return qs();case"uninstall":return zs();case"status":return Zs();default:return console.log(`
|
|
176
184
|
Claude-Mem Gemini CLI Integration
|
|
177
185
|
|
|
178
186
|
Usage: claude-mem gemini-cli <command>
|
|
@@ -188,53 +196,53 @@ Examples:
|
|
|
188
196
|
claude-mem gemini-cli uninstall # Remove hooks
|
|
189
197
|
|
|
190
198
|
For more info: https://docs.claude-mem.ai/usage/gemini-provider
|
|
191
|
-
`),0}}var
|
|
192
|
-
${
|
|
193
|
-
${
|
|
199
|
+
`),0}}var Qt,B,ne,dt,Qa,Pe,qr=S(()=>{"use strict";K();ut();Qt=Vr.join(Za(),".gemini"),B=Vr.join(Qt,"settings.json"),ne=Vr.join(Qt,"GEMINI.md"),dt="claude-mem",Qa=1e4,Pe={SessionStart:"context",BeforeAgent:"session-init",AfterAgent:"observation",BeforeTool:"observation",AfterTool:"observation",PreCompress:"summarize",Notification:"observation"}});import ac from"path";import{existsSync as cc,readFileSync as lc,writeFileSync as zr,mkdirSync as uc}from"fs";function er(e,t,r){let n=ac.dirname(e);uc(n,{recursive:!0});let s=`${pt}
|
|
200
|
+
${t}
|
|
201
|
+
${Fe}`;if(cc(e)){let o=lc(e,"utf-8"),i=o.indexOf(pt),a=o.indexOf(Fe);i!==-1&&a!==-1?o=o.slice(0,i)+s+o.slice(a+Fe.length):o=o.trimEnd()+`
|
|
194
202
|
|
|
195
203
|
`+s+`
|
|
196
|
-
`,
|
|
204
|
+
`,zr(e,o,"utf-8")}else r?zr(e,`${r}
|
|
197
205
|
|
|
198
206
|
${s}
|
|
199
|
-
`,"utf-8"):
|
|
200
|
-
`,"utf-8")}var
|
|
201
|
-
`,"utf-8"),console.log(" Cleaned context from AGENTS.md"))}function
|
|
202
|
-
`+
|
|
207
|
+
`,"utf-8"):zr(e,s+`
|
|
208
|
+
`,"utf-8")}var pt,Fe,Zr=S(()=>{"use strict";pt="<claude-mem-context>",Fe="</claude-mem-context>"});var tn={};se(tn,{checkOpenCodeStatus:()=>yc,findBuiltPluginPath:()=>ro,getInstalledPluginPath:()=>gt,getOpenCodeAgentsMdPath:()=>mt,getOpenCodeConfigDirectory:()=>tr,getOpenCodePluginsDirectory:()=>Qr,injectContextIntoAgentsMd:()=>en,installOpenCodeIntegration:()=>wc,installOpenCodePlugin:()=>no,syncContextToAgentsMd:()=>fc,uninstallOpenCodePlugin:()=>Cc});import he from"path";import{homedir as Qs}from"os";import{fileURLToPath as dc}from"url";import{existsSync as Le,readFileSync as eo,writeFileSync as pc,mkdirSync as mc,copyFileSync as gc,unlinkSync as to}from"fs";function tr(){return process.env.OPENCODE_CONFIG_DIR?process.env.OPENCODE_CONFIG_DIR:he.join(Qs(),".config","opencode")}function Qr(){return he.join(tr(),"plugins")}function mt(){return he.join(tr(),"AGENTS.md")}function gt(){return he.join(Qr(),"claude-mem.js")}function ro(){let e=[he.join(process.env.CLAUDE_CONFIG_DIR||he.join(Qs(),".claude"),"plugins","marketplaces","thedotmack","dist","opencode-plugin","index.js"),he.join(he.dirname(dc(import.meta.url)),"..","..","..","dist","opencode-plugin","index.js")];for(let t of e)if(Le(t))return t;return null}function no(){let e=ro();if(!e)return console.error("Could not find built OpenCode plugin bundle."),console.error(" Expected at: dist/opencode-plugin/index.js"),console.error(" Run the build first: npm run build"),1;let t=Qr(),r=gt();try{return mc(t,{recursive:!0}),gc(e,r),console.log(` Plugin installed to: ${r}`),l.info("OPENCODE","Plugin installed",{destination:r}),0}catch(n){let s=n instanceof Error?n.message:String(n);return console.error(`Failed to install OpenCode plugin: ${s}`),1}}function en(e){let t=mt();try{return er(t,e,"# Claude-Mem Memory Context"),l.info("OPENCODE","Context injected into AGENTS.md",{path:t}),0}catch(r){let n=r instanceof Error?r.message:String(r);return console.error(`Failed to inject context into AGENTS.md: ${n}`),1}}async function fc(e,t){try{await Ec(e,t)}catch(r){r instanceof Error?l.debug("WORKER","Worker not available during context sync",{},r):l.debug("WORKER","Worker not available during context sync",{},new Error(String(r)))}}async function hc(){let e=ct();if(!(await fetch(`http://127.0.0.1:${e}/api/readiness`)).ok)return null;let r=await fetch(`http://127.0.0.1:${e}/api/context/inject?project=opencode`);if(!r.ok)return null;let n=await r.text();return n&&n.trim()?n:null}async function Ec(e,t){let r=await fetch(`http://127.0.0.1:${e}/api/context/inject?project=${encodeURIComponent(t)}`);if(!r.ok)return;let n=await r.text();n&&n.trim()&&en(n)!==0&&l.warn("OPENCODE","Failed to inject context into AGENTS.md during sync")}function Sc(e,t){t.length===0||t==="# Claude-Mem Memory Context"?(to(e),console.log(" Removed empty AGENTS.md")):(pc(e,t+`
|
|
209
|
+
`,"utf-8"),console.log(" Cleaned context from AGENTS.md"))}function Cc(){let e=!1,t=gt();if(Le(t))try{to(t),console.log(` Removed plugin: ${t}`)}catch(n){let s=n instanceof Error?n.message:String(n);console.error(` Failed to remove plugin: ${s}`),e=!0}let r=mt();if(Le(r)){let n;try{n=eo(r,"utf-8")}catch(i){let a=i instanceof Error?i.message:String(i);console.error(` Failed to read AGENTS.md: ${a}`),e=!0,n=""}let s=n.indexOf(pt),o=n.indexOf(Fe);if(s!==-1&&o!==-1){n=n.slice(0,s).trimEnd()+`
|
|
210
|
+
`+n.slice(o+Fe.length).trimStart();let i=n.trim();try{Sc(r,i)}catch(a){let c=a instanceof Error?a.message:String(a);console.error(` Failed to clean AGENTS.md: ${c}`),e=!0}}}return e?1:0}function yc(){console.log(`
|
|
203
211
|
Claude-Mem OpenCode Integration Status
|
|
204
|
-
`);let
|
|
212
|
+
`);let e=tr(),t=gt(),r=mt();if(console.log(`Config directory: ${e}`),console.log(` Exists: ${Le(e)?"yes":"no"}`),console.log(""),console.log(`Plugin: ${t}`),console.log(` Installed: ${Le(t)?"yes":"no"}`),console.log(""),console.log(`Context (AGENTS.md): ${r}`),Le(r)){let s=eo(r,"utf-8").includes(pt);console.log(" Exists: yes"),console.log(` Has claude-mem context: ${s?"yes":"no"}`)}else console.log(" Exists: no");return console.log(""),0}async function wc(){console.log(`
|
|
205
213
|
Installing Claude-Mem for OpenCode...
|
|
206
|
-
`);let
|
|
214
|
+
`);let e=no();if(e!==0)return e;let r=`# Memory Context from Past Sessions
|
|
207
215
|
|
|
208
216
|
*No context yet. Complete your first session and context will appear here.*
|
|
209
217
|
|
|
210
|
-
Use claude-mem search tools for manual memory queries.`,
|
|
218
|
+
Use claude-mem search tools for manual memory queries.`,n="placeholder";try{let o=await hc();o&&(r=o,n="existing memory")}catch(o){o instanceof Error?l.debug("WORKER","Worker not available during OpenCode install",{},o):l.debug("WORKER","Worker not available during OpenCode install",{},new Error(String(o)))}return en(r)!==0?l.warn("OPENCODE",`Failed to inject ${n} context into AGENTS.md during install`):console.log(n==="existing memory"?" Context injected from existing memory":" Placeholder context created (worker not running)"),console.log(`
|
|
211
219
|
Installation complete!
|
|
212
220
|
|
|
213
|
-
Plugin installed to: ${
|
|
214
|
-
Context file: ${
|
|
221
|
+
Plugin installed to: ${gt()}
|
|
222
|
+
Context file: ${mt()}
|
|
215
223
|
|
|
216
224
|
Next steps:
|
|
217
225
|
1. Start claude-mem worker: npx claude-mem start
|
|
218
226
|
2. Restart OpenCode to load the plugin
|
|
219
227
|
3. Memory capture is automatic from then on
|
|
220
|
-
`),0}var
|
|
228
|
+
`),0}var rn=S(()=>{"use strict";K();Zr();Yt()});var on={};se(on,{checkWindsurfHooksStatus:()=>po,handleWindsurfCommand:()=>Rc,installWindsurfHooks:()=>lo,readWindsurfRegistry:()=>or,registerWindsurfProject:()=>ao,uninstallWindsurfHooks:()=>uo,unregisterWindsurfProject:()=>co,updateWindsurfContextForProject:()=>xc,writeWindsurfContextFile:()=>sn,writeWindsurfRegistry:()=>nn});import Z from"path";import{homedir as vc}from"os";import{existsSync as Ue,readFileSync as nr,writeFileSync as ft,unlinkSync as oo,mkdirSync as sr,renameSync as _c}from"fs";function or(){try{return Ue(Ne)?JSON.parse(nr(Ne,"utf-8")):{}}catch(e){return e instanceof Error?l.error("WORKER","Failed to read registry, using empty",{file:Ne},e):l.error("WORKER","Failed to read registry, using empty",{file:Ne},new Error(String(e))),{}}}function nn(e){let t=Z.dirname(Ne);sr(t,{recursive:!0}),ft(Ne,JSON.stringify(e,null,2))}function ao(e){let t=or();t[e]={installedAt:new Date().toISOString()},nn(t),l.info("WINDSURF","Registered project for auto-context updates",{workspacePath:e})}function co(e){let t=or();t[e]&&(delete t[e],nn(t),l.info("WINDSURF","Unregistered project",{workspacePath:e}))}async function xc(e,t,r){if(or()[t])try{let o=await fetch(`http://127.0.0.1:${r}/api/context/inject?project=${encodeURIComponent(e)}`);if(!o.ok)return;let i=await o.text();if(!i||!i.trim())return;sn(t,i),l.debug("WINDSURF","Updated context file",{projectName:e,workspacePath:t})}catch(o){o instanceof Error?l.error("WORKER","Failed to update context file",{projectName:e,workspacePath:t},o):l.error("WORKER","Failed to update context file",{projectName:e,workspacePath:t},new Error(String(o)))}}function sn(e,t){let r=Z.join(e,".windsurf","rules"),n=Z.join(r,"claude-mem-context.md"),s=`${n}.tmp`;sr(r,{recursive:!0});let o=`# Memory Context from Past Sessions
|
|
221
229
|
|
|
222
230
|
The following context is from claude-mem, a persistent memory system that tracks your coding sessions.
|
|
223
231
|
|
|
224
|
-
${
|
|
232
|
+
${t}
|
|
225
233
|
|
|
226
234
|
---
|
|
227
235
|
*Auto-updated by claude-mem after each session. Use MCP search tools for detailed queries.*
|
|
228
|
-
`;
|
|
236
|
+
`;o.length>so&&(o=o.slice(0,so-50)+`
|
|
229
237
|
|
|
230
238
|
*[Truncated \u2014 use MCP search for full history]*
|
|
231
|
-
`),
|
|
239
|
+
`),ft(s,o),_c(s,n)}function $c(e,t,r){let s={pre_user_prompt:"session-init",post_write_code:"file-edit",post_run_command:"observation",post_mcp_tool_use:"observation",post_cascade_response:"observation"}[r]??"observation";return`"${e}" "${t}" hook windsurf ${s}`}function Ic(e,t,r){sr(io,{recursive:!0});let n={hooks:{}};if(Ue(F))try{n=JSON.parse(nr(F,"utf-8")),n.hooks||(n.hooks={})}catch(s){throw s instanceof Error?l.error("WORKER","Corrupt hooks.json, refusing to overwrite",{path:F},s):l.error("WORKER","Corrupt hooks.json, refusing to overwrite",{path:F},new Error(String(s))),new Error(`Corrupt hooks.json at ${F}, refusing to overwrite`)}for(let s of rr){let i={command:$c(e,t,s),show_output:!1,working_directory:r},a=(n.hooks[s]??[]).filter(c=>!c.command.includes("worker-service")||!c.command.includes("windsurf"));n.hooks[s]=[...a,i]}ft(F,JSON.stringify(n,null,2))}async function lo(){console.log(`
|
|
232
240
|
Installing Claude-Mem Windsurf hooks (user level)...
|
|
233
|
-
`);let
|
|
234
|
-
Installation failed: ${
|
|
241
|
+
`);let e=Re();if(!e)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let t=De();if(!t)return console.error("Could not find Bun runtime"),console.error(" Install Bun: curl -fsSL https://bun.sh/install | bash"),1;let r=Z.dirname(e);console.log(` Using Bun runtime: ${t}`),console.log(` Worker service: ${e}`);let n=process.cwd();try{return await kc(t,e,r,n),0}catch(s){let o=s instanceof Error?s.message:String(s);return console.error(`
|
|
242
|
+
Installation failed: ${o}`),1}}async function kc(e,t,r,n){Ic(e,t,r),console.log(" Created/merged hooks.json"),await Mc(n),console.log(`
|
|
235
243
|
Installation complete!
|
|
236
244
|
|
|
237
|
-
Hooks installed to: ${
|
|
245
|
+
Hooks installed to: ${F}
|
|
238
246
|
Using unified CLI: bun worker-service.cjs hook windsurf <command>
|
|
239
247
|
|
|
240
248
|
Events registered:
|
|
@@ -248,21 +256,21 @@ Next steps:
|
|
|
248
256
|
1. Start claude-mem worker: claude-mem start
|
|
249
257
|
2. Restart Windsurf to load the hooks
|
|
250
258
|
3. Context is injected via .windsurf/rules/claude-mem-context.md (workspace-level)
|
|
251
|
-
`)}async function
|
|
259
|
+
`)}async function Mc(e){let t=ct(),r=Z.basename(e),n=!1;console.log(" Generating initial context...");try{n=await bc(t,r,e)}catch(s){s instanceof Error?l.debug("WORKER","Worker not running during install",{},s):l.debug("WORKER","Worker not running during install",{},new Error(String(s)))}if(!n){let s=Z.join(e,".windsurf","rules");sr(s,{recursive:!0});let o=Z.join(s,"claude-mem-context.md");ft(o,`# Memory Context from Past Sessions
|
|
252
260
|
|
|
253
261
|
*No context yet. Complete your first session and context will appear here.*
|
|
254
262
|
|
|
255
263
|
Use claude-mem's MCP search tools for manual memory queries.
|
|
256
|
-
`),console.log(" Created placeholder context file (will populate after first session)")}
|
|
264
|
+
`),console.log(" Created placeholder context file (will populate after first session)")}ao(e),console.log(" Registered for auto-context updates")}async function bc(e,t,r){if(!(await fetch(`http://127.0.0.1:${e}/api/readiness`)).ok)return!1;let s=await fetch(`http://127.0.0.1:${e}/api/context/inject?project=${encodeURIComponent(t)}`);if(!s.ok)return!1;let o=await s.text();return o&&o.trim()?(sn(r,o),console.log(" Generated initial context from existing memory"),!0):!1}function uo(){if(console.log(`
|
|
257
265
|
Uninstalling Claude-Mem Windsurf hooks...
|
|
258
|
-
`),
|
|
259
|
-
Uninstallation failed: ${r}`),1}}function
|
|
266
|
+
`),Ue(F))try{Tc()}catch(t){t instanceof Error?l.error("WORKER","Could not parse hooks.json during uninstall",{path:F},t):l.error("WORKER","Could not parse hooks.json during uninstall",{path:F},new Error(String(t))),console.log(" Warning: could not parse hooks.json \u2014 leaving file intact to preserve other hooks")}else console.log(" No hooks.json found");let e=process.cwd();try{return Ac(e),0}catch(t){let r=t instanceof Error?t.message:String(t);return console.error(`
|
|
267
|
+
Uninstallation failed: ${r}`),1}}function Tc(){let t={hooks:JSON.parse(nr(F,"utf-8")).hooks??{}};for(let r of rr){let n=t.hooks[r]??[];n.length>0&&(t.hooks[r]=n.filter(s=>!s.command.includes("worker-service")||!s.command.includes("windsurf")),t.hooks[r].length===0&&delete t.hooks[r])}Object.keys(t.hooks).length===0?(oo(F),console.log(" Removed hooks.json (no hooks remaining)")):(ft(F,JSON.stringify(t,null,2)),console.log(" Removed claude-mem entries from hooks.json (other hooks preserved)"))}function Ac(e){let t=Z.join(e,".windsurf","rules","claude-mem-context.md");Ue(t)&&(oo(t),console.log(" Removed context file")),co(e),console.log(" Unregistered from auto-context updates"),console.log(`
|
|
260
268
|
Uninstallation complete!
|
|
261
|
-
`),console.log("Restart Windsurf to apply changes.")}function
|
|
269
|
+
`),console.log("Restart Windsurf to apply changes.")}function po(){if(console.log(`
|
|
262
270
|
Claude-Mem Windsurf Hooks Status
|
|
263
|
-
`),
|
|
271
|
+
`),Ue(F)){console.log("User-level: Installed"),console.log(` Config: ${F}`);let e=null;try{e=JSON.parse(nr(F,"utf-8"))}catch(r){let n=r instanceof Error?r:new Error(String(r));l.error("WORKER","Unable to parse hooks.json",{path:F},n),console.log(" Mode: Unable to parse hooks.json")}if(e){let r=rr.filter(n=>(e?.hooks?.[n]??[]).some(s=>s.command.includes("worker-service")&&s.command.includes("windsurf")));console.log(` Events: ${r.length}/${rr.length} registered`);for(let n of r)console.log(` - ${n}`)}let t=Z.join(process.cwd(),".windsurf","rules","claude-mem-context.md");Ue(t)?console.log(" Context: Active (current workspace)"):console.log(" Context: Not yet generated for this workspace")}else console.log("User-level: Not installed"),console.log(`
|
|
264
272
|
No hooks installed. Run: claude-mem windsurf install
|
|
265
|
-
`);return console.log(""),0}async function
|
|
273
|
+
`);return console.log(""),0}async function Rc(e,t){switch(e){case"install":return lo();case"uninstall":return uo();case"status":return po();default:return console.log(`
|
|
266
274
|
Claude-Mem Windsurf Integration
|
|
267
275
|
|
|
268
276
|
Usage: claude-mem windsurf <command>
|
|
@@ -278,33 +286,33 @@ Examples:
|
|
|
278
286
|
claude-mem windsurf status # Check if hooks are installed
|
|
279
287
|
|
|
280
288
|
For more info: https://docs.claude-mem.ai/windsurf
|
|
281
|
-
`),0}}var
|
|
282
|
-
`,"utf-8")}function
|
|
283
|
-
`,"utf-8"),
|
|
289
|
+
`),0}}var io,F,so,Ne,rr,an=S(()=>{"use strict";K();Yt();at();ut();io=Z.join(vc(),".codeium","windsurf"),F=Z.join(io,"hooks.json"),so=6e3,Ne=Z.join(V,"windsurf-projects.json"),rr=["pre_user_prompt","post_write_code","post_run_command","post_mcp_tool_use","post_cascade_response"]});var un={};se(un,{checkOpenClawStatus:()=>Uc,findPluginManifestPath:()=>Eo,findPluginSkillsDirectory:()=>So,findPreBuiltPluginDirectory:()=>ho,getOpenClawClaudeMemExtensionDirectory:()=>Et,getOpenClawConfigDirectory:()=>ht,getOpenClawConfigFilePath:()=>je,getOpenClawExtensionsDirectory:()=>fo,installOpenClawIntegration:()=>jc,installOpenClawPlugin:()=>yo,uninstallOpenClawPlugin:()=>Nc});import O from"path";import{homedir as ir}from"os";import{existsSync as ae,readFileSync as Dc,writeFileSync as mo,mkdirSync as go,cpSync as cn,rmSync as Oc}from"fs";function ht(){return O.join(ir(),".openclaw")}function fo(){return O.join(ht(),"extensions")}function Et(){return O.join(fo(),"claude-mem")}function je(){return O.join(ht(),"openclaw.json")}function ho(){let e=[O.join(process.env.CLAUDE_CONFIG_DIR||O.join(ir(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let t of e){let r=O.join(t,"openclaw","dist"),n=O.join(r,"index.js");if(ae(n))return r}return null}function Eo(){let e=[O.join(process.env.CLAUDE_CONFIG_DIR||O.join(ir(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let t of e){let r=O.join(t,"openclaw","openclaw.plugin.json");if(ae(r))return r}return null}function So(){let e=[O.join(process.env.CLAUDE_CONFIG_DIR||O.join(ir(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let t of e){let r=O.join(t,"openclaw","skills");if(ae(r))return r}return null}function ln(){let e=je();if(!ae(e))return{};try{return JSON.parse(Dc(e,"utf-8"))}catch(t){let r=t instanceof Error?t:new Error(String(t));throw l.error("WORKER","Failed to parse openclaw.json",{path:e},r),r}}function Co(e){let t=ht();go(t,{recursive:!0}),mo(je(),JSON.stringify(e,null,2)+`
|
|
290
|
+
`,"utf-8")}function Pc(e=37777,t="openclaw",r=!0){let n=ln();if(n.plugins||(n.plugins={}),n.plugins.slots||(n.plugins.slots={}),n.plugins.entries||(n.plugins.entries={}),n.plugins.slots.memory="claude-mem",!n.plugins.entries["claude-mem"])n.plugins.entries["claude-mem"]={enabled:!0,config:{workerPort:e,project:t,syncMemoryFile:r}};else{n.plugins.entries["claude-mem"].enabled=!0,n.plugins.entries["claude-mem"].config||(n.plugins.entries["claude-mem"].config={});let s=n.plugins.entries["claude-mem"].config;s.workerPort===void 0&&(s.workerPort=e),s.project===void 0&&(s.project=t),s.syncMemoryFile===void 0&&(s.syncMemoryFile=r)}Co(n)}function Fc(){let e=je();if(!ae(e))return;let t=ln();t.plugins?.entries?.["claude-mem"]&&delete t.plugins.entries["claude-mem"],t.plugins?.slots?.memory==="claude-mem"&&delete t.plugins.slots.memory,Co(t)}function yo(){let e=ho();if(!e)return console.error("Could not find pre-built OpenClaw plugin bundle."),console.error(" Expected at: openclaw/dist/index.js"),console.error(" Ensure the npm package includes the openclaw directory."),1;let t=Et(),r=O.join(t,"dist"),n=Eo(),s=So(),o={name:"claude-mem",version:"1.0.0",type:"module",main:"dist/index.js",openclaw:{extensions:["./dist/index.js"]}};try{return go(r,{recursive:!0}),Lc(e,r,t,n,s,o),0}catch(i){let a=i instanceof Error?i.message:String(i);return console.error(`Failed to install OpenClaw plugin: ${a}`),1}}function Lc(e,t,r,n,s,o){if(cn(e,t,{recursive:!0,force:!0}),console.log(` Plugin dist copied to: ${t}`),n){let i=O.join(r,"openclaw.plugin.json");cn(n,i,{force:!0}),console.log(` Plugin manifest copied to: ${i}`)}if(s){let i=O.join(r,"skills");cn(s,i,{recursive:!0,force:!0}),console.log(` Skills copied to: ${i}`)}mo(O.join(r,"package.json"),JSON.stringify(o,null,2)+`
|
|
291
|
+
`,"utf-8"),Pc(),console.log(" Registered in openclaw.json"),l.info("OPENCLAW","Plugin installed",{destination:r})}function Nc(){let e=!1,t=Et();if(ae(t))try{Oc(t,{recursive:!0,force:!0}),console.log(` Removed extension: ${t}`)}catch(r){let n=r instanceof Error?r.message:String(r);console.error(` Failed to remove extension directory: ${n}`),e=!0}try{Fc(),console.log(" Unregistered from openclaw.json")}catch(r){let n=r instanceof Error?r.message:String(r);console.error(` Failed to update openclaw.json: ${n}`),e=!0}return e?1:0}function Uc(){console.log(`
|
|
284
292
|
Claude-Mem OpenClaw Integration Status
|
|
285
|
-
`);let
|
|
293
|
+
`);let e=ht(),t=Et(),r=je(),n=O.join(t,"dist","index.js");if(console.log(`Config directory: ${e}`),console.log(` Exists: ${ae(e)?"yes":"no"}`),console.log(""),console.log(`Extension directory: ${t}`),console.log(` Exists: ${ae(t)?"yes":"no"}`),console.log(` Plugin entry: ${ae(n)?"yes":"no"}`),console.log(""),console.log(`Config (openclaw.json): ${r}`),ae(r)){let s=ln(),o=s.plugins?.entries?.["claude-mem"]!==void 0,i=s.plugins?.entries?.["claude-mem"]?.enabled===!0,a=s.plugins?.slots?.memory==="claude-mem";if(console.log(" Exists: yes"),console.log(` Registered: ${o?"yes":"no"}`),console.log(` Enabled: ${i?"yes":"no"}`),console.log(` Memory slot: ${a?"yes":"no"}`),o){let c=s.plugins.entries["claude-mem"].config;c&&(console.log(` Worker port: ${c.workerPort??"default"}`),console.log(` Project: ${c.project??"default"}`),console.log(` Sync MEMORY.md: ${c.syncMemoryFile??"default"}`))}}else console.log(" Exists: no");return console.log(""),0}async function jc(){console.log(`
|
|
286
294
|
Installing Claude-Mem for OpenClaw...
|
|
287
|
-
`);let
|
|
295
|
+
`);let e=yo();if(e!==0)return e;let t=Et();return console.log(`
|
|
288
296
|
Installation complete!
|
|
289
297
|
|
|
290
|
-
Plugin installed to: ${
|
|
291
|
-
Config updated: ${
|
|
298
|
+
Plugin installed to: ${t}
|
|
299
|
+
Config updated: ${je()}
|
|
292
300
|
|
|
293
301
|
Next steps:
|
|
294
302
|
1. Start claude-mem worker: npx claude-mem start
|
|
295
303
|
2. Restart OpenClaw to load the plugin
|
|
296
304
|
3. Memory capture is automatic from then on
|
|
297
|
-
`),0}var
|
|
298
|
-
`)}function
|
|
305
|
+
`),0}var dn=S(()=>{"use strict";K()});import{existsSync as im,readFileSync as am,writeFileSync as cm,mkdirSync as lm}from"fs";import{homedir as wo}from"os";import{join as vo,dirname as pm}from"path";var $e,St,Gc,ar,_o=S(()=>{"use strict";$e=vo(wo(),".claude-mem","transcript-watch.json"),St=vo(wo(),".claude-mem","transcript-watch-state.json"),Gc={name:"codex",version:"0.3",description:"Schema for Codex session JSONL files under ~/.codex/sessions.",events:[{name:"session-meta",match:{path:"type",equals:"session_meta"},action:"session_context",fields:{sessionId:"payload.id",cwd:"payload.cwd"}},{name:"turn-context",match:{path:"type",equals:"turn_context"},action:"session_context",fields:{cwd:"payload.cwd"}},{name:"user-message",match:{path:"payload.type",equals:"user_message"},action:"session_init",fields:{prompt:"payload.message"}},{name:"assistant-message",match:{path:"payload.type",equals:"agent_message"},action:"assistant_message",fields:{message:"payload.message"}},{name:"tool-use",match:{path:"payload.type",in:["function_call","custom_tool_call","web_search_call","exec_command"]},action:"tool_use",fields:{toolId:"payload.call_id",toolName:{coalesce:["payload.name","payload.type",{value:"web_search"}]},toolInput:{coalesce:["payload.arguments","payload.input","payload.command","payload.action"]}}},{name:"tool-result",match:{path:"payload.type",in:["function_call_output","custom_tool_call_output","exec_command_output"]},action:"tool_result",fields:{toolId:"payload.call_id",toolResponse:"payload.output"}},{name:"session-end",match:{path:"payload.type",in:["turn_aborted","turn_completed"]},action:"session_end"}]},ar={version:1,schemas:{codex:Gc},watches:[{name:"codex",path:"~/.codex/sessions/**/*.jsonl",schema:"codex",startAtEnd:!0,context:{mode:"agents",updateOn:["session_start","session_end"]}}],stateFile:St}});var fn={};se(fn,{installCodexCli:()=>Yc,uninstallCodexCli:()=>qc});import mn from"path";import{homedir as xo}from"os";import{existsSync as gn,readFileSync as pn,writeFileSync as cr,mkdirSync as Wc}from"fs";function $o(){let e=$e;if(!gn(e))return{version:1,schemas:{},watches:[],stateFile:St};try{let t=pn(e,"utf-8"),r=JSON.parse(t);return r.version||(r.version=1),r.watches||(r.watches=[]),r.schemas||(r.schemas={}),r.stateFile||(r.stateFile=St),r}catch(t){t instanceof Error?l.error("WORKER","Corrupt transcript-watch.json, creating backup",{path:e},t):l.error("WORKER","Corrupt transcript-watch.json, creating backup",{path:e},new Error(String(t)));let r=`${e}.backup.${Date.now()}`;return cr(r,pn(e)),console.warn(` Backed up corrupt transcript-watch.json to ${r}`),{version:1,schemas:{},watches:[],stateFile:St}}}function Kc(e){let t={...e};t.schemas={...t.schemas};let r=ar.schemas?.[Ge];r&&(t.schemas[Ge]=r);let n=ar.watches.find(s=>s.name===Ge);if(n){let s=t.watches.findIndex(o=>o.name===Ge);s!==-1?t.watches[s]=n:t.watches.push(n)}return t}function Io(e){Wc(Bc,{recursive:!0}),cr($e,JSON.stringify(e,null,2)+`
|
|
306
|
+
`)}function Vc(){if(!gn(Ct))return;let e="<claude-mem-context>",t="</claude-mem-context>";try{Jc(e,t)}catch(r){let n=r instanceof Error?r.message:String(r);l.warn("WORKER","Failed to clean AGENTS.md context",{error:n})}}function Jc(e,t){let r=pn(Ct,"utf-8"),n=r.indexOf(e),s=r.indexOf(t);if(n===-1||s===-1)return;let o=r.substring(0,n).replace(/\n+$/,""),i=r.substring(s+t.length).replace(/^\n+/,""),a=(o+(i?`
|
|
299
307
|
|
|
300
|
-
`+
|
|
301
|
-
`):
|
|
308
|
+
`+i:"")).trim();a?cr(Ct,a+`
|
|
309
|
+
`):cr(Ct,""),console.log(` Removed legacy global context from ${Ct}`)}async function Yc(){console.log(`
|
|
302
310
|
Installing Claude-Mem for Codex CLI (transcript watching)...
|
|
303
|
-
`);let
|
|
304
|
-
Installation failed: ${
|
|
311
|
+
`);let e=$o(),t=Kc(e);try{return Xc(t),0}catch(r){let n=r instanceof Error?r.message:String(r);return console.error(`
|
|
312
|
+
Installation failed: ${n}`),1}}function Xc(e){Io(e),console.log(` Updated ${$e}`),console.log(" Watch path: ~/.codex/sessions/**/*.jsonl"),console.log(` Schema: codex (v${ar.schemas?.codex?.version??"?"})`),ko(),console.log(`
|
|
305
313
|
Installation complete!
|
|
306
314
|
|
|
307
|
-
Transcript watch config: ${
|
|
315
|
+
Transcript watch config: ${$e}
|
|
308
316
|
Context files: <workspace>/AGENTS.md
|
|
309
317
|
|
|
310
318
|
How it works:
|
|
@@ -315,33 +323,33 @@ How it works:
|
|
|
315
323
|
Next steps:
|
|
316
324
|
1. Start claude-mem worker: npx claude-mem start
|
|
317
325
|
2. Use Codex CLI as usual -- memory capture is automatic!
|
|
318
|
-
`)}function
|
|
326
|
+
`)}function qc(){if(console.log(`
|
|
319
327
|
Uninstalling Claude-Mem Codex CLI integration...
|
|
320
|
-
`),
|
|
321
|
-
Uninstallation failed: ${r}`),1}}else console.log(" No transcript-watch.json found -- nothing to remove.");return
|
|
328
|
+
`),gn($e)){let e=$o();e.watches=e.watches.filter(t=>t.name!==Ge),e.schemas&&delete e.schemas[Ge];try{Io(e),console.log(` Removed codex watch from ${$e}`)}catch(t){let r=t instanceof Error?t.message:String(t);return console.error(`
|
|
329
|
+
Uninstallation failed: ${r}`),1}}else console.log(" No transcript-watch.json found -- nothing to remove.");return ko(),console.log(`
|
|
322
330
|
Uninstallation complete!`),console.log(`Restart claude-mem worker to apply changes.
|
|
323
|
-
`),0}var
|
|
324
|
-
`)}function
|
|
325
|
-
Installing Claude-Mem MCP integration for ${
|
|
326
|
-
`);let
|
|
327
|
-
Installation failed: ${
|
|
331
|
+
`),0}var Hc,Ct,Bc,Ge,ko,hn=S(()=>{"use strict";K();_o();Hc=mn.join(xo(),".codex"),Ct=mn.join(Hc,"AGENTS.md"),Bc=mn.join(xo(),".claude-mem"),Ge="codex";ko=Vc});var Do={};se(Do,{MCP_IDE_INSTALLERS:()=>ul,installGooseMcpIntegration:()=>Ro});import Y from"path";import{homedir as vt}from"os";import{existsSync as To,readFileSync as zc,writeFileSync as wt,mkdirSync as Ao}from"fs";function Qc(e){return{command:process.execPath,args:[e]}}function el(e,t,r="mcpServers"){let n=Y.dirname(e);Ao(n,{recursive:!0});let s=ee(e,{});s[r]||(s[r]={}),s[r]["claude-mem"]=Qc(t),wt(e,JSON.stringify(s,null,2)+`
|
|
332
|
+
`)}function yt(e){return async()=>{console.log(`
|
|
333
|
+
Installing Claude-Mem MCP integration for ${e.ideLabel}...
|
|
334
|
+
`);let t=lt();if(!t)return console.error("Could not find MCP server script"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"),1;let r=e.configPath,n=e.ideId==="warp"&&!To(Y.dirname(r)),s;e.contextFile&&(s=e.contextFile.path);try{return tl(e,r,t,n,s),0}catch(o){let i=o instanceof Error?o.message:String(o);return console.error(`
|
|
335
|
+
Installation failed: ${i}`),1}}}function tl(e,t,r,n,s){n?console.log(" Note: ~/.warp/ not found. MCP may need to be configured via Warp Drive UI."):(el(t,r,e.configKey),console.log(` MCP config written to: ${t}`)),s&&(er(s,Zc),console.log(` Context placeholder written to: ${s}`));let o=[`
|
|
328
336
|
Installation complete!
|
|
329
|
-
`];
|
|
330
|
-
`))}function
|
|
331
|
-
`)}function
|
|
332
|
-
`)}async function
|
|
337
|
+
`];o.push(`MCP config: ${t}`),s&&o.push(`Context: ${s}`),o.push(""),o.push("Note: This is an MCP-only integration providing search tools and context."),o.push(`Transcript capture is not available for ${e.ideLabel}.`),e.ideId==="warp"&&o.push("If MCP config via file is not supported, configure MCP through Warp Drive UI."),o.push(""),o.push("Next steps:"),o.push(" 1. Start claude-mem worker: npx claude-mem start"),o.push(` 2. Restart ${e.ideLabel} to pick up the MCP server`),o.push(""),console.log(o.join(`
|
|
338
|
+
`))}function al(){return Y.join(vt(),".config","goose","config.yaml")}function cl(e){return e.includes("claude-mem:")&&e.includes("mcpServers:")}function Mo(e){return["mcpServers:"," claude-mem:",` command: ${process.execPath}`," args:",` - ${e}`].join(`
|
|
339
|
+
`)}function bo(e){return[" claude-mem:",` command: ${process.execPath}`," args:",` - ${e}`].join(`
|
|
340
|
+
`)}async function Ro(){console.log(`
|
|
333
341
|
Installing Claude-Mem MCP integration for Goose...
|
|
334
|
-
`);let
|
|
335
|
-
Installation failed: ${s}`),1}}function
|
|
336
|
-
`;if(!
|
|
337
|
-
`+
|
|
338
|
-
`+
|
|
342
|
+
`);let e=lt();if(!e)return console.error("Could not find MCP server script"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"),1;let t=al(),r=Y.dirname(t);try{return Ao(r,{recursive:!0}),ll(t,e),0}catch(n){let s=n instanceof Error?n.message:String(n);return console.error(`
|
|
343
|
+
Installation failed: ${s}`),1}}function ll(e,t){if(To(e)){let r=zc(e,"utf-8");if(cl(r)){let n=/( {2}claude-mem:\n(?:.*\n)*?(?= {2}\S|\n\n|^\S|$))/m,s=bo(t)+`
|
|
344
|
+
`;if(!n.test(r))throw new Error("Found mcpServers/claude-mem markers but could not locate a replaceable claude-mem block");r=r.replace(n,s),wt(e,r),console.log(` Updated existing claude-mem entry in: ${e}`)}else if(r.includes("mcpServers:")){let s=r.indexOf("mcpServers:")+11,o=`
|
|
345
|
+
`+bo(t);r=r.slice(0,s)+o+r.slice(s),wt(e,r),console.log(` Added claude-mem to existing mcpServers in: ${e}`)}else{let n=`
|
|
346
|
+
`+Mo(t)+`
|
|
339
347
|
`;r=r.trimEnd()+`
|
|
340
|
-
`+
|
|
341
|
-
`;
|
|
348
|
+
`+n,wt(e,r),console.log(` Appended mcpServers section to: ${e}`)}}else{let r=Mo(t)+`
|
|
349
|
+
`;wt(e,r),console.log(` Created config with MCP server: ${e}`)}console.log(`
|
|
342
350
|
Installation complete!
|
|
343
351
|
|
|
344
|
-
MCP config: ${
|
|
352
|
+
MCP config: ${e}
|
|
345
353
|
|
|
346
354
|
Note: This is an MCP-only integration providing search tools and context.
|
|
347
355
|
Transcript capture is not available for Goose.
|
|
@@ -349,39 +357,39 @@ Transcript capture is not available for Goose.
|
|
|
349
357
|
Next steps:
|
|
350
358
|
1. Start claude-mem worker: npx claude-mem start
|
|
351
359
|
2. Restart Goose to pick up the MCP server
|
|
352
|
-
`)}var
|
|
360
|
+
`)}var Zc,rl,nl,sl,ol,il,ul,Oo=S(()=>{"use strict";ut();Ve();Zr();Zc=`# claude-mem: Cross-Session Memory
|
|
353
361
|
|
|
354
362
|
*No context yet. Complete your first session and context will appear here.*
|
|
355
363
|
|
|
356
|
-
Use claude-mem's MCP search tools for manual memory queries
|
|
357
|
-
`),
|
|
358
|
-
${
|
|
359
|
-
`),"Next Steps"),
|
|
360
|
-
Next Steps`),
|
|
364
|
+
Use claude-mem's MCP search tools for manual memory queries.`;rl={ideId:"copilot-cli",ideLabel:"Copilot CLI",configPath:Y.join(vt(),".github","copilot","mcp.json"),configKey:"servers",contextFile:{path:Y.join(process.cwd(),".github","copilot-instructions.md"),isWorkspaceRelative:!0}},nl={ideId:"antigravity",ideLabel:"Antigravity",configPath:Y.join(vt(),".gemini","antigravity","mcp_config.json"),configKey:"mcpServers",contextFile:{path:Y.join(process.cwd(),".agents","rules","claude-mem-context.md"),isWorkspaceRelative:!0}},sl={ideId:"crush",ideLabel:"Crush",configPath:Y.join(vt(),".config","crush","mcp.json"),configKey:"mcpServers"},ol={ideId:"roo-code",ideLabel:"Roo Code",configPath:Y.join(process.cwd(),".roo","mcp.json"),configKey:"mcpServers",contextFile:{path:Y.join(process.cwd(),".roo","rules","claude-mem-context.md"),isWorkspaceRelative:!0}},il={ideId:"warp",ideLabel:"Warp",configPath:Y.join(vt(),".warp","mcp.json"),configKey:"mcpServers",contextFile:{path:Y.join(process.cwd(),"WARP.md"),isWorkspaceRelative:!0}};ul={"copilot-cli":yt(rl),antigravity:yt(nl),goose:Ro,crush:yt(sl),"roo-code":yt(ol),warp:yt(il)}});var lr={};se(lr,{runInstallCommand:()=>vl});import{execSync as En}from"child_process";import{cpSync as Po,existsSync as _t,readFileSync as dl,rmSync as Fo}from"fs";import{join as We}from"path";async function pl(e){if(Ee)await Ut(e);else for(let t of e){let r=await t.task(n=>console.log(` ${n}`));console.log(` ${r}`)}}function ml(){let e=ee(ke(),{});e.thedotmack={source:{source:"github",repo:"thedotmack/claude-mem"},installLocation:G(),lastUpdated:new Date().toISOString(),autoUpdate:!0},Xe(ve()),pe(ke(),e)}function gl(e){let t=ee(Me(),{});t.version||(t.version=2),t.plugins||(t.plugins={});let r=fr(e),n=new Date().toISOString();t.plugins["claude-mem@thedotmack"]=[{scope:"user",installPath:r,version:e,installedAt:n,lastUpdated:n}],pe(Me(),t)}function fl(){let e=ee(be(),{});e.enabledPlugins||(e.enabledPlugins={}),e.enabledPlugins["claude-mem@thedotmack"]=!0,pe(be(),e)}async function hl(e){let t=[];for(let r of e)switch(r){case"claude-code":{try{En("claude plugin marketplace add thedotmack/claude-mem && claude plugin install claude-mem",{stdio:"inherit"}),_.success("Claude Code: plugin installed via CLI.")}catch(n){console.error("[install] Claude Code plugin install error:",n instanceof Error?n.message:String(n)),_.error("Claude Code: plugin install failed. Is `claude` CLI on your PATH?"),t.push(r)}break}case"cursor":{let{installCursorHooks:n,configureCursorMcp:s}=await Promise.resolve().then(()=>(ut(),Js));await n("user")===0?s("user")===0?_.success("Cursor: hooks + MCP installed."):_.success("Cursor: hooks installed (MCP setup failed \u2014 run `npx claude-mem cursor mcp` to retry)."):(_.error("Cursor: hook installation failed."),t.push(r));break}case"gemini-cli":{let{installGeminiCliHooks:n}=await Promise.resolve().then(()=>(qr(),Xr));await n()===0?_.success("Gemini CLI: hooks installed."):(_.error("Gemini CLI: hook installation failed."),t.push(r));break}case"opencode":{let{installOpenCodeIntegration:n}=await Promise.resolve().then(()=>(rn(),tn));await n()===0?_.success("OpenCode: plugin installed."):(_.error("OpenCode: plugin installation failed."),t.push(r));break}case"windsurf":{let{installWindsurfHooks:n}=await Promise.resolve().then(()=>(an(),on));await n()===0?_.success("Windsurf: hooks installed."):(_.error("Windsurf: hook installation failed."),t.push(r));break}case"openclaw":{let{installOpenClawIntegration:n}=await Promise.resolve().then(()=>(dn(),un));await n()===0?_.success("OpenClaw: plugin installed."):(_.error("OpenClaw: plugin installation failed."),t.push(r));break}case"codex-cli":{let{installCodexCli:n}=await Promise.resolve().then(()=>(hn(),fn));await n()===0?_.success("Codex CLI: transcript watching configured."):(_.error("Codex CLI: integration setup failed."),t.push(r));break}case"copilot-cli":case"antigravity":case"goose":case"crush":case"roo-code":case"warp":{let{MCP_IDE_INSTALLERS:n}=await Promise.resolve().then(()=>(Oo(),Do)),s=n[r];if(s){let o=await s(),c=ot().find(p=>p.id===r)?.label??r;o===0?_.success(`${c}: MCP integration installed.`):(_.error(`${c}: MCP integration failed.`),t.push(r))}break}default:{let s=ot().find(o=>o.id===r);s&&!s.supported&&_.warn(`Support for ${s.label} coming soon.`);break}}return t}async function El(){let t=ot().filter(s=>s.detected);if(t.length===0)return _.warn("No supported IDEs detected. Installing for Claude Code by default."),["claude-code"];let r=t.map(s=>({value:s.id,label:s.label,hint:s.supported?s.hint:"coming soon"})),n=await ns({message:"Which IDEs do you use?",options:r,initialValues:t.filter(s=>s.supported).map(s=>s.id),required:!0});return ge(n)&&(rt("Installation cancelled."),process.exit(0)),n}function Sl(){let e=G(),t=Mt();Xe(e);let r=["plugin","package.json","package-lock.json","node_modules","openclaw","dist","LICENSE","README.md","CHANGELOG.md"];for(let n of r){let s=We(t,n),o=We(e,n);_t(s)&&(_t(o)&&Fo(o,{recursive:!0,force:!0}),Po(s,o,{recursive:!0,force:!0}))}}function Cl(e){let t=hr(),r=fr(e);Fo(r,{recursive:!0,force:!0}),Xe(r),Po(t,r,{recursive:!0,force:!0})}function yl(){let e=G(),t=We(e,"package.json");_t(t)&&En("npm install --production",{cwd:e,stdio:"pipe",encoding:"utf8",...de?{shell:process.env.ComSpec??"cmd.exe"}:{}})}function wl(){let e=We(G(),"plugin","scripts","smart-install.js");if(!_t(e))return _.warn("smart-install.js not found \u2014 skipping Bun/uv auto-install."),!1;try{return En(`node "${e}"`,{stdio:"inherit",encoding:"utf8",...de?{shell:process.env.ComSpec??"cmd.exe"}:{}}),!0}catch(t){return console.warn("[install] smart-install error:",t instanceof Error?t.message:String(t)),_.warn("smart-install encountered an issue. You may need to install Bun/uv manually."),!1}}async function vl(e={}){let t=Ye();Ee?Nt(M.default.bgCyan(M.default.black(" claude-mem install "))):console.log("claude-mem install"),_.info(`Version: ${M.default.cyan(t)}`),_.info(`Platform: ${process.platform} (${process.arch})`);let r=G();if(_t(We(r,"plugin",".claude-plugin","plugin.json"))){try{let d=JSON.parse(dl(We(r,"plugin",".claude-plugin","plugin.json"),"utf-8"));_.warn(`Existing installation detected (v${d.version??"unknown"}).`)}catch(d){console.warn("[install] Failed to read existing plugin version:",d instanceof Error?d.message:String(d)),_.warn("Existing installation detected.")}if(process.stdin.isTTY){let d=await tt({message:"Overwrite existing installation?",initialValue:!0});(ge(d)||!d)&&(rt("Installation cancelled."),process.exit(0))}}let s;if(e.ide){s=[e.ide];let d=ot(),g=d.find(E=>E.id===e.ide);g&&!g.supported&&(_.error(`Support for ${g.label} coming soon.`),process.exit(1)),g||(_.error(`Unknown IDE: ${e.ide}`),_.info(`Available IDEs: ${d.map(E=>E.id).join(", ")}`),process.exit(1))}else process.stdin.isTTY?s=await El():s=["claude-code"];s.some(d=>d!=="claude-code")&&await pl([{title:"Copying plugin files",task:async d=>(d("Copying to marketplace directory..."),Sl(),`Plugin files copied ${M.default.green("OK")}`)},{title:"Caching plugin version",task:async d=>(d(`Caching v${t}...`),Cl(t),`Plugin cached (v${t}) ${M.default.green("OK")}`)},{title:"Registering marketplace",task:async()=>(ml(),`Marketplace registered ${M.default.green("OK")}`)},{title:"Registering plugin",task:async()=>(gl(t),`Plugin registered ${M.default.green("OK")}`)},{title:"Enabling plugin in Claude settings",task:async()=>(fl(),`Plugin enabled ${M.default.green("OK")}`)},{title:"Installing dependencies",task:async d=>{d("Running npm install...");try{return yl(),`Dependencies installed ${M.default.green("OK")}`}catch(g){return console.warn("[install] npm install error:",g instanceof Error?g.message:String(g)),`Dependencies may need manual install ${M.default.yellow("!")}`}}},{title:"Setting up Bun and uv",task:async d=>(d("Running smart-install..."),wl()?`Runtime dependencies ready ${M.default.green("OK")}`:`Runtime setup may need attention ${M.default.yellow("!")}`)}]);let i=await hl(s),a=i.length>0?"Installation Partial":"Installation Complete",c=[`Version: ${M.default.cyan(t)}`,`Plugin dir: ${M.default.cyan(r)}`,`IDEs: ${M.default.cyan(s.join(", "))}`];i.length>0&&c.push(`Failed: ${M.default.red(i.join(", "))}`),Ee?nt(c.join(`
|
|
365
|
+
`),a):(console.log(`
|
|
366
|
+
${a}`),c.forEach(d=>console.log(` ${d}`)));let p=process.env.CLAUDE_MEM_WORKER_PORT||"37777",m=["Open Claude Code and start a conversation -- memory is automatic!",`View your memories: ${M.default.underline(`http://localhost:${p}`)}`,`Search past work: use ${M.default.bold("/mem-search")} in Claude Code`,`Start worker: ${M.default.bold("npx claude-mem start")}`];Ee?(nt(m.join(`
|
|
367
|
+
`),"Next Steps"),i.length>0?xe(M.default.yellow("claude-mem installed with some IDE setup failures.")):xe(M.default.green("claude-mem installed successfully!"))):(console.log(`
|
|
368
|
+
Next Steps`),m.forEach(d=>console.log(` ${d}`)),i.length>0?(console.log(`
|
|
361
369
|
claude-mem installed with some IDE setup failures.`),process.exitCode=1):console.log(`
|
|
362
|
-
claude-mem installed successfully!`))}var
|
|
363
|
-
`),"Note"),
|
|
364
|
-
${
|
|
365
|
-
|
|
366
|
-
${
|
|
367
|
-
${
|
|
368
|
-
${
|
|
369
|
-
${
|
|
370
|
-
${
|
|
371
|
-
${
|
|
372
|
-
${
|
|
373
|
-
|
|
374
|
-
${
|
|
375
|
-
${
|
|
376
|
-
${
|
|
377
|
-
${
|
|
378
|
-
${
|
|
379
|
-
${
|
|
380
|
-
${
|
|
381
|
-
${
|
|
382
|
-
|
|
383
|
-
${
|
|
370
|
+
claude-mem installed successfully!`))}var M,Ee,_,ur=S(()=>{"use strict";Rr();M=Ie(Ke(),1);_e();Ve();is();Ee=process.stdin.isTTY===!0;_={info:e=>Ee?H.info(e):console.log(` ${e}`),success:e=>Ee?H.success(e):console.log(` ${e}`),warn:e=>Ee?H.warn(e):console.warn(` ${e}`),error:e=>Ee?H.error(e):console.error(` ${e}`)}});var Uo={};se(Uo,{runUninstallCommand:()=>bl});import{existsSync as Lo,rmSync as No}from"fs";import{join as _l}from"path";function xl(){let e=G();return Lo(e)?(No(e,{recursive:!0,force:!0}),!0):!1}function $l(){let e=_l(ve(),"cache","thedotmack","claude-mem");return Lo(e)?(No(e,{recursive:!0,force:!0}),!0):!1}function Il(){let e=ee(ke(),{});e.thedotmack&&(delete e.thedotmack,pe(ke(),e))}function kl(){let e=ee(Me(),{});e.plugins?.["claude-mem@thedotmack"]&&(delete e.plugins["claude-mem@thedotmack"],pe(Me(),e))}function Ml(){let e=ee(be(),{});e.enabledPlugins?.["claude-mem@thedotmack"]!==void 0&&(delete e.enabledPlugins["claude-mem@thedotmack"],pe(be(),e))}async function bl(){if(Nt(Q.default.bgRed(Q.default.white(" claude-mem uninstall "))),bt()){if(process.stdin.isTTY){let r=await tt({message:"Are you sure you want to uninstall claude-mem?",initialValue:!1});if(ge(r)||!r){rt("Uninstall cancelled.");return}}}else if(H.warn("claude-mem does not appear to be installed."),process.stdin.isTTY){let r=await tt({message:"Clean up any remaining registration data anyway?",initialValue:!1});if(ge(r)||!r){xe("Nothing to do.");return}}else{xe("Nothing to do.");return}let e=process.env.CLAUDE_MEM_WORKER_PORT||"37777";try{await fetch(`http://127.0.0.1:${e}/api/admin/shutdown`,{method:"POST",signal:AbortSignal.timeout(5e3)});for(let r=0;r<20;r++){await new Promise(n=>setTimeout(n,500));try{await fetch(`http://127.0.0.1:${e}/api/health`,{signal:AbortSignal.timeout(1e3)})}catch(n){console.error("[uninstall] Worker health check failed (worker stopped):",n instanceof Error?n.message:String(n));break}}H.info("Worker service stopped.")}catch{}await Ut([{title:"Removing marketplace directory",task:async()=>xl()?`Marketplace directory removed ${Q.default.green("OK")}`:`Marketplace directory not found ${Q.default.dim("skipped")}`},{title:"Removing cache directory",task:async()=>$l()?`Cache directory removed ${Q.default.green("OK")}`:`Cache directory not found ${Q.default.dim("skipped")}`},{title:"Removing marketplace registration",task:async()=>(Il(),`Marketplace registration removed ${Q.default.green("OK")}`)},{title:"Removing plugin registration",task:async()=>(kl(),`Plugin registration removed ${Q.default.green("OK")}`)},{title:"Removing from Claude settings",task:async()=>(Ml(),`Claude settings updated ${Q.default.green("OK")}`)}]);let t=[{label:"Gemini CLI hooks",fn:async()=>{let{uninstallGeminiCliHooks:r}=await Promise.resolve().then(()=>(qr(),Xr));return r()}},{label:"Windsurf hooks",fn:async()=>{let{uninstallWindsurfHooks:r}=await Promise.resolve().then(()=>(an(),on));return r()}},{label:"OpenCode plugin",fn:async()=>{let{uninstallOpenCodePlugin:r}=await Promise.resolve().then(()=>(rn(),tn));return r()}},{label:"OpenClaw plugin",fn:async()=>{let{uninstallOpenClawPlugin:r}=await Promise.resolve().then(()=>(dn(),un));return r()}},{label:"Codex CLI",fn:async()=>{let{uninstallCodexCli:r}=await Promise.resolve().then(()=>(hn(),fn));return r()}}];for(let{label:r,fn:n}of t)try{await n()===0&&H.info(`${r}: removed.`)}catch(s){console.warn(`[uninstall] ${r} cleanup failed:`,s instanceof Error?s.message:String(s))}nt([`Your data directory at ${Q.default.cyan("~/.claude-mem")} was preserved.`,"To remove it manually: rm -rf ~/.claude-mem"].join(`
|
|
371
|
+
`),"Note"),xe(Q.default.green("claude-mem has been uninstalled."))}var Q,jo=S(()=>{"use strict";Rr();Q=Ie(Ke(),1);_e();Ve()});import{spawnSync as Tl}from"child_process";import{existsSync as Al}from"fs";import{homedir as Sn}from"os";import{join as Cn}from"path";function Rl(){return de?[Cn(Sn(),".bun","bin","bun.exe"),Cn(process.env.USERPROFILE||Sn(),".bun","bin","bun.exe")]:[Cn(Sn(),".bun","bin","bun"),"/usr/local/bin/bun","/opt/homebrew/bin/bun","/home/linuxbrew/.linuxbrew/bin/bun"]}function Go(){let t=Tl(de?"where":"which",["bun"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"],shell:de});if(t.status===0&&t.stdout.trim())return"bun";for(let r of Rl())if(Al(r))return r;return null}var Wo=S(()=>{"use strict";_e()});var Se={};se(Se,{runAdoptCommand:()=>Ll,runRestartCommand:()=>Pl,runSearchCommand:()=>Nl,runStartCommand:()=>Dl,runStatusCommand:()=>Fl,runStopCommand:()=>Ol,runTranscriptWatchCommand:()=>Ul});import{spawn as yn}from"child_process";import{existsSync as wn}from"fs";import{join as Ho}from"path";function dr(){bt()||(console.error(L.default.red("claude-mem is not installed.")),console.error(`Run: ${L.default.bold("npx claude-mem install")}`),process.exit(1))}function vn(){let e=Go();return e||(console.error(L.default.red("Bun not found.")),console.error("Install Bun: https://bun.sh"),console.error("After installation, restart your terminal."),process.exit(1)),e}function Bo(){return Ho(G(),"plugin","scripts","worker-service.cjs")}function xt(e,t=[]){dr();let r=vn(),n=Bo();wn(n)||(console.error(L.default.red(`Worker script not found at: ${n}`)),console.error("The installation may be corrupted. Try: npx claude-mem install"),process.exit(1));let s=[n,e,...t],o=yn(r,s,{stdio:"inherit",cwd:G(),env:process.env});o.on("error",i=>{console.error(L.default.red(`Failed to start Bun: ${i.message}`)),process.exit(1)}),o.on("close",i=>{process.exit(i??0)})}function Dl(){xt("start")}function Ol(){xt("stop")}function Pl(){xt("restart")}function Fl(){xt("status")}function Ll(e=[]){dr();let t=vn(),r=Bo();wn(r)||(console.error(L.default.red(`Worker script not found at: ${r}`)),console.error("The installation may be corrupted. Try: npx claude-mem install"),process.exit(1));let n=process.cwd(),s=[r,"adopt","--cwd",n,...e],o=yn(t,s,{stdio:"inherit",cwd:G(),env:process.env});o.on("error",i=>{console.error(L.default.red(`Failed to start Bun: ${i.message}`)),process.exit(1)}),o.on("close",i=>{process.exit(i??0)})}async function Nl(e){dr();let t=e.join(" ").trim();t||(console.error(L.default.red("Usage: npx claude-mem search <query>")),process.exit(1));let n=`http://127.0.0.1:${process.env.CLAUDE_MEM_WORKER_PORT||"37777"}/api/search?query=${encodeURIComponent(t)}`,s;try{s=await fetch(n)}catch(i){let a=i instanceof Error?i.message:String(i);((i instanceof Error?i.cause:void 0)?.code==="ECONNREFUSED"||a.includes("ECONNREFUSED"))&&(console.error(L.default.red("Worker is not running.")),console.error(`Start it with: ${L.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(L.default.red(`Search failed: ${a}`)),process.exit(1)}s.ok||(s.status===404&&(console.error(L.default.red("Search endpoint not found. Is the worker running?")),console.error(`Try: ${L.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(L.default.red(`Search failed: HTTP ${s.status}`)),process.exit(1));let o;try{o=await s.json()}catch(i){let a=i instanceof Error?i.message:String(i);console.error(L.default.red(`Search failed: invalid JSON response (${a})`)),process.exit(1)}console.log(typeof o=="object"&&o!==null?JSON.stringify(o,null,2):o)}function Ul(){dr();let e=vn(),t=Ho(G(),"plugin","scripts","transcript-watcher.cjs");if(!wn(t)){xt("transcript",["watch"]);return}let r=yn(e,[t,"watch"],{stdio:"inherit",cwd:G(),env:process.env});r.on("error",n=>{console.error(L.default.red(`Failed to start transcript watcher: ${n.message}`)),process.exit(1)}),r.on("close",n=>{process.exit(n??0)})}var L,Ce=S(()=>{"use strict";L=Ie(Ke(),1);Wo();_e()});var b=Ie(Ke(),1);_e();var He=process.argv.slice(2),Ko=He[0]?.toLowerCase()??"";function jl(){let e=Ye();console.log(`
|
|
372
|
+
${b.default.bold("claude-mem")} v${e} \u2014 persistent memory for AI coding assistants
|
|
373
|
+
|
|
374
|
+
${b.default.bold("Install Commands")} (no Bun required):
|
|
375
|
+
${b.default.cyan("npx claude-mem")} Interactive install
|
|
376
|
+
${b.default.cyan("npx claude-mem install")} Interactive install
|
|
377
|
+
${b.default.cyan("npx claude-mem install --ide <id>")} Install for specific IDE
|
|
378
|
+
${b.default.cyan("npx claude-mem update")} Update to latest version
|
|
379
|
+
${b.default.cyan("npx claude-mem uninstall")} Remove plugin and configs
|
|
380
|
+
${b.default.cyan("npx claude-mem version")} Print version
|
|
381
|
+
|
|
382
|
+
${b.default.bold("Runtime Commands")} (requires Bun, delegates to installed plugin):
|
|
383
|
+
${b.default.cyan("npx claude-mem start")} Start worker service
|
|
384
|
+
${b.default.cyan("npx claude-mem stop")} Stop worker service
|
|
385
|
+
${b.default.cyan("npx claude-mem restart")} Restart worker service
|
|
386
|
+
${b.default.cyan("npx claude-mem status")} Show worker status
|
|
387
|
+
${b.default.cyan("npx claude-mem search <query>")} Search observations
|
|
388
|
+
${b.default.cyan("npx claude-mem adopt [--dry-run] [--branch <name>]")} Stamp merged worktrees into parent project
|
|
389
|
+
${b.default.cyan("npx claude-mem transcript watch")} Start transcript watcher
|
|
390
|
+
|
|
391
|
+
${b.default.bold("IDE Identifiers")}:
|
|
384
392
|
claude-code, cursor, gemini-cli, opencode, openclaw,
|
|
385
393
|
windsurf, codex-cli, copilot-cli, antigravity, goose,
|
|
386
394
|
crush, roo-code, warp
|
|
387
|
-
`)}async function
|
|
395
|
+
`)}async function Gl(){switch(Ko){case"":{let{runInstallCommand:e}=await Promise.resolve().then(()=>(ur(),lr));await e();break}case"install":{let e=He.indexOf("--ide"),t=e!==-1?He[e+1]:void 0,{runInstallCommand:r}=await Promise.resolve().then(()=>(ur(),lr));await r({ide:t});break}case"update":case"upgrade":{let{runInstallCommand:e}=await Promise.resolve().then(()=>(ur(),lr));await e();break}case"uninstall":case"remove":{let{runUninstallCommand:e}=await Promise.resolve().then(()=>(jo(),Uo));await e();break}case"version":case"--version":case"-v":{console.log(Ye());break}case"help":case"--help":case"-h":{jl();break}case"start":{let{runStartCommand:e}=await Promise.resolve().then(()=>(Ce(),Se));e();break}case"stop":{let{runStopCommand:e}=await Promise.resolve().then(()=>(Ce(),Se));e();break}case"restart":{let{runRestartCommand:e}=await Promise.resolve().then(()=>(Ce(),Se));e();break}case"status":{let{runStatusCommand:e}=await Promise.resolve().then(()=>(Ce(),Se));e();break}case"search":{let{runSearchCommand:e}=await Promise.resolve().then(()=>(Ce(),Se));await e(He.slice(1));break}case"adopt":{let{runAdoptCommand:e}=await Promise.resolve().then(()=>(Ce(),Se));e(He.slice(1));break}case"transcript":{let e=He[1]?.toLowerCase();if(e==="watch"){let{runTranscriptWatchCommand:t}=await Promise.resolve().then(()=>(Ce(),Se));t()}else console.error(b.default.red(`Unknown transcript subcommand: ${e??"(none)"}`)),console.error("Usage: npx claude-mem transcript watch"),process.exit(1);break}default:console.error(b.default.red(`Unknown command: ${Ko}`)),console.error(`Run ${b.default.bold("npx claude-mem --help")} for usage information.`),process.exit(1)}}Gl().catch(e=>{console.error(b.default.red("Fatal error:"),e.message||e),process.exit(1)});
|