opencode-supermemory 0.1.2 → 0.1.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 +2 -2
- package/dist/cli.js +77 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +82 -49
- package/dist/services/client.d.ts +65 -7
- package/dist/services/client.d.ts.map +1 -1
- package/dist/services/compaction.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Your agent remembers what you tell it - across sessions, across projects.
|
|
|
9
9
|
### For Humans
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
bunx opencode-supermemory install
|
|
12
|
+
bunx opencode-supermemory@latest install
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Then get your API key from [console.supermemory.ai](https://console.supermemory.ai) and set it:
|
|
@@ -33,7 +33,7 @@ If you're an LLM agent helping set up opencode-supermemory, follow these steps:
|
|
|
33
33
|
#### Step 1: Run the installer
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
bunx opencode-supermemory install --no-tui
|
|
36
|
+
bunx opencode-supermemory@latest install --no-tui
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
This will:
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,8 @@ import { homedir } from "node:os";
|
|
|
7
7
|
import * as readline from "node:readline";
|
|
8
8
|
var OPENCODE_CONFIG_DIR = join(homedir(), ".config", "opencode");
|
|
9
9
|
var OPENCODE_COMMAND_DIR = join(OPENCODE_CONFIG_DIR, "command");
|
|
10
|
-
var
|
|
10
|
+
var OH_MY_OPENCODE_CONFIG = join(OPENCODE_CONFIG_DIR, "oh-my-opencode.json");
|
|
11
|
+
var PLUGIN_NAME = "opencode-supermemory@latest";
|
|
11
12
|
var SUPERMEMORY_INIT_COMMAND = `---
|
|
12
13
|
description: Initialize Supermemory with comprehensive codebase knowledge
|
|
13
14
|
---
|
|
@@ -249,6 +250,49 @@ function createCommand() {
|
|
|
249
250
|
console.log(`✓ Created /supermemory-init command`);
|
|
250
251
|
return true;
|
|
251
252
|
}
|
|
253
|
+
function isOhMyOpencodeInstalled() {
|
|
254
|
+
const configPath = findOpencodeConfig();
|
|
255
|
+
if (!configPath)
|
|
256
|
+
return false;
|
|
257
|
+
try {
|
|
258
|
+
const content = readFileSync(configPath, "utf-8");
|
|
259
|
+
return content.includes("oh-my-opencode");
|
|
260
|
+
} catch {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function isAutoCompactAlreadyDisabled() {
|
|
265
|
+
if (!existsSync(OH_MY_OPENCODE_CONFIG))
|
|
266
|
+
return false;
|
|
267
|
+
try {
|
|
268
|
+
const content = readFileSync(OH_MY_OPENCODE_CONFIG, "utf-8");
|
|
269
|
+
const config = JSON.parse(content);
|
|
270
|
+
const disabledHooks = config.disabled_hooks;
|
|
271
|
+
return disabledHooks?.includes("anthropic-auto-compact") ?? false;
|
|
272
|
+
} catch {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function disableAutoCompactHook() {
|
|
277
|
+
try {
|
|
278
|
+
let config = {};
|
|
279
|
+
if (existsSync(OH_MY_OPENCODE_CONFIG)) {
|
|
280
|
+
const content = readFileSync(OH_MY_OPENCODE_CONFIG, "utf-8");
|
|
281
|
+
config = JSON.parse(content);
|
|
282
|
+
}
|
|
283
|
+
const disabledHooks = config.disabled_hooks || [];
|
|
284
|
+
if (!disabledHooks.includes("anthropic-auto-compact")) {
|
|
285
|
+
disabledHooks.push("anthropic-auto-compact");
|
|
286
|
+
}
|
|
287
|
+
config.disabled_hooks = disabledHooks;
|
|
288
|
+
writeFileSync(OH_MY_OPENCODE_CONFIG, JSON.stringify(config, null, 2));
|
|
289
|
+
console.log(`✓ Disabled anthropic-auto-compact hook in oh-my-opencode.json`);
|
|
290
|
+
return true;
|
|
291
|
+
} catch (err) {
|
|
292
|
+
console.error("✗ Failed to update oh-my-opencode.json:", err);
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
252
296
|
async function install(options) {
|
|
253
297
|
console.log(`
|
|
254
298
|
\uD83E\uDDE0 opencode-supermemory installer
|
|
@@ -291,6 +335,28 @@ Step 2: Create /supermemory-init command`);
|
|
|
291
335
|
} else {
|
|
292
336
|
createCommand();
|
|
293
337
|
}
|
|
338
|
+
if (isOhMyOpencodeInstalled()) {
|
|
339
|
+
console.log(`
|
|
340
|
+
Step 3: Configure Oh My OpenCode`);
|
|
341
|
+
console.log("Detected Oh My OpenCode plugin.");
|
|
342
|
+
console.log("Supermemory handles context compaction, so the built-in auto-compact hook should be disabled.");
|
|
343
|
+
if (isAutoCompactAlreadyDisabled()) {
|
|
344
|
+
console.log("✓ anthropic-auto-compact hook already disabled");
|
|
345
|
+
} else {
|
|
346
|
+
if (options.tui) {
|
|
347
|
+
const shouldDisable = await confirm(rl, "Disable anthropic-auto-compact hook to let Supermemory handle context?");
|
|
348
|
+
if (!shouldDisable) {
|
|
349
|
+
console.log("Skipped.");
|
|
350
|
+
} else {
|
|
351
|
+
disableAutoCompactHook();
|
|
352
|
+
}
|
|
353
|
+
} else if (options.disableAutoCompact) {
|
|
354
|
+
disableAutoCompactHook();
|
|
355
|
+
} else {
|
|
356
|
+
console.log("Skipped. Use --disable-auto-compact to disable the hook in non-interactive mode.");
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
294
360
|
console.log(`
|
|
295
361
|
` + "─".repeat(50));
|
|
296
362
|
console.log(`
|
|
@@ -319,12 +385,14 @@ function printHelp() {
|
|
|
319
385
|
opencode-supermemory - Persistent memory for OpenCode agents
|
|
320
386
|
|
|
321
387
|
Commands:
|
|
322
|
-
install
|
|
323
|
-
--no-tui
|
|
388
|
+
install Install and configure the plugin
|
|
389
|
+
--no-tui Run in non-interactive mode (for LLM agents)
|
|
390
|
+
--disable-auto-compact Disable Oh My OpenCode's auto-compact hook (use with --no-tui)
|
|
324
391
|
|
|
325
392
|
Examples:
|
|
326
|
-
bunx opencode-supermemory install
|
|
327
|
-
bunx opencode-supermemory install --no-tui
|
|
393
|
+
bunx opencode-supermemory@latest install
|
|
394
|
+
bunx opencode-supermemory@latest install --no-tui
|
|
395
|
+
bunx opencode-supermemory@latest install --no-tui --disable-auto-compact
|
|
328
396
|
`);
|
|
329
397
|
}
|
|
330
398
|
var args = process.argv.slice(2);
|
|
@@ -334,12 +402,14 @@ if (args.length === 0 || args[0] === "help" || args[0] === "--help" || args[0] =
|
|
|
334
402
|
}
|
|
335
403
|
if (args[0] === "install") {
|
|
336
404
|
const noTui = args.includes("--no-tui");
|
|
337
|
-
|
|
405
|
+
const disableAutoCompact = args.includes("--disable-auto-compact");
|
|
406
|
+
install({ tui: !noTui, disableAutoCompact }).then((code) => process.exit(code));
|
|
338
407
|
} else if (args[0] === "setup") {
|
|
339
408
|
console.log(`Note: 'setup' is deprecated. Use 'install' instead.
|
|
340
409
|
`);
|
|
341
410
|
const noTui = args.includes("--no-tui");
|
|
342
|
-
|
|
411
|
+
const disableAutoCompact = args.includes("--disable-auto-compact");
|
|
412
|
+
install({ tui: !noTui, disableAutoCompact }).then((code) => process.exit(code));
|
|
343
413
|
} else {
|
|
344
414
|
console.error(`Unknown command: ${args[0]}`);
|
|
345
415
|
printHelp();
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAuC/D,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AAuC/D,eAAO,MAAM,iBAAiB,EAAE,MAwa/B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -13698,11 +13698,11 @@ class SupermemoryClient {
|
|
|
13698
13698
|
searchMode: "hybrid"
|
|
13699
13699
|
}), TIMEOUT_MS);
|
|
13700
13700
|
log("searchMemories: success", { count: result.results?.length || 0 });
|
|
13701
|
-
return result;
|
|
13701
|
+
return { success: true, ...result };
|
|
13702
13702
|
} catch (error45) {
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
return { results: [], total: 0, timing: 0 };
|
|
13703
|
+
const errorMessage = error45 instanceof Error ? error45.message : String(error45);
|
|
13704
|
+
log("searchMemories: error", { error: errorMessage });
|
|
13705
|
+
return { success: false, error: errorMessage, results: [], total: 0, timing: 0 };
|
|
13706
13706
|
}
|
|
13707
13707
|
}
|
|
13708
13708
|
async getProfile(containerTag, query) {
|
|
@@ -13713,34 +13713,39 @@ class SupermemoryClient {
|
|
|
13713
13713
|
q: query
|
|
13714
13714
|
}), TIMEOUT_MS);
|
|
13715
13715
|
log("getProfile: success", { hasProfile: !!result?.profile });
|
|
13716
|
-
return result;
|
|
13716
|
+
return { success: true, ...result };
|
|
13717
13717
|
} catch (error45) {
|
|
13718
|
-
|
|
13719
|
-
|
|
13720
|
-
return null;
|
|
13718
|
+
const errorMessage = error45 instanceof Error ? error45.message : String(error45);
|
|
13719
|
+
log("getProfile: error", { error: errorMessage });
|
|
13720
|
+
return { success: false, error: errorMessage, profile: null };
|
|
13721
13721
|
}
|
|
13722
13722
|
}
|
|
13723
13723
|
async addMemory(content, containerTag, metadata) {
|
|
13724
|
+
log("addMemory: start", { containerTag, contentLength: content.length });
|
|
13724
13725
|
try {
|
|
13725
|
-
|
|
13726
|
+
const result = await withTimeout(this.getClient().memories.add({
|
|
13726
13727
|
content,
|
|
13727
13728
|
containerTag,
|
|
13728
13729
|
metadata
|
|
13729
13730
|
}), TIMEOUT_MS);
|
|
13731
|
+
log("addMemory: success", { id: result.id });
|
|
13732
|
+
return { success: true, ...result };
|
|
13730
13733
|
} catch (error45) {
|
|
13731
|
-
|
|
13732
|
-
|
|
13734
|
+
const errorMessage = error45 instanceof Error ? error45.message : String(error45);
|
|
13735
|
+
log("addMemory: error", { error: errorMessage });
|
|
13736
|
+
return { success: false, error: errorMessage };
|
|
13733
13737
|
}
|
|
13734
13738
|
}
|
|
13735
|
-
async
|
|
13739
|
+
async deleteMemory(memoryId) {
|
|
13740
|
+
log("deleteMemory: start", { memoryId });
|
|
13736
13741
|
try {
|
|
13737
|
-
|
|
13738
|
-
|
|
13739
|
-
|
|
13740
|
-
}), TIMEOUT_MS);
|
|
13742
|
+
await withTimeout(this.getClient().memories.delete(memoryId), TIMEOUT_MS);
|
|
13743
|
+
log("deleteMemory: success", { memoryId });
|
|
13744
|
+
return { success: true };
|
|
13741
13745
|
} catch (error45) {
|
|
13742
|
-
|
|
13743
|
-
|
|
13746
|
+
const errorMessage = error45 instanceof Error ? error45.message : String(error45);
|
|
13747
|
+
log("deleteMemory: error", { memoryId, error: errorMessage });
|
|
13748
|
+
return { success: false, error: errorMessage };
|
|
13744
13749
|
}
|
|
13745
13750
|
}
|
|
13746
13751
|
async listMemories(containerTag, limit = 20) {
|
|
@@ -13753,11 +13758,11 @@ class SupermemoryClient {
|
|
|
13753
13758
|
sort: "createdAt"
|
|
13754
13759
|
}), TIMEOUT_MS);
|
|
13755
13760
|
log("listMemories: success", { count: result.memories?.length || 0 });
|
|
13756
|
-
return result;
|
|
13761
|
+
return { success: true, ...result };
|
|
13757
13762
|
} catch (error45) {
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
return { memories: [], pagination: { currentPage: 1, totalItems: 0, totalPages: 0 } };
|
|
13763
|
+
const errorMessage = error45 instanceof Error ? error45.message : String(error45);
|
|
13764
|
+
log("listMemories: error", { error: errorMessage });
|
|
13765
|
+
return { success: false, error: errorMessage, memories: [], pagination: { currentPage: 1, totalItems: 0, totalPages: 0 } };
|
|
13761
13766
|
}
|
|
13762
13767
|
}
|
|
13763
13768
|
async ingestConversation(conversationId, messages, containerTags, metadata) {
|
|
@@ -13779,15 +13784,15 @@ class SupermemoryClient {
|
|
|
13779
13784
|
if (!response.ok) {
|
|
13780
13785
|
const errorText = await response.text();
|
|
13781
13786
|
log("ingestConversation: error response", { status: response.status, error: errorText });
|
|
13782
|
-
return
|
|
13787
|
+
return { success: false, error: `HTTP ${response.status}: ${errorText}` };
|
|
13783
13788
|
}
|
|
13784
13789
|
const result = await response.json();
|
|
13785
13790
|
log("ingestConversation: success", { conversationId, status: result.status });
|
|
13786
|
-
return result;
|
|
13791
|
+
return { success: true, ...result };
|
|
13787
13792
|
} catch (error45) {
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
return
|
|
13793
|
+
const errorMessage = error45 instanceof Error ? error45.message : String(error45);
|
|
13794
|
+
log("ingestConversation: error", { error: errorMessage });
|
|
13795
|
+
return { success: false, error: errorMessage };
|
|
13791
13796
|
}
|
|
13792
13797
|
}
|
|
13793
13798
|
}
|
|
@@ -14077,8 +14082,10 @@ function createCompactionHook(ctx, tags, options) {
|
|
|
14077
14082
|
try {
|
|
14078
14083
|
const result = await supermemoryClient.addMemory(`[Session Summary]
|
|
14079
14084
|
${summaryContent}`, tags.project, { type: "conversation" });
|
|
14080
|
-
if (result) {
|
|
14085
|
+
if (result.success) {
|
|
14081
14086
|
log("[compaction] summary saved as memory", { sessionID, memoryId: result.id });
|
|
14087
|
+
} else {
|
|
14088
|
+
log("[compaction] failed to save summary", { error: result.error });
|
|
14082
14089
|
}
|
|
14083
14090
|
} catch (err) {
|
|
14084
14091
|
log("[compaction] failed to save summary", { error: String(err) });
|
|
@@ -14331,20 +14338,23 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14331
14338
|
const isFirstMessage = !injectedSessions.has(input.sessionID);
|
|
14332
14339
|
if (isFirstMessage) {
|
|
14333
14340
|
injectedSessions.add(input.sessionID);
|
|
14334
|
-
const [
|
|
14341
|
+
const [profileResult, userMemoriesResult, projectMemoriesListResult] = await Promise.all([
|
|
14335
14342
|
supermemoryClient.getProfile(tags.user, userMessage),
|
|
14336
14343
|
supermemoryClient.searchMemories(userMessage, tags.user),
|
|
14337
14344
|
supermemoryClient.listMemories(tags.project, CONFIG.maxProjectMemories)
|
|
14338
14345
|
]);
|
|
14346
|
+
const profile = profileResult.success ? profileResult : null;
|
|
14347
|
+
const userMemories = userMemoriesResult.success ? userMemoriesResult : { results: [] };
|
|
14348
|
+
const projectMemoriesList = projectMemoriesListResult.success ? projectMemoriesListResult : { memories: [] };
|
|
14339
14349
|
const projectMemories = {
|
|
14340
|
-
results: (projectMemoriesList
|
|
14350
|
+
results: (projectMemoriesList.memories || []).map((m) => ({
|
|
14341
14351
|
id: m.id,
|
|
14342
14352
|
memory: m.summary,
|
|
14343
14353
|
similarity: 1,
|
|
14344
14354
|
title: m.title,
|
|
14345
14355
|
metadata: m.metadata
|
|
14346
14356
|
})),
|
|
14347
|
-
total: projectMemoriesList
|
|
14357
|
+
total: projectMemoriesList.memories?.length || 0,
|
|
14348
14358
|
timing: 0
|
|
14349
14359
|
};
|
|
14350
14360
|
const memoryContext = formatContextForPrompt(profile, userMemories, projectMemories);
|
|
@@ -14460,10 +14470,10 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14460
14470
|
const scope = args.scope || "project";
|
|
14461
14471
|
const containerTag = scope === "user" ? tags.user : tags.project;
|
|
14462
14472
|
const result = await supermemoryClient.addMemory(sanitizedContent, containerTag, { type: args.type });
|
|
14463
|
-
if (!result) {
|
|
14473
|
+
if (!result.success) {
|
|
14464
14474
|
return JSON.stringify({
|
|
14465
14475
|
success: false,
|
|
14466
|
-
error: "Failed to add memory"
|
|
14476
|
+
error: result.error || "Failed to add memory"
|
|
14467
14477
|
});
|
|
14468
14478
|
}
|
|
14469
14479
|
return JSON.stringify({
|
|
@@ -14483,23 +14493,41 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14483
14493
|
}
|
|
14484
14494
|
const scope = args.scope;
|
|
14485
14495
|
if (scope === "user") {
|
|
14486
|
-
const
|
|
14487
|
-
|
|
14496
|
+
const result = await supermemoryClient.searchMemories(args.query, tags.user);
|
|
14497
|
+
if (!result.success) {
|
|
14498
|
+
return JSON.stringify({
|
|
14499
|
+
success: false,
|
|
14500
|
+
error: result.error || "Failed to search memories"
|
|
14501
|
+
});
|
|
14502
|
+
}
|
|
14503
|
+
return formatSearchResults(args.query, scope, result, args.limit);
|
|
14488
14504
|
}
|
|
14489
14505
|
if (scope === "project") {
|
|
14490
|
-
const
|
|
14491
|
-
|
|
14506
|
+
const result = await supermemoryClient.searchMemories(args.query, tags.project);
|
|
14507
|
+
if (!result.success) {
|
|
14508
|
+
return JSON.stringify({
|
|
14509
|
+
success: false,
|
|
14510
|
+
error: result.error || "Failed to search memories"
|
|
14511
|
+
});
|
|
14512
|
+
}
|
|
14513
|
+
return formatSearchResults(args.query, scope, result, args.limit);
|
|
14492
14514
|
}
|
|
14493
|
-
const [
|
|
14515
|
+
const [userResult, projectResult] = await Promise.all([
|
|
14494
14516
|
supermemoryClient.searchMemories(args.query, tags.user),
|
|
14495
14517
|
supermemoryClient.searchMemories(args.query, tags.project)
|
|
14496
14518
|
]);
|
|
14519
|
+
if (!userResult.success || !projectResult.success) {
|
|
14520
|
+
return JSON.stringify({
|
|
14521
|
+
success: false,
|
|
14522
|
+
error: userResult.error || projectResult.error || "Failed to search memories"
|
|
14523
|
+
});
|
|
14524
|
+
}
|
|
14497
14525
|
const combined = [
|
|
14498
|
-
...(
|
|
14526
|
+
...(userResult.results || []).map((r) => ({
|
|
14499
14527
|
...r,
|
|
14500
14528
|
scope: "user"
|
|
14501
14529
|
})),
|
|
14502
|
-
...(
|
|
14530
|
+
...(projectResult.results || []).map((r) => ({
|
|
14503
14531
|
...r,
|
|
14504
14532
|
scope: "project"
|
|
14505
14533
|
}))
|
|
@@ -14517,18 +14545,18 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14517
14545
|
});
|
|
14518
14546
|
}
|
|
14519
14547
|
case "profile": {
|
|
14520
|
-
const
|
|
14521
|
-
if (!
|
|
14548
|
+
const result = await supermemoryClient.getProfile(tags.user, args.query);
|
|
14549
|
+
if (!result.success) {
|
|
14522
14550
|
return JSON.stringify({
|
|
14523
14551
|
success: false,
|
|
14524
|
-
error: "Failed to fetch profile"
|
|
14552
|
+
error: result.error || "Failed to fetch profile"
|
|
14525
14553
|
});
|
|
14526
14554
|
}
|
|
14527
14555
|
return JSON.stringify({
|
|
14528
14556
|
success: true,
|
|
14529
14557
|
profile: {
|
|
14530
|
-
static:
|
|
14531
|
-
dynamic:
|
|
14558
|
+
static: result.profile?.static || [],
|
|
14559
|
+
dynamic: result.profile?.dynamic || []
|
|
14532
14560
|
}
|
|
14533
14561
|
});
|
|
14534
14562
|
}
|
|
@@ -14537,6 +14565,12 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14537
14565
|
const limit = args.limit || 20;
|
|
14538
14566
|
const containerTag = scope === "user" ? tags.user : tags.project;
|
|
14539
14567
|
const result = await supermemoryClient.listMemories(containerTag, limit);
|
|
14568
|
+
if (!result.success) {
|
|
14569
|
+
return JSON.stringify({
|
|
14570
|
+
success: false,
|
|
14571
|
+
error: result.error || "Failed to list memories"
|
|
14572
|
+
});
|
|
14573
|
+
}
|
|
14540
14574
|
const memories = result.memories || [];
|
|
14541
14575
|
return JSON.stringify({
|
|
14542
14576
|
success: true,
|
|
@@ -14558,12 +14592,11 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14558
14592
|
});
|
|
14559
14593
|
}
|
|
14560
14594
|
const scope = args.scope || "project";
|
|
14561
|
-
const
|
|
14562
|
-
|
|
14563
|
-
if (!result) {
|
|
14595
|
+
const result = await supermemoryClient.deleteMemory(args.memoryId);
|
|
14596
|
+
if (!result.success) {
|
|
14564
14597
|
return JSON.stringify({
|
|
14565
14598
|
success: false,
|
|
14566
|
-
error: "Failed to
|
|
14599
|
+
error: result.error || "Failed to delete memory"
|
|
14567
14600
|
});
|
|
14568
14601
|
}
|
|
14569
14602
|
return JSON.stringify({
|
|
@@ -1,18 +1,76 @@
|
|
|
1
1
|
import Supermemory from "supermemory";
|
|
2
|
-
import type { MemoryType, ConversationMessage
|
|
2
|
+
import type { MemoryType, ConversationMessage } from "../types/index.js";
|
|
3
3
|
export declare class SupermemoryClient {
|
|
4
4
|
private client;
|
|
5
5
|
private getClient;
|
|
6
|
-
searchMemories(query: string, containerTag: string): Promise<
|
|
7
|
-
|
|
6
|
+
searchMemories(query: string, containerTag: string): Promise<{
|
|
7
|
+
results: Array<Supermemory.Search.SearchMemoriesResponse.Result>;
|
|
8
|
+
timing: number;
|
|
9
|
+
total: number;
|
|
10
|
+
success: true;
|
|
11
|
+
error?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
success: false;
|
|
14
|
+
error: string;
|
|
15
|
+
results: never[];
|
|
16
|
+
total: number;
|
|
17
|
+
timing: number;
|
|
18
|
+
}>;
|
|
19
|
+
getProfile(containerTag: string, query?: string): Promise<{
|
|
20
|
+
profile: Supermemory.ProfileResponse.Profile;
|
|
21
|
+
searchResults?: Supermemory.ProfileResponse.SearchResults;
|
|
22
|
+
success: true;
|
|
23
|
+
error?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
success: false;
|
|
26
|
+
error: string;
|
|
27
|
+
profile: null;
|
|
28
|
+
}>;
|
|
8
29
|
addMemory(content: string, containerTag: string, metadata?: {
|
|
9
30
|
type?: MemoryType;
|
|
10
31
|
tool?: string;
|
|
11
32
|
[key: string]: unknown;
|
|
12
|
-
}): Promise<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
33
|
+
}): Promise<{
|
|
34
|
+
id: string;
|
|
35
|
+
status: string;
|
|
36
|
+
success: true;
|
|
37
|
+
error?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
success: false;
|
|
40
|
+
error: string;
|
|
41
|
+
}>;
|
|
42
|
+
deleteMemory(memoryId: string): Promise<{
|
|
43
|
+
success: boolean;
|
|
44
|
+
error?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
success: boolean;
|
|
47
|
+
error: string;
|
|
48
|
+
}>;
|
|
49
|
+
listMemories(containerTag: string, limit?: number): Promise<{
|
|
50
|
+
memories: Array<Supermemory.Memories.MemoryListResponse.Memory>;
|
|
51
|
+
pagination: Supermemory.Memories.MemoryListResponse.Pagination;
|
|
52
|
+
success: true;
|
|
53
|
+
error?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
success: false;
|
|
56
|
+
error: string;
|
|
57
|
+
memories: never[];
|
|
58
|
+
pagination: {
|
|
59
|
+
currentPage: number;
|
|
60
|
+
totalItems: number;
|
|
61
|
+
totalPages: number;
|
|
62
|
+
};
|
|
63
|
+
}>;
|
|
64
|
+
ingestConversation(conversationId: string, messages: ConversationMessage[], containerTags: string[], metadata?: Record<string, string | number | boolean>): Promise<{
|
|
65
|
+
success: false;
|
|
66
|
+
error: string;
|
|
67
|
+
} | {
|
|
68
|
+
id: string;
|
|
69
|
+
conversationId: string;
|
|
70
|
+
status: string;
|
|
71
|
+
success: true;
|
|
72
|
+
error?: undefined;
|
|
73
|
+
}>;
|
|
16
74
|
}
|
|
17
75
|
export declare const supermemoryClient: SupermemoryClient;
|
|
18
76
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -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,
|
|
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,EAEpB,MAAM,mBAAmB,CAAC;AAe3B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,SAAS;IAcX,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MA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