@agent-wechat/agent-wechat 2.4.2 → 2.5.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 +11 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1583,6 +1583,10 @@ var NativeWeChatClient = class {
1583
1583
  const response = await this.response(`v1/accounts/${id(accountId)}/uploads`, { method: "POST", body: form, signal }, false, this.mediaTimeoutMs);
1584
1584
  return JSON.parse(new TextDecoder().decode(await this.readBounded(response)));
1585
1585
  }
1586
+ /** Delete an upload you have finished with, such as the source of an added sticker. Uploads a pending send or preparation needs are kept (`upload_in_use`). */
1587
+ releaseUpload(accountId, sourceId, signal) {
1588
+ return this.request(`v1/accounts/${id(accountId)}/uploads/${id(sourceId)}`, { method: "DELETE", signal });
1589
+ }
1586
1590
  /** Derive Saved and all added official pack tabs from the account profile. */
1587
1591
  stickerCollections(accountId, signal) {
1588
1592
  return this.request(`v1/accounts/${id(accountId)}/sticker-collections`, { signal });
@@ -5872,7 +5876,9 @@ function createNativeStickerTools(context, dependencies = { host: ensureNativeHo
5872
5876
  file: { type: "string", description: "Workspace-relative source file for prepare; resolved on the session execution host." },
5873
5877
  sourceId: { type: "string", description: "Existing daemon-owned upload instead of a workspace file." },
5874
5878
  output: { type: "string", description: "New workspace-relative output for download, using the original format extension; existing files are never replaced." },
5875
- fit: { type: "boolean", description: "Permit proportional resizing to the sticker output limit." },
5879
+ fit: { type: "boolean", description: "Shrink a source larger than 1024 pixels to fit. Smaller sources keep their size and encoding." },
5880
+ maxEdge: { type: "integer", minimum: 16, maximum: 1024, description: "Shrink so the longest edge is at most this many pixels; never enlarges. Video defaults to 240." },
5881
+ fps: { type: "integer", minimum: 1, maximum: 30, description: "Frame rate for a sticker made from video; default 10. Not accepted for images or GIFs." },
5876
5882
  startMs: { type: "integer", minimum: 0, maximum: 4294967295, description: "Explicit segment start in milliseconds; requires durationMs." },
5877
5883
  durationMs: { type: "integer", minimum: 1, maximum: 1e4, description: "Explicit retained duration in milliseconds; omitted means preserve duration." },
5878
5884
  idempotencyKey: { type: "string", minLength: 1, maxLength: 200, description: "Required stable key for prepare/add/move/remove and downloads that need acquisition. Reuse the key and identical intent after uncertain responses." }
@@ -5880,7 +5886,7 @@ function createNativeStickerTools(context, dependencies = { host: ensureNativeHo
5880
5886
  execute: async (_id, input, signal) => {
5881
5887
  if (!input || typeof input !== "object" || Array.isArray(input)) throw Error("Invalid sticker arguments");
5882
5888
  const args = input;
5883
- const fields = ["action", "stickerId", "preparationId", "file", "sourceId", "output", "fit", "startMs", "durationMs", "idempotencyKey", "revision", "afterId", "messageId", "assetId"];
5889
+ const fields = ["action", "stickerId", "preparationId", "file", "sourceId", "output", "fit", "maxEdge", "fps", "startMs", "durationMs", "idempotencyKey", "revision", "afterId", "messageId", "assetId"];
5884
5890
  if (Object.keys(args).some((key2) => !fields.includes(key2))) throw Error("Unknown sticker argument");
5885
5891
  const guard2 = () => {
5886
5892
  signal?.throwIfAborted();
@@ -5935,6 +5941,8 @@ function createNativeStickerTools(context, dependencies = { host: ensureNativeHo
5935
5941
  if (args.action === "prepare") {
5936
5942
  const key2 = text3(args.idempotencyKey, "idempotency key");
5937
5943
  if (key2.length > 200 || args.fit != null && typeof args.fit !== "boolean") throw Error("Invalid sticker preparation options");
5944
+ const whole = (value, min, max) => value == null || Number.isInteger(value) && value >= min && value <= max;
5945
+ if (!whole(args.maxEdge, 16, 1024) || !whole(args.fps, 1, 30)) throw Error("Invalid sticker preparation options");
5938
5946
  if (args.startMs != null && typeof args.startMs !== "number" || args.durationMs != null && typeof args.durationMs !== "number") throw Error("Invalid sticker segment");
5939
5947
  const trim = args.durationMs == null ? null : { startMs: Number(args.startMs ?? 0), durationMs: Number(args.durationMs) };
5940
5948
  if (args.startMs != null && !trim || trim && (!Number.isInteger(trim.startMs) || trim.startMs < 0 || trim.startMs > 4294967295 || !Number.isInteger(trim.durationMs) || trim.durationMs < 1 || trim.durationMs > 1e4)) throw Error("Invalid sticker segment");
@@ -5953,7 +5961,7 @@ function createNativeStickerTools(context, dependencies = { host: ensureNativeHo
5953
5961
  } else sourceId = text3(args.sourceId, "source identity");
5954
5962
  guard2();
5955
5963
  context.assertInputCommitAllowed?.();
5956
- const job2 = await client.prepareSticker(accountId, { sourceId, fit: args.fit === true, trim }, key2, signal);
5964
+ const job2 = await client.prepareSticker(accountId, { sourceId, fit: args.fit === true, maxEdge: args.maxEdge == null ? null : Number(args.maxEdge), fps: args.fps == null ? null : Number(args.fps), trim }, key2, signal);
5957
5965
  guard2();
5958
5966
  return result({ ...job2, idempotencyKey: key2 });
5959
5967
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-wechat/agent-wechat",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [