openclaw-extension-typex 1.0.18 → 1.0.19
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/client/monitor.js +5 -0
- package/dist/plugin.js +11 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/client/monitor.js
CHANGED
|
@@ -205,6 +205,7 @@ async function monitorTypeXProvider(opts) {
|
|
|
205
205
|
logger?.info(`[${accountObj.accountId}] Loaded pos: ${currentPos}`);
|
|
206
206
|
// Group history buffer: lives for the entire monitor lifetime.
|
|
207
207
|
const chatHistories = new Map();
|
|
208
|
+
let fatalError = null;
|
|
208
209
|
// --- Polling Loop ---
|
|
209
210
|
while (!abortSignal.aborted) {
|
|
210
211
|
let messages;
|
|
@@ -215,6 +216,7 @@ async function monitorTypeXProvider(opts) {
|
|
|
215
216
|
// fetchMessages threw — this is treated as a fatal error (e.g. auth failure,
|
|
216
217
|
// bad token, server unreachable). Stop the monitor so we don't spam the API.
|
|
217
218
|
logger?.error(`[${accountObj.accountId}] Fatal error fetching TypeX messages; stopping monitor: ${err instanceof Error ? err.stack : String(err)}`);
|
|
219
|
+
fatalError = err instanceof Error ? err : new Error(String(err));
|
|
218
220
|
break;
|
|
219
221
|
}
|
|
220
222
|
if (messages && messages.length > 0) {
|
|
@@ -246,4 +248,7 @@ async function monitorTypeXProvider(opts) {
|
|
|
246
248
|
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
247
249
|
}
|
|
248
250
|
logger?.info(`Stopping TypeX monitor...`);
|
|
251
|
+
if (fatalError) {
|
|
252
|
+
throw fatalError;
|
|
253
|
+
}
|
|
249
254
|
}
|
package/dist/plugin.js
CHANGED
|
@@ -98,12 +98,22 @@ exports.typexPlugin = {
|
|
|
98
98
|
}
|
|
99
99
|
catch (err) {
|
|
100
100
|
log?.error(`TypeX Provider crashed: ${err}`);
|
|
101
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
101
102
|
setStatus({
|
|
102
103
|
accountId: account.accountId,
|
|
103
104
|
running: false,
|
|
104
|
-
lastError:
|
|
105
|
+
lastError: errorMessage,
|
|
105
106
|
lastStopAt: Date.now(),
|
|
106
107
|
});
|
|
108
|
+
if (errorMessage.includes("401") || errorMessage.includes("Unauthorized")) {
|
|
109
|
+
log?.error(`[${account.accountId}] Token is permanently invalid (401). Suspending account task to prevent auto-restart loop.`);
|
|
110
|
+
if (!abortSignal.aborted) {
|
|
111
|
+
await new Promise((resolve) => {
|
|
112
|
+
abortSignal.addEventListener('abort', () => resolve());
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
107
117
|
throw err;
|
|
108
118
|
}
|
|
109
119
|
},
|
package/openclaw.plugin.json
CHANGED