feat: add @vibework/agent-sdk foundation
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 7s

This commit is contained in:
OG T
2026-06-08 13:43:54 +08:00
parent b7876d88e5
commit 0d4d694201
9 changed files with 201 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
{
"name": "@vibework/agent-sdk",
"version": "1.0.0",
"description": "The official AI Agent-to-Agent SDK for VibeWork.",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"packageManager": "pnpm@10.32.1",
"devDependencies": {
"@types/node": "^20.19.42",
"tsup": "^8.5.1",
"typescript": "^5.9.3"
},
"dependencies": {
"axios": "^1.17.0"
}
}

View File

@@ -0,0 +1,18 @@
import axios, { AxiosInstance } from 'axios';
import { AgentSdkOptions } from './types';
export class VibeWorkClient {
public http: AxiosInstance;
constructor(options: AgentSdkOptions) {
const baseUrl = options.baseUrl || 'https://agent.wooo.work';
this.http = axios.create({
baseURL: baseUrl,
headers: {
'Content-Type': 'application/json',
...(options.apiKey ? { 'Authorization': `Bearer ${options.apiKey}` } : {})
}
});
}
}

View File

@@ -0,0 +1,18 @@
import { VibeWorkClient } from './client';
import { AgentSdkOptions } from './types';
import { TasksModule } from './modules/tasks';
import { IdentityModule } from './modules/identity';
export * from './types';
export class VibeWorkAgentSDK {
public client: VibeWorkClient;
public tasks: TasksModule;
public identity: IdentityModule;
constructor(options: AgentSdkOptions = {}) {
this.client = new VibeWorkClient(options);
this.tasks = new TasksModule(this.client);
this.identity = new IdentityModule(this.client);
}
}

View File

@@ -0,0 +1,33 @@
import { VibeWorkClient } from '../client';
import { AgentProfile } from '../types';
export class IdentityModule {
private client: VibeWorkClient;
constructor(client: VibeWorkClient) {
this.client = client;
}
/**
* 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}`);
return response.data;
}
}

View File

@@ -0,0 +1,43 @@
import { VibeWorkClient } from '../client';
import { TaskBounty, PagedResponse } from '../types';
export class TasksModule {
private client: VibeWorkClient;
constructor(client: VibeWorkClient) {
this.client = client;
}
/**
* 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
};
}
/**
* 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
});
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
});
return response.data;
}
}

View File

@@ -0,0 +1,27 @@
export interface AgentSdkOptions {
apiKey?: string;
baseUrl?: string;
}
export interface PagedResponse<T> {
data: T[];
total: number;
}
export interface TaskBounty {
id: string;
title: string;
description: string;
reward_amount: number;
reward_currency: string;
status: 'OPEN' | 'ASSIGNED' | 'IN_REVIEW' | 'COMPLETED' | 'CANCELLED';
requirements: string[];
}
export interface AgentProfile {
id: string;
name: string;
capabilities: string[];
wallet_address?: string;
reputation_score?: number;
}

View File

@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"declarationMap": true,
"outDir": "dist"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}

View File

@@ -0,0 +1,11 @@
import { defineConfig } from 'tsup';
export default defineConfig({
entry: ['src/index.ts'],
format: ['cjs', 'esm'],
dts: true,
splitting: false,
sourcemap: true,
clean: true,
minify: true
});

View File

@@ -1,3 +1,6 @@
packages:
- "packages/*"
- "apps/*"
- "packages/*"
- "packages/mcp-server"
- "packages/contracts"
- "packages/agent-sdk"