openclaw-quiubo 2.6.57 → 2.6.59
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.d.ts.map +1 -1
- package/dist/index.js +118 -0
- package/dist/index.js.map +3 -3
- package/dist/src/activity-hook.d.ts +11 -0
- package/dist/src/activity-hook.d.ts.map +1 -0
- package/dist/src/api.d.ts +9 -0
- package/dist/src/api.d.ts.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,KAAK,sBAAsB,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACvK,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AAGxB,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,eAAe,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,GAAG,CAAA;KAAE,KAAK,IAAI,CAAC;IAEjD,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAE5D,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC5F;AAED,QAAA,MAAM,MAAM;;;;kBAII,iBAAiB;CAQhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9138,6 +9138,15 @@ var QuiuboApiClient = class {
|
|
|
9138
9138
|
await this.request("POST", `/groups/${groupId}/typing`, { identityId });
|
|
9139
9139
|
}
|
|
9140
9140
|
// ========================================================================
|
|
9141
|
+
// Activity Indicators
|
|
9142
|
+
// ========================================================================
|
|
9143
|
+
/**
|
|
9144
|
+
* Send an activity state update for an identity in an SDK group.
|
|
9145
|
+
*/
|
|
9146
|
+
async sendActivity(groupId, opts) {
|
|
9147
|
+
await this.request("POST", `/groups/${groupId}/activity`, opts);
|
|
9148
|
+
}
|
|
9149
|
+
// ========================================================================
|
|
9141
9150
|
// OpenClaw Response
|
|
9142
9151
|
// ========================================================================
|
|
9143
9152
|
/**
|
|
@@ -15151,6 +15160,114 @@ function registerGroupContextHook(api) {
|
|
|
15151
15160
|
);
|
|
15152
15161
|
}
|
|
15153
15162
|
|
|
15163
|
+
// src/activity-hook.ts
|
|
15164
|
+
var activeToolCounts = /* @__PURE__ */ new Map();
|
|
15165
|
+
var lastSentAt = /* @__PURE__ */ new Map();
|
|
15166
|
+
var DEBOUNCE_MS = 2e3;
|
|
15167
|
+
function generateLabel(toolName, params) {
|
|
15168
|
+
switch (toolName) {
|
|
15169
|
+
case "exec":
|
|
15170
|
+
case "bash":
|
|
15171
|
+
case "Bash": {
|
|
15172
|
+
const cmd = typeof params?.command === "string" ? params.command : "";
|
|
15173
|
+
const first = cmd.split(/[&&||;|]/)[0].trim();
|
|
15174
|
+
const word = first.split(/\s+/)[0] || "";
|
|
15175
|
+
if (!word) return "Running command...";
|
|
15176
|
+
const truncated = word.length > 50 ? word.slice(0, 50) + "\u2026" : word;
|
|
15177
|
+
return `Running ${truncated}...`;
|
|
15178
|
+
}
|
|
15179
|
+
case "read":
|
|
15180
|
+
case "Read":
|
|
15181
|
+
return "Reading files...";
|
|
15182
|
+
case "write":
|
|
15183
|
+
case "Write":
|
|
15184
|
+
case "edit":
|
|
15185
|
+
case "Edit":
|
|
15186
|
+
return "Writing code...";
|
|
15187
|
+
case "web_search":
|
|
15188
|
+
case "WebSearch":
|
|
15189
|
+
return "Searching the web...";
|
|
15190
|
+
case "web_fetch":
|
|
15191
|
+
case "WebFetch":
|
|
15192
|
+
return "Fetching page...";
|
|
15193
|
+
case "grep":
|
|
15194
|
+
case "Grep":
|
|
15195
|
+
case "glob":
|
|
15196
|
+
case "Glob":
|
|
15197
|
+
return "Searching codebase...";
|
|
15198
|
+
case "Task":
|
|
15199
|
+
return "Running sub-agent...";
|
|
15200
|
+
default:
|
|
15201
|
+
return "Working...";
|
|
15202
|
+
}
|
|
15203
|
+
}
|
|
15204
|
+
function registerActivityHook(api) {
|
|
15205
|
+
api.on(
|
|
15206
|
+
"before_tool_call",
|
|
15207
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15208
|
+
(_event, ctx) => {
|
|
15209
|
+
const sessionKey = ctx.sessionKey;
|
|
15210
|
+
const groupId = extractGroupIdFromSessionKey(sessionKey);
|
|
15211
|
+
if (!groupId) return;
|
|
15212
|
+
const key = sessionKey;
|
|
15213
|
+
const prev = activeToolCounts.get(key) ?? 0;
|
|
15214
|
+
activeToolCounts.set(key, prev + 1);
|
|
15215
|
+
if (prev === 0) {
|
|
15216
|
+
const now = Date.now();
|
|
15217
|
+
const last = lastSentAt.get(key) ?? 0;
|
|
15218
|
+
if (now - last < DEBOUNCE_MS) return;
|
|
15219
|
+
lastSentAt.set(key, now);
|
|
15220
|
+
const config = api.runtime?.config ?? api.config;
|
|
15221
|
+
const agentId = extractAgentIdFromSessionKey(sessionKey);
|
|
15222
|
+
const accountId = resolveAccountId(config, agentId);
|
|
15223
|
+
const client = clients.get(accountId);
|
|
15224
|
+
const accountCfg = accounts.get(accountId);
|
|
15225
|
+
if (!client || !accountCfg?.botIdentityId) return;
|
|
15226
|
+
const toolName = ctx.toolName ?? ctx.tool ?? "";
|
|
15227
|
+
const label = generateLabel(toolName, ctx.params ?? ctx.input);
|
|
15228
|
+
client.sendActivity(groupId, {
|
|
15229
|
+
identityId: accountCfg.botIdentityId,
|
|
15230
|
+
state: "working",
|
|
15231
|
+
tool: toolName || void 0,
|
|
15232
|
+
label
|
|
15233
|
+
}).catch((err) => {
|
|
15234
|
+
console.warn(`[quiubo] activity-hook working failed: ${err}`);
|
|
15235
|
+
});
|
|
15236
|
+
}
|
|
15237
|
+
},
|
|
15238
|
+
{ name: "quiubo-activity-before" }
|
|
15239
|
+
);
|
|
15240
|
+
api.on(
|
|
15241
|
+
"after_tool_call",
|
|
15242
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15243
|
+
(_event, ctx) => {
|
|
15244
|
+
const sessionKey = ctx.sessionKey;
|
|
15245
|
+
const groupId = extractGroupIdFromSessionKey(sessionKey);
|
|
15246
|
+
if (!groupId) return;
|
|
15247
|
+
const key = sessionKey;
|
|
15248
|
+
const prev = activeToolCounts.get(key) ?? 0;
|
|
15249
|
+
const next = Math.max(0, prev - 1);
|
|
15250
|
+
activeToolCounts.set(key, next);
|
|
15251
|
+
if (next === 0) {
|
|
15252
|
+
lastSentAt.delete(key);
|
|
15253
|
+
const config = api.runtime?.config ?? api.config;
|
|
15254
|
+
const agentId = extractAgentIdFromSessionKey(sessionKey);
|
|
15255
|
+
const accountId = resolveAccountId(config, agentId);
|
|
15256
|
+
const client = clients.get(accountId);
|
|
15257
|
+
const accountCfg = accounts.get(accountId);
|
|
15258
|
+
if (!client || !accountCfg?.botIdentityId) return;
|
|
15259
|
+
client.sendActivity(groupId, {
|
|
15260
|
+
identityId: accountCfg.botIdentityId,
|
|
15261
|
+
state: "idle"
|
|
15262
|
+
}).catch((err) => {
|
|
15263
|
+
console.warn(`[quiubo] activity-hook idle failed: ${err}`);
|
|
15264
|
+
});
|
|
15265
|
+
}
|
|
15266
|
+
},
|
|
15267
|
+
{ name: "quiubo-activity-after" }
|
|
15268
|
+
);
|
|
15269
|
+
}
|
|
15270
|
+
|
|
15154
15271
|
// src/polling-gateway.ts
|
|
15155
15272
|
var PollingGateway = class {
|
|
15156
15273
|
client;
|
|
@@ -15300,6 +15417,7 @@ var plugin = {
|
|
|
15300
15417
|
api.registerChannel({ plugin: quiuboPlugin });
|
|
15301
15418
|
api.registerTool(createQuiuboPostToolFactory, { name: "quiubo_create_post" });
|
|
15302
15419
|
registerGroupContextHook(api);
|
|
15420
|
+
registerActivityHook(api);
|
|
15303
15421
|
registerStatusRpc(api);
|
|
15304
15422
|
}
|
|
15305
15423
|
};
|