duclaw-cli 1.8.40 → 1.8.41

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.40" : "unknown"}`);
30245
+ console.log(`duclaw-cli v${true ? "1.8.41" : "unknown"}`);
30246
30246
  }
30247
30247
  function getDuclawTemplate() {
30248
30248
  return {
@@ -45936,6 +45936,32 @@ var createAgent = (config2 = getDefaultAgentConfig()) => {
45936
45936
  for (const id of ids) injectedEventIds.add(id);
45937
45937
  markAgentEventsInjected(ids);
45938
45938
  };
45939
+ const ceoFollowupIdsFromMetadata = (metadata) => {
45940
+ const ids = /* @__PURE__ */ new Set();
45941
+ if (typeof metadata?.ceoFollowupId === "string") ids.add(metadata.ceoFollowupId);
45942
+ if (Array.isArray(metadata?.ceoFollowupIds)) {
45943
+ for (const id of metadata.ceoFollowupIds) {
45944
+ if (typeof id === "string") ids.add(id);
45945
+ }
45946
+ }
45947
+ return Array.from(ids);
45948
+ };
45949
+ const rememberCeoFollowupIds = (ids) => {
45950
+ if (ids.length === 0) return;
45951
+ const current = ceoFollowupIdsFromMetadata(request.metadata);
45952
+ request.metadata = {
45953
+ ...request.metadata ?? {},
45954
+ ceoFollowupIds: Array.from(/* @__PURE__ */ new Set([...current, ...ids]))
45955
+ };
45956
+ };
45957
+ const completeUserVisibleCeoFollowups = () => {
45958
+ const ids = ceoFollowupIdsFromMetadata(request.metadata);
45959
+ if (ids.length > 0) {
45960
+ for (const id of ids) completeCeoFollowup(id);
45961
+ return;
45962
+ }
45963
+ completePendingCeoFollowupsForUser(request.userId);
45964
+ };
45939
45965
  const queuePendingDurableEvents = () => {
45940
45966
  try {
45941
45967
  const events = listPendingAgentEvents(userId, 10).filter((event) => !injectedEventIds.has(event.id)).filter((event) => !interruptQueuedEventIds.has(event.id));
@@ -46123,6 +46149,7 @@ ${msg}</user-interrupt>`;
46123
46149
  if (pendingEvents.length > 0) {
46124
46150
  for (const event of pendingEvents) injectedEventIds.add(event.id);
46125
46151
  markAgentEventsInjected(pendingEvents.map((event) => event.id));
46152
+ rememberCeoFollowupIds(pendingEvents.filter((event) => event.type === "ceo.followup_required").map((event) => event.payload.ceoFollowupId).filter((id) => typeof id === "string"));
46126
46153
  }
46127
46154
  if (messages.length === 0 && internalOnly && eventReminder) {
46128
46155
  messages = [userMessage(text(eventReminder))];
@@ -46261,7 +46288,7 @@ ${memoryInjection}` : "") + dreamInjection;
46261
46288
  }
46262
46289
  hasSentMessage = true;
46263
46290
  sentMessageContent = answer;
46264
- completePendingCeoFollowupsForUser(request.userId);
46291
+ completeUserVisibleCeoFollowups();
46265
46292
  }
46266
46293
  }
46267
46294
  if (useBlock.name === `send_file`) {
@@ -46331,6 +46358,18 @@ ${msg}</user-interrupt>`
46331
46358
  }
46332
46359
  continue;
46333
46360
  }
46361
+ const visibleCeoFollowupIds = ceoFollowupIdsFromMetadata(request.metadata);
46362
+ if (!hasSentMessage && visibleCeoFollowupIds.length > 0 && config2.channelPlugin) {
46363
+ await config2.channelPlugin.outbound.sendText({
46364
+ cfg: {},
46365
+ to: request.userId,
46366
+ text: textContent,
46367
+ accountId: request.requestId
46368
+ });
46369
+ hasSentMessage = true;
46370
+ sentMessageContent = textContent;
46371
+ completeUserVisibleCeoFollowups();
46372
+ }
46334
46373
  if (topicStorage) {
46335
46374
  const topicSummary = hasSentMessage ? sentMessageContent : textContent;
46336
46375
  await updateTopicSummary(topicStorage, userId, beijingTime, topicSummary, job?.title);
@@ -47206,7 +47245,8 @@ var handleCeoFollowup = async (followup) => {
47206
47245
  metadata: {
47207
47246
  internalOnly: true,
47208
47247
  eventId: event.id,
47209
- trigger: "ceo.followup_required"
47248
+ trigger: "ceo.followup_required",
47249
+ ceoFollowupId: followup.id
47210
47250
  }
47211
47251
  });
47212
47252
  console.log(`[mailbox] \u4E3B agent \u6B63\u5728\u8FD0\u884C\u4E2D\uFF0C${followup.fromMailboxId} \u7684\u56DE\u4FE1\u5DF2\u5165\u961F\u7B49\u5F85\u4E2D\u65AD\u6CE8\u5165 followup=${followup.id}`);
@@ -52551,7 +52591,7 @@ var systemRoutes = new Hono2();
52551
52591
  var startTime = Date.now();
52552
52592
  systemRoutes.get("/system/info", (c) => {
52553
52593
  return c.json({
52554
- version: true ? "1.8.40" : "unknown",
52594
+ version: true ? "1.8.41" : "unknown",
52555
52595
  uptime: Math.floor((Date.now() - startTime) / 1e3),
52556
52596
  env: process.env.NODE_ENV || "development",
52557
52597
  nodeVersion: process.version