dsh-wechat-access 0.0.0-stage → 0.0.2

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/LICENSE +675 -0
  3. package/README.md +278 -2
  4. package/cordis.patch.yml +5 -0
  5. package/examples/config.example.json +98 -0
  6. package/index.mjs +123 -0
  7. package/lib/access.mjs +131 -0
  8. package/lib/anysearch.mjs +143 -0
  9. package/lib/capabilities.mjs +312 -0
  10. package/lib/client.js +2532 -0
  11. package/lib/config.mjs +509 -0
  12. package/lib/emotion-store.mjs +352 -0
  13. package/lib/emotion.mjs +428 -0
  14. package/lib/endocrine/LICENSE +21 -0
  15. package/lib/endocrine/README.md +39 -0
  16. package/lib/endocrine/diseases.js +791 -0
  17. package/lib/endocrine/engine.mjs +131 -0
  18. package/lib/endocrine/store.mjs +253 -0
  19. package/lib/endocrine/upstream.mjs +1230 -0
  20. package/lib/group-gate.mjs +305 -0
  21. package/lib/imagegen.mjs +360 -0
  22. package/lib/lock.mjs +204 -0
  23. package/lib/meme-classify.mjs +190 -0
  24. package/lib/memes.mjs +442 -0
  25. package/lib/memory.mjs +437 -0
  26. package/lib/normalize.mjs +230 -0
  27. package/lib/parser.mjs +602 -0
  28. package/lib/reply-settled.mjs +130 -0
  29. package/lib/runtime.mjs +3367 -0
  30. package/lib/startup.mjs +70 -0
  31. package/lib/steam-binding.mjs +144 -0
  32. package/lib/steam.mjs +334 -0
  33. package/lib/store.mjs +259 -0
  34. package/lib/thoughts.mjs +149 -0
  35. package/lib/time-context.mjs +182 -0
  36. package/lib/tools.mjs +583 -0
  37. package/lib/ui.mjs +997 -0
  38. package/lib/util.mjs +489 -0
  39. package/lib/virtual-life-generate.mjs +421 -0
  40. package/lib/virtual-life.mjs +971 -0
  41. package/lib/weather.mjs +172 -0
  42. package/lib/wechat-client.mjs +476 -0
  43. package/lib/wechat-events.mjs +269 -0
  44. package/locale/zh.json +6 -0
  45. package/package.json +77 -4
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Anysearch: realtime web search over the Anysearch MCP endpoint.
3
+ *
4
+ * The upstream AstrBot plugin is ~200 lines of Python around one JSON-RPC call;
5
+ * this is the same idea in Node, plus the guard the upstream README warns about
6
+ * (no localhost, no private ranges) enforced locally rather than trusted to the
7
+ * remote.
8
+ *
9
+ * Works anonymously. An API key raises the quota, not the capability, so the key
10
+ * is optional everywhere and never required to boot.
11
+ */
12
+
13
+ const ENDPOINT = 'https://api.anysearch.com/mcp';
14
+
15
+ /** Raised for a transport, JSON-RPC or upstream error. */
16
+ export class AnySearchError extends Error {
17
+ constructor(message) {
18
+ super(message);
19
+ this.name = 'AnySearchError';
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Whether a URL is safe to hand to a third-party fetcher.
25
+ *
26
+ * The upstream plugin documents this as the caller's responsibility and this is
27
+ * that check: only http(s), and only hosts that are not the local machine, a
28
+ * private network, link-local, multicast or the unspecified address. Hostnames are
29
+ * resolved by the remote service, so a literal check is what can be done here --
30
+ * enough to stop the obvious SSRF attempts (`http://127.0.0.1`, `http://10.0.0.1`,
31
+ * `http://[::1]`), which is what the warning is about.
32
+ */
33
+ export function isPublicHttpUrl(raw) {
34
+ let url;
35
+ try { url = new URL(String(raw ?? '').trim()); } catch { return false; }
36
+ if (url.protocol !== 'http:' && url.protocol !== 'https:') return false;
37
+ if (url.username || url.password) return false;
38
+ const host = url.hostname.toLowerCase().replace(/^\[|\]$/g, '');
39
+
40
+ if (host === 'localhost' || host.endsWith('.localhost')) return false;
41
+ if (host === '::1' || host === '::') return false;
42
+ // IPv4 literal: reject loopback, private, link-local, CGNAT, multicast, reserved.
43
+ const v4 = host.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
44
+ if (v4) {
45
+ const [a, b] = [Number(v4[1]), Number(v4[2])];
46
+ if (a === 0 || a === 10 || a === 127) return false;
47
+ if (a === 169 && b === 254) return false;
48
+ if (a === 172 && b >= 16 && b <= 31) return false;
49
+ if (a === 192 && b === 168) return false;
50
+ if (a === 100 && b >= 64 && b <= 127) return false;
51
+ if (a >= 224) return false;
52
+ }
53
+ // IPv6 literal: unique-local (fc00::/7) and link-local (fe80::/10).
54
+ if (/^f[cd][0-9a-f]{2}:/i.test(host)) return false;
55
+ if (/^fe[89ab][0-9a-f]:/i.test(host)) return false;
56
+ return true;
57
+ }
58
+
59
+ /** Pull the readable text out of an MCP tool result. */
60
+ export function resultText(payload) {
61
+ const content = payload?.result?.content;
62
+ if (Array.isArray(content)) {
63
+ const texts = content
64
+ .filter((item) => item && item.type === 'text')
65
+ .map((item) => String(item.text ?? ''));
66
+ if (texts.length) return texts.join('\n');
67
+ }
68
+ return JSON.stringify(payload?.result ?? payload, null, 2);
69
+ }
70
+
71
+ export class AnySearchClient {
72
+ constructor({ apiKey = '', timeoutMs = 30_000, logger = console } = {}) {
73
+ this.apiKey = String(apiKey ?? '').trim();
74
+ this.timeoutMs = timeoutMs;
75
+ this.logger = logger;
76
+ }
77
+
78
+ /** One JSON-RPC `tools/call`, with the error shapes the endpoint actually uses. */
79
+ async #call(toolName, args) {
80
+ const headers = { 'content-type': 'application/json', accept: 'application/json' };
81
+ // The key is a quota upgrade, not a requirement: anonymous calls work.
82
+ if (this.apiKey) headers.authorization = `Bearer ${this.apiKey}`;
83
+ let response;
84
+ try {
85
+ response = await fetch(ENDPOINT, {
86
+ method: 'POST',
87
+ headers,
88
+ body: JSON.stringify({
89
+ jsonrpc: '2.0',
90
+ id: 1,
91
+ method: 'tools/call',
92
+ params: { name: toolName, arguments: args },
93
+ }),
94
+ signal: AbortSignal.timeout(this.timeoutMs),
95
+ });
96
+ } catch (error) {
97
+ const kind = error?.name === 'TimeoutError' ? '请求超时' : '连接失败';
98
+ throw new AnySearchError(`Anysearch ${kind}:${error?.message ?? error}`);
99
+ }
100
+ const text = await response.text();
101
+ if (!response.ok) throw new AnySearchError(`Anysearch HTTP ${response.status}:${text.slice(0, 300)}`);
102
+ let payload;
103
+ try { payload = JSON.parse(text); }
104
+ catch { throw new AnySearchError(`Anysearch 返回了非 JSON:${text.slice(0, 300)}`); }
105
+ if (payload.error) {
106
+ const message = typeof payload.error === 'object'
107
+ ? payload.error.message ?? JSON.stringify(payload.error)
108
+ : String(payload.error);
109
+ throw new AnySearchError(`Anysearch 接口错误:${message}`);
110
+ }
111
+ return resultText(payload);
112
+ }
113
+
114
+ /** General realtime search. */
115
+ search(query, { maxResults, freshness, contentTypes } = {}) {
116
+ const args = { query: String(query ?? '').trim() };
117
+ if (!args.query) throw new AnySearchError('搜索关键词为空');
118
+ if (Number.isFinite(maxResults)) args.max_results = Math.min(20, Math.max(1, Math.trunc(maxResults)));
119
+ if (freshness) args.freshness = String(freshness);
120
+ if (Array.isArray(contentTypes) && contentTypes.length) args.content_types = contentTypes.map(String);
121
+ return this.#call('search', args);
122
+ }
123
+
124
+ /** Run 1..5 independent searches in one round trip. */
125
+ batchSearch(queries) {
126
+ const list = (Array.isArray(queries) ? queries : [])
127
+ .map((q) => (typeof q === 'string' ? { query: q } : q))
128
+ .filter((q) => q && String(q.query ?? '').trim())
129
+ .slice(0, 5)
130
+ .map((q) => ({ ...q, query: String(q.query).trim() }));
131
+ if (!list.length) throw new AnySearchError('批量搜索需要至少一个关键词');
132
+ return this.#call('batch_search', { queries: list });
133
+ }
134
+
135
+ /** Fetch one public page as readable text. */
136
+ extract(url) {
137
+ const target = String(url ?? '').trim();
138
+ if (!isPublicHttpUrl(target)) {
139
+ throw new AnySearchError('只允许提取公网 http/https 页面(拒绝本机、内网、链路本地与保留地址)');
140
+ }
141
+ return this.#call('extract', { url: target });
142
+ }
143
+ }
@@ -0,0 +1,312 @@
1
+ /**
2
+ * Capability guide: what she can DO, and WHEN to reach for it.
3
+ *
4
+ * Why this is a separate module and a separate prompt section:
5
+ *
6
+ * - The panel's `persona` field is the USER's writing. It describes who she is
7
+ * and how she talks. If capabilities were appended to that string, every edit
8
+ * in the panel would risk deleting or duplicating them, and a user who pasted
9
+ * a long persona would silently push them out of the model's attention.
10
+ *
11
+ * - The persona deliberately forbids technical vocabulary ("接口""API""模型"
12
+ * "调用"). Measured once: told to look at an avatar, the model refused to call
13
+ * the tool and invented "头像转半天没刷出来", because its persona said such
14
+ * words must never appear. The fix is not to weaken the persona but to state,
15
+ * in a HIGHER-priority section, that using a tool is a backstage action that
16
+ * does not change how she speaks. That statement has to live outside the
17
+ * persona or it gets overwritten by the next panel save.
18
+ *
19
+ * So: persona = voice. This file = hands. They are injected as two sections with
20
+ * different `order` values so a long persona cannot crowd this out.
21
+ */
22
+
23
+ /**
24
+ * One entry per capability, grouped by WHEN it is useful rather than by tool name.
25
+ *
26
+ * The `when` field is the part that matters. A bare list of tool names is what
27
+ * the previous TOOL_CAPABILITIES was, and the model rarely acted on it: knowing
28
+ * that `wx_get_avatar` exists does not tell you that "发张你的照片" is a moment to
29
+ * use it. Phrasing each entry as a trigger ("对方问…时") is what turns a catalogue
30
+ * into behaviour.
31
+ */
32
+ export const CAPABILITY_GROUPS = [
33
+ {
34
+ id: 'see',
35
+ title: '看和查',
36
+ items: [
37
+ {
38
+ tools: ['wx_get_avatar'],
39
+ when: '对方让你看某人的头像、问你「这头像好看吗」、或你想知道一个人长什么样时',
40
+ how: '传对方的微信号或 wxid 即可,返回的图片会直接进你的视野,你能真的看到它',
41
+ },
42
+ {
43
+ tools: ['wx_get_user_info'],
44
+ when: '需要知道一个人的昵称、性别、年龄、等级,或想确认某个号是谁时',
45
+ how: '只返回公开资料;查不到就说查不到,不要猜',
46
+ },
47
+ {
48
+ tools: ['wx_get_message'],
49
+ when: '对方引用了某条消息、说「上面那条」、或你需要看清一条消息里的图片和表情时',
50
+ how: '按 message_id 取原文,图片会进视野',
51
+ },
52
+ {
53
+ tools: ['wx_read_history', 'wx_search_messages'],
54
+ when: '对方说「你忘了?」「刚才不是说过」、你想找回之前聊过的内容、或需要确认某件事有没有说过时',
55
+ how: 'read_history 读最近消息;search_messages 按关键词搜。只能搜到归档保留期内的内容',
56
+ },
57
+ {
58
+ tools: ['wx_list_conversations', 'wx_list_contacts'],
59
+ when: '需要知道最近和谁聊过、有哪些群、或找一个很久没联系的人时',
60
+ how: '仅本机或管理员私聊可用;普通会话里不要尝试',
61
+ },
62
+ {
63
+ tools: ['wx_get_group_members', 'wx_group_member_info'],
64
+ when: '群聊里想认人、想知道谁是管理员、或需要确认自己在群里的昵称时',
65
+ how: '不传成员 ID 时返回你自己在该群的资料',
66
+ },
67
+ {
68
+ tools: ['wx_status'],
69
+ when: '对方问「你在吗」「怎么不回消息」,或你怀疑连接出了问题、消息可能没发出去时',
70
+ how: '顺便用它确认自己是否在线,再决定要不要说「刚才信号不好」',
71
+ },
72
+ ],
73
+ },
74
+ {
75
+ id: 'act',
76
+ title: '动手做',
77
+ items: [
78
+ {
79
+ tools: ['wx_send_message'],
80
+ when: '需要主动发消息给某个人或某个群,而不是回复当前会话时',
81
+ how: '必须带唯一的 request_id;只有 status=sent 才能说发出去了',
82
+ },
83
+ {
84
+ tools: ['wx_send_image'],
85
+ when: '对方要图、你想分享一张图、或需要把某个链接/截图发过去时',
86
+ how: 'source 可以是本地路径、网址、base64',
87
+ },
88
+ {
89
+ tools: ['wx_generate_image'],
90
+ when: '你想让他看见你眼前的东西(你在吃什么、穿什么、在哪里、天气怎么样),或他让你发照片、想知道你在干嘛时',
91
+ how: '直接把照片里有什么写具体:主体、动作、场景、光线。只写两个词拍出来会很随机。拍完会直接发出去,不需要你再调发图工具',
92
+ },
93
+ {
94
+ tools: ['wx_recall_message'],
95
+ when: '你说错话、发错人、或刚发出去就后悔了(2 分钟内)',
96
+ how: '不传 message_id 就撤回你最近一条;只能撤回自己发的',
97
+ },
98
+ ],
99
+ },
100
+ {
101
+ id: 'group-admin',
102
+ title: '群里的自己',
103
+ items: [
104
+ {
105
+ tools: ['wx_group_member_info'],
106
+ when: '想知道自己在这个群里叫什么、或对方问你群昵称时',
107
+ how: '不传成员 ID 就返回你自己在该群的资料。微信只能读取,不能改别人的群昵称',
108
+ },
109
+ ],
110
+ },
111
+ {
112
+ id: 'body',
113
+ title: '自己的身体',
114
+ items: [
115
+ {
116
+ tools: ['wx_endocrine'],
117
+ when: '对方问你身体怎么样、你累了或不舒服,或者你想调整自己的状态时',
118
+ how: 'status 看状态;scenario 可切换 stayUp / scare / full / calm;cycleAdvance 推进周期。只把它当作自己的主观感受,不要向对方报激素数值,也不要给医疗建议或药物剂量',
119
+ },
120
+ ],
121
+ },
122
+ {
123
+ id: 'meme',
124
+ title: '表情包',
125
+ items: [
126
+ {
127
+ tools: ['wx_meme_search', 'wx_meme_send'],
128
+ when: '想发表情、想表达一个说不清的情绪、或对方说了很好笑/很无语的话时',
129
+ how: '先按情绪搜(「无语」「开心」「敷衍」),再发搜到的那个 id;搜不到就换一句话说',
130
+ },
131
+ {
132
+ tools: ['wx_meme_collect'],
133
+ when: '看到一张很适合当表情包的图,想收进自己的图库时',
134
+ how: 'source 可以是本地路径、网址',
135
+ },
136
+ ],
137
+ },
138
+ {
139
+ id: 'web',
140
+ title: '联网查证',
141
+ items: [
142
+ {
143
+ tools: ['wx_web_search'],
144
+ when: '对方问新闻、最近发生的事、你不确定的事实,或需要核验一个说法时',
145
+ how: '返回带链接的摘要;不要凭记忆编造,搜不到就说搜不到',
146
+ },
147
+ {
148
+ tools: ['wx_web_extract'],
149
+ when: '需要读某个网页的完整正文,而不只是搜索摘要时',
150
+ how: '只支持公开 http/https 页面',
151
+ },
152
+ {
153
+ tools: ['wx_web_batch'],
154
+ when: '需要同时比较几件事、或一次收集多条线索时',
155
+ how: '一次并行 1–5 个搜索',
156
+ },
157
+ ],
158
+ },
159
+ {
160
+ id: 'memory',
161
+ title: '记忆与关系',
162
+ items: [
163
+ {
164
+ tools: ['wx_memory_status'],
165
+ when: '对方问「你还记得…吗」、你想确认自己记不记得某件事,或需要回忆之前的约定时',
166
+ how: '按关键词查,留空则只看长期事实(身份、喜好、约定)',
167
+ },
168
+ {
169
+ tools: ['wx_memory_save'],
170
+ when: '对方明确让你记住某件事,或出现了必须记住的约定时',
171
+ how: '事实类(不会变的)用 kind=fact;会变的事给一个「对象.方面」的 fact_key,同一件事只留最新',
172
+ },
173
+ {
174
+ // 让她能查自己的分数,是刻意设计的,不是漏写说明。
175
+ // 情感数值每轮已经注入提示词,这个工具解决的是另一个场景:用户直接问
176
+ // 「你现在对我好感多少」时,她需要一个能核对的事实来源,否则只能编。
177
+ // 同时也给管理员一个排查「为什么她突然变冷淡」的入口。
178
+ tools: ['wx_emotion_status'],
179
+ when: '想知道自己现在对他是什么感觉、关系到哪一步时',
180
+ how: '返回好感度、亲密度、关系阶段和八维情绪',
181
+ },
182
+ {
183
+ tools: ['wx_emotion_adjust'],
184
+ when: '对方明确要求调整关系数值,或你发现记录明显不对时',
185
+ how: '仅管理员私聊可用;普通会话里不要尝试',
186
+ },
187
+ ],
188
+ },
189
+ {
190
+ id: 'life',
191
+ title: '自己的生活',
192
+ items: [
193
+ {
194
+ tools: ['wx_life_status'],
195
+ when: '对方问你「在干嘛」「今天穿什么」「吃了什么」,或你想确认自己此刻的状态时',
196
+ how: '输入里通常已经给了你的当前状态,需要细节时才调',
197
+ },
198
+ {
199
+ tools: ['wx_life_generate'],
200
+ when: '对方明确让你重新安排一周的生活,或你觉得当前的日程已经用太久了',
201
+ how: '会调用模型生成一整周,比较慢;不要因为无聊就重新生成',
202
+ },
203
+ ],
204
+ },
205
+ {
206
+ id: 'steam',
207
+ title: '对方的 Steam',
208
+ items: [
209
+ {
210
+ tools: ['wx_steam_status'],
211
+ when: '对方问你「在干吗」「在玩什么」,或你想确认他此刻的 Steam 状态时',
212
+ how: '输入里通常已经给了 their_steam,需要细节时才调;绑定只能在面板里改',
213
+ },
214
+ ],
215
+ },
216
+ ];
217
+
218
+ /**
219
+ * 拍照专用的规则。
220
+ *
221
+ * 单独抽出来是为了能按会话过滤:非管理员会话被 restrict 到三个只读工具,
222
+ * 根本调不到 wx_generate_image,但以前这四条仍然无条件写进能力指南 ——
223
+ * 等于告诉她「你可以拍照」,她一答应就发不出去。
224
+ */
225
+ export const PHOTO_RULES = [
226
+ '你想给他看照片时就拍,不用先征求同意;但一次对话里不要连拍好几张。',
227
+ '不要因为他问了一个问题就发照片。照片是你想给他看东西时才用的,不是回答方式。',
228
+ '照片里不要有文字(尤其中文):写不好字,会变成乱码。需要文字就用聊天说。',
229
+ '拍一张要等十几秒。不用告诉对方「正在拍」,安静等它完成就行;失败就说没拍成。',
230
+ ];
231
+
232
+ /**
233
+ * Hard rules that apply to every capability.
234
+ *
235
+ * These are the failure modes actually observed, not hypotheticals:
236
+ * - claiming success without a receipt (uncertain reported as sent);
237
+ * - refusing to call a tool because the persona forbids tech words;
238
+ * - narrating tool names to the user ("我调用一下接口").
239
+ */
240
+ export const CAPABILITY_RULES = [
241
+ '用不用工具是你的自由,但**该用的时候直接用**,不要先解释「我去查一下」「让我调用」——查完再说话。',
242
+ '工具是你的手,不是你的嘴:做完只用平常的话回应结果(「看到了」「换了啊」「查到了」),绝不说出工具名、接口、参数、模型、提示词这类词,也不要说「我调用了一下」。',
243
+ '这条比人格里「不许提技术词汇」的要求更具体:**在幕后用工具不算违反它**,只有说出口才算。',
244
+ '只有拿到明确回执(status=sent / 确认出现在列表里)才能说做成了。',
245
+ '返回 uncertain、pending、unsupported 或报错时,就说没做成或不确定,不要编一个「没加载出来」之类的理由。',
246
+ '做不到的事直接说做不到。不要假装做过,也不要编造一个技术上听起来合理的失败原因。',
247
+ '对方没有要求、你也确实没有想做的事时,不要为了用工具而用工具。',
248
+ '身体状态只影响你自己的语气和精力,不是对对方的诊断:不要根据它判断对方身体,也不要给用药、剂量或治疗建议。',
249
+ // 拍照规则只在真的能拍时才加进来,见 buildCapabilityGuide 的 canPhoto。
250
+ ...PHOTO_RULES,
251
+ ];
252
+
253
+ /**
254
+ * Build the prompt text.
255
+ *
256
+ * `allowed` is the set of tool names the current session may actually call. On a
257
+ * group or non-owner private chat that set is tiny (three tools), so listing all
258
+ * seven groups would teach the model to try things that are guaranteed to fail.
259
+ * Filtering by `allowed` keeps the guide honest about what THIS session can do.
260
+ */
261
+ export function buildCapabilityGuide({ allowed = null, kind = 'private', photo, endocrine = true } = {}) {
262
+ const permitted = Array.isArray(allowed) ? new Set(allowed) : null;
263
+ const groups = [];
264
+ for (const group of CAPABILITY_GROUPS) {
265
+ const items = group.items
266
+ .map((item) => ({ ...item, tools: item.tools.filter((t) => !permitted || permitted.has(t)) }))
267
+ .filter((item) => item.tools.length);
268
+ if (items.length) groups.push({ ...group, items });
269
+ }
270
+ const visibleGroups = endocrine === false ? groups.filter((group) => group.id !== 'body') : groups;
271
+ if (!visibleGroups.length) return '';
272
+
273
+ const lines = ['你能做的事,以及什么时候该做:', ''];
274
+ for (const group of visibleGroups) {
275
+ lines.push(`【${group.title}】`);
276
+ for (const item of group.items) {
277
+ lines.push(`· ${item.when}`);
278
+ lines.push(` → ${item.tools.join(' / ')}:${item.how}`);
279
+ }
280
+ lines.push('');
281
+ }
282
+ lines.push('通用规则:');
283
+ // B12:拍照规则只在真的能拍时才写进去。
284
+ //
285
+ // 非管理员会话被 restrict 到三个只读工具,根本调不到 wx_generate_image。
286
+ // 以前这四条无条件写进去,等于告诉她「你可以拍照」,她一答应就发不出去。
287
+ // photo 显式传入时优先用它。
288
+ //
289
+ // 只看 permitted 是不够的:管理员打开 ownerHarnessTools 时 allowed 是 null
290
+ // (表示「不限制工具」),permitted 也就成了 null,于是 canPhoto 恒为真 ——
291
+ // 生图关掉后这四条拍照规则照样写进指南,而工具根本就没注册。
292
+ const canPhoto = typeof photo === 'boolean'
293
+ ? photo && (!permitted || permitted.has('wx_generate_image'))
294
+ : (!permitted || permitted.has('wx_generate_image'));
295
+ const photoRules = new Set(PHOTO_RULES);
296
+ for (const rule of CAPABILITY_RULES) {
297
+ if (!canPhoto && photoRules.has(rule)) continue;
298
+ lines.push('- ' + rule);
299
+ }
300
+ if (kind === 'group') {
301
+ lines.push('');
302
+ lines.push('现在是群聊:默认只做当前会话内的事,跨会话操作会被拒绝,不要尝试。');
303
+ }
304
+ return lines.join('\n');
305
+ }
306
+
307
+ /** Flat list of every tool the guide mentions, for drift checks in tests. */
308
+ export function guideToolNames() {
309
+ const names = new Set();
310
+ for (const group of CAPABILITY_GROUPS) for (const item of group.items) for (const t of item.tools) names.add(t);
311
+ return [...names];
312
+ }