@mysten-incubation/oc-memwal 0.0.4 → 0.0.5-dev.1

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 ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute
108
+ must include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  </p>
6
6
 
7
7
  <p align="center">
8
- <a href="https://docs.memwal.ai/openclaw/overview"><strong>Documentation</strong></a> ·
8
+ <a href="https://docs.wal.app/walrus-memory/openclaw/overview"><strong>Documentation</strong></a> ·
9
9
  <a href="#quick-start"><strong>Quick Start</strong></a> ·
10
10
  <a href="#verify"><strong>Verify</strong></a> ·
11
11
  <a href="#how-it-works"><strong>How It Works</strong></a>
@@ -44,14 +44,14 @@ The plugin needs three values:
44
44
  | **Account ID** | Your Walrus Memory account object ID on Sui (`0x...`) |
45
45
  | **Relayer URL** | The Walrus Memory relayer endpoint that handles search, storage, and encryption |
46
46
 
47
- Get your delegate key and account ID from the [Walrus Memory dashboard](https://memwal.ai), or see the [Quick Start guide](https://docs.memwal.ai/getting-started/quick-start) for detailed setup.
47
+ Get your delegate key and account ID from the [Walrus Memory dashboard](https://memory.walrus.xyz), or see the [Quick Start guide](https://docs.wal.app/walrus-memory/getting-started/quick-start) for detailed setup.
48
48
 
49
- For the relayer, use a managed endpoint or [self-host your own](https://docs.memwal.ai/relayer/self-hosting):
49
+ For the relayer, use a managed endpoint or [self-host your own](https://docs.wal.app/walrus-memory/relayer/self-hosting):
50
50
 
51
51
  | Environment | Relayer URL |
52
52
  |-------------|-------------|
53
- | **Production** (mainnet) | `https://relayer.memwal.ai` |
54
- | **Development** (testnet) | `https://relayer.dev.memwal.ai` |
53
+ | **Production** (mainnet) | `https://relayer.memory.walrus.xyz` |
54
+ | **Staging** (testnet) | `https://relayer-staging.memory.walrus.xyz` |
55
55
 
56
56
  ## Quick Start
57
57
 
@@ -84,7 +84,7 @@ Add the plugin config to `~/.openclaw/openclaw.json`:
84
84
  "config": {
85
85
  "privateKey": "${MEMWAL_PRIVATE_KEY}", // References the env var
86
86
  "accountId": "0x3247e3da...", // Your account ID from the dashboard
87
- "serverUrl": "https://relayer.dev.memwal.ai" // Or your self-hosted relayer
87
+ "serverUrl": "https://relayer-staging.memory.walrus.xyz" // Or your self-hosted relayer
88
88
  }
89
89
  }
90
90
  }
package/dist/capture.d.ts CHANGED
@@ -1,25 +1,11 @@
1
1
  /**
2
2
  * Capture filtering — determines whether a conversation turn
3
3
  * is worth sending to analyze() for fact extraction.
4
- *
5
- * Prevents wasted server calls on trivial turns like "ok", "thanks", emoji.
6
- * Based on patterns from LanceDB's shouldCapture() implementation.
7
- */
8
- /**
9
- * Check if text looks like a prompt injection attempt.
10
- * Used by both capture (reject on store) and recall (reject on inject).
11
4
  */
5
+ /** Normalize text by stripping invisible/format characters, decomposing Unicode, and mapping confusable scripts. */
6
+ export declare function normalizeForInjectionCheck(text: string): string;
7
+ /** Check if text matches known prompt injection patterns. */
12
8
  export declare function looksLikeInjection(text: string): boolean;
13
- /**
14
- * Determine whether a conversation text is worth capturing.
15
- *
16
- * Applies a multi-step filter chain: rejects short text, filler responses,
17
- * XML/system content, emoji-heavy messages, and injection attempts.
18
- * Accepts immediately if a trigger pattern matches (e.g. "remember", "prefer").
19
- * Falls through to accept if text is long enough for the server LLM to evaluate.
20
- *
21
- * @param text - Raw message text (user or assistant)
22
- * @returns `true` if the text likely contains memorable facts
23
- */
9
+ /** Determine whether a conversation turn is worth capturing. */
24
10
  export declare function shouldCapture(text: string): boolean;
25
11
  //# sourceMappingURL=capture.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAsBnD"}
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkDH,oHAAoH;AACpH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW/D;AAED,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKxD;AAED,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYnD"}
package/dist/capture.js CHANGED
@@ -1,76 +1,86 @@
1
1
  /**
2
2
  * Capture filtering — determines whether a conversation turn
3
3
  * is worth sending to analyze() for fact extraction.
4
- *
5
- * Prevents wasted server calls on trivial turns like "ok", "thanks", emoji.
6
- * Based on patterns from LanceDB's shouldCapture() implementation.
7
4
  */
8
5
  import { MIN_CAPTURE_LENGTH, MAX_EMOJI_COUNT } from "./constants.js";
9
6
  /** Filler patterns — exact-match trivial responses. */
10
7
  const FILLER_PATTERN = /^(ok|okay|sure|thanks|thank you|thx|yes|yep|yeah|no|nope|nah|got it|hmm|hm|ah|oh|lol|haha|nice|cool|great|right|alright|fine|k|kk)\s*[.!?]*$/i;
11
- /** Prompt injection patterns never capture these. */
8
+ /** Visual lookalike character map (Cyrillic, Greek, Latin symbols). */
9
+ const VISUAL_CONFUSABLES = {
10
+ "а": "a", "А": "a", "б": "b", "Б": "b", "в": "b", "В": "b", "ь": "b", "Ь": "b",
11
+ "с": "c", "С": "c", "д": "d", "Д": "d", "е": "e", "Е": "e", "ѐ": "e", "Ѐ": "e",
12
+ "ё": "e", "Ё": "e", "є": "e", "Є": "e", "і": "i", "І": "i", "ї": "i", "Ї": "i",
13
+ "ј": "j", "Ј": "j", "к": "k", "К": "k", "л": "l", "Л": "l", "м": "m", "М": "m",
14
+ "н": "h", "Н": "h", "п": "n", "П": "n", "о": "o", "О": "o", "ѻ": "o", "Ѻ": "o",
15
+ "р": "p", "Р": "p", "ҏ": "p", "Ҏ": "p", "ѕ": "s", "Ѕ": "s", "т": "t", "Т": "t",
16
+ "и": "u", "И": "u", "й": "u", "Й": "u", "у": "y", "У": "y", "х": "x", "Х": "x",
17
+ "α": "a", "Α": "a", "β": "b", "Β": "b", "γ": "y", "Γ": "r", "δ": "d", "Δ": "d",
18
+ "ε": "e", "Ε": "e", "ζ": "z", "Ζ": "z", "η": "n", "Η": "h", "θ": "o", "Θ": "o",
19
+ "ι": "i", "Ι": "i", "κ": "k", "Κ": "k", "λ": "l", "Λ": "l", "μ": "u", "Μ": "m",
20
+ "ν": "v", "Ν": "n", "ξ": "x", "Ξ": "x", "ο": "o", "Ο": "o", "π": "n", "Π": "n",
21
+ "ρ": "p", "Ρ": "p", "σ": "o", "Σ": "e", "ς": "s", "τ": "t", "Τ": "t", "υ": "u",
22
+ "Υ": "y", "φ": "o", "Φ": "o", "χ": "x", "Χ": "x", "ψ": "y", "Ψ": "y", "ω": "w",
23
+ "Ω": "o", "ℓ": "l", "ø": "o", "Ø": "o", "đ": "d", "Đ": "d", "ħ": "h", "Ħ": "h",
24
+ "ł": "l", "Ł": "l", "ŋ": "n", "Ŋ": "n", "ŧ": "t", "Ŧ": "t",
25
+ };
26
+ /** Prompt injection patterns — never capture or recall these. */
12
27
  const INJECTION_PATTERNS = [
13
- /ignore (all|any|previous|above|prior) instructions/i,
14
- /do not follow (the )?(system|developer)/i,
15
- /system prompt/i,
16
- /<\s*(system|assistant|developer|tool|function)\b/i,
17
- /\b(run|execute|call|invoke)\b.{0,40}\b(tool|command)\b/i,
28
+ /\b(ign[o0a]re|disregard|override|f[o0]rget|bypass)\b[\s\S]{0,140}?\b(instruct\w*|instr\w{1,8}tions?|pr[o0]mpt|rules|c[o0]nstraints|guidelines|safety)\b/i,
29
+ /\b(ign[o0a]re|disregard|f[o0]rget|override)\b[\s\S]{0,80}?\b(everything|anything)\b[\s\S]{0,80}?\b(bef[o0]re|pri[o0]r|t[o0]ld|pr[o0]mpt)\b/i,
30
+ /\b(?:do\s+not|don\x27?t|st[o0]p)\s+f[o0]ll[o0]w(?:ing)?\b[\s\S]{0,80}?\b(?:system|devel[o0]per|safety|rules|instructions?|instr\w{1,8}tions?)\b/i,
31
+ /\b(?:new\s+instructions|system\s+override)\s*:\s*/i,
32
+ /\byou\s+are\s+now\s+(?:dan|unrestricted|jailbroken|unfiltered)\b/i,
33
+ /\bsystem\s+pr[o0]mpt\b/i,
34
+ /\breveal\s+(?:all\s+)?(?:your\s+)?(?:system\s+)?instructions?\b/i,
35
+ /<\s*\/?\s*(system|assistant|developer|tool|function|prompt)\b/i,
36
+ /\b(run|execute|call|invoke)\b.{0,40}\b(tool|command|shell|bash)\b/i,
18
37
  ];
19
- /** Memory trigger patterns — always capture if matched (whitelist boost). */
38
+ /** Memory trigger patterns — always capture if matched. */
20
39
  const TRIGGER_PATTERNS = [
21
40
  /remember|prefer|radši|zapamatuj/i,
22
41
  /i (like|prefer|hate|love|want|need|use|am|work)/i,
23
42
  /my\s+\w+\s+is|is\s+my/i,
24
43
  /always|never|important/i,
25
44
  /decided|will use|switched to/i,
26
- /\+\d{10,}/, // phone numbers
27
- /[\w.-]+@[\w.-]+\.\w+/, // email addresses
45
+ /\+\d{10,}/,
46
+ /[\w.-]+@[\w.-]+\.\w+/,
28
47
  ];
29
- // ============================================================================
30
- // Functions
31
- // ============================================================================
32
- /**
33
- * Check if text looks like a prompt injection attempt.
34
- * Used by both capture (reject on store) and recall (reject on inject).
35
- */
48
+ /** Normalize text by stripping invisible/format characters, decomposing Unicode, and mapping confusable scripts. */
49
+ export function normalizeForInjectionCheck(text) {
50
+ const noInvisible = text.replace(/[\p{Cf}\p{Cc}\p{Co}\p{Cs}]/gu, "");
51
+ const decomposed = noInvisible
52
+ .normalize("NFKD")
53
+ .replace(/[\p{Diacritic}\p{M}]/gu, "");
54
+ let mapped = "";
55
+ for (const char of decomposed) {
56
+ mapped += VISUAL_CONFUSABLES[char] ?? char;
57
+ }
58
+ return mapped.replace(/\s+/g, " ").trim();
59
+ }
60
+ /** Check if text matches known prompt injection patterns. */
36
61
  export function looksLikeInjection(text) {
37
- const normalized = text.replace(/\s+/g, " ").trim();
62
+ if (!text)
63
+ return false;
64
+ const normalized = normalizeForInjectionCheck(text);
38
65
  if (!normalized)
39
66
  return false;
40
67
  return INJECTION_PATTERNS.some((p) => p.test(normalized));
41
68
  }
42
- /**
43
- * Determine whether a conversation text is worth capturing.
44
- *
45
- * Applies a multi-step filter chain: rejects short text, filler responses,
46
- * XML/system content, emoji-heavy messages, and injection attempts.
47
- * Accepts immediately if a trigger pattern matches (e.g. "remember", "prefer").
48
- * Falls through to accept if text is long enough for the server LLM to evaluate.
49
- *
50
- * @param text - Raw message text (user or assistant)
51
- * @returns `true` if the text likely contains memorable facts
52
- */
69
+ /** Determine whether a conversation turn is worth capturing. */
53
70
  export function shouldCapture(text) {
54
- // Too short to contain useful facts
55
71
  if (text.length < MIN_CAPTURE_LENGTH)
56
72
  return false;
57
- // Pure filler response
58
73
  if (FILLER_PATTERN.test(text.trim()))
59
74
  return false;
60
- // System/XML content (likely injected context, not user speech)
61
75
  if (text.trim().startsWith("<") && text.includes("</"))
62
76
  return false;
63
- // Emoji-heavy (likely reactions, not factual content)
64
77
  const emojiCount = (text.match(/[\u{1F300}-\u{1F9FF}]/gu) || []).length;
65
78
  if (emojiCount > MAX_EMOJI_COUNT)
66
79
  return false;
67
- // Prompt injection attempt — never store
68
- if (INJECTION_PATTERNS.some((p) => p.test(text)))
80
+ if (looksLikeInjection(text))
69
81
  return false;
70
- // If it matches a trigger pattern, definitely capture
71
82
  if (TRIGGER_PATTERNS.some((p) => p.test(text)))
72
83
  return true;
73
- // Default: capture if it's long enough (the server LLM will decide what's worth keeping)
74
84
  return true;
75
85
  }
76
86
  //# sourceMappingURL=capture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capture.js","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAErE,uDAAuD;AACvD,MAAM,cAAc,GAAG,+IAA+I,CAAC;AAEvK,uDAAuD;AACvD,MAAM,kBAAkB,GAAG;IACzB,qDAAqD;IACrD,0CAA0C;IAC1C,gBAAgB;IAChB,mDAAmD;IACnD,yDAAyD;CAC1D,CAAC;AAEF,6EAA6E;AAC7E,MAAM,gBAAgB,GAAG;IACvB,kCAAkC;IAClC,kDAAkD;IAClD,wBAAwB;IACxB,yBAAyB;IACzB,+BAA+B;IAC/B,WAAW,EAAwB,gBAAgB;IACnD,sBAAsB,EAAa,kBAAkB;CACtD,CAAC;AAEF,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,kBAAkB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,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAE5D,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/config.d.ts CHANGED
@@ -1,40 +1,16 @@
1
1
  /**
2
2
  * Config parsing, validation, and namespace resolution.
3
- *
4
- * Uses Zod for schema validation — all config errors surface at startup
5
- * with clear messages instead of failing at runtime.
6
3
  */
7
4
  import type { PluginConfig } from "./types.js";
8
- /**
9
- * Parse and validate raw plugin config from openclaw.json.
10
- *
11
- * Resolves ${ENV_VAR} placeholders in string fields, then validates
12
- * the full config against the Zod schema. Throws with clear field-level
13
- * error messages on invalid config.
14
- *
15
- * @param raw - Raw config object from `api.pluginConfig`
16
- * @returns Validated config with all defaults applied
17
- * @throws {Error} If config is missing, or any field fails validation
18
- */
19
5
  export declare function parseConfig(raw: unknown): PluginConfig;
20
6
  export interface ResolvedAgent {
21
7
  namespace: string;
8
+ legacyNamespace?: string;
22
9
  agentName: string;
23
10
  }
24
- /**
25
- * Resolve agent name and namespace from OpenClaw's sessionKey.
26
- *
27
- * Parses agent name from format "agent:\<name\>:\<uuid\>".
28
- * Each agent gets its own namespace for memory isolation.
29
- * Falls back to defaultNamespace for main agent or unknown sessions.
30
- *
31
- * @param defaultNamespace - Fallback namespace (used for main agent)
32
- * @param sessionKey - OpenClaw session key, e.g. "agent:researcher:uuid-456"
33
- * @returns Resolved namespace and human-readable agent name
34
- */
11
+ /** Derive a collision-resistant namespace for an agent name. */
12
+ export declare function deriveAgentNamespace(rawName: string): string;
13
+ /** Resolve agent namespace and human-readable name from sessionKey. */
35
14
  export declare function resolveAgent(defaultNamespace: string, sessionKey?: string): ResolvedAgent;
36
- /**
37
- * Format key for safe logging (first 4 + last 4 chars).
38
- */
39
15
  export declare function keyPreview(key: string): string;
40
16
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAqD/C;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAkBtD;AAMD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,gBAAgB,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,aAAa,CAQzF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAqD/C,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAetD;AAMD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,gEAAgE;AAChE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgB5D;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,gBAAgB,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,aAAa,CAmBzF;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C"}
package/dist/config.js CHANGED
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * Config parsing, validation, and namespace resolution.
3
- *
4
- * Uses Zod for schema validation — all config errors surface at startup
5
- * with clear messages instead of failing at runtime.
6
3
  */
4
+ import { createHash } from "node:crypto";
7
5
  import { z } from "zod";
8
6
  // ============================================================================
9
7
  // Schema
@@ -18,7 +16,12 @@ const ConfigSchema = z.object({
18
16
  serverUrl: z.string()
19
17
  .min(1, "required")
20
18
  .url("must be a valid URL"),
21
- defaultNamespace: z.string().default("default"),
19
+ defaultNamespace: z.string()
20
+ .min(1, "must not be empty")
21
+ .refine((ns) => !/[\r\n"]/.test(ns), {
22
+ message: 'defaultNamespace must not contain quotes (") or newline characters',
23
+ })
24
+ .default("default"),
22
25
  autoRecall: z.boolean().default(true),
23
26
  autoCapture: z.boolean().default(true),
24
27
  maxRecallResults: z.number().min(1).max(20).default(5),
@@ -28,7 +31,6 @@ const ConfigSchema = z.object({
28
31
  // ============================================================================
29
32
  // Env Var Resolution
30
33
  // ============================================================================
31
- /** Replace ${ENV_VAR} placeholders with process.env values. */
32
34
  function resolveEnvVar(value) {
33
35
  return value.replace(/\$\{([^}]+)\}/g, (_, name) => {
34
36
  const v = process.env[name];
@@ -37,10 +39,6 @@ function resolveEnvVar(value) {
37
39
  return v;
38
40
  });
39
41
  }
40
- /**
41
- * Resolve ${ENV_VAR} placeholders in all string fields of a config object.
42
- * Non-string fields are passed through unchanged.
43
- */
44
42
  function resolveEnvVars(raw) {
45
43
  const resolved = {};
46
44
  for (const [key, value] of Object.entries(raw)) {
@@ -51,24 +49,11 @@ function resolveEnvVars(raw) {
51
49
  // ============================================================================
52
50
  // Config Parser
53
51
  // ============================================================================
54
- /**
55
- * Parse and validate raw plugin config from openclaw.json.
56
- *
57
- * Resolves ${ENV_VAR} placeholders in string fields, then validates
58
- * the full config against the Zod schema. Throws with clear field-level
59
- * error messages on invalid config.
60
- *
61
- * @param raw - Raw config object from `api.pluginConfig`
62
- * @returns Validated config with all defaults applied
63
- * @throws {Error} If config is missing, or any field fails validation
64
- */
65
52
  export function parseConfig(raw) {
66
53
  if (!raw || typeof raw !== "object") {
67
54
  throw new Error("memory-memwal: config is required");
68
55
  }
69
- // Resolve env vars before validation
70
56
  const resolved = resolveEnvVars(raw);
71
- // Validate with Zod — clear error messages per field
72
57
  const result = ConfigSchema.safeParse(resolved);
73
58
  if (!result.success) {
74
59
  const issues = result.error.issues
@@ -78,29 +63,40 @@ export function parseConfig(raw) {
78
63
  }
79
64
  return result.data;
80
65
  }
81
- /**
82
- * Resolve agent name and namespace from OpenClaw's sessionKey.
83
- *
84
- * Parses agent name from format "agent:\<name\>:\<uuid\>".
85
- * Each agent gets its own namespace for memory isolation.
86
- * Falls back to defaultNamespace for main agent or unknown sessions.
87
- *
88
- * @param defaultNamespace - Fallback namespace (used for main agent)
89
- * @param sessionKey - OpenClaw session key, e.g. "agent:researcher:uuid-456"
90
- * @returns Resolved namespace and human-readable agent name
91
- */
66
+ /** Derive a collision-resistant namespace for an agent name. */
67
+ export function deriveAgentNamespace(rawName) {
68
+ const normalized = rawName.normalize("NFKC").trim();
69
+ const lower = normalized.toLowerCase();
70
+ // Domain 1: Safe standard names (1-64 ASCII alphanumeric/hyphen/underscore)
71
+ if (/^[a-zA-Z0-9_-]{1,64}$/.test(normalized)) {
72
+ return lower;
73
+ }
74
+ // Domain 2: Unsafe names (hash length >= 68 chars prevents domain collision)
75
+ const slug = lower
76
+ .replace(/[^a-z0-9_-]+/g, "-")
77
+ .replace(/^-+|-+$/g, "")
78
+ .slice(0, 32);
79
+ const hash = createHash("sha256").update(lower).digest("hex");
80
+ return slug && slug !== "main" ? `_h_${slug}_${hash}` : `_h_agent_${hash}`;
81
+ }
82
+ /** Resolve agent namespace and human-readable name from sessionKey. */
92
83
  export function resolveAgent(defaultNamespace, sessionKey) {
93
84
  if (!sessionKey)
94
85
  return { namespace: defaultNamespace, agentName: "main" };
95
86
  const match = sessionKey.match(/^agent:([^:]+):/);
96
- const name = match?.[1];
97
- if (!name || name === "main")
87
+ const rawName = match?.[1];
88
+ if (!rawName || rawName === "main") {
89
+ return { namespace: defaultNamespace, agentName: "main" };
90
+ }
91
+ const trimmed = rawName.trim();
92
+ if (trimmed === "main" || trimmed.toLowerCase() === "main") {
98
93
  return { namespace: defaultNamespace, agentName: "main" };
99
- return { namespace: name, agentName: name };
94
+ }
95
+ const namespace = deriveAgentNamespace(rawName);
96
+ const legacyNamespace = rawName !== namespace && /^[a-zA-Z0-9_-]{1,64}$/.test(trimmed) ? rawName : undefined;
97
+ const agentName = trimmed.normalize("NFKC").slice(0, 64) || namespace;
98
+ return { namespace, legacyNamespace, agentName };
100
99
  }
101
- /**
102
- * Format key for safe logging (first 4 + last 4 chars).
103
- */
104
100
  export function keyPreview(key) {
105
101
  return key.length > 8 ? `${key.slice(0, 4)}...${key.slice(-4)}` : "****";
106
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;SACnB,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC;SAClB,KAAK,CAAC,mBAAmB,EAAE,kDAAkD,CAAC;IACjF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;SAClB,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC;SAClB,KAAK,CAAC,sBAAsB,EAAE,iCAAiC,CAAC;IACnE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;SAClB,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC;SAClB,GAAG,CAAC,qBAAqB,CAAC;IAC7B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;IAC/C,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACrC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACtC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,G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,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;AAC3E,CAAC"}
@@ -1,9 +1,5 @@
1
1
  /**
2
2
  * Auto-recall hook — before_prompt_build.
3
- *
4
- * Searches Walrus Memory for memories relevant to the user's prompt and injects
5
- * them into the LLM context. Also injects a namespace instruction so
6
- * tools scope to the correct agent's memory.
7
3
  */
8
4
  import type { MemWal } from "@mysten-incubation/memwal";
9
5
  import type { PluginConfig } from "../types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"recall.d.ts","sourceRoot":"","sources":["../../src/hooks/recall.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAwDvF"}
1
+ {"version":3,"file":"recall.d.ts","sourceRoot":"","sources":["../../src/hooks/recall.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA8EvF"}
@@ -1,9 +1,5 @@
1
1
  /**
2
2
  * Auto-recall hook — before_prompt_build.
3
- *
4
- * Searches Walrus Memory for memories relevant to the user's prompt and injects
5
- * them into the LLM context. Also injects a namespace instruction so
6
- * tools scope to the correct agent's memory.
7
3
  */
8
4
  import { resolveAgent } from "../config.js";
9
5
  import { looksLikeInjection } from "../capture.js";
@@ -12,28 +8,46 @@ import { MIN_PROMPT_LENGTH } from "../constants.js";
12
8
  /** Register the before_prompt_build hook for auto-recall. */
13
9
  export function registerRecallHook(api, client, config) {
14
10
  api.on("before_prompt_build", async (event, ctx) => {
15
- // Skip trivial prompts ("ok", "y") — not worth a server round-trip
16
11
  if (!event.prompt || event.prompt.length < MIN_PROMPT_LENGTH)
17
12
  return;
18
- const { namespace, agentName } = resolveAgent(config.defaultNamespace, ctx?.sessionKey);
19
- // The LLM doesn't know which agent it is. This instruction guides
20
- // memory_search/memory_store tool calls to the correct namespace.
21
- // Returned via appendSystemContext in ALL code paths (including errors)
22
- // so tools still scope correctly even when recall itself fails.
13
+ const { namespace, legacyNamespace, agentName } = resolveAgent(config.defaultNamespace, ctx?.sessionKey);
23
14
  const namespaceInstruction = `When using memory_search or memory_store tools, ` +
24
- `pass namespace="${namespace}" to scope operations to the current agent's memory.`;
15
+ `pass namespace=${JSON.stringify(namespace)} to scope operations to the current agent's memory.`;
25
16
  try {
26
- const result = await client.recall(event.prompt, config.maxRecallResults, namespace);
27
- if (!result.results?.length) {
17
+ const recallPromises = [
18
+ client.recall(event.prompt, config.maxRecallResults, namespace),
19
+ ];
20
+ if (legacyNamespace && legacyNamespace !== namespace) {
21
+ recallPromises.push(client.recall(event.prompt, config.maxRecallResults, legacyNamespace));
22
+ }
23
+ const resultsList = await Promise.allSettled(recallPromises);
24
+ const primaryResult = resultsList[0];
25
+ if (primaryResult?.status === "rejected") {
26
+ api.logger.warn(`memory-memwal: canonical recall failed: ${String(primaryResult.reason)}`);
27
+ }
28
+ const candidates = [];
29
+ const seen = new Set();
30
+ for (const res of resultsList) {
31
+ if (res.status === "fulfilled" && res.value?.results?.length) {
32
+ for (const item of res.value.results) {
33
+ const key = item.blob_id || item.text;
34
+ if (!seen.has(key)) {
35
+ seen.add(key);
36
+ candidates.push(item);
37
+ }
38
+ }
39
+ }
40
+ }
41
+ if (!candidates.length) {
28
42
  return { appendSystemContext: namespaceInstruction };
29
43
  }
30
- // Two filters: relevance threshold (drop noise) and injection
31
- // detection (drop memories containing prompt manipulation attempts)
32
- const relevant = result.results.filter((r) => (1 - r.distance) >= config.minRelevance &&
44
+ const filtered = candidates.filter((r) => (1 - r.distance) >= config.minRelevance &&
33
45
  !looksLikeInjection(r.text));
34
- if (!relevant.length) {
46
+ if (!filtered.length) {
35
47
  return { appendSystemContext: namespaceInstruction };
36
48
  }
49
+ filtered.sort((a, b) => a.distance - b.distance);
50
+ const relevant = filtered.slice(0, config.maxRecallResults);
37
51
  api.logger.info(`memory-memwal: auto-recall injected ${relevant.length} memories ` +
38
52
  `(agent: ${agentName}, namespace: ${namespace})`);
39
53
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"recall.js","sourceRoot":"","sources":["../../src/hooks/recall.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,6DAA6D;AAC7D,MAAM,UAAU,kBAAkB,CAAC,GAAQ,EAAE,MAAc,EAAE,MAAoB;IAC/E,GAAG,CAAC,EAAE,CAAC,qBAAqB,EAAE,KAAK,EAAE,KAAU,EAAE,GAAQ,EAAE,EAAE;QAC3D,mEAAmE;QACnE,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,iBAAiB;YAAE,OAAO;QAErE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,gBAA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I,CAAC,CAC9B,CAAC;YAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBACrB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC;YACvD,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAE5D,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,uCAAuC,QAAQ,CAAC,MAAM,YAAY;gBAClE,WAAW,SAAS,gBAAgB,SAAS,GAAG,CACjD,CAAC;YAEF,OAAO;gBACL,cAAc,EAAE,uBAAuB,CACrC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAC7C;gBACD,mBAAmB,EAAE,oBAAoB;aAC1C,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,sCAAsC,MAAM,CAAC,GAAG,CAAC,EAAE,CACpD,CAAC;YACF,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC;QACvD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysten-incubation/oc-memwal",
3
- "version": "0.0.4",
3
+ "version": "0.0.5-dev.1",
4
4
  "type": "module",
5
5
  "description": "NemoClaw/OpenClaw memory plugin — encrypted, decentralized long-term memory via Walrus Memory",
6
6
  "license": "Apache-2.0",
@@ -30,19 +30,13 @@
30
30
  "openclaw",
31
31
  "nemoclaw"
32
32
  ],
33
- "scripts": {
34
- "build": "tsc",
35
- "typecheck": "tsc --noEmit",
36
- "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
37
- "prepublishOnly": "npm run clean && npm run build"
38
- },
39
33
  "engines": {
40
34
  "node": ">=20.0.0"
41
35
  },
42
36
  "dependencies": {
43
- "@mysten-incubation/memwal": "workspace:*",
44
37
  "@sinclair/typebox": "0.34.48",
45
- "zod": "^3.23.0"
38
+ "zod": "^3.23.0",
39
+ "@mysten-incubation/memwal": "0.1.3"
46
40
  },
47
41
  "devDependencies": {
48
42
  "@types/node": "^22.0.0",
@@ -52,5 +46,11 @@
52
46
  "extensions": [
53
47
  "./dist/index.js"
54
48
  ]
49
+ },
50
+ "scripts": {
51
+ "build": "tsc",
52
+ "typecheck": "tsc --noEmit",
53
+ "test": "tsc && node --test \"test/**/*.test.mjs\"",
54
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\""
55
55
  }
56
- }
56
+ }