duclaw-cli 1.8.16 → 1.8.18
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 +98 -12
- package/dist/main.js +1 -1
- package/dist/worker-main.js +1 -1
- package/package.json +1 -1
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.
|
|
30245
|
+
console.log(`duclaw-cli v${true ? "1.8.18" : "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
|
-
|
|
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,100 @@ var wakeDepartmentAgent = async (mailboxId, msgIds) => {
|
|
|
46468
46461
|
}
|
|
46469
46462
|
}
|
|
46470
46463
|
};
|
|
46464
|
+
var finalizeDepartmentAgentUnrepliedMessages = (mailboxId, msgIds, result) => {
|
|
46465
|
+
const fallbackContent = result.content?.trim();
|
|
46466
|
+
const processingRows = msgIds.map((id) => db2.prepare(
|
|
46467
|
+
`SELECT
|
|
46468
|
+
id,
|
|
46469
|
+
to_mailbox_id as toMailboxId,
|
|
46470
|
+
from_mailbox_id as fromMailboxId,
|
|
46471
|
+
status,
|
|
46472
|
+
origin_user_id as originUserId,
|
|
46473
|
+
origin_platform as originPlatform,
|
|
46474
|
+
thread_id as threadId
|
|
46475
|
+
FROM mailbox
|
|
46476
|
+
WHERE id = ?`
|
|
46477
|
+
).get(id)).filter((row) => Boolean(row && row.status === "processing"));
|
|
46478
|
+
if (fallbackContent && processingRows.length > 1) {
|
|
46479
|
+
const bySender = /* @__PURE__ */ new Map();
|
|
46480
|
+
for (const row of processingRows) {
|
|
46481
|
+
const rows = bySender.get(row.fromMailboxId) ?? [];
|
|
46482
|
+
rows.push(row);
|
|
46483
|
+
bySender.set(row.fromMailboxId, rows);
|
|
46484
|
+
}
|
|
46485
|
+
for (const [senderMailboxId, rows] of bySender.entries()) {
|
|
46486
|
+
const changedRows = rows.filter((row) => updateMailboxMessageStatus(row.id, "failed", {
|
|
46487
|
+
fromStatus: "processing",
|
|
46488
|
+
actorMailboxId: mailboxId,
|
|
46489
|
+
counterpartMailboxId: senderMailboxId,
|
|
46490
|
+
reason: "department_agent_batch_fallback_ambiguous"
|
|
46491
|
+
}));
|
|
46492
|
+
if (changedRows.length === 0) continue;
|
|
46493
|
+
const first = changedRows[0];
|
|
46494
|
+
const ids = changedRows.map((row) => row.id).join(", ");
|
|
46495
|
+
sendMessage2(mailboxId, senderMailboxId, [
|
|
46496
|
+
`[\u7CFB\u7EDF\u901A\u77E5] ${mailboxId} \u672C\u8F6E\u540C\u65F6\u5904\u7406\u4E86 ${changedRows.length} \u5C01\u90AE\u4EF6\uFF0C\u4F46\u6CA1\u6709\u8C03\u7528 reply_mailbox\uFF0C\u65E0\u6CD5\u53EF\u9760\u5224\u65AD\u6700\u7EC8\u6587\u672C\u5206\u522B\u5BF9\u5E94\u54EA\u5C01\u90AE\u4EF6\u3002`,
|
|
46497
|
+
`\u5DF2\u5C06\u8FD9\u4E9B\u90AE\u4EF6\u6807\u8BB0\u4E3A failed\uFF0C\u907F\u514D\u91CD\u590D\u6295\u9012\u6216\u751F\u6210\u5927\u91CF\u91CD\u590D\u56DE\u4FE1\u3002`,
|
|
46498
|
+
`\u53D7\u5F71\u54CD\u90AE\u4EF6: ${ids}`,
|
|
46499
|
+
``,
|
|
46500
|
+
`agent \u6700\u7EC8\u6587\u672C\u6458\u5F55:`,
|
|
46501
|
+
fallbackContent.slice(0, 1200)
|
|
46502
|
+
].join("\n"), {
|
|
46503
|
+
originUserId: first.originUserId,
|
|
46504
|
+
originPlatform: first.originPlatform,
|
|
46505
|
+
threadId: first.threadId || first.id,
|
|
46506
|
+
parentMessageId: first.id,
|
|
46507
|
+
auditDetail: {
|
|
46508
|
+
fallbackReason: "department_agent_batch_returned_without_reply_mailbox",
|
|
46509
|
+
affectedMessageIds: changedRows.map((row) => row.id)
|
|
46510
|
+
}
|
|
46511
|
+
});
|
|
46512
|
+
console.warn(`[mailbox] department agent ${mailboxId} \u672A\u8C03\u7528 reply_mailbox\uFF0C\u6279\u91CF\u515C\u5E95\u5B58\u5728\u6B67\u4E49\uFF0C\u5DF2\u5C06 ${changedRows.length} \u5C01\u90AE\u4EF6\u6807\u8BB0 failed \u5E76\u5411 ${senderMailboxId} \u53D1\u9001\u4E00\u5C01\u7CFB\u7EDF\u901A\u77E5`);
|
|
46513
|
+
}
|
|
46514
|
+
return;
|
|
46515
|
+
}
|
|
46516
|
+
for (const row of processingRows) {
|
|
46517
|
+
if (fallbackContent) {
|
|
46518
|
+
const changed2 = updateMailboxMessageStatus(row.id, "done", {
|
|
46519
|
+
fromStatus: "processing",
|
|
46520
|
+
actorMailboxId: mailboxId,
|
|
46521
|
+
counterpartMailboxId: row.fromMailboxId,
|
|
46522
|
+
reason: "department_agent_fallback_reply"
|
|
46523
|
+
});
|
|
46524
|
+
if (changed2) {
|
|
46525
|
+
sendMessage2(mailboxId, row.fromMailboxId, fallbackContent, {
|
|
46526
|
+
originUserId: row.originUserId,
|
|
46527
|
+
originPlatform: row.originPlatform,
|
|
46528
|
+
threadId: row.threadId || row.id,
|
|
46529
|
+
parentMessageId: row.id,
|
|
46530
|
+
auditDetail: {
|
|
46531
|
+
fallbackReason: "department_agent_returned_without_reply_mailbox"
|
|
46532
|
+
}
|
|
46533
|
+
});
|
|
46534
|
+
console.warn(`[mailbox] department agent ${mailboxId} \u672A\u8C03\u7528 reply_mailbox\uFF0C\u5DF2\u5C06\u6700\u7EC8\u6587\u672C\u515C\u5E95\u8F6C\u4E3A\u90AE\u4EF6 ${row.id} \u7684\u56DE\u4FE1`);
|
|
46535
|
+
}
|
|
46536
|
+
continue;
|
|
46537
|
+
}
|
|
46538
|
+
const changed = updateMailboxMessageStatus(row.id, "failed", {
|
|
46539
|
+
fromStatus: "processing",
|
|
46540
|
+
actorMailboxId: mailboxId,
|
|
46541
|
+
counterpartMailboxId: row.fromMailboxId,
|
|
46542
|
+
reason: "department_agent_no_reply"
|
|
46543
|
+
});
|
|
46544
|
+
if (changed) {
|
|
46545
|
+
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`, {
|
|
46546
|
+
originUserId: row.originUserId,
|
|
46547
|
+
originPlatform: row.originPlatform,
|
|
46548
|
+
threadId: row.threadId || row.id,
|
|
46549
|
+
parentMessageId: row.id,
|
|
46550
|
+
auditDetail: {
|
|
46551
|
+
fallbackReason: "department_agent_returned_empty_without_reply_mailbox"
|
|
46552
|
+
}
|
|
46553
|
+
});
|
|
46554
|
+
console.warn(`[mailbox] department agent ${mailboxId} \u6CA1\u6709\u56DE\u590D\u5185\u5BB9\uFF0C\u90AE\u4EF6 ${row.id} \u5DF2\u6807\u8BB0 failed`);
|
|
46555
|
+
}
|
|
46556
|
+
}
|
|
46557
|
+
};
|
|
46471
46558
|
var polling = false;
|
|
46472
46559
|
var pollMailbox = async () => {
|
|
46473
46560
|
if (polling) return;
|
|
@@ -46551,7 +46638,6 @@ var createDepartmentAgentTools = () => {
|
|
|
46551
46638
|
registerTool(registry2, departmentSkillKeep);
|
|
46552
46639
|
registerTool(registry2, departmentSkillDrop);
|
|
46553
46640
|
registerTool(registry2, departmentProposalCreate);
|
|
46554
|
-
registerTool(registry2, sendMessage);
|
|
46555
46641
|
return { registry: registry2, executor };
|
|
46556
46642
|
};
|
|
46557
46643
|
var getDepartmentAgentConfig = (tools, memberFocusOn, workspacePath, departmentName) => {
|
|
@@ -51436,7 +51522,7 @@ var systemRoutes = new Hono2();
|
|
|
51436
51522
|
var startTime = Date.now();
|
|
51437
51523
|
systemRoutes.get("/system/info", (c) => {
|
|
51438
51524
|
return c.json({
|
|
51439
|
-
version: true ? "1.8.
|
|
51525
|
+
version: true ? "1.8.18" : "unknown",
|
|
51440
51526
|
uptime: Math.floor((Date.now() - startTime) / 1e3),
|
|
51441
51527
|
env: process.env.NODE_ENV || "development",
|
|
51442
51528
|
nodeVersion: process.version
|