@bountyagents/bountyagents-task 2026.3.94 → 2026.3.95
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 +7 -4
- package/package.json +1 -1
- package/src/worker.ts +12 -5
package/dist/index.js
CHANGED
|
@@ -55745,7 +55745,8 @@ async function getAvailableTask(params) {
|
|
|
55745
55745
|
});
|
|
55746
55746
|
const tasks = await plugin.executeTool("bountyagents.worker.task.query", {
|
|
55747
55747
|
filter: {
|
|
55748
|
-
status: "active"
|
|
55748
|
+
status: "active",
|
|
55749
|
+
...params.id ? { id: params.id } : {}
|
|
55749
55750
|
},
|
|
55750
55751
|
pageSize: params.pageSize,
|
|
55751
55752
|
pageNum: params.pageNum
|
|
@@ -55770,16 +55771,18 @@ async function submitResponse(params) {
|
|
|
55770
55771
|
function registerWorkerTools(api3) {
|
|
55771
55772
|
api3.registerTool({
|
|
55772
55773
|
name: "get_available_task",
|
|
55773
|
-
description: "Get available active bounty task for the worker to work on and respond to.",
|
|
55774
|
+
description: "Get available active bounty task for the worker to work on and respond to, if id is provided, get the task with the given id.",
|
|
55774
55775
|
parameters: Type.Object({
|
|
55775
|
-
keyword: Type.Optional(Type.String())
|
|
55776
|
+
keyword: Type.Optional(Type.String()),
|
|
55777
|
+
id: Type.Optional(Type.String())
|
|
55776
55778
|
}),
|
|
55777
55779
|
async execute(_id, params) {
|
|
55778
55780
|
try {
|
|
55779
55781
|
const result = await getAvailableTask({
|
|
55780
55782
|
pageSize: 1,
|
|
55781
55783
|
pageNum: 0,
|
|
55782
|
-
keyword: ""
|
|
55784
|
+
keyword: "",
|
|
55785
|
+
id: params.id
|
|
55783
55786
|
});
|
|
55784
55787
|
return json(result);
|
|
55785
55788
|
} catch (error48) {
|
package/package.json
CHANGED
package/src/worker.ts
CHANGED
|
@@ -7,6 +7,7 @@ const SERVICE_URL = "http://localhost:3000";
|
|
|
7
7
|
const CONTRACT_ADDRESS = "0x55D45aFA265d0381C8A81328FfeA408D2Dd45F40";
|
|
8
8
|
|
|
9
9
|
export async function getAvailableTask(params: {
|
|
10
|
+
id?: string;
|
|
10
11
|
keyword?: string;
|
|
11
12
|
pageSize?: number;
|
|
12
13
|
pageNum?: number;
|
|
@@ -20,6 +21,7 @@ export async function getAvailableTask(params: {
|
|
|
20
21
|
const tasks = (await plugin.executeTool("bountyagents.worker.task.query", {
|
|
21
22
|
filter: {
|
|
22
23
|
status: "active",
|
|
24
|
+
...(params.id ? { id: params.id } : {}),
|
|
23
25
|
},
|
|
24
26
|
pageSize: params.pageSize,
|
|
25
27
|
pageNum: params.pageNum,
|
|
@@ -40,10 +42,13 @@ export async function submitResponse(params: {
|
|
|
40
42
|
contractAddress: CONTRACT_ADDRESS,
|
|
41
43
|
});
|
|
42
44
|
|
|
43
|
-
const response = (await plugin.executeTool(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const response = (await plugin.executeTool(
|
|
46
|
+
"bountyagents.worker.task.respond",
|
|
47
|
+
{
|
|
48
|
+
taskId: params.taskId,
|
|
49
|
+
payload: params.payload,
|
|
50
|
+
}
|
|
51
|
+
)) as any;
|
|
47
52
|
return response;
|
|
48
53
|
}
|
|
49
54
|
|
|
@@ -51,9 +56,10 @@ export function registerWorkerTools(api: any) {
|
|
|
51
56
|
api.registerTool({
|
|
52
57
|
name: "get_available_task",
|
|
53
58
|
description:
|
|
54
|
-
"Get available active bounty task for the worker to work on and respond to.",
|
|
59
|
+
"Get available active bounty task for the worker to work on and respond to, if id is provided, get the task with the given id.",
|
|
55
60
|
parameters: Type.Object({
|
|
56
61
|
keyword: Type.Optional(Type.String()),
|
|
62
|
+
id: Type.Optional(Type.String()),
|
|
57
63
|
}),
|
|
58
64
|
async execute(_id: string, params: any) {
|
|
59
65
|
try {
|
|
@@ -61,6 +67,7 @@ export function registerWorkerTools(api: any) {
|
|
|
61
67
|
pageSize: 1,
|
|
62
68
|
pageNum: 0,
|
|
63
69
|
keyword: "",
|
|
70
|
+
id: params.id,
|
|
64
71
|
});
|
|
65
72
|
return json(result);
|
|
66
73
|
} catch (error: any) {
|