openclaw-quiubo 2.6.37 → 2.6.38
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 +15 -1
- package/dist/index.js.map +2 -2
- package/dist/src/create-post-tool.d.ts.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14638,6 +14638,18 @@ function extractGroupIdFromSessionKey(key) {
|
|
|
14638
14638
|
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);
|
|
14639
14639
|
return match?.[1];
|
|
14640
14640
|
}
|
|
14641
|
+
function extractAgentIdFromSessionKey(key) {
|
|
14642
|
+
if (!key) return "main";
|
|
14643
|
+
const match = key.match(/^agent:([^:]+):quiubo:/);
|
|
14644
|
+
return match?.[1] ?? "main";
|
|
14645
|
+
}
|
|
14646
|
+
function resolveAccountId(config, agentId) {
|
|
14647
|
+
const bindings = config?.bindings ?? [];
|
|
14648
|
+
const matched = bindings.find(
|
|
14649
|
+
(b) => b?.match?.channel === "quiubo" && b?.agentId === agentId
|
|
14650
|
+
);
|
|
14651
|
+
return matched?.match?.accountId ?? "default";
|
|
14652
|
+
}
|
|
14641
14653
|
function jsonResult(payload) {
|
|
14642
14654
|
return {
|
|
14643
14655
|
content: [{ type: "text", text: JSON.stringify(payload) }],
|
|
@@ -14651,8 +14663,10 @@ function errorResult(msg) {
|
|
|
14651
14663
|
};
|
|
14652
14664
|
}
|
|
14653
14665
|
function createQuiuboPostToolFactory(ctx) {
|
|
14666
|
+
const agentId = extractAgentIdFromSessionKey(ctx.sessionKey);
|
|
14667
|
+
const accountId = resolveAccountId(ctx.config, agentId);
|
|
14654
14668
|
const quiuboConfig = ctx.config?.channels?.quiubo;
|
|
14655
|
-
const accountCfg = quiuboConfig?.accounts?.
|
|
14669
|
+
const accountCfg = quiuboConfig?.accounts?.[accountId];
|
|
14656
14670
|
if (!accountCfg?.apiKey) return null;
|
|
14657
14671
|
const client = new QuiuboApiClient(
|
|
14658
14672
|
accountCfg.apiUrl ?? DEFAULT_API_URL2,
|