feat: add test agent, python sdk, and external traffic validator
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 9s

This commit is contained in:
OG T
2026-06-08 14:12:56 +08:00
parent 0d4d694201
commit 36ea11ea0f
13 changed files with 1469 additions and 61 deletions

View File

@@ -1,5 +1,5 @@
import { VibeWorkClient } from '../client';
import { AgentProfile } from '../types';
import { AgentCard, RegisterAgentResponse } from '../types';
export class IdentityModule {
private client: VibeWorkClient;
@@ -11,23 +11,8 @@ export class IdentityModule {
/**
* Register or update an Agent Card
*/
async registerAgent(card: {
agent_id: string;
name: string;
description: string;
model_provider?: string;
capabilities: string[];
x402_wallet_address?: string;
}): Promise<AgentProfile> {
const response = await this.client.http.post('/api/mcp/agent_card', card);
return response.data;
}
/**
* Get an Agent Profile by ID
*/
async getProfile(agentId: string): Promise<AgentProfile> {
const response = await this.client.http.get(`/api/mcp/agent_card?agent_id=${agentId}`);
async registerAgent(card: AgentCard): Promise<RegisterAgentResponse> {
const response = await this.client.http.post<{ status: string; message: string }>('/api/mcp/agent_card', { card });
return response.data;
}
}

View File

@@ -1,5 +1,5 @@
import { VibeWorkClient } from '../client';
import { TaskBounty, PagedResponse } from '../types';
import { ClaimTaskRequest, ClaimTaskResponse, SubmitSolutionRequest, SubmitSolutionResponse, TaskBounty } from '../types';
export class TasksModule {
private client: VibeWorkClient;
@@ -11,33 +11,29 @@ export class TasksModule {
/**
* List all open bounties in the IntentPool
*/
async listOpenBounties(): Promise<PagedResponse<TaskBounty>> {
const response = await this.client.http.get('/api/open-tasks');
return {
data: response.data,
total: response.data.length
};
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): Promise<TaskBounty> {
const response = await this.client.http.post(`/api/mcp/claim_task`, {
taskId,
agentId
});
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(taskId: string, pullRequestUrl: string): Promise<TaskBounty> {
const response = await this.client.http.post(`/api/mcp/submit_work`, {
taskId,
pullRequestUrl
});
async submitWork(options: SubmitSolutionRequest): Promise<SubmitSolutionResponse> {
const response = await this.client.http.post<SubmitSolutionResponse>('/api/mcp/submit_solution', options);
return response.data;
}
}

View File

@@ -8,14 +8,82 @@ export interface PagedResponse<T> {
total: number;
}
export interface TaskReward {
amount: number;
currency: 'USD' | 'TWD' | 'USDC';
display_amount?: string;
}
export interface TaskBounty {
id: string;
task_id: string;
title: string;
description: string;
reward_amount: number;
reward_currency: string;
status: 'OPEN' | 'ASSIGNED' | 'IN_REVIEW' | 'COMPLETED' | 'CANCELLED';
requirements: string[];
description?: string;
description_preview?: string;
reward_amount_cents?: number;
reward_display?: string;
reward?: TaskReward;
status:
| 'DRAFT'
| 'OPEN'
| 'EXECUTING'
| 'VERIFYING'
| 'COMPLETED'
| 'FAILED'
| 'FAILED_RETRYABLE'
| 'CANCELLED'
| 'DISPUTED'
| 'REFUND_PENDING'
| 'PAYOUT_READY'
| 'PAYOUT_SETTLED'
| 'ARCHIVED'
| 'IN_REVIEW';
required_stack: string[];
difficulty?: string;
scope_clarity_score?: number;
}
export interface AgentCard {
agent_id: string;
name: string;
description?: string;
supported_models?: string[];
skills: string[];
max_concurrent_tasks?: number;
x402_wallet_address?: string;
}
export interface RegisterAgentResponse {
status: string;
message: string;
}
export interface ClaimTaskRequest {
task_id: string;
agent_id: string;
developer_wallet: string;
}
export interface ClaimTaskResponse {
task_id: string;
status: 'EXECUTING';
held_amount: number;
held_currency: 'USD' | 'TWD';
claim_token: string;
expires_at: string;
}
export interface SubmitSolutionRequest {
task_id: string;
claim_token: string;
deliverables: Record<string, string>;
github_pr_url?: string;
}
export interface SubmitSolutionResponse {
task_id: string;
submission_id: string;
status: 'VERIFYING';
estimated_judge_complete_at?: string;
}
export interface AgentProfile {