openclaw-quiubo 2.6.55 → 2.6.58
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 +124 -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/dist/src/channel.d.ts +2 -0
- package/dist/src/channel.d.ts.map +1 -1
- package/dist/src/group-context-hook.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
|
/**
|
|
@@ -13540,6 +13549,7 @@ async function readOutboundAttachments(mediaUrls, source, client, groupId, log,
|
|
|
13540
13549
|
var gateways = /* @__PURE__ */ new Map();
|
|
13541
13550
|
var clients = /* @__PURE__ */ new Map();
|
|
13542
13551
|
var accounts = /* @__PURE__ */ new Map();
|
|
13552
|
+
var partnerGroupIds = /* @__PURE__ */ new Set();
|
|
13543
13553
|
var loggers = /* @__PURE__ */ new Map();
|
|
13544
13554
|
var CHANNEL_ID = "quiubo";
|
|
13545
13555
|
var DEFAULT_API_URL = "https://api.quiubo.io";
|
|
@@ -14495,6 +14505,7 @@ var quiuboPlugin = {
|
|
|
14495
14505
|
securityMode: ag.securityMode
|
|
14496
14506
|
});
|
|
14497
14507
|
} else {
|
|
14508
|
+
partnerGroupIds.add(ag.groupId);
|
|
14498
14509
|
const botSettings = ag.settings?.bot ?? {};
|
|
14499
14510
|
let ownerIdentityId = "";
|
|
14500
14511
|
try {
|
|
@@ -14530,6 +14541,7 @@ var quiuboPlugin = {
|
|
|
14530
14541
|
} else {
|
|
14531
14542
|
const { groups: allGroups } = await client.listGroups(botIdentityId);
|
|
14532
14543
|
for (const group of allGroups) {
|
|
14544
|
+
partnerGroupIds.add(group.id);
|
|
14533
14545
|
const botSettings = group.settings?.bot ?? {};
|
|
14534
14546
|
let ownerIdentityId = "";
|
|
14535
14547
|
try {
|
|
@@ -15059,6 +15071,7 @@ function setCache(groupId, data) {
|
|
|
15059
15071
|
async function fetchGroupContext(config, sessionKey) {
|
|
15060
15072
|
const groupId = extractGroupIdFromSessionKey(sessionKey);
|
|
15061
15073
|
if (!groupId) return void 0;
|
|
15074
|
+
if (partnerGroupIds.has(groupId)) return void 0;
|
|
15062
15075
|
const cached = getCached(groupId);
|
|
15063
15076
|
if (cached) return cached;
|
|
15064
15077
|
const agentId = extractAgentIdFromSessionKey(sessionKey);
|
|
@@ -15147,6 +15160,116 @@ function registerGroupContextHook(api) {
|
|
|
15147
15160
|
);
|
|
15148
15161
|
}
|
|
15149
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
|
+
if (ctx.channelId !== "quiubo") return;
|
|
15210
|
+
const sessionKey = ctx.sessionKey;
|
|
15211
|
+
const groupId = extractGroupIdFromSessionKey(sessionKey);
|
|
15212
|
+
if (!groupId) return;
|
|
15213
|
+
const key = sessionKey;
|
|
15214
|
+
const prev = activeToolCounts.get(key) ?? 0;
|
|
15215
|
+
activeToolCounts.set(key, prev + 1);
|
|
15216
|
+
if (prev === 0) {
|
|
15217
|
+
const now = Date.now();
|
|
15218
|
+
const last = lastSentAt.get(key) ?? 0;
|
|
15219
|
+
if (now - last < DEBOUNCE_MS) return;
|
|
15220
|
+
lastSentAt.set(key, now);
|
|
15221
|
+
const config = api.runtime?.config ?? api.config;
|
|
15222
|
+
const agentId = extractAgentIdFromSessionKey(sessionKey);
|
|
15223
|
+
const accountId = resolveAccountId(config, agentId);
|
|
15224
|
+
const client = clients.get(accountId);
|
|
15225
|
+
const accountCfg = accounts.get(accountId);
|
|
15226
|
+
if (!client || !accountCfg?.botIdentityId) return;
|
|
15227
|
+
const toolName = ctx.toolName ?? ctx.tool ?? "";
|
|
15228
|
+
const label = generateLabel(toolName, ctx.params ?? ctx.input);
|
|
15229
|
+
client.sendActivity(groupId, {
|
|
15230
|
+
identityId: accountCfg.botIdentityId,
|
|
15231
|
+
state: "working",
|
|
15232
|
+
tool: toolName || void 0,
|
|
15233
|
+
label
|
|
15234
|
+
}).catch((err) => {
|
|
15235
|
+
console.warn(`[quiubo] activity-hook working failed: ${err}`);
|
|
15236
|
+
});
|
|
15237
|
+
}
|
|
15238
|
+
},
|
|
15239
|
+
{ name: "quiubo-activity-before" }
|
|
15240
|
+
);
|
|
15241
|
+
api.on(
|
|
15242
|
+
"after_tool_call",
|
|
15243
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15244
|
+
(_event, ctx) => {
|
|
15245
|
+
if (ctx.channelId !== "quiubo") return;
|
|
15246
|
+
const sessionKey = ctx.sessionKey;
|
|
15247
|
+
const groupId = extractGroupIdFromSessionKey(sessionKey);
|
|
15248
|
+
if (!groupId) return;
|
|
15249
|
+
const key = sessionKey;
|
|
15250
|
+
const prev = activeToolCounts.get(key) ?? 0;
|
|
15251
|
+
const next = Math.max(0, prev - 1);
|
|
15252
|
+
activeToolCounts.set(key, next);
|
|
15253
|
+
if (next === 0) {
|
|
15254
|
+
lastSentAt.delete(key);
|
|
15255
|
+
const config = api.runtime?.config ?? api.config;
|
|
15256
|
+
const agentId = extractAgentIdFromSessionKey(sessionKey);
|
|
15257
|
+
const accountId = resolveAccountId(config, agentId);
|
|
15258
|
+
const client = clients.get(accountId);
|
|
15259
|
+
const accountCfg = accounts.get(accountId);
|
|
15260
|
+
if (!client || !accountCfg?.botIdentityId) return;
|
|
15261
|
+
client.sendActivity(groupId, {
|
|
15262
|
+
identityId: accountCfg.botIdentityId,
|
|
15263
|
+
state: "idle"
|
|
15264
|
+
}).catch((err) => {
|
|
15265
|
+
console.warn(`[quiubo] activity-hook idle failed: ${err}`);
|
|
15266
|
+
});
|
|
15267
|
+
}
|
|
15268
|
+
},
|
|
15269
|
+
{ name: "quiubo-activity-after" }
|
|
15270
|
+
);
|
|
15271
|
+
}
|
|
15272
|
+
|
|
15150
15273
|
// src/polling-gateway.ts
|
|
15151
15274
|
var PollingGateway = class {
|
|
15152
15275
|
client;
|
|
@@ -15296,6 +15419,7 @@ var plugin = {
|
|
|
15296
15419
|
api.registerChannel({ plugin: quiuboPlugin });
|
|
15297
15420
|
api.registerTool(createQuiuboPostToolFactory, { name: "quiubo_create_post" });
|
|
15298
15421
|
registerGroupContextHook(api);
|
|
15422
|
+
registerActivityHook(api);
|
|
15299
15423
|
registerStatusRpc(api);
|
|
15300
15424
|
}
|
|
15301
15425
|
};
|