@wu529778790/open-im 1.11.0 → 1.11.1-beta.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/dist/clawbot/client.js +4 -28
- package/package.json +1 -1
package/dist/clawbot/client.js
CHANGED
|
@@ -47,34 +47,10 @@ export async function initClawbot(config, eventHandler, onStateChange) {
|
|
|
47
47
|
reconnectAttempt = 0;
|
|
48
48
|
fatal = false;
|
|
49
49
|
getUpdatesBuf = '';
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
base_info: BASE_INFO,
|
|
55
|
-
});
|
|
56
|
-
if (!res.ok) {
|
|
57
|
-
throw new Error(`API check failed: ${res.error ?? 'unknown'}`);
|
|
58
|
-
}
|
|
59
|
-
log.info(`ClawBot API reachable at ${apiUrl}`);
|
|
60
|
-
fatal = false;
|
|
61
|
-
reconnectAttempt = 0;
|
|
62
|
-
if (res.updatesBuf)
|
|
63
|
-
getUpdatesBuf = res.updatesBuf;
|
|
64
|
-
updateState('connected');
|
|
65
|
-
startPolling();
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
if (isFatalReconnectError(err)) {
|
|
69
|
-
fatal = true;
|
|
70
|
-
log.warn('ClawBot API auth/session error, will slow-probe:', err);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
log.warn('ClawBot API not reachable, will retry:', err);
|
|
74
|
-
}
|
|
75
|
-
updateState('connecting');
|
|
76
|
-
scheduleReconnect();
|
|
77
|
-
}
|
|
50
|
+
// Start polling directly — no blocking connectivity check.
|
|
51
|
+
// The polling loop handles errors and reconnection internally.
|
|
52
|
+
updateState('connected');
|
|
53
|
+
startPolling();
|
|
78
54
|
log.info('ClawBot client initialized');
|
|
79
55
|
}
|
|
80
56
|
function startPolling() {
|