@auto-ai/agent 2.1.111 → 2.1.112

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.
@@ -650,14 +650,29 @@ server.registerTool(
650
650
  async ({ chat_id, sender_id, text, chat_type, reply_to_post_id }) => {
651
651
  const target = chat_id || sender_id;
652
652
  if (!target) throw new Error("chat_id or sender_id is required");
653
- await sendTextMsg(
653
+ const apiBody = await sendTextMsg(
654
654
  account,
655
655
  target,
656
656
  chat_type || guessChatType(target),
657
657
  text,
658
658
  { reply_to_post_id },
659
659
  );
660
- return { content: [{ type: "text", text: `Sent to ${target}` }] };
660
+ const message_id = String(
661
+ apiBody?.msgid ?? apiBody?.data?.msgid ?? apiBody?.post_id ?? "",
662
+ ).trim();
663
+ const post_id = String(apiBody?.post_id ?? "").trim();
664
+ const structuredContent =
665
+ message_id.length > 0
666
+ ? {
667
+ message_id,
668
+ ...(post_id.length > 0 ? { post_id } : {}),
669
+ chat_id: target,
670
+ }
671
+ : undefined;
672
+ return {
673
+ content: [{ type: "text", text: `Sent to ${target}` }],
674
+ ...(structuredContent ? { structuredContent } : {}),
675
+ };
661
676
  },
662
677
  );
663
678
 
@@ -674,13 +689,23 @@ server.registerTool(
674
689
  },
675
690
  },
676
691
  async ({ chat_id, media_url, chat_type }) => {
677
- await sendMediaMsg(
692
+ const apiBody = await sendMediaMsg(
678
693
  account,
679
694
  chat_id,
680
695
  chat_type || guessChatType(chat_id),
681
696
  media_url,
682
697
  );
683
- return { content: [{ type: "text", text: `Media sent to ${chat_id}` }] };
698
+ const message_id = String(
699
+ apiBody?.msgid ?? apiBody?.data?.msgid ?? apiBody?.post_id ?? "",
700
+ ).trim();
701
+ const structuredContent =
702
+ message_id.length > 0
703
+ ? { message_id, chat_id }
704
+ : undefined;
705
+ return {
706
+ content: [{ type: "text", text: `Media sent to ${chat_id}` }],
707
+ ...(structuredContent ? { structuredContent } : {}),
708
+ };
684
709
  },
685
710
  );
686
711
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auto-ai/agent",
3
- "version": "2.1.111",
3
+ "version": "2.1.112",
4
4
  "description": "Auto AI Agent 网关 CLI(WebSocket,独立二进制,无需 Bun)",
5
5
  "type": "module",
6
6
  "maintainers": [
@@ -32,11 +32,11 @@
32
32
  "zod": "^4.3.6"
33
33
  },
34
34
  "optionalDependencies": {
35
- "@auto-ai/agent-linux-x64": "2.1.111",
36
- "@auto-ai/agent-linux-arm64": "2.1.111",
37
- "@auto-ai/agent-darwin-x64": "2.1.111",
38
- "@auto-ai/agent-darwin-arm64": "2.1.111",
39
- "@auto-ai/agent-win-x64": "2.1.111"
35
+ "@auto-ai/agent-linux-x64": "2.1.112",
36
+ "@auto-ai/agent-linux-arm64": "2.1.112",
37
+ "@auto-ai/agent-darwin-x64": "2.1.112",
38
+ "@auto-ai/agent-darwin-arm64": "2.1.112",
39
+ "@auto-ai/agent-win-x64": "2.1.112"
40
40
  },
41
41
  "scripts": {
42
42
  "prepare": "node ../../scripts/sync-launcher-env.js",