@mysten-incubation/oc-memwal 0.0.1-dev.0
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/LICENSE +176 -0
- package/README.md +216 -0
- package/dist/capture.d.ts +25 -0
- package/dist/capture.d.ts.map +1 -0
- package/dist/capture.js +80 -0
- package/dist/capture.js.map +1 -0
- package/dist/cli/index.d.ts +10 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +18 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/search.d.ts +10 -0
- package/dist/cli/search.d.ts.map +1 -0
- package/dist/cli/search.js +32 -0
- package/dist/cli/search.js.map +1 -0
- package/dist/cli/stats.d.ts +10 -0
- package/dist/cli/stats.d.ts.map +1 -0
- package/dist/cli/stats.js +31 -0
- package/dist/cli/stats.js.map +1 -0
- package/dist/config.d.ts +40 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +107 -0
- package/dist/config.js.map +1 -0
- package/dist/format.d.ts +55 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +122 -0
- package/dist/format.js.map +1 -0
- package/dist/hooks/capture.d.ts +12 -0
- package/dist/hooks/capture.d.ts.map +1 -0
- package/dist/hooks/capture.js +49 -0
- package/dist/hooks/capture.js.map +1 -0
- package/dist/hooks/index.d.ts +11 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +16 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/recall.d.ts +12 -0
- package/dist/hooks/recall.d.ts.map +1 -0
- package/dist/hooks/recall.js +50 -0
- package/dist/hooks/recall.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/index.d.ts +12 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +15 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/search.d.ts +13 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +83 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/store.d.ts +12 -0
- package/dist/tools/store.d.ts.map +1 -0
- package/dist/tools/store.js +87 -0
- package/dist/tools/store.js.map +1 -0
- package/dist/types.d.ts +24 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/openclaw.plugin.json +101 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,yCAAyC;AACzC,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAGlF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-callable tools — require tools.allow config to be visible to the LLM.
|
|
3
|
+
*
|
|
4
|
+
* Tools accept an optional namespace parameter. The before_prompt_build hook
|
|
5
|
+
* injects the current agent's namespace into the system prompt, guiding the
|
|
6
|
+
* LLM to pass the correct namespace. Falls back to defaultNamespace if omitted.
|
|
7
|
+
*/
|
|
8
|
+
import { registerSearchTool } from "./search.js";
|
|
9
|
+
import { registerStoreTool } from "./store.js";
|
|
10
|
+
/** Register all agent-callable tools. */
|
|
11
|
+
export function registerTools(api, client, config) {
|
|
12
|
+
registerSearchTool(api, client, config);
|
|
13
|
+
registerStoreTool(api, client, config);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,yCAAyC;AACzC,MAAM,UAAU,aAAa,CAAC,GAAQ,EAAE,MAAc,EAAE,MAAoB;IAC1E,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* memory_search tool — semantic recall.
|
|
3
|
+
*
|
|
4
|
+
* Requires tools.allow config to be visible to the LLM.
|
|
5
|
+
* Accepts an optional namespace parameter; the before_prompt_build hook
|
|
6
|
+
* injects the current agent's namespace into the system prompt, guiding
|
|
7
|
+
* the LLM to pass the correct value.
|
|
8
|
+
*/
|
|
9
|
+
import type { MemWal } from "@mysten-incubation/memwal";
|
|
10
|
+
import type { PluginConfig } from "../types.js";
|
|
11
|
+
/** Register the memory_search agent tool. */
|
|
12
|
+
export declare function registerSearchTool(api: any, client: MemWal, config: PluginConfig): void;
|
|
13
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,6CAA6C;AAC7C,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAoFvF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* memory_search tool — semantic recall.
|
|
3
|
+
*
|
|
4
|
+
* Requires tools.allow config to be visible to the LLM.
|
|
5
|
+
* Accepts an optional namespace parameter; the before_prompt_build hook
|
|
6
|
+
* injects the current agent's namespace into the system prompt, guiding
|
|
7
|
+
* the LLM to pass the correct value.
|
|
8
|
+
*/
|
|
9
|
+
import { Type } from "@sinclair/typebox";
|
|
10
|
+
import { looksLikeInjection } from "../capture.js";
|
|
11
|
+
import { escapeForPrompt, toolError } from "../format.js";
|
|
12
|
+
/** Register the memory_search agent tool. */
|
|
13
|
+
export function registerSearchTool(api, client, config) {
|
|
14
|
+
api.registerTool({
|
|
15
|
+
name: "memory_search",
|
|
16
|
+
label: "Memory Search",
|
|
17
|
+
description: "Search long-term memory for relevant past information, facts, " +
|
|
18
|
+
"preferences, and decisions. Returns memories ranked by relevance. " +
|
|
19
|
+
"Pass the namespace parameter to scope the search to the current agent's memory.",
|
|
20
|
+
parameters: Type.Object({
|
|
21
|
+
query: Type.String({ description: "Search query" }),
|
|
22
|
+
limit: Type.Optional(Type.Number({ description: "Max results (default: 5)" })),
|
|
23
|
+
namespace: Type.Optional(Type.String({
|
|
24
|
+
description: "Memory namespace to search (use the namespace from system context)",
|
|
25
|
+
})),
|
|
26
|
+
}),
|
|
27
|
+
async execute(_id, params) {
|
|
28
|
+
const { query, limit = 5, namespace } = params;
|
|
29
|
+
// LLM may omit namespace (e.g. tools.allow set but hooks disabled) — fall back safely
|
|
30
|
+
const ns = namespace || config.defaultNamespace;
|
|
31
|
+
try {
|
|
32
|
+
const result = await client.recall(query, limit, ns);
|
|
33
|
+
if (!result.results?.length) {
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{ type: "text", text: "No relevant memories found." },
|
|
37
|
+
],
|
|
38
|
+
details: { count: 0, namespace: ns },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Filter out injection attempts and escape text before returning
|
|
42
|
+
// to the LLM — same protection as the recall hook path
|
|
43
|
+
const safe = result.results.filter((r) => !looksLikeInjection(r.text));
|
|
44
|
+
if (!safe.length) {
|
|
45
|
+
return {
|
|
46
|
+
content: [
|
|
47
|
+
{ type: "text", text: "No relevant memories found." },
|
|
48
|
+
],
|
|
49
|
+
details: { count: 0, namespace: ns },
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// MemWal returns L2 distance — convert to similarity % for readability
|
|
53
|
+
const formatted = safe
|
|
54
|
+
.map((r, i) => {
|
|
55
|
+
const relevance = Math.round((1 - r.distance) * 100);
|
|
56
|
+
return `${i + 1}. ${escapeForPrompt(r.text)} (${relevance}% relevance)`;
|
|
57
|
+
})
|
|
58
|
+
.join("\n");
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: "text",
|
|
63
|
+
text: `Found ${safe.length} memories:\n\n${formatted}`,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
details: {
|
|
67
|
+
count: safe.length,
|
|
68
|
+
namespace: ns,
|
|
69
|
+
memories: safe.map((r) => ({
|
|
70
|
+
text: r.text,
|
|
71
|
+
blob_id: r.blob_id,
|
|
72
|
+
relevance: Math.round((1 - r.distance) * 100) / 100,
|
|
73
|
+
})),
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
return toolError("Memory search failed", err);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
}, { name: "memory_search" });
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG1D,6CAA6C;AAC7C,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ACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,SAAS,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;KACF,EACD,EAAE,IAAI,EAAE,eAAe,EAAE,CAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* memory_store tool — explicit save.
|
|
3
|
+
*
|
|
4
|
+
* Uses analyze() instead of remember() so the server LLM extracts
|
|
5
|
+
* individual facts from the text, producing cleaner, more searchable
|
|
6
|
+
* memories (same approach as Mem0's memory_store).
|
|
7
|
+
*/
|
|
8
|
+
import type { MemWal } from "@mysten-incubation/memwal";
|
|
9
|
+
import type { PluginConfig } from "../types.js";
|
|
10
|
+
/** Register the memory_store agent tool. */
|
|
11
|
+
export declare function registerStoreTool(api: any, client: MemWal, config: PluginConfig): void;
|
|
12
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/tools/store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAoFtF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* memory_store tool — explicit save.
|
|
3
|
+
*
|
|
4
|
+
* Uses analyze() instead of remember() so the server LLM extracts
|
|
5
|
+
* individual facts from the text, producing cleaner, more searchable
|
|
6
|
+
* memories (same approach as Mem0's memory_store).
|
|
7
|
+
*/
|
|
8
|
+
import { Type } from "@sinclair/typebox";
|
|
9
|
+
import { looksLikeInjection } from "../capture.js";
|
|
10
|
+
import { toolError } from "../format.js";
|
|
11
|
+
/** Register the memory_store agent tool. */
|
|
12
|
+
export function registerStoreTool(api, client, config) {
|
|
13
|
+
api.registerTool({
|
|
14
|
+
name: "memory_store",
|
|
15
|
+
label: "Memory Store",
|
|
16
|
+
description: "Save important information to encrypted long-term memory. " +
|
|
17
|
+
"Use when the user asks to remember something or when you " +
|
|
18
|
+
"identify important facts worth preserving. " +
|
|
19
|
+
"Pass the namespace parameter to store in the current agent's memory.",
|
|
20
|
+
parameters: Type.Object({
|
|
21
|
+
text: Type.String({
|
|
22
|
+
description: "Information to store in memory",
|
|
23
|
+
}),
|
|
24
|
+
namespace: Type.Optional(Type.String({
|
|
25
|
+
description: "Memory namespace to store in (use the namespace from system context)",
|
|
26
|
+
})),
|
|
27
|
+
}),
|
|
28
|
+
async execute(_id, params) {
|
|
29
|
+
const { text, namespace } = params;
|
|
30
|
+
const ns = namespace || config.defaultNamespace;
|
|
31
|
+
// Defence in depth: reject injection on write, not just on read.
|
|
32
|
+
// The recall hook filters on retrieval, but polluted data could
|
|
33
|
+
// surface through other read paths (memory_search, future tools).
|
|
34
|
+
if (looksLikeInjection(text)) {
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: "text",
|
|
39
|
+
text: "Cannot store text containing disallowed patterns.",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
details: { error: "injection_rejected" },
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (!text || text.trim().length < 3) {
|
|
46
|
+
return {
|
|
47
|
+
content: [
|
|
48
|
+
{
|
|
49
|
+
type: "text",
|
|
50
|
+
text: "Cannot store empty or very short text.",
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
details: { error: "text_too_short" },
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const result = await client.analyze(text.trim(), ns);
|
|
58
|
+
const factCount = result.facts?.length ?? 0;
|
|
59
|
+
// Show first 3 extracted facts as confirmation, or raw text truncation as fallback
|
|
60
|
+
const preview = result.facts
|
|
61
|
+
?.map((f) => f.text)
|
|
62
|
+
.slice(0, 3)
|
|
63
|
+
.join("; ") ?? text.slice(0, 100);
|
|
64
|
+
return {
|
|
65
|
+
content: [
|
|
66
|
+
{
|
|
67
|
+
type: "text",
|
|
68
|
+
text: factCount > 0
|
|
69
|
+
? `Stored ${factCount} fact${factCount === 1 ? "" : "s"}: ${preview}`
|
|
70
|
+
: `No memorable facts extracted from the input.`,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
details: {
|
|
74
|
+
action: "created",
|
|
75
|
+
namespace: ns,
|
|
76
|
+
factCount,
|
|
77
|
+
facts: result.facts,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
return toolError("Failed to store memory", err);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
}, { name: "memory_store" });
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/tools/store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,4CAA4C;AAC5C,MAAM,UAAU,iBAAiB,CAAC,GAAQ,EAAE,MAAc,EAAE,MAAoB;IAC9E,GAAG,CAAC,YAAY,CACd;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,cAAc;QACrB,WAAW,EACT,4DAA4D;YAC5D,2DAA2D;YAC3D,6CAA6C;YAC7C,sEAAsE;QACxE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,IAAI,C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KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;qBACX,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;gBAEpC,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,SAAS,GAAG,CAAC;gCACjB,CAAC,CAAC,UAAU,SAAS,QAAQ,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;gCACrE,CAAC,CAAC,8CAA8C;yBACnD;qBACF;oBACD,OAAO,EAAE;wBACP,MAAM,EAAE,SAAS;wBACjB,SAAS,EAAE,EAAE;wBACb,SAAS;wBACT,KAAK,EAAE,MAAM,CAAC,KAAK;qBACpB;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,SAAS,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;KACF,EACD,EAAE,IAAI,EAAE,cAAc,EAAE,CACzB,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the MemWal OpenClaw plugin.
|
|
3
|
+
*/
|
|
4
|
+
export interface PluginConfig {
|
|
5
|
+
/** Ed25519 private key (hex). */
|
|
6
|
+
privateKey: string;
|
|
7
|
+
/** MemWalAccount object ID on Sui. */
|
|
8
|
+
accountId: string;
|
|
9
|
+
/** MemWal server URL. */
|
|
10
|
+
serverUrl: string;
|
|
11
|
+
/** Default namespace for memory scoping (default: "default"). */
|
|
12
|
+
defaultNamespace: string;
|
|
13
|
+
/** Auto-inject relevant memories before each agent turn. */
|
|
14
|
+
autoRecall: boolean;
|
|
15
|
+
/** Auto-extract and store facts after each agent turn. */
|
|
16
|
+
autoCapture: boolean;
|
|
17
|
+
/** Max memories to inject per auto-recall. */
|
|
18
|
+
maxRecallResults: number;
|
|
19
|
+
/** Min relevance threshold (0-1) for auto-recall filtering. */
|
|
20
|
+
minRelevance: number;
|
|
21
|
+
/** Number of recent messages to send for auto-capture. */
|
|
22
|
+
captureMaxMessages: number;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,gBAAgB,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,UAAU,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,WAAW,EAAE,OAAO,CAAC;IACrB,8CAA8C;IAC9C,gBAAgB,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "memory-memwal",
|
|
3
|
+
"kind": "memory",
|
|
4
|
+
"name": "Memory (MemWal)",
|
|
5
|
+
"description": "Encrypted, decentralized long-term memory via MemWal + Walrus",
|
|
6
|
+
"configSchema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"privateKey": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Ed25519 private key (hex). Supports ${ENV_VAR}."
|
|
13
|
+
},
|
|
14
|
+
"accountId": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "MemWalAccount object ID on Sui (0x...)"
|
|
17
|
+
},
|
|
18
|
+
"serverUrl": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "MemWal server URL"
|
|
21
|
+
},
|
|
22
|
+
"defaultNamespace": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Default namespace for memory scoping (default: 'default')"
|
|
25
|
+
},
|
|
26
|
+
"autoRecall": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"description": "Auto-inject relevant memories before each turn"
|
|
29
|
+
},
|
|
30
|
+
"autoCapture": {
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"description": "Auto-extract and store facts after each turn"
|
|
33
|
+
},
|
|
34
|
+
"maxRecallResults": {
|
|
35
|
+
"type": "number",
|
|
36
|
+
"minimum": 1,
|
|
37
|
+
"maximum": 20,
|
|
38
|
+
"description": "Max memories per auto-recall"
|
|
39
|
+
},
|
|
40
|
+
"minRelevance": {
|
|
41
|
+
"type": "number",
|
|
42
|
+
"minimum": 0,
|
|
43
|
+
"maximum": 1,
|
|
44
|
+
"description": "Min relevance threshold for auto-recall"
|
|
45
|
+
},
|
|
46
|
+
"captureMaxMessages": {
|
|
47
|
+
"type": "number",
|
|
48
|
+
"minimum": 1,
|
|
49
|
+
"maximum": 50,
|
|
50
|
+
"description": "Recent messages window for auto-capture"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"required": ["privateKey", "accountId", "serverUrl"]
|
|
54
|
+
},
|
|
55
|
+
"uiHints": {
|
|
56
|
+
"privateKey": {
|
|
57
|
+
"label": "Ed25519 Private Key",
|
|
58
|
+
"sensitive": true,
|
|
59
|
+
"placeholder": "64-character hex string or ${ENV_VAR}",
|
|
60
|
+
"help": "Get from app.memwal.com. Supports ${ENV_VAR} syntax."
|
|
61
|
+
},
|
|
62
|
+
"accountId": {
|
|
63
|
+
"label": "MemWalAccount ID",
|
|
64
|
+
"placeholder": "0x3247e3da...",
|
|
65
|
+
"help": "MemWalAccount object ID on Sui. Get from app.memwal.com."
|
|
66
|
+
},
|
|
67
|
+
"serverUrl": {
|
|
68
|
+
"label": "MemWal Server URL",
|
|
69
|
+
"placeholder": "https://relayer.dev.memwal.ai"
|
|
70
|
+
},
|
|
71
|
+
"defaultNamespace": {
|
|
72
|
+
"label": "Default Namespace",
|
|
73
|
+
"placeholder": "default",
|
|
74
|
+
"help": "Memory scope for the main agent. Other agents auto-scope by name.",
|
|
75
|
+
"advanced": true
|
|
76
|
+
},
|
|
77
|
+
"autoRecall": {
|
|
78
|
+
"label": "Auto-Recall",
|
|
79
|
+
"help": "Inject relevant memories before each turn"
|
|
80
|
+
},
|
|
81
|
+
"autoCapture": {
|
|
82
|
+
"label": "Auto-Capture",
|
|
83
|
+
"help": "Extract and store facts after each turn"
|
|
84
|
+
},
|
|
85
|
+
"maxRecallResults": {
|
|
86
|
+
"label": "Max Recall Results",
|
|
87
|
+
"placeholder": "5",
|
|
88
|
+
"advanced": true
|
|
89
|
+
},
|
|
90
|
+
"minRelevance": {
|
|
91
|
+
"label": "Min Relevance",
|
|
92
|
+
"placeholder": "0.3",
|
|
93
|
+
"advanced": true
|
|
94
|
+
},
|
|
95
|
+
"captureMaxMessages": {
|
|
96
|
+
"label": "Capture Window",
|
|
97
|
+
"placeholder": "10",
|
|
98
|
+
"advanced": true
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mysten-incubation/oc-memwal",
|
|
3
|
+
"version": "0.0.1-dev.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "NemoClaw/OpenClaw memory plugin — encrypted, decentralized long-term memory via MemWal + Walrus",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"openclaw.plugin.json",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20.0.0"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@mysten-incubation/memwal": "^0.0.1",
|
|
25
|
+
"@sinclair/typebox": "0.34.48",
|
|
26
|
+
"zod": "^4.3.6"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^22.0.0",
|
|
30
|
+
"typescript": "^5.7.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"openclaw": ">=2026.3.11"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"openclaw": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"openclaw": {
|
|
41
|
+
"extensions": [
|
|
42
|
+
"./dist/index.js"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc",
|
|
47
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\""
|
|
48
|
+
}
|
|
49
|
+
}
|