openclaw-plugin-yuanbao 2.13.3 → 2.13.4
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.
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Fetches group info via the queryGroupInfo interface (WS protocol).
|
|
8
8
|
*/
|
|
9
9
|
import { getMember } from "../../infra/cache/member.js";
|
|
10
|
+
import { createLog } from "../../logger.js";
|
|
10
11
|
import { extractGroupCode, json } from "../utils/utils.js";
|
|
11
12
|
/**
|
|
12
13
|
* Create the query_group_info tool definition.
|
|
@@ -14,6 +15,7 @@ import { extractGroupCode, json } from "../utils/utils.js";
|
|
|
14
15
|
* Queries basic group info including name, owner (userId + nickname), and member count.
|
|
15
16
|
*/
|
|
16
17
|
function createQueryGroupInfoTool(ctx) {
|
|
18
|
+
const log = createLog("tools.group");
|
|
17
19
|
if (!ctx.messageChannel?.includes('yuanbao'))
|
|
18
20
|
return null;
|
|
19
21
|
const sessionKey = ctx.sessionKey ?? "";
|
|
@@ -34,8 +36,8 @@ function createQueryGroupInfoTool(ctx) {
|
|
|
34
36
|
* 1. No groupCode -> inform model no group context
|
|
35
37
|
* 2. Call queryGroupInfo to get basic group info
|
|
36
38
|
*/
|
|
37
|
-
async execute(
|
|
38
|
-
|
|
39
|
+
async execute(toolCallId, _params) {
|
|
40
|
+
log.debug("execute", { toolCallId });
|
|
39
41
|
const groupCode = extractGroupCode(sessionKey);
|
|
40
42
|
// 1. No groupCode -> cannot locate group
|
|
41
43
|
if (!groupCode) {
|
|
@@ -77,5 +79,7 @@ function createQueryGroupInfoTool(ctx) {
|
|
|
77
79
|
* - query_group_info: Query basic group info (always available)
|
|
78
80
|
*/
|
|
79
81
|
export function registerGroupTools(api) {
|
|
80
|
-
|
|
82
|
+
const log = createLog("tools.group");
|
|
83
|
+
log.info("register tool", { name: "query_group_info", optional: false });
|
|
84
|
+
api.registerTool(createQueryGroupInfoTool, { name: "query_group_info", optional: false });
|
|
81
85
|
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* For group owner info, use the query_group_info tool.
|
|
9
9
|
*/
|
|
10
10
|
import { getMember } from "../../infra/cache/member.js";
|
|
11
|
+
import { createLog } from "../../logger.js";
|
|
11
12
|
import { extractGroupCode, json } from "../utils/utils.js";
|
|
12
13
|
/** @mention hint text (used as JSON field value) */
|
|
13
14
|
const MENTION_HINT_TEXT = 'To @mention a user, you MUST use the format: space + @ + nickname + space (e.g. " @Alice ").';
|
|
@@ -94,6 +95,7 @@ function handleListAll(allMembers, mention) {
|
|
|
94
95
|
* Prefers API-fetched full member list; session cache as fallback.
|
|
95
96
|
*/
|
|
96
97
|
function createQuerySessionMembersTool(ctx) {
|
|
98
|
+
const log = createLog("tools.member");
|
|
97
99
|
if (!ctx.messageChannel?.includes('yuanbao'))
|
|
98
100
|
return null;
|
|
99
101
|
const sessionKey = ctx.sessionKey ?? "";
|
|
@@ -133,11 +135,11 @@ function createQuerySessionMembersTool(ctx) {
|
|
|
133
135
|
* 2. Query via Member facade: prefer GroupMember (WS API) -> fallback SessionMember (cache)
|
|
134
136
|
* 3. Dispatch to action handlers
|
|
135
137
|
*/
|
|
136
|
-
async execute(
|
|
138
|
+
async execute(toolCallId, params) {
|
|
139
|
+
log.debug("execute", { toolCallId });
|
|
137
140
|
const action = typeof params.action === "string" ? params.action : "list_all";
|
|
138
141
|
const nameFilter = typeof params.name === "string" ? params.name.trim() : "";
|
|
139
142
|
const mention = params.mention === true || params.mention === "true";
|
|
140
|
-
// Extract groupCode from sessionKey
|
|
141
143
|
const groupCode = extractGroupCode(sessionKey);
|
|
142
144
|
if (!groupCode) {
|
|
143
145
|
return json({
|
|
@@ -172,5 +174,7 @@ function createQuerySessionMembersTool(ctx) {
|
|
|
172
174
|
* - query_session_members: Query session members (always available)
|
|
173
175
|
*/
|
|
174
176
|
export function registerMemberTools(api) {
|
|
175
|
-
|
|
177
|
+
const log = createLog("tools.member");
|
|
178
|
+
log.info("register tool", { name: "query_session_members", optional: false });
|
|
179
|
+
api.registerTool(createQuerySessionMembersTool, { name: "query_session_members", optional: false });
|
|
176
180
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Scheduled reminder tool (yuanbao_remind). */
|
|
2
|
+
import { createLog } from "../../logger.js";
|
|
2
3
|
import { json } from "../utils/utils.js";
|
|
3
4
|
let _callGatewayTool;
|
|
4
5
|
let _runPluginCmd;
|
|
@@ -586,6 +587,7 @@ function executeLegacy(p, resolvedTo) {
|
|
|
586
587
|
// ============================================================================
|
|
587
588
|
/** Returns null for non-yuanbao channels. */
|
|
588
589
|
function createYuanbaoRemindTool(ctx) {
|
|
590
|
+
const log = createLog("tools.remind");
|
|
589
591
|
if (!ctx.messageChannel?.includes('yuanbao'))
|
|
590
592
|
return null;
|
|
591
593
|
const resolvedTo = resolveToFromSession(ctx);
|
|
@@ -595,7 +597,8 @@ function createYuanbaoRemindTool(ctx) {
|
|
|
595
597
|
label: '元宝定时任务',
|
|
596
598
|
description: TOOL_DESCRIPTION,
|
|
597
599
|
parameters: RemindSchema,
|
|
598
|
-
async execute(
|
|
600
|
+
async execute(toolCallId, params) {
|
|
601
|
+
log.debug("execute", { toolCallId });
|
|
599
602
|
const p = params;
|
|
600
603
|
const gatewayTool = await resolveCallGatewayTool();
|
|
601
604
|
if (gatewayTool) {
|
|
@@ -614,5 +617,7 @@ function createYuanbaoRemindTool(ctx) {
|
|
|
614
617
|
};
|
|
615
618
|
}
|
|
616
619
|
export function registerRemindTools(api) {
|
|
617
|
-
|
|
620
|
+
const log = createLog("tools.remind");
|
|
621
|
+
log.info("register tool", { name: "yuanbao_remind", optional: false });
|
|
622
|
+
api.registerTool(createYuanbaoRemindTool, { name: "yuanbao_remind", optional: false });
|
|
618
623
|
}
|
package/openclaw.plugin.json
CHANGED