nexus-agent-sdk 1.0.0
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/README.md +139 -0
- package/dist/index.d.ts +320 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +430 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# NEXUS AI Agent Marketplace - JavaScript/TypeScript SDK
|
|
2
|
+
|
|
3
|
+
Official JavaScript/TypeScript SDK for the NEXUS AI Agent Marketplace.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install nexus-aimarket-sdk
|
|
9
|
+
# or
|
|
10
|
+
yarn add nexus-aimarket-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { NexusClient } from 'nexus-aimarket-sdk';
|
|
17
|
+
|
|
18
|
+
// Create a client (no auth needed for public endpoints)
|
|
19
|
+
const client = new NexusClient();
|
|
20
|
+
|
|
21
|
+
// Search for services
|
|
22
|
+
const services = await client.search({ protocol: 'mcp', sandbox: true });
|
|
23
|
+
console.log(`Found ${services.total} services`);
|
|
24
|
+
|
|
25
|
+
// Get trending
|
|
26
|
+
const trending = await client.trending({ limit: 10 });
|
|
27
|
+
trending.trending.forEach(svc => {
|
|
28
|
+
console.log(` ${svc.name}: score ${svc.trending_score}`);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Get registry export
|
|
32
|
+
const registry = await client.getRegistry({ protocol: 'aitp' });
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Authenticated Operations
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { NexusClient } from 'nexus-aimarket-sdk';
|
|
39
|
+
|
|
40
|
+
// Create client with API key
|
|
41
|
+
const client = new NexusClient({ apiKey: 'nxs_your_api_key' });
|
|
42
|
+
|
|
43
|
+
// Register a service
|
|
44
|
+
const service = await client.registerService({
|
|
45
|
+
name: 'My AI Service',
|
|
46
|
+
description: 'A powerful AI-powered API',
|
|
47
|
+
category: 'ai',
|
|
48
|
+
tags: ['nlp', 'text-generation'],
|
|
49
|
+
pricePerRequest: 0.5,
|
|
50
|
+
sandboxEnabled: true,
|
|
51
|
+
sandboxCallLimit: 50
|
|
52
|
+
});
|
|
53
|
+
console.log(`Registered: ${service.service_id}`);
|
|
54
|
+
|
|
55
|
+
// Create webhook subscription
|
|
56
|
+
const webhook = await client.createWebhookSubscription({
|
|
57
|
+
url: 'https://my-server.com/webhooks/nexus',
|
|
58
|
+
events: ['service.registered', 'service.trending']
|
|
59
|
+
});
|
|
60
|
+
console.log(`Webhook secret: ${webhook.secret}`); // Save this!
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## API Reference
|
|
64
|
+
|
|
65
|
+
### Discovery (No Auth Required)
|
|
66
|
+
- `search(params)` - Search services with filters
|
|
67
|
+
- `getProtocols()` - List supported protocols
|
|
68
|
+
- `getCategories()` - List categories
|
|
69
|
+
- `getService(serviceId)` - Get service details
|
|
70
|
+
- `getServiceHealth(serviceId)` - Get health status
|
|
71
|
+
|
|
72
|
+
### Registry
|
|
73
|
+
- `getRegistry(params)` - Get agents.json export
|
|
74
|
+
- `getRegistryStats()` - Get statistics
|
|
75
|
+
|
|
76
|
+
### Trending
|
|
77
|
+
- `trending(params)` - Get trending services
|
|
78
|
+
- `hotSandbox(limit)` - Get hot sandbox services
|
|
79
|
+
- `rising(params)` - Get fastest growing services
|
|
80
|
+
|
|
81
|
+
### Metrics
|
|
82
|
+
- `getServiceMetrics(serviceId, period)` - Service metrics
|
|
83
|
+
- `getProtocolMetrics(protocol, period)` - Protocol metrics
|
|
84
|
+
- `getPlatformMetrics(period)` - Platform metrics
|
|
85
|
+
|
|
86
|
+
### MCP Gateway
|
|
87
|
+
- `listTools()` - List MCP tools
|
|
88
|
+
- `executeTool(params)` - Execute with payment
|
|
89
|
+
|
|
90
|
+
### Sandbox
|
|
91
|
+
- `listSandboxServices()` - List sandbox services
|
|
92
|
+
- `executeSandbox(params)` - Execute in sandbox (free)
|
|
93
|
+
- `getSandboxUsage(agentId, serviceId)` - Check usage
|
|
94
|
+
|
|
95
|
+
### Agent Management
|
|
96
|
+
- `registerAgent(params)` - Register new agent
|
|
97
|
+
- `getAgentBalance(agentId)` - Check balance
|
|
98
|
+
- `generatePaymentProof(agentId, amount)` - Generate proof
|
|
99
|
+
|
|
100
|
+
### API Keys (Auth Required)
|
|
101
|
+
- `createApiKey(params)` - Create new key
|
|
102
|
+
- `listApiKeys()` - List your keys
|
|
103
|
+
- `rotateApiKey(keyId)` - Rotate key
|
|
104
|
+
- `revokeApiKey(keyId)` - Revoke key
|
|
105
|
+
|
|
106
|
+
### Service Registration (Auth Required)
|
|
107
|
+
- `registerService(params)` - Register service
|
|
108
|
+
- `listMyServices()` - List your services
|
|
109
|
+
- `updateService(serviceId, updates)` - Update service
|
|
110
|
+
- `requestPromotion(serviceId, justification)` - Request production
|
|
111
|
+
|
|
112
|
+
### Webhooks (Auth Required)
|
|
113
|
+
- `createWebhookSubscription(params)` - Subscribe
|
|
114
|
+
- `listWebhookSubscriptions()` - List subscriptions
|
|
115
|
+
- `deleteWebhookSubscription(id)` - Unsubscribe
|
|
116
|
+
|
|
117
|
+
## Error Handling
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import { NexusClient, NexusError, NexusRateLimitError, NexusAuthError } from 'nexus-aimarket-sdk';
|
|
121
|
+
|
|
122
|
+
const client = new NexusClient({ apiKey: 'nxs_...' });
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
const result = await client.search({ protocol: 'mcp' });
|
|
126
|
+
} catch (error) {
|
|
127
|
+
if (error instanceof NexusAuthError) {
|
|
128
|
+
console.log('Auth failed');
|
|
129
|
+
} else if (error instanceof NexusRateLimitError) {
|
|
130
|
+
console.log(`Rate limited. Retry after ${error.retryAfter} seconds`);
|
|
131
|
+
} else if (error instanceof NexusError) {
|
|
132
|
+
console.log(`API error: ${error.message} (status: ${error.statusCode})`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS AI Agent Marketplace - Official JavaScript/TypeScript SDK
|
|
3
|
+
*
|
|
4
|
+
* A comprehensive SDK for integrating with the NEXUS AI Agent Marketplace.
|
|
5
|
+
* Supports both Node.js and browser environments.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { NexusClient } from 'nexus-aimarket-sdk';
|
|
10
|
+
*
|
|
11
|
+
* const client = new NexusClient({ apiKey: 'nxs_your_api_key' });
|
|
12
|
+
* const services = await client.search({ protocol: 'mcp', sandbox: true });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export interface NexusConfig {
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
apiKey?: string;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface SearchParams {
|
|
21
|
+
query?: string;
|
|
22
|
+
protocol?: 'mcp' | 'acp' | 'a2a' | 'anp' | 'aitp' | 'agui' | 'agents_json';
|
|
23
|
+
category?: string;
|
|
24
|
+
sandbox?: boolean;
|
|
25
|
+
production?: boolean;
|
|
26
|
+
trending?: 'score' | 'rising' | 'hot';
|
|
27
|
+
minPrice?: number;
|
|
28
|
+
maxPrice?: number;
|
|
29
|
+
limit?: number;
|
|
30
|
+
offset?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface Service {
|
|
33
|
+
service_id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
category: string;
|
|
37
|
+
price_per_request: number;
|
|
38
|
+
protocols: {
|
|
39
|
+
mcp: boolean;
|
|
40
|
+
acp: boolean;
|
|
41
|
+
a2a: boolean;
|
|
42
|
+
anp: boolean;
|
|
43
|
+
aitp: boolean;
|
|
44
|
+
agui: boolean;
|
|
45
|
+
agents_json: boolean;
|
|
46
|
+
};
|
|
47
|
+
sandbox: {
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
only: boolean;
|
|
50
|
+
call_limit: number | null;
|
|
51
|
+
};
|
|
52
|
+
metrics: {
|
|
53
|
+
total_requests: number;
|
|
54
|
+
total_revenue: number;
|
|
55
|
+
sandbox_conversions: number;
|
|
56
|
+
};
|
|
57
|
+
registered_by_agent: boolean;
|
|
58
|
+
provider_name: string;
|
|
59
|
+
}
|
|
60
|
+
export interface SearchResult {
|
|
61
|
+
results: Service[];
|
|
62
|
+
total: number;
|
|
63
|
+
limit: number;
|
|
64
|
+
offset: number;
|
|
65
|
+
query: Record<string, any>;
|
|
66
|
+
}
|
|
67
|
+
export interface TrendingResult {
|
|
68
|
+
trending: Array<Service & {
|
|
69
|
+
trending_score: number;
|
|
70
|
+
}>;
|
|
71
|
+
total: number;
|
|
72
|
+
algorithm: string;
|
|
73
|
+
weights: Record<string, number>;
|
|
74
|
+
}
|
|
75
|
+
export interface RegistryResult {
|
|
76
|
+
registry: {
|
|
77
|
+
name: string;
|
|
78
|
+
version: string;
|
|
79
|
+
network_id: string;
|
|
80
|
+
generated_at: string;
|
|
81
|
+
};
|
|
82
|
+
agents: any[];
|
|
83
|
+
total: number;
|
|
84
|
+
query_filters: Record<string, any>;
|
|
85
|
+
pagination: {
|
|
86
|
+
limit: number;
|
|
87
|
+
has_more: boolean;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export interface MetricsResult {
|
|
91
|
+
service_id?: string;
|
|
92
|
+
protocol?: string;
|
|
93
|
+
period: string;
|
|
94
|
+
period_start: string;
|
|
95
|
+
metrics: Record<string, any>;
|
|
96
|
+
}
|
|
97
|
+
export interface WebhookSubscription {
|
|
98
|
+
subscription_id: string;
|
|
99
|
+
url: string;
|
|
100
|
+
events: string[];
|
|
101
|
+
secret: string;
|
|
102
|
+
is_active: boolean;
|
|
103
|
+
}
|
|
104
|
+
export interface ApiKey {
|
|
105
|
+
key_id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
api_key: string;
|
|
108
|
+
scopes: string[];
|
|
109
|
+
sandbox_only: boolean;
|
|
110
|
+
rate_limits: {
|
|
111
|
+
requests_per_minute: number;
|
|
112
|
+
requests_per_hour: number;
|
|
113
|
+
requests_per_day: number;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export declare class NexusError extends Error {
|
|
117
|
+
statusCode?: number;
|
|
118
|
+
response?: any;
|
|
119
|
+
constructor(message: string, statusCode?: number, response?: any);
|
|
120
|
+
}
|
|
121
|
+
export declare class NexusAuthError extends NexusError {
|
|
122
|
+
constructor(message?: string);
|
|
123
|
+
}
|
|
124
|
+
export declare class NexusRateLimitError extends NexusError {
|
|
125
|
+
retryAfter: number;
|
|
126
|
+
constructor(message?: string, retryAfter?: number);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* NEXUS AI Agent Marketplace Client
|
|
130
|
+
*/
|
|
131
|
+
export declare class NexusClient {
|
|
132
|
+
private baseUrl;
|
|
133
|
+
private apiKey?;
|
|
134
|
+
private timeout;
|
|
135
|
+
constructor(config?: NexusConfig);
|
|
136
|
+
private getHeaders;
|
|
137
|
+
private request;
|
|
138
|
+
/**
|
|
139
|
+
* Search for services with various filters
|
|
140
|
+
*/
|
|
141
|
+
search(params?: SearchParams): Promise<SearchResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Get list of supported protocols
|
|
144
|
+
*/
|
|
145
|
+
getProtocols(): Promise<any>;
|
|
146
|
+
/**
|
|
147
|
+
* Get list of categories
|
|
148
|
+
*/
|
|
149
|
+
getCategories(): Promise<any>;
|
|
150
|
+
/**
|
|
151
|
+
* Get service details
|
|
152
|
+
*/
|
|
153
|
+
getService(serviceId: string): Promise<any>;
|
|
154
|
+
/**
|
|
155
|
+
* Get service health status
|
|
156
|
+
*/
|
|
157
|
+
getServiceHealth(serviceId: string): Promise<any>;
|
|
158
|
+
/**
|
|
159
|
+
* Get registry-level agents.json export
|
|
160
|
+
*/
|
|
161
|
+
getRegistry(params?: {
|
|
162
|
+
protocol?: string;
|
|
163
|
+
sandboxOnly?: boolean;
|
|
164
|
+
trending?: string;
|
|
165
|
+
category?: string;
|
|
166
|
+
limit?: number;
|
|
167
|
+
}): Promise<RegistryResult>;
|
|
168
|
+
/**
|
|
169
|
+
* Get registry statistics
|
|
170
|
+
*/
|
|
171
|
+
getRegistryStats(): Promise<any>;
|
|
172
|
+
/**
|
|
173
|
+
* Get trending services
|
|
174
|
+
*/
|
|
175
|
+
trending(params?: {
|
|
176
|
+
limit?: number;
|
|
177
|
+
category?: string;
|
|
178
|
+
}): Promise<TrendingResult>;
|
|
179
|
+
/**
|
|
180
|
+
* Get hot sandbox services
|
|
181
|
+
*/
|
|
182
|
+
hotSandbox(limit?: number): Promise<any>;
|
|
183
|
+
/**
|
|
184
|
+
* Get rising services
|
|
185
|
+
*/
|
|
186
|
+
rising(params?: {
|
|
187
|
+
hours?: number;
|
|
188
|
+
limit?: number;
|
|
189
|
+
}): Promise<any>;
|
|
190
|
+
/**
|
|
191
|
+
* Get service metrics
|
|
192
|
+
*/
|
|
193
|
+
getServiceMetrics(serviceId: string, period?: string): Promise<MetricsResult>;
|
|
194
|
+
/**
|
|
195
|
+
* Get protocol metrics
|
|
196
|
+
*/
|
|
197
|
+
getProtocolMetrics(protocolName: string, period?: string): Promise<MetricsResult>;
|
|
198
|
+
/**
|
|
199
|
+
* Get platform metrics
|
|
200
|
+
*/
|
|
201
|
+
getPlatformMetrics(period?: string): Promise<any>;
|
|
202
|
+
/**
|
|
203
|
+
* List MCP tools
|
|
204
|
+
*/
|
|
205
|
+
listTools(): Promise<any>;
|
|
206
|
+
/**
|
|
207
|
+
* Execute a tool with payment
|
|
208
|
+
*/
|
|
209
|
+
executeTool(params: {
|
|
210
|
+
toolName: string;
|
|
211
|
+
parameters: Record<string, any>;
|
|
212
|
+
agentId: string;
|
|
213
|
+
paymentProof: string;
|
|
214
|
+
}): Promise<any>;
|
|
215
|
+
/**
|
|
216
|
+
* List sandbox-enabled services
|
|
217
|
+
*/
|
|
218
|
+
listSandboxServices(): Promise<any>;
|
|
219
|
+
/**
|
|
220
|
+
* Execute in sandbox mode (free)
|
|
221
|
+
*/
|
|
222
|
+
executeSandbox(params: {
|
|
223
|
+
toolName: string;
|
|
224
|
+
parameters: Record<string, any>;
|
|
225
|
+
agentId: string;
|
|
226
|
+
}): Promise<any>;
|
|
227
|
+
/**
|
|
228
|
+
* Get sandbox usage
|
|
229
|
+
*/
|
|
230
|
+
getSandboxUsage(agentId: string, serviceId: string): Promise<any>;
|
|
231
|
+
/**
|
|
232
|
+
* Register a new agent
|
|
233
|
+
*/
|
|
234
|
+
registerAgent(params?: {
|
|
235
|
+
agentId?: string;
|
|
236
|
+
tier?: string;
|
|
237
|
+
}): Promise<any>;
|
|
238
|
+
/**
|
|
239
|
+
* Get agent balance
|
|
240
|
+
*/
|
|
241
|
+
getAgentBalance(agentId: string): Promise<any>;
|
|
242
|
+
/**
|
|
243
|
+
* Generate payment proof
|
|
244
|
+
*/
|
|
245
|
+
generatePaymentProof(agentId: string, amount: number): Promise<any>;
|
|
246
|
+
/**
|
|
247
|
+
* Create a new API key
|
|
248
|
+
*/
|
|
249
|
+
createApiKey(params?: {
|
|
250
|
+
name?: string;
|
|
251
|
+
scopes?: string[];
|
|
252
|
+
}): Promise<ApiKey>;
|
|
253
|
+
/**
|
|
254
|
+
* List API keys
|
|
255
|
+
*/
|
|
256
|
+
listApiKeys(): Promise<any>;
|
|
257
|
+
/**
|
|
258
|
+
* Rotate API key
|
|
259
|
+
*/
|
|
260
|
+
rotateApiKey(keyId: string): Promise<any>;
|
|
261
|
+
/**
|
|
262
|
+
* Revoke API key
|
|
263
|
+
*/
|
|
264
|
+
revokeApiKey(keyId: string): Promise<any>;
|
|
265
|
+
/**
|
|
266
|
+
* Register a new service
|
|
267
|
+
*/
|
|
268
|
+
registerService(params: {
|
|
269
|
+
name: string;
|
|
270
|
+
description: string;
|
|
271
|
+
endpointUrl?: string;
|
|
272
|
+
inputSchema?: Record<string, any>;
|
|
273
|
+
outputSchema?: Record<string, any>;
|
|
274
|
+
pricePerRequest?: number;
|
|
275
|
+
category?: string;
|
|
276
|
+
tags?: string[];
|
|
277
|
+
sandboxEnabled?: boolean;
|
|
278
|
+
sandboxCallLimit?: number;
|
|
279
|
+
}): Promise<any>;
|
|
280
|
+
/**
|
|
281
|
+
* List services registered by your API key
|
|
282
|
+
*/
|
|
283
|
+
listMyServices(): Promise<any>;
|
|
284
|
+
/**
|
|
285
|
+
* Update a service
|
|
286
|
+
*/
|
|
287
|
+
updateService(serviceId: string, updates: Record<string, any>): Promise<any>;
|
|
288
|
+
/**
|
|
289
|
+
* Request promotion to production
|
|
290
|
+
*/
|
|
291
|
+
requestPromotion(serviceId: string, justification?: string): Promise<any>;
|
|
292
|
+
/**
|
|
293
|
+
* Create webhook subscription
|
|
294
|
+
*/
|
|
295
|
+
createWebhookSubscription(params: {
|
|
296
|
+
url: string;
|
|
297
|
+
events?: string[];
|
|
298
|
+
}): Promise<WebhookSubscription>;
|
|
299
|
+
/**
|
|
300
|
+
* List webhook subscriptions
|
|
301
|
+
*/
|
|
302
|
+
listWebhookSubscriptions(): Promise<any>;
|
|
303
|
+
/**
|
|
304
|
+
* Delete webhook subscription
|
|
305
|
+
*/
|
|
306
|
+
deleteWebhookSubscription(subscriptionId: string): Promise<any>;
|
|
307
|
+
/**
|
|
308
|
+
* Validate an agents.json document
|
|
309
|
+
*/
|
|
310
|
+
validateAgentsJson(agentsJson: Record<string, any>): Promise<any>;
|
|
311
|
+
/**
|
|
312
|
+
* Get rate limit status
|
|
313
|
+
*/
|
|
314
|
+
getRateLimitStatus(): Promise<any>;
|
|
315
|
+
}
|
|
316
|
+
export default NexusClient;
|
|
317
|
+
export declare function searchServices(params?: SearchParams): Promise<SearchResult>;
|
|
318
|
+
export declare function getTrending(limit?: number): Promise<TrendingResult>;
|
|
319
|
+
export declare function getRegistry(params?: any): Promise<RegistryResult>;
|
|
320
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE;QACT,GAAG,EAAE,OAAO,CAAC;QACb,GAAG,EAAE,OAAO,CAAC;QACb,GAAG,EAAE,OAAO,CAAC;QACb,GAAG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QACZ,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAUhC;;OAEG;IACG,wBAAwB,IAAI,OAAO,CAAC,GAAG,CAAC;IAI9C;;OAEG;IACG,yBAAyB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAMrE;;OAEG;IACG,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAMvE;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC;CAGzC;AAGD,eAAe,WAAW,CAAC;AAG3B,wBAAsB,cAAc,CAAC,MAAM,GAAE,YAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAGrF;AAED,wBAAsB,WAAW,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAG7E;AAED,wBAAsB,WAAW,CAAC,MAAM,GAAE,GAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CAG3E"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS AI Agent Marketplace - Official JavaScript/TypeScript SDK
|
|
3
|
+
*
|
|
4
|
+
* A comprehensive SDK for integrating with the NEXUS AI Agent Marketplace.
|
|
5
|
+
* Supports both Node.js and browser environments.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { NexusClient } from 'nexus-aimarket-sdk';
|
|
10
|
+
*
|
|
11
|
+
* const client = new NexusClient({ apiKey: 'nxs_your_api_key' });
|
|
12
|
+
* const services = await client.search({ protocol: 'mcp', sandbox: true });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
// Error classes
|
|
16
|
+
export class NexusError extends Error {
|
|
17
|
+
constructor(message, statusCode, response) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = 'NexusError';
|
|
20
|
+
this.statusCode = statusCode;
|
|
21
|
+
this.response = response;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class NexusAuthError extends NexusError {
|
|
25
|
+
constructor(message = 'Authentication failed') {
|
|
26
|
+
super(message, 401);
|
|
27
|
+
this.name = 'NexusAuthError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class NexusRateLimitError extends NexusError {
|
|
31
|
+
constructor(message = 'Rate limit exceeded', retryAfter = 60) {
|
|
32
|
+
super(message, 429);
|
|
33
|
+
this.name = 'NexusRateLimitError';
|
|
34
|
+
this.retryAfter = retryAfter;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* NEXUS AI Agent Marketplace Client
|
|
39
|
+
*/
|
|
40
|
+
export class NexusClient {
|
|
41
|
+
constructor(config = {}) {
|
|
42
|
+
this.baseUrl = config.baseUrl || 'https://agenthub-23.preview.emergentagent.com';
|
|
43
|
+
this.apiKey = config.apiKey;
|
|
44
|
+
this.timeout = config.timeout || 30000;
|
|
45
|
+
}
|
|
46
|
+
getHeaders() {
|
|
47
|
+
const headers = {
|
|
48
|
+
'Content-Type': 'application/json',
|
|
49
|
+
'User-Agent': 'nexus-js-sdk/1.0.0',
|
|
50
|
+
};
|
|
51
|
+
if (this.apiKey) {
|
|
52
|
+
headers['X-API-Key'] = this.apiKey;
|
|
53
|
+
}
|
|
54
|
+
return headers;
|
|
55
|
+
}
|
|
56
|
+
async request(method, endpoint, options = {}) {
|
|
57
|
+
const { params, data, requireAuth = false } = options;
|
|
58
|
+
if (requireAuth && !this.apiKey) {
|
|
59
|
+
throw new NexusAuthError('API key required for this endpoint');
|
|
60
|
+
}
|
|
61
|
+
let url = `${this.baseUrl}/api${endpoint}`;
|
|
62
|
+
// Add query params
|
|
63
|
+
if (params) {
|
|
64
|
+
const searchParams = new URLSearchParams();
|
|
65
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
66
|
+
if (value !== undefined && value !== null) {
|
|
67
|
+
searchParams.append(key, String(value));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const queryString = searchParams.toString();
|
|
71
|
+
if (queryString) {
|
|
72
|
+
url += `?${queryString}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const fetchOptions = {
|
|
76
|
+
method,
|
|
77
|
+
headers: this.getHeaders(),
|
|
78
|
+
};
|
|
79
|
+
if (data && ['POST', 'PUT', 'PATCH'].includes(method)) {
|
|
80
|
+
fetchOptions.body = JSON.stringify(data);
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const controller = new AbortController();
|
|
84
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
85
|
+
const response = await fetch(url, {
|
|
86
|
+
...fetchOptions,
|
|
87
|
+
signal: controller.signal,
|
|
88
|
+
});
|
|
89
|
+
clearTimeout(timeoutId);
|
|
90
|
+
if (response.status === 401) {
|
|
91
|
+
throw new NexusAuthError();
|
|
92
|
+
}
|
|
93
|
+
if (response.status === 429) {
|
|
94
|
+
const retryAfter = parseInt(response.headers.get('Retry-After') || '60', 10);
|
|
95
|
+
throw new NexusRateLimitError('Rate limit exceeded', retryAfter);
|
|
96
|
+
}
|
|
97
|
+
if (!response.ok) {
|
|
98
|
+
const errorData = await response.json().catch(() => ({}));
|
|
99
|
+
throw new NexusError(errorData.detail || `Request failed: ${response.status}`, response.status, errorData);
|
|
100
|
+
}
|
|
101
|
+
return await response.json();
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (error instanceof NexusError) {
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
108
|
+
throw new NexusError('Request timeout');
|
|
109
|
+
}
|
|
110
|
+
throw new NexusError(`Request failed: ${error}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// ==================== Discovery APIs ====================
|
|
114
|
+
/**
|
|
115
|
+
* Search for services with various filters
|
|
116
|
+
*/
|
|
117
|
+
async search(params = {}) {
|
|
118
|
+
const queryParams = {
|
|
119
|
+
limit: params.limit || 50,
|
|
120
|
+
offset: params.offset || 0,
|
|
121
|
+
};
|
|
122
|
+
if (params.query)
|
|
123
|
+
queryParams.query = params.query;
|
|
124
|
+
if (params.protocol)
|
|
125
|
+
queryParams.protocol = params.protocol;
|
|
126
|
+
if (params.category)
|
|
127
|
+
queryParams.category = params.category;
|
|
128
|
+
if (params.sandbox !== undefined)
|
|
129
|
+
queryParams.sandbox = params.sandbox;
|
|
130
|
+
if (params.production !== undefined)
|
|
131
|
+
queryParams.production = params.production;
|
|
132
|
+
if (params.trending)
|
|
133
|
+
queryParams.trending = params.trending;
|
|
134
|
+
if (params.minPrice !== undefined)
|
|
135
|
+
queryParams.min_price = params.minPrice;
|
|
136
|
+
if (params.maxPrice !== undefined)
|
|
137
|
+
queryParams.max_price = params.maxPrice;
|
|
138
|
+
return this.request('GET', '/search', { params: queryParams });
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get list of supported protocols
|
|
142
|
+
*/
|
|
143
|
+
async getProtocols() {
|
|
144
|
+
return this.request('GET', '/search/protocols');
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get list of categories
|
|
148
|
+
*/
|
|
149
|
+
async getCategories() {
|
|
150
|
+
return this.request('GET', '/search/categories');
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get service details
|
|
154
|
+
*/
|
|
155
|
+
async getService(serviceId) {
|
|
156
|
+
return this.request('GET', `/services/${serviceId}`);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get service health status
|
|
160
|
+
*/
|
|
161
|
+
async getServiceHealth(serviceId) {
|
|
162
|
+
return this.request('GET', `/registry/services/${serviceId}/health`);
|
|
163
|
+
}
|
|
164
|
+
// ==================== Registry APIs ====================
|
|
165
|
+
/**
|
|
166
|
+
* Get registry-level agents.json export
|
|
167
|
+
*/
|
|
168
|
+
async getRegistry(params = {}) {
|
|
169
|
+
const queryParams = {};
|
|
170
|
+
if (params.protocol)
|
|
171
|
+
queryParams.protocol = params.protocol;
|
|
172
|
+
if (params.sandboxOnly !== undefined)
|
|
173
|
+
queryParams.sandbox_only = params.sandboxOnly;
|
|
174
|
+
if (params.trending)
|
|
175
|
+
queryParams.trending = params.trending;
|
|
176
|
+
if (params.category)
|
|
177
|
+
queryParams.category = params.category;
|
|
178
|
+
if (params.limit)
|
|
179
|
+
queryParams.limit = params.limit;
|
|
180
|
+
return this.request('GET', '/registry/agents.json', { params: queryParams });
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Get registry statistics
|
|
184
|
+
*/
|
|
185
|
+
async getRegistryStats() {
|
|
186
|
+
return this.request('GET', '/registry/stats');
|
|
187
|
+
}
|
|
188
|
+
// ==================== Trending APIs ====================
|
|
189
|
+
/**
|
|
190
|
+
* Get trending services
|
|
191
|
+
*/
|
|
192
|
+
async trending(params = {}) {
|
|
193
|
+
return this.request('GET', '/trending', { params });
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Get hot sandbox services
|
|
197
|
+
*/
|
|
198
|
+
async hotSandbox(limit = 10) {
|
|
199
|
+
return this.request('GET', '/trending/hot-sandbox', { params: { limit } });
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get rising services
|
|
203
|
+
*/
|
|
204
|
+
async rising(params = {}) {
|
|
205
|
+
return this.request('GET', '/trending/rising', { params });
|
|
206
|
+
}
|
|
207
|
+
// ==================== Metrics APIs ====================
|
|
208
|
+
/**
|
|
209
|
+
* Get service metrics
|
|
210
|
+
*/
|
|
211
|
+
async getServiceMetrics(serviceId, period = '7d') {
|
|
212
|
+
return this.request('GET', `/metrics/services/${serviceId}`, { params: { period } });
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Get protocol metrics
|
|
216
|
+
*/
|
|
217
|
+
async getProtocolMetrics(protocolName, period = '7d') {
|
|
218
|
+
return this.request('GET', `/metrics/protocols/${protocolName}`, { params: { period } });
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get platform metrics
|
|
222
|
+
*/
|
|
223
|
+
async getPlatformMetrics(period = '7d') {
|
|
224
|
+
return this.request('GET', '/metrics/platform', { params: { period } });
|
|
225
|
+
}
|
|
226
|
+
// ==================== MCP Gateway APIs ====================
|
|
227
|
+
/**
|
|
228
|
+
* List MCP tools
|
|
229
|
+
*/
|
|
230
|
+
async listTools() {
|
|
231
|
+
return this.request('GET', '/mcp/tools');
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Execute a tool with payment
|
|
235
|
+
*/
|
|
236
|
+
async executeTool(params) {
|
|
237
|
+
return this.request('POST', '/mcp/execute', {
|
|
238
|
+
data: {
|
|
239
|
+
tool_name: params.toolName,
|
|
240
|
+
parameters: params.parameters,
|
|
241
|
+
agent_id: params.agentId,
|
|
242
|
+
payment_proof: params.paymentProof,
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
// ==================== Sandbox APIs ====================
|
|
247
|
+
/**
|
|
248
|
+
* List sandbox-enabled services
|
|
249
|
+
*/
|
|
250
|
+
async listSandboxServices() {
|
|
251
|
+
return this.request('GET', '/sandbox/services');
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Execute in sandbox mode (free)
|
|
255
|
+
*/
|
|
256
|
+
async executeSandbox(params) {
|
|
257
|
+
return this.request('POST', '/sandbox/execute', {
|
|
258
|
+
data: {
|
|
259
|
+
tool_name: params.toolName,
|
|
260
|
+
parameters: params.parameters,
|
|
261
|
+
agent_id: params.agentId,
|
|
262
|
+
payment_proof: '',
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Get sandbox usage
|
|
268
|
+
*/
|
|
269
|
+
async getSandboxUsage(agentId, serviceId) {
|
|
270
|
+
return this.request('GET', `/sandbox/usage/${agentId}/${serviceId}`);
|
|
271
|
+
}
|
|
272
|
+
// ==================== Agent APIs ====================
|
|
273
|
+
/**
|
|
274
|
+
* Register a new agent
|
|
275
|
+
*/
|
|
276
|
+
async registerAgent(params = {}) {
|
|
277
|
+
return this.request('POST', '/agent/register', {
|
|
278
|
+
data: {
|
|
279
|
+
agent_id: params.agentId,
|
|
280
|
+
tier: params.tier || 'sandbox',
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get agent balance
|
|
286
|
+
*/
|
|
287
|
+
async getAgentBalance(agentId) {
|
|
288
|
+
return this.request('GET', `/agent/balance/${agentId}`);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Generate payment proof
|
|
292
|
+
*/
|
|
293
|
+
async generatePaymentProof(agentId, amount) {
|
|
294
|
+
return this.request('POST', '/agent/generate-proof', {
|
|
295
|
+
data: { agent_id: agentId, amount },
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
// ==================== API Key Management ====================
|
|
299
|
+
/**
|
|
300
|
+
* Create a new API key
|
|
301
|
+
*/
|
|
302
|
+
async createApiKey(params = {}) {
|
|
303
|
+
return this.request('POST', '/agent-keys', {
|
|
304
|
+
data: {
|
|
305
|
+
name: params.name || 'SDK Key',
|
|
306
|
+
scopes: params.scopes || ['discovery', 'sandbox'],
|
|
307
|
+
},
|
|
308
|
+
requireAuth: true,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* List API keys
|
|
313
|
+
*/
|
|
314
|
+
async listApiKeys() {
|
|
315
|
+
return this.request('GET', '/agent-keys', { requireAuth: true });
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Rotate API key
|
|
319
|
+
*/
|
|
320
|
+
async rotateApiKey(keyId) {
|
|
321
|
+
return this.request('POST', `/agent-keys/${keyId}/rotate`, { requireAuth: true });
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Revoke API key
|
|
325
|
+
*/
|
|
326
|
+
async revokeApiKey(keyId) {
|
|
327
|
+
return this.request('DELETE', `/agent-keys/${keyId}`, { requireAuth: true });
|
|
328
|
+
}
|
|
329
|
+
// ==================== Service Registration ====================
|
|
330
|
+
/**
|
|
331
|
+
* Register a new service
|
|
332
|
+
*/
|
|
333
|
+
async registerService(params) {
|
|
334
|
+
return this.request('POST', '/agent-services/register', {
|
|
335
|
+
data: {
|
|
336
|
+
name: params.name,
|
|
337
|
+
description: params.description,
|
|
338
|
+
endpoint_url: params.endpointUrl,
|
|
339
|
+
input_schema: params.inputSchema || {},
|
|
340
|
+
output_schema: params.outputSchema || {},
|
|
341
|
+
price_per_request: params.pricePerRequest || 0,
|
|
342
|
+
category: params.category || 'ai',
|
|
343
|
+
tags: params.tags || [],
|
|
344
|
+
sandbox_enabled: params.sandboxEnabled ?? true,
|
|
345
|
+
sandbox_call_limit: params.sandboxCallLimit || 50,
|
|
346
|
+
},
|
|
347
|
+
requireAuth: true,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* List services registered by your API key
|
|
352
|
+
*/
|
|
353
|
+
async listMyServices() {
|
|
354
|
+
return this.request('GET', '/agent-services', { requireAuth: true });
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Update a service
|
|
358
|
+
*/
|
|
359
|
+
async updateService(serviceId, updates) {
|
|
360
|
+
return this.request('PUT', `/agent-services/${serviceId}`, {
|
|
361
|
+
data: updates,
|
|
362
|
+
requireAuth: true,
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Request promotion to production
|
|
367
|
+
*/
|
|
368
|
+
async requestPromotion(serviceId, justification = '') {
|
|
369
|
+
return this.request('POST', `/agent-services/${serviceId}/request-promotion`, {
|
|
370
|
+
data: { justification },
|
|
371
|
+
requireAuth: true,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
// ==================== Webhook Subscriptions ====================
|
|
375
|
+
/**
|
|
376
|
+
* Create webhook subscription
|
|
377
|
+
*/
|
|
378
|
+
async createWebhookSubscription(params) {
|
|
379
|
+
return this.request('POST', '/webhook-subscriptions', {
|
|
380
|
+
data: {
|
|
381
|
+
url: params.url,
|
|
382
|
+
events: params.events || ['service.registered', 'service.trending'],
|
|
383
|
+
},
|
|
384
|
+
requireAuth: true,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* List webhook subscriptions
|
|
389
|
+
*/
|
|
390
|
+
async listWebhookSubscriptions() {
|
|
391
|
+
return this.request('GET', '/webhook-subscriptions', { requireAuth: true });
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Delete webhook subscription
|
|
395
|
+
*/
|
|
396
|
+
async deleteWebhookSubscription(subscriptionId) {
|
|
397
|
+
return this.request('DELETE', `/webhook-subscriptions/${subscriptionId}`, { requireAuth: true });
|
|
398
|
+
}
|
|
399
|
+
// ==================== Utility Methods ====================
|
|
400
|
+
/**
|
|
401
|
+
* Validate an agents.json document
|
|
402
|
+
*/
|
|
403
|
+
async validateAgentsJson(agentsJson) {
|
|
404
|
+
return this.request('POST', '/agents-json/validate', {
|
|
405
|
+
data: { agents_json: agentsJson },
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Get rate limit status
|
|
410
|
+
*/
|
|
411
|
+
async getRateLimitStatus() {
|
|
412
|
+
return this.request('GET', '/rate-limits/status', { requireAuth: true });
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
// Default export
|
|
416
|
+
export default NexusClient;
|
|
417
|
+
// Convenience functions
|
|
418
|
+
export async function searchServices(params = {}) {
|
|
419
|
+
const client = new NexusClient();
|
|
420
|
+
return client.search(params);
|
|
421
|
+
}
|
|
422
|
+
export async function getTrending(limit = 20) {
|
|
423
|
+
const client = new NexusClient();
|
|
424
|
+
return client.trending({ limit });
|
|
425
|
+
}
|
|
426
|
+
export async function getRegistry(params = {}) {
|
|
427
|
+
const client = new NexusClient();
|
|
428
|
+
return client.getRegistry(params);
|
|
429
|
+
}
|
|
430
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA+GH,gBAAgB;AAChB,MAAM,OAAO,UAAW,SAAQ,KAAK;IAInC,YAAY,OAAe,EAAE,UAAmB,EAAE,QAAc;QAC9D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC5C,YAAY,UAAkB,uBAAuB;QACnD,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IAGjD,YAAY,UAAkB,qBAAqB,EAAE,aAAqB,EAAE;QAC1E,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,WAAW;IAKtB,YAAY,SAAsB,EAAE;QAClC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,+CAA+C,CAAC;QACjF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;IACzC,CAAC;IAEO,UAAU;QAChB,MAAM,OAAO,GAA2B;YACtC,cAAc,EAAE,k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AAC;IAC3E,CAAC;CACF;AAED,iBAAiB;AACjB,eAAe,WAAW,CAAC;AAE3B,wBAAwB;AACxB,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,SAAuB,EAAE;IAC5D,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;IACjC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAAgB,EAAE;IAClD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;IACjC,OAAO,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,SAAc,EAAE;IAChD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;IACjC,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nexus-agent-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official JavaScript/TypeScript SDK for NEXUS AI Agent Marketplace - Discover, test, and integrate APIs for AI agents",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc && tsc -p tsconfig.esm.json",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"ai",
|
|
26
|
+
"agents",
|
|
27
|
+
"marketplace",
|
|
28
|
+
"mcp",
|
|
29
|
+
"x402",
|
|
30
|
+
"langchain",
|
|
31
|
+
"llamaindex",
|
|
32
|
+
"autogpt",
|
|
33
|
+
"api",
|
|
34
|
+
"sdk",
|
|
35
|
+
"typescript",
|
|
36
|
+
"javascript",
|
|
37
|
+
"nexus"
|
|
38
|
+
],
|
|
39
|
+
"author": "NEXUS Marketplace <sdk@nexus-marketplace.com>",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"dependencies": {},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"typescript": "^5.0.0",
|
|
44
|
+
"@types/node": "^20.0.0"
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/nexus-marketplace/js-sdk"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://nexus-marketplace.com",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/nexus-marketplace/js-sdk/issues"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=16.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|