@dsh-mobile/mobile-remote 3.3.0 → 3.4.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/FAQ.md +2 -2
- package/LICENSE +0 -0
- package/README.md +13 -8
- package/docs/PRIVACY-POLICY.en.md +26 -18
- package/docs/PRIVACY-POLICY.md +26 -18
- package/docs/SUPPORT.md +1 -1
- package/docs/TERMS-OF-SERVICE.en.md +5 -3
- package/docs/TERMS-OF-SERVICE.md +5 -3
- package/docs/USER-GUIDE.zh-CN.md +7 -6
- package/lib/account-usage-query.js +60 -60
- package/lib/account-usage.js +10 -10
- package/lib/api-helpers.js +114 -110
- package/lib/assistant-prefs.js +119 -76
- package/lib/auto-config.js +65 -65
- package/lib/backup.js +159 -123
- package/lib/break-reminder.js +45 -45
- package/lib/client.js +336 -138
- package/lib/config.js +234 -218
- package/lib/git-read-bundled-provider.js +27 -7
- package/lib/git-read-service.js +5 -5
- package/lib/host-compat.js +84 -84
- package/lib/http-util.js +17 -17
- package/lib/index.js +1670 -1511
- package/lib/memory/context.js +45 -40
- package/lib/memory/decay.js +93 -93
- package/lib/memory/extract.js +77 -77
- package/lib/memory/routes.js +33 -33
- package/lib/memory/store.js +239 -192
- package/lib/notify-copy.js +93 -93
- package/lib/permission-guide.js +86 -86
- package/lib/persona-cards.js +73 -61
- package/lib/phone-action-args.js +175 -0
- package/lib/phone-actions.js +227 -0
- package/lib/phone-announce.js +58 -0
- package/lib/proactive-material.js +42 -42
- package/lib/proactive.js +122 -119
- package/lib/protected-paths.js +205 -45
- package/lib/protocol.js +62 -23
- package/lib/push.js +29 -29
- package/lib/rate-limit.js +16 -16
- package/lib/relay/connector.js +334 -81
- package/lib/relay/crypto.js +15 -15
- package/lib/relay/devices.js +64 -32
- package/lib/relay/fingerprint.js +34 -34
- package/lib/relay/identity.js +26 -26
- package/lib/relay/mux.js +60 -46
- package/lib/relay/noise.js +40 -40
- package/lib/relay/on-demand.js +36 -31
- package/lib/relay/p2p.js +239 -0
- package/lib/relay/pairing.js +54 -15
- package/lib/relay/phone.js +63 -39
- package/lib/relay/serve.js +21 -21
- package/lib/relay/signal.js +69 -0
- package/lib/relay/ws-server.js +245 -0
- package/lib/reminders.js +15 -15
- package/lib/rpc-adapter.js +43 -43
- package/lib/session-list.js +31 -31
- package/lib/session-rotation.js +95 -95
- package/lib/session-title-cache.js +35 -35
- package/lib/session-title-refresh.js +51 -51
- package/lib/timeline.js +140 -140
- package/lib/turn-outline.js +104 -104
- package/package.json +11 -18
package/lib/memory/context.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
20
|
export const MEMORY_CONTEXT_NAME = "mobile-remote:memory";
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
const HEADER = "关于这位用户的长期记忆(来自你自己之前的记录,可能过时;与当前对话冲突时以当前对话为准):";
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
35
|
export function createMemoryContextProvider({
|
|
36
36
|
getStore,
|
|
37
37
|
getMode,
|
|
@@ -49,27 +49,32 @@ export function createMemoryContextProvider({
|
|
|
49
49
|
if (!body) return "";
|
|
50
50
|
return `${HEADER}\n${body}`;
|
|
51
51
|
} catch {
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
return "";
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
66
|
export function installMemoryContext(ctx, provider) {
|
|
67
67
|
const systemPrompt = ctx.get?.("systemPrompt");
|
|
68
68
|
if (!systemPrompt || typeof systemPrompt.context !== "function") return false;
|
|
69
69
|
systemPrompt.context({
|
|
70
70
|
name: MEMORY_CONTEXT_NAME,
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
order: 60,
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
interpolate: false,
|
|
73
78
|
text: provider,
|
|
74
79
|
});
|
|
75
80
|
return true;
|
package/lib/memory/decay.js
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
27
|
export const DEFAULT_STABILITY_DAYS = 7;
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
export const DEFAULT_DIFFICULTY = 5;
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
39
|
export const FORGET_THRESHOLD = 0.5;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
export function isFrozen(retention) {
|
|
43
43
|
return retention < FORGET_THRESHOLD;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
62
|
export function retentionOf(daysSinceRecall, stability) {
|
|
63
63
|
const t = Math.max(0, Number(daysSinceRecall) || 0);
|
|
64
64
|
const s = Math.max(0.1, Number(stability) || DEFAULT_STABILITY_DAYS);
|
|
65
65
|
return Math.max(0, Math.min(1, 1 / (1 + t / s)));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
80
|
export function nextStability(stability, difficulty) {
|
|
81
81
|
const s = Math.max(0.1, Number(stability) || DEFAULT_STABILITY_DAYS);
|
|
82
82
|
const d = Math.max(1, Math.min(10, Number(difficulty) || DEFAULT_DIFFICULTY));
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
const gain = 2.2 - (d - 1) * (1 / 9) * 1.0;
|
|
85
85
|
return Math.min(3650, s * gain);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
93
|
export function nextDifficulty(difficulty) {
|
|
94
94
|
const d = Math.max(1, Math.min(10, Number(difficulty) || DEFAULT_DIFFICULTY));
|
|
95
95
|
return Math.max(1, d - 0.3);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
107
|
export function retentionOfRow(row, now = new Date()) {
|
|
108
108
|
if (row?.pinned) return 1;
|
|
109
109
|
const last = Number(row?.lastRecalledAt ?? row?.last_recalled_at ?? row?.createdAt ?? row?.created_at ?? 0);
|
|
@@ -113,23 +113,23 @@ export function retentionOfRow(row, now = new Date()) {
|
|
|
113
113
|
return retentionOf(days, stability);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
128
|
export function partitionInjectable(rows, { now = new Date(), limit = 20, threshold = FORGET_THRESHOLD } = {}) {
|
|
129
129
|
const scored = rows.map((r) => ({ row: r, retention: retentionOfRow(r, now) }));
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
133
|
const isLive = (x) => Boolean(x.row.pinned) || x.retention >= threshold;
|
|
134
134
|
const live = scored.filter(isLive);
|
|
135
135
|
const frozen = scored.filter((x) => !isLive(x));
|
package/lib/memory/extract.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
35
|
const PATTERNS = [
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
{ re: /^(?:我)?(?:比较)?(?:喜欢|偏好|更愿意|习惯用|习惯)(.+)$/, scope: "shared", confidence: 0.9 },
|
|
38
38
|
{ re: /^(?:我)?(?:不喜欢|讨厌|受不了|不想用)(.+)$/, scope: "shared", confidence: 0.9 },
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
{ re: /^(?:我)?(?:是|在做|从事)(.{2,40}?)(?:工程师|开发|设计|产品|学生|老师)?$/, scope: "shared", confidence: 0.6 },
|
|
41
41
|
{ re: /^(?:我)?(?:在|住)(.{2,20}?)(?:工作|生活|上班)$/, scope: "life", confidence: 0.7 },
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
{ re: /^(?:请)?(?:以后|今后|之后)(?:都|一直|一律)?(.+)$/, scope: "shared", confidence: 0.85 },
|
|
44
44
|
{ re: /^(?:我)?(?:不(?:要|想|希望))(?:你)?(.+)$/, scope: "shared", confidence: 0.7 },
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
{ re: /^(?:我们)?(?:项目|团队|公司)(?:用|是|在)(.+)$/, scope: "work", confidence: 0.75 },
|
|
47
47
|
];
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
const MIN_TEXT = 3;
|
|
51
51
|
const MAX_TEXT = 120;
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
const MAX_STORED = 200;
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
60
|
const TRANSIENT = /(?:这样|这次|这个版本|这一版|刚才|现在先|暂时|先这么)/;
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
68
|
export function extractMemory(raw) {
|
|
69
69
|
const text = String(raw ?? "").replace(/\s+/g, " ").trim();
|
|
70
70
|
if (text.length < MIN_TEXT) return null;
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
if (/[??]\s*$/.test(text)) return null;
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
if (/^[\s`$>#/]/.test(text) || /```/.test(text)) return null;
|
|
75
75
|
if (TRANSIENT.test(text)) return null;
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
if (text.split(/[。!!;;]/).filter((s) => s.trim() !== "").length > 1) return null;
|
|
78
78
|
|
|
79
79
|
for (const { re, scope, confidence } of PATTERNS) {
|
|
80
80
|
const m = re.exec(text);
|
|
81
81
|
if (!m) continue;
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
|
|
83
|
+
|
|
84
84
|
const body = text.slice(0, MAX_STORED);
|
|
85
85
|
if (body.replace(/[^\p{L}\p{N}]/gu, "").length < MIN_TEXT) return null;
|
|
86
86
|
return { text: body, scope, confidence };
|
|
@@ -88,14 +88,14 @@ export function extractMemory(raw) {
|
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
99
|
export function extractMemories({ text, mode = "work" }) {
|
|
100
100
|
const lines = String(text ?? "")
|
|
101
101
|
.split(/\r?\n/)
|
|
@@ -105,26 +105,26 @@ export function extractMemories({ text, mode = "work" }) {
|
|
|
105
105
|
for (const line of lines) {
|
|
106
106
|
const hit = extractMemory(line);
|
|
107
107
|
if (!hit) continue;
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
|
|
109
|
+
|
|
110
110
|
if (mode === "life" && hit.scope === "work") continue;
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
if (out.some((o) => o.text === hit.text)) continue;
|
|
113
113
|
out.push(hit);
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
return out.slice(0, 3);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
128
|
export function recordMemories({ store, candidates, meta = {} }) {
|
|
129
129
|
if (!store || !Array.isArray(candidates) || candidates.length === 0) return 0;
|
|
130
130
|
let written = 0;
|
|
@@ -139,7 +139,7 @@ export function recordMemories({ store, candidates, meta = {} }) {
|
|
|
139
139
|
});
|
|
140
140
|
written++;
|
|
141
141
|
} catch {
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
return written;
|
package/lib/memory/routes.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
16
|
import { readBody, sendError, sendJson } from "../http-util.js";
|
|
17
17
|
import { normalizeScope } from "./store.js";
|
|
18
18
|
|
|
19
19
|
const MAX_TEXT = 4000;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
function normalizeMode(value) {
|
|
23
23
|
return value === "life" ? "life" : "work";
|
|
24
24
|
}
|
|
@@ -27,19 +27,19 @@ function badRequest(res, detail) {
|
|
|
27
27
|
sendError(res, 400, "bad-request", detail);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
36
|
export function createMemoryRoutes({ store, wipe = () => 0, onDeleteAll = () => {} }) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
43
|
const current = () => {
|
|
44
44
|
try {
|
|
45
45
|
const s = store();
|
|
@@ -51,15 +51,15 @@ export function createMemoryRoutes({ store, wipe = () => 0, onDeleteAll = () =>
|
|
|
51
51
|
|
|
52
52
|
return async function handleMemory(req, res, url, rest, method) {
|
|
53
53
|
const lookup = current();
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
|
|
55
|
+
|
|
56
56
|
if (rest === "/memory" && method === "DELETE") {
|
|
57
57
|
if (url.searchParams.get("all") !== "1") {
|
|
58
58
|
badRequest(res, "删除全部记忆需要 ?all=1 / deleting all memory needs ?all=1");
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
try {
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
onDeleteAll();
|
|
64
64
|
if (lookup.kind === "ok") {
|
|
65
65
|
sendJson(res, 200, { ok: true, removed: lookup.store.removeAll() });
|
|
@@ -72,7 +72,7 @@ export function createMemoryRoutes({ store, wipe = () => 0, onDeleteAll = () =>
|
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
if (lookup.kind !== "ok") {
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
const reason =
|
|
77
77
|
lookup.kind === "off"
|
|
78
78
|
? "记忆未启用"
|
|
@@ -82,7 +82,7 @@ export function createMemoryRoutes({ store, wipe = () => 0, onDeleteAll = () =>
|
|
|
82
82
|
}
|
|
83
83
|
const s = lookup.store;
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
if (rest === "/memory/export") {
|
|
87
87
|
if (method !== "GET" && method !== "HEAD") {
|
|
88
88
|
sendError(res, 405, "method-not-allowed");
|