ai-project-manage-cli 7.0.3 → 7.0.4

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -453,6 +453,10 @@ var requestConfig = {
453
453
  method: "PUT",
454
454
  path: "/cli/mailbox-messages/claim"
455
455
  }),
456
+ appendMailboxDraft: defineEndpoint({
457
+ method: "PUT",
458
+ path: "/cli/mailbox-messages/append-draft"
459
+ }),
456
460
  completeMailboxMessage: defineEndpoint({
457
461
  method: "PUT",
458
462
  path: "/cli/mailbox-messages/complete"
@@ -2281,7 +2285,7 @@ function removeMailById(mailId) {
2281
2285
  }
2282
2286
 
2283
2287
  // src/commands/connect/reply-mail-tool.ts
2284
- function createMailReplyDraft() {
2288
+ function createMailReplyDraft(input) {
2285
2289
  const parts = [];
2286
2290
  const tool = {
2287
2291
  description: "\u5411\u53D1\u4FE1\u4EBA\u589E\u91CF\u66F4\u65B0\u56DE\u590D\u5185\u5BB9\u3002\u53EF\u591A\u6B21\u8C03\u7528\u8FFD\u52A0\u8FDB\u5C55\uFF08\u5982\u5148\u786E\u8BA4\u6536\u5230\u3001\u518D\u6C47\u62A5\u7ED3\u679C\uFF09\uFF1BAgent \u6B63\u5E38\u7ED3\u675F\u540E\u4F1A\u81EA\u52A8\u63D0\u4EA4\u5B8C\u6574\u56DE\u4FE1\uFF0C\u65E0\u9700\u53E6\u884C\u6536\u5C3E\u3002",
@@ -2304,6 +2308,7 @@ function createMailReplyDraft() {
2304
2308
  };
2305
2309
  }
2306
2310
  parts.push(content);
2311
+ await input.appendDraft(content);
2307
2312
  console.log(`[apm] \u589E\u91CF\u66F4\u65B0\u56DE\u4FE1\uFF08\u7B2C ${parts.length} \u6BB5\uFF09`);
2308
2313
  return "\u5DF2\u8FFD\u52A0\u5230\u56DE\u4FE1\u8349\u7A3F\uFF0CAgent \u7ED3\u675F\u540E\u5C06\u4E00\u5E76\u63D0\u4EA4\u3002";
2309
2314
  }
@@ -2508,15 +2513,17 @@ async function processMail(mail, options) {
2508
2513
  );
2509
2514
  return;
2510
2515
  }
2511
- if (detail.status !== "PENDING") {
2516
+ if (detail.status !== "UNREAD") {
2512
2517
  console.log(`[apm] \u4FE1\u4EF6 id=${mail.id} \u72B6\u6001\u4E3A ${detail.status}\uFF0C\u8DF3\u8FC7\u5904\u7406`);
2513
- if (detail.status === "SUCCEEDED" || detail.status === "FAILED") {
2518
+ if (detail.status === "READ") {
2514
2519
  markMailReplied(mail.id);
2515
2520
  }
2516
2521
  return;
2517
2522
  }
2523
+ let draftReplyId;
2518
2524
  try {
2519
- await api.cli.claimMailboxMessage({ id: mail.id });
2525
+ const claimed = await api.cli.claimMailboxMessage({ id: mail.id });
2526
+ draftReplyId = claimed.draftReplyId;
2520
2527
  } catch (err) {
2521
2528
  console.error(
2522
2529
  `[apm] \u8BA4\u9886\u4FE1\u4EF6\u5931\u8D25 id=${mail.id}:`,
@@ -2529,7 +2536,11 @@ async function processMail(mail, options) {
2529
2536
  tool: replyTool,
2530
2537
  getReplyContent,
2531
2538
  hasReplyContent
2532
- } = createMailReplyDraft();
2539
+ } = createMailReplyDraft({
2540
+ appendDraft: async (content) => {
2541
+ await api.cli.appendMailboxDraft({ id: draftReplyId, content });
2542
+ }
2543
+ });
2533
2544
  try {
2534
2545
  const cursorMode = resolveCursorAgentMode(detail.studio?.phase);
2535
2546
  const result = await runCursorAgent(
@@ -2562,7 +2573,7 @@ async function processMail(mail, options) {
2562
2573
  });
2563
2574
  }
2564
2575
  await api.cli.completeMailboxMessage({
2565
- id: detail.id,
2576
+ id: draftReplyId,
2566
2577
  status: "SUCCEEDED",
2567
2578
  replyContent
2568
2579
  });
@@ -2577,7 +2588,7 @@ async function processMail(mail, options) {
2577
2588
  console.error(`[apm] \u4FE1\u4EF6\u5904\u7406\u5931\u8D25 id=${mail.id}: ${message}`);
2578
2589
  try {
2579
2590
  await api.cli.completeMailboxMessage({
2580
- id: detail.id,
2591
+ id: draftReplyId,
2581
2592
  status: "FAILED",
2582
2593
  error: message
2583
2594
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "7.0.3",
3
+ "version": "7.0.4",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,