openclaw-weixin 3.0.2 → 3.1.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.
- package/CHANGELOG.md +20 -0
- package/CHANGELOG_EN.md +25 -0
- package/README.md +101 -50
- package/README_EN.md +113 -57
- package/dist/src/auth/accounts.js +313 -18
- package/dist/src/auth/accounts.js.map +1 -1
- package/dist/src/channel.js +106 -49
- package/dist/src/channel.js.map +1 -1
- package/dist/src/messaging/inbound.js +13 -8
- package/dist/src/messaging/inbound.js.map +1 -1
- package/dist/src/messaging/process-message.js +3 -2
- package/dist/src/messaging/process-message.js.map +1 -1
- package/dist/src/monitor/monitor.js +2 -0
- package/dist/src/monitor/monitor.js.map +1 -1
- package/docs/architecture.md +95 -103
- package/docs/architecture_EN.md +136 -0
- package/docs/backend-api.md +187 -196
- package/docs/backend-api_EN.md +347 -0
- package/docs/guide.md +45 -55
- package/docs/guide_EN.md +110 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +7 -7
- package/docs/backend-api.zh_CN.md +0 -338
- package/docs/guide.zh_CN.md +0 -99
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../../src/monitor/monitor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAsB,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,iCAAiC,GAClC,MAAM,gCAAgC,CAAC;AACxC,OAAO,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,wBAAwB,wCAAwC,CAAC,CAAC;gBAC5F,mBAAmB,GAAG,CAAC,CAAC;gBACxB,MAAM,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAsB;IACrD,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC;IACrG,OAAO,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,KAAK,CAAC,EAAU,EAAE,MAAoB;IAC7C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAClC,MAAM,EAAE,gBAAgB,CACtB,OAAO,EACP,GAAG,EAAE;YACH,YAAY,CAAC,CAAC,CAAC,CAAC;YAChB,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/B,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/docs/architecture.md
CHANGED
|
@@ -1,133 +1,125 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 架构说明
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
runtime. The plugin owns login, account state, long polling, message conversion,
|
|
5
|
-
and outbound media transfer. OpenClaw owns routing, sessions, command
|
|
6
|
-
authorization, reply generation, hooks, and the unified media store.
|
|
3
|
+
[English](./architecture_EN.md)
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
`openclaw-weixin` 将微信 HTTP/CDN 协议适配到 OpenClaw channel 运行时。插件负责
|
|
6
|
+
登录、账号状态、长轮询、消息转换和出站媒体传输;OpenClaw 负责路由、会话、命令
|
|
7
|
+
授权、回复生成、hook 和统一媒体存储。
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
线级接口与消息结构详见[后端 API 协议](./backend-api.md)。
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
## 组件地图
|
|
12
|
+
|
|
13
|
+
| 组件 | 职责 |
|
|
14
14
|
| --- | --- |
|
|
15
|
-
| `index.ts` |
|
|
16
|
-
| `src/channel.ts` |
|
|
17
|
-
| `src/auth/` |
|
|
18
|
-
| `src/api/` |
|
|
19
|
-
| `src/monitor/monitor.ts` |
|
|
20
|
-
| `src/messaging/process-message.ts` |
|
|
21
|
-
| `src/messaging/send*.ts` |
|
|
22
|
-
| `src/cdn
|
|
23
|
-
| `src/storage/` |
|
|
24
|
-
|
|
25
|
-
##
|
|
15
|
+
| `index.ts` | 校验宿主兼容性并注册 channel |
|
|
16
|
+
| `src/channel.ts` | 实现 OpenClaw channel 契约与账号生命周期 |
|
|
17
|
+
| `src/auth/` | 扫码登录、账号持久化、ID 兼容和配对 |
|
|
18
|
+
| `src/api/` | 构造已鉴权的后端请求并分类失败 |
|
|
19
|
+
| `src/monitor/monitor.ts` | 轮询更新、持久化游标并调度入站任务 |
|
|
20
|
+
| `src/messaging/process-message.ts` | 授权、路由、记录并分派单条入站消息 |
|
|
21
|
+
| `src/messaging/send*.ts` | 将出站文本和媒体转换为后端消息条目 |
|
|
22
|
+
| `src/cdn/`、`src/media/` | 加密、上传、下载、解密并转码媒体 |
|
|
23
|
+
| `src/storage/` | 解析状态路径并持久化轮询游标 |
|
|
24
|
+
|
|
25
|
+
## 插件与账号生命周期
|
|
26
26
|
|
|
27
27
|
```mermaid
|
|
28
28
|
flowchart TD
|
|
29
|
-
A[index.ts
|
|
30
|
-
B --> C[
|
|
31
|
-
C --> D{
|
|
32
|
-
D
|
|
33
|
-
E --> F[
|
|
34
|
-
F --> G[
|
|
35
|
-
G --> H[
|
|
36
|
-
D
|
|
37
|
-
I --> J[
|
|
38
|
-
J --> K[
|
|
39
|
-
D
|
|
40
|
-
L --> M[
|
|
29
|
+
A[index.ts 注册] --> B[检查 OpenClaw 宿主版本]
|
|
30
|
+
B --> C[注册 weixinPlugin]
|
|
31
|
+
C --> D{操作}
|
|
32
|
+
D -->|登录| E[启动扫码会话]
|
|
33
|
+
E --> F[等待确认]
|
|
34
|
+
F --> G[持久化账号与配对状态]
|
|
35
|
+
G --> H[触发 channel 重载]
|
|
36
|
+
D -->|启动账号| I[恢复 context token]
|
|
37
|
+
I --> J[通知后端启动]
|
|
38
|
+
J --> K[运行 monitor 循环]
|
|
39
|
+
D -->|停止或重载| L[中止活跃轮询]
|
|
40
|
+
L --> M[通知后端停止]
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
silently merge unrelated accounts.
|
|
43
|
+
插件/channel ID 和状态目录结构都是兼容性边界。登录成功后,可以替换同一微信用户的
|
|
44
|
+
过期账号记录,但不得静默合并无关账号。
|
|
46
45
|
|
|
47
|
-
##
|
|
46
|
+
## 入站流程
|
|
48
47
|
|
|
49
48
|
```mermaid
|
|
50
49
|
sequenceDiagram
|
|
51
|
-
participant Backend as
|
|
50
|
+
participant Backend as 微信后端
|
|
52
51
|
participant Monitor as monitorWeixinProvider
|
|
53
52
|
participant Processor as processOneMessage
|
|
54
|
-
participant Runtime as OpenClaw channel
|
|
55
|
-
|
|
56
|
-
Monitor->>Backend: getUpdates
|
|
57
|
-
Backend-->>Monitor:
|
|
58
|
-
Monitor->>Monitor:
|
|
59
|
-
Monitor->>Processor:
|
|
60
|
-
Processor->>Processor:
|
|
61
|
-
Processor->>Runtime:
|
|
62
|
-
Processor->>Runtime:
|
|
63
|
-
Processor->>Runtime:
|
|
64
|
-
Runtime-->>Processor:
|
|
53
|
+
participant Runtime as OpenClaw channel 运行时
|
|
54
|
+
|
|
55
|
+
Monitor->>Backend: getUpdates(游标、中止信号)
|
|
56
|
+
Backend-->>Monitor: 消息与下一游标
|
|
57
|
+
Monitor->>Monitor: 持久化游标与账号级 context token
|
|
58
|
+
Monitor->>Processor: 调度消息
|
|
59
|
+
Processor->>Processor: 处理斜杠命令或下载媒体
|
|
60
|
+
Processor->>Runtime: 授权发送者并解析 agent 路由
|
|
61
|
+
Processor->>Runtime: 记录入站会话
|
|
62
|
+
Processor->>Runtime: 分派回复
|
|
63
|
+
Runtime-->>Processor: 文本、媒体与条目生命周期事件
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
so an active ordinary turn cannot block approval.
|
|
66
|
+
普通消息会串行处理,直到 OpenClaw 接受当前 turn;随后轮询即可接纳下一条消息。插件
|
|
67
|
+
审批命令使用独立调度通道,因此活跃的普通 turn 不会阻塞审批。
|
|
70
68
|
|
|
71
|
-
##
|
|
69
|
+
## 出站流程
|
|
72
70
|
|
|
73
71
|
```mermaid
|
|
74
72
|
flowchart LR
|
|
75
|
-
A[OpenClaw
|
|
76
|
-
B
|
|
77
|
-
B
|
|
73
|
+
A[OpenClaw 出站请求] --> B{是否提供账号 ID?}
|
|
74
|
+
B -->|是| C[解析已配置账号]
|
|
75
|
+
B -->|否| D[按账号级 context token 解析]
|
|
78
76
|
D --> C
|
|
79
|
-
C --> E[
|
|
80
|
-
E --> F[
|
|
81
|
-
F
|
|
82
|
-
F
|
|
83
|
-
H
|
|
84
|
-
H
|
|
85
|
-
J --> K[
|
|
86
|
-
K --> L[
|
|
87
|
-
I --> M[
|
|
77
|
+
C --> E[检查活跃会话]
|
|
78
|
+
E --> F[运行 message_sending hook]
|
|
79
|
+
F -->|已取消| G[不向后端发送并返回]
|
|
80
|
+
F -->|继续| H{文本还是媒体?}
|
|
81
|
+
H -->|文本| I[过滤 Markdown 并调用 sendMessage]
|
|
82
|
+
H -->|媒体| J[远程资源则先下载]
|
|
83
|
+
J --> K[加密并上传至 CDN]
|
|
84
|
+
K --> L[构造媒体消息条目]
|
|
85
|
+
I --> M[触发 message_sent hook]
|
|
88
86
|
L --> M
|
|
89
87
|
```
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
sending from the wrong bot.
|
|
89
|
+
存在多个账号时,只有恰好能选出一个账号,才允许省略账号 ID。上下文缺失或存在歧义时
|
|
90
|
+
必须失败,不得冒险使用错误的 bot 发送消息。
|
|
94
91
|
|
|
95
|
-
##
|
|
92
|
+
## 持久化状态
|
|
96
93
|
|
|
97
|
-
|
|
98
|
-
override applies.
|
|
94
|
+
除非框架已有覆盖设置,以下路径均相对于 OpenClaw 状态目录。
|
|
99
95
|
|
|
100
|
-
|
|
|
96
|
+
| 路径 | 内容 |
|
|
101
97
|
| --- | --- |
|
|
102
|
-
| `openclaw-weixin/accounts.json` |
|
|
103
|
-
| `openclaw-weixin/
|
|
104
|
-
| `openclaw-weixin/accounts/<accountId>.
|
|
105
|
-
| `openclaw-weixin/accounts/<accountId>.
|
|
106
|
-
| `openclaw-weixin/
|
|
107
|
-
| `
|
|
108
|
-
| `openclaw.json` |
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
##
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
- Account and storage tests point `OPENCLAW_STATE_DIR` to isolated temporary
|
|
131
|
-
directories.
|
|
132
|
-
- Shared builders live under `test/helpers/`; test-only files must not be emitted
|
|
133
|
-
into `dist/`.
|
|
98
|
+
| `openclaw-weixin/accounts.json` | 已注册的主 bot-hash 账号 ID(monitor) |
|
|
99
|
+
| `openclaw-weixin/account-aliases.json` | 可选的 1:1 `别名 → hash` 映射,用于绑定和出站 |
|
|
100
|
+
| `openclaw-weixin/accounts/<accountId>.json` | token、后端 URL、保存时间和关联用户 ID |
|
|
101
|
+
| `openclaw-weixin/accounts/<accountId>.sync.json` | `getUpdates` 游标 |
|
|
102
|
+
| `openclaw-weixin/accounts/<accountId>.context-tokens.json` | 该账号的收件人 context token |
|
|
103
|
+
| `openclaw-weixin/replay-dedupe/<accountId>.json` | 入站 `getUpdates` 重放墓碑(保留 24 小时;较新的宿主可能将路径映射到 SQLite) |
|
|
104
|
+
| `credentials/openclaw-weixin-<accountId>-allowFrom.json` | 框架配对允许列表 |
|
|
105
|
+
| `openclaw.json` | channel 配置和账号覆盖项 |
|
|
106
|
+
|
|
107
|
+
加载器保留对旧版原始 ID、旧版单账号凭据文件和旧版同步游标路径的回退兼容。更改这些
|
|
108
|
+
回退逻辑时必须添加迁移测试。
|
|
109
|
+
|
|
110
|
+
## 失败与隐私边界
|
|
111
|
+
|
|
112
|
+
- 后端 HTTP 错误会附带可操作的上下文,但不会暴露原始 authorization token 或
|
|
113
|
+
context token。
|
|
114
|
+
- token 过期后,该账号的所有请求都会暂停,之后才恢复轮询。
|
|
115
|
+
- 长轮询接收 Gateway 中止信号,因此停止或重载无需等待服务端超时。
|
|
116
|
+
- 媒体日志必须隐去 URL 和加密查询参数。
|
|
117
|
+
- 测试和示例使用 `account-1`、`user-1` 等合成 ID。
|
|
118
|
+
|
|
119
|
+
## 测试接缝
|
|
120
|
+
|
|
121
|
+
- API 测试替换 `fetch`,并断言请求和响应边界。
|
|
122
|
+
- monitor 测试模拟轮询、游标持久化、context 存储和消息处理。
|
|
123
|
+
- 消息处理测试使用最小化的强类型 channel 运行时 fake。
|
|
124
|
+
- 账号和存储测试将 `OPENCLAW_STATE_DIR` 指向隔离的临时目录。
|
|
125
|
+
- 共用 builder 位于 `test/helpers/`;测试专用文件不得输出到 `dist/`。
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
[简体中文](./architecture.md)
|
|
4
|
+
|
|
5
|
+
`openclaw-weixin` adapts the Weixin HTTP/CDN protocol to the OpenClaw channel
|
|
6
|
+
runtime. The plugin owns login, account state, long polling, message conversion,
|
|
7
|
+
and outbound media transfer. OpenClaw owns routing, sessions, command
|
|
8
|
+
authorization, reply generation, hooks, and the unified media store.
|
|
9
|
+
|
|
10
|
+
The wire-level endpoint and message shapes are documented in the
|
|
11
|
+
[backend API protocol](./backend-api_EN.md).
|
|
12
|
+
|
|
13
|
+
## Component map
|
|
14
|
+
|
|
15
|
+
| Component | Responsibility |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `index.ts` | Validate host compatibility and register the channel |
|
|
18
|
+
| `src/channel.ts` | Implement the OpenClaw channel contract and account lifecycle |
|
|
19
|
+
| `src/auth/` | QR login, account persistence, ID compatibility, and pairing |
|
|
20
|
+
| `src/api/` | Build authenticated backend requests and classify failures |
|
|
21
|
+
| `src/monitor/monitor.ts` | Poll updates, persist cursors, and schedule inbound work |
|
|
22
|
+
| `src/messaging/process-message.ts` | Authorize, route, record, and dispatch one inbound message |
|
|
23
|
+
| `src/messaging/send*.ts` | Convert outbound text/media to backend message items |
|
|
24
|
+
| `src/cdn/`, `src/media/` | Encrypt, upload, download, decrypt, and transcode media |
|
|
25
|
+
| `src/storage/` | Resolve state paths and persist the polling cursor |
|
|
26
|
+
|
|
27
|
+
## Plugin and account lifecycle
|
|
28
|
+
|
|
29
|
+
```mermaid
|
|
30
|
+
flowchart TD
|
|
31
|
+
A[index.ts register] --> B[Check OpenClaw host version]
|
|
32
|
+
B --> C[Register weixinPlugin]
|
|
33
|
+
C --> D{Operation}
|
|
34
|
+
D -->|login| E[Start QR session]
|
|
35
|
+
E --> F[Wait for confirmation]
|
|
36
|
+
F --> G[Persist account and pairing state]
|
|
37
|
+
G --> H[Trigger channel reload]
|
|
38
|
+
D -->|start account| I[Restore context tokens]
|
|
39
|
+
I --> J[Notify backend start]
|
|
40
|
+
J --> K[Run monitor loop]
|
|
41
|
+
D -->|stop or reload| L[Abort active poll]
|
|
42
|
+
L --> M[Notify backend stop]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The plugin/channel ID and state layout are compatibility surfaces. A successful
|
|
46
|
+
login may replace stale account records for the same Weixin user, but it must not
|
|
47
|
+
silently merge unrelated accounts.
|
|
48
|
+
|
|
49
|
+
## Inbound flow
|
|
50
|
+
|
|
51
|
+
```mermaid
|
|
52
|
+
sequenceDiagram
|
|
53
|
+
participant Backend as Weixin backend
|
|
54
|
+
participant Monitor as monitorWeixinProvider
|
|
55
|
+
participant Processor as processOneMessage
|
|
56
|
+
participant Runtime as OpenClaw channel runtime
|
|
57
|
+
|
|
58
|
+
Monitor->>Backend: getUpdates(cursor, abort signal)
|
|
59
|
+
Backend-->>Monitor: messages + next cursor
|
|
60
|
+
Monitor->>Monitor: persist cursor and account-scoped context token
|
|
61
|
+
Monitor->>Processor: schedule message
|
|
62
|
+
Processor->>Processor: handle slash command or download media
|
|
63
|
+
Processor->>Runtime: authorize sender and resolve agent route
|
|
64
|
+
Processor->>Runtime: record inbound session
|
|
65
|
+
Processor->>Runtime: dispatch reply
|
|
66
|
+
Runtime-->>Processor: text, media, and item lifecycle events
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Ordinary messages are serialized until OpenClaw accepts the turn, after which
|
|
70
|
+
polling can admit the next message. Plugin approval commands use a separate lane
|
|
71
|
+
so an active ordinary turn cannot block approval.
|
|
72
|
+
|
|
73
|
+
## Outbound flow
|
|
74
|
+
|
|
75
|
+
```mermaid
|
|
76
|
+
flowchart LR
|
|
77
|
+
A[OpenClaw outbound request] --> B{Account ID supplied?}
|
|
78
|
+
B -->|yes| C[Resolve configured account]
|
|
79
|
+
B -->|no| D[Resolve by account-scoped context token]
|
|
80
|
+
D --> C
|
|
81
|
+
C --> E[Check active session]
|
|
82
|
+
E --> F[Run message_sending hook]
|
|
83
|
+
F -->|cancelled| G[Return without backend send]
|
|
84
|
+
F -->|continue| H{Text or media?}
|
|
85
|
+
H -->|text| I[Filter markdown and call sendMessage]
|
|
86
|
+
H -->|media| J[Download if remote]
|
|
87
|
+
J --> K[Encrypt and upload to CDN]
|
|
88
|
+
K --> L[Build media message item]
|
|
89
|
+
I --> M[Emit message_sent hook]
|
|
90
|
+
L --> M
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
With multiple accounts, an omitted account ID is valid only when exactly one
|
|
94
|
+
account can be selected. Ambiguous or missing context must fail rather than risk
|
|
95
|
+
sending from the wrong bot.
|
|
96
|
+
|
|
97
|
+
## Persistent state
|
|
98
|
+
|
|
99
|
+
Paths are relative to the OpenClaw state directory unless an existing framework
|
|
100
|
+
override applies.
|
|
101
|
+
|
|
102
|
+
| Path | Contents |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| `openclaw-weixin/accounts.json` | Registered primary bot-hash account IDs (monitors) |
|
|
105
|
+
| `openclaw-weixin/account-aliases.json` | Optional 1:1 `alias → hash` map for bindings / outbound |
|
|
106
|
+
| `openclaw-weixin/accounts/<accountId>.json` | Token, backend URL, save time, and linked user ID |
|
|
107
|
+
| `openclaw-weixin/accounts/<accountId>.sync.json` | `getUpdates` cursor |
|
|
108
|
+
| `openclaw-weixin/accounts/<accountId>.context-tokens.json` | Recipient context tokens for that account |
|
|
109
|
+
| `openclaw-weixin/replay-dedupe/<accountId>.json` | Inbound getUpdates replay tombstones (24h; newer hosts may map the path to SQLite) |
|
|
110
|
+
| `credentials/openclaw-weixin-<accountId>-allowFrom.json` | Framework pairing allow-list |
|
|
111
|
+
| `openclaw.json` | Channel configuration and account overrides |
|
|
112
|
+
|
|
113
|
+
Loaders retain fallbacks for legacy raw IDs, a legacy single-account credential
|
|
114
|
+
file, and older sync-buffer paths. Changes to these fallbacks require migration
|
|
115
|
+
tests.
|
|
116
|
+
|
|
117
|
+
## Failure and privacy boundaries
|
|
118
|
+
|
|
119
|
+
- Backend HTTP errors are surfaced with actionable context but without raw
|
|
120
|
+
authorization or context tokens.
|
|
121
|
+
- A stale token pauses all requests for that account before polling resumes.
|
|
122
|
+
- Long polls receive the gateway abort signal so stop/reload does not wait for a
|
|
123
|
+
server timeout.
|
|
124
|
+
- Media logs must redact URLs and encrypted query parameters.
|
|
125
|
+
- Tests and examples use synthetic IDs such as `account-1` and `user-1`.
|
|
126
|
+
|
|
127
|
+
## Test seams
|
|
128
|
+
|
|
129
|
+
- API tests replace `fetch` and assert request/response boundaries.
|
|
130
|
+
- Monitor tests mock polling, cursor persistence, context storage, and message
|
|
131
|
+
processing.
|
|
132
|
+
- Message-processing tests use a minimal typed channel-runtime fake.
|
|
133
|
+
- Account and storage tests point `OPENCLAW_STATE_DIR` to isolated temporary
|
|
134
|
+
directories.
|
|
135
|
+
- Shared builders live under `test/helpers/`; test-only files must not be emitted
|
|
136
|
+
into `dist/`.
|