@kyan-du/agent-wechat-wechaty-puppet 0.14.3 → 0.14.5
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/mod.js +34 -3
- package/package.json +1 -1
package/dist/mod.js
CHANGED
|
@@ -4158,6 +4158,15 @@ var downloadFileParamsSchema = external_exports.object({
|
|
|
4158
4158
|
var downloadFileResultSchema = openChatResultSchema.extend({
|
|
4159
4159
|
clicked: external_exports.boolean().optional()
|
|
4160
4160
|
});
|
|
4161
|
+
var materializeChatHistoryParamsSchema = external_exports.object({
|
|
4162
|
+
chatId: external_exports.string().min(1),
|
|
4163
|
+
title: external_exports.string().min(1).optional(),
|
|
4164
|
+
localId: external_exports.number().int().optional(),
|
|
4165
|
+
executionTimeoutMs: external_exports.number().int().positive().optional()
|
|
4166
|
+
});
|
|
4167
|
+
var materializeChatHistoryResultSchema = openChatResultSchema.extend({
|
|
4168
|
+
clicked: external_exports.boolean().optional()
|
|
4169
|
+
});
|
|
4161
4170
|
var idempotencyKeySchema = external_exports.string().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/);
|
|
4162
4171
|
var forwardedMessageNodeSchema = external_exports.lazy(() => external_exports.object({
|
|
4163
4172
|
sender: external_exports.string().optional(),
|
|
@@ -4271,7 +4280,8 @@ var mediaResultSchema = external_exports.object({
|
|
|
4271
4280
|
format: external_exports.string(),
|
|
4272
4281
|
filename: external_exports.string(),
|
|
4273
4282
|
source: external_exports.enum(["original", "thumbnail"]).optional(),
|
|
4274
|
-
errorCode: external_exports.string().optional()
|
|
4283
|
+
errorCode: external_exports.string().optional(),
|
|
4284
|
+
items: external_exports.array(external_exports.lazy(() => mediaResultSchema)).optional()
|
|
4275
4285
|
});
|
|
4276
4286
|
var agentConfigSchema = external_exports.object({
|
|
4277
4287
|
maxTurns: external_exports.number().int().positive().default(30),
|
|
@@ -4355,6 +4365,17 @@ var WeChatClient = class {
|
|
|
4355
4365
|
await throwHttpError(res);
|
|
4356
4366
|
return res.json();
|
|
4357
4367
|
}
|
|
4368
|
+
async put(path, body, signal) {
|
|
4369
|
+
const res = await fetch(`${this.base}${path}`, {
|
|
4370
|
+
method: "PUT",
|
|
4371
|
+
headers: this.headers,
|
|
4372
|
+
body: body != null ? JSON.stringify(body) : void 0,
|
|
4373
|
+
signal
|
|
4374
|
+
});
|
|
4375
|
+
if (!res.ok)
|
|
4376
|
+
await throwHttpError(res);
|
|
4377
|
+
return res.json();
|
|
4378
|
+
}
|
|
4358
4379
|
// ---- Status ----
|
|
4359
4380
|
async status() {
|
|
4360
4381
|
return this.get("/api/status");
|
|
@@ -4376,12 +4397,18 @@ var WeChatClient = class {
|
|
|
4376
4397
|
return this.post("/api/status/auth/reset");
|
|
4377
4398
|
}
|
|
4378
4399
|
// ---- Chats ----
|
|
4379
|
-
async listChatsPage(limit, cursor, unreadOnly) {
|
|
4380
|
-
const page = await this.get(`/api/chats${qs({ limit, cursor, unreadOnly })}`);
|
|
4400
|
+
async listChatsPage(limit, cursor, unreadOnly, interestOnly) {
|
|
4401
|
+
const page = await this.get(`/api/chats${qs({ limit, cursor, unreadOnly, interestOnly })}`);
|
|
4381
4402
|
if (page.errorCode)
|
|
4382
4403
|
throw new WeChatHttpError(400, "Bad Request", page.errorCode, page.errorCode);
|
|
4383
4404
|
return page;
|
|
4384
4405
|
}
|
|
4406
|
+
async getMonitorInterest() {
|
|
4407
|
+
return this.get("/api/interest");
|
|
4408
|
+
}
|
|
4409
|
+
async setMonitorInterest(interest) {
|
|
4410
|
+
return this.put("/api/interest", interest);
|
|
4411
|
+
}
|
|
4385
4412
|
async listChats(limit) {
|
|
4386
4413
|
return (await this.listChatsPage(limit)).items;
|
|
4387
4414
|
}
|
|
@@ -4400,6 +4427,10 @@ var WeChatClient = class {
|
|
|
4400
4427
|
async downloadFile(chatId, filename, signal, executionTimeoutMs) {
|
|
4401
4428
|
return this.post(`/api/chats/${encodeURIComponent(chatId)}/download-file${qs({ filename, executionTimeoutMs })}`, void 0, signal);
|
|
4402
4429
|
}
|
|
4430
|
+
async materializeChatHistory(chatId, options, signal) {
|
|
4431
|
+
const { title, localId, executionTimeoutMs } = options ?? {};
|
|
4432
|
+
return this.post(`/api/chats/${encodeURIComponent(chatId)}/materialize-chat-history${qs({ title, localId, executionTimeoutMs })}`, void 0, signal);
|
|
4433
|
+
}
|
|
4403
4434
|
async listGroupMembersPage(groupId, limit, cursor) {
|
|
4404
4435
|
const page = groupMembersPageSchema.parse(await this.get(`/api/groups/${encodeURIComponent(groupId)}/members${qs({ limit, cursor })}`));
|
|
4405
4436
|
if (page.errorCode)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kyan-du/agent-wechat-wechaty-puppet",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.5",
|
|
4
4
|
"description": "Wechaty Puppet for agent-wechat — bridges Wechaty bots to WeChat via the agent-wechat REST/WebSocket server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/mod.js",
|