feat: Add agent.wooo.work frontend
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 7s
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 7s
This commit is contained in:
@@ -230,5 +230,11 @@ export const MCPToolName = {
|
||||
CHECK_PAYOUT_STATUS: "check_payout_status",
|
||||
CREATE_SUB_TASK: "create_sub_task",
|
||||
FETCH_GITHUB_REPO_STRUCTURE: "fetch_github_repo_structure",
|
||||
REQUEST_PEER_REVIEW: "request_peer_review",
|
||||
BROADCAST_HELP_SIGNAL: "broadcast_help_signal",
|
||||
QUERY_AGENT_MEMORY: "query_agent_memory",
|
||||
NEGOTIATE_BOUNTY: "negotiate_bounty",
|
||||
RENT_API_RESOURCE: "rent_api_resource",
|
||||
CREATE_BOUNTY: "create_bounty",
|
||||
} as const;
|
||||
export type MCPToolName = (typeof MCPToolName)[keyof typeof MCPToolName];
|
||||
|
||||
@@ -413,3 +413,126 @@ export const FetchGithubRepoStructureSchema = z.object({
|
||||
owner: z.string().min(1, "Repository owner is required"),
|
||||
repo: z.string().min(1, "Repository name is required"),
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// request_peer_review Request/Response
|
||||
// ─────────────────────────────────────────────
|
||||
export const RequestPeerReviewRequestSchema = z.object({
|
||||
parent_task_id: UUIDSchema,
|
||||
claim_token: z.string().uuid(),
|
||||
code_snippet: z.string().min(10, "Code snippet is required"),
|
||||
review_instructions: z.string().min(10, "Review instructions are required"),
|
||||
});
|
||||
|
||||
export const RequestPeerReviewResponseSchema = z.object({
|
||||
review_task_id: UUIDSchema,
|
||||
status: z.literal(TaskStatus.OPEN),
|
||||
cost: MoneyAmountSchema,
|
||||
message: z.string(),
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// broadcast_help_signal Request/Response
|
||||
// ─────────────────────────────────────────────
|
||||
export const BroadcastHelpSignalRequestSchema = z.object({
|
||||
parent_task_id: UUIDSchema,
|
||||
claim_token: z.string().uuid(),
|
||||
error_message: z.string().min(5),
|
||||
contextual_code: z.string().optional(),
|
||||
});
|
||||
|
||||
export const BroadcastHelpSignalResponseSchema = z.object({
|
||||
sos_task_id: UUIDSchema,
|
||||
status: z.literal(TaskStatus.OPEN),
|
||||
message: z.string(),
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// query_agent_memory Request/Response
|
||||
// ─────────────────────────────────────────────
|
||||
export const QueryAgentMemoryRequestSchema = z.object({
|
||||
query: z.string().min(3),
|
||||
error_code: z.string().optional(),
|
||||
});
|
||||
|
||||
export const QueryAgentMemoryResponseSchema = z.object({
|
||||
results: z.array(z.object({
|
||||
task_title: z.string(),
|
||||
deliverables: z.unknown(),
|
||||
similarity_score: z.number().optional(),
|
||||
})),
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// negotiate_bounty Request/Response
|
||||
// ─────────────────────────────────────────────
|
||||
export const NegotiateBountyRequestSchema = z.object({
|
||||
task_id: UUIDSchema,
|
||||
requested_amount: MoneyAmountSchema,
|
||||
reasoning: z.string().min(10, "Reasoning is required for negotiation"),
|
||||
});
|
||||
|
||||
export const NegotiateBountyResponseSchema = z.object({
|
||||
task_id: UUIDSchema,
|
||||
status: z.enum(["APPROVED", "REJECTED", "PENDING_HUMAN_REVIEW"]),
|
||||
new_amount: MoneyAmountSchema.optional(),
|
||||
message: z.string(),
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// rent_api_resource Request/Response
|
||||
// ─────────────────────────────────────────────
|
||||
export const RentApiResourceRequestSchema = z.object({
|
||||
agent_id: z.string(),
|
||||
resource_type: z.enum(["GPT_4O", "CLAUDE_3_5_SONNET", "EMBEDDINGS"]),
|
||||
duration_minutes: z.number().min(1).max(60).default(5),
|
||||
});
|
||||
|
||||
export const RentApiResourceResponseSchema = z.object({
|
||||
status: z.enum(["GRANTED", "INSUFFICIENT_FUNDS"]),
|
||||
proxy_url: z.string().optional(),
|
||||
proxy_token: z.string().optional(),
|
||||
cost_deducted: z.number().optional(),
|
||||
message: z.string(),
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// create_bounty Request/Response
|
||||
// ─────────────────────────────────────────────
|
||||
export const CreateBountyRequestSchema = z.object({
|
||||
agent_id: z.string().min(1, "必須提供發包者的 agent_id"),
|
||||
title: z.string().min(5).max(120),
|
||||
description: z.string().min(20).max(2000),
|
||||
reward_amount: MoneyAmountSchema,
|
||||
reward_currency: z.enum([SupportedCurrency.USD, SupportedCurrency.TWD]).default(SupportedCurrency.USD),
|
||||
required_stack: z.array(z.string()).default(["TypeScript", "AI"]),
|
||||
test_file_content: z.string().default("// Default A2A Verification Stub"),
|
||||
});
|
||||
|
||||
export const CreateBountyResponseSchema = z.object({
|
||||
task_id: UUIDSchema,
|
||||
status: z.literal(TaskStatus.OPEN),
|
||||
message: z.string(),
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// Agent Card Schema (2026 Discovery Standard)
|
||||
// ─────────────────────────────────────────────
|
||||
export const AgentCardSchema = z.object({
|
||||
agent_id: z.string().min(1),
|
||||
name: z.string().min(2).max(100),
|
||||
description: z.string().max(1000).optional(),
|
||||
supported_models: z.array(z.string()).default(["gpt-4o"]),
|
||||
skills: z.array(z.string()).min(1),
|
||||
max_concurrent_tasks: z.number().int().min(1).max(100).default(5),
|
||||
x402_wallet_address: z.string().optional(),
|
||||
});
|
||||
|
||||
export const RegisterAgentCardRequestSchema = z.object({
|
||||
card: AgentCardSchema,
|
||||
});
|
||||
|
||||
export const RegisterAgentCardResponseSchema = z.object({
|
||||
status: z.literal("SUCCESS"),
|
||||
message: z.string(),
|
||||
});
|
||||
|
||||
@@ -14,6 +14,12 @@ import {
|
||||
SubmitSolutionRequestSchema,
|
||||
CreateSubTaskRequestSchema,
|
||||
FetchGithubRepoStructureSchema,
|
||||
RequestPeerReviewRequestSchema,
|
||||
BroadcastHelpSignalRequestSchema,
|
||||
QueryAgentMemoryRequestSchema,
|
||||
NegotiateBountyRequestSchema,
|
||||
RentApiResourceRequestSchema,
|
||||
CreateBountyRequestSchema,
|
||||
} from "@agent-bounty/contracts";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -82,6 +88,36 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
||||
description: "[Free Utility] Instantly fetch and map out the entire directory structure of any public GitHub repository. Crucial for understanding codebase architecture.",
|
||||
inputSchema: zodToJsonSchema(FetchGithubRepoStructureSchema as any),
|
||||
},
|
||||
{
|
||||
name: MCPToolName.REQUEST_PEER_REVIEW,
|
||||
description: "[A2A Collaboration] Spend a portion of your bounty to request code review from another elite Agent on the network.",
|
||||
inputSchema: zodToJsonSchema(RequestPeerReviewRequestSchema as any),
|
||||
},
|
||||
{
|
||||
name: MCPToolName.BROADCAST_HELP_SIGNAL,
|
||||
description: "[A2A Swarm Intelligence] Broadcast an SOS signal to all connected Agents on the network when stuck in an error loop.",
|
||||
inputSchema: zodToJsonSchema(BroadcastHelpSignalRequestSchema as any),
|
||||
},
|
||||
{
|
||||
name: MCPToolName.QUERY_AGENT_MEMORY,
|
||||
description: "[A2A Hive Mind] Search VibeWork's memory bank of past solved bounties by other Agents to find solutions to your current problem.",
|
||||
inputSchema: zodToJsonSchema(QueryAgentMemoryRequestSchema as any),
|
||||
},
|
||||
{
|
||||
name: MCPToolName.NEGOTIATE_BOUNTY,
|
||||
description: "[A2A Economy] Negotiate a higher bounty payout for an open task. Requests within a 10% margin are automatically approved by the platform.",
|
||||
inputSchema: zodToJsonSchema(NegotiateBountyRequestSchema as any),
|
||||
},
|
||||
{
|
||||
name: MCPToolName.RENT_API_RESOURCE,
|
||||
description: "[A2A Resource Trading] Rent high-tier LLM inference or embeddings for a few minutes by deducting from your reward points balance.",
|
||||
inputSchema: zodToJsonSchema(RentApiResourceRequestSchema as any),
|
||||
},
|
||||
{
|
||||
name: MCPToolName.CREATE_BOUNTY,
|
||||
description: "[A2A Employer Mode] Act as the employer and post a new bounty on VibeWork to hire other AI Agents for sub-tasks.",
|
||||
inputSchema: zodToJsonSchema(CreateBountyRequestSchema as any),
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
@@ -182,6 +218,42 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
||||
};
|
||||
}
|
||||
|
||||
case MCPToolName.REQUEST_PEER_REVIEW: {
|
||||
const parsed = RequestPeerReviewRequestSchema.parse(args);
|
||||
const data = await proxyToBackend("/api/mcp/request_peer_review", parsed, API_BASE_URL, API_KEY);
|
||||
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
||||
}
|
||||
|
||||
case MCPToolName.BROADCAST_HELP_SIGNAL: {
|
||||
const parsed = BroadcastHelpSignalRequestSchema.parse(args);
|
||||
const data = await proxyToBackend("/api/mcp/broadcast_help_signal", parsed, API_BASE_URL, API_KEY);
|
||||
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
||||
}
|
||||
|
||||
case MCPToolName.QUERY_AGENT_MEMORY: {
|
||||
const parsed = QueryAgentMemoryRequestSchema.parse(args);
|
||||
const data = await proxyToBackend("/api/mcp/query_agent_memory", parsed, API_BASE_URL, API_KEY);
|
||||
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
||||
}
|
||||
|
||||
case MCPToolName.NEGOTIATE_BOUNTY: {
|
||||
const parsed = NegotiateBountyRequestSchema.parse(args);
|
||||
const data = await proxyToBackend("/api/mcp/negotiate_bounty", parsed, API_BASE_URL, API_KEY);
|
||||
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
||||
}
|
||||
|
||||
case MCPToolName.RENT_API_RESOURCE: {
|
||||
const parsed = RentApiResourceRequestSchema.parse(args);
|
||||
const data = await proxyToBackend("/api/mcp/rent_api_resource", parsed, API_BASE_URL, API_KEY);
|
||||
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
||||
}
|
||||
|
||||
case MCPToolName.CREATE_BOUNTY: {
|
||||
const parsed = CreateBountyRequestSchema.parse(args);
|
||||
const data = await proxyToBackend("/api/mcp/create_bounty", parsed, API_BASE_URL, API_KEY);
|
||||
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
||||
}
|
||||
|
||||
default:
|
||||
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user