claude-mem 10.6.3 → 10.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -3
- package/dist/npx-cli/index.js +278 -0
- package/dist/opencode-plugin/index.js +2 -0
- package/openclaw/Dockerfile.e2e +69 -0
- package/openclaw/SKILL.md +462 -0
- package/openclaw/TESTING.md +279 -0
- package/openclaw/dist/index.js +15 -0
- package/openclaw/e2e-verify.sh +265 -0
- package/openclaw/install.sh +1852 -0
- package/openclaw/openclaw.plugin.json +92 -0
- package/openclaw/package.json +20 -0
- package/openclaw/src/index.test.ts +981 -0
- package/openclaw/src/index.ts +1051 -0
- package/openclaw/test-e2e.sh +46 -0
- package/openclaw/test-install.sh +2339 -0
- package/openclaw/test-sse-consumer.js +106 -0
- package/openclaw/tsconfig.json +26 -0
- package/package.json +17 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/hooks.json +2 -2
- package/plugin/package.json +1 -1
- package/plugin/scripts/mcp-server.cjs +16 -16
- package/plugin/scripts/worker-service.cjs +254 -193
- package/plugin/skills/version-bump/SKILL.md +42 -0
- package/plugin/skills/version-bump/scripts/generate_changelog.js +37 -0
- package/plugin/.mcp.json +0 -8
- package/plugin/scripts/claude-mem +0 -0
package/README.md
CHANGED
|
@@ -127,17 +127,29 @@
|
|
|
127
127
|
|
|
128
128
|
## Quick Start
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
Install with a single command:
|
|
131
131
|
|
|
132
|
+
```bash
|
|
133
|
+
npx claude-mem install
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Or install for Gemini CLI (auto-detects `~/.gemini`):
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npx claude-mem install --ide gemini-cli
|
|
132
140
|
```
|
|
141
|
+
|
|
142
|
+
Or install from the plugin marketplace inside Claude Code:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
133
145
|
/plugin marketplace add thedotmack/claude-mem
|
|
134
146
|
|
|
135
147
|
/plugin install claude-mem
|
|
136
148
|
```
|
|
137
149
|
|
|
138
|
-
Restart Claude Code. Context from previous sessions will automatically appear in new sessions.
|
|
150
|
+
Restart Claude Code or Gemini CLI. Context from previous sessions will automatically appear in new sessions.
|
|
139
151
|
|
|
140
|
-
> **Note:** Claude-Mem is also published on npm, but `npm install -g claude-mem` installs the **SDK/library only** — it does not register the plugin hooks or set up the worker service.
|
|
152
|
+
> **Note:** Claude-Mem is also published on npm, but `npm install -g claude-mem` installs the **SDK/library only** — it does not register the plugin hooks or set up the worker service. Always install via `npx claude-mem install` or the `/plugin` commands above.
|
|
141
153
|
|
|
142
154
|
### 🦞 OpenClaw Gateway
|
|
143
155
|
|
|
@@ -171,6 +183,7 @@ The installer handles dependencies, plugin setup, AI provider configuration, wor
|
|
|
171
183
|
### Getting Started
|
|
172
184
|
|
|
173
185
|
- **[Installation Guide](https://docs.claude-mem.ai/installation)** - Quick start & advanced installation
|
|
186
|
+
- **[Gemini CLI Setup](https://docs.claude-mem.ai/gemini-cli/setup)** - Dedicated guide for Google's Gemini CLI integration
|
|
174
187
|
- **[Usage Guide](https://docs.claude-mem.ai/usage/getting-started)** - How Claude-Mem works automatically
|
|
175
188
|
- **[Search Tools](https://docs.claude-mem.ai/usage/search-tools)** - Query your project history with natural language
|
|
176
189
|
- **[Beta Features](https://docs.claude-mem.ai/beta-features)** - Try experimental features like Endless Mode
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var Vo=Object.create;var it=Object.defineProperty;var Xo=Object.getOwnPropertyDescriptor;var Ko=Object.getOwnPropertyNames;var Yo=Object.getPrototypeOf,qo=Object.prototype.hasOwnProperty;var zo=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var p=(n,e)=>()=>(n&&(e=n(n=0)),e);var qt=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),G=(n,e)=>{for(var o in e)it(n,o,{get:e[o],enumerable:!0})},Zo=(n,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ko(e))!qo.call(n,s)&&s!==o&&it(n,s,{get:()=>e[s],enumerable:!(r=Xo(e,s))||r.enumerable});return n};var X=(n,e,o)=>(o=n!=null?Vo(Yo(n)):{},Zo(e||!n||!n.__esModule?it(o,"default",{value:n,enumerable:!0}):o,n));var Z=qt((yu,at)=>{var ke=process||{},zt=ke.argv||[],we=ke.env||{},Qo=!(we.NO_COLOR||zt.includes("--no-color"))&&(!!we.FORCE_COLOR||zt.includes("--color")||ke.platform==="win32"||(ke.stdout||{}).isTTY&&we.TERM!=="dumb"||!!we.CI),er=(n,e,o=n)=>r=>{let s=""+r,u=s.indexOf(e,n.length);return~u?n+tr(s,e,o,u)+e:n+s+e},tr=(n,e,o,r)=>{let s="",u=0;do s+=n.substring(u,r)+o,u=r+e.length,r=n.indexOf(e,u);while(~r);return s+n.substring(u)},Zt=(n=Qo)=>{let e=n?er:()=>String;return{isColorSupported:n,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};at.exports=Zt();at.exports.createColors=Zt});import{existsSync as nr,readFileSync as or}from"fs";function ae(n,e){if(!nr(n))return e;try{return JSON.parse(or(n,"utf-8"))}catch{throw new Error(`Corrupt JSON file, refusing to overwrite: ${n}`)}}var ct=p(()=>{"use strict"});import{existsSync as ce,mkdirSync as rr,readFileSync as Qt,writeFileSync as sr}from"fs";import{homedir as ur}from"os";import{dirname as en,join as $}from"path";import{fileURLToPath as ir}from"url";function Dt(){return process.env.CLAUDE_CONFIG_DIR||$(ur(),".claude")}function W(){return $(Dt(),"plugins","marketplaces","thedotmack")}function Oe(){return $(Dt(),"plugins")}function lt(){return $(Oe(),"known_marketplaces.json")}function mt(){return $(Oe(),"installed_plugins.json")}function dt(){return $(Dt(),"settings.json")}function tn(){let n=ir(import.meta.url),e=$(en(n),"..","..");if(!ce($(e,"package.json")))throw new Error(`npmPackageRootDirectory: expected package.json at ${e}. Bundle structure may have changed \u2014 update the path walk.`);return e}function ar(){return $(tn(),"plugin")}function pt(){let n=$(ar(),".claude-plugin","plugin.json");if(ce(n))try{let o=JSON.parse(Qt(n,"utf-8"));if(o.version)return o.version}catch{}let e=$(tn(),"package.json");if(ce(e))try{let o=JSON.parse(Qt(e,"utf-8"));if(o.version)return o.version}catch{}return"0.0.0"}function Be(){let n=W();return ce($(n,"plugin",".claude-plugin","plugin.json"))}function cr(n){ce(n)||rr(n,{recursive:!0})}function Te(n,e){cr(en(n)),sr(n,JSON.stringify(e,null,2)+`
|
|
3
|
+
`,"utf-8")}var Me,De=p(()=>{"use strict";ct();Me=process.platform==="win32"});var Re={};G(Re,{runInstallCommand:()=>lr});import{execSync as Dr}from"child_process";async function lr(n={}){console.log(Ie.default.bold("claude-mem install")),console.log();try{Dr("claude plugin marketplace add thedotmack/claude-mem && claude plugin install claude-mem",{stdio:"inherit"})}catch{console.error(Ie.default.red("Installation failed.")),console.error("Make sure Claude Code CLI is installed and on your PATH."),process.exit(1)}console.log(),console.log(Ie.default.green("claude-mem installed successfully!")),console.log(),console.log("Open Claude Code and start a conversation \u2014 memory is automatic.")}var Ie,Le=p(()=>{"use strict";Ie=X(Z(),1)});var Ct=qt((Mu,nn)=>{"use strict";var gt={to(n,e){return e?`\x1B[${e+1};${n+1}H`:`\x1B[${n+1}G`},move(n,e){let o="";return n<0?o+=`\x1B[${-n}D`:n>0&&(o+=`\x1B[${n}C`),e<0?o+=`\x1B[${-e}A`:e>0&&(o+=`\x1B[${e}B`),o},up:(n=1)=>`\x1B[${n}A`,down:(n=1)=>`\x1B[${n}B`,forward:(n=1)=>`\x1B[${n}C`,backward:(n=1)=>`\x1B[${n}D`,nextLine:(n=1)=>"\x1B[E".repeat(n),prevLine:(n=1)=>"\x1B[F".repeat(n),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},mr={up:(n=1)=>"\x1B[S".repeat(n),down:(n=1)=>"\x1B[T".repeat(n)},dr={screen:"\x1B[2J",up:(n=1)=>"\x1B[1J".repeat(n),down:(n=1)=>"\x1B[J".repeat(n),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(n){let e="";for(let o=0;o<n;o++)e+=this.line+(o<n-1?gt.up():"");return n&&(e+=gt.left),e}};nn.exports={cursor:gt,scroll:mr,erase:dr,beep:"\x07"}});import{stdin as ln,stdout as mn}from"node:process";import*as H from"node:readline";import on from"node:readline";import{WriteStream as pr}from"node:tty";function gr({onlyFirst:n=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,n?void 0:"g")}function dn(n){if(typeof n!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof n}\``);return n.replace(Cr,"")}function pn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function le(n,e={}){if(typeof n!="string"||n.length===0||(e={ambiguousIsNarrow:!0,...e},n=dn(n),n.length===0))return 0;n=n.replace(Fr()," ");let o=e.ambiguousIsNarrow?1:2,r=0;for(let s of n){let u=s.codePointAt(0);if(!(u<=31||u>=127&&u<=159||u>=768&&u<=879))switch(hr.eastAsianWidth(s)){case"F":case"W":r+=2;break;case"A":r+=o;break;default:r+=1}}return r}function vr(){let n=new Map;for(let[e,o]of Object.entries(g)){for(let[r,s]of Object.entries(o))g[r]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},o[r]=g[r],n.set(s[0],s[1]);Object.defineProperty(g,e,{value:o,enumerable:!1})}return Object.defineProperty(g,"codes",{value:n,enumerable:!1}),g.color.close="\x1B[39m",g.bgColor.close="\x1B[49m",g.color.ansi=rn(),g.color.ansi256=sn(),g.color.ansi16m=un(),g.bgColor.ansi=rn(ft),g.bgColor.ansi256=sn(ft),g.bgColor.ansi16m=un(ft),Object.defineProperties(g,{rgbToAnsi256:{value:(e,o,r)=>e===o&&o===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(o/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:e=>{let o=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!o)return[0,0,0];let[r]=o;r.length===3&&(r=[...r].map(u=>u+u).join(""));let s=Number.parseInt(r,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:e=>g.rgbToAnsi256(...g.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let o,r,s;if(e>=232)o=((e-232)*10+8)/255,r=o,s=o;else{e-=16;let i=e%36;o=Math.floor(e/36)/5,r=Math.floor(i/6)/5,s=i%6/5}let u=Math.max(o,r,s)*2;if(u===0)return 30;let t=30+(Math.round(s)<<2|Math.round(r)<<1|Math.round(o));return u===2&&(t+=60),t},enumerable:!1},rgbToAnsi:{value:(e,o,r)=>g.ansi256ToAnsi(g.rgbToAnsi256(e,o,r)),enumerable:!1},hexToAnsi:{value:e=>g.ansi256ToAnsi(g.hexToAnsi256(e)),enumerable:!1}}),g}function Dn(n,e,o){return String(n).normalize().replace(/\r\n/g,`
|
|
4
|
+
`).split(`
|
|
5
|
+
`).map(r=>wr(r,e,o)).join(`
|
|
6
|
+
`)}function vt(n,e){if(typeof n=="string")return je.aliases.get(n)===e;for(let o of n)if(o!==void 0&&vt(o,e))return!0;return!1}function Mr(n,e){if(n===e)return;let o=n.split(`
|
|
7
|
+
`),r=e.split(`
|
|
8
|
+
`),s=[];for(let u=0;u<Math.max(o.length,r.length);u++)o[u]!==r[u]&&s.push(u);return s}function me(n){return n===Et}function Pe(n,e){let o=n;o.isTTY&&o.setRawMode(e)}function hn({input:n=ln,output:e=mn,overwrite:o=!0,hideCursor:r=!0}={}){let s=H.createInterface({input:n,output:e,prompt:"",tabSize:1});H.emitKeypressEvents(n,s),n.isTTY&&n.setRawMode(!0);let u=(t,{name:i,sequence:c})=>{let D=String(t);if(vt([D,i,c],"cancel")){r&&e.write(E.cursor.show),process.exit(0);return}if(!o)return;H.moveCursor(e,i==="return"?0:-1,i==="return"?-1:0,()=>{H.clearLine(e,1,()=>{n.once("keypress",u)})})};return r&&e.write(E.cursor.hide),n.once("keypress",u),()=>{n.off("keypress",u),r&&e.write(E.cursor.show),n.isTTY&&!Or&&n.setRawMode(!1),s.terminal=!1,s.close()}}var E,Cr,gn,fr,hr,Er,Fr,ft,rn,sn,un,g,yr,xr,_r,Ue,Sr,yt,Cn,Ar,fn,xt,an,cn,br,ht,$r,wr,kr,je,Or,Et,Br,Tr,_,Ft,Ne,_t=p(()=>{E=X(Ct(),1);Cr=gr();gn={exports:{}};(function(n){var e={};n.exports=e,e.eastAsianWidth=function(r){var s=r.charCodeAt(0),u=r.length==2?r.charCodeAt(1):0,t=s;return 55296<=s&&s<=56319&&56320<=u&&u<=57343&&(s&=1023,u&=1023,t=s<<10|u,t+=65536),t==12288||65281<=t&&t<=65376||65504<=t&&t<=65510?"F":t==8361||65377<=t&&t<=65470||65474<=t&&t<=65479||65482<=t&&t<=65487||65490<=t&&t<=65495||65498<=t&&t<=65500||65512<=t&&t<=65518?"H":4352<=t&&t<=4447||4515<=t&&t<=4519||4602<=t&&t<=4607||9001<=t&&t<=9002||11904<=t&&t<=11929||11931<=t&&t<=12019||12032<=t&&t<=12245||12272<=t&&t<=12283||12289<=t&&t<=12350||12353<=t&&t<=12438||12441<=t&&t<=12543||12549<=t&&t<=12589||12593<=t&&t<=12686||12688<=t&&t<=12730||12736<=t&&t<=12771||12784<=t&&t<=12830||12832<=t&&t<=12871||12880<=t&&t<=13054||13056<=t&&t<=19903||19968<=t&&t<=42124||42128<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||55216<=t&&t<=55238||55243<=t&&t<=55291||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65106||65108<=t&&t<=65126||65128<=t&&t<=65131||110592<=t&&t<=110593||127488<=t&&t<=127490||127504<=t&&t<=127546||127552<=t&&t<=127560||127568<=t&&t<=127569||131072<=t&&t<=194367||177984<=t&&t<=196605||196608<=t&&t<=262141?"W":32<=t&&t<=126||162<=t&&t<=163||165<=t&&t<=166||t==172||t==175||10214<=t&&t<=10221||10629<=t&&t<=10630?"Na":t==161||t==164||167<=t&&t<=168||t==170||173<=t&&t<=174||176<=t&&t<=180||182<=t&&t<=186||188<=t&&t<=191||t==198||t==208||215<=t&&t<=216||222<=t&&t<=225||t==230||232<=t&&t<=234||236<=t&&t<=237||t==240||242<=t&&t<=243||247<=t&&t<=250||t==252||t==254||t==257||t==273||t==275||t==283||294<=t&&t<=295||t==299||305<=t&&t<=307||t==312||319<=t&&t<=322||t==324||328<=t&&t<=331||t==333||338<=t&&t<=339||358<=t&&t<=359||t==363||t==462||t==464||t==466||t==468||t==470||t==472||t==474||t==476||t==593||t==609||t==708||t==711||713<=t&&t<=715||t==717||t==720||728<=t&&t<=731||t==733||t==735||768<=t&&t<=879||913<=t&&t<=929||931<=t&&t<=937||945<=t&&t<=961||963<=t&&t<=969||t==1025||1040<=t&&t<=1103||t==1105||t==8208||8211<=t&&t<=8214||8216<=t&&t<=8217||8220<=t&&t<=8221||8224<=t&&t<=8226||8228<=t&&t<=8231||t==8240||8242<=t&&t<=8243||t==8245||t==8251||t==8254||t==8308||t==8319||8321<=t&&t<=8324||t==8364||t==8451||t==8453||t==8457||t==8467||t==8470||8481<=t&&t<=8482||t==8486||t==8491||8531<=t&&t<=8532||8539<=t&&t<=8542||8544<=t&&t<=8555||8560<=t&&t<=8569||t==8585||8592<=t&&t<=8601||8632<=t&&t<=8633||t==8658||t==8660||t==8679||t==8704||8706<=t&&t<=8707||8711<=t&&t<=8712||t==8715||t==8719||t==8721||t==8725||t==8730||8733<=t&&t<=8736||t==8739||t==8741||8743<=t&&t<=8748||t==8750||8756<=t&&t<=8759||8764<=t&&t<=8765||t==8776||t==8780||t==8786||8800<=t&&t<=8801||8804<=t&&t<=8807||8810<=t&&t<=8811||8814<=t&&t<=8815||8834<=t&&t<=8835||8838<=t&&t<=8839||t==8853||t==8857||t==8869||t==8895||t==8978||9312<=t&&t<=9449||9451<=t&&t<=9547||9552<=t&&t<=9587||9600<=t&&t<=9615||9618<=t&&t<=9621||9632<=t&&t<=9633||9635<=t&&t<=9641||9650<=t&&t<=9651||9654<=t&&t<=9655||9660<=t&&t<=9661||9664<=t&&t<=9665||9670<=t&&t<=9672||t==9675||9678<=t&&t<=9681||9698<=t&&t<=9701||t==9711||9733<=t&&t<=9734||t==9737||9742<=t&&t<=9743||9748<=t&&t<=9749||t==9756||t==9758||t==9792||t==9794||9824<=t&&t<=9825||9827<=t&&t<=9829||9831<=t&&t<=9834||9836<=t&&t<=9837||t==9839||9886<=t&&t<=9887||9918<=t&&t<=9919||9924<=t&&t<=9933||9935<=t&&t<=9953||t==9955||9960<=t&&t<=9983||t==10045||t==10071||10102<=t&&t<=10111||11093<=t&&t<=11097||12872<=t&&t<=12879||57344<=t&&t<=63743||65024<=t&&t<=65039||t==65533||127232<=t&&t<=127242||127248<=t&&t<=127277||127280<=t&&t<=127337||127344<=t&&t<=127386||917760<=t&&t<=917999||983040<=t&&t<=1048573||1048576<=t&&t<=1114109?"A":"N"},e.characterLength=function(r){var s=this.eastAsianWidth(r);return s=="F"||s=="W"||s=="A"?2:1};function o(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(r){for(var s=o(r),u=0,t=0;t<s.length;t++)u=u+this.characterLength(s[t]);return u},e.slice=function(r,s,u){textLen=e.length(r),s=s||0,u=u||1,s<0&&(s=textLen+s),u<0&&(u=textLen+u);for(var t="",i=0,c=o(r),D=0;D<c.length;D++){var m=c[D],d=e.length(m);if(i>=s-(d==2?1:0))if(i+d<=u)t+=m;else break;i+=d}return t}})(gn);fr=gn.exports,hr=pn(fr),Er=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},Fr=pn(Er);ft=10,rn=(n=0)=>e=>`\x1B[${e+n}m`,sn=(n=0)=>e=>`\x1B[${38+n};5;${e}m`,un=(n=0)=>(e,o,r)=>`\x1B[${38+n};2;${e};${o};${r}m`,g={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(g.modifier);yr=Object.keys(g.color),xr=Object.keys(g.bgColor);[...yr,...xr];_r=vr(),Ue=new Set(["\x1B","\x9B"]),Sr=39,yt="\x07",Cn="[",Ar="]",fn="m",xt=`${Ar}8;;`,an=n=>`${Ue.values().next().value}${Cn}${n}${fn}`,cn=n=>`${Ue.values().next().value}${xt}${n}${yt}`,br=n=>n.split(" ").map(e=>le(e)),ht=(n,e,o)=>{let r=[...e],s=!1,u=!1,t=le(dn(n[n.length-1]));for(let[i,c]of r.entries()){let D=le(c);if(t+D<=o?n[n.length-1]+=c:(n.push(c),t=0),Ue.has(c)&&(s=!0,u=r.slice(i+1).join("").startsWith(xt)),s){u?c===yt&&(s=!1,u=!1):c===fn&&(s=!1);continue}t+=D,t===o&&i<r.length-1&&(n.push(""),t=0)}!t&&n[n.length-1].length>0&&n.length>1&&(n[n.length-2]+=n.pop())},$r=n=>{let e=n.split(" "),o=e.length;for(;o>0&&!(le(e[o-1])>0);)o--;return o===e.length?n:e.slice(0,o).join(" ")+e.slice(o).join("")},wr=(n,e,o={})=>{if(o.trim!==!1&&n.trim()==="")return"";let r="",s,u,t=br(n),i=[""];for(let[D,m]of n.split(" ").entries()){o.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let d=le(i[i.length-1]);if(D!==0&&(d>=e&&(o.wordWrap===!1||o.trim===!1)&&(i.push(""),d=0),(d>0||o.trim===!1)&&(i[i.length-1]+=" ",d++)),o.hard&&t[D]>e){let b=e-d,L=1+Math.floor((t[D]-b-1)/e);Math.floor((t[D]-1)/e)<L&&i.push(""),ht(i,m,e);continue}if(d+t[D]>e&&d>0&&t[D]>0){if(o.wordWrap===!1&&d<e){ht(i,m,e);continue}i.push("")}if(d+t[D]>e&&o.wordWrap===!1){ht(i,m,e);continue}i[i.length-1]+=m}o.trim!==!1&&(i=i.map(D=>$r(D)));let c=[...i.join(`
|
|
9
|
+
`)];for(let[D,m]of c.entries()){if(r+=m,Ue.has(m)){let{groups:b}=new RegExp(`(?:\\${Cn}(?<code>\\d+)m|\\${xt}(?<uri>.*)${yt})`).exec(c.slice(D).join(""))||{groups:{}};if(b.code!==void 0){let L=Number.parseFloat(b.code);s=L===Sr?void 0:L}else b.uri!==void 0&&(u=b.uri.length===0?void 0:b.uri)}let d=_r.codes.get(Number(s));c[D+1]===`
|
|
10
|
+
`?(u&&(r+=cn("")),s&&d&&(r+=an(d))):m===`
|
|
11
|
+
`&&(s&&d&&(r+=an(s)),u&&(r+=cn(u)))}return r};kr=["up","down","left","right","space","enter","cancel"],je={actions:new Set(kr),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};Or=globalThis.process.platform.startsWith("win"),Et=Symbol("clack:cancel");Br=Object.defineProperty,Tr=(n,e,o)=>e in n?Br(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,_=(n,e,o)=>(Tr(n,typeof e!="symbol"?e+"":e,o),o),Ft=class{constructor(e,o=!0){_(this,"input"),_(this,"output"),_(this,"_abortSignal"),_(this,"rl"),_(this,"opts"),_(this,"_render"),_(this,"_track",!1),_(this,"_prevFrame",""),_(this,"_subscribers",new Map),_(this,"_cursor",0),_(this,"state","initial"),_(this,"error",""),_(this,"value");let{input:r=ln,output:s=mn,render:u,signal:t,...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=u.bind(this),this._track=o,this._abortSignal=t,this.input=r,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(e,o){let r=this._subscribers.get(e)??[];r.push(o),this._subscribers.set(e,r)}on(e,o){this.setSubscriber(e,{cb:o})}once(e,o){this.setSubscriber(e,{cb:o,once:!0})}emit(e,...o){let r=this._subscribers.get(e)??[],s=[];for(let u of r)u.cb(...o),u.once&&s.push(()=>r.splice(r.indexOf(u),1));for(let u of s)u()}prompt(){return new Promise((e,o)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Et);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let r=new pr(0);r._write=(s,u,t)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),t()},this.input.pipe(r),this.rl=on.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),on.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Pe(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(E.cursor.show),this.output.off("resize",this.render),Pe(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(E.cursor.show),this.output.off("resize",this.render),Pe(this.input,!1),e(Et)})})}onKeypress(e,o){if(this.state==="error"&&(this.state="active"),o?.name&&(!this._track&&je.aliases.has(o.name)&&this.emit("cursor",je.aliases.get(o.name)),je.actions.has(o.name)&&this.emit("cursor",o.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),o?.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.value))}this.state!=="error"&&(this.state="submit")}vt([e,o?.name,o?.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
|
+
`),Pe(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Dn(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
13
|
+
`).length-1;this.output.write(E.cursor.move(-999,e*-1))}render(){let e=Dn(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(E.cursor.hide);else{let o=Mr(this._prevFrame,e);if(this.restoreCursor(),o&&o?.length===1){let r=o[0];this.output.write(E.cursor.move(0,r)),this.output.write(E.erase.lines(1));let s=e.split(`
|
|
14
|
+
`);this.output.write(s[r]),this._prevFrame=e,this.output.write(E.cursor.move(0,s.length-r-1));return}if(o&&o?.length>1){let r=o[0];this.output.write(E.cursor.move(0,r)),this.output.write(E.erase.down());let s=e.split(`
|
|
15
|
+
`).slice(r);this.output.write(s.join(`
|
|
16
|
+
`)),this._prevFrame=e;return}this.output.write(E.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Ne=class extends Ft{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",o=>{this.output.write(E.cursor.move(0,-1)),this.value=o,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}});import{stripVTControlCharacters as St}from"node:util";import B from"node:process";function Ir(){return B.platform!=="win32"?B.env.TERM!=="linux":!!B.env.CI||!!B.env.WT_SESSION||!!B.env.TERMINUS_SUBLIME||B.env.ConEmuTask==="{cmd::Cmder}"||B.env.TERM_PROGRAM==="Terminus-Sublime"||B.env.TERM_PROGRAM==="vscode"||B.env.TERM==="xterm-256color"||B.env.TERM==="alacritty"||B.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var a,Ge,At,C,Rr,xn,vn,We,Lr,S,bt,En,Fn,Vu,Xu,Ku,Yu,yn,Pr,jr,Nr,Ur,Gr,Wr,Hr,Jr,$t,_n,Sn,An,He,P,Vr,bn,$n=p(()=>{_t();_t();a=X(Z(),1),Ge=X(Ct(),1);At=Ir(),C=(n,e)=>At?n:e,Rr=C("\u25C6","*"),xn=C("\u25A0","x"),vn=C("\u25B2","x"),We=C("\u25C7","o"),Lr=C("\u250C","T"),S=C("\u2502","|"),bt=C("\u2514","\u2014"),En=C("\u25CF",">"),Fn=C("\u25CB"," "),Vu=C("\u25FB","[\u2022]"),Xu=C("\u25FC","[+]"),Ku=C("\u25FB","[ ]"),Yu=C("\u25AA","\u2022"),yn=C("\u2500","-"),Pr=C("\u256E","+"),jr=C("\u251C","+"),Nr=C("\u256F","+"),Ur=C("\u25CF","\u2022"),Gr=C("\u25C6","*"),Wr=C("\u25B2","!"),Hr=C("\u25A0","x"),Jr=n=>{switch(n){case"initial":case"active":return a.default.cyan(Rr);case"cancel":return a.default.red(xn);case"error":return a.default.yellow(vn);case"submit":return a.default.green(We)}},$t=n=>{let e=n.active??"Yes",o=n.inactive??"No";return new Ne({active:e,inactive:o,initialValue:n.initialValue??!0,render(){let r=`${a.default.gray(S)}
|
|
17
|
+
${Jr(this.state)} ${n.message}
|
|
18
|
+
`,s=this.value?e:o;switch(this.state){case"submit":return`${r}${a.default.gray(S)} ${a.default.dim(s)}`;case"cancel":return`${r}${a.default.gray(S)} ${a.default.strikethrough(a.default.dim(s))}
|
|
19
|
+
${a.default.gray(S)}`;default:return`${r}${a.default.cyan(S)} ${this.value?`${a.default.green(En)} ${e}`:`${a.default.dim(Fn)} ${a.default.dim(e)}`} ${a.default.dim("/")} ${this.value?`${a.default.dim(Fn)} ${a.default.dim(o)}`:`${a.default.green(En)} ${o}`}
|
|
20
|
+
${a.default.cyan(bt)}
|
|
21
|
+
`}}}).prompt()},_n=(n="",e="")=>{let o=`
|
|
22
|
+
${n}
|
|
23
|
+
`.split(`
|
|
24
|
+
`),r=St(e).length,s=Math.max(o.reduce((t,i)=>{let c=St(i);return c.length>t?c.length:t},0),r)+2,u=o.map(t=>`${a.default.gray(S)} ${a.default.dim(t)}${" ".repeat(s-St(t).length)}${a.default.gray(S)}`).join(`
|
|
25
|
+
`);process.stdout.write(`${a.default.gray(S)}
|
|
26
|
+
${a.default.green(We)} ${a.default.reset(e)} ${a.default.gray(yn.repeat(Math.max(s-r-1,1))+Pr)}
|
|
27
|
+
${u}
|
|
28
|
+
${a.default.gray(jr+yn.repeat(s+2)+Nr)}
|
|
29
|
+
`)},Sn=(n="")=>{process.stdout.write(`${a.default.gray(bt)} ${a.default.red(n)}
|
|
30
|
+
|
|
31
|
+
`)},An=(n="")=>{process.stdout.write(`${a.default.gray(Lr)} ${n}
|
|
32
|
+
`)},He=(n="")=>{process.stdout.write(`${a.default.gray(S)}
|
|
33
|
+
${a.default.gray(bt)} ${n}
|
|
34
|
+
|
|
35
|
+
`)},P={message:(n="",{symbol:e=a.default.gray(S)}={})=>{let o=[`${a.default.gray(S)}`];if(n){let[r,...s]=n.split(`
|
|
36
|
+
`);o.push(`${e} ${r}`,...s.map(u=>`${a.default.gray(S)} ${u}`))}process.stdout.write(`${o.join(`
|
|
37
|
+
`)}
|
|
38
|
+
`)},info:n=>{P.message(n,{symbol:a.default.blue(Ur)})},success:n=>{P.message(n,{symbol:a.default.green(Gr)})},step:n=>{P.message(n,{symbol:a.default.green(We)})},warn:n=>{P.message(n,{symbol:a.default.yellow(Wr)})},warning:n=>{P.warn(n)},error:n=>{P.message(n,{symbol:a.default.red(Hr)})}},Vr=()=>{let n=At?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],e=At?80:120,o=process.env.CI==="true",r,s,u=!1,t="",i,c=y=>{let O=y>1?"Something went wrong":"Canceled";u&&ie(O,y)},D=()=>c(2),m=()=>c(1),d=()=>{process.on("uncaughtExceptionMonitor",D),process.on("unhandledRejection",D),process.on("SIGINT",m),process.on("SIGTERM",m),process.on("exit",c)},b=()=>{process.removeListener("uncaughtExceptionMonitor",D),process.removeListener("unhandledRejection",D),process.removeListener("SIGINT",m),process.removeListener("SIGTERM",m),process.removeListener("exit",c)},L=()=>{if(i===void 0)return;o&&process.stdout.write(`
|
|
39
|
+
`);let y=i.split(`
|
|
40
|
+
`);process.stdout.write(Ge.cursor.move(-999,y.length-1)),process.stdout.write(Ge.erase.down(y.length))},$e=y=>y.replace(/\.+$/,""),Yt=(y="")=>{u=!0,r=hn(),t=$e(y),process.stdout.write(`${a.default.gray(S)}
|
|
41
|
+
`);let O=0,U=0;d(),s=setInterval(()=>{if(o&&t===i)return;L(),i=t;let Ho=a.default.magenta(n[O]),Jo=o?"...":".".repeat(Math.floor(U)).slice(0,3);process.stdout.write(`${Ho} ${t}${Jo}`),O=O+1<n.length?O+1:0,U=U<n.length?U+.125:0},e)},ie=(y="",O=0)=>{u=!1,clearInterval(s),L();let U=O===0?a.default.green(We):O===1?a.default.red(xn):a.default.red(vn);t=$e(y??t),process.stdout.write(`${U} ${t}
|
|
42
|
+
`),b(),r()};return{start:Yt,stop:ie,message:(y="")=>{t=$e(y??t)}}},bn=async n=>{for(let e of n){if(e.enabled===!1)continue;let o=Vr();o.start(e.title);let r=await e.task(o.message);o.stop(r||e.title)}}});import{appendFileSync as Kr,existsSync as wn,mkdirSync as Yr,readFileSync as qr}from"fs";import{join as Je}from"path";import{homedir as zr}from"os";var wt,kn,kt,l,T=p(()=>{"use strict";wt=(u=>(u[u.DEBUG=0]="DEBUG",u[u.INFO=1]="INFO",u[u.WARN=2]="WARN",u[u.ERROR=3]="ERROR",u[u.SILENT=4]="SILENT",u))(wt||{}),kn=Je(zr(),".claude-mem"),kt=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let e=Je(kn,"logs");wn(e)||Yr(e,{recursive:!0});let o=new Date().toISOString().split("T")[0];this.logFilePath=Je(e,`claude-mem-${o}.log`)}catch(e){console.error("[LOGGER] Failed to initialize log file:",e),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let e=Je(kn,"settings.json");if(wn(e)){let o=qr(e,"utf-8"),s=(JSON.parse(o).CLAUDE_MEM_LOG_LEVEL||"INFO").toUpperCase();this.level=wt[s]??1}else this.level=1}catch{this.level=1}return this.level}correlationId(e,o){return`obs-${e}-${o}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message}
|
|
43
|
+
${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let o=Object.keys(e);return o.length===0?"{}":o.length<=3?JSON.stringify(e):`{${o.length} keys: ${o.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,o){if(!o)return e;let r=o;if(typeof o=="string")try{r=JSON.parse(o)}catch{r=o}if(e==="Bash"&&r.command)return`${e}(${r.command})`;if(r.file_path)return`${e}(${r.file_path})`;if(r.notebook_path)return`${e}(${r.notebook_path})`;if(e==="Glob"&&r.pattern)return`${e}(${r.pattern})`;if(e==="Grep"&&r.pattern)return`${e}(${r.pattern})`;if(r.url)return`${e}(${r.url})`;if(r.query)return`${e}(${r.query})`;if(e==="Task"){if(r.subagent_type)return`${e}(${r.subagent_type})`;if(r.description)return`${e}(${r.description})`}return e==="Skill"&&r.skill?`${e}(${r.skill})`:e==="LSP"&&r.operation?`${e}(${r.operation})`:e}formatTimestamp(e){let o=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0"),u=String(e.getHours()).padStart(2,"0"),t=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0"),c=String(e.getMilliseconds()).padStart(3,"0");return`${o}-${r}-${s} ${u}:${t}:${i}.${c}`}log(e,o,r,s,u){if(e<this.getLevel())return;this.ensureLogFileInitialized();let t=this.formatTimestamp(new Date),i=wt[e].padEnd(5),c=o.padEnd(6),D="";s?.correlationId?D=`[${s.correlationId}] `:s?.sessionId&&(D=`[session-${s.sessionId}] `);let m="";u!=null&&(u instanceof Error?m=this.getLevel()===0?`
|
|
44
|
+
${u.message}
|
|
45
|
+
${u.stack}`:` ${u.message}`:this.getLevel()===0&&typeof u=="object"?m=`
|
|
46
|
+
`+JSON.stringify(u,null,2):m=" "+this.formatData(u));let d="";if(s){let{sessionId:L,memorySessionId:$e,correlationId:Yt,...ie}=s;Object.keys(ie).length>0&&(d=` {${Object.entries(ie).map(([O,U])=>`${O}=${U}`).join(", ")}}`)}let b=`[${t}] [${i}] [${c}] ${D}${r}${d}${m}`;if(this.logFilePath)try{Kr(this.logFilePath,b+`
|
|
47
|
+
`,"utf8")}catch(L){process.stderr.write(`[LOGGER] Failed to write to log file: ${L}
|
|
48
|
+
`)}else process.stderr.write(b+`
|
|
49
|
+
`)}debug(e,o,r,s){this.log(0,e,o,r,s)}info(e,o,r,s){this.log(1,e,o,r,s)}warn(e,o,r,s){this.log(2,e,o,r,s)}error(e,o,r,s){this.log(3,e,o,r,s)}dataIn(e,o,r,s){this.info(e,`\u2192 ${o}`,r,s)}dataOut(e,o,r,s){this.info(e,`\u2190 ${o}`,r,s)}success(e,o,r,s){this.info(e,`\u2713 ${o}`,r,s)}failure(e,o,r,s){this.error(e,`\u2717 ${o}`,r,s)}timing(e,o,r,s){this.info(e,`\u23F1 ${o}`,s,{duration:`${r}ms`})}happyPathError(e,o,r,s,u=""){let D=((new Error().stack||"").split(`
|
|
50
|
+
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),m=D?`${D[1].split("/").pop()}:${D[2]}`:"unknown",d={...r,location:m};return this.warn(e,`[HAPPY-PATH] ${o}`,d,s),u}},l=new kt});function Mn(n){return process.platform==="win32"?Math.round(n*Mt.WINDOWS_MULTIPLIER):n}var Mt,On=p(()=>{"use strict";Mt={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:5e3,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 Zr,writeFileSync as Bn,existsSync as Tn,mkdirSync as Qr}from"fs";import{join as es,dirname as ts}from"path";import{homedir as ns}from"os";var Q,Ot=p(()=>{"use strict";Q=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",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_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:es(ns(),".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_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",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"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return process.env[e]??this.DEFAULTS[e]}static getInt(e){let o=this.get(e);return parseInt(o,10)}static getBool(e){let o=this.get(e);return o==="true"||o===!0}static applyEnvOverrides(e){let o={...e};for(let r of Object.keys(this.DEFAULTS))process.env[r]!==void 0&&(o[r]=process.env[r]);return o}static loadFromFile(e){try{if(!Tn(e)){let t=this.getAllDefaults();try{let i=ts(e);Tn(i)||Qr(i,{recursive:!0}),Bn(e,JSON.stringify(t,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",e)}catch(i){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",e,i)}return this.applyEnvOverrides(t)}let o=Zr(e,"utf-8"),r=JSON.parse(o),s=r;if(r.env&&typeof r.env=="object"){s=r.env;try{Bn(e,JSON.stringify(s,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",e)}catch(t){console.warn("[SETTINGS] Failed to auto-migrate settings file:",e,t)}}let u={...this.DEFAULTS};for(let t of Object.keys(this.DEFAULTS))s[t]!==void 0&&(u[t]=s[t]);return this.applyEnvOverrides(u)}catch(o){return console.warn("[SETTINGS] Failed to load settings, using defaults:",e,o),this.applyEnvOverrides(this.getAllDefaults())}}}});import{join as F,dirname as os,basename as ii}from"path";import{homedir as In}from"os";import{existsSync as rs,mkdirSync as li}from"fs";import{execSync as di}from"child_process";import{fileURLToPath as ss}from"url";function us(){return typeof __dirname<"u"?__dirname:os(ss(import.meta.url))}function is(){if(process.env.CLAUDE_MEM_DATA_DIR)return process.env.CLAUDE_MEM_DATA_DIR;let n=F(In(),".claude-mem"),e=F(n,"settings.json");try{if(rs(e)){let{readFileSync:o}=zo("fs"),r=JSON.parse(o(e,"utf-8")),s=r.env??r;if(s.CLAUDE_MEM_DATA_DIR)return s.CLAUDE_MEM_DATA_DIR}}catch{}return n}var Ci,A,de,Bt,fi,hi,Ei,Fi,yi,xi,vi,_i,Si,Ai,bi,$i,Ve=p(()=>{"use strict";T();Ci=us();A=is(),de=process.env.CLAUDE_CONFIG_DIR||F(In(),".claude"),Bt=F(de,"plugins","marketplaces","thedotmack"),fi=F(A,"archives"),hi=F(A,"logs"),Ei=F(A,"trash"),Fi=F(A,"backups"),yi=F(A,"modes"),xi=F(A,"settings.json"),vi=F(A,"claude-mem.db"),_i=F(A,"vector-db"),Si=F(A,"observer-sessions"),Ai=F(de,"settings.json"),bi=F(de,"commands"),$i=F(de,"CLAUDE.md")});import as from"path";import{readFileSync as Oi}from"fs";function Ke(){if(Xe!==null)return Xe;let n=as.join(Q.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=Q.loadFromFile(n);return Xe=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),Xe}var Li,Xe,pe=p(()=>{"use strict";T();On();Ot();Ve();Li=(()=>{let n=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(n){let e=parseInt(n,10);if(Number.isFinite(e)&&e>=500&&e<=3e5)return e;l.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:n,min:500,max:3e5})}return Mn(Mt.HEALTH_CHECK)})(),Xe=null});import{existsSync as Ni,readFileSync as Ui,writeFileSync as Gi,mkdirSync as Wi,renameSync as Hi}from"fs";import{join as Vi,basename as Xi}from"path";var Rn=p(()=>{"use strict";T()});import ee from"path";import{homedir as Ln}from"os";import{existsSync as Pn,readFileSync as na,writeFileSync as oa,unlinkSync as ra,mkdirSync as sa}from"fs";import{exec as Ds}from"child_process";import{promisify as ls}from"util";function Ye(){let n=[ee.join(Bt,"plugin","scripts","worker-service.cjs"),ee.join(process.cwd(),"plugin","scripts","worker-service.cjs")];for(let e of n)if(Pn(e))return e;return null}function qe(){let n=[ee.join(Ln(),".bun","bin","bun"),"/usr/local/bin/bun","/usr/bin/bun",...process.platform==="win32"?[ee.join(Ln(),".bun","bin","bun.exe"),ee.join(process.env.LOCALAPPDATA||"","bun","bun.exe")]:[]];for(let e of n)if(e&&Pn(e))return e;return"bun"}var da,pa,Tt=p(()=>{"use strict";T();pe();Ve();Rn();da=ls(Ds),pa=ee.join(A,"cursor-projects.json")});var Hn={};G(Hn,{checkGeminiCliHooksStatus:()=>Wn,handleGeminiCliCommand:()=>hs,installGeminiCliHooks:()=>Un,uninstallGeminiCliHooks:()=>Gn});import It from"path";import{homedir as ms}from"os";import{existsSync as ne,readFileSync as ze,writeFileSync as Rt,mkdirSync as jn}from"fs";function ps(n,e,o){let r=te[o];if(!r)throw new Error(`Unknown Gemini CLI event: ${o}`);let s=n.replace(/\\/g,"\\\\"),u=e.replace(/\\/g,"\\\\");return`"${s}" "${u}" hook gemini-cli ${r}`}function gs(n){return{matcher:"*",hooks:[{name:ge,type:"command",command:n,timeout:ds}]}}function Lt(){if(!ne(R))return{};let n=ze(R,"utf-8");try{return JSON.parse(n)}catch{throw new Error(`Corrupt JSON in ${R}, refusing to overwrite user settings`)}}function Nn(n){jn(Ze,{recursive:!0}),Rt(R,JSON.stringify(n,null,2)+`
|
|
51
|
+
`)}function Cs(n,e){let o={...n};o.hooks||(o.hooks={});for(let[r,s]of Object.entries(e)){let u=o.hooks[r]??[];for(let t of s){let i=u.findIndex(c=>c.hooks.some(D=>D.name===ge));if(i>=0){let c=u[i],D=c.hooks.findIndex(m=>m.name===ge);D>=0?c.hooks[D]=t.hooks[0]:c.hooks.push(t.hooks[0])}else u.push(t)}o.hooks[r]=u}return o}function fs(){let n="<claude-mem-context>",o=`${n}
|
|
52
|
+
# Memory Context from Past Sessions
|
|
53
|
+
|
|
54
|
+
*No context yet. Complete your first session and context will appear here.*
|
|
55
|
+
</claude-mem-context>`,r="";if(ne(I)&&(r=ze(I,"utf-8")),r.includes(n))return;let s=r.length>0&&!r.endsWith(`
|
|
56
|
+
`)?`
|
|
57
|
+
|
|
58
|
+
`:r.length>0?`
|
|
59
|
+
`:"",u=r+s+o+`
|
|
60
|
+
`;jn(Ze,{recursive:!0}),Rt(I,u)}async function Un(){console.log(`
|
|
61
|
+
Installing Claude-Mem Gemini CLI hooks...
|
|
62
|
+
`);let n=Ye();if(!n)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let e=qe();console.log(` Using Bun runtime: ${e}`),console.log(` Worker service: ${n}`);try{let o={};for(let t of Object.keys(te)){let i=ps(e,n,t);o[t]=[gs(i)]}let r=Lt(),s=Cs(r,o);Nn(s),console.log(` Merged hooks into ${R}`),fs(),console.log(` Setup context injection in ${I}`);let u=Object.keys(te);console.log(` Registered ${u.length} hook events:`);for(let t of u){let i=te[t];console.log(` ${t} \u2192 ${i}`)}return console.log(`
|
|
63
|
+
Installation complete!
|
|
64
|
+
|
|
65
|
+
Hooks installed to: ${R}
|
|
66
|
+
Using unified CLI: bun worker-service.cjs hook gemini-cli <event>
|
|
67
|
+
|
|
68
|
+
Next steps:
|
|
69
|
+
1. Start claude-mem worker: claude-mem start
|
|
70
|
+
2. Restart Gemini CLI to load the hooks
|
|
71
|
+
3. Memory will be captured automatically during sessions
|
|
72
|
+
|
|
73
|
+
Context Injection:
|
|
74
|
+
Context from past sessions is injected via ~/.gemini/GEMINI.md
|
|
75
|
+
and automatically included in Gemini CLI conversations.
|
|
76
|
+
`),0}catch(o){return console.error(`
|
|
77
|
+
Installation failed: ${o.message}`),1}}function Gn(){console.log(`
|
|
78
|
+
Uninstalling Claude-Mem Gemini CLI hooks...
|
|
79
|
+
`);try{if(!ne(R))return console.log(" No Gemini CLI settings found \u2014 nothing to uninstall."),0;let n=Lt();if(!n.hooks)return console.log(" No hooks found in Gemini CLI settings \u2014 nothing to uninstall."),0;let e=0;for(let[o,r]of Object.entries(n.hooks)){let s=r.map(u=>{let t=u.hooks.filter(i=>i.name!==ge);return e+=u.hooks.length-t.length,{...u,hooks:t}}).filter(u=>u.hooks.length>0);s.length>0?n.hooks[o]=s:delete n.hooks[o]}if(Object.keys(n.hooks).length===0&&delete n.hooks,Nn(n),console.log(` Removed ${e} claude-mem hook(s) from ${R}`),ne(I)){let o=ze(I,"utf-8"),r=/\n?<claude-mem-context>[\s\S]*?<\/claude-mem-context>\n?/;r.test(o)&&(o=o.replace(r,""),Rt(I,o),console.log(` Removed context section from ${I}`))}return console.log(`
|
|
80
|
+
Uninstallation complete!
|
|
81
|
+
`),console.log("Restart Gemini CLI to apply changes."),0}catch(n){return console.error(`
|
|
82
|
+
Uninstallation failed: ${n.message}`),1}}function Wn(){if(console.log(`
|
|
83
|
+
Claude-Mem Gemini CLI Hooks Status
|
|
84
|
+
`),!ne(R))return console.log("Gemini CLI settings: Not found"),console.log(` Expected at: ${R}
|
|
85
|
+
`),console.log(`No hooks installed. Run: claude-mem install --ide gemini-cli
|
|
86
|
+
`),0;let n;try{n=Lt()}catch(o){return console.log(`Gemini CLI settings: ${o.message}
|
|
87
|
+
`),0}if(!n.hooks)return console.log(`Gemini CLI settings: Found, but no hooks configured
|
|
88
|
+
`),console.log(`No hooks installed. Run: claude-mem install --ide gemini-cli
|
|
89
|
+
`),0;let e=[];for(let[o,r]of Object.entries(n.hooks))r.some(u=>u.hooks.some(t=>t.name===ge))&&e.push(o);if(e.length===0)return console.log(`Gemini CLI settings: Found, but no claude-mem hooks
|
|
90
|
+
`),console.log(`Run: claude-mem install --ide gemini-cli
|
|
91
|
+
`),0;console.log(`Settings: ${R}`),console.log("Mode: Unified CLI (bun worker-service.cjs hook gemini-cli)"),console.log(`Events: ${e.length} of ${Object.keys(te).length} mapped`);for(let o of e){let r=te[o]??"unknown";console.log(` ${o} \u2192 ${r}`)}return ne(I)?ze(I,"utf-8").includes("<claude-mem-context>")?console.log(`Context: Active (${I})`):console.log("Context: GEMINI.md exists but missing claude-mem section"):console.log("Context: No GEMINI.md found"),console.log(""),0}async function hs(n,e){switch(n){case"install":return Un();case"uninstall":return Gn();case"status":return Wn();default:return console.log(`
|
|
92
|
+
Claude-Mem Gemini CLI Integration
|
|
93
|
+
|
|
94
|
+
Usage: claude-mem gemini-cli <command>
|
|
95
|
+
|
|
96
|
+
Commands:
|
|
97
|
+
install Install hooks into ~/.gemini/settings.json
|
|
98
|
+
uninstall Remove claude-mem hooks (preserves other hooks)
|
|
99
|
+
status Check installation status
|
|
100
|
+
|
|
101
|
+
Examples:
|
|
102
|
+
claude-mem gemini-cli install # Install hooks
|
|
103
|
+
claude-mem gemini-cli status # Check if installed
|
|
104
|
+
claude-mem gemini-cli uninstall # Remove hooks
|
|
105
|
+
|
|
106
|
+
For more info: https://docs.claude-mem.ai/usage/gemini-provider
|
|
107
|
+
`),0}}var Ze,R,I,ge,ds,te,Jn=p(()=>{"use strict";Tt();Ze=It.join(ms(),".gemini"),R=It.join(Ze,"settings.json"),I=It.join(Ze,"GEMINI.md"),ge="claude-mem",ds=1e4,te={SessionStart:"context",BeforeAgent:"user-message",AfterAgent:"observation",BeforeTool:"observation",AfterTool:"observation",PreCompress:"summarize",Notification:"observation",SessionEnd:"session-complete"}});var eo={};G(eo,{checkWindsurfHooksStatus:()=>Qn,handleWindsurfCommand:()=>Ss,installWindsurfHooks:()=>zn,readWindsurfRegistry:()=>nt,registerWindsurfProject:()=>Yn,uninstallWindsurfHooks:()=>Zn,unregisterWindsurfProject:()=>qn,updateWindsurfContextForProject:()=>ys,writeWindsurfContextFile:()=>jt,writeWindsurfRegistry:()=>Pt});import k from"path";import{homedir as Es}from"os";import{existsSync as oe,readFileSync as et,writeFileSync as fe,unlinkSync as Vn,mkdirSync as tt,renameSync as Fs}from"fs";function nt(){try{return oe(Ce)?JSON.parse(et(Ce,"utf-8")):{}}catch(n){return l.error("WINDSURF","Failed to read registry, using empty",{file:Ce},n),{}}}function Pt(n){let e=k.dirname(Ce);tt(e,{recursive:!0}),fe(Ce,JSON.stringify(n,null,2))}function Yn(n){let e=nt();e[n]={installedAt:new Date().toISOString()},Pt(e),l.info("WINDSURF","Registered project for auto-context updates",{workspacePath:n})}function qn(n){let e=nt();e[n]&&(delete e[n],Pt(e),l.info("WINDSURF","Unregistered project",{workspacePath:n}))}async function ys(n,e,o){if(nt()[e])try{let u=await fetch(`http://127.0.0.1:${o}/api/context/inject?project=${encodeURIComponent(n)}`);if(!u.ok)return;let t=await u.text();if(!t||!t.trim())return;jt(e,t),l.debug("WINDSURF","Updated context file",{projectName:n,workspacePath:e})}catch(u){l.error("WINDSURF","Failed to update context file",{projectName:n,workspacePath:e},u)}}function jt(n,e){let o=k.join(n,".windsurf","rules"),r=k.join(o,"claude-mem-context.md"),s=`${r}.tmp`;tt(o,{recursive:!0});let u=`# Memory Context from Past Sessions
|
|
108
|
+
|
|
109
|
+
The following context is from claude-mem, a persistent memory system that tracks your coding sessions.
|
|
110
|
+
|
|
111
|
+
${e}
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
*Auto-updated by claude-mem after each session. Use MCP search tools for detailed queries.*
|
|
115
|
+
`;u.length>Xn&&(u=u.slice(0,Xn-50)+`
|
|
116
|
+
|
|
117
|
+
*[Truncated \u2014 use MCP search for full history]*
|
|
118
|
+
`),fe(s,u),Fs(s,r)}function xs(n,e,o){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"}[o]??"observation";return`"${n}" "${e}" hook windsurf ${s}`}function vs(n,e,o){tt(Kn,{recursive:!0});let r={hooks:{}};if(oe(w))try{r=JSON.parse(et(w,"utf-8")),r.hooks||(r.hooks={})}catch{throw new Error(`Corrupt hooks.json at ${w}, refusing to overwrite`)}for(let s of Qe){let t={command:xs(n,e,s),show_output:!1,working_directory:o},i=(r.hooks[s]??[]).filter(c=>!c.command.includes("worker-service")||!c.command.includes("windsurf"));r.hooks[s]=[...i,t]}fe(w,JSON.stringify(r,null,2))}async function zn(){console.log(`
|
|
119
|
+
Installing Claude-Mem Windsurf hooks (user level)...
|
|
120
|
+
`);let n=Ye();if(!n)return console.error("Could not find worker-service.cjs"),console.error(" Expected at: ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs"),1;let e=qe();if(!e)return console.error("Could not find Bun runtime"),console.error(" Install Bun: curl -fsSL https://bun.sh/install | bash"),1;let o=k.dirname(n);try{console.log(` Using Bun runtime: ${e}`),console.log(` Worker service: ${n}`),vs(e,n,o),console.log(" Created/merged hooks.json");let r=process.cwd();return await _s(r),console.log(`
|
|
121
|
+
Installation complete!
|
|
122
|
+
|
|
123
|
+
Hooks installed to: ${w}
|
|
124
|
+
Using unified CLI: bun worker-service.cjs hook windsurf <command>
|
|
125
|
+
|
|
126
|
+
Events registered:
|
|
127
|
+
- pre_user_prompt (session init + context injection)
|
|
128
|
+
- post_write_code (code generation observation)
|
|
129
|
+
- post_run_command (command execution observation)
|
|
130
|
+
- post_mcp_tool_use (MCP tool results)
|
|
131
|
+
- post_cascade_response (full AI response)
|
|
132
|
+
|
|
133
|
+
Next steps:
|
|
134
|
+
1. Start claude-mem worker: claude-mem start
|
|
135
|
+
2. Restart Windsurf to load the hooks
|
|
136
|
+
3. Context is injected via .windsurf/rules/claude-mem-context.md (workspace-level)
|
|
137
|
+
`),0}catch(r){return console.error(`
|
|
138
|
+
Installation failed: ${r.message}`),1}}async function _s(n){let e=Ke(),o=k.basename(n),r=!1;console.log(" Generating initial context...");try{if((await fetch(`http://127.0.0.1:${e}/api/readiness`)).ok){let u=await fetch(`http://127.0.0.1:${e}/api/context/inject?project=${encodeURIComponent(o)}`);if(u.ok){let t=await u.text();t&&t.trim()&&(jt(n,t),r=!0,console.log(" Generated initial context from existing memory"))}}}catch(s){l.debug("WINDSURF","Worker not running during install",{},s)}if(!r){let s=k.join(n,".windsurf","rules");tt(s,{recursive:!0});let u=k.join(s,"claude-mem-context.md");fe(u,`# Memory Context from Past Sessions
|
|
139
|
+
|
|
140
|
+
*No context yet. Complete your first session and context will appear here.*
|
|
141
|
+
|
|
142
|
+
Use claude-mem's MCP search tools for manual memory queries.
|
|
143
|
+
`),console.log(" Created placeholder context file (will populate after first session)")}Yn(n),console.log(" Registered for auto-context updates")}function Zn(){console.log(`
|
|
144
|
+
Uninstalling Claude-Mem Windsurf hooks...
|
|
145
|
+
`);try{if(oe(w))try{let o=JSON.parse(et(w,"utf-8"));for(let r of Qe)o.hooks[r]&&(o.hooks[r]=o.hooks[r].filter(s=>!s.command.includes("worker-service")||!s.command.includes("windsurf")),o.hooks[r].length===0&&delete o.hooks[r]);Object.keys(o.hooks).length===0?(Vn(w),console.log(" Removed hooks.json (no hooks remaining)")):(fe(w,JSON.stringify(o,null,2)),console.log(" Removed claude-mem entries from hooks.json (other hooks preserved)"))}catch{console.log(" Warning: could not parse hooks.json \u2014 leaving file intact to preserve other hooks")}else console.log(" No hooks.json found");let n=process.cwd(),e=k.join(n,".windsurf","rules","claude-mem-context.md");return oe(e)&&(Vn(e),console.log(" Removed context file")),qn(n),console.log(" Unregistered from auto-context updates"),console.log(`
|
|
146
|
+
Uninstallation complete!
|
|
147
|
+
`),console.log("Restart Windsurf to apply changes."),0}catch(n){return console.error(`
|
|
148
|
+
Uninstallation failed: ${n.message}`),1}}function Qn(){if(console.log(`
|
|
149
|
+
Claude-Mem Windsurf Hooks Status
|
|
150
|
+
`),oe(w)){console.log("User-level: Installed"),console.log(` Config: ${w}`);try{let e=JSON.parse(et(w,"utf-8")),o=Qe.filter(r=>e.hooks[r]?.some(s=>s.command.includes("worker-service")&&s.command.includes("windsurf")));console.log(` Events: ${o.length}/${Qe.length} registered`);for(let r of o)console.log(` - ${r}`)}catch{console.log(" Mode: Unable to parse hooks.json")}let n=k.join(process.cwd(),".windsurf","rules","claude-mem-context.md");oe(n)?console.log(" Context: Active (current workspace)"):console.log(" Context: Not yet generated for this workspace")}else console.log("User-level: Not installed"),console.log(`
|
|
151
|
+
No hooks installed. Run: claude-mem windsurf install
|
|
152
|
+
`);return console.log(""),0}async function Ss(n,e){switch(n){case"install":return zn();case"uninstall":return Zn();case"status":return Qn();default:return console.log(`
|
|
153
|
+
Claude-Mem Windsurf Integration
|
|
154
|
+
|
|
155
|
+
Usage: claude-mem windsurf <command>
|
|
156
|
+
|
|
157
|
+
Commands:
|
|
158
|
+
install Install Windsurf hooks (user-level, ~/.codeium/windsurf/hooks.json)
|
|
159
|
+
uninstall Remove Windsurf hooks
|
|
160
|
+
status Check installation status
|
|
161
|
+
|
|
162
|
+
Examples:
|
|
163
|
+
claude-mem windsurf install # Install hooks globally
|
|
164
|
+
claude-mem windsurf uninstall # Remove hooks
|
|
165
|
+
claude-mem windsurf status # Check if hooks are installed
|
|
166
|
+
|
|
167
|
+
For more info: https://docs.claude-mem.ai/windsurf
|
|
168
|
+
`),0}}var Kn,w,Xn,Ce,Qe,to=p(()=>{"use strict";T();pe();Ve();Tt();Kn=k.join(Es(),".codeium","windsurf"),w=k.join(Kn,"hooks.json"),Xn=6e3,Ce=k.join(A,"windsurf-projects.json"),Qe=["pre_user_prompt","post_write_code","post_run_command","post_mcp_tool_use","post_cascade_response"]});import As from"path";import{existsSync as bs,readFileSync as $s,writeFileSync as Nt,mkdirSync as ws}from"fs";function no(n,e,o){let r=As.dirname(n);ws(r,{recursive:!0});let s=`${he}
|
|
169
|
+
${e}
|
|
170
|
+
${re}`;if(bs(n)){let u=$s(n,"utf-8"),t=u.indexOf(he),i=u.indexOf(re);t!==-1&&i!==-1?u=u.slice(0,t)+s+u.slice(i+re.length):u=u.trimEnd()+`
|
|
171
|
+
|
|
172
|
+
`+s+`
|
|
173
|
+
`,Nt(n,u,"utf-8")}else o?Nt(n,`${o}
|
|
174
|
+
|
|
175
|
+
${s}
|
|
176
|
+
`,"utf-8"):Nt(n,s+`
|
|
177
|
+
`,"utf-8")}var he,re,oo=p(()=>{"use strict";he="<claude-mem-context>",re="</claude-mem-context>"});var co={};G(co,{checkOpenCodeStatus:()=>Rs,findBuiltPluginPath:()=>io,getInstalledPluginPath:()=>Fe,getOpenCodeAgentsMdPath:()=>Ee,getOpenCodeConfigDirectory:()=>ot,getOpenCodePluginsDirectory:()=>Ut,injectContextIntoAgentsMd:()=>K,installOpenCodeIntegration:()=>Ls,installOpenCodePlugin:()=>ao,syncContextToAgentsMd:()=>Ts,uninstallOpenCodePlugin:()=>Is});import J from"path";import{homedir as so}from"os";import{fileURLToPath as ks}from"url";import{existsSync as se,readFileSync as uo,writeFileSync as Ms,mkdirSync as Os,copyFileSync as Bs,unlinkSync as ro}from"fs";function ot(){return process.env.OPENCODE_CONFIG_DIR?process.env.OPENCODE_CONFIG_DIR:J.join(so(),".config","opencode")}function Ut(){return J.join(ot(),"plugins")}function Ee(){return J.join(ot(),"AGENTS.md")}function Fe(){return J.join(Ut(),"claude-mem.js")}function io(){let n=[J.join(process.env.CLAUDE_CONFIG_DIR||J.join(so(),".claude"),"plugins","marketplaces","thedotmack","dist","opencode-plugin","index.js"),J.join(J.dirname(ks(import.meta.url)),"..","..","..","dist","opencode-plugin","index.js")];for(let e of n)if(se(e))return e;return null}function ao(){let n=io();if(!n)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 e=Ut(),o=Fe();try{return Os(e,{recursive:!0}),Bs(n,o),console.log(` Plugin installed to: ${o}`),l.info("OPENCODE","Plugin installed",{destination:o}),0}catch(r){let s=r instanceof Error?r.message:String(r);return console.error(`Failed to install OpenCode plugin: ${s}`),1}}function K(n){let e=Ee();try{return no(e,n,"# Claude-Mem Memory Context"),l.info("OPENCODE","Context injected into AGENTS.md",{path:e}),0}catch(o){let r=o instanceof Error?o.message:String(o);return console.error(`Failed to inject context into AGENTS.md: ${r}`),1}}async function Ts(n,e){try{let o=await fetch(`http://127.0.0.1:${n}/api/context/inject?project=${encodeURIComponent(e)}`);if(!o.ok)return;let r=await o.text();r&&r.trim()&&K(r)!==0&&l.warn("OPENCODE","Failed to inject context into AGENTS.md during sync")}catch{}}function Is(){let n=!1,e=Fe();if(se(e))try{ro(e),console.log(` Removed plugin: ${e}`)}catch(r){let s=r instanceof Error?r.message:String(r);console.error(` Failed to remove plugin: ${s}`),n=!0}let o=Ee();if(se(o))try{let r=uo(o,"utf-8"),s=r.indexOf(he),u=r.indexOf(re);if(s!==-1&&u!==-1){r=r.slice(0,s).trimEnd()+`
|
|
178
|
+
`+r.slice(u+re.length).trimStart();let t=r.trim();t.length===0||t==="# Claude-Mem Memory Context"?(ro(o),console.log(" Removed empty AGENTS.md")):(Ms(o,t+`
|
|
179
|
+
`,"utf-8"),console.log(" Cleaned context from AGENTS.md"))}}catch(r){let s=r instanceof Error?r.message:String(r);console.error(` Failed to clean AGENTS.md: ${s}`),n=!0}return n?1:0}function Rs(){console.log(`
|
|
180
|
+
Claude-Mem OpenCode Integration Status
|
|
181
|
+
`);let n=ot(),e=Fe(),o=Ee();if(console.log(`Config directory: ${n}`),console.log(` Exists: ${se(n)?"yes":"no"}`),console.log(""),console.log(`Plugin: ${e}`),console.log(` Installed: ${se(e)?"yes":"no"}`),console.log(""),console.log(`Context (AGENTS.md): ${o}`),se(o)){let s=uo(o,"utf-8").includes(he);console.log(" Exists: yes"),console.log(` Has claude-mem context: ${s?"yes":"no"}`)}else console.log(" Exists: no");return console.log(""),0}async function Ls(){console.log(`
|
|
182
|
+
Installing Claude-Mem for OpenCode...
|
|
183
|
+
`);let n=ao();if(n!==0)return n;let e=`# Memory Context from Past Sessions
|
|
184
|
+
|
|
185
|
+
*No context yet. Complete your first session and context will appear here.*
|
|
186
|
+
|
|
187
|
+
Use claude-mem search tools for manual memory queries.`;try{let o=Ke();if((await fetch(`http://127.0.0.1:${o}/api/readiness`)).ok){let s=await fetch(`http://127.0.0.1:${o}/api/context/inject?project=opencode`);if(s.ok){let u=await s.text();u&&u.trim()?K(u)!==0?l.warn("OPENCODE","Failed to inject real context into AGENTS.md during install"):console.log(" Context injected from existing memory"):K(e)!==0?l.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install"):console.log(" Placeholder context created (will populate after first session)")}else K(e)!==0&&l.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install")}else K(e)!==0?l.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install"):console.log(" Placeholder context created (worker not running)")}catch{K(e)!==0?l.warn("OPENCODE","Failed to inject placeholder context into AGENTS.md during install"):console.log(" Placeholder context created (worker not running)")}return console.log(`
|
|
188
|
+
Installation complete!
|
|
189
|
+
|
|
190
|
+
Plugin installed to: ${Fe()}
|
|
191
|
+
Context file: ${Ee()}
|
|
192
|
+
|
|
193
|
+
Next steps:
|
|
194
|
+
1. Start claude-mem worker: npx claude-mem start
|
|
195
|
+
2. Restart OpenCode to load the plugin
|
|
196
|
+
3. Memory capture is automatic from then on
|
|
197
|
+
`),0}var Do=p(()=>{"use strict";T();oo();pe()});var Fo={};G(Fo,{checkOpenClawStatus:()=>Ws,findPluginManifestPath:()=>Co,findPluginSkillsDirectory:()=>fo,findPreBuiltPluginDirectory:()=>go,getOpenClawClaudeMemExtensionDirectory:()=>xe,getOpenClawConfigDirectory:()=>ye,getOpenClawConfigFilePath:()=>ue,getOpenClawExtensionsDirectory:()=>po,installOpenClawIntegration:()=>Hs,installOpenClawPlugin:()=>Eo,uninstallOpenClawPlugin:()=>Gs});import h from"path";import{homedir as rt}from"os";import{existsSync as j,readFileSync as Ps,writeFileSync as lo,mkdirSync as mo,cpSync as Gt,rmSync as js}from"fs";function ye(){return h.join(rt(),".openclaw")}function po(){return h.join(ye(),"extensions")}function xe(){return h.join(po(),"claude-mem")}function ue(){return h.join(ye(),"openclaw.json")}function go(){let n=[h.join(process.env.CLAUDE_CONFIG_DIR||h.join(rt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of n){let o=h.join(e,"openclaw","dist"),r=h.join(o,"index.js");if(j(r))return o}return null}function Co(){let n=[h.join(process.env.CLAUDE_CONFIG_DIR||h.join(rt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of n){let o=h.join(e,"openclaw","openclaw.plugin.json");if(j(o))return o}return null}function fo(){let n=[h.join(process.env.CLAUDE_CONFIG_DIR||h.join(rt(),".claude"),"plugins","marketplaces","thedotmack"),process.cwd()];for(let e of n){let o=h.join(e,"openclaw","skills");if(j(o))return o}return null}function Wt(){let n=ue();if(!j(n))return{};try{return JSON.parse(Ps(n,"utf-8"))}catch{return{}}}function ho(n){let e=ye();mo(e,{recursive:!0}),lo(ue(),JSON.stringify(n,null,2)+`
|
|
198
|
+
`,"utf-8")}function Ns(n=37777,e="openclaw",o=!0){let r=Wt();if(r.plugins||(r.plugins={}),r.plugins.slots||(r.plugins.slots={}),r.plugins.entries||(r.plugins.entries={}),r.plugins.slots.memory="claude-mem",!r.plugins.entries["claude-mem"])r.plugins.entries["claude-mem"]={enabled:!0,config:{workerPort:n,project:e,syncMemoryFile:o}};else{r.plugins.entries["claude-mem"].enabled=!0,r.plugins.entries["claude-mem"].config||(r.plugins.entries["claude-mem"].config={});let s=r.plugins.entries["claude-mem"].config;s.workerPort===void 0&&(s.workerPort=n),s.project===void 0&&(s.project=e),s.syncMemoryFile===void 0&&(s.syncMemoryFile=o)}ho(r)}function Us(){let n=ue();if(!j(n))return;let e=Wt();e.plugins?.entries?.["claude-mem"]&&delete e.plugins.entries["claude-mem"],e.plugins?.slots?.memory==="claude-mem"&&delete e.plugins.slots.memory,ho(e)}function Eo(){let n=go();if(!n)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 e=xe(),o=h.join(e,"dist");try{mo(o,{recursive:!0}),Gt(n,o,{recursive:!0,force:!0}),console.log(` Plugin dist copied to: ${o}`);let r=Co();if(r){let t=h.join(e,"openclaw.plugin.json");Gt(r,t,{force:!0}),console.log(` Plugin manifest copied to: ${t}`)}let s=fo();if(s){let t=h.join(e,"skills");Gt(s,t,{recursive:!0,force:!0}),console.log(` Skills copied to: ${t}`)}let u={name:"claude-mem",version:"1.0.0",type:"module",main:"dist/index.js",openclaw:{extensions:["./dist/index.js"]}};return lo(h.join(e,"package.json"),JSON.stringify(u,null,2)+`
|
|
199
|
+
`,"utf-8"),Ns(),console.log(" Registered in openclaw.json"),l.info("OPENCLAW","Plugin installed",{destination:e}),0}catch(r){let s=r instanceof Error?r.message:String(r);return console.error(`Failed to install OpenClaw plugin: ${s}`),1}}function Gs(){let n=!1,e=xe();if(j(e))try{js(e,{recursive:!0,force:!0}),console.log(` Removed extension: ${e}`)}catch(o){let r=o instanceof Error?o.message:String(o);console.error(` Failed to remove extension directory: ${r}`),n=!0}try{Us(),console.log(" Unregistered from openclaw.json")}catch(o){let r=o instanceof Error?o.message:String(o);console.error(` Failed to update openclaw.json: ${r}`),n=!0}return n?1:0}function Ws(){console.log(`
|
|
200
|
+
Claude-Mem OpenClaw Integration Status
|
|
201
|
+
`);let n=ye(),e=xe(),o=ue(),r=h.join(e,"dist","index.js");if(console.log(`Config directory: ${n}`),console.log(` Exists: ${j(n)?"yes":"no"}`),console.log(""),console.log(`Extension directory: ${e}`),console.log(` Exists: ${j(e)?"yes":"no"}`),console.log(` Plugin entry: ${j(r)?"yes":"no"}`),console.log(""),console.log(`Config (openclaw.json): ${o}`),j(o)){let s=Wt(),u=s.plugins?.entries?.["claude-mem"]!==void 0,t=s.plugins?.entries?.["claude-mem"]?.enabled===!0,i=s.plugins?.slots?.memory==="claude-mem";if(console.log(" Exists: yes"),console.log(` Registered: ${u?"yes":"no"}`),console.log(` Enabled: ${t?"yes":"no"}`),console.log(` Memory slot: ${i?"yes":"no"}`),u){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 Hs(){console.log(`
|
|
202
|
+
Installing Claude-Mem for OpenClaw...
|
|
203
|
+
`);let n=Eo();if(n!==0)return n;let e=xe();return console.log(`
|
|
204
|
+
Installation complete!
|
|
205
|
+
|
|
206
|
+
Plugin installed to: ${e}
|
|
207
|
+
Config updated: ${ue()}
|
|
208
|
+
|
|
209
|
+
Next steps:
|
|
210
|
+
1. Start claude-mem worker: npx claude-mem start
|
|
211
|
+
2. Restart OpenClaw to load the plugin
|
|
212
|
+
3. Memory capture is automatic from then on
|
|
213
|
+
`),0}var yo=p(()=>{"use strict";T()});import Wa from"path";var xo=p(()=>{"use strict";T()});import{existsSync as Ka,readFileSync as Ya,writeFileSync as qa,renameSync as za}from"fs";import Js from"path";import Vs from"os";function vo(n,e){let o="<claude-mem-context>",r="</claude-mem-context>";if(!n)return`${o}
|
|
214
|
+
${e}
|
|
215
|
+
${r}`;let s=n.indexOf(o),u=n.indexOf(r);return s!==-1&&u!==-1?n.substring(0,s)+`${o}
|
|
216
|
+
${e}
|
|
217
|
+
${r}`+n.substring(u+r.length):n+`
|
|
218
|
+
|
|
219
|
+
${o}
|
|
220
|
+
${e}
|
|
221
|
+
${r}`}var sc,_o=p(()=>{"use strict";T();xo();Ot();pe();sc=Js.join(Vs.homedir(),".claude-mem","settings.json")});import{existsSync as ac,readFileSync as cc,writeFileSync as Dc,mkdirSync as lc}from"fs";import{homedir as So}from"os";import{join as Ao,dirname as pc}from"path";var N,ve,Xs,st,bo=p(()=>{"use strict";N=Ao(So(),".claude-mem","transcript-watch.json"),ve=Ao(So(),".claude-mem","transcript-watch-state.json"),Xs={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"}]},st={version:1,schemas:{codex:Xs},watches:[{name:"codex",path:"~/.codex/sessions/**/*.jsonl",schema:"codex",startAtEnd:!0,context:{mode:"agents",path:"~/.codex/AGENTS.md",updateOn:["session_start","session_end"]}}],stateFile:ve}});var Mo={};G(Mo,{checkCodexCliStatus:()=>eu,installCodexCli:()=>Zs,uninstallCodexCli:()=>Qs});import ut from"path";import{homedir as $o}from"os";import{existsSync as Y,readFileSync as _e,writeFileSync as Se,mkdirSync as wo}from"fs";function Jt(){let n=N;if(!Y(n))return{version:1,schemas:{},watches:[],stateFile:ve};try{let e=_e(n,"utf-8"),o=JSON.parse(e);return o.version||(o.version=1),o.watches||(o.watches=[]),o.schemas||(o.schemas={}),o.stateFile||(o.stateFile=ve),o}catch(e){l.error("CODEX","Corrupt transcript-watch.json, creating backup",{path:n},e);let o=`${n}.backup.${Date.now()}`;return Se(o,_e(n)),console.warn(` Backed up corrupt transcript-watch.json to ${o}`),{version:1,schemas:{},watches:[],stateFile:ve}}}function Ys(n){let e={...n};e.schemas={...e.schemas};let o=st.schemas?.[V];o&&(e.schemas[V]=o);let r=st.watches.find(s=>s.name===V);if(r){let s=e.watches.findIndex(u=>u.name===V);s!==-1?e.watches[s]=r:e.watches.push(r)}return e}function ko(n){wo(Ks,{recursive:!0}),Se(N,JSON.stringify(n,null,2)+`
|
|
222
|
+
`)}function qs(){try{wo(Ht,{recursive:!0});let n="";Y(x)&&(n=_e(x,"utf-8"));let e=["# Recent Activity","","<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->","","*No context yet. Complete your first session and context will appear here.*"].join(`
|
|
223
|
+
`),o=vo(n,e);Se(x,o),console.log(` Injected context placeholder into ${x}`)}catch(n){l.warn("CODEX","Failed to inject AGENTS.md context",{error:n.message}),console.warn(` Warning: Could not inject context into AGENTS.md: ${n.message}`)}}function zs(){try{if(!Y(x))return;let n=_e(x,"utf-8"),e="<claude-mem-context>",o="</claude-mem-context>",r=n.indexOf(e),s=n.indexOf(o);if(r===-1||s===-1)return;let u=n.substring(0,r).replace(/\n+$/,""),t=n.substring(s+o.length).replace(/^\n+/,""),i=(u+(t?`
|
|
224
|
+
|
|
225
|
+
`+t:"")).trim();i?Se(x,i+`
|
|
226
|
+
`):Se(x,""),console.log(` Removed context section from ${x}`)}catch(n){l.warn("CODEX","Failed to clean AGENTS.md context",{error:n.message})}}async function Zs(){console.log(`
|
|
227
|
+
Installing Claude-Mem for Codex CLI (transcript watching)...
|
|
228
|
+
`);try{let n=Jt(),e=Ys(n);return ko(e),console.log(` Updated ${N}`),console.log(" Watch path: ~/.codex/sessions/**/*.jsonl"),console.log(` Schema: codex (v${st.schemas?.codex?.version??"?"})`),qs(),console.log(`
|
|
229
|
+
Installation complete!
|
|
230
|
+
|
|
231
|
+
Transcript watch config: ${N}
|
|
232
|
+
Context file: ${x}
|
|
233
|
+
|
|
234
|
+
How it works:
|
|
235
|
+
- claude-mem watches Codex session JSONL files for new activity
|
|
236
|
+
- No hooks needed -- transcript watching is fully automatic
|
|
237
|
+
- Context from past sessions is injected via ${x}
|
|
238
|
+
|
|
239
|
+
Next steps:
|
|
240
|
+
1. Start claude-mem worker: npx claude-mem start
|
|
241
|
+
2. Use Codex CLI as usual -- memory capture is automatic!
|
|
242
|
+
`),0}catch(n){return console.error(`
|
|
243
|
+
Installation failed: ${n.message}`),1}}function Qs(){console.log(`
|
|
244
|
+
Uninstalling Claude-Mem Codex CLI integration...
|
|
245
|
+
`);try{if(Y(N)){let n=Jt();n.watches=n.watches.filter(e=>e.name!==V),n.schemas&&delete n.schemas[V],ko(n),console.log(` Removed codex watch from ${N}`)}else console.log(" No transcript-watch.json found -- nothing to remove.");return zs(),console.log(`
|
|
246
|
+
Uninstallation complete!`),console.log(`Restart claude-mem worker to apply changes.
|
|
247
|
+
`),0}catch(n){return console.error(`
|
|
248
|
+
Uninstallation failed: ${n.message}`),1}}function eu(){if(console.log(`
|
|
249
|
+
Claude-Mem Codex CLI Integration Status
|
|
250
|
+
`),!Y(N))return console.log("Status: Not installed"),console.log(` No transcript watch config at ${N}`),console.log(`
|
|
251
|
+
Run: npx claude-mem install --ide codex-cli
|
|
252
|
+
`),0;try{let n=Jt(),e=n.watches.find(s=>s.name===V),o=n.schemas?.[V];if(!e)return console.log("Status: Not installed"),console.log(" transcript-watch.json exists but no codex watch configured."),console.log(`
|
|
253
|
+
Run: npx claude-mem install --ide codex-cli
|
|
254
|
+
`),0;console.log("Status: Installed"),console.log(` Config: ${N}`),console.log(` Watch path: ${e.path}`),console.log(` Schema: ${o?`codex (v${o.version??"?"})`:"missing"}`),console.log(` Start at end: ${e.startAtEnd??!1}`),e.context&&(console.log(` Context mode: ${e.context.mode}`),console.log(` Context path: ${e.context.path??"default"}`),console.log(` Context updates on: ${e.context.updateOn?.join(", ")??"none"}`)),Y(x)?_e(x,"utf-8").includes("<claude-mem-context>")?console.log(` Context: Active (${x})`):console.log(" Context: AGENTS.md exists but no context tags"):console.log(" Context: No AGENTS.md file");let r=ut.join(Ht,"sessions");Y(r)?console.log(" Sessions directory: exists"):console.log(" Sessions directory: not yet created (use Codex CLI to generate sessions)")}catch{console.log("Status: Unknown"),console.log(" Could not parse transcript-watch.json.")}return console.log(""),0}var Ht,x,Ks,V,Oo=p(()=>{"use strict";T();_o();bo();Ht=ut.join($o(),".codex"),x=ut.join(Ht,"AGENTS.md"),Ks=ut.join($o(),".claude-mem"),V="codex"});var Io={};G(Io,{runUninstallCommand:()=>iu});import{existsSync as Bo,rmSync as To}from"fs";import{join as tu}from"path";function nu(){let n=W();return Bo(n)?(To(n,{recursive:!0,force:!0}),!0):!1}function ou(){let n=tu(Oe(),"cache","thedotmack","claude-mem");return Bo(n)?(To(n,{recursive:!0,force:!0}),!0):!1}function ru(){let n=ae(lt(),{});n.thedotmack&&(delete n.thedotmack,Te(lt(),n))}function su(){let n=ae(mt(),{});n.plugins?.["claude-mem@thedotmack"]&&(delete n.plugins["claude-mem@thedotmack"],Te(mt(),n))}function uu(){let n=ae(dt(),{});n.enabledPlugins?.["claude-mem@thedotmack"]!==void 0&&(delete n.enabledPlugins["claude-mem@thedotmack"],Te(dt(),n))}async function iu(){if(An(M.default.bgRed(M.default.white(" claude-mem uninstall "))),Be()){if(process.stdin.isTTY){let o=await $t({message:"Are you sure you want to uninstall claude-mem?",initialValue:!1});if(me(o)||!o){Sn("Uninstall cancelled.");return}}}else if(P.warn("claude-mem does not appear to be installed."),process.stdin.isTTY){let o=await $t({message:"Clean up any remaining registration data anyway?",initialValue:!1});if(me(o)||!o){He("Nothing to do.");return}}else{He("Nothing to do.");return}let n=process.env.CLAUDE_MEM_WORKER_PORT||"37777";try{await fetch(`http://127.0.0.1:${n}/api/admin/shutdown`,{method:"POST",signal:AbortSignal.timeout(5e3)});for(let o=0;o<20;o++){await new Promise(r=>setTimeout(r,500));try{await fetch(`http://127.0.0.1:${n}/api/health`,{signal:AbortSignal.timeout(1e3)})}catch{break}}P.info("Worker service stopped.")}catch{}await bn([{title:"Removing marketplace directory",task:async()=>nu()?`Marketplace directory removed ${M.default.green("OK")}`:`Marketplace directory not found ${M.default.dim("skipped")}`},{title:"Removing cache directory",task:async()=>ou()?`Cache directory removed ${M.default.green("OK")}`:`Cache directory not found ${M.default.dim("skipped")}`},{title:"Removing marketplace registration",task:async()=>(ru(),`Marketplace registration removed ${M.default.green("OK")}`)},{title:"Removing plugin registration",task:async()=>(su(),`Plugin registration removed ${M.default.green("OK")}`)},{title:"Removing from Claude settings",task:async()=>(uu(),`Claude settings updated ${M.default.green("OK")}`)}]);let e=[{label:"Gemini CLI hooks",fn:async()=>{let{uninstallGeminiCliHooks:o}=await Promise.resolve().then(()=>(Jn(),Hn));return o()}},{label:"Windsurf hooks",fn:async()=>{let{uninstallWindsurfHooks:o}=await Promise.resolve().then(()=>(to(),eo));return o()}},{label:"OpenCode plugin",fn:async()=>{let{uninstallOpenCodePlugin:o}=await Promise.resolve().then(()=>(Do(),co));return o()}},{label:"OpenClaw plugin",fn:async()=>{let{uninstallOpenClawPlugin:o}=await Promise.resolve().then(()=>(yo(),Fo));return o()}},{label:"Codex CLI",fn:async()=>{let{uninstallCodexCli:o}=await Promise.resolve().then(()=>(Oo(),Mo));return o()}}];for(let{label:o,fn:r}of e)try{await r()===0&&P.info(`${o}: removed.`)}catch{}_n([`Your data directory at ${M.default.cyan("~/.claude-mem")} was preserved.`,"To remove it manually: rm -rf ~/.claude-mem"].join(`
|
|
255
|
+
`),"Note"),He(M.default.green("claude-mem has been uninstalled."))}var M,Ro=p(()=>{"use strict";$n();M=X(Z(),1);De();ct()});import{spawnSync as au}from"child_process";import{existsSync as cu}from"fs";import{homedir as Vt}from"os";import{join as Xt}from"path";function Du(){return Me?[Xt(Vt(),".bun","bin","bun.exe"),Xt(process.env.USERPROFILE||Vt(),".bun","bin","bun.exe")]:[Xt(Vt(),".bun","bin","bun"),"/usr/local/bin/bun","/opt/homebrew/bin/bun","/home/linuxbrew/.linuxbrew/bin/bun"]}function Lo(){let e=au(Me?"where":"which",["bun"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"],shell:Me});if(e.status===0&&e.stdout.trim())return"bun";for(let o of Du())if(cu(o))return o;return null}var Po=p(()=>{"use strict";De()});var q={};G(q,{runRestartCommand:()=>pu,runSearchCommand:()=>Cu,runStartCommand:()=>mu,runStatusCommand:()=>gu,runStopCommand:()=>du,runTranscriptWatchCommand:()=>fu});import{spawn as jo}from"child_process";import{existsSync as No}from"fs";import{join as Uo}from"path";function Kt(){Be()||(console.error(v.default.red("claude-mem is not installed.")),console.error(`Run: ${v.default.bold("npx claude-mem install")}`),process.exit(1))}function Go(){let n=Lo();return n||(console.error(v.default.red("Bun not found.")),console.error("Install Bun: https://bun.sh"),console.error("After installation, restart your terminal."),process.exit(1)),n}function lu(){return Uo(W(),"plugin","scripts","worker-service.cjs")}function Ae(n,e=[]){Kt();let o=Go(),r=lu();No(r)||(console.error(v.default.red(`Worker script not found at: ${r}`)),console.error("The installation may be corrupted. Try: npx claude-mem install"),process.exit(1));let s=[r,n,...e],u=jo(o,s,{stdio:"inherit",cwd:W(),env:process.env});u.on("error",t=>{console.error(v.default.red(`Failed to start Bun: ${t.message}`)),process.exit(1)}),u.on("close",t=>{process.exit(t??0)})}function mu(){Ae("start")}function du(){Ae("stop")}function pu(){Ae("restart")}function gu(){Ae("status")}async function Cu(n){Kt();let e=n.join(" ").trim();e||(console.error(v.default.red("Usage: npx claude-mem search <query>")),process.exit(1));let r=`http://127.0.0.1:${process.env.CLAUDE_MEM_WORKER_PORT||"37777"}/api/search?q=${encodeURIComponent(e)}`;try{let s=await fetch(r);s.ok||(s.status===404&&(console.error(v.default.red("Search endpoint not found. Is the worker running?")),console.error(`Try: ${v.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(v.default.red(`Search failed: HTTP ${s.status}`)),process.exit(1));let u=await s.json();console.log(typeof u=="object"&&u!==null?JSON.stringify(u,null,2):u)}catch(s){(s?.cause?.code==="ECONNREFUSED"||s?.message?.includes("ECONNREFUSED"))&&(console.error(v.default.red("Worker is not running.")),console.error(`Start it with: ${v.default.bold("npx claude-mem start")}`),process.exit(1)),console.error(v.default.red(`Search failed: ${s.message}`)),process.exit(1)}}function fu(){Kt();let n=Go(),e=Uo(W(),"plugin","scripts","transcript-watcher.cjs");if(!No(e)){Ae("transcript",["watch"]);return}let o=jo(n,[e,"watch"],{stdio:"inherit",cwd:W(),env:process.env});o.on("error",r=>{console.error(v.default.red(`Failed to start transcript watcher: ${r.message}`)),process.exit(1)}),o.on("close",r=>{process.exit(r??0)})}var v,z=p(()=>{"use strict";v=X(Z(),1);Po();De()});var f=X(Z(),1);De();var be=process.argv.slice(2),Wo=be[0]?.toLowerCase()??"";function hu(){let n=pt();console.log(`
|
|
256
|
+
${f.default.bold("claude-mem")} v${n} \u2014 persistent memory for AI coding assistants
|
|
257
|
+
|
|
258
|
+
${f.default.bold("Install Commands")} (no Bun required):
|
|
259
|
+
${f.default.cyan("npx claude-mem")} Interactive install
|
|
260
|
+
${f.default.cyan("npx claude-mem install")} Interactive install
|
|
261
|
+
${f.default.cyan("npx claude-mem install --ide <id>")} Install for specific IDE
|
|
262
|
+
${f.default.cyan("npx claude-mem update")} Update to latest version
|
|
263
|
+
${f.default.cyan("npx claude-mem uninstall")} Remove plugin and configs
|
|
264
|
+
${f.default.cyan("npx claude-mem version")} Print version
|
|
265
|
+
|
|
266
|
+
${f.default.bold("Runtime Commands")} (requires Bun, delegates to installed plugin):
|
|
267
|
+
${f.default.cyan("npx claude-mem start")} Start worker service
|
|
268
|
+
${f.default.cyan("npx claude-mem stop")} Stop worker service
|
|
269
|
+
${f.default.cyan("npx claude-mem restart")} Restart worker service
|
|
270
|
+
${f.default.cyan("npx claude-mem status")} Show worker status
|
|
271
|
+
${f.default.cyan("npx claude-mem search <query>")} Search observations
|
|
272
|
+
${f.default.cyan("npx claude-mem transcript watch")} Start transcript watcher
|
|
273
|
+
|
|
274
|
+
${f.default.bold("IDE Identifiers")}:
|
|
275
|
+
claude-code, cursor, gemini-cli, opencode, openclaw,
|
|
276
|
+
windsurf, codex-cli, copilot-cli, antigravity, goose,
|
|
277
|
+
crush, roo-code, warp
|
|
278
|
+
`)}async function Eu(){switch(Wo){case"":{let{runInstallCommand:n}=await Promise.resolve().then(()=>(Le(),Re));await n();break}case"install":{let n=be.indexOf("--ide"),e=n!==-1?be[n+1]:void 0,{runInstallCommand:o}=await Promise.resolve().then(()=>(Le(),Re));await o({ide:e});break}case"update":case"upgrade":{let{runInstallCommand:n}=await Promise.resolve().then(()=>(Le(),Re));await n();break}case"uninstall":case"remove":{let{runUninstallCommand:n}=await Promise.resolve().then(()=>(Ro(),Io));await n();break}case"version":case"--version":case"-v":{console.log(pt());break}case"help":case"--help":case"-h":{hu();break}case"start":{let{runStartCommand:n}=await Promise.resolve().then(()=>(z(),q));n();break}case"stop":{let{runStopCommand:n}=await Promise.resolve().then(()=>(z(),q));n();break}case"restart":{let{runRestartCommand:n}=await Promise.resolve().then(()=>(z(),q));n();break}case"status":{let{runStatusCommand:n}=await Promise.resolve().then(()=>(z(),q));n();break}case"search":{let{runSearchCommand:n}=await Promise.resolve().then(()=>(z(),q));await n(be.slice(1));break}case"transcript":{let n=be[1]?.toLowerCase();if(n==="watch"){let{runTranscriptWatchCommand:e}=await Promise.resolve().then(()=>(z(),q));e()}else console.error(f.default.red(`Unknown transcript subcommand: ${n??"(none)"}`)),console.error("Usage: npx claude-mem transcript watch"),process.exit(1);break}default:console.error(f.default.red(`Unknown command: ${Wo}`)),console.error(`Run ${f.default.bold("npx claude-mem --help")} for usage information.`),process.exit(1)}}Eu().catch(n=>{console.error(f.default.red("Fatal error:"),n.message||n),process.exit(1)});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var d="http://127.0.0.1:37777";function c(t,s){fetch(`${d}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).catch(o=>{let r=o instanceof Error?o.message:String(o);r.includes("ECONNREFUSED")||console.warn(`[claude-mem] Worker POST ${t} failed: ${r}`)})}async function p(t){try{let s=await fetch(`${d}${t}`);return s.ok?await s.text():(console.warn(`[claude-mem] Worker GET ${t} returned ${s.status}`),null)}catch(s){let o=s instanceof Error?s.message:String(s);return o.includes("ECONNREFUSED")||console.warn(`[claude-mem] Worker GET ${t} failed: ${o}`),null}}var i=new Map,E=1e3;function u(t){if(!i.has(t)){for(;i.size>=E;){let s=i.keys().next().value;if(s!==void 0)i.delete(s);else break}i.set(t,`opencode-${t}-${Date.now()}`)}return i.get(t)}var S=async t=>{let s=t.project?.name||"opencode";return console.log(`[claude-mem] OpenCode plugin loading (project: ${s})`),{hooks:{tool:{execute:{after:(o,r)=>{let e=u(o.sessionID),n=r.output||"";n.length>1e3&&(n=n.slice(0,1e3)),c("/api/sessions/observations",{contentSessionId:e,tool_name:o.tool,tool_input:o.args||{},tool_response:n,cwd:t.directory})}}}},event:(o,r)=>{switch(o){case"session.created":{let{event:e}=r,n=u(e.sessionID);c("/api/sessions/init",{contentSessionId:n,project:s,prompt:""});break}case"message.updated":{let{event:e}=r;if(e.role!=="assistant")break;let n=u(e.sessionID),a=e.content||"";a.length>1e3&&(a=a.slice(0,1e3)),c("/api/sessions/observations",{contentSessionId:n,tool_name:"assistant_message",tool_input:{},tool_response:a,cwd:t.directory});break}case"session.compacted":{let{event:e}=r,n=u(e.sessionID);c("/api/sessions/summarize",{contentSessionId:n,last_assistant_message:e.summary||""});break}case"file.edited":{let{event:e}=r,n=u(e.sessionID);c("/api/sessions/observations",{contentSessionId:n,tool_name:"file_edit",tool_input:{path:e.path},tool_response:e.diff?e.diff.slice(0,1e3):`File edited: ${e.path}`,cwd:t.directory});break}case"session.deleted":{let{event:e}=r,n=i.get(e.sessionID);n&&(c("/api/sessions/complete",{contentSessionId:n}),i.delete(e.sessionID));break}}},tool:{claude_mem_search:{description:"Search claude-mem memory database for past observations, sessions, and context",args:{query:{type:"string",description:"Search query for memory observations"}},async execute(o){let r=String(o.query||"");if(!r)return"Please provide a search query.";let e=await p(`/api/search/observations?query=${encodeURIComponent(r)}&limit=10`);if(!e)return"claude-mem worker is not running. Start it with: npx claude-mem start";try{let n=JSON.parse(e),a=Array.isArray(n.items)?n.items:[];return a.length===0?`No results found for "${r}".`:a.slice(0,10).map((l,g)=>{let m=String(l.title||l.subtitle||"Untitled"),f=l.project?` [${String(l.project)}]`:"";return`${g+1}. ${m}${f}`}).join(`
|
|
2
|
+
`)}catch{return"Failed to parse search results."}}}}}},w=S;export{S as ClaudeMemPlugin,w as default};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Dockerfile.e2e — End-to-end test: install claude-mem plugin on a real OpenClaw instance
|
|
2
|
+
# Simulates the complete plugin installation flow a user would follow.
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# docker build -f Dockerfile.e2e -t openclaw-e2e-test . && docker run --rm openclaw-e2e-test
|
|
6
|
+
#
|
|
7
|
+
# Interactive (for human testing):
|
|
8
|
+
# docker run --rm -it openclaw-e2e-test /bin/bash
|
|
9
|
+
|
|
10
|
+
FROM ghcr.io/openclaw/openclaw:main
|
|
11
|
+
|
|
12
|
+
USER root
|
|
13
|
+
|
|
14
|
+
# Install curl for health checks in e2e-verify.sh, and TypeScript for building
|
|
15
|
+
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
|
|
16
|
+
RUN npm install -g typescript@5
|
|
17
|
+
|
|
18
|
+
# Create staging directory for the plugin source
|
|
19
|
+
WORKDIR /tmp/claude-mem-plugin
|
|
20
|
+
|
|
21
|
+
# Copy plugin source files
|
|
22
|
+
COPY package.json tsconfig.json openclaw.plugin.json ./
|
|
23
|
+
COPY src/ ./src/
|
|
24
|
+
|
|
25
|
+
# Build the plugin (TypeScript → JavaScript)
|
|
26
|
+
# NODE_ENV=production is set in the base image; override to install devDependencies
|
|
27
|
+
RUN NODE_ENV=development npm install && npx tsc
|
|
28
|
+
|
|
29
|
+
# Create the installable plugin package:
|
|
30
|
+
# OpenClaw `plugins install` expects package.json with openclaw.extensions field.
|
|
31
|
+
# The package name must match the plugin ID in openclaw.plugin.json (claude-mem).
|
|
32
|
+
# Only include the main plugin entry point, not test/mock files.
|
|
33
|
+
RUN mkdir -p /tmp/claude-mem-installable/dist && \
|
|
34
|
+
cp dist/index.js /tmp/claude-mem-installable/dist/ && \
|
|
35
|
+
cp dist/index.d.ts /tmp/claude-mem-installable/dist/ 2>/dev/null || true && \
|
|
36
|
+
cp openclaw.plugin.json /tmp/claude-mem-installable/ && \
|
|
37
|
+
node -e " \
|
|
38
|
+
const pkg = { \
|
|
39
|
+
name: 'claude-mem', \
|
|
40
|
+
version: '1.0.0', \
|
|
41
|
+
type: 'module', \
|
|
42
|
+
main: 'dist/index.js', \
|
|
43
|
+
openclaw: { extensions: ['./dist/index.js'] } \
|
|
44
|
+
}; \
|
|
45
|
+
require('fs').writeFileSync('/tmp/claude-mem-installable/package.json', JSON.stringify(pkg, null, 2)); \
|
|
46
|
+
"
|
|
47
|
+
|
|
48
|
+
# Switch back to app directory and node user for installation
|
|
49
|
+
WORKDIR /app
|
|
50
|
+
USER node
|
|
51
|
+
|
|
52
|
+
# Create the OpenClaw config directory
|
|
53
|
+
RUN mkdir -p /home/node/.openclaw
|
|
54
|
+
|
|
55
|
+
# Install the plugin using OpenClaw's official CLI
|
|
56
|
+
RUN node openclaw.mjs plugins install /tmp/claude-mem-installable
|
|
57
|
+
|
|
58
|
+
# Enable the plugin
|
|
59
|
+
RUN node openclaw.mjs plugins enable claude-mem
|
|
60
|
+
|
|
61
|
+
# Copy the e2e verification script and mock worker
|
|
62
|
+
COPY --chown=node:node e2e-verify.sh /app/e2e-verify.sh
|
|
63
|
+
USER root
|
|
64
|
+
RUN chmod +x /app/e2e-verify.sh && \
|
|
65
|
+
cp /tmp/claude-mem-plugin/dist/mock-worker.js /app/mock-worker.js
|
|
66
|
+
USER node
|
|
67
|
+
|
|
68
|
+
# Default: run the automated verification
|
|
69
|
+
CMD ["/bin/bash", "/app/e2e-verify.sh"]
|