duclaw-cli 1.8.16 → 1.8.17

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.16" : "unknown"}`);
30245
+ console.log(`duclaw-cli v${true ? "1.8.17" : "unknown"}`);
30246
30246
  }
30247
30247
  function getDuclawTemplate() {
30248
30248
  return {
@@ -45233,6 +45233,7 @@ The user will primarily request you perform software engineering tasks. This inc
45233
45233
  - \u5B58\u5728\u591A\u79CD\u65B9\u6848\u4E14\u5404\u6709\u5229\u5F0A\u65F6\uFF0C\u5217\u51FA\u9009\u9879\u8BA9\u7528\u6237\u9009\u62E9
45234
45234
  - \u4EFB\u52A1\u7406\u89E3\u6709\u6B67\u4E49\u65F6\uFF0C\u5148\u786E\u8BA4\u7528\u6237\u7684\u771F\u5B9E\u610F\u56FE
45235
45235
  - \u64CD\u4F5C\u7ED3\u679C\u4F1A\u5F71\u54CD\u5176\u4ED6\u4EBA\u6216\u5916\u90E8\u7CFB\u7EDF\u65F6
45236
+ - \u98DE\u4E66/Lark \u6388\u6743\u94FE\u63A5\u5FC5\u987B\u4E3B\u52A8\u8F6C\u53D1\uFF1A\u5F53\u5DE5\u5177\u8F93\u51FA\u3001\u90E8\u95E8\u6210\u5458\u56DE\u590D\u6216\u9519\u8BEF\u4FE1\u606F\u4E2D\u51FA\u73B0\u9700\u8981\u7528\u6237\u5728\u6D4F\u89C8\u5668\u5B8C\u6210\u7684\u98DE\u4E66/Lark \u6388\u6743\u3001\u5E94\u7528\u914D\u7F6E\u3001scope \u5F00\u901A\u3001console_url\u3001authorize_url\u3001auth login URL \u7B49\u94FE\u63A5\u65F6\uFF0C\u5FC5\u987B\u901A\u8FC7 send_message \u628A\u5B8C\u6574 URL \u76F4\u63A5\u53D1\u7ED9\u7528\u6237\uFF0C\u5E76\u660E\u786E\u8BF4\u660E\u9700\u8981\u7528\u6237\u6253\u5F00\u8BE5\u94FE\u63A5\u5B8C\u6210\u6388\u6743\u3002\u4E0D\u8981\u53EA\u8BF4\u201C\u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u6388\u6743\u94FE\u63A5\u201D\u800C\u4E0D\u63D0\u4F9B\u94FE\u63A5\u3002
45236
45237
  - \u4E0D\u8981\u64C5\u81EA\u505A\u91CD\u5927\u51B3\u5B9A\uFF0C\u5B81\u53EF\u591A\u95EE\u4E00\u53E5\u4E5F\u4E0D\u8981\u9ED8\u9ED8\u6267\u884C\u53EF\u80FD\u51FA\u9519\u7684\u64CD\u4F5C\u3002
45237
45238
  </Communication>
45238
45239
 
@@ -46449,15 +46450,7 @@ var wakeDepartmentAgent = async (mailboxId, msgIds) => {
46449
46450
  };
46450
46451
  const result = await agent(request);
46451
46452
  console.log(`[mailbox] department agent ${mailboxId} \u5904\u7406\u5B8C\u6210, alreadySent=${result.alreadySent}`);
46452
- for (const id of msgIds) {
46453
- const changed = updateMailboxMessageStatus(id, "pending", {
46454
- fromStatus: "processing",
46455
- reason: "department_agent_retry"
46456
- });
46457
- if (changed) {
46458
- console.log(`[mailbox] \u6D88\u606F ${id} \u672A\u88AB agent \u5904\u7406\uFF0C\u5DF2\u91CD\u7F6E\u4E3A pending`);
46459
- }
46460
- }
46453
+ finalizeDepartmentAgentUnrepliedMessages(mailboxId, msgIds, result);
46461
46454
  } catch (err) {
46462
46455
  console.error(`[mailbox] \u5524\u9192 department agent ${mailboxId} \u5931\u8D25:`, err);
46463
46456
  for (const id of msgIds) {
@@ -46468,6 +46461,63 @@ var wakeDepartmentAgent = async (mailboxId, msgIds) => {
46468
46461
  }
46469
46462
  }
46470
46463
  };
46464
+ var finalizeDepartmentAgentUnrepliedMessages = (mailboxId, msgIds, result) => {
46465
+ const fallbackContent = result.content?.trim();
46466
+ for (const id of msgIds) {
46467
+ const row = db2.prepare(
46468
+ `SELECT
46469
+ id,
46470
+ to_mailbox_id as toMailboxId,
46471
+ from_mailbox_id as fromMailboxId,
46472
+ status,
46473
+ origin_user_id as originUserId,
46474
+ origin_platform as originPlatform,
46475
+ thread_id as threadId
46476
+ FROM mailbox
46477
+ WHERE id = ?`
46478
+ ).get(id);
46479
+ if (!row || row.status !== "processing") continue;
46480
+ if (fallbackContent) {
46481
+ const changed2 = updateMailboxMessageStatus(id, "done", {
46482
+ fromStatus: "processing",
46483
+ actorMailboxId: mailboxId,
46484
+ counterpartMailboxId: row.fromMailboxId,
46485
+ reason: "department_agent_fallback_reply"
46486
+ });
46487
+ if (changed2) {
46488
+ sendMessage2(mailboxId, row.fromMailboxId, fallbackContent, {
46489
+ originUserId: row.originUserId,
46490
+ originPlatform: row.originPlatform,
46491
+ threadId: row.threadId || row.id,
46492
+ parentMessageId: row.id,
46493
+ auditDetail: {
46494
+ fallbackReason: "department_agent_returned_without_reply_mailbox"
46495
+ }
46496
+ });
46497
+ console.warn(`[mailbox] department agent ${mailboxId} \u672A\u8C03\u7528 reply_mailbox\uFF0C\u5DF2\u5C06\u6700\u7EC8\u6587\u672C\u515C\u5E95\u8F6C\u4E3A\u90AE\u4EF6 ${id} \u7684\u56DE\u4FE1`);
46498
+ }
46499
+ continue;
46500
+ }
46501
+ const changed = updateMailboxMessageStatus(id, "failed", {
46502
+ fromStatus: "processing",
46503
+ actorMailboxId: mailboxId,
46504
+ counterpartMailboxId: row.fromMailboxId,
46505
+ reason: "department_agent_no_reply"
46506
+ });
46507
+ if (changed) {
46508
+ sendMessage2(mailboxId, row.fromMailboxId, `[\u7CFB\u7EDF\u901A\u77E5] ${mailboxId} \u672C\u8F6E\u88AB\u5524\u9192\u540E\u6CA1\u6709\u4EA7\u51FA\u53EF\u8F6C\u4EA4\u7684\u56DE\u590D\uFF0C\u539F\u90AE\u4EF6\u5DF2\u6807\u8BB0\u4E3A failed\uFF0C\u907F\u514D\u7EE7\u7EED\u91CD\u590D\u6295\u9012\u3002`, {
46509
+ originUserId: row.originUserId,
46510
+ originPlatform: row.originPlatform,
46511
+ threadId: row.threadId || row.id,
46512
+ parentMessageId: row.id,
46513
+ auditDetail: {
46514
+ fallbackReason: "department_agent_returned_empty_without_reply_mailbox"
46515
+ }
46516
+ });
46517
+ console.warn(`[mailbox] department agent ${mailboxId} \u6CA1\u6709\u56DE\u590D\u5185\u5BB9\uFF0C\u90AE\u4EF6 ${id} \u5DF2\u6807\u8BB0 failed`);
46518
+ }
46519
+ }
46520
+ };
46471
46521
  var polling = false;
46472
46522
  var pollMailbox = async () => {
46473
46523
  if (polling) return;
@@ -46551,7 +46601,6 @@ var createDepartmentAgentTools = () => {
46551
46601
  registerTool(registry2, departmentSkillKeep);
46552
46602
  registerTool(registry2, departmentSkillDrop);
46553
46603
  registerTool(registry2, departmentProposalCreate);
46554
- registerTool(registry2, sendMessage);
46555
46604
  return { registry: registry2, executor };
46556
46605
  };
46557
46606
  var getDepartmentAgentConfig = (tools, memberFocusOn, workspacePath, departmentName) => {
@@ -51436,7 +51485,7 @@ var systemRoutes = new Hono2();
51436
51485
  var startTime = Date.now();
51437
51486
  systemRoutes.get("/system/info", (c) => {
51438
51487
  return c.json({
51439
- version: true ? "1.8.16" : "unknown",
51488
+ version: true ? "1.8.17" : "unknown",
51440
51489
  uptime: Math.floor((Date.now() - startTime) / 1e3),
51441
51490
  env: process.env.NODE_ENV || "development",
51442
51491
  nodeVersion: process.version