@yun-zero/claw-memory 0.1.3 → 0.1.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/config/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/config/plugin.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,IAAI,GAAG,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;QACxB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AASD,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,YAAY,CAgCpD"}
|
package/dist/config/plugin.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
function expandTilde(filepath) {
|
|
4
|
+
if (filepath.startsWith('~/') || filepath === '~') {
|
|
5
|
+
return path.join(os.homedir(), filepath.slice(1));
|
|
6
|
+
}
|
|
7
|
+
return filepath;
|
|
8
|
+
}
|
|
1
9
|
export function getConfig(config) {
|
|
2
10
|
const defaultConfig = {
|
|
3
11
|
enabled: true,
|
|
4
12
|
autoSave: true,
|
|
5
13
|
saveMode: 'qa',
|
|
6
|
-
dataDir: '~/.openclaw/claw-memory',
|
|
14
|
+
dataDir: expandTilde('~/.openclaw/claw-memory'),
|
|
7
15
|
scheduler: {
|
|
8
16
|
enabled: true,
|
|
9
17
|
deduplicateTime: '01:00',
|
|
@@ -19,7 +27,7 @@ export function getConfig(config) {
|
|
|
19
27
|
enabled: config.enabled ?? defaultConfig.enabled,
|
|
20
28
|
autoSave: config.autoSave ?? defaultConfig.autoSave,
|
|
21
29
|
saveMode: config.saveMode ?? defaultConfig.saveMode,
|
|
22
|
-
dataDir: config.dataDir ?? defaultConfig.dataDir,
|
|
30
|
+
dataDir: expandTilde(config.dataDir ?? defaultConfig.dataDir),
|
|
23
31
|
scheduler: {
|
|
24
32
|
enabled: config.scheduler?.enabled ?? defaultConfig.scheduler.enabled,
|
|
25
33
|
deduplicateTime: config.scheduler?.deduplicateTime ?? defaultConfig.scheduler.deduplicateTime,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/config/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/config/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAgBxB,SAAS,WAAW,CAAC,QAAgB;IACnC,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,QAAQ,KAAK,GAAG,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,MAAY;IACpC,MAAM,aAAa,GAAiB;QAClC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,WAAW,CAAC,yBAAyB,CAAC;QAC/C,SAAS,EAAE;YACT,OAAO,EAAE,IAAI;YACb,eAAe,EAAE,OAAO;YACxB,SAAS,EAAE,OAAO;YAClB,UAAU,EAAE,OAAO;YACnB,WAAW,EAAE,OAAO;SACrB;KACF,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO;QAChD,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,aAAa,CAAC,QAAQ;QACnD,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,aAAa,CAAC,QAAQ;QACnD,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC;QAC7D,SAAS,EAAE;YACT,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,IAAI,aAAa,CAAC,SAAS,CAAC,OAAO;YACrE,eAAe,EAAE,MAAM,CAAC,SAAS,EAAE,eAAe,IAAI,aAAa,CAAC,SAAS,CAAC,eAAe;YAC7F,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,IAAI,aAAa,CAAC,SAAS,CAAC,SAAS;YAC3E,UAAU,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,aAAa,CAAC,SAAS,CAAC,UAAU;YAC9E,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,WAAW,IAAI,aAAa,CAAC,SAAS,CAAC,WAAW;SAClF;KACF,CAAC;AACJ,CAAC"}
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/config/plugin.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
1
4
|
export interface PluginConfig {
|
|
2
5
|
enabled: boolean;
|
|
3
6
|
autoSave: boolean;
|
|
@@ -12,12 +15,19 @@ export interface PluginConfig {
|
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
function expandTilde(filepath: string): string {
|
|
19
|
+
if (filepath.startsWith('~/') || filepath === '~') {
|
|
20
|
+
return path.join(os.homedir(), filepath.slice(1));
|
|
21
|
+
}
|
|
22
|
+
return filepath;
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
export function getConfig(config?: any): PluginConfig {
|
|
16
26
|
const defaultConfig: PluginConfig = {
|
|
17
27
|
enabled: true,
|
|
18
28
|
autoSave: true,
|
|
19
29
|
saveMode: 'qa',
|
|
20
|
-
dataDir: '~/.openclaw/claw-memory',
|
|
30
|
+
dataDir: expandTilde('~/.openclaw/claw-memory'),
|
|
21
31
|
scheduler: {
|
|
22
32
|
enabled: true,
|
|
23
33
|
deduplicateTime: '01:00',
|
|
@@ -35,7 +45,7 @@ export function getConfig(config?: any): PluginConfig {
|
|
|
35
45
|
enabled: config.enabled ?? defaultConfig.enabled,
|
|
36
46
|
autoSave: config.autoSave ?? defaultConfig.autoSave,
|
|
37
47
|
saveMode: config.saveMode ?? defaultConfig.saveMode,
|
|
38
|
-
dataDir: config.dataDir ?? defaultConfig.dataDir,
|
|
48
|
+
dataDir: expandTilde(config.dataDir ?? defaultConfig.dataDir),
|
|
39
49
|
scheduler: {
|
|
40
50
|
enabled: config.scheduler?.enabled ?? defaultConfig.scheduler.enabled,
|
|
41
51
|
deduplicateTime: config.scheduler?.deduplicateTime ?? defaultConfig.scheduler.deduplicateTime,
|