openclaw-quiubo 2.6.59 → 2.6.60
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 +25 -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,11 @@ 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
|
+
}
|
|
15215
15222
|
if (prev === 0) {
|
|
15216
15223
|
const now = Date.now();
|
|
15217
15224
|
const last = lastSentAt.get(key) ?? 0;
|
|
@@ -15249,19 +15256,24 @@ function registerActivityHook(api) {
|
|
|
15249
15256
|
const next = Math.max(0, prev - 1);
|
|
15250
15257
|
activeToolCounts.set(key, next);
|
|
15251
15258
|
if (next === 0) {
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15259
|
+
const idleTimer = setTimeout(() => {
|
|
15260
|
+
pendingIdle.delete(key);
|
|
15261
|
+
lastSentAt.delete(key);
|
|
15262
|
+
if ((activeToolCounts.get(key) ?? 0) > 0) return;
|
|
15263
|
+
const config = api.runtime?.config ?? api.config;
|
|
15264
|
+
const agentId = extractAgentIdFromSessionKey(sessionKey);
|
|
15265
|
+
const accountId = resolveAccountId(config, agentId);
|
|
15266
|
+
const client = clients.get(accountId);
|
|
15267
|
+
const accountCfg = accounts.get(accountId);
|
|
15268
|
+
if (!client || !accountCfg?.botIdentityId) return;
|
|
15269
|
+
client.sendActivity(groupId, {
|
|
15270
|
+
identityId: accountCfg.botIdentityId,
|
|
15271
|
+
state: "idle"
|
|
15272
|
+
}).catch((err) => {
|
|
15273
|
+
console.warn(`[quiubo] activity-hook idle failed: ${err}`);
|
|
15274
|
+
});
|
|
15275
|
+
}, IDLE_DELAY_MS);
|
|
15276
|
+
pendingIdle.set(key, idleTimer);
|
|
15265
15277
|
}
|
|
15266
15278
|
},
|
|
15267
15279
|
{ name: "quiubo-activity-after" }
|