@a2hmarket/a2hmarket 0.7.7 → 0.7.9
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/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/tools/address.ts +3 -3
- package/src/tools/discussion.ts +3 -3
- package/src/tools/file.ts +1 -1
- package/src/tools/order.ts +4 -4
- package/src/tools/payment.ts +2 -2
- package/src/tools/profile.ts +1 -1
- package/src/tools/send.ts +1 -1
- package/src/tools/status.ts +1 -1
- package/src/tools/tempo-payment.ts +1 -1
- package/src/tools/works.ts +8 -7
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/tools/address.ts
CHANGED
|
@@ -34,7 +34,7 @@ export function registerAddressTools(api: OpenClawPluginApi, client: A2HApiClien
|
|
|
34
34
|
},
|
|
35
35
|
required: ["receiverName", "phoneNumber", "province", "city", "district", "detailAddress"],
|
|
36
36
|
},
|
|
37
|
-
execute: async (params: Record<string, unknown>) => {
|
|
37
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
38
38
|
const body: Record<string, unknown> = {
|
|
39
39
|
receiverName: params.receiverName,
|
|
40
40
|
phoneNumber: params.phoneNumber,
|
|
@@ -61,7 +61,7 @@ export function registerAddressTools(api: OpenClawPluginApi, client: A2HApiClien
|
|
|
61
61
|
},
|
|
62
62
|
required: ["address_id"],
|
|
63
63
|
},
|
|
64
|
-
execute: async (params: Record<string, unknown>) => {
|
|
64
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
65
65
|
const apiPath = `${ADDRESS_API}/${params.address_id}`;
|
|
66
66
|
const data = await client.deleteJSON(apiPath);
|
|
67
67
|
return { result: JSON.stringify(data ?? { ok: true }, null, 2) };
|
|
@@ -78,7 +78,7 @@ export function registerAddressTools(api: OpenClawPluginApi, client: A2HApiClien
|
|
|
78
78
|
},
|
|
79
79
|
required: ["address_id"],
|
|
80
80
|
},
|
|
81
|
-
execute: async (params: Record<string, unknown>) => {
|
|
81
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
82
82
|
const apiPath = `${ADDRESS_API}/${params.address_id}/default`;
|
|
83
83
|
const data = await client.putJSON(apiPath);
|
|
84
84
|
return { result: JSON.stringify(data ?? { ok: true }, null, 2) };
|
package/src/tools/discussion.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function registerDiscussionTools(api: OpenClawPluginApi, client: A2HApiCl
|
|
|
22
22
|
},
|
|
23
23
|
required: ["title", "content"],
|
|
24
24
|
},
|
|
25
|
-
execute: async (params: Record<string, unknown>) => {
|
|
25
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
26
26
|
const body: Record<string, unknown> = {
|
|
27
27
|
type: 4,
|
|
28
28
|
title: params.title,
|
|
@@ -48,7 +48,7 @@ export function registerDiscussionTools(api: OpenClawPluginApi, client: A2HApiCl
|
|
|
48
48
|
},
|
|
49
49
|
required: ["parent_works_id", "title", "content"],
|
|
50
50
|
},
|
|
51
|
-
execute: async (params: Record<string, unknown>) => {
|
|
51
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
52
52
|
const body = {
|
|
53
53
|
type: 4,
|
|
54
54
|
title: params.title,
|
|
@@ -71,7 +71,7 @@ export function registerDiscussionTools(api: OpenClawPluginApi, client: A2HApiCl
|
|
|
71
71
|
page_size: { type: "number", description: "Page size (default 20)" },
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
|
-
execute: async (params: Record<string, unknown>) => {
|
|
74
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
75
75
|
const page = (params.page as number) || 1;
|
|
76
76
|
const pageSize = (params.page_size as number) || 20;
|
|
77
77
|
const qs = `?type=4&page=${page}&pageSize=${pageSize}`;
|
package/src/tools/file.ts
CHANGED
|
@@ -18,7 +18,7 @@ export function registerFileTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
18
18
|
},
|
|
19
19
|
required: ["file"],
|
|
20
20
|
},
|
|
21
|
-
execute: async (params: Record<string, unknown>) => {
|
|
21
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
22
22
|
const uploadType = (params.upload_type as string) || "chatfile";
|
|
23
23
|
const fileInfo = await ossUpload(client, params.file as string, uploadType);
|
|
24
24
|
return { result: JSON.stringify(fileInfo, null, 2) };
|
package/src/tools/order.ts
CHANGED
|
@@ -18,7 +18,7 @@ export function registerOrderTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
18
18
|
},
|
|
19
19
|
required: ["customer_id", "title", "content", "price_cent", "product_id", "order_type"],
|
|
20
20
|
},
|
|
21
|
-
execute: async (params: Record<string, unknown>) => {
|
|
21
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
22
22
|
const body = {
|
|
23
23
|
providerId: client.agentId,
|
|
24
24
|
customerId: params.customer_id,
|
|
@@ -48,7 +48,7 @@ export function registerOrderTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
48
48
|
},
|
|
49
49
|
required: ["order_id", "action"],
|
|
50
50
|
},
|
|
51
|
-
execute: async (params: Record<string, unknown>) => {
|
|
51
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
52
52
|
const validActions = ["confirm", "reject", "cancel", "confirm-received", "confirm-service-completed"];
|
|
53
53
|
const action = params.action as string;
|
|
54
54
|
if (!validActions.includes(action)) {
|
|
@@ -70,7 +70,7 @@ export function registerOrderTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
70
70
|
},
|
|
71
71
|
required: ["order_id"],
|
|
72
72
|
},
|
|
73
|
-
execute: async (params: Record<string, unknown>) => {
|
|
73
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
74
74
|
const orderId = (params.order_id ?? params.orderId) as string;
|
|
75
75
|
if (!orderId) throw new Error("order_id is required");
|
|
76
76
|
const apiPath = `/findu-trade/api/v1/orders/${orderId}/detail`;
|
|
@@ -95,7 +95,7 @@ export function registerOrderTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
95
95
|
},
|
|
96
96
|
required: ["role"],
|
|
97
97
|
},
|
|
98
|
-
execute: async (params: Record<string, unknown>) => {
|
|
98
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
99
99
|
const role = params.role === "purchase" ? "purchase-orders" : "sales-orders";
|
|
100
100
|
const page = (params.page as number) || 1;
|
|
101
101
|
const pageSize = (params.page_size as number) || 20;
|
package/src/tools/payment.ts
CHANGED
|
@@ -66,7 +66,7 @@ export function registerPaymentTools(api: OpenClawPluginApi, client: A2HApiClien
|
|
|
66
66
|
},
|
|
67
67
|
required: ["order_id"],
|
|
68
68
|
},
|
|
69
|
-
execute: async (params: Record<string, unknown>) => {
|
|
69
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
70
70
|
const orderId = (params.order_id ?? params.orderId) as string;
|
|
71
71
|
if (!orderId) throw new Error("order_id is required");
|
|
72
72
|
const body: Record<string, unknown> = {
|
|
@@ -91,7 +91,7 @@ export function registerPaymentTools(api: OpenClawPluginApi, client: A2HApiClien
|
|
|
91
91
|
},
|
|
92
92
|
required: ["order_id"],
|
|
93
93
|
},
|
|
94
|
-
execute: async (params: Record<string, unknown>) => {
|
|
94
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
95
95
|
const orderId = (params.order_id ?? params.orderId) as string;
|
|
96
96
|
if (!orderId) throw new Error("order_id is required");
|
|
97
97
|
const apiPath = `${PAYMENT_STATUS_API}/${orderId}`;
|
package/src/tools/profile.ts
CHANGED
|
@@ -30,7 +30,7 @@ export function registerProfileTools(api: OpenClawPluginApi, client: A2HApiClien
|
|
|
30
30
|
},
|
|
31
31
|
required: ["file"],
|
|
32
32
|
},
|
|
33
|
-
execute: async (params: Record<string, unknown>) => {
|
|
33
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
34
34
|
const fileInfo = await ossUpload(client, params.file as string, "profile", PROFILE_QR_MIME);
|
|
35
35
|
|
|
36
36
|
const changeData = await client.postJSON<Record<string, unknown>>(CHANGE_REQUEST_API, {
|
package/src/tools/send.ts
CHANGED
|
@@ -43,7 +43,7 @@ export function registerSendTool(api: OpenClawPluginApi, creds: A2HCredentials)
|
|
|
43
43
|
},
|
|
44
44
|
required: ["target_agent_id"],
|
|
45
45
|
},
|
|
46
|
-
execute: async (params: Record<string, unknown>) => {
|
|
46
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
47
47
|
const targetAgentId = params.target_agent_id as string;
|
|
48
48
|
if (!targetAgentId || targetAgentId === "undefined") {
|
|
49
49
|
throw new Error("target_agent_id is required and cannot be empty. If you are replying to an inbound message, reply with plain text instead of calling a2h_send.");
|
package/src/tools/status.ts
CHANGED
|
@@ -48,7 +48,7 @@ export function registerInboxHistoryTool(api: OpenClawPluginApi, client: A2HApiC
|
|
|
48
48
|
},
|
|
49
49
|
required: ["peer_id"],
|
|
50
50
|
},
|
|
51
|
-
execute: async (params: Record<string, unknown>) => {
|
|
51
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
52
52
|
const peerId = params.peer_id as string;
|
|
53
53
|
const page = (params.page as number) || 1;
|
|
54
54
|
const limit = Math.min((params.limit as number) || 20, 100);
|
|
@@ -40,7 +40,7 @@ export function registerTempoPaymentTools(api: OpenClawPluginApi, client: A2HApi
|
|
|
40
40
|
},
|
|
41
41
|
required: ["order_id"],
|
|
42
42
|
},
|
|
43
|
-
execute: async (params: Record<string, unknown>) => {
|
|
43
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
44
44
|
const orderId = (params.order_id ?? params.orderId) as string;
|
|
45
45
|
if (!orderId) throw new Error("order_id is required");
|
|
46
46
|
|
package/src/tools/works.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function registerWorksTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
22
22
|
},
|
|
23
23
|
required: ["keyword"],
|
|
24
24
|
},
|
|
25
|
-
execute: async (params: Record<string, unknown>) => {
|
|
25
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
26
26
|
const page = (params.page as number) || 1;
|
|
27
27
|
const body: Record<string, unknown> = {
|
|
28
28
|
serviceInfo: params.keyword,
|
|
@@ -48,7 +48,7 @@ export function registerWorksTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
48
48
|
page_size: { type: "number", description: "Page size (default 20)" },
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
|
-
execute: async (params: Record<string, unknown>) => {
|
|
51
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
52
52
|
const page = (params.page as number) || 1;
|
|
53
53
|
const pageSize = (params.page_size as number) || 20;
|
|
54
54
|
let qs = `?pageNum=${page}&pageSize=${pageSize}`;
|
|
@@ -76,10 +76,11 @@ export function registerWorksTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
76
76
|
},
|
|
77
77
|
required: ["type", "title", "content"],
|
|
78
78
|
},
|
|
79
|
-
execute: async (params: Record<string, unknown>) => {
|
|
79
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
80
80
|
const extendInfo: Record<string, unknown> = { pois: [] };
|
|
81
81
|
if (params.expected_price) extendInfo.expectedPrice = params.expected_price;
|
|
82
|
-
|
|
82
|
+
// API requires serviceMethod for both type=2 and type=3; default to "online" for demands
|
|
83
|
+
extendInfo.serviceMethod = (params.service_method as string) || "online";
|
|
83
84
|
if (params.service_location) extendInfo.serviceLocation = params.service_location;
|
|
84
85
|
|
|
85
86
|
const body: Record<string, unknown> = {
|
|
@@ -112,10 +113,10 @@ export function registerWorksTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
112
113
|
},
|
|
113
114
|
required: ["works_id", "type", "title"],
|
|
114
115
|
},
|
|
115
|
-
execute: async (params: Record<string, unknown>) => {
|
|
116
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
116
117
|
const extendInfo: Record<string, unknown> = { pois: [] };
|
|
117
118
|
if (params.expected_price) extendInfo.expectedPrice = params.expected_price;
|
|
118
|
-
|
|
119
|
+
extendInfo.serviceMethod = (params.service_method as string) || "online";
|
|
119
120
|
if (params.service_location) extendInfo.serviceLocation = params.service_location;
|
|
120
121
|
|
|
121
122
|
const body: Record<string, unknown> = {
|
|
@@ -142,7 +143,7 @@ export function registerWorksTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
142
143
|
},
|
|
143
144
|
required: ["works_id"],
|
|
144
145
|
},
|
|
145
|
-
execute: async (params: Record<string, unknown>) => {
|
|
146
|
+
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
146
147
|
const data = await client.deleteJSON(`${WORKS_DELETE_API}/${params.works_id}`);
|
|
147
148
|
return { result: JSON.stringify(data ?? { ok: true }, null, 2) };
|
|
148
149
|
},
|