@dingxiang-me/openclaw-wechat 2.0.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.
- package/CHANGELOG.md +85 -0
- package/README.en.md +204 -32
- package/README.md +234 -63
- package/docs/channels/wecom.md +137 -1
- package/openclaw.plugin.json +694 -10
- package/package.json +207 -4
- package/scripts/wecom-agent-selfcheck.mjs +775 -0
- package/scripts/wecom-bot-longconn-probe.mjs +582 -0
- package/scripts/wecom-bot-selfcheck.mjs +952 -0
- package/scripts/wecom-callback-matrix.mjs +224 -0
- package/scripts/wecom-doctor.mjs +1407 -0
- package/scripts/wecom-e2e-scenario.mjs +333 -0
- package/scripts/wecom-migrate.mjs +261 -0
- package/scripts/wecom-quickstart.mjs +1824 -0
- package/scripts/wecom-release-check.mjs +232 -0
- package/scripts/wecom-remote-e2e.mjs +310 -0
- package/scripts/wecom-selfcheck.mjs +1255 -0
- package/scripts/wecom-smoke.sh +74 -0
- package/src/core/delivery-router.js +21 -0
- package/src/core.js +631 -34
- package/src/wecom/account-config-core.js +27 -1
- package/src/wecom/account-config.js +19 -2
- package/src/wecom/agent-dispatch-executor.js +11 -0
- package/src/wecom/agent-dispatch-handlers.js +61 -8
- package/src/wecom/agent-inbound-guards.js +63 -16
- package/src/wecom/agent-inbound-processor.js +34 -2
- package/src/wecom/agent-late-reply-runtime.js +30 -2
- package/src/wecom/agent-text-sender.js +2 -0
- package/src/wecom/api-client-core.js +27 -19
- package/src/wecom/api-client-media.js +16 -7
- package/src/wecom/api-client-send-text.js +4 -0
- package/src/wecom/api-client-send-typed.js +4 -1
- package/src/wecom/api-client-senders.js +41 -3
- package/src/wecom/api-client.js +1 -0
- package/src/wecom/bot-dispatch-fallback.js +18 -3
- package/src/wecom/bot-dispatch-handlers.js +47 -10
- package/src/wecom/bot-inbound-dispatch-runtime.js +3 -0
- package/src/wecom/bot-inbound-executor-helpers.js +11 -1
- package/src/wecom/bot-inbound-executor.js +25 -1
- package/src/wecom/bot-inbound-guards.js +78 -23
- package/src/wecom/bot-long-connection-manager.js +4 -4
- package/src/wecom/channel-config-schema.js +132 -0
- package/src/wecom/channel-plugin.js +370 -7
- package/src/wecom/command-handlers.js +107 -10
- package/src/wecom/command-status-text.js +275 -1
- package/src/wecom/doc-client.js +7 -1
- package/src/wecom/inbound-content-handler-file-video-link.js +4 -0
- package/src/wecom/inbound-content-handler-image-voice.js +6 -0
- package/src/wecom/inbound-content.js +5 -0
- package/src/wecom/installer-api.js +910 -0
- package/src/wecom/media-download.js +2 -2
- package/src/wecom/migration-diagnostics.js +816 -0
- package/src/wecom/network-config.js +91 -0
- package/src/wecom/observability-metrics.js +9 -3
- package/src/wecom/outbound-agent-delivery.js +313 -0
- package/src/wecom/outbound-agent-media-sender.js +37 -7
- package/src/wecom/outbound-agent-push.js +1 -0
- package/src/wecom/outbound-delivery.js +129 -12
- package/src/wecom/outbound-stream-msg-item.js +25 -2
- package/src/wecom/outbound-webhook-delivery.js +19 -0
- package/src/wecom/outbound-webhook-media.js +30 -6
- package/src/wecom/pairing.js +188 -0
- package/src/wecom/pending-reply-manager.js +143 -0
- package/src/wecom/plugin-account-policy-services.js +26 -0
- package/src/wecom/plugin-base-services.js +58 -0
- package/src/wecom/plugin-constants.js +1 -1
- package/src/wecom/plugin-delivery-inbound-services.js +25 -0
- package/src/wecom/plugin-processing-deps.js +7 -0
- package/src/wecom/plugin-route-runtime-deps.js +1 -0
- package/src/wecom/plugin-services.js +87 -0
- package/src/wecom/policy-resolvers.js +93 -20
- package/src/wecom/quickstart-metadata.js +1247 -0
- package/src/wecom/reasoning-visibility.js +104 -0
- package/src/wecom/register-runtime.js +10 -0
- package/src/wecom/reliable-delivery-persistence.js +138 -0
- package/src/wecom/reliable-delivery.js +642 -0
- package/src/wecom/reply-output-policy.js +171 -0
- package/src/wecom/text-inbound-scheduler.js +6 -1
- package/src/wecom/workspace-auto-sender.js +2 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
5
|
+
cd "$ROOT_DIR"
|
|
6
|
+
|
|
7
|
+
WITH_BOT_E2E=false
|
|
8
|
+
SELF_CHECK_ARGS=()
|
|
9
|
+
|
|
10
|
+
print_help() {
|
|
11
|
+
cat <<'EOF'
|
|
12
|
+
OpenClaw-Wechat smoke check
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
npm run wecom:smoke -- [options]
|
|
16
|
+
|
|
17
|
+
Options:
|
|
18
|
+
--with-bot-e2e Also run Bot E2E selfcheck (signature/encryption/stream-refresh)
|
|
19
|
+
-h, --help Show this help
|
|
20
|
+
|
|
21
|
+
Other options are forwarded to:
|
|
22
|
+
npm run wecom:selfcheck -- --all-accounts ...
|
|
23
|
+
EOF
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
while [[ $# -gt 0 ]]; do
|
|
27
|
+
case "$1" in
|
|
28
|
+
--with-bot-e2e)
|
|
29
|
+
WITH_BOT_E2E=true
|
|
30
|
+
shift
|
|
31
|
+
;;
|
|
32
|
+
-h|--help)
|
|
33
|
+
print_help
|
|
34
|
+
exit 0
|
|
35
|
+
;;
|
|
36
|
+
*)
|
|
37
|
+
SELF_CHECK_ARGS+=("$1")
|
|
38
|
+
shift
|
|
39
|
+
;;
|
|
40
|
+
esac
|
|
41
|
+
done
|
|
42
|
+
|
|
43
|
+
TOTAL_STEPS=5
|
|
44
|
+
if [[ "$WITH_BOT_E2E" == "true" ]]; then
|
|
45
|
+
TOTAL_STEPS=6
|
|
46
|
+
fi
|
|
47
|
+
STEP=1
|
|
48
|
+
|
|
49
|
+
echo "[$STEP/$TOTAL_STEPS] Syntax check"
|
|
50
|
+
npm run test:syntax
|
|
51
|
+
STEP=$((STEP + 1))
|
|
52
|
+
|
|
53
|
+
echo "[$STEP/$TOTAL_STEPS] Unit tests"
|
|
54
|
+
npm test
|
|
55
|
+
STEP=$((STEP + 1))
|
|
56
|
+
|
|
57
|
+
echo "[$STEP/$TOTAL_STEPS] WeCom selfcheck (all discovered accounts)"
|
|
58
|
+
npm run wecom:selfcheck -- --all-accounts "${SELF_CHECK_ARGS[@]}"
|
|
59
|
+
STEP=$((STEP + 1))
|
|
60
|
+
|
|
61
|
+
if [[ "$WITH_BOT_E2E" == "true" ]]; then
|
|
62
|
+
echo "[$STEP/$TOTAL_STEPS] WeCom Bot E2E selfcheck"
|
|
63
|
+
npm run wecom:bot:selfcheck --
|
|
64
|
+
STEP=$((STEP + 1))
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
echo "[$STEP/$TOTAL_STEPS] Gateway health"
|
|
68
|
+
openclaw gateway health
|
|
69
|
+
STEP=$((STEP + 1))
|
|
70
|
+
|
|
71
|
+
echo "[$STEP/$TOTAL_STEPS] OpenClaw status (summary)"
|
|
72
|
+
openclaw status --all | sed -n '1,120p'
|
|
73
|
+
|
|
74
|
+
echo "Smoke check completed."
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { inferWecomDeliveryStatus, normalizeWecomDeliveryStatus } from "../wecom/reliable-delivery.js";
|
|
2
|
+
|
|
1
3
|
const DEFAULT_FALLBACK_ORDER = Object.freeze([
|
|
2
4
|
"long_connection",
|
|
3
5
|
"active_stream",
|
|
@@ -124,6 +126,7 @@ export function createWecomDeliveryRouter({
|
|
|
124
126
|
layer,
|
|
125
127
|
ok: true,
|
|
126
128
|
status: "ok",
|
|
129
|
+
deliveryStatus: "delivered",
|
|
127
130
|
meta: result?.meta ?? {},
|
|
128
131
|
durationMs: Math.max(0, layerEndedAt - layerStartedAt),
|
|
129
132
|
startedAt: layerStartedAt,
|
|
@@ -141,6 +144,7 @@ export function createWecomDeliveryRouter({
|
|
|
141
144
|
layer,
|
|
142
145
|
deliveryPath: layer,
|
|
143
146
|
finalStatus: attempts.length > 1 ? "degraded" : "ok",
|
|
147
|
+
deliveryStatus: "delivered",
|
|
144
148
|
attempts,
|
|
145
149
|
totalDurationMs: Math.max(0, layerEndedAt - deliverStartedAt),
|
|
146
150
|
};
|
|
@@ -150,6 +154,14 @@ export function createWecomDeliveryRouter({
|
|
|
150
154
|
ok: false,
|
|
151
155
|
status: "miss",
|
|
152
156
|
reason: String(result?.reason ?? "rejected"),
|
|
157
|
+
deliveryStatus:
|
|
158
|
+
normalizeWecomDeliveryStatus(result?.deliveryStatus, "") ||
|
|
159
|
+
inferWecomDeliveryStatus({
|
|
160
|
+
reason: String(result?.reason ?? "rejected"),
|
|
161
|
+
layer,
|
|
162
|
+
meta: result?.meta ?? {},
|
|
163
|
+
errcode: result?.meta?.errcode ?? result?.errcode ?? null,
|
|
164
|
+
}),
|
|
153
165
|
meta: result?.meta ?? {},
|
|
154
166
|
durationMs: Math.max(0, layerEndedAt - layerStartedAt),
|
|
155
167
|
startedAt: layerStartedAt,
|
|
@@ -168,6 +180,10 @@ export function createWecomDeliveryRouter({
|
|
|
168
180
|
ok: false,
|
|
169
181
|
status: "error",
|
|
170
182
|
reason: safeErrorMessage(err),
|
|
183
|
+
deliveryStatus: inferWecomDeliveryStatus({
|
|
184
|
+
reason: safeErrorMessage(err),
|
|
185
|
+
layer,
|
|
186
|
+
}),
|
|
171
187
|
durationMs: Math.max(0, layerEndedAt - layerStartedAt),
|
|
172
188
|
startedAt: layerStartedAt,
|
|
173
189
|
endedAt: layerEndedAt,
|
|
@@ -191,6 +207,11 @@ export function createWecomDeliveryRouter({
|
|
|
191
207
|
layer: null,
|
|
192
208
|
deliveryPath: null,
|
|
193
209
|
finalStatus: "failed",
|
|
210
|
+
deliveryStatus:
|
|
211
|
+
attempts
|
|
212
|
+
.slice()
|
|
213
|
+
.reverse()
|
|
214
|
+
.find((attempt) => attempt?.deliveryStatus)?.deliveryStatus || "rejected_unknown",
|
|
194
215
|
attempts,
|
|
195
216
|
error: "all-layers-failed",
|
|
196
217
|
totalDurationMs: Math.max(0, Date.now() - deliverStartedAt),
|