wechat-clawbot 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -3,9 +3,12 @@
3
3
  English | [中文](README.zh.md)
4
4
 
5
5
  Chat with the [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH) agent on your computer from WeChat.
6
+ Clawbot is a DSH plugin and fully open source. It replies with the AI you use in DSH and does not upload your information.
6
7
  Away from your desk, you can still ask it to look through files, edit documents or run commands, and the results come back to the WeChat chat.
7
8
 
8
- It uses WeChat's official **微信ClawBot** channel (Tencent iLink): no second account and no web-login tricks.
9
+ It uses WeChat's official **微信ClawBot** channel: just scan a QR code to log in.
10
+
11
+ After nearly two months of development and real-world use, `wechat-clawbot` has become steadily more stable and economical, and the stable release **v1.0.0** came out on 10 October 2026.
9
12
 
10
13
  ## What it does
11
14
 
@@ -19,14 +22,22 @@ It uses WeChat's official **微信ClawBot** channel (Tencent iLink): no second a
19
22
  - **Understands quotes**: reply to an older message with WeChat's quote feature and it knows which one you mean
20
23
  - **Long chats stay quick**: when the conversation gets long, it tidies older messages into a summary during a quiet spell after a reply, so your next message never waits for it
21
24
 
25
+ ## Cost
26
+
27
+ - When the author uses gpt-6-luna, one WeChat message costs about $0.005–0.007 on average; at around 7 messages a day that is about $1.4 a month (under ¥10).
28
+
22
29
  ## Requirements
23
30
 
24
- - DSH **0.1.7 – 0.2.x** (tested on 0.1.7-rc.2 and 0.2.0-rc.2), Node.js 22+ and pnpm
31
+ - DSH **0.1.7 – 0.2.0** (tested on 0.1.7-rc.2 and 0.2.0-rc.2), Node.js 22+ and pnpm
25
32
  - The official **微信ClawBot** plugin in the WeChat mobile app (WeChat → Settings → Plugins; the first scan may ask you to update WeChat)
26
33
  - A computer that stays on: the bot is online while DSH is running
27
34
 
28
35
  ## Set up in three steps
29
36
 
37
+ **0. Got an agent?**
38
+
39
+ Copy the link to this page, or tell any agent `wechat-clawbot`, and ask it to install it into DSH. Or:
40
+
30
41
  **1. Install the plugin**
31
42
 
32
43
  ```bash
@@ -45,7 +56,7 @@ A QR code appears in the terminal. Scan it with WeChat's "Scan" and confirm.
45
56
 
46
57
  **3. Start chatting**
47
58
 
48
- A new contact, **微信ClawBot**, shows up in WeChat. Message it. The running DSH picks up the new link within a few seconds, so no restart is needed.
59
+ A new contact, **微信ClawBot**, shows up in WeChat. Message it. The running DSH picks up the new link automatically and starts a conversation.
49
60
 
50
61
  Other commands: `clawbot status` shows who is linked, `clawbot logout` unlinks (use the same `npx -y -p wechat-clawbot` prefix).
51
62
 
package/README.zh.md CHANGED
@@ -3,9 +3,12 @@
3
3
  [English](README.md) | 中文
4
4
 
5
5
  在微信里和你电脑上的 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)助手聊天。
6
+ Clawbot 作为 DSH 插件,完全开源,使用 DSH 的 AI 进行回复,不会上传用户信息。
6
7
  出门在外也能让它查文件、改文档、跑命令,结果直接回到微信对话里。
7
8
 
8
- 它走的是微信官方的 **微信ClawBot** 通道(腾讯 iLink),不用小号、不模拟网页登录。
9
+ 它走的是微信官方的 **微信ClawBot** 通道,扫码登录即可。
10
+
11
+ 经过近两个月的开发和实测,`wechat-clawbot` 日趋稳定、省钱,现于2026年10月10日发布稳定版 **v1.0.0**。
9
12
 
10
13
  ## 能做什么
11
14
 
@@ -19,14 +22,22 @@
19
22
  - **看得懂引用**:引用一条旧消息回复,它知道你在说哪条
20
23
  - **聊得越久也不变慢**:回复结束、安静一阵之后,对话太长就趁空闲把旧内容整理成摘要,你下一条消息来时不用等
21
24
 
25
+ ## 成本
26
+
27
+ - 作者用 gpt-6-luna 时,一条微信对话的平均成本约 $0.005–0.007,每天 7 条左右、一个月约 $1.4,不到 ¥10。
28
+
22
29
  ## 需要什么
23
30
 
24
- - DSH **0.1.7 到 0.2.x**(在 0.1.7-rc.2 和 0.2.0-rc.2 上测过),以及 Node.js 22+、pnpm
31
+ - DSH **0.1.7 到 0.2.0**(在 0.1.7-rc.2 和 0.2.0-rc.2 上测过),以及 Node.js 22+、pnpm
25
32
  - 手机微信里能用官方「**微信ClawBot**」插件(微信 → 设置 → 插件;第一次扫码时可能会提示升级微信)
26
33
  - 一台一直开着的电脑:DSH 在运行,bot 才在线
27
34
 
28
35
  ## 三步装好
29
36
 
37
+ **0. 有 Agent**
38
+
39
+ 复制这个网站,或者跟任何 Agent 说 `wechat-clawbot`,让它帮忙安装到DSH即可。或者:
40
+
30
41
  **1. 安装插件**
31
42
 
32
43
  ```bash
@@ -45,7 +56,7 @@ npx -y -p wechat-clawbot clawbot login
45
56
 
46
57
  **3. 开始聊天**
47
58
 
48
- 微信里会多出一个联系人「**微信ClawBot**」,给它发消息就行。正在运行的 DSH 几秒内会自动认出新绑定的账号,不用重启。
59
+ 微信里会多出一个联系人「**微信ClawBot**」,给它发消息就行。正在运行的 DSH 会自动认出新绑定的账号,并开启一个对话。
49
60
 
50
61
  其他命令:`clawbot status` 看绑定的是谁,`clawbot logout` 解除绑定(同样用 `npx -y -p wechat-clawbot` 前缀)。
51
62
 
@@ -0,0 +1,104 @@
1
+ export type BacklogItem =
2
+ /** A text the bot sent (a reminder, or any reply) that did not get through. */
3
+ {
4
+ id: string;
5
+ kind: "text";
6
+ at: string;
7
+ text: string;
8
+ }
9
+ /** A notification from Claude or Codex, kept as one sentence. */
10
+ | {
11
+ id: string;
12
+ kind: "notice";
13
+ at: string;
14
+ source: "Claude" | "Codex";
15
+ summary: string;
16
+ }
17
+ /**
18
+ * A file or image, sent again after the digest if it still exists. Once a
19
+ * digest has said it follows (`announced`), later deliveries only retry it.
20
+ */
21
+ | {
22
+ id: string;
23
+ kind: "file";
24
+ at: string;
25
+ path: string;
26
+ caption?: string;
27
+ original?: boolean;
28
+ attempts?: number;
29
+ announced?: boolean;
30
+ };
31
+ /** What callers hand in; the backlog stamps the id. */
32
+ export type NewBacklogItem = {
33
+ kind: "text";
34
+ at: string;
35
+ text: string;
36
+ } | {
37
+ kind: "notice";
38
+ at: string;
39
+ source: "Claude" | "Codex";
40
+ summary: string;
41
+ } | {
42
+ kind: "file";
43
+ at: string;
44
+ path: string;
45
+ caption?: string;
46
+ original?: boolean;
47
+ };
48
+ /** Items kept per recipient; the oldest go first beyond this. */
49
+ export declare const BACKLOG_LIMIT = 100;
50
+ /** A digest message is split at entry boundaries beyond this many characters. */
51
+ export declare const DIGEST_MAX_CHARS = 3000;
52
+ /** Deliveries a kept file gets before it is given up (a CDN or network failure each time). */
53
+ export declare const FILE_ATTEMPTS = 3;
54
+ /** Whether a send failed because WeChat will not let the bot write first right now. */
55
+ export declare function isSendWindowClosed(err: unknown): boolean;
56
+ /**
57
+ * When a scheduled reminder was due, from the message dsh-schedule writes
58
+ * (`occurrence_at: 2026-10-06T17:30:00.000Z`). A reminder that fired late (the
59
+ * computer was asleep) is still stamped with its own time.
60
+ */
61
+ export declare function occurrenceAt(text: string): string | undefined;
62
+ /** What a file is called in the digest: 图片 or 文件, and its name. */
63
+ export declare function fileLabel(p: string): string;
64
+ /** `10-13 周一 09:00` in the user's zone. */
65
+ export declare function dueStamp(at: Date): string;
66
+ /**
67
+ * One short sentence for a long notification when the sender gave no summary:
68
+ * its first non-empty line, cut at the first sentence end, at most `max` chars.
69
+ */
70
+ export declare function oneSentence(text: string, max?: number): string;
71
+ /**
72
+ * The digest: one header sentence, then every item in time order with the time
73
+ * it was due. Split into several messages at entry boundaries when long.
74
+ */
75
+ export declare function formatDigest(items: readonly BacklogItem[], opts: {
76
+ fileExists: (p: string) => boolean;
77
+ maxChars?: number;
78
+ }): string[];
79
+ /** The digest's messages, each with the ids of the items it carries (forgotten once it is out). */
80
+ export declare function digestChunks(items: readonly BacklogItem[], opts: {
81
+ fileExists: (p: string) => boolean;
82
+ maxChars?: number;
83
+ }): Array<{
84
+ text: string;
85
+ ids: string[];
86
+ }>;
87
+ /** The kept messages, one list per recipient, in `<state dir>/backlog.json`. */
88
+ export declare class Backlog {
89
+ private readonly file;
90
+ constructor(file?: string);
91
+ /** Keep one message for `to`. */
92
+ add(to: string, item: NewBacklogItem): BacklogItem;
93
+ /** What is waiting for `to`, oldest first. */
94
+ peek(to: string): BacklogItem[];
95
+ /** Count one more failed delivery of a kept file; returns the new count. */
96
+ bumpAttempts(to: string, id: string): number;
97
+ /** Note that a digest has told the user these files follow. */
98
+ markAnnounced(to: string, ids: readonly string[]): void;
99
+ /** Forget items once delivered (by id, so anything added meanwhile stays). */
100
+ remove(to: string, ids: readonly string[]): void;
101
+ private read;
102
+ private write;
103
+ }
104
+ //# sourceMappingURL=backlog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backlog.d.ts","sourceRoot":"","sources":["../src/backlog.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,WAAW;AACrB,+EAA+E;AAC7E;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACxD,iEAAiE;GAC/D;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AACzF;;;GAGG;GACD;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzI,uDAAuD;AACvD,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;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EAC7B,IAAI,EAAE;IAAE,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9D,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA8BxC;AAID,gFAAgF;AAChF,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,GAAE,MAAqD;IAExF,iCAAiC;IACjC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,WAAW;IAclD,8CAA8C;IAC9C,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE;IAI/B,4EAA4E;IAC5E,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM;IAS5C,+DAA+D;IAC/D,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAQvD,8EAA8E;IAC9E,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAShD,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,KAAK;CAMd"}
package/lib/backlog.js ADDED
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Messages WeChat would not let the bot send, kept and delivered later as one.
3
+ *
4
+ * iLink lets a bot write first only for a while after the user's last message.
5
+ * In this owner's logs every `sendMessage ret=-2 errmsg=prepare failed` came
6
+ * 24.8–53 h after their last message and every delivered reminder within
7
+ * 20.5 h; the vendored api.ts says the same (agent-initiated sends need a
8
+ * context token that only a recent inbound message refreshes). A reminder that
9
+ * fired later than that, or a Claude/Codex notification, was simply lost, and
10
+ * send_wechat_text had already told the model it was sent.
11
+ *
12
+ * Now such a message waits here, on disk, and goes out after the bot has
13
+ * answered the user's next message: one message that lists everything in time
14
+ * order and marks when each part was due, then any files.
15
+ */
16
+ import fs from "node:fs";
17
+ import path from "node:path";
18
+ import { randomUUID } from "node:crypto";
19
+ import { resolveStateDir } from "./ilink/storage/state-dir.js";
20
+ import { zonedDate, zonedStamp, zonedWeekday } from "./localtime.js";
21
+ import { logger } from "./ilink/util/logger.js";
22
+ /** Items kept per recipient; the oldest go first beyond this. */
23
+ export const BACKLOG_LIMIT = 100;
24
+ /** A digest message is split at entry boundaries beyond this many characters. */
25
+ export const DIGEST_MAX_CHARS = 3000;
26
+ /** Deliveries a kept file gets before it is given up (a CDN or network failure each time). */
27
+ export const FILE_ATTEMPTS = 3;
28
+ /** Whether a send failed because WeChat will not let the bot write first right now. */
29
+ export function isSendWindowClosed(err) {
30
+ return /\bret=-2\b/.test(err instanceof Error ? err.message : String(err));
31
+ }
32
+ /**
33
+ * When a scheduled reminder was due, from the message dsh-schedule writes
34
+ * (`occurrence_at: 2026-10-06T17:30:00.000Z`). A reminder that fired late (the
35
+ * computer was asleep) is still stamped with its own time.
36
+ */
37
+ export function occurrenceAt(text) {
38
+ const m = /^occurrence_at:\s*(\S+)\s*$/m.exec(text);
39
+ if (m === null)
40
+ return undefined;
41
+ const t = Date.parse(m[1]);
42
+ return Number.isNaN(t) ? undefined : new Date(t).toISOString();
43
+ }
44
+ /** What a file is called in the digest: 图片 or 文件, and its name. */
45
+ export function fileLabel(p) {
46
+ return `${IMAGE_EXT.test(p) ? "图片" : "文件"} ${path.basename(p)}`;
47
+ }
48
+ /** `10-13 周一 09:00` in the user's zone. */
49
+ export function dueStamp(at) {
50
+ const stamp = zonedStamp(at);
51
+ return `${stamp.slice(0, 5)} ${zonedWeekday(zonedDate(at))} ${stamp.slice(6)}`;
52
+ }
53
+ /**
54
+ * One short sentence for a long notification when the sender gave no summary:
55
+ * its first non-empty line, cut at the first sentence end, at most `max` chars.
56
+ */
57
+ export function oneSentence(text, max = 60) {
58
+ const line = text.split(/\r?\n/).map((s) => s.trim()).find((s) => s !== "") ?? "";
59
+ const s = line.replace(/[::]\s*$/, "");
60
+ const end = s.search(/[。!?!?]/);
61
+ if (end >= 0 && end < max)
62
+ return s.slice(0, end + 1);
63
+ return s.length <= max ? s : `${s.slice(0, max - 1)}…`;
64
+ }
65
+ const IMAGE_EXT = /\.(png|jpe?g|gif|webp|heic|heif|bmp)$/i;
66
+ /**
67
+ * The digest: one header sentence, then every item in time order with the time
68
+ * it was due. Split into several messages at entry boundaries when long.
69
+ */
70
+ export function formatDigest(items, opts) {
71
+ return digestChunks(items, opts).map((chunk) => chunk.text);
72
+ }
73
+ /** The digest's messages, each with the ids of the items it carries (forgotten once it is out). */
74
+ export function digestChunks(items, opts) {
75
+ const maxChars = opts.maxChars ?? DIGEST_MAX_CHARS;
76
+ // A file an earlier digest already announced is only retried, not announced again.
77
+ const sorted = [...items]
78
+ .filter((item) => item.kind !== "file" || item.announced !== true)
79
+ .sort((a, b) => Date.parse(a.at) - Date.parse(b.at));
80
+ if (sorted.length === 0)
81
+ return [];
82
+ const entries = sorted.map((item) => {
83
+ const due = `〔${dueStamp(new Date(item.at))}〕`;
84
+ if (item.kind === "text")
85
+ return `${due}\n${item.text}`;
86
+ if (item.kind === "notice")
87
+ return `${due}${item.source} 的通知\n${item.summary}`;
88
+ const exists = opts.fileExists(item.path);
89
+ const status = exists ? "(随后补发)" : "(文件已经不在了,没法补发)";
90
+ // The file carries its own caption; when it is gone, the caption is all that is left.
91
+ return `${due}${fileLabel(item.path)}${status}${!exists && item.caption ? `\n${item.caption}` : ""}`;
92
+ });
93
+ const header = `有 ${sorted.length} 条消息当时没能发出(微信不允许 bot 在你一段时间没说话时主动发消息),按原定时间补上:`;
94
+ const chunks = [];
95
+ let current = { text: header, ids: [] };
96
+ entries.forEach((entry, i) => {
97
+ const next = `${current.text}\n\n${entry}`;
98
+ if (next.length > maxChars && current.ids.length > 0) {
99
+ chunks.push(current);
100
+ current = { text: entry, ids: [sorted[i].id] };
101
+ }
102
+ else {
103
+ current = { text: next, ids: [...current.ids, sorted[i].id] };
104
+ }
105
+ });
106
+ chunks.push(current);
107
+ return chunks;
108
+ }
109
+ /** The kept messages, one list per recipient, in `<state dir>/backlog.json`. */
110
+ export class Backlog {
111
+ file;
112
+ constructor(file = path.join(resolveStateDir(), "backlog.json")) {
113
+ this.file = file;
114
+ }
115
+ /** Keep one message for `to`. */
116
+ add(to, item) {
117
+ const data = this.read();
118
+ const list = data.recipients[to] ?? [];
119
+ const kept = { ...item, id: randomUUID() };
120
+ list.push(kept);
121
+ if (list.length > BACKLOG_LIMIT) {
122
+ const dropped = list.splice(0, list.length - BACKLOG_LIMIT);
123
+ logger.warn(`backlog: more than ${BACKLOG_LIMIT} waiting for ${to}; dropped the ${dropped.length} oldest`);
124
+ }
125
+ data.recipients[to] = list;
126
+ this.write(data);
127
+ return kept;
128
+ }
129
+ /** What is waiting for `to`, oldest first. */
130
+ peek(to) {
131
+ return [...(this.read().recipients[to] ?? [])];
132
+ }
133
+ /** Count one more failed delivery of a kept file; returns the new count. */
134
+ bumpAttempts(to, id) {
135
+ const data = this.read();
136
+ const item = (data.recipients[to] ?? []).find((i) => i.id === id);
137
+ if (item === undefined || item.kind !== "file")
138
+ return 0;
139
+ item.attempts = (item.attempts ?? 0) + 1;
140
+ this.write(data);
141
+ return item.attempts;
142
+ }
143
+ /** Note that a digest has told the user these files follow. */
144
+ markAnnounced(to, ids) {
145
+ if (ids.length === 0)
146
+ return;
147
+ const data = this.read();
148
+ const want = new Set(ids);
149
+ for (const item of data.recipients[to] ?? [])
150
+ if (item.kind === "file" && want.has(item.id))
151
+ item.announced = true;
152
+ this.write(data);
153
+ }
154
+ /** Forget items once delivered (by id, so anything added meanwhile stays). */
155
+ remove(to, ids) {
156
+ const data = this.read();
157
+ const gone = new Set(ids);
158
+ const left = (data.recipients[to] ?? []).filter((item) => !gone.has(item.id));
159
+ if (left.length > 0)
160
+ data.recipients[to] = left;
161
+ else
162
+ delete data.recipients[to];
163
+ this.write(data);
164
+ }
165
+ read() {
166
+ try {
167
+ const parsed = JSON.parse(fs.readFileSync(this.file, "utf-8"));
168
+ if (parsed && typeof parsed === "object" && parsed.recipients && typeof parsed.recipients === "object") {
169
+ return { version: 1, recipients: parsed.recipients };
170
+ }
171
+ }
172
+ catch (err) {
173
+ if (err.code !== "ENOENT")
174
+ logger.warn(`backlog: unreadable ${this.file}: ${String(err)}`);
175
+ }
176
+ return { version: 1, recipients: {} };
177
+ }
178
+ write(data) {
179
+ fs.mkdirSync(path.dirname(this.file), { recursive: true });
180
+ const tmp = `${this.file}.tmp`;
181
+ fs.writeFileSync(tmp, JSON.stringify(data, null, 2), { mode: 0o600 });
182
+ fs.renameSync(tmp, this.file);
183
+ }
184
+ }
185
+ //# sourceMappingURL=backlog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backlog.js","sourceRoot":"","sources":["../src/backlog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAmBhD,iEAAiE;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAErC,8FAA8F;AAC9F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B,uFAAuF;AACvF,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC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AI,KAAK,QAAQ;gBAAE,MAAM,CAAC,IAAI,CAAC,uBAAuB,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACxH,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IACxC,CAAC;IAEO,KAAK,CAAC,IAAiB;QAC7B,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,MAAM,CAAC;QAC/B,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACtE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF"}
package/lib/bridge.d.ts CHANGED
@@ -4,6 +4,8 @@ import { SessionId, type Session, type SessionEvent } from "@deepseek-ai/dsh-ses
4
4
  import { type CodexPeer } from "./codex-peer.js";
5
5
  import type { ClawbotConfig } from "./config.js";
6
6
  import { PendingRegistry } from "./pending.js";
7
+ import { Backlog } from "./backlog.js";
8
+ import type { FileUploadResult } from "./tool.js";
7
9
  import type { ResolvedWeixinAccount } from "./ilink/auth/accounts.js";
8
10
  export type SendTextFn = (to: string, text: string) => Promise<void>;
9
11
  export type BridgeDeps = {
@@ -14,6 +16,14 @@ export type BridgeDeps = {
14
16
  /** Pending WeChat interactions (approvals + questions). */
15
17
  pending: PendingRegistry;
16
18
  codexPeer?: CodexPeer;
19
+ /** Messages WeChat would not take yet (see backlog.ts); tests pass a temp one. */
20
+ backlog?: Backlog;
21
+ /** Upload one kept file when its backlog is delivered (index.ts wires uploadFileTo). */
22
+ sendFile?: (to: string, file: {
23
+ path: string;
24
+ caption?: string;
25
+ original?: boolean;
26
+ }) => Promise<FileUploadResult>;
17
27
  };
18
28
  /**
19
29
  * The durable, serializable reference `attachments.saveImages()` hands back.
@@ -53,6 +63,33 @@ export declare class WechatBridge {
53
63
  private selectionInstalled;
54
64
  /** Queued turns waiting for the serialized worker (oldest first). */
55
65
  private readonly queue;
66
+ /** Whether the running turn has answered yet (sent, asked, or started a file). */
67
+ private answeredThisTurn;
68
+ /** Replies held this turn because the recipient wrote more (capped, see coalesce.ts). */
69
+ private holdsThisTurn;
70
+ /** Texts the current queued turn answers (batch, merges, steered ones), for auto-memory. */
71
+ private chainTexts;
72
+ /** Tool calls in the current turn; 0 means the bot is still on its first thought. */
73
+ private toolCallsThisTurn;
74
+ /** Restarts made while answering the current queued message (capped). */
75
+ private restarts;
76
+ /**
77
+ * The message the worker's running turn answers. A newer one merges into it
78
+ * while the host has not picked it up (a restart settling, maintenance
79
+ * holding the agent); once written into the history (`recordedAt`, the host
80
+ * turn and step that did it), a restart may cancel that step without losing
81
+ * it. A restart's own message is `restarted` and carries TOGETHER_HINT.
82
+ */
83
+ private turnMessage;
84
+ /** The host turn and step running now, from turn/start and step/start. */
85
+ private hostTurn;
86
+ private hostStep;
87
+ /** Messages each sender has put into the agent's inbox, by id; unread while still there. */
88
+ private readonly inboxIds;
89
+ /** What those messages were, to answer them if a turn ends with them still waiting. */
90
+ private readonly inboxTasks;
91
+ /** Messages per sender that reached clawbot but not the bridge yet (an image downloading). */
92
+ private readonly incoming;
56
93
  /** Whether the WeChat tools are registered on the current agent scope. */
57
94
  private toolsRegistered;
58
95
  /** The sender whose turn is currently being driven (approvals go to them). */
@@ -76,6 +113,16 @@ export declare class WechatBridge {
76
113
  private readonly idleCompact;
77
114
  /** Tokens the last model request on this session carried, as reported by the provider. */
78
115
  private lastRequestTokens;
116
+ /** Messages WeChat would not take yet; sent after the user's next message is answered. */
117
+ private readonly backlog;
118
+ /** When each sender's latest message reached the bot: that reopens WeChat's window. */
119
+ private readonly lastInbound;
120
+ /** Recipients whose backlog is being delivered right now (one delivery at a time). */
121
+ private readonly delivering;
122
+ /** Senders whose message was steered into a turn the worker does not drive (a reminder). */
123
+ private readonly steeredIntoOtherTurn;
124
+ /** When the running reminder turn was due: what a refused reminder is stamped with. */
125
+ private reminderDueAt;
79
126
  constructor(ctx: Context, config: ClawbotConfig, sendText: SendTextFn, deps: BridgeDeps);
80
127
  /**
81
128
  * Log once at startup whether idle compaction can work here: the host's
@@ -105,7 +152,42 @@ export declare class WechatBridge {
105
152
  */
106
153
  sendTextTo(sender: string, text: string, opts?: {
107
154
  uncapped?: boolean;
155
+ transient?: boolean;
108
156
  }): boolean;
157
+ /** send_wechat_file hit WeChat's closed window: keep the file for later. */
158
+ keepFile(to: string, file: {
159
+ path: string;
160
+ caption?: string;
161
+ original?: boolean;
162
+ }): void;
163
+ /** Keep what WeChat would not take now (see backlog.ts). */
164
+ private keep;
165
+ /**
166
+ * Send what WeChat would not take earlier, once `to` has written again and
167
+ * the bot has answered: one digest in time order (on the outbound chain, so
168
+ * it lands after the reply), then any files. One delivery at a time.
169
+ */
170
+ private deliverBacklog;
171
+ /** The digest, part by part; each part's items are settled once it is out. */
172
+ private sendDigest;
173
+ /** Files a digest said would follow; give up with one line after FILE_ATTEMPTS. */
174
+ private sendKeptFiles;
175
+ /**
176
+ * After a turn the worker did not drive (a reminder, a web turn) that
177
+ * someone's WeChat message was steered into: once the agent is idle, a
178
+ * message that turn never read (it failed) is answered first; then what
179
+ * WeChat refused earlier goes out.
180
+ */
181
+ private afterOtherTurn;
182
+ /** Drop delivered (or hopeless) items from the backlog. */
183
+ private forget;
184
+ /**
185
+ * Tell the bot what just went out late, so a reply to one of those messages
186
+ * makes sense to it. Injected, not followed up: it rides along with the next turn.
187
+ */
188
+ private noteBacklogDelivered;
189
+ /** A line for the bot about what was (or was not) delivered late; it rides along with the next turn. */
190
+ private noteSession;
109
191
  get id(): SessionId;
110
192
  /**
111
193
  * Ask the user a question THROUGH WeChat and wait for their reply.
@@ -262,6 +344,38 @@ export declare class WechatBridge {
262
344
  /** Wrap `attachImage` as the content block an inbound message carries. */
263
345
  private imageBlock;
264
346
  enqueueMessage(sender: string, text: string, imagePath?: string): Promise<void>;
347
+ /**
348
+ * Add a newer message to the one the running turn has not picked up yet (a
349
+ * restart settling, or maintenance such as compaction holding the agent).
350
+ * False once the host has taken it; then the usual rules apply.
351
+ */
352
+ private mergeIntoWaitingTurn;
353
+ /** Remember a message `task.sender` put into the agent's inbox (unread while it is still there). */
354
+ private trackInbox;
355
+ /** A message from `sender` reached clawbot (+1) or the bridge (-1); see INCOMING_WAIT_MS. */
356
+ noteIncoming(sender: string, delta: 1 | -1): void;
357
+ /**
358
+ * After the worker's turn: messages still waiting in the agent's inbox (the
359
+ * turn failed, or ended before reading them) are taken out and answered
360
+ * next, instead of waiting for whatever the user sends after them.
361
+ */
362
+ private requeueUnread;
363
+ /**
364
+ * Whether `sender` has a message the next step will read: one still waiting
365
+ * in the agent's next-step inbox. One queued for a later turn does not count;
366
+ * holding a reply for it would only make the model wait for nothing.
367
+ */
368
+ private hasUnread;
369
+ /**
370
+ * Read before replying (see coalesce.ts): true when a reply to `sender` has
371
+ * to wait because they wrote more that the model has not read yet. The
372
+ * reply tool then returns HOLD_MESSAGE and the next step reads it.
373
+ */
374
+ holdReply(sender: string, signal?: AbortSignal): Promise<boolean>;
375
+ /** The text a held reply tool returns. */
376
+ get holdMessage(): string;
377
+ /** A reply tool went ahead: later messages this turn are follow-ups, not part of the same answer. */
378
+ noteAnswered(): void;
265
379
  /** Start the serialized worker if it is not already running. */
266
380
  private runWorker;
267
381
  /** Drive queued turns one at a time; never rejects. */
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAEL,KAAK,KA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