openclaw-quiubo 2.6.40 → 2.6.42
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 +67 -4
- package/dist/index.js.map +2 -2
- package/dist/src/channel.d.ts.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13531,6 +13531,43 @@ var quiuboPlugin = {
|
|
|
13531
13531
|
const accts = { ...channel.accounts };
|
|
13532
13532
|
delete accts[id];
|
|
13533
13533
|
return setChannelConfig(cfg, { ...channel, accounts: accts });
|
|
13534
|
+
},
|
|
13535
|
+
/**
|
|
13536
|
+
* Resolve a default delivery target for cron/announce when no --to is provided.
|
|
13537
|
+
* Scans the agent's session store for quiubo group sessions and returns the
|
|
13538
|
+
* group ID if there's exactly one. With multiple groups, returns undefined
|
|
13539
|
+
* (user must specify --to).
|
|
13540
|
+
*/
|
|
13541
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13542
|
+
resolveDefaultTo({ cfg, accountId }) {
|
|
13543
|
+
try {
|
|
13544
|
+
const fs = __require("node:fs");
|
|
13545
|
+
const path = __require("node:path");
|
|
13546
|
+
const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
13547
|
+
const agentId = accountId ?? "main";
|
|
13548
|
+
const possiblePaths = [
|
|
13549
|
+
path.join(homeDir, ".openclaw", "agents", agentId, "sessions", "sessions.json"),
|
|
13550
|
+
path.join(homeDir, ".openclaw", "sessions", "sessions.json")
|
|
13551
|
+
];
|
|
13552
|
+
for (const storePath of possiblePaths) {
|
|
13553
|
+
if (!fs.existsSync(storePath)) continue;
|
|
13554
|
+
const raw = fs.readFileSync(storePath, "utf-8");
|
|
13555
|
+
const store = JSON.parse(raw);
|
|
13556
|
+
const groupIds = /* @__PURE__ */ new Set();
|
|
13557
|
+
for (const key of Object.keys(store)) {
|
|
13558
|
+
const match = key.match(/quiubo:([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i);
|
|
13559
|
+
if (match && !key.includes(":group:")) {
|
|
13560
|
+
groupIds.add(match[1]);
|
|
13561
|
+
}
|
|
13562
|
+
}
|
|
13563
|
+
if (groupIds.size === 1) {
|
|
13564
|
+
return [...groupIds][0];
|
|
13565
|
+
}
|
|
13566
|
+
if (groupIds.size > 1) return void 0;
|
|
13567
|
+
}
|
|
13568
|
+
} catch {
|
|
13569
|
+
}
|
|
13570
|
+
return void 0;
|
|
13534
13571
|
}
|
|
13535
13572
|
},
|
|
13536
13573
|
// ── setup adapter (for `channels add` CLI) ──────────────────────
|
|
@@ -13752,8 +13789,13 @@ var quiuboPlugin = {
|
|
|
13752
13789
|
}
|
|
13753
13790
|
log?.info?.(`[${accountId}] [outbound:sendText] groupId=${groupId}, text=${text?.length ?? 0} chars, ctx.to=${ctx.to}, ConversationLabel=${ctx.target?.raw?.ConversationLabel ?? ctx.ConversationLabel}, SessionKey=${ctx.target?.raw?.SessionKey ?? ctx.SessionKey}`);
|
|
13754
13791
|
if (!groupId) {
|
|
13755
|
-
|
|
13756
|
-
|
|
13792
|
+
const availableGroups = listAgentQuiuboGroups(accountId);
|
|
13793
|
+
if (availableGroups.length > 0) {
|
|
13794
|
+
log?.error?.(`[${accountId}] [outbound:sendText] no groupId resolved. Available groups for this agent: ${availableGroups.join(", ")}. Set --to <groupId> when creating crons.`);
|
|
13795
|
+
} else {
|
|
13796
|
+
log?.error?.(`[${accountId}] [outbound:sendText] no groupId \u2014 ctx keys=${Object.keys(ctx).join(",")}, target=${ctx.target ? JSON.stringify(Object.keys(ctx.target)) : "none"}, raw=${ctx.target?.raw ? JSON.stringify(Object.keys(ctx.target.raw)) : "none"}`);
|
|
13797
|
+
}
|
|
13798
|
+
return { ok: false, error: availableGroups.length > 0 ? `No groupId in outbound context. Available groups: ${availableGroups.join(", ")}. Use --to <groupId> when creating crons.` : "No groupId in outbound context" };
|
|
13757
13799
|
}
|
|
13758
13800
|
const senderId = account.botIdentityId;
|
|
13759
13801
|
if (!senderId) {
|
|
@@ -13805,7 +13847,8 @@ var quiuboPlugin = {
|
|
|
13805
13847
|
}
|
|
13806
13848
|
if (!groupId) {
|
|
13807
13849
|
log?.error?.(`[${accountId}] [outbound:sendMedia] no groupId \u2014 ctx keys=${Object.keys(ctx).join(",")}`);
|
|
13808
|
-
|
|
13850
|
+
const _groups = listAgentQuiuboGroups(accountId);
|
|
13851
|
+
return { ok: false, error: _groups.length > 0 ? `No groupId in outbound context. Available groups: ${_groups.join(", ")}. Use --to <groupId> when creating crons.` : "No groupId in outbound context" };
|
|
13809
13852
|
}
|
|
13810
13853
|
const outboundAttachments = await readOutboundAttachments(urls, "agent", client, groupId, log, accountId);
|
|
13811
13854
|
const imageAttachments = outboundAttachments.filter((a) => a.mimeType.startsWith("image/"));
|
|
@@ -13873,7 +13916,8 @@ var quiuboPlugin = {
|
|
|
13873
13916
|
}
|
|
13874
13917
|
if (!groupId) {
|
|
13875
13918
|
log?.error?.(`[${accountId}] [outbound:createPost] no groupId \u2014 ctx keys=${Object.keys(ctx).join(",")}`);
|
|
13876
|
-
|
|
13919
|
+
const _groups = listAgentQuiuboGroups(accountId);
|
|
13920
|
+
return { ok: false, error: _groups.length > 0 ? `No groupId in outbound context. Available groups: ${_groups.join(", ")}. Use --to <groupId> when creating crons.` : "No groupId in outbound context" };
|
|
13877
13921
|
}
|
|
13878
13922
|
const senderId = account.botIdentityId;
|
|
13879
13923
|
if (!senderId) {
|
|
@@ -14317,6 +14361,25 @@ var quiuboPlugin = {
|
|
|
14317
14361
|
}
|
|
14318
14362
|
}
|
|
14319
14363
|
};
|
|
14364
|
+
function listAgentQuiuboGroups(agentId) {
|
|
14365
|
+
try {
|
|
14366
|
+
const fs = __require("node:fs");
|
|
14367
|
+
const path = __require("node:path");
|
|
14368
|
+
const homeDir = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
14369
|
+
const storePath = path.join(homeDir, ".openclaw", "agents", agentId, "sessions", "sessions.json");
|
|
14370
|
+
if (!fs.existsSync(storePath)) return [];
|
|
14371
|
+
const raw = fs.readFileSync(storePath, "utf-8");
|
|
14372
|
+
const store = JSON.parse(raw);
|
|
14373
|
+
const groups = /* @__PURE__ */ new Set();
|
|
14374
|
+
for (const key of Object.keys(store)) {
|
|
14375
|
+
const match = key.match(/quiubo:([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i);
|
|
14376
|
+
if (match && !key.includes(":group:")) groups.add(match[1]);
|
|
14377
|
+
}
|
|
14378
|
+
return [...groups];
|
|
14379
|
+
} catch {
|
|
14380
|
+
return [];
|
|
14381
|
+
}
|
|
14382
|
+
}
|
|
14320
14383
|
function resolveOutboundGroupId(ctx) {
|
|
14321
14384
|
const raw = ctx.target?.raw ?? ctx;
|
|
14322
14385
|
const label = raw.ConversationLabel ?? ctx.ConversationLabel;
|