@lih-x-x/kmr 1.0.41 → 1.0.43

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/dist/cli.js CHANGED
@@ -6,9 +6,9 @@ async function checkUpdate() {
6
6
  try {
7
7
  const res = await fetch(`https://registry.npmjs.org/${"@lih-x-x/kmr"}/latest`, { signal: AbortSignal.timeout(3e3) });
8
8
  const data = await res.json();
9
- if (data.version && data.version !== "1.0.41") {
9
+ if (data.version && data.version !== "1.0.43") {
10
10
  console.log(`
11
- \u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.41"} \u2192 ${data.version}`);
11
+ \u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.43"} \u2192 ${data.version}`);
12
12
  console.log(` \u8FD0\u884C npm install -g ${"@lih-x-x/kmr"} \u66F4\u65B0
13
13
  `);
14
14
  }
@@ -53,11 +53,10 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
53
53
  kmr del <id> \u5220\u9664\u8BB0\u5F55
54
54
  kmr find <q> \u641C\u7D22\u4F1A\u8BAE\u8BB0\u5F55
55
55
  kmr create-task <\u6807\u9898> [--due YYYY-MM-DD] [--assignee \u59D3\u540D] [--desc \u63CF\u8FF0] \u521B\u5EFA\u98DE\u4E66\u4EFB\u52A1
56
- kmr send <\u5185\u5BB9> \u5411\u7BA1\u7406\u5458\u53D1\u9001\u98DE\u4E66\u6D88\u606F
57
56
  kmr --help \u663E\u793A\u5E2E\u52A9
58
57
  `);
59
58
  } else if (command === "--version" || command === "-v") {
60
- console.log("1.0.41");
59
+ console.log("1.0.43");
61
60
  } else if (command === "list") {
62
61
  const { loadConfig } = await import("./config-L2SVVMAR.js");
63
62
  const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
@@ -184,24 +183,6 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
184
183
  const result = await taskCreator.createTask({ summary, due, description: desc, assigneeOpenId });
185
184
  console.log(`\u2705 \u4EFB\u52A1\u5DF2\u521B\u5EFA: ${result.taskId}`);
186
185
  if (result.url) console.log(` ${result.url}`);
187
- } else if (command === "send") {
188
- const text = argv.slice(3).join(" ");
189
- if (!text) {
190
- console.error("\u7528\u6CD5: kmr send <\u6D88\u606F\u5185\u5BB9>");
191
- process.exit(1);
192
- }
193
- const { loadConfig } = await import("./config-L2SVVMAR.js");
194
- const { createLarkClient } = await import("./client-DFBBDD77.js");
195
- const { Messenger } = await import("./messenger-O4LNWO4P.js");
196
- const config = loadConfig();
197
- if (!config.lark.adminOpenId) {
198
- console.error("\u274C \u672A\u914D\u7F6E adminOpenId\uFF0C\u65E0\u6CD5\u53D1\u9001\u6D88\u606F");
199
- process.exit(1);
200
- }
201
- const client = createLarkClient(config);
202
- const messenger = new Messenger(client);
203
- await messenger.sendToUser(config.lark.adminOpenId, text);
204
- console.log("\u2705 \u6D88\u606F\u5DF2\u53D1\u9001");
205
186
  } else if (command === "find") {
206
187
  const query = argv.slice(3).join(" ");
207
188
  if (!query) {
@@ -240,7 +221,6 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
240
221
  kmr del <id> \u5220\u9664\u8BB0\u5F55
241
222
  kmr find <q> \u641C\u7D22\u4F1A\u8BAE\u8BB0\u5F55
242
223
  kmr create-task <\u6807\u9898> [--due DATE] [--assignee \u59D3\u540D] [--desc \u63CF\u8FF0] \u521B\u5EFA\u4EFB\u52A1
243
- kmr send <\u5185\u5BB9> \u5411\u7BA1\u7406\u5458\u53D1\u6D88\u606F
244
224
  kmr --help \u663E\u793A\u5B8C\u6574\u5E2E\u52A9
245
225
  `);
246
226
  await import("./index.js");
package/dist/index.js CHANGED
@@ -1,6 +1,3 @@
1
- import {
2
- Messenger
3
- } from "./chunk-VYFCZATK.js";
4
1
  import {
5
2
  ClaudeCodeProvider,
6
3
  getExecEnv
@@ -112,6 +109,196 @@ var DocReader = class {
112
109
  }
113
110
  };
114
111
 
112
+ // src/lark/messenger.ts
113
+ var Messenger = class {
114
+ constructor(client) {
115
+ this.client = client;
116
+ }
117
+ client;
118
+ async replyText(messageId, text) {
119
+ await this.client.im.message.reply({
120
+ path: { message_id: messageId },
121
+ data: {
122
+ content: JSON.stringify({ text }),
123
+ msg_type: "text"
124
+ }
125
+ });
126
+ }
127
+ async replyMeetingSummary(messageId, record) {
128
+ const lines = [
129
+ `\u2705 \u4F1A\u8BAE\u5173\u952E\u4FE1\u606F\u63D0\u53D6\u5B8C\u6210`,
130
+ "",
131
+ `\u{1F4CB} **${record.summary.title}**`,
132
+ `\u{1F4C5} \u65E5\u671F\uFF1A${record.summary.date}`,
133
+ `\u{1F465} \u53C2\u4E0E\u4EBA\uFF1A${record.summary.participants.join("\u3001")}`,
134
+ "",
135
+ "**\u6838\u5FC3\u8981\u70B9\uFF1A**",
136
+ ...record.summary.keyPoints.map((p) => `\u2022 ${p}`)
137
+ ];
138
+ if (record.todos.length > 0) {
139
+ lines.push("", "**\u5F85\u529E\u4E8B\u9879\uFF1A**");
140
+ for (const todo of record.todos) {
141
+ lines.push(`\u2022 ${todo.content}\uFF08${todo.owner}\uFF0C\u622A\u6B62 ${todo.deadline}\uFF09`);
142
+ }
143
+ }
144
+ if (record.risks.length > 0) {
145
+ lines.push("", "**\u98CE\u9669\u9879\uFF1A**");
146
+ for (const risk of record.risks) {
147
+ lines.push(`\u2022 [${risk.severity}] ${risk.description}`);
148
+ }
149
+ }
150
+ if (record.commitments.length > 0) {
151
+ lines.push("", "\u{1F91D} **\u5173\u952E\u5171\u8BC6\u4E0E\u627F\u8BFA\uFF1A**");
152
+ for (const c of record.commitments) {
153
+ lines.push(`\u2022 ${c.content}`);
154
+ lines.push(` \u76F8\u5173\u65B9\uFF1A${c.participants.join("\u3001")}${c.deadline ? `\uFF0C\u622A\u6B62 ${c.deadline}` : ""}`);
155
+ lines.push(` \u{1F4A1} ${c.context}`);
156
+ }
157
+ }
158
+ if (record.reusableInsights.length > 0) {
159
+ lines.push("", "\u{1F9E0} **\u53EF\u590D\u7528\u77E5\u8BC6\uFF1A**");
160
+ for (const r of record.reusableInsights) {
161
+ lines.push(`\u2022 [${r.category}] ${r.content}`);
162
+ lines.push(` \u9002\u7528\u573A\u666F\uFF1A${r.scenario}`);
163
+ }
164
+ }
165
+ await this.replyText(messageId, lines.join("\n"));
166
+ }
167
+ async replyRecordList(messageId, records) {
168
+ if (records.length === 0) {
169
+ await this.replyText(messageId, "\u6682\u65E0\u4F1A\u8BAE\u8BB0\u5F55");
170
+ return;
171
+ }
172
+ const lines = [`\u{1F4C2} \u5171 ${records.length} \u6761\u4F1A\u8BAE\u8BB0\u5F55\uFF1A`, ""];
173
+ for (const r of records) {
174
+ lines.push(`\u2022 ${r.id}`);
175
+ lines.push(` ${r.summary.title}\uFF08${r.summary.date}\uFF09`);
176
+ if (r.documentUrl) lines.push(` ${r.documentUrl}`);
177
+ lines.push("");
178
+ }
179
+ lines.push("\u4F7F\u7528 /show <id> \u67E5\u770B\u8BE6\u60C5\uFF0C/del <id> \u5220\u9664\u8BB0\u5F55");
180
+ await this.replyText(messageId, lines.join("\n"));
181
+ }
182
+ async replyRecordDetail(messageId, record) {
183
+ const lines = [
184
+ `\u{1F4CB} **${record.summary.title}**`,
185
+ `\u{1F4C5} \u65E5\u671F\uFF1A${record.summary.date}`,
186
+ `\u{1F465} \u53C2\u4E0E\u4EBA\uFF1A${record.summary.participants.join("\u3001")}`,
187
+ `\u{1F194} ${record.id}`
188
+ ];
189
+ if (record.documentUrl) {
190
+ lines.push(`\u{1F517} ${record.documentUrl}`);
191
+ }
192
+ lines.push("", "**\u6838\u5FC3\u8981\u70B9\uFF1A**");
193
+ for (const p of record.summary.keyPoints) {
194
+ lines.push(`\u2022 ${p}`);
195
+ }
196
+ if (record.commitments && record.commitments.length > 0) {
197
+ lines.push("", "\u{1F91D} **\u5173\u952E\u5171\u8BC6\u4E0E\u627F\u8BFA\uFF1A**");
198
+ for (const c of record.commitments) {
199
+ lines.push(`\u2022 ${c.content}`);
200
+ lines.push(` \u76F8\u5173\u65B9\uFF1A${c.participants.join("\u3001")}${c.deadline ? `\uFF0C\u622A\u6B62 ${c.deadline}` : ""}`);
201
+ lines.push(` \u{1F4A1} ${c.context}`);
202
+ }
203
+ }
204
+ if (record.reusableInsights && record.reusableInsights.length > 0) {
205
+ lines.push("", "\u{1F9E0} **\u53EF\u590D\u7528\u77E5\u8BC6\uFF1A**");
206
+ for (const r of record.reusableInsights) {
207
+ lines.push(`\u2022 [${r.category}] ${r.content}`);
208
+ lines.push(` \u9002\u7528\u573A\u666F\uFF1A${r.scenario}`);
209
+ }
210
+ }
211
+ if (record.todos && record.todos.length > 0) {
212
+ lines.push("", "**\u5F85\u529E\u4E8B\u9879\uFF1A**");
213
+ for (const t of record.todos) {
214
+ lines.push(`\u2022 ${t.content}\uFF08${t.owner}\uFF0C\u622A\u6B62 ${t.deadline}\uFF09`);
215
+ }
216
+ }
217
+ if (record.risks && record.risks.length > 0) {
218
+ lines.push("", "**\u98CE\u9669\u9879\uFF1A**");
219
+ for (const r of record.risks) {
220
+ lines.push(`\u2022 [${r.severity}] ${r.description}`);
221
+ }
222
+ }
223
+ await this.replyText(messageId, lines.join("\n"));
224
+ }
225
+ async replySearchResults(messageId, results) {
226
+ if (results.length === 0) {
227
+ await this.replyText(messageId, "\u672A\u627E\u5230\u76F8\u5173\u4F1A\u8BAE\u8BB0\u5F55");
228
+ return;
229
+ }
230
+ const lines = ["\u{1F50D} \u627E\u5230\u4EE5\u4E0B\u76F8\u5173\u4F1A\u8BAE\uFF1A", ""];
231
+ for (const r of results.slice(0, 3)) {
232
+ lines.push(`\u2022 **${r.summary.title}**\uFF08${r.summary.date}\uFF09`);
233
+ lines.push(` \u8981\u70B9\uFF1A${r.summary.keyPoints[0] || "\u65E0"}`);
234
+ lines.push(` \u94FE\u63A5\uFF1A${r.documentUrl}`);
235
+ lines.push("");
236
+ }
237
+ await this.replyText(messageId, lines.join("\n"));
238
+ }
239
+ async replyTodoConfirmation(messageId, todos) {
240
+ const lines = [
241
+ `\u{1F4DD} \u68C0\u6D4B\u5230 ${todos.length} \u6761\u5F85\u529E\uFF0C\u662F\u5426\u521B\u5EFA\u98DE\u4E66\u4EFB\u52A1\uFF1F`,
242
+ ""
243
+ ];
244
+ todos.forEach((t, i) => {
245
+ lines.push(`${i + 1}. [${t.owner}] ${t.content}${t.deadline ? `\uFF08\u622A\u6B62 ${t.deadline}\uFF09` : ""}`);
246
+ });
247
+ lines.push("", "\u56DE\u590D /confirm all \u521B\u5EFA\u5168\u90E8");
248
+ lines.push("\u56DE\u590D /confirm 1,2 \u521B\u5EFA\u9009\u4E2D\u7684\u4EFB\u52A1");
249
+ lines.push("\u56DE\u590D /reject \u53D6\u6D88\u521B\u5EFA");
250
+ lines.push("", "\u23F1 3 \u5206\u949F\u5185\u672A\u56DE\u590D\u5C06\u81EA\u52A8\u53D6\u6D88");
251
+ await this.replyText(messageId, lines.join("\n"));
252
+ }
253
+ async replyTaskResults(messageId, results) {
254
+ const lines = ["\u{1F4CB} \u98DE\u4E66\u4EFB\u52A1\u521B\u5EFA\u7ED3\u679C\uFF1A", ""];
255
+ for (const r of results) {
256
+ if (r.success) {
257
+ lines.push(`\u2705 ${r.summary}`);
258
+ if (r.url) lines.push(` ${r.url}`);
259
+ } else {
260
+ lines.push(`\u274C ${r.summary} \u2014 ${r.error || "\u521B\u5EFA\u5931\u8D25"}`);
261
+ }
262
+ }
263
+ await this.replyText(messageId, lines.join("\n"));
264
+ }
265
+ /**
266
+ * 给消息添加表情回应(Reaction),返回 reaction_id
267
+ */
268
+ async addReaction(messageId, emojiType) {
269
+ const res = await this.client.im.messageReaction.create({
270
+ path: { message_id: messageId },
271
+ data: { reaction_type: { emoji_type: emojiType } }
272
+ });
273
+ return res.data?.reaction_id || "";
274
+ }
275
+ /**
276
+ * 删除指定的表情回应
277
+ */
278
+ async removeReaction(messageId, reactionId) {
279
+ try {
280
+ if (!reactionId) return;
281
+ await this.client.im.messageReaction.delete({
282
+ path: { message_id: messageId, reaction_id: reactionId }
283
+ });
284
+ } catch {
285
+ }
286
+ }
287
+ /**
288
+ * 主动向指定用户发送消息(不需要先收到消息)
289
+ */
290
+ async sendToUser(openId, text) {
291
+ await this.client.im.message.create({
292
+ params: { receive_id_type: "open_id" },
293
+ data: {
294
+ receive_id: openId,
295
+ content: JSON.stringify({ text }),
296
+ msg_type: "text"
297
+ }
298
+ });
299
+ }
300
+ };
301
+
115
302
  // src/lark/router.ts
116
303
  function parseMessage(text) {
117
304
  const trimmed = text.trim();
@@ -410,11 +597,9 @@ var SESSION_SKILL = `\u4F60\u662F KMR\uFF08Key Meetings Record\uFF09\u7684\u667A
410
597
  - kmr task \u2014 \u67E5\u770B\u6240\u6709\u4EFB\u52A1
411
598
  - kmr del <id> \u2014 \u5220\u9664\u8BB0\u5F55
412
599
  - kmr create-task <\u4EFB\u52A1\u6807\u9898> [--due YYYY-MM-DD] [--assignee \u59D3\u540D] [--desc \u63CF\u8FF0] \u2014 \u521B\u5EFA\u98DE\u4E66\u4EFB\u52A1
413
- - kmr send <\u6D88\u606F\u5185\u5BB9> \u2014 \u5411\u7BA1\u7406\u5458\u53D1\u9001\u98DE\u4E66\u6D88\u606F
414
600
 
415
601
  \u64CD\u4F5C\u6307\u5357\uFF1A
416
602
  - \u5F53\u7528\u6237\u8981\u6C42\u521B\u5EFA\u4EFB\u52A1\u65F6\uFF0C\u76F4\u63A5\u6267\u884C kmr create-task \u547D\u4EE4\uFF0C\u4F8B\u5982\uFF1Akmr create-task "\u5B8C\u6210\u65B9\u6848\u8BBE\u8BA1" --due 2026-05-15 --assignee \u5F20\u4E09
417
- - \u5F53\u7528\u6237\u8981\u6C42\u53D1\u6D88\u606F\u7ED9\u7BA1\u7406\u5458\u6216\u901A\u77E5\u67D0\u4EBA\u65F6\uFF0C\u4F7F\u7528 kmr send \u547D\u4EE4
418
603
  - \u5F53\u7528\u6237\u95EE\u5230\u4F1A\u8BAE/\u4EFB\u52A1\u76F8\u5173\u7684\u95EE\u9898\u65F6\uFF0C\u5148\u6267\u884C kmr \u547D\u4EE4\u83B7\u53D6\u6570\u636E\u518D\u56DE\u7B54
419
604
  - \u63D0\u793A\u7528\u6237\u5728\u98DE\u4E66\u5BF9\u8BDD\u4E2D\u4E5F\u53EF\u4EE5\u76F4\u63A5\u4F7F\u7528\uFF1A/find \u641C\u7D22\u3001/list \u5217\u51FA\u5168\u90E8\u3001/show <id> \u67E5\u770B\u8BE6\u60C5\u3001/del <id> \u5220\u9664\u3001/task \u67E5\u770B\u4EFB\u52A1
420
605
 
@@ -455,8 +640,6 @@ var SessionManager = class {
455
640
  const sessionName = `kmr-${userId}`;
456
641
  const userDir = path2.join(this.sessionDir, userId);
457
642
  fs2.mkdirSync(userDir, { recursive: true });
458
- const skillPath = path2.join(userDir, "skill.md");
459
- fs2.writeFileSync(skillPath, SESSION_SKILL, "utf-8");
460
643
  console.log(`[session] \u521B\u5EFA\u65B0 session: ${sessionName}`);
461
644
  const agentCmd = this.getAgentCmd();
462
645
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lih-x-x/kmr",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,193 +0,0 @@
1
- // src/lark/messenger.ts
2
- var Messenger = class {
3
- constructor(client) {
4
- this.client = client;
5
- }
6
- client;
7
- async replyText(messageId, text) {
8
- await this.client.im.message.reply({
9
- path: { message_id: messageId },
10
- data: {
11
- content: JSON.stringify({ text }),
12
- msg_type: "text"
13
- }
14
- });
15
- }
16
- async replyMeetingSummary(messageId, record) {
17
- const lines = [
18
- `\u2705 \u4F1A\u8BAE\u5173\u952E\u4FE1\u606F\u63D0\u53D6\u5B8C\u6210`,
19
- "",
20
- `\u{1F4CB} **${record.summary.title}**`,
21
- `\u{1F4C5} \u65E5\u671F\uFF1A${record.summary.date}`,
22
- `\u{1F465} \u53C2\u4E0E\u4EBA\uFF1A${record.summary.participants.join("\u3001")}`,
23
- "",
24
- "**\u6838\u5FC3\u8981\u70B9\uFF1A**",
25
- ...record.summary.keyPoints.map((p) => `\u2022 ${p}`)
26
- ];
27
- if (record.todos.length > 0) {
28
- lines.push("", "**\u5F85\u529E\u4E8B\u9879\uFF1A**");
29
- for (const todo of record.todos) {
30
- lines.push(`\u2022 ${todo.content}\uFF08${todo.owner}\uFF0C\u622A\u6B62 ${todo.deadline}\uFF09`);
31
- }
32
- }
33
- if (record.risks.length > 0) {
34
- lines.push("", "**\u98CE\u9669\u9879\uFF1A**");
35
- for (const risk of record.risks) {
36
- lines.push(`\u2022 [${risk.severity}] ${risk.description}`);
37
- }
38
- }
39
- if (record.commitments.length > 0) {
40
- lines.push("", "\u{1F91D} **\u5173\u952E\u5171\u8BC6\u4E0E\u627F\u8BFA\uFF1A**");
41
- for (const c of record.commitments) {
42
- lines.push(`\u2022 ${c.content}`);
43
- lines.push(` \u76F8\u5173\u65B9\uFF1A${c.participants.join("\u3001")}${c.deadline ? `\uFF0C\u622A\u6B62 ${c.deadline}` : ""}`);
44
- lines.push(` \u{1F4A1} ${c.context}`);
45
- }
46
- }
47
- if (record.reusableInsights.length > 0) {
48
- lines.push("", "\u{1F9E0} **\u53EF\u590D\u7528\u77E5\u8BC6\uFF1A**");
49
- for (const r of record.reusableInsights) {
50
- lines.push(`\u2022 [${r.category}] ${r.content}`);
51
- lines.push(` \u9002\u7528\u573A\u666F\uFF1A${r.scenario}`);
52
- }
53
- }
54
- await this.replyText(messageId, lines.join("\n"));
55
- }
56
- async replyRecordList(messageId, records) {
57
- if (records.length === 0) {
58
- await this.replyText(messageId, "\u6682\u65E0\u4F1A\u8BAE\u8BB0\u5F55");
59
- return;
60
- }
61
- const lines = [`\u{1F4C2} \u5171 ${records.length} \u6761\u4F1A\u8BAE\u8BB0\u5F55\uFF1A`, ""];
62
- for (const r of records) {
63
- lines.push(`\u2022 ${r.id}`);
64
- lines.push(` ${r.summary.title}\uFF08${r.summary.date}\uFF09`);
65
- if (r.documentUrl) lines.push(` ${r.documentUrl}`);
66
- lines.push("");
67
- }
68
- lines.push("\u4F7F\u7528 /show <id> \u67E5\u770B\u8BE6\u60C5\uFF0C/del <id> \u5220\u9664\u8BB0\u5F55");
69
- await this.replyText(messageId, lines.join("\n"));
70
- }
71
- async replyRecordDetail(messageId, record) {
72
- const lines = [
73
- `\u{1F4CB} **${record.summary.title}**`,
74
- `\u{1F4C5} \u65E5\u671F\uFF1A${record.summary.date}`,
75
- `\u{1F465} \u53C2\u4E0E\u4EBA\uFF1A${record.summary.participants.join("\u3001")}`,
76
- `\u{1F194} ${record.id}`
77
- ];
78
- if (record.documentUrl) {
79
- lines.push(`\u{1F517} ${record.documentUrl}`);
80
- }
81
- lines.push("", "**\u6838\u5FC3\u8981\u70B9\uFF1A**");
82
- for (const p of record.summary.keyPoints) {
83
- lines.push(`\u2022 ${p}`);
84
- }
85
- if (record.commitments && record.commitments.length > 0) {
86
- lines.push("", "\u{1F91D} **\u5173\u952E\u5171\u8BC6\u4E0E\u627F\u8BFA\uFF1A**");
87
- for (const c of record.commitments) {
88
- lines.push(`\u2022 ${c.content}`);
89
- lines.push(` \u76F8\u5173\u65B9\uFF1A${c.participants.join("\u3001")}${c.deadline ? `\uFF0C\u622A\u6B62 ${c.deadline}` : ""}`);
90
- lines.push(` \u{1F4A1} ${c.context}`);
91
- }
92
- }
93
- if (record.reusableInsights && record.reusableInsights.length > 0) {
94
- lines.push("", "\u{1F9E0} **\u53EF\u590D\u7528\u77E5\u8BC6\uFF1A**");
95
- for (const r of record.reusableInsights) {
96
- lines.push(`\u2022 [${r.category}] ${r.content}`);
97
- lines.push(` \u9002\u7528\u573A\u666F\uFF1A${r.scenario}`);
98
- }
99
- }
100
- if (record.todos && record.todos.length > 0) {
101
- lines.push("", "**\u5F85\u529E\u4E8B\u9879\uFF1A**");
102
- for (const t of record.todos) {
103
- lines.push(`\u2022 ${t.content}\uFF08${t.owner}\uFF0C\u622A\u6B62 ${t.deadline}\uFF09`);
104
- }
105
- }
106
- if (record.risks && record.risks.length > 0) {
107
- lines.push("", "**\u98CE\u9669\u9879\uFF1A**");
108
- for (const r of record.risks) {
109
- lines.push(`\u2022 [${r.severity}] ${r.description}`);
110
- }
111
- }
112
- await this.replyText(messageId, lines.join("\n"));
113
- }
114
- async replySearchResults(messageId, results) {
115
- if (results.length === 0) {
116
- await this.replyText(messageId, "\u672A\u627E\u5230\u76F8\u5173\u4F1A\u8BAE\u8BB0\u5F55");
117
- return;
118
- }
119
- const lines = ["\u{1F50D} \u627E\u5230\u4EE5\u4E0B\u76F8\u5173\u4F1A\u8BAE\uFF1A", ""];
120
- for (const r of results.slice(0, 3)) {
121
- lines.push(`\u2022 **${r.summary.title}**\uFF08${r.summary.date}\uFF09`);
122
- lines.push(` \u8981\u70B9\uFF1A${r.summary.keyPoints[0] || "\u65E0"}`);
123
- lines.push(` \u94FE\u63A5\uFF1A${r.documentUrl}`);
124
- lines.push("");
125
- }
126
- await this.replyText(messageId, lines.join("\n"));
127
- }
128
- async replyTodoConfirmation(messageId, todos) {
129
- const lines = [
130
- `\u{1F4DD} \u68C0\u6D4B\u5230 ${todos.length} \u6761\u5F85\u529E\uFF0C\u662F\u5426\u521B\u5EFA\u98DE\u4E66\u4EFB\u52A1\uFF1F`,
131
- ""
132
- ];
133
- todos.forEach((t, i) => {
134
- lines.push(`${i + 1}. [${t.owner}] ${t.content}${t.deadline ? `\uFF08\u622A\u6B62 ${t.deadline}\uFF09` : ""}`);
135
- });
136
- lines.push("", "\u56DE\u590D /confirm all \u521B\u5EFA\u5168\u90E8");
137
- lines.push("\u56DE\u590D /confirm 1,2 \u521B\u5EFA\u9009\u4E2D\u7684\u4EFB\u52A1");
138
- lines.push("\u56DE\u590D /reject \u53D6\u6D88\u521B\u5EFA");
139
- lines.push("", "\u23F1 3 \u5206\u949F\u5185\u672A\u56DE\u590D\u5C06\u81EA\u52A8\u53D6\u6D88");
140
- await this.replyText(messageId, lines.join("\n"));
141
- }
142
- async replyTaskResults(messageId, results) {
143
- const lines = ["\u{1F4CB} \u98DE\u4E66\u4EFB\u52A1\u521B\u5EFA\u7ED3\u679C\uFF1A", ""];
144
- for (const r of results) {
145
- if (r.success) {
146
- lines.push(`\u2705 ${r.summary}`);
147
- if (r.url) lines.push(` ${r.url}`);
148
- } else {
149
- lines.push(`\u274C ${r.summary} \u2014 ${r.error || "\u521B\u5EFA\u5931\u8D25"}`);
150
- }
151
- }
152
- await this.replyText(messageId, lines.join("\n"));
153
- }
154
- /**
155
- * 给消息添加表情回应(Reaction),返回 reaction_id
156
- */
157
- async addReaction(messageId, emojiType) {
158
- const res = await this.client.im.messageReaction.create({
159
- path: { message_id: messageId },
160
- data: { reaction_type: { emoji_type: emojiType } }
161
- });
162
- return res.data?.reaction_id || "";
163
- }
164
- /**
165
- * 删除指定的表情回应
166
- */
167
- async removeReaction(messageId, reactionId) {
168
- try {
169
- if (!reactionId) return;
170
- await this.client.im.messageReaction.delete({
171
- path: { message_id: messageId, reaction_id: reactionId }
172
- });
173
- } catch {
174
- }
175
- }
176
- /**
177
- * 主动向指定用户发送消息(不需要先收到消息)
178
- */
179
- async sendToUser(openId, text) {
180
- await this.client.im.message.create({
181
- params: { receive_id_type: "open_id" },
182
- data: {
183
- receive_id: openId,
184
- content: JSON.stringify({ text }),
185
- msg_type: "text"
186
- }
187
- });
188
- }
189
- };
190
-
191
- export {
192
- Messenger
193
- };
@@ -1,6 +0,0 @@
1
- import {
2
- Messenger
3
- } from "./chunk-VYFCZATK.js";
4
- export {
5
- Messenger
6
- };