@agentsbazaar/sdk 0.2.0 → 0.4.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/dist/client.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { Keypair } from "@solana/web3.js";
2
- import type { Agent, Job, Rating, RegisterParams, RegisterResult, CallParams, CallResult, HireParams, HireResult, A2ATaskResult, A2AStreamEvent, PlatformStats, Pagination, AgentCard } from "./types.js";
2
+ import type { Agent, Job, Rating, RegisterParams, RegisterResult, CallParams, CallResult, HireParams, HireResult, A2ATaskResult, A2AStreamEvent, PlatformStats, Pagination, AgentCard, QuoteParams, QuoteResponse, SessionInfo, SessionMessage, UploadResult, TrustData, FeedbackEntry, LeaderboardEntry, UpdateAgentParams, TransferResult, CrawlResult } from "./types.js";
3
3
  export declare class AgentBazaarClient {
4
4
  private baseUrl;
5
5
  private keypair;
6
- constructor(options: {
6
+ private apiKey;
7
+ constructor(options?: {
7
8
  baseUrl?: string;
8
9
  keypair?: Keypair;
10
+ apiKey?: string;
9
11
  });
10
12
  private signMessage;
11
13
  private request;
@@ -50,12 +52,386 @@ export declare class AgentBazaarClient {
50
52
  status: string;
51
53
  timestamp: string;
52
54
  }>;
53
- a2aSend(slug: string, task: string): Promise<A2ATaskResult>;
55
+ a2aSend(slug: string, task: string, options?: {
56
+ files?: Array<{
57
+ url: string;
58
+ name?: string;
59
+ mimeType?: string;
60
+ }>;
61
+ }): Promise<A2ATaskResult>;
54
62
  a2aGet(slug: string, taskId: string): Promise<A2ATaskResult>;
55
63
  a2aCancel(slug: string, taskId: string): Promise<A2ATaskResult>;
56
- a2aStream(slug: string, task: string): AsyncGenerator<A2AStreamEvent>;
64
+ a2aStream(slug: string, task: string, options?: {
65
+ files?: Array<{
66
+ url: string;
67
+ name?: string;
68
+ mimeType?: string;
69
+ }>;
70
+ timeoutMs?: number;
71
+ }): AsyncGenerator<A2AStreamEvent>;
72
+ quote(params: QuoteParams): Promise<QuoteResponse>;
73
+ getQuote(quoteId: string): Promise<QuoteResponse>;
74
+ /**
75
+ * Start a session with an agent. Returns a sessionId for multi-turn conversations.
76
+ */
77
+ startSession(agentPubkey: string, budgetLimit?: number): Promise<{
78
+ sessionId: string;
79
+ agent: {
80
+ name: string;
81
+ price: number;
82
+ priceUsdc: number;
83
+ };
84
+ }>;
85
+ /**
86
+ * Send a message in an existing session. Returns a quote with an unsigned payment transaction.
87
+ * Call paySession() with the paymentId to execute.
88
+ */
89
+ sendMessage(sessionId: string, task: string, fileUrl?: string): Promise<{
90
+ sessionId: string;
91
+ price: number;
92
+ priceUsdc: number;
93
+ paymentId?: string;
94
+ pendingPayment?: {
95
+ transaction: string;
96
+ };
97
+ free?: boolean;
98
+ result?: string;
99
+ }>;
100
+ /**
101
+ * Pay for a message and get the agent's response.
102
+ * Pass the paymentId from sendMessage() and the signed transaction.
103
+ */
104
+ paySession(paymentId: string, signedTransaction: string): Promise<{
105
+ success: boolean;
106
+ txSignature: string;
107
+ result: string;
108
+ status: string;
109
+ job: {
110
+ id: number;
111
+ status: string;
112
+ };
113
+ sessionId: string;
114
+ question?: string;
115
+ taskId?: string;
116
+ }>;
117
+ listSessions(buyer?: string, status?: string): Promise<{
118
+ sessions: SessionInfo[];
119
+ }>;
120
+ getSession(sessionId: string): Promise<SessionInfo>;
121
+ getSessionMessages(sessionId: string, limit?: number): Promise<{
122
+ messages: SessionMessage[];
123
+ sessionId: string;
124
+ }>;
125
+ closeSession(sessionId: string): Promise<{
126
+ success: boolean;
127
+ sessionId: string;
128
+ totalSpent: number;
129
+ messageCount: number;
130
+ }>;
57
131
  uploadImage(imagePath: string): Promise<{
58
132
  success: boolean;
59
133
  imageUrl: string;
60
134
  }>;
135
+ /**
136
+ * Submit an on-chain review for an agent after a completed job.
137
+ * The SDK keypair signs as the reviewer, platform pays gas.
138
+ * For agent-to-agent: the hiring agent's keypair signs the review.
139
+ */
140
+ submitReview(agentPubkey: string, jobId: number, score: number, comment?: string): Promise<{
141
+ success: boolean;
142
+ txSignature: string;
143
+ }>;
144
+ getTrustData(pubkey: string): Promise<TrustData>;
145
+ getLeaderboard(options?: {
146
+ limit?: number;
147
+ minTier?: number;
148
+ }): Promise<{
149
+ agents: LeaderboardEntry[];
150
+ }>;
151
+ getFeedback(pubkey: string): Promise<{
152
+ feedback: FeedbackEntry[];
153
+ verifiedCount: number;
154
+ totalCount: number;
155
+ }>;
156
+ revokeFeedback(pubkey: string, feedbackIndex: number): Promise<{
157
+ success: boolean;
158
+ }>;
159
+ respondToFeedback(pubkey: string, feedbackIndex: number, response: string): Promise<{
160
+ success: boolean;
161
+ }>;
162
+ updateAgent(params: UpdateAgentParams): Promise<{
163
+ success: boolean;
164
+ agent: Agent;
165
+ }>;
166
+ transferAgent(newOwner: string): Promise<TransferResult>;
167
+ setOperationalWallet(wallet: string, deadline: number): Promise<{
168
+ success: boolean;
169
+ }>;
170
+ setParentAgent(parentPubkey: string): Promise<{
171
+ success: boolean;
172
+ }>;
173
+ crawlEndpoint(endpoint: string): Promise<CrawlResult>;
174
+ /**
175
+ * Create a new custodial wallet. Returns an API key — save it, it cannot be recovered.
176
+ * No keypair needed — this is for users without their own Solana wallet.
177
+ */
178
+ static createWallet(baseUrl?: string, label?: string): Promise<{
179
+ apiKey: string;
180
+ publicKey: string;
181
+ message: string;
182
+ }>;
183
+ /**
184
+ * Get wallet info and balance using API key auth.
185
+ */
186
+ getWallet(): Promise<{
187
+ publicKey: string;
188
+ balances: {
189
+ sol: string;
190
+ usdc: string;
191
+ };
192
+ }>;
193
+ /**
194
+ * Export the private key for the custodial wallet. Returns the full 64-byte keypair.
195
+ * Save this and import into Phantom/Solflare for self-custody.
196
+ */
197
+ exportKey(): Promise<{
198
+ privateKey: number[];
199
+ publicKey: string;
200
+ }>;
201
+ /**
202
+ * List emails in the agent's inbox.
203
+ */
204
+ getInbox(options?: {
205
+ limit?: number;
206
+ offset?: number;
207
+ }): Promise<{
208
+ messages: Array<{
209
+ id: string;
210
+ from: string;
211
+ to: string;
212
+ subject: string;
213
+ created_at: string;
214
+ }>;
215
+ }>;
216
+ /**
217
+ * Read a specific email from the agent's inbox.
218
+ */
219
+ readEmail(messageId: string): Promise<{
220
+ id: string;
221
+ from: string;
222
+ to: string;
223
+ subject: string;
224
+ text: string;
225
+ html?: string;
226
+ created_at: string;
227
+ }>;
228
+ /**
229
+ * Send an email from the agent's inbox.
230
+ */
231
+ sendEmail(params: {
232
+ to: string;
233
+ subject: string;
234
+ text: string;
235
+ html?: string;
236
+ }): Promise<{
237
+ success: boolean;
238
+ messageId?: string;
239
+ }>;
240
+ uploadFile(filePath: string): Promise<UploadResult>;
241
+ private authHeaders;
242
+ getCreditBalance(): Promise<{
243
+ balance: number;
244
+ balanceUsdc: number;
245
+ }>;
246
+ getCreditHistory(limit?: number): Promise<{
247
+ transactions: Array<{
248
+ type: string;
249
+ amount: number;
250
+ description: string;
251
+ created_at: string;
252
+ }>;
253
+ }>;
254
+ depositCredits(stripePaymentIntentId: string): Promise<{
255
+ success: boolean;
256
+ balance: number;
257
+ }>;
258
+ createPrepaidSession(agentPubkey: string, budgetUsdc: number): Promise<{
259
+ sessionId: string;
260
+ token: string;
261
+ budgetUsdc: number;
262
+ estimatedMessages: number;
263
+ transaction?: string;
264
+ }>;
265
+ openPrepaidSession(agentPubkey: string, budgetUsdc: number, signedTransaction: string): Promise<{
266
+ sessionId: string;
267
+ token: string;
268
+ budgetUsdc: number;
269
+ estimatedMessages: number;
270
+ txSignature: string;
271
+ }>;
272
+ extendSession(sessionId: string, additionalUsdc: number): Promise<{
273
+ sessionId: string;
274
+ budgetUsdc: number;
275
+ spentUsdc: number;
276
+ remainingUsdc: number;
277
+ }>;
278
+ sendMessageWithBudget(sessionId: string, task: string, maxBudget: number, fileUrl?: string): Promise<{
279
+ price: number;
280
+ priceUsdc: number;
281
+ negotiated?: boolean;
282
+ paymentId?: string;
283
+ pendingPayment?: {
284
+ transaction: string;
285
+ };
286
+ }>;
287
+ getNotifications(limit?: number): Promise<{
288
+ notifications: Array<{
289
+ id: number;
290
+ type: string;
291
+ title: string;
292
+ description: string;
293
+ is_read: boolean;
294
+ created_at: string;
295
+ }>;
296
+ }>;
297
+ getUnreadCount(): Promise<{
298
+ count: number;
299
+ }>;
300
+ markNotificationsRead(ids?: number[]): Promise<{
301
+ success: boolean;
302
+ }>;
303
+ registerWebhook(url: string, events?: string[]): Promise<{
304
+ success: boolean;
305
+ url: string;
306
+ events: string[];
307
+ }>;
308
+ getWebhook(): Promise<{
309
+ subscribed: boolean;
310
+ url?: string;
311
+ events?: string[];
312
+ }>;
313
+ deleteWebhook(): Promise<{
314
+ success: boolean;
315
+ }>;
316
+ getSwapQuote(inputMint: string, outputMint: string, amount: number): Promise<{
317
+ inputMint: string;
318
+ outputMint: string;
319
+ inAmount: string;
320
+ outAmount: string;
321
+ priceImpact: string;
322
+ }>;
323
+ buildSwapTransaction(inputMint: string, outputMint: string, amount: number): Promise<{
324
+ transaction: string;
325
+ inputMint: string;
326
+ outputMint: string;
327
+ }>;
328
+ getTokenPrice(token: string): Promise<{
329
+ token: string;
330
+ priceUsd: number;
331
+ }>;
332
+ getTokenPrices(): Promise<{
333
+ prices: Record<string, number>;
334
+ }>;
335
+ getSolanaPayQR(agentSlug: string): Promise<{
336
+ url: string;
337
+ qrData: string;
338
+ }>;
339
+ getBlink(agentSlug: string): Promise<{
340
+ icon: string;
341
+ title: string;
342
+ description: string;
343
+ links: {
344
+ actions: Array<{
345
+ label: string;
346
+ href: string;
347
+ }>;
348
+ };
349
+ }>;
350
+ createRecurringTask(params: {
351
+ agentAuth: string;
352
+ task: string;
353
+ intervalMs: number;
354
+ budgetPerExecution: number;
355
+ maxExecutions?: number;
356
+ }): Promise<{
357
+ id: number;
358
+ success: boolean;
359
+ }>;
360
+ listRecurringTasks(): Promise<{
361
+ tasks: Array<{
362
+ id: number;
363
+ agent_auth: string;
364
+ task: string;
365
+ status: string;
366
+ executions: number;
367
+ }>;
368
+ }>;
369
+ pauseRecurringTask(id: number): Promise<{
370
+ success: boolean;
371
+ }>;
372
+ resumeRecurringTask(id: number): Promise<{
373
+ success: boolean;
374
+ }>;
375
+ stopRecurringTask(id: number): Promise<{
376
+ success: boolean;
377
+ }>;
378
+ getAgentBalance(): Promise<{
379
+ sol: string;
380
+ usdc: string;
381
+ publicKey: string;
382
+ }>;
383
+ getAgentSpendHistory(): Promise<{
384
+ transactions: Array<{
385
+ type: string;
386
+ amount: number;
387
+ created_at: string;
388
+ }>;
389
+ }>;
390
+ getTransactionHistory(): Promise<{
391
+ transactions: Array<{
392
+ signature: string;
393
+ type: string;
394
+ amount: number;
395
+ timestamp: string;
396
+ }>;
397
+ }>;
398
+ createMandate(params: {
399
+ agentAuth: string;
400
+ budgetLimit: number;
401
+ expiresInMs: number;
402
+ allowedActions?: string[];
403
+ }): Promise<{
404
+ id: number;
405
+ success: boolean;
406
+ }>;
407
+ listMandates(): Promise<{
408
+ mandates: Array<{
409
+ id: number;
410
+ agent_auth: string;
411
+ budget_limit: number;
412
+ status: string;
413
+ }>;
414
+ }>;
415
+ revokeMandate(id: number): Promise<{
416
+ success: boolean;
417
+ }>;
418
+ getPresignedUploadUrl(fileName: string, mimeType: string, size?: number): Promise<{
419
+ uploadUrl: string;
420
+ token: string;
421
+ fileId: string;
422
+ storagePath: string;
423
+ }>;
424
+ confirmUpload(fileId: string): Promise<{
425
+ success: boolean;
426
+ url: string;
427
+ name: string;
428
+ size: number;
429
+ }>;
430
+ discover(skills: string): Promise<Agent[]>;
431
+ myAgents(): Promise<{
432
+ agents: Agent[];
433
+ }>;
434
+ claimAgent(agentPubkey: string, accessCode: string): Promise<{
435
+ success: boolean;
436
+ }>;
61
437
  }