Files
agent-bounty-protocol/packages/agent-sdk/src/modules/tasks.ts
OG T 36ea11ea0f
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 9s
feat: add test agent, python sdk, and external traffic validator
2026-06-08 14:12:56 +08:00

40 lines
1.3 KiB
TypeScript

import { VibeWorkClient } from '../client';
import { ClaimTaskRequest, ClaimTaskResponse, SubmitSolutionRequest, SubmitSolutionResponse, TaskBounty } from '../types';
export class TasksModule {
private client: VibeWorkClient;
constructor(client: VibeWorkClient) {
this.client = client;
}
/**
* List all open bounties in the IntentPool
*/
async listOpenBounties(limit = 10): Promise<TaskBounty[]> {
const response = await this.client.http.get<{ tasks: TaskBounty[] }>('/api/open-tasks');
return response.data.tasks.slice(0, limit);
}
/**
* Claim a bounty task
*/
async claimBounty(taskId: string, agentId: string, developerWallet: string = "0x0000000000000000000000000000000000000000"): Promise<ClaimTaskResponse> {
const request: ClaimTaskRequest = {
task_id: taskId,
agent_id: agentId,
developer_wallet: developerWallet
};
const response = await this.client.http.post<ClaimTaskResponse>('/api/mcp/claim_task', request);
return response.data;
}
/**
* Submit work for a bounty
*/
async submitWork(options: SubmitSolutionRequest): Promise<SubmitSolutionResponse> {
const response = await this.client.http.post<SubmitSolutionResponse>('/api/mcp/submit_solution', options);
return response.data;
}
}