@mrc2204/agent-smart-memo 5.1.8 → 5.1.11
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 +30 -7
- package/bin/asm.mjs +80 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,12 +91,17 @@ asm install opencode
|
|
|
91
91
|
|
|
92
92
|
## 3) Install ASM
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
There are currently **two supported install flows**.
|
|
95
|
+
|
|
96
|
+
### Flow A — CLI-first (recommended for ASM CLI usage)
|
|
97
|
+
Install the CLI globally first:
|
|
98
|
+
|
|
95
99
|
```bash
|
|
96
100
|
npm install -g @mrc2204/agent-smart-memo
|
|
97
101
|
```
|
|
98
102
|
|
|
99
|
-
|
|
103
|
+
Then initialize shared config:
|
|
104
|
+
|
|
100
105
|
```bash
|
|
101
106
|
asm init-setup --yes
|
|
102
107
|
```
|
|
@@ -106,19 +111,32 @@ This creates or updates:
|
|
|
106
111
|
~/.config/asm/config.json
|
|
107
112
|
```
|
|
108
113
|
|
|
109
|
-
|
|
114
|
+
Then install a runtime target:
|
|
115
|
+
|
|
110
116
|
```bash
|
|
111
117
|
asm install openclaw
|
|
112
118
|
asm install paperclip
|
|
113
119
|
asm install opencode
|
|
114
120
|
```
|
|
115
121
|
|
|
116
|
-
|
|
122
|
+
### Flow B — Plugin-first (direct OpenClaw plugin install)
|
|
123
|
+
If you only want the OpenClaw plugin directly, install it through OpenClaw:
|
|
117
124
|
|
|
118
|
-
```
|
|
119
|
-
|
|
125
|
+
```bash
|
|
126
|
+
openclaw plugins install @mrc2204/agent-smart-memo
|
|
120
127
|
```
|
|
121
128
|
|
|
129
|
+
Then continue with OpenClaw-side config/bootstrap as needed.
|
|
130
|
+
|
|
131
|
+
### Important note
|
|
132
|
+
The command below is **not the recommended primary flow right now**:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npx @mrc2204/agent-smart-memo install
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Use the two supported flows above until CLI bootstrap is fully separated/standardized.
|
|
139
|
+
|
|
122
140
|
---
|
|
123
141
|
|
|
124
142
|
## 4) Shared config source-of-truth
|
|
@@ -177,13 +195,18 @@ This keeps `openclaw.json` from becoming a second core source-of-truth.
|
|
|
177
195
|
|
|
178
196
|
## 5) OpenClaw quick start
|
|
179
197
|
|
|
180
|
-
### Install from npm
|
|
198
|
+
### Install from npm (CLI-first)
|
|
181
199
|
```bash
|
|
182
200
|
npm install -g @mrc2204/agent-smart-memo
|
|
183
201
|
asm init-setup --yes
|
|
184
202
|
asm install openclaw --yes
|
|
185
203
|
```
|
|
186
204
|
|
|
205
|
+
### Install plugin directly into OpenClaw (plugin-first)
|
|
206
|
+
```bash
|
|
207
|
+
openclaw plugins install @mrc2204/agent-smart-memo
|
|
208
|
+
```
|
|
209
|
+
|
|
187
210
|
### Install locally from source
|
|
188
211
|
```bash
|
|
189
212
|
npm install
|
package/bin/asm.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { resolve } from "node:path";
|
|
2
|
+
import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { runInitOpenClaw } from "../scripts/init-openclaw.mjs";
|
|
5
5
|
import { createShellRunner, runInitSetupFlow, runInstallPlatformFlow } from "../dist/cli/platform-installers.js";
|
|
6
6
|
import { runOpencodeMcpServer } from "./opencode-mcp-server.mjs";
|
|
@@ -8,6 +8,10 @@ import { runOpencodeMcpServer } from "./opencode-mcp-server.mjs";
|
|
|
8
8
|
const ASM_PLUGIN_PACKAGE = "@mrc2204/agent-smart-memo";
|
|
9
9
|
const ASM_PLUGIN_ID = "agent-smart-memo";
|
|
10
10
|
|
|
11
|
+
console.error("[ASM-TRACE] import.meta.url=", import.meta.url);
|
|
12
|
+
console.error("[ASM-TRACE] argv=", JSON.stringify(process.argv));
|
|
13
|
+
console.error("[ASM-TRACE] cwd=", process.cwd());
|
|
14
|
+
|
|
11
15
|
function text(value) {
|
|
12
16
|
return typeof value === "string" ? value.trim() : "";
|
|
13
17
|
}
|
|
@@ -171,15 +175,82 @@ function parseProjectEventArgs(argv = []) {
|
|
|
171
175
|
return out;
|
|
172
176
|
}
|
|
173
177
|
|
|
178
|
+
function resolveUserBinDir() {
|
|
179
|
+
const home = process.env.HOME || process.cwd();
|
|
180
|
+
return join(home, '.local', 'bin');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function pathContains(dir) {
|
|
184
|
+
return String(process.env.PATH || '').split(':').includes(dir);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function detectShellProfile() {
|
|
188
|
+
const shell = String(process.env.SHELL || '').trim();
|
|
189
|
+
const home = process.env.HOME || process.cwd();
|
|
190
|
+
if (shell.endsWith('/zsh')) return { shell: 'zsh', profilePath: join(home, '.zshrc') };
|
|
191
|
+
if (shell.endsWith('/bash')) return { shell: 'bash', profilePath: join(home, '.bashrc') };
|
|
192
|
+
return { shell: shell || 'unknown', profilePath: join(home, '.profile') };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function profileHasPathLine(profilePath, userBin) {
|
|
196
|
+
try {
|
|
197
|
+
const content = readFileSync(profilePath, 'utf8');
|
|
198
|
+
return content.includes(userBin) || content.includes('$HOME/.local/bin');
|
|
199
|
+
} catch {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function appendPathLine(profilePath, userBin) {
|
|
205
|
+
const exportLine = `\n# Added by ASM CLI installer\nexport PATH=\"${userBin}:$PATH\"\n`;
|
|
206
|
+
const existing = (() => { try { return readFileSync(profilePath, 'utf8'); } catch { return ''; } })();
|
|
207
|
+
if (!existing.includes(userBin) && !existing.includes('$HOME/.local/bin')) {
|
|
208
|
+
writeFileSync(profilePath, `${existing}${exportLine}`, 'utf8');
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function createAsmLauncher() {
|
|
213
|
+
const userBin = resolveUserBinDir();
|
|
214
|
+
mkdirSync(userBin, { recursive: true });
|
|
215
|
+
const launcherPath = join(userBin, 'asm');
|
|
216
|
+
const packageRoot = resolve(dirname(new URL(import.meta.url).pathname), '..');
|
|
217
|
+
const launcher = `#!/usr/bin/env bash\nnode \"${join(packageRoot, 'bin', 'asm.mjs')}\" \"$@\"\n`;
|
|
218
|
+
writeFileSync(launcherPath, launcher, 'utf8');
|
|
219
|
+
chmodSync(launcherPath, 0o755);
|
|
220
|
+
return { launcherPath, userBin };
|
|
221
|
+
}
|
|
222
|
+
|
|
174
223
|
export async function runCliBootstrapFlow({ log = console.log } = {}) {
|
|
175
|
-
log(
|
|
224
|
+
log('[ASM-CLI] Installing / exposing ASM CLI only...');
|
|
176
225
|
log(`[ASM-CLI] Package: ${ASM_PLUGIN_PACKAGE}`);
|
|
177
|
-
|
|
178
|
-
log(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
226
|
+
const installed = createAsmLauncher();
|
|
227
|
+
log(`[ASM-CLI] Installed launcher: ${installed.launcherPath}`);
|
|
228
|
+
if (!pathContains(installed.userBin)) {
|
|
229
|
+
const detected = detectShellProfile();
|
|
230
|
+
log(`[ASM-CLI] ${installed.userBin} is not currently on PATH.`);
|
|
231
|
+
const shouldPatch = process.stdin.isTTY
|
|
232
|
+
? await askYesNo(`[ASM-CLI] Add ${installed.userBin} to ${detected.profilePath} now? [y/N] `)
|
|
233
|
+
: false;
|
|
234
|
+
if (shouldPatch) {
|
|
235
|
+
appendPathLine(detected.profilePath, installed.userBin);
|
|
236
|
+
log(`[ASM-CLI] Updated ${detected.profilePath}`);
|
|
237
|
+
log(`[ASM-CLI] Run: source ${detected.profilePath} (or open a new terminal)`);
|
|
238
|
+
process.env.PATH = `${installed.userBin}:${process.env.PATH || ''}`;
|
|
239
|
+
} else {
|
|
240
|
+
log(`[ASM-CLI] To enable 'asm' in future shells, add this line to ${detected.profilePath}:`);
|
|
241
|
+
log(` export PATH=\"${installed.userBin}:$PATH\"`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const verify = createShellRunner()('bash', ['-lc', `"${installed.launcherPath}" --help`]);
|
|
245
|
+
if (!verify.ok) {
|
|
246
|
+
return { ok: false, step: 'verify-cli-launcher', details: { stdout: verify.stdout, stderr: verify.stderr, launcherPath: installed.launcherPath } };
|
|
247
|
+
}
|
|
248
|
+
log('[ASM-CLI] asm launcher verified successfully.');
|
|
249
|
+
log('[ASM-CLI] Next steps:');
|
|
250
|
+
log(' 1) asm install openclaw');
|
|
251
|
+
log(' 2) asm install opencode');
|
|
252
|
+
log(' 3) asm install paperclip');
|
|
253
|
+
return { ok: true, step: 'install-cli', details: installed };
|
|
183
254
|
}
|
|
184
255
|
|
|
185
256
|
export async function runSetupOpenClawFlow({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrc2204/agent-smart-memo",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.11",
|
|
4
4
|
"description": "Smart Memory Plugin for OpenClaw \u2014 structured slot memory with auto-capture, auto-recall, essence distillation, and Qdrant vector search",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|