duclaw-cli 1.8.28 → 1.8.30

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/bundle.js CHANGED
@@ -30242,7 +30242,7 @@ function printHelp() {
30242
30242
  `);
30243
30243
  }
30244
30244
  function printVersion() {
30245
- console.log(`duclaw-cli v${true ? "1.8.28" : "unknown"}`);
30245
+ console.log(`duclaw-cli v${true ? "1.8.30" : "unknown"}`);
30246
30246
  }
30247
30247
  function getDuclawTemplate() {
30248
30248
  return {
@@ -41559,6 +41559,39 @@ var create_agent_events_table = () => {
41559
41559
  `);
41560
41560
  };
41561
41561
 
41562
+ // src/agent/interruptRegistry.ts
41563
+ var registry = /* @__PURE__ */ new Map();
41564
+ var markRunning = (userId) => {
41565
+ const current = registry.get(userId);
41566
+ if (current) {
41567
+ current.startedAt = Date.now();
41568
+ return;
41569
+ }
41570
+ registry.set(userId, { messages: [], startedAt: Date.now() });
41571
+ };
41572
+ var markDone = (userId) => {
41573
+ registry.delete(userId);
41574
+ };
41575
+ var hasRunningAgent = (userId) => {
41576
+ return registry.has(userId);
41577
+ };
41578
+ var queueInterrupt = (userId, message) => {
41579
+ const entry = registry.get(userId);
41580
+ if (!entry) return false;
41581
+ const interruptMessage = typeof message === "string" ? { content: message } : message;
41582
+ entry.messages.push(interruptMessage);
41583
+ console.log(`[interrupt] \u7528\u6237 ${userId} \u65B0\u6D88\u606F\u5DF2\u5165\u961F\uFF0C\u5F53\u524D\u961F\u5217\u957F\u5EA6: ${entry.messages.length}`);
41584
+ return true;
41585
+ };
41586
+ var drainInterrupts = (userId) => {
41587
+ const entry = registry.get(userId);
41588
+ if (!entry || entry.messages.length === 0) return [];
41589
+ const messages = [...entry.messages];
41590
+ entry.messages.length = 0;
41591
+ console.log(`[interrupt] \u7528\u6237 ${userId} drain ${messages.length} \u6761\u4E2D\u65AD\u6D88\u606F`);
41592
+ return messages;
41593
+ };
41594
+
41562
41595
  // src/department/mailbox/events.ts
41563
41596
  var import_node_crypto2 = require("node:crypto");
41564
41597
  var parseDetail = (detailJson) => {
@@ -41911,6 +41944,41 @@ var cancelMailboxMessages = (mailboxId) => {
41911
41944
  }
41912
41945
  return messages.length;
41913
41946
  };
41947
+ var buildMailboxInterruptContent = (msg) => {
41948
+ const from = msg.fromMailboxId;
41949
+ return [
41950
+ `<system_reminder>`,
41951
+ `\u4F60\u7684 mailbox \u6536\u5230\u4E00\u5C01\u65B0\u7684\u5185\u90E8\u534F\u4F5C\u6D88\u606F\u3002`,
41952
+ ``,
41953
+ `message_id: ${msg.id}`,
41954
+ `from: ${from}`,
41955
+ `thread: ${msg.threadId || msg.id}`,
41956
+ ``,
41957
+ `\u8FD9\u662F\u4E00\u6761\u4E2D\u65AD\u63D0\u9192\uFF0C\u4E0D\u4EE3\u8868\u90AE\u4EF6\u5DF2\u88AB\u9886\u53D6\u3002\u8BF7\u5C3D\u5FEB\u91CD\u65B0\u8BC4\u4F30\u5F53\u524D\u5DE5\u4F5C\u4F18\u5148\u7EA7\uFF1A`,
41958
+ `1. \u8C03\u7528 list_mailbox \u67E5\u770B\u5F85\u5904\u7406\u961F\u5217\u3002`,
41959
+ `2. \u5982\u8BE5\u6D88\u606F\u66F4\u7D27\u6025\uFF0C\u8C03\u7528 get_mailbox(message_id="${msg.id}") \u9886\u53D6\u5E76\u8BFB\u53D6\u3002`,
41960
+ `3. \u5982\u679C\u4F60\u6B63\u5728\u8FD0\u884C\u957F\u4EFB\u52A1\uFF0C\u5E94\u5148\u8BB0\u5F55\u5F53\u524D\u8FDB\u5C55\uFF0C\u5FC5\u8981\u65F6\u7528 mailbox_followup \u540C\u6B65\u72B6\u6001\uFF0C\u518D\u5904\u7406\u8FD9\u5C01\u65B0\u6D88\u606F\u3002`,
41961
+ `4. \u5F62\u6210\u6B63\u5F0F\u7B54\u590D\u540E\u5FC5\u987B\u7528 reply_mailbox \u56DE\u590D\u5BF9\u5E94 message_id\u3002`,
41962
+ `</system_reminder>`
41963
+ ].join("\n");
41964
+ };
41965
+ var queueMailboxInterruptIfRunning = (msg) => {
41966
+ if (msg.toMailboxId === "manager") return;
41967
+ if (!hasRunningAgent(msg.toMailboxId)) return;
41968
+ const queued = queueInterrupt(msg.toMailboxId, {
41969
+ content: buildMailboxInterruptContent(msg),
41970
+ metadata: {
41971
+ trigger: "mailbox.message_received",
41972
+ mailboxMessageId: msg.id,
41973
+ fromMailboxId: msg.fromMailboxId,
41974
+ toMailboxId: msg.toMailboxId,
41975
+ threadId: msg.threadId || msg.id
41976
+ }
41977
+ });
41978
+ if (queued) {
41979
+ console.log(`[mailbox] \u76EE\u6807 agent ${msg.toMailboxId} \u6B63\u5728\u8FD0\u884C\uFF0C\u5DF2\u5C06\u65B0\u90AE\u4EF6 ${msg.id} \u4F5C\u4E3A\u4E2D\u65AD\u63D0\u9192\u5165\u961F`);
41980
+ }
41981
+ };
41914
41982
  var sendMessage2 = (fromMailboxId, toMailboxId, content, options) => {
41915
41983
  const db3 = createSqliteDB();
41916
41984
  const stmt = db3.prepare(`insert into mailbox (
@@ -41963,6 +42031,7 @@ var sendMessage2 = (fromMailboxId, toMailboxId, content, options) => {
41963
42031
  },
41964
42032
  createdAt: mailboxMsg.sendTime
41965
42033
  });
42034
+ queueMailboxInterruptIfRunning(mailboxMsg);
41966
42035
  return mailboxMsg;
41967
42036
  };
41968
42037
  var updateMailboxMessageStatus = (messageId, nextStatus, options) => {
@@ -42478,7 +42547,15 @@ var checkDepartmentReplies = {
42478
42547
  msgs = stmt.all();
42479
42548
  }
42480
42549
  if (msgs.length === 0) {
42481
- return `[checkDepartmentReplies] \u6682\u65E0\u90E8\u95E8\u56DE\u4FE1\u3002\u6210\u5458\u53EF\u80FD\u4ECD\u5728\u5904\u7406\u4EFB\u52A1\u4E2D\uFF0C\u8BF7\u7A0D\u540E\u518D\u67E5\u3002`;
42550
+ return [
42551
+ `[checkDepartmentReplies] \u6682\u65E0\u90E8\u95E8\u56DE\u4FE1\u3002\u6210\u5458\u53EF\u80FD\u4ECD\u5728\u5904\u7406\u4EFB\u52A1\u4E2D\uFF0C\u8BF7\u7A0D\u540E\u518D\u67E5\u3002`,
42552
+ ``,
42553
+ `\u6CBB\u7406\u63D0\u793A\uFF1A`,
42554
+ `- \u8FD9\u4E0D\u662F\u8BA9 CEO \u4EB2\u81EA read/bash/\u6D4B\u8BD5/\u6539\u4EE3\u7801\u7684\u4FE1\u53F7\u3002`,
42555
+ `- \u5982\u679C\u7528\u6237\u6B63\u5728\u7B49\u5F85\uFF0C\u8BF7\u5148\u7528 send_message \u7B80\u77ED\u8BF4\u660E\u201C\u8D1F\u8D23\u4EBA\u8FD8\u5728\u5904\u7406\uFF0C\u6211\u7A0D\u540E\u540C\u6B65\u7ED3\u679C\u201D\u3002`,
42556
+ `- \u5982\u679C\u5DF2\u7ECF\u7B49\u5F85\u8F83\u4E45\uFF0C\u4F7F\u7528 mailbox_followup \u6216 department_communicate \u50AC\u95EE\u5BF9\u5E94 Department Head \u7684\u771F\u5B9E\u8FDB\u5C55\u3001\u963B\u585E\u9879\u548C\u9884\u8BA1\u5B8C\u6210\u65F6\u95F4\u3002`,
42557
+ `- \u4E4B\u540E\u518D\u8C03\u7528 check_department_replies \u67E5\u770B\u56DE\u4FE1\u3002`
42558
+ ].join("\n");
42482
42559
  }
42483
42560
  const updateStmt = db3.prepare(`UPDATE mailbox SET status = 'read' WHERE id = ?`);
42484
42561
  for (const msg of msgs) {
@@ -43689,39 +43766,6 @@ var recallChatHistory = (messageStorage, topicStorage, recallIndexStorage) => ({
43689
43766
  }
43690
43767
  });
43691
43768
 
43692
- // src/agent/interruptRegistry.ts
43693
- var registry = /* @__PURE__ */ new Map();
43694
- var markRunning = (userId) => {
43695
- const current = registry.get(userId);
43696
- if (current) {
43697
- current.startedAt = Date.now();
43698
- return;
43699
- }
43700
- registry.set(userId, { messages: [], startedAt: Date.now() });
43701
- };
43702
- var markDone = (userId) => {
43703
- registry.delete(userId);
43704
- };
43705
- var hasRunningAgent = (userId) => {
43706
- return registry.has(userId);
43707
- };
43708
- var queueInterrupt = (userId, message) => {
43709
- const entry = registry.get(userId);
43710
- if (!entry) return false;
43711
- const interruptMessage = typeof message === "string" ? { content: message } : message;
43712
- entry.messages.push(interruptMessage);
43713
- console.log(`[interrupt] \u7528\u6237 ${userId} \u65B0\u6D88\u606F\u5DF2\u5165\u961F\uFF0C\u5F53\u524D\u961F\u5217\u957F\u5EA6: ${entry.messages.length}`);
43714
- return true;
43715
- };
43716
- var drainInterrupts = (userId) => {
43717
- const entry = registry.get(userId);
43718
- if (!entry || entry.messages.length === 0) return [];
43719
- const messages = [...entry.messages];
43720
- entry.messages.length = 0;
43721
- console.log(`[interrupt] \u7528\u6237 ${userId} drain ${messages.length} \u6761\u4E2D\u65AD\u6D88\u606F`);
43722
- return messages;
43723
- };
43724
-
43725
43769
  // src/dream/dreamPrompt.ts
43726
43770
  var DREAM_MAX_MESSAGE_CHARS = 1e4;
43727
43771
  var DREAM_MAX_TEXT_BLOCK_CHARS = 400;
@@ -45214,6 +45258,13 @@ The user will primarily request you perform software engineering tasks. This inc
45214
45258
  - \u9ED8\u8BA4\u4E0D\u66B4\u9732\u8DE8\u5C42\u7EA7/\u8DE8\u90E8\u95E8\u901A\u4FE1\u5730\u5740\uFF1B\u5982\u679C agent \u5DF2\u77E5\u5730\u5740\uFF0C\u901A\u4FE1\u4E0D\u5E94\u88AB\u786C\u6027\u963B\u6B62\uFF0C\u4F46\u8981\u5C0A\u91CD\u7EC4\u7EC7\u8D23\u4EFB\u5E76\u7559\u4E0B\u5BA1\u8BA1\u8BB0\u5F55
45215
45259
  - \u4FDD\u6301\u8D23\u4EFB\u5F52\u5C5E\u7A33\u5B9A\uFF1A\u67D0\u4E2A Department Head \u5DF2\u7ECF\u8D1F\u8D23\u7684\u4EA7\u51FA\uFF0C\u540E\u7EED\u4FEE\u8BA2\u3001\u8FD4\u5DE5\u3001bug \u4FEE\u590D\u9ED8\u8BA4\u4ECD\u7531\u8BE5 Department Head \u8D1F\u8D23\uFF0C\u901A\u5E38\u5E94\u901A\u8FC7 mailbox_followup \u63A5\u56DE\u539F\u7EBF\u7A0B
45216
45260
 
45261
+ ## \u4E13\u4E1A\u56E2\u961F\u4F18\u5148\u786C\u89C4\u5219
45262
+ - \u53EA\u8981\u7EC4\u7EC7\u91CC\u5DF2\u7ECF\u5B58\u5728\u804C\u8D23\u5339\u914D\u7684 Department \u6216 Department Head\uFF0CCEO \u9ED8\u8BA4\u4E0D\u4EB2\u81EA\u505A\u8BE5\u4E13\u4E1A\u56E2\u961F\u8986\u76D6\u7684\u6267\u884C\u5DE5\u4F5C\u3002
45263
+ - \u201C\u4E13\u4E1A\u56E2\u961F\u8986\u76D6\u201D\u5305\u62EC\u4F46\u4E0D\u9650\u4E8E\uFF1A\u5199\u4EE3\u7801\u3001\u8BFB\u4EE3\u7801\u5B9A\u4F4D\u95EE\u9898\u3001\u6539\u6587\u4EF6\u3001\u8DD1\u6D4B\u8BD5\u3001\u8C03\u8BD5\u3001\u90E8\u7F72\u3001\u6570\u636E\u5904\u7406\u3001\u6587\u6863/\u97F3\u9891/\u56FE\u7247\u5904\u7406\u3001\u5916\u90E8 API \u9A8C\u8BC1\u3001\u62A5\u544A\u751F\u6210\u7B49\u3002
45264
+ - CEO \u7684\u6B63\u786E\u52A8\u4F5C\u662F department_list \u5B9A\u4F4D\u56E2\u961F\uFF0Cdepartment_communicate \u59D4\u6D3E\u6216\u8FFD\u95EE\uFF0Cmailbox_followup \u50AC\u529E/\u8865\u5145\u4E0A\u4E0B\u6587\uFF0Ccheck_department_replies \u6536\u96C6\u7ED3\u679C\uFF0C\u7136\u540E\u6C47\u603B\u7ED9\u7528\u6237\u3002
45265
+ - Department Head \u6682\u65E0\u56DE\u4FE1\u3001\u56DE\u590D\u6162\u3001\u6216 check_department_replies \u8FD4\u56DE\u7A7A\uFF0C\u4E0D\u6784\u6210 CEO \u4E0B\u573A\u5E72\u6D3B\u7684\u7406\u7531\uFF1B\u5E94\u8BE5\u7A0D\u540E\u518D\u67E5\u3001\u50AC\u95EE\u8D1F\u8D23\u4EBA\uFF0C\u6216\u7528 send_message \u544A\u8BC9\u7528\u6237\u201C\u56E2\u961F\u4ECD\u5728\u5904\u7406\uFF0C\u6211\u7A0D\u540E\u540C\u6B65\u201D\u3002
45266
+ - \u53EA\u6709\u5728\u7528\u6237\u660E\u786E\u8981\u6C42\u201CCEO/\u4F60\u4EB2\u81EA\u505A\u201D\u3001\u6CA1\u6709\u4EFB\u4F55\u804C\u8D23\u5339\u914D\u56E2\u961F/\u8D1F\u8D23\u4EBA\u3001\u6216\u56E2\u961F\u660E\u786E\u5931\u8D25\u4E14\u7528\u6237\u540C\u610F CEO \u63A5\u7BA1\u65F6\uFF0CCEO \u624D\u80FD\u8D8A\u8FC7\u56E2\u961F\u4EB2\u81EA\u6267\u884C\u4E13\u4E1A\u5DE5\u4F5C\u3002
45267
+
45217
45268
  ## \u8D23\u4EFB\u5F52\u5C5E\u786C\u89C4\u5219
45218
45269
  - Department Head \u4EA4\u4ED8\u7ED3\u679C\u540E\uFF0C\u5982\u679C\u7528\u6237\u53CD\u9988\u201C\u6253\u4E0D\u5F00\u201D\u201C\u6709 bug\u201D\u201C\u5E2E\u6211\u6539\u4E00\u4E0B\u201D\u201C\u518D\u51FA\u4E00\u7248\u201D\u7B49\uFF0C\u8FD9\u5C5E\u4E8E\u5BF9\u65E2\u6709\u4EA7\u51FA\u7684\u8FD4\u5DE5\u6216\u8FED\u4EE3\uFF0C\u9ED8\u8BA4\u5E94\u7EE7\u7EED\u4EA4\u7ED9\u539F\u8D23\u4EFB Department Head \u5904\u7406
45219
45270
  - \u4F18\u5148\u4F7F\u7528 mailbox_followup \u5BF9\u8BE5 Department Head \u6700\u8FD1\u4E00\u6B21\u76F8\u5173\u56DE\u4FE1\u8FFD\u52A0\u53CD\u9988\uFF0C\u907F\u514D CEO \u4EB2\u81EA\u4E0B\u573A\u91CD\u505A\u5B9E\u73B0
@@ -50634,6 +50685,60 @@ agentRoutes.get("/goals/:gid/chat/logs", async (c) => {
50634
50685
 
50635
50686
  // src/server/routes/departments.ts
50636
50687
  var departmentRoutes = new Hono2();
50688
+ var toBeijingDateKeys = (days = 7) => {
50689
+ const now = /* @__PURE__ */ new Date();
50690
+ return Array.from({ length: days }, (_, i) => {
50691
+ const d = new Date(now.getTime() - i * 864e5);
50692
+ return d.toLocaleString("sv-SE", {
50693
+ timeZone: "Asia/Shanghai",
50694
+ year: "numeric",
50695
+ month: "2-digit",
50696
+ day: "2-digit"
50697
+ }).replace(/-/g, "");
50698
+ });
50699
+ };
50700
+ var blockToApiBlock = (block) => {
50701
+ if (block.type === "text") return { type: "text", text: block.text };
50702
+ if (block.type === "tool_use") {
50703
+ return {
50704
+ type: "tool_use",
50705
+ id: block.id,
50706
+ name: block.name,
50707
+ input: block.input
50708
+ };
50709
+ }
50710
+ if (block.type === "tool_result") {
50711
+ return {
50712
+ type: "tool_result",
50713
+ toolUseId: block.tool_use_id,
50714
+ content: typeof block.content === "string" ? block.content.slice(0, 2e3) : JSON.stringify(block.content).slice(0, 2e3)
50715
+ };
50716
+ }
50717
+ if (block.type === "thinking") {
50718
+ return {
50719
+ type: "thinking",
50720
+ thinking: block.thinking.slice(0, 2e3)
50721
+ };
50722
+ }
50723
+ if (block.type === "image") {
50724
+ return {
50725
+ type: "image"
50726
+ };
50727
+ }
50728
+ return { type: "unknown" };
50729
+ };
50730
+ var messagesToAgentLogs = (messages, startIndex = 0) => messages.map((msg, idx) => ({
50731
+ index: startIndex + idx,
50732
+ role: msg.role,
50733
+ blocks: msg.content.map(blockToApiBlock)
50734
+ }));
50735
+ var collectRecentMessages = async (storage, userId) => {
50736
+ for (const dateStr of toBeijingDateKeys()) {
50737
+ const msgs = await getMessages(storage, userId, 300, dateStr);
50738
+ if (msgs.length > 0) return msgs;
50739
+ }
50740
+ return getMessages(storage, userId, 300);
50741
+ };
50637
50742
  departmentRoutes.get("/departments", (c) => {
50638
50743
  try {
50639
50744
  return c.json(listDepartments());
@@ -50796,16 +50901,8 @@ departmentRoutes.get("/departments/:name/members/:memberName/context", async (c)
50796
50901
  loadEnv();
50797
50902
  const storageConf = { url: process.env.REDIS_URL };
50798
50903
  const storage = createRuntimeStorage(storageConf);
50799
- const now = /* @__PURE__ */ new Date();
50800
50904
  let allMessages = [];
50801
- for (let i = 0; i < 7; i++) {
50802
- const d = new Date(now.getTime() - i * 864e5);
50803
- const dateStr = d.toLocaleString("sv-SE", {
50804
- timeZone: "Asia/Shanghai",
50805
- year: "numeric",
50806
- month: "2-digit",
50807
- day: "2-digit"
50808
- }).replace(/-/g, "");
50905
+ for (const dateStr of toBeijingDateKeys()) {
50809
50906
  const msgs = await getMessages(storage, mailBoxId, 300, dateStr);
50810
50907
  if (msgs.length > 0) {
50811
50908
  allMessages = msgs;
@@ -50815,39 +50912,7 @@ departmentRoutes.get("/departments/:name/members/:memberName/context", async (c)
50815
50912
  if (allMessages.length === 0) {
50816
50913
  allMessages = await getMessages(storage, mailBoxId, 300);
50817
50914
  }
50818
- agentLogs = allMessages.map((msg, idx) => {
50819
- const blocks = msg.content.map((block) => {
50820
- if (block.type === "text") return { type: "text", text: block.text };
50821
- if (block.type === "tool_use") {
50822
- return {
50823
- type: "tool_use",
50824
- id: block.id,
50825
- name: block.name,
50826
- input: block.input
50827
- };
50828
- }
50829
- if (block.type === "tool_result") {
50830
- return {
50831
- type: "tool_result",
50832
- toolUseId: block.tool_use_id,
50833
- content: typeof block.content === "string" ? block.content.slice(0, 2e3) : JSON.stringify(block.content).slice(0, 2e3)
50834
- };
50835
- }
50836
- if (block.type === "thinking") {
50837
- return {
50838
- type: "thinking",
50839
- thinking: block.thinking.slice(0, 2e3)
50840
- };
50841
- }
50842
- if (block.type === "image") {
50843
- return {
50844
- type: "image"
50845
- };
50846
- }
50847
- return { type: "unknown" };
50848
- });
50849
- return { index: idx, role: msg.role, blocks };
50850
- });
50915
+ agentLogs = messagesToAgentLogs(allMessages);
50851
50916
  } catch {
50852
50917
  agentLogs = [];
50853
50918
  }
@@ -50858,6 +50923,73 @@ departmentRoutes.get("/departments/:name/members/:memberName/context", async (c)
50858
50923
  agentLogs
50859
50924
  });
50860
50925
  });
50926
+ departmentRoutes.get("/departments/:name/ceo-context", async (c) => {
50927
+ const name = c.req.param("name");
50928
+ const department = getDepartment(name);
50929
+ if (!department) return c.json({ error: "Department not found" }, 404);
50930
+ let messages = [];
50931
+ const sourceUserIds = /* @__PURE__ */ new Set();
50932
+ try {
50933
+ const members = listDepartmentMembers(name);
50934
+ const mailboxIds = members.map((m) => m.mailBoxId);
50935
+ if (mailboxIds.length > 0) {
50936
+ const placeholders = mailboxIds.map(() => "?").join(", ");
50937
+ const db3 = createSqliteDB();
50938
+ const rows = db3.prepare(
50939
+ `SELECT id, from_mailbox_id, to_mailbox_id, content, send_time, status, thread_id, parent_message_id, origin_user_id
50940
+ FROM mailbox
50941
+ WHERE from_mailbox_id IN (${placeholders}) OR to_mailbox_id IN (${placeholders})
50942
+ ORDER BY send_time DESC
50943
+ LIMIT 100`
50944
+ ).all(...mailboxIds, ...mailboxIds);
50945
+ messages = rows.filter((row) => row.from_mailbox_id === "manager" || row.to_mailbox_id === "manager").map((row) => ({
50946
+ id: row.id,
50947
+ fromMailboxId: row.from_mailbox_id,
50948
+ toMailboxId: row.to_mailbox_id,
50949
+ content: row.content,
50950
+ sendTime: row.send_time,
50951
+ status: row.status,
50952
+ threadId: row.thread_id || void 0,
50953
+ parentMessageId: row.parent_message_id || void 0
50954
+ }));
50955
+ for (const row of rows) {
50956
+ if (typeof row.origin_user_id === "string" && row.origin_user_id.trim()) {
50957
+ sourceUserIds.add(row.origin_user_id);
50958
+ }
50959
+ }
50960
+ }
50961
+ } catch (err) {
50962
+ return c.json({ error: err.message || "Failed to get CEO mailbox messages" }, 500);
50963
+ }
50964
+ if (department.sourceGoalId) {
50965
+ const context = getGoalConversationContext(department.sourceGoalId);
50966
+ sourceUserIds.add(context?.threadId ?? getGoalThreadId(department.sourceGoalId));
50967
+ if (context?.originUserId) sourceUserIds.add(context.originUserId);
50968
+ }
50969
+ let agentLogs = [];
50970
+ try {
50971
+ loadEnv();
50972
+ const storageConf = { url: process.env.REDIS_URL };
50973
+ const storage = createRuntimeStorage(storageConf);
50974
+ let index = 0;
50975
+ for (const userId of sourceUserIds) {
50976
+ const userMessages = await collectRecentMessages(storage, userId);
50977
+ if (userMessages.length === 0) continue;
50978
+ const logs = messagesToAgentLogs(userMessages, index);
50979
+ agentLogs.push(...logs);
50980
+ index += logs.length;
50981
+ }
50982
+ } catch {
50983
+ agentLogs = [];
50984
+ }
50985
+ return c.json({
50986
+ memberName: "CEO",
50987
+ mailBoxId: "manager",
50988
+ messages,
50989
+ agentLogs,
50990
+ sourceUserIds: [...sourceUserIds]
50991
+ });
50992
+ });
50861
50993
 
50862
50994
  // src/server/routes/cron.ts
50863
50995
  var import_crypto7 = require("crypto");
@@ -51679,7 +51811,7 @@ var systemRoutes = new Hono2();
51679
51811
  var startTime = Date.now();
51680
51812
  systemRoutes.get("/system/info", (c) => {
51681
51813
  return c.json({
51682
- version: true ? "1.8.28" : "unknown",
51814
+ version: true ? "1.8.30" : "unknown",
51683
51815
  uptime: Math.floor((Date.now() - startTime) / 1e3),
51684
51816
  env: process.env.NODE_ENV || "development",
51685
51817
  nodeVersion: process.version