opencode-supermemory 2.0.1 → 2.0.3
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 +67 -26
- package/dist/cli.js +19 -3
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +79 -27
- package/dist/services/client.d.ts +4 -1
- package/dist/services/client.d.ts.map +1 -1
- package/dist/services/tags.d.ts.map +1 -1
- package/package.json +46 -46
package/README.md
CHANGED
|
@@ -12,13 +12,14 @@ Your agent remembers what you tell it - across sessions, across projects.
|
|
|
12
12
|
bunx opencode-supermemory@latest install
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Then get your API key from [
|
|
15
|
+
Then get your API key from [app.supermemory.ai](https://app.supermemory.ai/?view=integrations) and set it:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
export SUPERMEMORY_API_KEY="sm_..."
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
**Or let your agent do it** - paste this into OpenCode:
|
|
22
|
+
|
|
22
23
|
```
|
|
23
24
|
Install opencode-supermemory by following https://raw.githubusercontent.com/supermemoryai/opencode-supermemory/main/README.md
|
|
24
25
|
```
|
|
@@ -37,6 +38,7 @@ bunx opencode-supermemory@latest install --no-tui
|
|
|
37
38
|
```
|
|
38
39
|
|
|
39
40
|
This will:
|
|
41
|
+
|
|
40
42
|
- Register the plugin in `~/.config/opencode/opencode.jsonc`
|
|
41
43
|
- Create the `/supermemory-init` command
|
|
42
44
|
|
|
@@ -47,6 +49,7 @@ cat ~/.config/opencode/opencode.jsonc
|
|
|
47
49
|
```
|
|
48
50
|
|
|
49
51
|
Should contain:
|
|
52
|
+
|
|
50
53
|
```json
|
|
51
54
|
{
|
|
52
55
|
"plugin": ["opencode-supermemory"]
|
|
@@ -56,16 +59,18 @@ Should contain:
|
|
|
56
59
|
If not, add it manually:
|
|
57
60
|
|
|
58
61
|
**JSONC:**
|
|
62
|
+
|
|
59
63
|
```jsonc
|
|
60
64
|
{
|
|
61
65
|
"plugin": [
|
|
62
|
-
"opencode-supermemory"
|
|
66
|
+
"opencode-supermemory",
|
|
63
67
|
// ... other plugins
|
|
64
|
-
]
|
|
68
|
+
],
|
|
65
69
|
}
|
|
66
70
|
```
|
|
67
71
|
|
|
68
72
|
**JSON:**
|
|
73
|
+
|
|
69
74
|
```json
|
|
70
75
|
{
|
|
71
76
|
"plugin": ["opencode-supermemory"]
|
|
@@ -74,7 +79,7 @@ If not, add it manually:
|
|
|
74
79
|
|
|
75
80
|
#### Step 3: Configure API key
|
|
76
81
|
|
|
77
|
-
Ask the user to get their API key from [
|
|
82
|
+
Ask the user to get their API key from [app.supermemory.ai](https://app.supermemory.ai/?view=integrations).
|
|
78
83
|
|
|
79
84
|
Then set it via environment variable:
|
|
80
85
|
|
|
@@ -86,7 +91,7 @@ Or create `~/.config/opencode/supermemory.jsonc`:
|
|
|
86
91
|
|
|
87
92
|
```jsonc
|
|
88
93
|
{
|
|
89
|
-
"apiKey": "sm_..."
|
|
94
|
+
"apiKey": "sm_...",
|
|
90
95
|
}
|
|
91
96
|
```
|
|
92
97
|
|
|
@@ -99,6 +104,7 @@ opencode -c
|
|
|
99
104
|
```
|
|
100
105
|
|
|
101
106
|
They should see `supermemory` in the tools list. If not, check:
|
|
107
|
+
|
|
102
108
|
1. Is `SUPERMEMORY_API_KEY` set?
|
|
103
109
|
2. Is the plugin in `opencode.jsonc`?
|
|
104
110
|
3. Check logs: `tail ~/.opencode-supermemory.log`
|
|
@@ -114,11 +120,13 @@ Run `/supermemory-init` to have the agent explore and memorize the codebase.
|
|
|
114
120
|
### Context Injection
|
|
115
121
|
|
|
116
122
|
On first message, the agent receives (invisible to user):
|
|
123
|
+
|
|
117
124
|
- User profile (cross-project preferences)
|
|
118
125
|
- Project memories (all project knowledge)
|
|
119
126
|
- Relevant user memories (semantic search)
|
|
120
127
|
|
|
121
128
|
Example of what the agent sees:
|
|
129
|
+
|
|
122
130
|
```
|
|
123
131
|
[SUPERMEMORY]
|
|
124
132
|
|
|
@@ -154,6 +162,7 @@ Run `/supermemory-init` to explore and memorize your codebase structure, pattern
|
|
|
154
162
|
### Preemptive Compaction
|
|
155
163
|
|
|
156
164
|
When context hits 80% capacity:
|
|
165
|
+
|
|
157
166
|
1. Triggers OpenCode's summarization
|
|
158
167
|
2. Injects project memories into summary context
|
|
159
168
|
3. Saves session summary as a memory
|
|
@@ -172,13 +181,13 @@ Content in `<private>` tags is never stored.
|
|
|
172
181
|
|
|
173
182
|
The `supermemory` tool is available to the agent:
|
|
174
183
|
|
|
175
|
-
| Mode
|
|
176
|
-
|
|
177
|
-
| `add`
|
|
178
|
-
| `search`
|
|
179
|
-
| `profile` | `query?`
|
|
180
|
-
| `list`
|
|
181
|
-
| `forget`
|
|
184
|
+
| Mode | Args | Description |
|
|
185
|
+
| --------- | ---------------------------- | ----------------- |
|
|
186
|
+
| `add` | `content`, `type?`, `scope?` | Store memory |
|
|
187
|
+
| `search` | `query`, `scope?` | Search memories |
|
|
188
|
+
| `profile` | `query?` | View user profile |
|
|
189
|
+
| `list` | `scope?`, `limit?` | List memories |
|
|
190
|
+
| `forget` | `memoryId`, `scope?` | Delete memory |
|
|
182
191
|
|
|
183
192
|
**Scopes:** `user` (cross-project), `project` (default)
|
|
184
193
|
|
|
@@ -186,9 +195,9 @@ The `supermemory` tool is available to the agent:
|
|
|
186
195
|
|
|
187
196
|
## Memory Scoping
|
|
188
197
|
|
|
189
|
-
| Scope
|
|
190
|
-
|
|
191
|
-
| User
|
|
198
|
+
| Scope | Tag | Persists |
|
|
199
|
+
| ------- | -------------------------------------- | ------------ |
|
|
200
|
+
| User | `opencode_user_{sha256(git email)}` | All projects |
|
|
192
201
|
| Project | `opencode_project_{sha256(directory)}` | This project |
|
|
193
202
|
|
|
194
203
|
## Configuration
|
|
@@ -199,35 +208,67 @@ Create `~/.config/opencode/supermemory.jsonc`:
|
|
|
199
208
|
{
|
|
200
209
|
// API key (can also use SUPERMEMORY_API_KEY env var)
|
|
201
210
|
"apiKey": "sm_...",
|
|
202
|
-
|
|
211
|
+
|
|
203
212
|
// Min similarity for memory retrieval (0-1)
|
|
204
213
|
"similarityThreshold": 0.6,
|
|
205
|
-
|
|
214
|
+
|
|
206
215
|
// Max memories injected per request
|
|
207
216
|
"maxMemories": 5,
|
|
208
|
-
|
|
217
|
+
|
|
209
218
|
// Max project memories listed
|
|
210
219
|
"maxProjectMemories": 10,
|
|
211
|
-
|
|
220
|
+
|
|
212
221
|
// Max profile facts injected
|
|
213
222
|
"maxProfileItems": 5,
|
|
214
|
-
|
|
223
|
+
|
|
215
224
|
// Include user profile in context
|
|
216
225
|
"injectProfile": true,
|
|
217
|
-
|
|
218
|
-
// Prefix for container tags
|
|
226
|
+
|
|
227
|
+
// Prefix for container tags (used when userContainerTag/projectContainerTag not set)
|
|
219
228
|
"containerTagPrefix": "opencode",
|
|
220
|
-
|
|
229
|
+
|
|
230
|
+
// Optional: Set exact user container tag (overrides auto-generated tag)
|
|
231
|
+
"userContainerTag": "my-custom-user-tag",
|
|
232
|
+
|
|
233
|
+
// Optional: Set exact project container tag (overrides auto-generated tag)
|
|
234
|
+
"projectContainerTag": "my-project-tag",
|
|
235
|
+
|
|
221
236
|
// Extra keyword patterns for memory detection (regex)
|
|
222
237
|
"keywordPatterns": ["log\\s+this", "write\\s+down"],
|
|
223
|
-
|
|
238
|
+
|
|
224
239
|
// Context usage ratio that triggers compaction (0-1)
|
|
225
|
-
"compactionThreshold": 0.
|
|
240
|
+
"compactionThreshold": 0.8,
|
|
226
241
|
}
|
|
227
242
|
```
|
|
228
243
|
|
|
229
244
|
All fields optional. Env var `SUPERMEMORY_API_KEY` takes precedence over config file.
|
|
230
245
|
|
|
246
|
+
### Container Tag Selection
|
|
247
|
+
|
|
248
|
+
By default, container tags are auto-generated using `containerTagPrefix` plus a hash:
|
|
249
|
+
|
|
250
|
+
- User tag: `{prefix}_user_{hash(git_email)}`
|
|
251
|
+
- Project tag: `{prefix}_project_{hash(directory)}`
|
|
252
|
+
|
|
253
|
+
You can override this by specifying exact container tags:
|
|
254
|
+
|
|
255
|
+
```jsonc
|
|
256
|
+
{
|
|
257
|
+
// Use a specific container tag for user memories
|
|
258
|
+
"userContainerTag": "my-team-workspace",
|
|
259
|
+
|
|
260
|
+
// Use a specific container tag for project memories
|
|
261
|
+
"projectContainerTag": "my-awesome-project",
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
This is useful when you want to:
|
|
266
|
+
|
|
267
|
+
- Share memories across team members (same `userContainerTag`)
|
|
268
|
+
- Sync memories between different machines for the same project
|
|
269
|
+
- Organize memories using your own naming scheme
|
|
270
|
+
- Integrate with existing Supermemory container tags from other tools
|
|
271
|
+
|
|
231
272
|
## Usage with Oh My OpenCode
|
|
232
273
|
|
|
233
274
|
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:
|
|
@@ -252,7 +293,7 @@ Local install:
|
|
|
252
293
|
|
|
253
294
|
```jsonc
|
|
254
295
|
{
|
|
255
|
-
"plugin": ["file:///path/to/opencode-supermemory"]
|
|
296
|
+
"plugin": ["file:///path/to/opencode-supermemory"],
|
|
256
297
|
}
|
|
257
298
|
```
|
|
258
299
|
|
package/dist/cli.js
CHANGED
|
@@ -86,7 +86,7 @@ import { homedir } from "node:os";
|
|
|
86
86
|
var CREDENTIALS_DIR = join(homedir(), ".supermemory-opencode");
|
|
87
87
|
var CREDENTIALS_FILE = join(CREDENTIALS_DIR, "credentials.json");
|
|
88
88
|
var AUTH_PORT = 19877;
|
|
89
|
-
var AUTH_BASE_URL = "https://
|
|
89
|
+
var AUTH_BASE_URL = process.env.SUPERMEMORY_AUTH_URL || "https://app.supermemory.ai/auth/connect";
|
|
90
90
|
var CLIENT_NAME = "opencode";
|
|
91
91
|
function loadCredentials() {
|
|
92
92
|
if (!existsSync(CREDENTIALS_FILE))
|
|
@@ -374,10 +374,23 @@ This will:
|
|
|
374
374
|
|
|
375
375
|
Wait for the command to complete, then inform the user whether authentication succeeded or failed.
|
|
376
376
|
|
|
377
|
-
If the user wants to log out instead,
|
|
377
|
+
If the user wants to log out instead, tell them to use the /supermemory-logout command.
|
|
378
|
+
`;
|
|
379
|
+
var SUPERMEMORY_LOGOUT_COMMAND = `---
|
|
380
|
+
description: Log out from Supermemory and clear credentials
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
# Supermemory Logout
|
|
384
|
+
|
|
385
|
+
Run this command to log out and clear Supermemory credentials:
|
|
386
|
+
|
|
378
387
|
\`\`\`bash
|
|
379
388
|
bunx opencode-supermemory@latest logout
|
|
380
389
|
\`\`\`
|
|
390
|
+
|
|
391
|
+
This will remove the saved credentials from ~/.supermemory-opencode/credentials.json.
|
|
392
|
+
|
|
393
|
+
Inform the user whether logout succeeded and that they'll need to run /supermemory-login to re-authenticate.
|
|
381
394
|
`;
|
|
382
395
|
function createReadline() {
|
|
383
396
|
return readline.createInterface({
|
|
@@ -470,6 +483,9 @@ function createCommands() {
|
|
|
470
483
|
const loginPath = join2(OPENCODE_COMMAND_DIR, "supermemory-login.md");
|
|
471
484
|
writeFileSync2(loginPath, SUPERMEMORY_LOGIN_COMMAND);
|
|
472
485
|
console.log(`✓ Created /supermemory-login command`);
|
|
486
|
+
const logoutPath = join2(OPENCODE_COMMAND_DIR, "supermemory-logout.md");
|
|
487
|
+
writeFileSync2(logoutPath, SUPERMEMORY_LOGOUT_COMMAND);
|
|
488
|
+
console.log(`✓ Created /supermemory-logout command`);
|
|
473
489
|
return true;
|
|
474
490
|
}
|
|
475
491
|
function isOhMyOpencodeInstalled() {
|
|
@@ -546,7 +562,7 @@ async function install(options) {
|
|
|
546
562
|
}
|
|
547
563
|
}
|
|
548
564
|
console.log(`
|
|
549
|
-
Step 2: Create /supermemory-init and /supermemory-
|
|
565
|
+
Step 2: Create /supermemory-init, /supermemory-login, and /supermemory-logout commands`);
|
|
550
566
|
if (options.tui) {
|
|
551
567
|
const shouldCreate = await confirm(rl, "Add supermemory commands?");
|
|
552
568
|
if (!shouldCreate) {
|
package/dist/config.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export declare const CONFIG: {
|
|
|
6
6
|
maxProfileItems: number;
|
|
7
7
|
injectProfile: boolean;
|
|
8
8
|
containerTagPrefix: string;
|
|
9
|
+
userContainerTag: string | undefined;
|
|
10
|
+
projectContainerTag: string | undefined;
|
|
9
11
|
filterPrompt: string;
|
|
10
12
|
keywordPatterns: string[];
|
|
11
13
|
compactionThreshold: number;
|
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":"AAmGA,eAAO,MAAM,mBAAmB,oBAAc,CAAC;AAE/C,eAAO,MAAM,MAAM;;;;;;;;;;;;CAelB,CAAC;AAEF,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
|
package/dist/index.js
CHANGED
|
@@ -13683,6 +13683,7 @@ import { join } from "node:path";
|
|
|
13683
13683
|
import { homedir } from "node:os";
|
|
13684
13684
|
var CREDENTIALS_DIR = join(homedir(), ".supermemory-opencode");
|
|
13685
13685
|
var CREDENTIALS_FILE = join(CREDENTIALS_DIR, "credentials.json");
|
|
13686
|
+
var AUTH_BASE_URL = process.env.SUPERMEMORY_AUTH_URL || "https://app.supermemory.ai/auth/connect";
|
|
13686
13687
|
function loadCredentials() {
|
|
13687
13688
|
if (!existsSync(CREDENTIALS_FILE))
|
|
13688
13689
|
return null;
|
|
@@ -13773,6 +13774,8 @@ var CONFIG = {
|
|
|
13773
13774
|
maxProfileItems: fileConfig.maxProfileItems ?? DEFAULTS.maxProfileItems,
|
|
13774
13775
|
injectProfile: fileConfig.injectProfile ?? DEFAULTS.injectProfile,
|
|
13775
13776
|
containerTagPrefix: fileConfig.containerTagPrefix ?? DEFAULTS.containerTagPrefix,
|
|
13777
|
+
userContainerTag: fileConfig.userContainerTag,
|
|
13778
|
+
projectContainerTag: fileConfig.projectContainerTag,
|
|
13776
13779
|
filterPrompt: fileConfig.filterPrompt ?? DEFAULTS.filterPrompt,
|
|
13777
13780
|
keywordPatterns: [
|
|
13778
13781
|
...DEFAULT_KEYWORD_PATTERNS,
|
|
@@ -13801,8 +13804,8 @@ function log(message, data) {
|
|
|
13801
13804
|
}
|
|
13802
13805
|
|
|
13803
13806
|
// src/services/client.ts
|
|
13804
|
-
var SUPERMEMORY_API_URL = "https://api.supermemory.ai";
|
|
13805
13807
|
var TIMEOUT_MS = 30000;
|
|
13808
|
+
var MAX_CONVERSATION_CHARS = 1e5;
|
|
13806
13809
|
function withTimeout(promise2, ms) {
|
|
13807
13810
|
return Promise.race([
|
|
13808
13811
|
promise2,
|
|
@@ -13812,6 +13815,19 @@ function withTimeout(promise2, ms) {
|
|
|
13812
13815
|
|
|
13813
13816
|
class SupermemoryClient {
|
|
13814
13817
|
client = null;
|
|
13818
|
+
formatConversationMessage(message) {
|
|
13819
|
+
const content = typeof message.content === "string" ? message.content : message.content.map((part) => part.type === "text" ? part.text : `[image] ${part.imageUrl.url}`).join(`
|
|
13820
|
+
`);
|
|
13821
|
+
const trimmed = content.trim();
|
|
13822
|
+
if (trimmed.length === 0) {
|
|
13823
|
+
return `[${message.role}]`;
|
|
13824
|
+
}
|
|
13825
|
+
return `[${message.role}] ${trimmed}`;
|
|
13826
|
+
}
|
|
13827
|
+
formatConversationTranscript(messages) {
|
|
13828
|
+
return messages.map((message, idx) => `${idx + 1}. ${this.formatConversationMessage(message)}`).join(`
|
|
13829
|
+
`);
|
|
13830
|
+
}
|
|
13815
13831
|
getClient() {
|
|
13816
13832
|
if (!this.client) {
|
|
13817
13833
|
if (!isConfigured()) {
|
|
@@ -13904,34 +13920,64 @@ class SupermemoryClient {
|
|
|
13904
13920
|
}
|
|
13905
13921
|
}
|
|
13906
13922
|
async ingestConversation(conversationId, messages, containerTags, metadata) {
|
|
13907
|
-
log("ingestConversation: start", {
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13923
|
+
log("ingestConversation: start", {
|
|
13924
|
+
conversationId,
|
|
13925
|
+
messageCount: messages.length,
|
|
13926
|
+
containerTags
|
|
13927
|
+
});
|
|
13928
|
+
if (messages.length === 0) {
|
|
13929
|
+
return { success: false, error: "No messages to ingest" };
|
|
13930
|
+
}
|
|
13931
|
+
const uniqueTags = [...new Set(containerTags)].filter((tag) => tag.length > 0);
|
|
13932
|
+
if (uniqueTags.length === 0) {
|
|
13933
|
+
return { success: false, error: "At least one containerTag is required" };
|
|
13934
|
+
}
|
|
13935
|
+
const transcript = this.formatConversationTranscript(messages);
|
|
13936
|
+
const rawContent = `[Conversation ${conversationId}]
|
|
13937
|
+
${transcript}`;
|
|
13938
|
+
const content = rawContent.length > MAX_CONVERSATION_CHARS ? `${rawContent.slice(0, MAX_CONVERSATION_CHARS)}
|
|
13939
|
+
...[truncated]` : rawContent;
|
|
13940
|
+
const ingestMetadata = {
|
|
13941
|
+
type: "conversation",
|
|
13942
|
+
conversationId,
|
|
13943
|
+
messageCount: messages.length,
|
|
13944
|
+
originalContainerTags: uniqueTags,
|
|
13945
|
+
...metadata
|
|
13946
|
+
};
|
|
13947
|
+
const savedIds = [];
|
|
13948
|
+
let firstError = null;
|
|
13949
|
+
for (const tag of uniqueTags) {
|
|
13950
|
+
const result = await this.addMemory(content, tag, ingestMetadata);
|
|
13951
|
+
if (result.success) {
|
|
13952
|
+
savedIds.push(result.id);
|
|
13953
|
+
} else if (!firstError) {
|
|
13954
|
+
firstError = result.error || "Failed to store conversation";
|
|
13926
13955
|
}
|
|
13927
|
-
const result = await response.json();
|
|
13928
|
-
log("ingestConversation: success", { conversationId, status: result.status });
|
|
13929
|
-
return { success: true, ...result };
|
|
13930
|
-
} catch (error45) {
|
|
13931
|
-
const errorMessage = error45 instanceof Error ? error45.message : String(error45);
|
|
13932
|
-
log("ingestConversation: error", { error: errorMessage });
|
|
13933
|
-
return { success: false, error: errorMessage };
|
|
13934
13956
|
}
|
|
13957
|
+
if (savedIds.length === 0) {
|
|
13958
|
+
log("ingestConversation: error", { conversationId, error: firstError });
|
|
13959
|
+
return {
|
|
13960
|
+
success: false,
|
|
13961
|
+
error: firstError || "Failed to ingest conversation"
|
|
13962
|
+
};
|
|
13963
|
+
}
|
|
13964
|
+
const status = savedIds.length === uniqueTags.length ? "stored" : "partial";
|
|
13965
|
+
const response = {
|
|
13966
|
+
id: savedIds[0],
|
|
13967
|
+
conversationId,
|
|
13968
|
+
status
|
|
13969
|
+
};
|
|
13970
|
+
log("ingestConversation: success", {
|
|
13971
|
+
conversationId,
|
|
13972
|
+
status,
|
|
13973
|
+
storedCount: savedIds.length,
|
|
13974
|
+
requestedCount: uniqueTags.length
|
|
13975
|
+
});
|
|
13976
|
+
return {
|
|
13977
|
+
success: true,
|
|
13978
|
+
...response,
|
|
13979
|
+
storedMemoryIds: savedIds
|
|
13980
|
+
};
|
|
13935
13981
|
}
|
|
13936
13982
|
}
|
|
13937
13983
|
var supermemoryClient = new SupermemoryClient;
|
|
@@ -13998,6 +14044,9 @@ function getGitEmail() {
|
|
|
13998
14044
|
}
|
|
13999
14045
|
}
|
|
14000
14046
|
function getUserTag() {
|
|
14047
|
+
if (CONFIG.userContainerTag) {
|
|
14048
|
+
return CONFIG.userContainerTag;
|
|
14049
|
+
}
|
|
14001
14050
|
const email3 = getGitEmail();
|
|
14002
14051
|
if (email3) {
|
|
14003
14052
|
return `${CONFIG.containerTagPrefix}_user_${sha256(email3)}`;
|
|
@@ -14006,6 +14055,9 @@ function getUserTag() {
|
|
|
14006
14055
|
return `${CONFIG.containerTagPrefix}_user_${sha256(fallback)}`;
|
|
14007
14056
|
}
|
|
14008
14057
|
function getProjectTag(directory) {
|
|
14058
|
+
if (CONFIG.projectContainerTag) {
|
|
14059
|
+
return CONFIG.projectContainerTag;
|
|
14060
|
+
}
|
|
14009
14061
|
return `${CONFIG.containerTagPrefix}_project_${sha256(directory)}`;
|
|
14010
14062
|
}
|
|
14011
14063
|
function getTags(directory) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import Supermemory from "supermemory";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ConversationMessage, MemoryType } from "../types/index.js";
|
|
3
3
|
export declare class SupermemoryClient {
|
|
4
4
|
private client;
|
|
5
|
+
private formatConversationMessage;
|
|
6
|
+
private formatConversationTranscript;
|
|
5
7
|
private getClient;
|
|
6
8
|
searchMemories(query: string, containerTag: string): Promise<{
|
|
7
9
|
results: Array<Supermemory.Search.SearchMemoriesResponse.Result>;
|
|
@@ -65,6 +67,7 @@ export declare class SupermemoryClient {
|
|
|
65
67
|
success: false;
|
|
66
68
|
error: string;
|
|
67
69
|
} | {
|
|
70
|
+
storedMemoryIds: string[];
|
|
68
71
|
id: string;
|
|
69
72
|
conversationId: string;
|
|
70
73
|
status: string;
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/services/client.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAc3B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,yBAAyB;IAmBjC,OAAO,CAAC,4BAA4B;IAMpC,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;;;;;;;;;IAqBnE,YAAY,CAAC,QAAQ,EAAE,MAAM;;;;;;;IAgB7B,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;;;;;;;;;;;CA0EvD;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/services/tags.ts"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAO3C;AAED,wBAAgB,UAAU,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/services/tags.ts"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAO3C;AAED,wBAAgB,UAAU,IAAI,MAAM,CAanC;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAQvD;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAK5E"}
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
2
|
+
"name": "opencode-supermemory",
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"description": "OpenCode plugin that gives coding agents persistent memory using Supermemory",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"opencode-supermemory": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/cli.ts --outfile ./dist/cli.js --target node && tsc --emitDeclarationOnly",
|
|
13
|
+
"dev": "tsc --watch",
|
|
14
|
+
"typecheck": "tsc --noEmit"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"opencode",
|
|
18
|
+
"plugin",
|
|
19
|
+
"supermemory",
|
|
20
|
+
"memory",
|
|
21
|
+
"ai",
|
|
22
|
+
"coding-agent"
|
|
23
|
+
],
|
|
24
|
+
"author": "Supermemory",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/supermemoryai/opencode-supermemory"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@opencode-ai/plugin": "^1.0.162",
|
|
32
|
+
"supermemory": "^4.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/bun": "latest",
|
|
36
|
+
"typescript": "^5.7.3"
|
|
37
|
+
},
|
|
38
|
+
"opencode": {
|
|
39
|
+
"type": "plugin",
|
|
40
|
+
"hooks": [
|
|
41
|
+
"chat.message",
|
|
42
|
+
"event"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist"
|
|
47
|
+
]
|
|
48
48
|
}
|