opencode-supermemory 2.0.5 → 2.0.6
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/dist/index.js
CHANGED
|
@@ -13909,7 +13909,8 @@ class SupermemoryClient {
|
|
|
13909
13909
|
containerTags: [containerTag],
|
|
13910
13910
|
limit,
|
|
13911
13911
|
order: "desc",
|
|
13912
|
-
sort: "createdAt"
|
|
13912
|
+
sort: "createdAt",
|
|
13913
|
+
includeContent: true
|
|
13913
13914
|
}), TIMEOUT_MS);
|
|
13914
13915
|
log("listMemories: success", { count: result.memories?.length || 0 });
|
|
13915
13916
|
return { success: true, ...result };
|
|
@@ -13983,6 +13984,17 @@ ${transcript}`;
|
|
|
13983
13984
|
var supermemoryClient = new SupermemoryClient;
|
|
13984
13985
|
|
|
13985
13986
|
// src/services/context.ts
|
|
13987
|
+
function extractFactText(fact) {
|
|
13988
|
+
if (typeof fact === "string")
|
|
13989
|
+
return fact;
|
|
13990
|
+
if (fact != null && typeof fact === "object") {
|
|
13991
|
+
const content = fact.content;
|
|
13992
|
+
if (typeof content === "string")
|
|
13993
|
+
return content;
|
|
13994
|
+
return JSON.stringify(fact);
|
|
13995
|
+
}
|
|
13996
|
+
return String(fact ?? "");
|
|
13997
|
+
}
|
|
13986
13998
|
function formatContextForPrompt(profile, userMemories, projectMemories) {
|
|
13987
13999
|
const parts = ["[SUPERMEMORY]"];
|
|
13988
14000
|
if (CONFIG.injectProfile && profile?.profile) {
|
|
@@ -13991,14 +14003,16 @@ function formatContextForPrompt(profile, userMemories, projectMemories) {
|
|
|
13991
14003
|
parts.push(`
|
|
13992
14004
|
User Profile:`);
|
|
13993
14005
|
staticFacts.slice(0, CONFIG.maxProfileItems).forEach((fact) => {
|
|
13994
|
-
|
|
14006
|
+
const text = extractFactText(fact);
|
|
14007
|
+
parts.push(`- ${text}`);
|
|
13995
14008
|
});
|
|
13996
14009
|
}
|
|
13997
14010
|
if (dynamicFacts.length > 0) {
|
|
13998
14011
|
parts.push(`
|
|
13999
14012
|
Recent Context:`);
|
|
14000
14013
|
dynamicFacts.slice(0, CONFIG.maxProfileItems).forEach((fact) => {
|
|
14001
|
-
|
|
14014
|
+
const text = extractFactText(fact);
|
|
14015
|
+
parts.push(`- ${text}`);
|
|
14002
14016
|
});
|
|
14003
14017
|
}
|
|
14004
14018
|
}
|
|
@@ -14007,7 +14021,7 @@ Recent Context:`);
|
|
|
14007
14021
|
parts.push(`
|
|
14008
14022
|
Project Knowledge:`);
|
|
14009
14023
|
projectResults.forEach((mem) => {
|
|
14010
|
-
const similarity = Math.round(mem.similarity * 100);
|
|
14024
|
+
const similarity = Math.round((mem.similarity ?? 0) * 100);
|
|
14011
14025
|
const content = mem.memory || mem.chunk || "";
|
|
14012
14026
|
parts.push(`- [${similarity}%] ${content}`);
|
|
14013
14027
|
});
|
|
@@ -14017,7 +14031,7 @@ Project Knowledge:`);
|
|
|
14017
14031
|
parts.push(`
|
|
14018
14032
|
Relevant Memories:`);
|
|
14019
14033
|
userResults.forEach((mem) => {
|
|
14020
|
-
const similarity = Math.round(mem.similarity * 100);
|
|
14034
|
+
const similarity = Math.round((mem.similarity ?? 0) * 100);
|
|
14021
14035
|
const content = mem.memory || mem.chunk || "";
|
|
14022
14036
|
parts.push(`- [${similarity}%] ${content}`);
|
|
14023
14037
|
});
|
|
@@ -14545,7 +14559,7 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14545
14559
|
if (detectMemoryKeyword(userMessage)) {
|
|
14546
14560
|
log("chat.message: memory keyword detected");
|
|
14547
14561
|
const nudgePart = {
|
|
14548
|
-
id: `
|
|
14562
|
+
id: `prt_supermemory-nudge-${Date.now()}`,
|
|
14549
14563
|
sessionID: input.sessionID,
|
|
14550
14564
|
messageID: output.message.id,
|
|
14551
14565
|
type: "text",
|
|
@@ -14568,7 +14582,7 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14568
14582
|
const projectMemories = {
|
|
14569
14583
|
results: (projectMemoriesList.memories || []).map((m) => ({
|
|
14570
14584
|
id: m.id,
|
|
14571
|
-
memory: m.summary,
|
|
14585
|
+
memory: m.summary || m.content || m.title || "",
|
|
14572
14586
|
similarity: 1,
|
|
14573
14587
|
title: m.title,
|
|
14574
14588
|
metadata: m.metadata
|
|
@@ -14579,7 +14593,7 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14579
14593
|
const memoryContext = formatContextForPrompt(profile, userMemories, projectMemories);
|
|
14580
14594
|
if (memoryContext) {
|
|
14581
14595
|
const contextPart = {
|
|
14582
|
-
id: `
|
|
14596
|
+
id: `prt_supermemory-context-${Date.now()}`,
|
|
14583
14597
|
sessionID: input.sessionID,
|
|
14584
14598
|
messageID: output.message.id,
|
|
14585
14599
|
type: "text",
|
|
@@ -14750,7 +14764,7 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14750
14764
|
...r,
|
|
14751
14765
|
scope: "project"
|
|
14752
14766
|
}))
|
|
14753
|
-
].sort((a, b) => b.similarity - a.similarity);
|
|
14767
|
+
].sort((a, b) => (b.similarity ?? 0) - (a.similarity ?? 0));
|
|
14754
14768
|
return JSON.stringify({
|
|
14755
14769
|
success: true,
|
|
14756
14770
|
query: args.query,
|
|
@@ -14758,7 +14772,7 @@ var SupermemoryPlugin = async (ctx) => {
|
|
|
14758
14772
|
results: combined.slice(0, args.limit || 10).map((r) => ({
|
|
14759
14773
|
id: r.id,
|
|
14760
14774
|
content: r.memory || r.chunk,
|
|
14761
|
-
similarity: Math.round(r.similarity * 100),
|
|
14775
|
+
similarity: Math.round((r.similarity ?? 0) * 100),
|
|
14762
14776
|
scope: r.scope
|
|
14763
14777
|
}))
|
|
14764
14778
|
});
|
|
@@ -14855,7 +14869,7 @@ function formatSearchResults(query, scope, results, limit) {
|
|
|
14855
14869
|
results: memoryResults.slice(0, limit || 10).map((r) => ({
|
|
14856
14870
|
id: r.id,
|
|
14857
14871
|
content: r.memory || r.chunk,
|
|
14858
|
-
similarity: Math.round(r.similarity * 100)
|
|
14872
|
+
similarity: Math.round((r.similarity ?? 0) * 100)
|
|
14859
14873
|
}))
|
|
14860
14874
|
});
|
|
14861
14875
|
}
|
|
@@ -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,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;;;;;;;;;;;;;;;
|
|
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;;;;;;;;;;;;;;;IAsB7C,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":"context.d.ts","sourceRoot":"","sources":["../../src/services/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/services/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,UAAU,mBAAmB;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,uBAAuB;IAC/B,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAYD,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,eAAe,GAAG,IAAI,EAC/B,YAAY,EAAE,uBAAuB,EACrC,eAAe,EAAE,uBAAuB,GACvC,MAAM,CAgDR"}
|