openclaw-quiubo 2.6.59 → 2.6.61
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.js +26 -13
- package/dist/index.js.map +2 -2
- package/dist/src/activity-hook.d.ts.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15163,7 +15163,9 @@ function registerGroupContextHook(api) {
|
|
|
15163
15163
|
// src/activity-hook.ts
|
|
15164
15164
|
var activeToolCounts = /* @__PURE__ */ new Map();
|
|
15165
15165
|
var lastSentAt = /* @__PURE__ */ new Map();
|
|
15166
|
+
var pendingIdle = /* @__PURE__ */ new Map();
|
|
15166
15167
|
var DEBOUNCE_MS = 2e3;
|
|
15168
|
+
var IDLE_DELAY_MS = 5e3;
|
|
15167
15169
|
function generateLabel(toolName, params) {
|
|
15168
15170
|
switch (toolName) {
|
|
15169
15171
|
case "exec":
|
|
@@ -15212,6 +15214,12 @@ function registerActivityHook(api) {
|
|
|
15212
15214
|
const key = sessionKey;
|
|
15213
15215
|
const prev = activeToolCounts.get(key) ?? 0;
|
|
15214
15216
|
activeToolCounts.set(key, prev + 1);
|
|
15217
|
+
const pendingTimer = pendingIdle.get(key);
|
|
15218
|
+
if (pendingTimer) {
|
|
15219
|
+
clearTimeout(pendingTimer);
|
|
15220
|
+
pendingIdle.delete(key);
|
|
15221
|
+
return;
|
|
15222
|
+
}
|
|
15215
15223
|
if (prev === 0) {
|
|
15216
15224
|
const now = Date.now();
|
|
15217
15225
|
const last = lastSentAt.get(key) ?? 0;
|
|
@@ -15249,19 +15257,24 @@ function registerActivityHook(api) {
|
|
|
15249
15257
|
const next = Math.max(0, prev - 1);
|
|
15250
15258
|
activeToolCounts.set(key, next);
|
|
15251
15259
|
if (next === 0) {
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15260
|
+
const idleTimer = setTimeout(() => {
|
|
15261
|
+
pendingIdle.delete(key);
|
|
15262
|
+
lastSentAt.delete(key);
|
|
15263
|
+
if ((activeToolCounts.get(key) ?? 0) > 0) return;
|
|
15264
|
+
const config = api.runtime?.config ?? api.config;
|
|
15265
|
+
const agentId = extractAgentIdFromSessionKey(sessionKey);
|
|
15266
|
+
const accountId = resolveAccountId(config, agentId);
|
|
15267
|
+
const client = clients.get(accountId);
|
|
15268
|
+
const accountCfg = accounts.get(accountId);
|
|
15269
|
+
if (!client || !accountCfg?.botIdentityId) return;
|
|
15270
|
+
client.sendActivity(groupId, {
|
|
15271
|
+
identityId: accountCfg.botIdentityId,
|
|
15272
|
+
state: "idle"
|
|
15273
|
+
}).catch((err) => {
|
|
15274
|
+
console.warn(`[quiubo] activity-hook idle failed: ${err}`);
|
|
15275
|
+
});
|
|
15276
|
+
}, IDLE_DELAY_MS);
|
|
15277
|
+
pendingIdle.set(key, idleTimer);
|
|
15265
15278
|
}
|
|
15266
15279
|
},
|
|
15267
15280
|
{ name: "quiubo-activity-after" }
|