@bountyagents/bountyagents-task 2026.3.94 → 2026.3.96
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 +28 -40
- package/index.ts +33 -33
- package/package.json +1 -1
- package/src/worker.ts +12 -5
package/dist/index.js
CHANGED
|
@@ -30026,27 +30026,6 @@ var require_eventsource = __commonJS((exports, module) => {
|
|
|
30026
30026
|
};
|
|
30027
30027
|
});
|
|
30028
30028
|
|
|
30029
|
-
// src/helper.ts
|
|
30030
|
-
import * as fs from "fs";
|
|
30031
|
-
import * as path from "path";
|
|
30032
|
-
import * as os from "os";
|
|
30033
|
-
function json(data) {
|
|
30034
|
-
return {
|
|
30035
|
-
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
30036
|
-
details: data
|
|
30037
|
-
};
|
|
30038
|
-
}
|
|
30039
|
-
var KEY_PATH = path.join(os.homedir(), ".bountyagents_key");
|
|
30040
|
-
function getPrivateKey() {
|
|
30041
|
-
if (fs.existsSync(KEY_PATH)) {
|
|
30042
|
-
const key = fs.readFileSync(KEY_PATH, "utf-8").trim();
|
|
30043
|
-
if (key.startsWith("0x")) {
|
|
30044
|
-
return key;
|
|
30045
|
-
}
|
|
30046
|
-
}
|
|
30047
|
-
return "0x289f92dd30c36ff24b75b48623c70dea2b428dabac7a52c5ca810bcda64d861b";
|
|
30048
|
-
}
|
|
30049
|
-
|
|
30050
30029
|
// ../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
30051
30030
|
var exports_value = {};
|
|
30052
30031
|
__export(exports_value, {
|
|
@@ -41397,6 +41376,27 @@ var buildSettleDataHash = (contractAddress, key, owner, token, worker, amount) =
|
|
|
41397
41376
|
]));
|
|
41398
41377
|
};
|
|
41399
41378
|
|
|
41379
|
+
// src/helper.ts
|
|
41380
|
+
import * as fs from "fs";
|
|
41381
|
+
import * as path from "path";
|
|
41382
|
+
import * as os from "os";
|
|
41383
|
+
function json(data) {
|
|
41384
|
+
return {
|
|
41385
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
41386
|
+
details: data
|
|
41387
|
+
};
|
|
41388
|
+
}
|
|
41389
|
+
var KEY_PATH = path.join(os.homedir(), ".bountyagents_key");
|
|
41390
|
+
function getPrivateKey() {
|
|
41391
|
+
if (fs.existsSync(KEY_PATH)) {
|
|
41392
|
+
const key = fs.readFileSync(KEY_PATH, "utf-8").trim();
|
|
41393
|
+
if (key.startsWith("0x")) {
|
|
41394
|
+
return key;
|
|
41395
|
+
}
|
|
41396
|
+
}
|
|
41397
|
+
return "0x289f92dd30c36ff24b75b48623c70dea2b428dabac7a52c5ca810bcda64d861b";
|
|
41398
|
+
}
|
|
41399
|
+
|
|
41400
41400
|
// node_modules/undici/index.js
|
|
41401
41401
|
var __filename = "/Users/amigo/Develop/mizu/bountyagents/plugin/node_modules/undici/index.js";
|
|
41402
41402
|
var Client = require_client();
|
|
@@ -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) {
|
|
@@ -55814,21 +55817,6 @@ function registerWorkerTools(api3) {
|
|
|
55814
55817
|
|
|
55815
55818
|
// index.ts
|
|
55816
55819
|
function register(api3) {
|
|
55817
|
-
api3.registerCommand({
|
|
55818
|
-
name: "upclaw",
|
|
55819
|
-
description: "UpClaw Bounty Agents Task commands",
|
|
55820
|
-
acceptsArgs: true,
|
|
55821
|
-
handler: async (ctx) => {
|
|
55822
|
-
const args = ctx.args?.trim() ?? "";
|
|
55823
|
-
const tokens = args.split(/\s+/).filter(Boolean);
|
|
55824
|
-
const action = (tokens[0] ?? "status").toLowerCase();
|
|
55825
|
-
if (action === "init") {}
|
|
55826
|
-
return json({
|
|
55827
|
-
text: ["UpClaw Bounty Agents Task commands:", "", "/upclaw-task init"].join(`
|
|
55828
|
-
`)
|
|
55829
|
-
});
|
|
55830
|
-
}
|
|
55831
|
-
});
|
|
55832
55820
|
registerPublisherTools(api3);
|
|
55833
55821
|
registerWorkerTools(api3);
|
|
55834
55822
|
}
|
package/index.ts
CHANGED
|
@@ -5,41 +5,41 @@ import { generatePrivateKey } from "viem/accounts";
|
|
|
5
5
|
import * as fs from "fs";
|
|
6
6
|
|
|
7
7
|
export default function register(api: any) {
|
|
8
|
-
api.registerCommand({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
// api.registerCommand({
|
|
9
|
+
// name: "upclaw",
|
|
10
|
+
// description: "UpClaw Bounty Agents Task commands",
|
|
11
|
+
// acceptsArgs: true,
|
|
12
|
+
// handler: async (ctx: any) => {
|
|
13
|
+
// const args = ctx.args?.trim() ?? "";
|
|
14
|
+
// const tokens = args.split(/\s+/).filter(Boolean);
|
|
15
|
+
// const action = (tokens[0] ?? "status").toLowerCase();
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
// if (action === "init") {
|
|
18
|
+
// // try {
|
|
19
|
+
// // if (!fs.existsSync(KEY_PATH)) {
|
|
20
|
+
// // const pk = generatePrivateKey();
|
|
21
|
+
// // fs.writeFileSync(KEY_PATH, pk, "utf-8");
|
|
22
|
+
// // return json({
|
|
23
|
+
// // text: `Initialized new EVM private key and saved to ${KEY_PATH}`,
|
|
24
|
+
// // });
|
|
25
|
+
// // } else {
|
|
26
|
+
// // return json({
|
|
27
|
+
// // text: `EVM private key already exists at ${KEY_PATH}`,
|
|
28
|
+
// // });
|
|
29
|
+
// // }
|
|
30
|
+
// // } catch (error: any) {
|
|
31
|
+
// // return json({
|
|
32
|
+
// // text: "Failed to initialize key:",
|
|
33
|
+
// // error: error.message,
|
|
34
|
+
// // });
|
|
35
|
+
// // }
|
|
36
|
+
// }
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
38
|
+
// return json({
|
|
39
|
+
// text: ["UpClaw Bounty Agents Task commands:", "", "/upclaw-task init"].join("\n"),
|
|
40
|
+
// });
|
|
41
|
+
// },
|
|
42
|
+
// });
|
|
43
43
|
|
|
44
44
|
registerPublisherTools(api);
|
|
45
45
|
registerWorkerTools(api);
|
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) {
|