opencode-supermemory 0.1.0 → 0.1.2
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 +110 -13
- package/dist/cli.js +91 -108
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/services/client.d.ts.map +1 -1
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -2,32 +2,123 @@
|
|
|
2
2
|
|
|
3
3
|
OpenCode plugin for persistent memory using [Supermemory](https://supermemory.ai).
|
|
4
4
|
|
|
5
|
+
Your agent remembers what you tell it - across sessions, across projects.
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
9
|
+
### For Humans
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bunx opencode-supermemory install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Then get your API key from [console.supermemory.ai](https://console.supermemory.ai) and set it:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
export SUPERMEMORY_API_KEY="sm_..."
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Or let your agent do it** - paste this into OpenCode:
|
|
22
|
+
```
|
|
23
|
+
Install opencode-supermemory by following https://raw.githubusercontent.com/supermemoryai/opencode-supermemory/main/README.md
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### For LLM Agents
|
|
27
|
+
|
|
28
|
+
<details>
|
|
29
|
+
<summary>Instructions for LLM Agents (click to expand)</summary>
|
|
30
|
+
|
|
31
|
+
If you're an LLM agent helping set up opencode-supermemory, follow these steps:
|
|
32
|
+
|
|
33
|
+
#### Step 1: Run the installer
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bunx opencode-supermemory install --no-tui
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This will:
|
|
40
|
+
- Register the plugin in `~/.config/opencode/opencode.jsonc`
|
|
41
|
+
- Create the `/supermemory-init` command
|
|
42
|
+
|
|
43
|
+
#### Step 2: Verify the config
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
cat ~/.config/opencode/opencode.jsonc
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Should contain:
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"plugin": ["opencode-supermemory"]
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If not, add it manually:
|
|
57
|
+
|
|
58
|
+
**JSONC:**
|
|
59
|
+
```jsonc
|
|
60
|
+
{
|
|
61
|
+
"plugin": [
|
|
62
|
+
"opencode-supermemory"
|
|
63
|
+
// ... other plugins
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**JSON:**
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"plugin": ["opencode-supermemory"]
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Step 3: Configure API key
|
|
76
|
+
|
|
77
|
+
Ask the user to get their API key from [console.supermemory.ai](https://console.supermemory.ai).
|
|
78
|
+
|
|
79
|
+
Then set it via environment variable:
|
|
80
|
+
|
|
7
81
|
```bash
|
|
8
|
-
|
|
82
|
+
export SUPERMEMORY_API_KEY="sm_..."
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Or create `~/.config/opencode/supermemory.jsonc`:
|
|
86
|
+
|
|
87
|
+
```jsonc
|
|
88
|
+
{
|
|
89
|
+
"apiKey": "sm_..."
|
|
90
|
+
}
|
|
9
91
|
```
|
|
10
92
|
|
|
11
|
-
|
|
12
|
-
1. Installs plugin globally
|
|
13
|
-
2. Creates `/supermemory-init` command
|
|
14
|
-
3. Adds plugin to OpenCode config
|
|
93
|
+
#### Step 4: Verify setup
|
|
15
94
|
|
|
16
|
-
|
|
95
|
+
Tell the user to restart OpenCode and run:
|
|
17
96
|
|
|
18
97
|
```bash
|
|
19
|
-
|
|
98
|
+
opencode -c
|
|
20
99
|
```
|
|
21
100
|
|
|
101
|
+
They should see `supermemory` in the tools list. If not, check:
|
|
102
|
+
1. Is `SUPERMEMORY_API_KEY` set?
|
|
103
|
+
2. Is the plugin in `opencode.jsonc`?
|
|
104
|
+
3. Check logs: `tail ~/.opencode-supermemory.log`
|
|
105
|
+
|
|
106
|
+
#### Step 5: Initialize codebase memory (optional)
|
|
107
|
+
|
|
108
|
+
Run `/supermemory-init` to have the agent explore and memorize the codebase.
|
|
109
|
+
|
|
110
|
+
</details>
|
|
111
|
+
|
|
22
112
|
## Features
|
|
23
113
|
|
|
24
114
|
### Context Injection
|
|
25
115
|
|
|
26
|
-
On first message,
|
|
116
|
+
On first message, the agent receives (invisible to user):
|
|
27
117
|
- User profile (cross-project preferences)
|
|
28
118
|
- Project memories (all project knowledge)
|
|
29
119
|
- Relevant user memories (semantic search)
|
|
30
120
|
|
|
121
|
+
Example of what the agent sees:
|
|
31
122
|
```
|
|
32
123
|
[SUPERMEMORY]
|
|
33
124
|
|
|
@@ -43,6 +134,8 @@ Relevant Memories:
|
|
|
43
134
|
- [82%] Build fails if .env.local missing
|
|
44
135
|
```
|
|
45
136
|
|
|
137
|
+
The agent uses this context automatically - no manual prompting needed.
|
|
138
|
+
|
|
46
139
|
### Keyword Detection
|
|
47
140
|
|
|
48
141
|
Say "remember", "save this", "don't forget" etc. and the agent auto-saves to memory.
|
|
@@ -127,13 +220,17 @@ Create `~/.config/opencode/supermemory.jsonc`:
|
|
|
127
220
|
|
|
128
221
|
All fields optional. Env var `SUPERMEMORY_API_KEY` takes precedence over config file.
|
|
129
222
|
|
|
130
|
-
|
|
223
|
+
## Usage with Oh My OpenCode
|
|
224
|
+
|
|
225
|
+
If you're using [Oh My OpenCode](https://github.com/code-yeongyu/oh-my-opencode), disable its built-in auto-compact hook to let supermemory handle context compaction:
|
|
131
226
|
|
|
132
|
-
|
|
227
|
+
Add to `~/.config/opencode/oh-my-opencode.json`:
|
|
133
228
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"disabled_hooks": ["anthropic-auto-compact"]
|
|
232
|
+
}
|
|
233
|
+
```
|
|
137
234
|
|
|
138
235
|
## Development
|
|
139
236
|
|
package/dist/cli.js
CHANGED
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
-
for (let key of __getOwnPropNames(mod))
|
|
12
|
-
if (!__hasOwnProp.call(to, key))
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: () => mod[key],
|
|
15
|
-
enumerable: true
|
|
16
|
-
});
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
2
|
|
|
21
3
|
// src/cli.ts
|
|
22
4
|
import { mkdirSync, writeFileSync, readFileSync, existsSync } from "node:fs";
|
|
@@ -25,7 +7,7 @@ import { homedir } from "node:os";
|
|
|
25
7
|
import * as readline from "node:readline";
|
|
26
8
|
var OPENCODE_CONFIG_DIR = join(homedir(), ".config", "opencode");
|
|
27
9
|
var OPENCODE_COMMAND_DIR = join(OPENCODE_CONFIG_DIR, "command");
|
|
28
|
-
var PLUGIN_NAME = "opencode-supermemory
|
|
10
|
+
var PLUGIN_NAME = "opencode-supermemory";
|
|
29
11
|
var SUPERMEMORY_INIT_COMMAND = `---
|
|
30
12
|
description: Initialize Supermemory with comprehensive codebase knowledge
|
|
31
13
|
---
|
|
@@ -190,42 +172,10 @@ async function confirm(rl, question) {
|
|
|
190
172
|
});
|
|
191
173
|
});
|
|
192
174
|
}
|
|
193
|
-
async function installPlugin() {
|
|
194
|
-
const { execSync } = await import("node:child_process");
|
|
195
|
-
let pm = "npm";
|
|
196
|
-
try {
|
|
197
|
-
execSync("bun --version", { stdio: "ignore" });
|
|
198
|
-
pm = "bun";
|
|
199
|
-
} catch {
|
|
200
|
-
try {
|
|
201
|
-
execSync("pnpm --version", { stdio: "ignore" });
|
|
202
|
-
pm = "pnpm";
|
|
203
|
-
} catch {}
|
|
204
|
-
}
|
|
205
|
-
console.log(`Installing ${PLUGIN_NAME} with ${pm}...`);
|
|
206
|
-
try {
|
|
207
|
-
execSync(`${pm} install -g ${PLUGIN_NAME}`, { stdio: "inherit" });
|
|
208
|
-
return true;
|
|
209
|
-
} catch {
|
|
210
|
-
console.error("Failed to install plugin globally.");
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function createCommand() {
|
|
215
|
-
mkdirSync(OPENCODE_COMMAND_DIR, { recursive: true });
|
|
216
|
-
const commandPath = join(OPENCODE_COMMAND_DIR, "supermemory-init.md");
|
|
217
|
-
if (existsSync(commandPath)) {
|
|
218
|
-
console.log(`Command already exists at ${commandPath}`);
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
221
|
-
writeFileSync(commandPath, SUPERMEMORY_INIT_COMMAND);
|
|
222
|
-
console.log(`Created /supermemory-init command`);
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
175
|
function findOpencodeConfig() {
|
|
226
176
|
const candidates = [
|
|
227
|
-
join(OPENCODE_CONFIG_DIR, "
|
|
228
|
-
join(OPENCODE_CONFIG_DIR, "
|
|
177
|
+
join(OPENCODE_CONFIG_DIR, "opencode.jsonc"),
|
|
178
|
+
join(OPENCODE_CONFIG_DIR, "opencode.json")
|
|
229
179
|
];
|
|
230
180
|
for (const path of candidates) {
|
|
231
181
|
if (existsSync(path)) {
|
|
@@ -238,7 +188,7 @@ function addPluginToConfig(configPath) {
|
|
|
238
188
|
try {
|
|
239
189
|
const content = readFileSync(configPath, "utf-8");
|
|
240
190
|
if (content.includes("opencode-supermemory")) {
|
|
241
|
-
console.log("Plugin already in config");
|
|
191
|
+
console.log("✓ Plugin already registered in config");
|
|
242
192
|
return true;
|
|
243
193
|
}
|
|
244
194
|
const jsonContent = content.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
@@ -246,7 +196,7 @@ function addPluginToConfig(configPath) {
|
|
|
246
196
|
try {
|
|
247
197
|
config = JSON.parse(jsonContent);
|
|
248
198
|
} catch {
|
|
249
|
-
console.error("Failed to parse config file");
|
|
199
|
+
console.error("✗ Failed to parse config file");
|
|
250
200
|
return false;
|
|
251
201
|
}
|
|
252
202
|
const plugins = config.plugin || [];
|
|
@@ -274,91 +224,124 @@ function addPluginToConfig(configPath) {
|
|
|
274
224
|
} else {
|
|
275
225
|
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
276
226
|
}
|
|
277
|
-
console.log(
|
|
227
|
+
console.log(`✓ Added plugin to ${configPath}`);
|
|
278
228
|
return true;
|
|
279
229
|
} catch (err) {
|
|
280
|
-
console.error("Failed to update config:", err);
|
|
230
|
+
console.error("✗ Failed to update config:", err);
|
|
281
231
|
return false;
|
|
282
232
|
}
|
|
283
233
|
}
|
|
284
234
|
function createNewConfig() {
|
|
285
|
-
const configPath = join(OPENCODE_CONFIG_DIR, "
|
|
235
|
+
const configPath = join(OPENCODE_CONFIG_DIR, "opencode.jsonc");
|
|
286
236
|
mkdirSync(OPENCODE_CONFIG_DIR, { recursive: true });
|
|
287
|
-
const config = {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
237
|
+
const config = `{
|
|
238
|
+
"plugin": ["${PLUGIN_NAME}"]
|
|
239
|
+
}
|
|
240
|
+
`;
|
|
241
|
+
writeFileSync(configPath, config);
|
|
242
|
+
console.log(`✓ Created ${configPath}`);
|
|
292
243
|
return true;
|
|
293
244
|
}
|
|
294
|
-
|
|
295
|
-
|
|
245
|
+
function createCommand() {
|
|
246
|
+
mkdirSync(OPENCODE_COMMAND_DIR, { recursive: true });
|
|
247
|
+
const commandPath = join(OPENCODE_COMMAND_DIR, "supermemory-init.md");
|
|
248
|
+
writeFileSync(commandPath, SUPERMEMORY_INIT_COMMAND);
|
|
249
|
+
console.log(`✓ Created /supermemory-init command`);
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
async function install(options) {
|
|
296
253
|
console.log(`
|
|
297
|
-
opencode-supermemory
|
|
254
|
+
\uD83E\uDDE0 opencode-supermemory installer
|
|
298
255
|
`);
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
console.log("Aborted.");
|
|
302
|
-
rl.close();
|
|
303
|
-
process.exit(0);
|
|
304
|
-
}
|
|
305
|
-
const installed = await installPlugin();
|
|
306
|
-
if (!installed) {
|
|
307
|
-
console.log("Aborted.");
|
|
308
|
-
rl.close();
|
|
309
|
-
process.exit(1);
|
|
310
|
-
}
|
|
311
|
-
const shouldCreateCommand = await confirm(rl, "Add /supermemory-init command?");
|
|
312
|
-
if (!shouldCreateCommand) {
|
|
313
|
-
console.log("Aborted.");
|
|
314
|
-
rl.close();
|
|
315
|
-
process.exit(0);
|
|
316
|
-
}
|
|
317
|
-
createCommand();
|
|
256
|
+
const rl = options.tui ? createReadline() : null;
|
|
257
|
+
console.log("Step 1: Register plugin in OpenCode config");
|
|
318
258
|
const configPath = findOpencodeConfig();
|
|
319
259
|
if (configPath) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
260
|
+
if (options.tui) {
|
|
261
|
+
const shouldModify = await confirm(rl, `Add plugin to ${configPath}?`);
|
|
262
|
+
if (!shouldModify) {
|
|
263
|
+
console.log("Skipped.");
|
|
264
|
+
} else {
|
|
265
|
+
addPluginToConfig(configPath);
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
addPluginToConfig(configPath);
|
|
325
269
|
}
|
|
326
|
-
addPluginToConfig(configPath);
|
|
327
270
|
} else {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
271
|
+
if (options.tui) {
|
|
272
|
+
const shouldCreate = await confirm(rl, "No OpenCode config found. Create one?");
|
|
273
|
+
if (!shouldCreate) {
|
|
274
|
+
console.log("Skipped.");
|
|
275
|
+
} else {
|
|
276
|
+
createNewConfig();
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
createNewConfig();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
console.log(`
|
|
283
|
+
Step 2: Create /supermemory-init command`);
|
|
284
|
+
if (options.tui) {
|
|
285
|
+
const shouldCreate = await confirm(rl, "Add /supermemory-init command?");
|
|
286
|
+
if (!shouldCreate) {
|
|
287
|
+
console.log("Skipped.");
|
|
288
|
+
} else {
|
|
289
|
+
createCommand();
|
|
333
290
|
}
|
|
334
|
-
|
|
291
|
+
} else {
|
|
292
|
+
createCommand();
|
|
335
293
|
}
|
|
336
294
|
console.log(`
|
|
337
|
-
|
|
338
|
-
console.log(
|
|
339
|
-
|
|
295
|
+
` + "─".repeat(50));
|
|
296
|
+
console.log(`
|
|
297
|
+
\uD83D\uDD11 Final step: Set your API key
|
|
298
|
+
`);
|
|
299
|
+
console.log("Get your API key from: https://console.supermemory.ai");
|
|
300
|
+
console.log(`
|
|
301
|
+
Then add to your shell profile:
|
|
302
|
+
`);
|
|
303
|
+
console.log(' export SUPERMEMORY_API_KEY="sm_..."');
|
|
304
|
+
console.log(`
|
|
305
|
+
Or create ~/.config/opencode/supermemory.jsonc:
|
|
306
|
+
`);
|
|
307
|
+
console.log(' { "apiKey": "sm_..." }');
|
|
308
|
+
console.log(`
|
|
309
|
+
` + "─".repeat(50));
|
|
310
|
+
console.log(`
|
|
311
|
+
✓ Setup complete! Restart OpenCode to activate.
|
|
312
|
+
`);
|
|
313
|
+
if (rl)
|
|
314
|
+
rl.close();
|
|
315
|
+
return 0;
|
|
340
316
|
}
|
|
341
317
|
function printHelp() {
|
|
342
318
|
console.log(`
|
|
343
|
-
opencode-supermemory
|
|
319
|
+
opencode-supermemory - Persistent memory for OpenCode agents
|
|
344
320
|
|
|
345
321
|
Commands:
|
|
346
|
-
|
|
322
|
+
install Install and configure the plugin
|
|
323
|
+
--no-tui Run in non-interactive mode (for LLM agents)
|
|
347
324
|
|
|
348
325
|
Examples:
|
|
349
|
-
|
|
350
|
-
bunx opencode-supermemory
|
|
326
|
+
bunx opencode-supermemory install
|
|
327
|
+
bunx opencode-supermemory install --no-tui
|
|
351
328
|
`);
|
|
352
329
|
}
|
|
353
330
|
var args = process.argv.slice(2);
|
|
354
|
-
if (args.length === 0 || args[0] === "help" || args[0] === "--help") {
|
|
331
|
+
if (args.length === 0 || args[0] === "help" || args[0] === "--help" || args[0] === "-h") {
|
|
355
332
|
printHelp();
|
|
356
333
|
process.exit(0);
|
|
357
334
|
}
|
|
358
|
-
if (args[0] === "
|
|
359
|
-
|
|
335
|
+
if (args[0] === "install") {
|
|
336
|
+
const noTui = args.includes("--no-tui");
|
|
337
|
+
install({ tui: !noTui }).then((code) => process.exit(code));
|
|
338
|
+
} else if (args[0] === "setup") {
|
|
339
|
+
console.log(`Note: 'setup' is deprecated. Use 'install' instead.
|
|
340
|
+
`);
|
|
341
|
+
const noTui = args.includes("--no-tui");
|
|
342
|
+
install({ tui: !noTui }).then((code) => process.exit(code));
|
|
360
343
|
} else {
|
|
361
|
-
console.error(`Unknown command: ${args
|
|
344
|
+
console.error(`Unknown command: ${args[0]}`);
|
|
362
345
|
printHelp();
|
|
363
346
|
process.exit(1);
|
|
364
347
|
}
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,mBAAmB,oBAAuD,CAAC;AAExF,eAAO,MAAM,MAAM;;;;;;;;CAQlB,CAAC;AAEF,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
|
package/dist/index.js
CHANGED
|
@@ -13616,7 +13616,8 @@ var DEFAULTS = {
|
|
|
13616
13616
|
maxProjectMemories: 10,
|
|
13617
13617
|
maxProfileItems: 5,
|
|
13618
13618
|
injectProfile: true,
|
|
13619
|
-
containerTagPrefix: "opencode"
|
|
13619
|
+
containerTagPrefix: "opencode",
|
|
13620
|
+
filterPrompt: "You are a stateful coding agent. Remember all the information, including but not limited to user's coding preferences, tech stack, behaviours, workflows, and any other relevant details."
|
|
13620
13621
|
};
|
|
13621
13622
|
function loadConfig() {
|
|
13622
13623
|
for (const path2 of CONFIG_FILES) {
|
|
@@ -13638,7 +13639,8 @@ var CONFIG = {
|
|
|
13638
13639
|
maxProjectMemories: fileConfig.maxProjectMemories ?? DEFAULTS.maxProjectMemories,
|
|
13639
13640
|
maxProfileItems: fileConfig.maxProfileItems ?? DEFAULTS.maxProfileItems,
|
|
13640
13641
|
injectProfile: fileConfig.injectProfile ?? DEFAULTS.injectProfile,
|
|
13641
|
-
containerTagPrefix: fileConfig.containerTagPrefix ?? DEFAULTS.containerTagPrefix
|
|
13642
|
+
containerTagPrefix: fileConfig.containerTagPrefix ?? DEFAULTS.containerTagPrefix,
|
|
13643
|
+
filterPrompt: fileConfig.filterPrompt ?? DEFAULTS.filterPrompt
|
|
13642
13644
|
};
|
|
13643
13645
|
function isConfigured() {
|
|
13644
13646
|
return !!SUPERMEMORY_API_KEY;
|
|
@@ -13662,7 +13664,7 @@ function log(message, data) {
|
|
|
13662
13664
|
|
|
13663
13665
|
// src/services/client.ts
|
|
13664
13666
|
var SUPERMEMORY_API_URL = "https://api.supermemory.ai";
|
|
13665
|
-
var TIMEOUT_MS =
|
|
13667
|
+
var TIMEOUT_MS = 30000;
|
|
13666
13668
|
function withTimeout(promise2, ms) {
|
|
13667
13669
|
return Promise.race([
|
|
13668
13670
|
promise2,
|
|
@@ -13678,6 +13680,10 @@ class SupermemoryClient {
|
|
|
13678
13680
|
throw new Error("SUPERMEMORY_API_KEY not set");
|
|
13679
13681
|
}
|
|
13680
13682
|
this.client = new Supermemory({ apiKey: SUPERMEMORY_API_KEY });
|
|
13683
|
+
this.client.settings.update({
|
|
13684
|
+
shouldLLMFilter: true,
|
|
13685
|
+
filterPrompt: CONFIG.filterPrompt
|
|
13686
|
+
});
|
|
13681
13687
|
}
|
|
13682
13688
|
return this.client;
|
|
13683
13689
|
}
|
|
@@ -13689,7 +13695,7 @@ class SupermemoryClient {
|
|
|
13689
13695
|
containerTag,
|
|
13690
13696
|
threshold: CONFIG.similarityThreshold,
|
|
13691
13697
|
limit: CONFIG.maxMemories,
|
|
13692
|
-
|
|
13698
|
+
searchMode: "hybrid"
|
|
13693
13699
|
}), TIMEOUT_MS);
|
|
13694
13700
|
log("searchMemories: success", { count: result.results?.length || 0 });
|
|
13695
13701
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/services/client.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAe3B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/services/client.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAe3B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,SAAS;IAcX,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAsBlD,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAmB/C,SAAS,CACb,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,UAAU,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE;IAiBnE,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAepD,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,SAAK;IAqB7C,kBAAkB,CACtB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACnD,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC;CAmC9C;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-supermemory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "OpenCode plugin that gives coding agents persistent memory using Supermemory",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,14 +28,12 @@
|
|
|
28
28
|
"url": "https://github.com/supermemoryai/opencode-supermemory"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@opencode-ai/plugin": "^1.0.162",
|
|
31
32
|
"supermemory": "^4.0.0"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
36
|
-
},
|
|
37
|
-
"peerDependencies": {
|
|
38
|
-
"typescript": "^5.9.3"
|
|
35
|
+
"@types/bun": "latest",
|
|
36
|
+
"typescript": "^5.7.3"
|
|
39
37
|
},
|
|
40
38
|
"opencode": {
|
|
41
39
|
"type": "plugin",
|