dsh-memsearch-community 0.3.3 → 0.3.4
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/lib/tree.js +14 -2
- package/package.json +1 -1
package/lib/tree.js
CHANGED
|
@@ -31,6 +31,18 @@ export function safeFileBase(title, fallback) {
|
|
|
31
31
|
return base.length > 80 ? base.slice(0, 80).trim() : base;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Escape timestamp-looking lines inside captured text.
|
|
36
|
+
*
|
|
37
|
+
* `appendTurn` separates turns with a line that starts with `[YYYY.MM.DD HH:MM]`.
|
|
38
|
+
* A reply that quotes such a line — an example, another archive, a log — would
|
|
39
|
+
* read as a turn boundary and split one exchange into several. Prefixing the
|
|
40
|
+
* line with a backslash keeps it visible but no longer a separator.
|
|
41
|
+
*/
|
|
42
|
+
export function defuseStamps(text) {
|
|
43
|
+
return String(text).replace(/^(\[\d{4}\.\d{2}\.\d{2} \d{2}:\d{2}\])/gm, "\\$1");
|
|
44
|
+
}
|
|
45
|
+
|
|
34
46
|
export class Archive {
|
|
35
47
|
constructor(root) {
|
|
36
48
|
this.root = root;
|
|
@@ -129,8 +141,8 @@ export class Archive {
|
|
|
129
141
|
|
|
130
142
|
const block = [
|
|
131
143
|
`[${dayStamp(date)}]`,
|
|
132
|
-
`[User]: ${userText}`,
|
|
133
|
-
`[DSH]: ${assistantText || "(无回答)"}`,
|
|
144
|
+
`[User]: ${defuseStamps(userText)}`,
|
|
145
|
+
`[DSH]: ${defuseStamps(assistantText || "(无回答)")}`,
|
|
134
146
|
"",
|
|
135
147
|
].join("\n");
|
|
136
148
|
appendFileSync(target, block, "utf8");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-memsearch-community",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Automatic local memory for DeepSeek Harness: per-day conversation archive by session title, semantic search index, first-run setup prompts, optional history import.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|