@agent-wechat/agent-wechat 2.2.1 → 2.3.0

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 +6 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1435,8 +1435,8 @@ var NativeWeChatClient = class {
1435
1435
  groupMutationByKey(accountId, key2, signal) {
1436
1436
  return this.request(`v1/accounts/${id(accountId)}/group-mutations/by-idempotency-key?${new URLSearchParams({ key: key2 })}`, { signal });
1437
1437
  }
1438
- refreshAvatar(accountId, username) {
1439
- return this.request(`v1/accounts/${id(accountId)}/avatars/${id(username)}/refresh`, { method: "POST", body: "{}" });
1438
+ refreshAvatar(accountId, username, options = {}) {
1439
+ return this.request(`v1/accounts/${id(accountId)}/avatars/${id(username)}/refresh`, { method: "POST", body: JSON.stringify(options) });
1440
1440
  }
1441
1441
  async avatar(accountId, username, signal) {
1442
1442
  const response = await this.response(`v1/accounts/${id(accountId)}/avatars/${id(username)}`, { signal });
@@ -2547,7 +2547,7 @@ function sameEmbeddedQuote(stored, current) {
2547
2547
  if (stored.state === "unsupported" && current.state === "embedded")
2548
2548
  return ["serverId", "type", "appMessageType", "senderId", "direction"].every((field) => (stored[field] ?? null) === (current[field] ?? null));
2549
2549
  const compared = { ...current };
2550
- for (const field of ["embeddedLink", "embeddedSticker"]) {
2550
+ for (const field of ["embeddedLink", "embeddedSticker", "senderName"]) {
2551
2551
  if (!Object.hasOwn(stored, field)) delete compared[field];
2552
2552
  }
2553
2553
  return JSON.stringify(stored) === JSON.stringify(compared);
@@ -2570,8 +2570,10 @@ function renderEmbeddedQuote(message, permitted = true, imageBody) {
2570
2570
  if (state === "embedded" && !image && !source.embeddedText) return unavailable("invalid");
2571
2571
  const content = state === "missing" ? "" : image ? imageBody ?? "[Image metadata embedded in quote; image not retrieved]" : source.embeddedText ?? "";
2572
2572
  const status = state === "unsupported" ? `[${label2} attachment unavailable from embedded quote]` : state === "missing" ? "[Embedded quote content unavailable]" : "";
2573
+ const suppliedName = source.senderName;
2574
+ const author = typeof suppliedName === "string" && suppliedName.trim() && suppliedName.length <= 4096 && !/[\u0000-\u001f\u007f-\u009f]/.test(suppliedName) ? suppliedName : source.senderId ?? "unknown sender";
2573
2575
  return {
2574
- body: `${comment}${comment ? "\n\n" : ""}[Quoted ${label2} from ${source.senderId ?? "unknown sender"}; embedded in reply]
2576
+ body: `${comment}${comment ? "\n\n" : ""}[Quoted ${label2} from ${author}; embedded in reply]
2575
2577
  ${[content, status].filter(Boolean).join("\n")}
2576
2578
  [/Quoted message]`,
2577
2579
  image,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-wechat/agent-wechat",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [