openclaw-quiubo 2.3.5 → 2.4.0
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 +48 -19
- 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
|
@@ -13606,23 +13606,43 @@ var quiuboPlugin = {
|
|
|
13606
13606
|
client.getGroup(groupId),
|
|
13607
13607
|
client.listGroupMembers(groupId)
|
|
13608
13608
|
]);
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13609
|
+
if (group.management === "partner") {
|
|
13610
|
+
const owner = members.find((m) => m.role === "owner");
|
|
13611
|
+
const botSettings = group.settings?.bot ?? {};
|
|
13612
|
+
log?.info?.(`[${accountId}] Quiubo: cache-miss resolved as partner group ${groupId}`);
|
|
13613
|
+
return {
|
|
13614
|
+
enabled: botSettings.enabled ?? false,
|
|
13615
|
+
suppressionMinutes: botSettings.suppressionMinutes ?? 10,
|
|
13616
|
+
ownerIdentityId: owner?.identityId ?? "",
|
|
13617
|
+
groupType: group.groupType ?? "standard"
|
|
13618
|
+
};
|
|
13619
|
+
}
|
|
13620
|
+
if (resolvedAgentId) {
|
|
13621
|
+
log?.info?.(`[${accountId}] Quiubo: non-partner group ${groupId}, trying getGroupAgent(${resolvedAgentId})`);
|
|
13622
|
+
const status = await client.getGroupAgent(resolvedAgentId, groupId);
|
|
13623
|
+
if (status) {
|
|
13624
|
+
log?.info?.(`[${accountId}] Quiubo: cache-miss resolved as directory group ${groupId}: ${JSON.stringify(status)}`);
|
|
13625
|
+
return {
|
|
13626
|
+
enabled: status.enabled,
|
|
13627
|
+
suppressionMinutes: 10,
|
|
13628
|
+
ownerIdentityId: "",
|
|
13629
|
+
groupType: group.groupType ?? "standard",
|
|
13630
|
+
triggerMode: status.triggerMode,
|
|
13631
|
+
source: "directory",
|
|
13632
|
+
grantedScopes: status.grantedScopes,
|
|
13633
|
+
agentDisplayName: resolvedAgentDisplayName
|
|
13634
|
+
};
|
|
13635
|
+
}
|
|
13636
|
+
}
|
|
13637
|
+
log?.warn?.(`[${accountId}] Quiubo: cache-miss returned null for group ${groupId} (fail-closed)`);
|
|
13638
|
+
return null;
|
|
13639
|
+
} catch (err) {
|
|
13640
|
+
log?.info?.(`[${accountId}] Quiubo: getGroup failed for ${groupId}: ${err}`);
|
|
13620
13641
|
if (resolvedAgentId) {
|
|
13621
13642
|
try {
|
|
13622
|
-
log?.info?.(`[${accountId}] Quiubo: trying getGroupAgent(${resolvedAgentId}, ${groupId})`);
|
|
13623
13643
|
const status = await client.getGroupAgent(resolvedAgentId, groupId);
|
|
13624
|
-
log?.info?.(`[${accountId}] Quiubo: getGroupAgent result: ${JSON.stringify(status)}`);
|
|
13625
13644
|
if (status) {
|
|
13645
|
+
log?.info?.(`[${accountId}] Quiubo: cache-miss resolved via getGroupAgent for ${groupId}`);
|
|
13626
13646
|
return {
|
|
13627
13647
|
enabled: status.enabled,
|
|
13628
13648
|
suppressionMinutes: 10,
|
|
@@ -13662,11 +13682,7 @@ var quiuboPlugin = {
|
|
|
13662
13682
|
onRequest: async (req) => {
|
|
13663
13683
|
log?.info?.(`[${accountId}] Quiubo: openclaw:request type=${req.type} requestId=${req.requestId} group=${req.groupId} from=${req.requestingIdentityId}`);
|
|
13664
13684
|
try {
|
|
13665
|
-
const
|
|
13666
|
-
const matchedBinding = bindings.find(
|
|
13667
|
-
(b) => b?.match?.channel === "quiubo" && b?.match?.accountId === accountId
|
|
13668
|
-
);
|
|
13669
|
-
const agentId = matchedBinding?.agentId || cfg?.agents?.list?.[0]?.id || "main";
|
|
13685
|
+
const agentId = resolveAgentId(cfg, accountId);
|
|
13670
13686
|
let data;
|
|
13671
13687
|
if (req.type === "activity") {
|
|
13672
13688
|
data = await getActivityData(runtime2, log, agentId);
|
|
@@ -13831,6 +13847,16 @@ async function createBotIdentity(client, prompter) {
|
|
|
13831
13847
|
return null;
|
|
13832
13848
|
}
|
|
13833
13849
|
}
|
|
13850
|
+
function resolveAgentId(cfg, accountId) {
|
|
13851
|
+
const bindings = cfg?.bindings ?? [];
|
|
13852
|
+
const matched = bindings.find(
|
|
13853
|
+
(b) => b?.match?.channel === "quiubo" && b?.match?.accountId === accountId
|
|
13854
|
+
);
|
|
13855
|
+
return matched?.agentId || cfg?.agents?.list?.[0]?.id || "main";
|
|
13856
|
+
}
|
|
13857
|
+
function buildSessionKey(agentId, groupId) {
|
|
13858
|
+
return agentId === "main" ? `quiubo:${groupId}` : `agent:${agentId}:quiubo:${groupId}`;
|
|
13859
|
+
}
|
|
13834
13860
|
async function routeInboundMessage(opts) {
|
|
13835
13861
|
const { runtime: runtime2, cfg, accountId, botIdentityId, client, msg, log, keyManager, e2eeGrantedGroups } = opts;
|
|
13836
13862
|
const senderId = msg.senderIdentityId;
|
|
@@ -13855,6 +13881,9 @@ async function routeInboundMessage(opts) {
|
|
|
13855
13881
|
};
|
|
13856
13882
|
await sendTyping();
|
|
13857
13883
|
const typingInterval = setInterval(sendTyping, 4e3);
|
|
13884
|
+
const agentId = resolveAgentId(cfg, accountId);
|
|
13885
|
+
const sessionKey = buildSessionKey(agentId, groupId);
|
|
13886
|
+
log?.info?.(`[${accountId}] Quiubo: resolved agentId=${agentId}, sessionKey=${sessionKey}`);
|
|
13858
13887
|
const ctxPayload = runtime2.channel.reply.finalizeInboundContext({
|
|
13859
13888
|
Body: text,
|
|
13860
13889
|
RawBody: text,
|
|
@@ -13862,7 +13891,7 @@ async function routeInboundMessage(opts) {
|
|
|
13862
13891
|
CommandAuthorized: true,
|
|
13863
13892
|
From: `quiubo:${senderId}`,
|
|
13864
13893
|
To: `quiubo:${botIdentityId}`,
|
|
13865
|
-
SessionKey:
|
|
13894
|
+
SessionKey: sessionKey,
|
|
13866
13895
|
AccountId: accountId,
|
|
13867
13896
|
ChatType: "group",
|
|
13868
13897
|
ConversationLabel: `quiubo:${groupId}`,
|