@53ai/53ai-openclaw 1.1.0 → 1.1.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/dist/index.cjs.js +51 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +51 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/src/const.d.ts +15 -2
- package/openclaw.plugin.json +6 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -34,8 +34,26 @@ const WS_RECONNECT_BASE_DELAY_MS = 1000;
|
|
|
34
34
|
// ============================================================================
|
|
35
35
|
/** 文本分块限制 */
|
|
36
36
|
const TEXT_CHUNK_LIMIT = 4000;
|
|
37
|
-
/**
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* 请求分析软阈值(毫秒)
|
|
39
|
+
* 超过该时间后只告警并继续等待,不直接中断长分析任务。
|
|
40
|
+
*/
|
|
41
|
+
const REQUEST_ANALYSIS_TIMEOUT_MS = 600000;
|
|
42
|
+
/**
|
|
43
|
+
* 读取请求分析软阈值的运行时覆盖值。
|
|
44
|
+
* 仅用于本地或特定部署快速调参;未设置时回退到默认值。
|
|
45
|
+
*/
|
|
46
|
+
function getRequestAnalysisTimeoutMs() {
|
|
47
|
+
const raw = process.env.OPENCLAW_REQUEST_ANALYSIS_TIMEOUT_MS?.trim();
|
|
48
|
+
if (!raw) {
|
|
49
|
+
return REQUEST_ANALYSIS_TIMEOUT_MS;
|
|
50
|
+
}
|
|
51
|
+
const parsed = Number(raw);
|
|
52
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
53
|
+
return REQUEST_ANALYSIS_TIMEOUT_MS;
|
|
54
|
+
}
|
|
55
|
+
return parsed;
|
|
56
|
+
}
|
|
39
57
|
/**
|
|
40
58
|
* 消息缓存 TTL(毫秒)
|
|
41
59
|
* 设为 35 分钟,确保覆盖最大重连时间(约 28.5 分钟)+ 缓冲
|
|
@@ -1201,6 +1219,8 @@ async function processMessage(params) {
|
|
|
1201
1219
|
const mediaList = [...imageMediaList, ...fileMediaList];
|
|
1202
1220
|
const ctxPayload = buildMessageContext(body, account, config, mediaList);
|
|
1203
1221
|
let cleanedUp = false;
|
|
1222
|
+
let analysisTimeoutTimer = null;
|
|
1223
|
+
const analysisTimeoutMs = getRequestAnalysisTimeoutMs();
|
|
1204
1224
|
const safeCleanup = () => {
|
|
1205
1225
|
if (!cleanedUp) {
|
|
1206
1226
|
cleanedUp = true;
|
|
@@ -1209,7 +1229,20 @@ async function processMessage(params) {
|
|
|
1209
1229
|
};
|
|
1210
1230
|
runtime.log?.(`[53aihub] processMessage: Starting dispatchReplyWithBufferedBlockDispatcher for msgId=${body.msgId}`);
|
|
1211
1231
|
try {
|
|
1212
|
-
|
|
1232
|
+
analysisTimeoutTimer = setTimeout(() => {
|
|
1233
|
+
runtime.log?.(`[53aihub] processMessage: analysis exceeded soft threshold ${analysisTimeoutMs}ms for msgId=${body.msgId}, keep waiting for completion`);
|
|
1234
|
+
if (wsClient.readyState !== WebSocket.OPEN) {
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
try {
|
|
1238
|
+
wsClient.ping();
|
|
1239
|
+
runtime.log?.(`[53aihub] processMessage: timeout keepalive ping sent for msgId=${body.msgId}`);
|
|
1240
|
+
}
|
|
1241
|
+
catch (err) {
|
|
1242
|
+
runtime.error?.(`[53aihub] processMessage: timeout keepalive ping failed for msgId=${body.msgId}: ${String(err)}`);
|
|
1243
|
+
}
|
|
1244
|
+
}, analysisTimeoutMs);
|
|
1245
|
+
await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
|
|
1213
1246
|
ctx: ctxPayload,
|
|
1214
1247
|
cfg: config,
|
|
1215
1248
|
dispatcherOptions: {
|
|
@@ -1273,7 +1306,7 @@ async function processMessage(params) {
|
|
|
1273
1306
|
});
|
|
1274
1307
|
},
|
|
1275
1308
|
},
|
|
1276
|
-
})
|
|
1309
|
+
});
|
|
1277
1310
|
runtime.log?.(`[53aihub] processMessage: dispatchReply completed, accumulatedTextLen=${state.accumulatedText.length}`);
|
|
1278
1311
|
if (state.accumulatedText) {
|
|
1279
1312
|
runtime.log?.(`[53aihub] processMessage: Sending final reply with accumulatedText`);
|
|
@@ -1320,6 +1353,12 @@ async function processMessage(params) {
|
|
|
1320
1353
|
}
|
|
1321
1354
|
safeCleanup();
|
|
1322
1355
|
}
|
|
1356
|
+
finally {
|
|
1357
|
+
if (analysisTimeoutTimer) {
|
|
1358
|
+
clearTimeout(analysisTimeoutTimer);
|
|
1359
|
+
analysisTimeoutTimer = null;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1323
1362
|
}
|
|
1324
1363
|
async function monitorProvider(options) {
|
|
1325
1364
|
const { account, config, runtime, abortSignal } = options;
|
|
@@ -1538,6 +1577,12 @@ async function promptWSUrl(prompter, account) {
|
|
|
1538
1577
|
},
|
|
1539
1578
|
})).trim();
|
|
1540
1579
|
}
|
|
1580
|
+
async function promptSendThinkingMessage(prompter, account) {
|
|
1581
|
+
return await prompter.confirm({
|
|
1582
|
+
message: "Send a thinking message while the agent is processing?",
|
|
1583
|
+
initialValue: account?.sendThinkingMessage ?? true,
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1541
1586
|
function setAccessPolicy(cfg, accessPolicy) {
|
|
1542
1587
|
const account = resolveAccount(cfg);
|
|
1543
1588
|
const existingAllowFrom = account.config.allowFrom ?? [];
|
|
@@ -1597,6 +1642,7 @@ const aiHubOnboardingAdapter = {
|
|
|
1597
1642
|
const botId = await promptBotId(prompter, account);
|
|
1598
1643
|
const secret = await promptSecret(prompter, account);
|
|
1599
1644
|
const WSUrl = await promptWSUrl(prompter, account);
|
|
1645
|
+
const sendThinkingMessage = await promptSendThinkingMessage(prompter, account);
|
|
1600
1646
|
const cfgWithAccount = setAccount(cfg, {
|
|
1601
1647
|
botId,
|
|
1602
1648
|
secret,
|
|
@@ -1604,7 +1650,7 @@ const aiHubOnboardingAdapter = {
|
|
|
1604
1650
|
enabled: true,
|
|
1605
1651
|
accessPolicy: account.config.accessPolicy ?? "open",
|
|
1606
1652
|
allowFrom: account.config.allowFrom ?? [],
|
|
1607
|
-
sendThinkingMessage
|
|
1653
|
+
sendThinkingMessage,
|
|
1608
1654
|
});
|
|
1609
1655
|
return { cfg: cfgWithAccount };
|
|
1610
1656
|
},
|