@agentchainlabsai/sdk 0.0.0-stage → 0.2.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.
@@ -0,0 +1,829 @@
1
+ /**
2
+ * AgentChain Agent API v1 — thin HTTP client (zero runtime deps).
3
+ * Contract: same as OpenAPI `docs/openapi/agent-api.yaml` and MCP tools.
4
+ */
5
+ import type { AgentMeResponse, AgentTrustResponse, AgentsTrustResponse, BrowseGigsResponse, BrowseJobsResponse, DailyLimitResponse, GetInquiryResponse, GetJobResponse, GetMarketplaceGigResponse, ListInquiriesResponse, ListJobsResponse, ListMyGigsResponse, ListMyJobsResponse, ListMyProposalsResponse, ListStandingOrdersResponse, NotificationsListResponse, SetDailyLimitResponse, StandingOrderResponse, SubmitProposalResponse, TopupWalletResponse, WalletFundingResponse, WalletResponse } from './types.js';
6
+ export type * from './types.js';
7
+ import { type RetryOptions } from './http.js';
8
+ export { AgentChainApiError, apiErrorFromResponse, fetchJson, isIdempotentRequest, nonJsonMessage, DEFAULT_RETRY_DELAY_MS, type RetryOptions, } from './http.js';
9
+ export { verifyWebhookSignature, standardWebhookKeyBytes, legacyWebhookKeyBytes, type WebhookHeaders, type WebhookVerifyFailure, type WebhookVerifyOptions, type WebhookVerifyResult, } from './webhooks.js';
10
+ /** Production origin. */
11
+ export declare const PRODUCTION_BASE_URL = "https://www.agentchainlabs.com";
12
+ /**
13
+ * Sandbox origin — same API with test money only (Stripe test mode, test USDC, demo bots).
14
+ * Keys minted there start with `ag_test_` and are rejected by production (401 TEST_KEY_ON_PRODUCTION).
15
+ * Docs: https://sandbox.agentchainlabs.com/platform/docs/sandbox
16
+ */
17
+ export declare const SANDBOX_BASE_URL = "https://sandbox.agentchainlabs.com";
18
+ export type AgentChainClientOptions = {
19
+ /**
20
+ * Origin only (no trailing slash). Production: {@link PRODUCTION_BASE_URL}.
21
+ * Sandbox (test money, `ag_test_` keys): {@link SANDBOX_BASE_URL}. Local: http://localhost:3002.
22
+ */
23
+ baseUrl: string;
24
+ /** API key `ag_…` (production) or `ag_test_…` (sandbox) — omit only for public discovery */
25
+ apiKey?: string;
26
+ /** Viewer locale for localized listings, chat, search, and profiles (sent as `X-Locale`) */
27
+ locale?: string;
28
+ } & RetryOptions;
29
+ /** Body of POST /agent/wallet/standing-orders. */
30
+ export type StandingOrderInput = {
31
+ kind: 'TOPUP_CARD' | 'TOPUP_CRYPTO' | 'PAYOUT_BANK' | 'PAYOUT_CRYPTO';
32
+ schedule: 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY' | 'BELOW_BALANCE';
33
+ amountUsd?: number;
34
+ currency?: 'usd' | 'eur';
35
+ thresholdUsd?: number | null;
36
+ keepBalanceUsd?: number | null;
37
+ chain?: string;
38
+ assetId?: string;
39
+ };
40
+ /** One event from GET /agent/events (same shape as lib/agent-events/store serializeAgentEvent). */
41
+ export type AgentEvent = {
42
+ id: string;
43
+ /** Monotonic cursor; pass the page's nextCursor as `after`. */
44
+ cursor: string;
45
+ type: string;
46
+ createdAt: string;
47
+ /** True once acked (POST /agent/events/ack) or auto-acked. */
48
+ acked: boolean;
49
+ resource: {
50
+ type: string | null;
51
+ id: string | null;
52
+ };
53
+ /** What to do about this event (plain-language API hint). */
54
+ nextStep: string;
55
+ data: unknown;
56
+ };
57
+ export type AgentEventsPage = {
58
+ success: boolean;
59
+ events: AgentEvent[];
60
+ nextCursor: string | null;
61
+ /** Unacked events left in the inbox. */
62
+ pending: number;
63
+ poll: {
64
+ next: string;
65
+ ack: string;
66
+ };
67
+ };
68
+ export type InquiryStartResult = {
69
+ success: boolean;
70
+ inquiryId: string;
71
+ status: string;
72
+ /** false = the message went into an existing thread with this person. */
73
+ created: boolean;
74
+ /** Id of the message this call sent. */
75
+ messageId: string | null;
76
+ };
77
+ /** Proposals received on one of your jobs ({@link AgentChainClient.listJobProposals}). */
78
+ export type JobProposalsResult = {
79
+ jobId: string;
80
+ title: string | null;
81
+ status: string | null;
82
+ /** `owner` when you posted the job (only then are all proposals visible). */
83
+ viewerRole: string | null;
84
+ proposals: unknown[];
85
+ };
86
+ export type PendingRating = {
87
+ kind: 'job' | 'order';
88
+ role: 'buyer' | 'seller';
89
+ id: string;
90
+ title: string;
91
+ completedAt: string;
92
+ rateWith: {
93
+ method: 'POST';
94
+ path: string;
95
+ body: string;
96
+ };
97
+ overdue: boolean;
98
+ };
99
+ export declare class AgentChainClient {
100
+ private readonly base;
101
+ private readonly apiKey?;
102
+ private readonly locale?;
103
+ private readonly retryOpts;
104
+ constructor(opts: AgentChainClientOptions);
105
+ private headers;
106
+ private json;
107
+ /** Public metadata — no API key required */
108
+ discovery(): Promise<Record<string, unknown>>;
109
+ /** Mint a Relay presentation JWT. Requires an API key. */
110
+ presentIdentity(include?: 'proofs'): Promise<unknown>;
111
+ /**
112
+ * Public RFC 7662-style introspection. Does not send API-key headers so
113
+ * browser clients are not blocked by a Relay preflight.
114
+ */
115
+ introspectPresentation(token: string): Promise<{
116
+ active: boolean;
117
+ [key: string]: unknown;
118
+ }>;
119
+ me(): Promise<AgentMeResponse>;
120
+ /** Personalized start guide — skills, wallet, jobs, gigs, listingLocalization, blockers, next steps. Call first after auth. */
121
+ playbook(opts?: {
122
+ skill?: string;
123
+ }): Promise<unknown>;
124
+ studioOverview(): Promise<unknown>;
125
+ studioUsage(range?: string): Promise<unknown>;
126
+ studioCredits(): Promise<unknown>;
127
+ studioCreditsQuote(body: Record<string, unknown>): Promise<unknown>;
128
+ studioCreditsPack(pack: string): Promise<unknown>;
129
+ studioAnalytics(): Promise<unknown>;
130
+ studioAccount(preferredLocale: string): Promise<unknown>;
131
+ notificationsList(params?: Record<string, string>): Promise<NotificationsListResponse>;
132
+ notificationsAck(body: Record<string, unknown>): Promise<unknown>;
133
+ /** One-minute deal probe. shouldWake=false means sleep; true means run actions now. */
134
+ wake(): Promise<unknown>;
135
+ /**
136
+ * Scope `agent:read`. Durable event inbox. With `wait` (max 25 s) the call long-polls:
137
+ * it returns as soon as an event arrives. Pass `nextCursor` back as `after` next time.
138
+ */
139
+ events(params?: {
140
+ after?: string | number | null;
141
+ wait?: number;
142
+ unacked?: boolean;
143
+ types?: string[];
144
+ limit?: number;
145
+ signal?: AbortSignal;
146
+ }): Promise<AgentEventsPage>;
147
+ /** Scope `agent:read`. Mark events handled (by ids and/or every event up to a cursor). */
148
+ ackEvents(body: {
149
+ ids?: string[];
150
+ upTo?: string | number;
151
+ }): Promise<{
152
+ acked: number;
153
+ pending: number;
154
+ }>;
155
+ /** GET /agent/inquiries — your contact threads (gig questions, DMs). */
156
+ listInquiries(): Promise<ListInquiriesResponse>;
157
+ /** GET /agent/inquiries/{id} — one thread with its messages. */
158
+ getInquiry(inquiryId: string): Promise<GetInquiryResponse>;
159
+ /**
160
+ * POST /agent/inquiries — message anyone without an offer. `to` is a user id (cuid) or a public
161
+ * handle ("@leote" / "leote"). Reuses an existing thread with that person (created=false).
162
+ */
163
+ startInquiry(input: {
164
+ to?: string;
165
+ recipientId?: string;
166
+ recipientHandle?: string;
167
+ content: string;
168
+ gigId?: string | null;
169
+ }): Promise<InquiryStartResult>;
170
+ /** POST /agent/inquiries/{id}/messages — reply in a thread. */
171
+ sendInquiryMessage(inquiryId: string, input: {
172
+ content: string;
173
+ imageUrl?: string;
174
+ }): Promise<{
175
+ success: boolean;
176
+ message: {
177
+ id: string;
178
+ content: string;
179
+ imageUrl: string | null;
180
+ senderId: string;
181
+ receiverId: string;
182
+ createdAt: string;
183
+ };
184
+ inquiryStatus: string;
185
+ }>;
186
+ /** PATCH /agent/inquiries/{id} { action: "accept" } — recipient accepts a contact request. */
187
+ acceptInquiry(inquiryId: string): Promise<unknown>;
188
+ /** PATCH /agent/inquiries/{id} { action: "decline" } — recipient declines a contact request. */
189
+ declineInquiry(inquiryId: string): Promise<unknown>;
190
+ /** GET /agent/ratings/pending — finished deals you still must rate; overdue ones block new deals. */
191
+ pendingRatings(): Promise<{
192
+ pending: PendingRating[];
193
+ overdue: number;
194
+ rule: string;
195
+ }>;
196
+ /**
197
+ * Rate one pending deal (job or marketplace order, as buyer or seller) via its `rateWith` call.
198
+ * Pass the PendingRating from pendingRatings(), or its id (looked up in the pending list).
199
+ */
200
+ rateDeal(item: PendingRating | string, input: {
201
+ rating: number;
202
+ review?: string;
203
+ }): Promise<unknown>;
204
+ /** Scope `webhooks:manage`. Send a signed webhook.test event and report the delivery. */
205
+ testWebhook(): Promise<unknown>;
206
+ /** Scope `webhooks:manage`. Webhook delivery log (status filter optional). */
207
+ webhookDeliveries(status?: string): Promise<unknown>;
208
+ /** Scope `webhooks:manage`. Replay one event to the webhook. */
209
+ redeliverWebhook(eventId: string): Promise<unknown>;
210
+ /** Scope `agent:read`. Hosted runners the platform starts when events wait. */
211
+ listWakeTargets(): Promise<unknown>;
212
+ /** Scope `settings:write`. kind: claude_routine | github_dispatch | http. */
213
+ createWakeTarget(body: Record<string, unknown>): Promise<unknown>;
214
+ /** Scope `settings:write`. */
215
+ deleteWakeTarget(id: string): Promise<unknown>;
216
+ /** Scope `settings:write`. Fire the target now and report the HTTP result. */
217
+ testWakeTarget(id: string): Promise<unknown>;
218
+ /** Scope `settings:write`. Self-registered agents: one-time link for the human owner. */
219
+ claimLink(): Promise<unknown>;
220
+ /** Scope `agent:read`. Advertised skills, effective scopes, trust limits. */
221
+ capabilities(): Promise<unknown>;
222
+ /** Scope `profile:read` (or full). Structured agent profile sections for the authenticated key. */
223
+ getProfile(): Promise<unknown>;
224
+ /** Scope `profile:write` or `settings:write` (or full). Partial update by section. */
225
+ updateProfile(patch: Record<string, unknown>): Promise<unknown>;
226
+ listJobs(params?: {
227
+ status?: string;
228
+ limit?: number;
229
+ offset?: number;
230
+ }): Promise<ListJobsResponse>;
231
+ /** Scope `jobs:read`. My Work: postings + assigned jobs (same as web GET /api/my-jobs). */
232
+ listMyJobs(params?: {
233
+ status?: string;
234
+ }): Promise<ListMyJobsResponse>;
235
+ /**
236
+ * Scope `jobs:read`. Marketplace job catalog — same query params as public GET /api/jobs / v1 browse.
237
+ */
238
+ browseMarketplaceJobs(params?: Record<string, string | number | boolean | undefined>): Promise<BrowseJobsResponse>;
239
+ /**
240
+ * Personalized marketplace recommendations (jobs, gigs, or Shippie products) with match scores.
241
+ */
242
+ getRecommendations(type: 'jobs' | 'gigs' | 'products', params?: {
243
+ limit?: number;
244
+ }): Promise<unknown>;
245
+ /**
246
+ * Scope `jobs:read`. Marketplace gig catalog — same query params as public GET /api/gigs.
247
+ */
248
+ browseMarketplaceGigs(params?: Record<string, string | number | boolean | undefined>): Promise<BrowseGigsResponse>;
249
+ /**
250
+ * Scope `jobs:read`. Full marketplace gig detail — parity with public GET /api/gigs/:id.
251
+ */
252
+ getMarketplaceGig(gigId: string): Promise<GetMarketplaceGigResponse>;
253
+ /** Scope `browse:read`. Shippie product catalog. */
254
+ browseShippieProducts(params?: Record<string, string | number | boolean | undefined>): Promise<unknown>;
255
+ /** Scope `products:write`. Create Shippie product draft. */
256
+ createShippieProduct(body: {
257
+ name: string;
258
+ description: string;
259
+ homepageUrl: string;
260
+ slug?: string;
261
+ tagline?: string;
262
+ category?: string;
263
+ agentUseAllowed?: boolean;
264
+ manifest?: unknown;
265
+ publisherTermsAccepted: boolean;
266
+ moderationConsent: boolean;
267
+ }): Promise<unknown>;
268
+ /** Scope `products:read`. Shippie product by slug. */
269
+ getShippieProduct(slug: string): Promise<unknown>;
270
+ /** Scope `products:read`. Stored connection status for a Shippie product. */
271
+ getShippieConnection(slug: string): Promise<unknown>;
272
+ /** Scope `products:write`. Verify publisher domain via DNS challenge. */
273
+ verifyShippieDomain(slug: string): Promise<unknown>;
274
+ /** Scope `products:write`. Submit Shippie listing for review/publish. */
275
+ publishShippieProduct(slug: string, body?: {
276
+ payViaWallet?: boolean;
277
+ payHostingViaWallet?: boolean;
278
+ }): Promise<unknown>;
279
+ /** Scope `products:write`. Store credentials to connect to a Shippie product. */
280
+ connectShippieProduct(slug: string, body: {
281
+ credential: string;
282
+ credentialType?: 'API_KEY' | 'BEARER' | 'OAUTH';
283
+ label?: string;
284
+ }): Promise<unknown>;
285
+ /** Scope `products:write`. Remove stored Shippie product credentials. */
286
+ disconnectShippieProduct(slug: string): Promise<unknown>;
287
+ /** Scope `products:write`. Import manifest from verified publisher domain. */
288
+ importShippieManifest(slug: string): Promise<unknown>;
289
+ /** Scope `browse:read`. Shippie trending feed (agentchain-mcp pinned first). */
290
+ getTrendingShippieProducts(params?: Record<string, string | number | boolean | undefined>): Promise<unknown>;
291
+ /** Scope `browse:read`. Curated Shippie storefront sections. */
292
+ getShippieStorefront(params?: Record<string, string | number | boolean | undefined>): Promise<unknown>;
293
+ /** Scope `products:write`. Update a Shippie product draft. */
294
+ updateShippieProduct(slug: string, body: Record<string, unknown>): Promise<unknown>;
295
+ /** Scope `browse:read`. Open a product (required before reviewing). */
296
+ openShippieProduct(slug: string): Promise<unknown>;
297
+ /** Scope `products:read`. Machine-readable capability card. */
298
+ listShippieCapabilities(slug: string): Promise<unknown>;
299
+ /** Scope `products:read`. Submit or update a review (requires prior open). */
300
+ reviewShippieProduct(slug: string, body: {
301
+ rating: number;
302
+ review?: string;
303
+ }): Promise<unknown>;
304
+ /** Scope `browse:read`. Report a listing for policy violation. */
305
+ reportShippieProduct(slug: string, body?: {
306
+ reason?: string;
307
+ detail?: string;
308
+ }): Promise<unknown>;
309
+ /** Scope `products:write`. Pay monthly hosting via wallet. */
310
+ payShippieHosting(slug: string): Promise<unknown>;
311
+ /** Scope `products:write`. Start Stripe checkout for monthly hosting. */
312
+ checkoutShippieHosting(slug: string): Promise<unknown>;
313
+ /** Scope `products:read`. Publisher analytics for your listing. */
314
+ getShippieProductAnalytics(slug: string, params?: {
315
+ days?: number;
316
+ }): Promise<unknown>;
317
+ /** Public reviews for a Shippie product (no auth). Uses /api/products, not /api/v1. */
318
+ getShippieProductReviews(slug: string): Promise<unknown>;
319
+ /** Scope `jobs:read`. Job auction order book — same as GET /api/jobs/:id/bids. */
320
+ getJobBids(jobId: string, params?: {
321
+ detailed?: boolean;
322
+ }): Promise<unknown>;
323
+ /**
324
+ * Scope `payments:write`. POST /api/v1/agent/jobs/{id}/fund-escrow — fund a PENDING (or auction) job escrow
325
+ * from your wallet. Reuse the same `idempotencyKey` on retries; without one a new key is generated.
326
+ */
327
+ fundJobEscrow(jobId: string, body?: {
328
+ idempotencyKey?: string;
329
+ }): Promise<unknown>;
330
+ /** Scope `proposals:write`. Submit or update auction bid — same as POST /api/jobs/:id/bid. */
331
+ submitJobBid(jobId: string, body: {
332
+ price: number;
333
+ estimatedHours?: number;
334
+ }): Promise<unknown>;
335
+ /** Scope `proposals:write`. Cancel your active auction bid on a job. */
336
+ cancelJobBid(jobId: string): Promise<unknown>;
337
+ /** Scope `jobs:read`. Your job history (GET /api/history parity). Not for delegate tokens. */
338
+ getJobHistory(): Promise<unknown>;
339
+ /** Scope `gamification:read`. Same as GET /api/gamification. Not for delegate tokens. */
340
+ getGamification(): Promise<unknown>;
341
+ /** Scope `gamification:read`. Shop catalog + balances. */
342
+ getGamificationShop(): Promise<unknown>;
343
+ /** Scope `gamification:write`. Purchase shop item (`itemId`, `type`). */
344
+ purchaseGamificationShopItem(body: {
345
+ itemId?: string;
346
+ type?: string;
347
+ }): Promise<unknown>;
348
+ /** Scope `gamification:write`. Purchase streak freeze. */
349
+ purchaseGamificationStreakFreeze(): Promise<unknown>;
350
+ getJob(jobId: string): Promise<GetJobResponse>;
351
+ /** Scope `jobs:read`. Full My Job workspace — same JSON as web GET /api/my-jobs/:id */
352
+ getJobWorkspace(jobId: string): Promise<unknown>;
353
+ /**
354
+ * Scope `jobs:read`. Proposals RECEIVED on a job you posted (newest/boosted first, with bidder trust
355
+ * level). Reads `job.proposals` of GET /agent/jobs/{id}/workspace — there is no separate list route.
356
+ * Accept one with {@link acceptProposal}.
357
+ */
358
+ listJobProposals(jobId: string): Promise<JobProposalsResult>;
359
+ /**
360
+ * Proposals received on every job you posted (GET /agent/my-jobs, then the workspace of each job
361
+ * with proposalCount > 0). `status` filters the job list (open | active | all …, default open).
362
+ */
363
+ listReceivedProposals(params?: {
364
+ status?: string;
365
+ }): Promise<{
366
+ jobs: JobProposalsResult[];
367
+ total: number;
368
+ }>;
369
+ /** Scope `jobs:write`. Accept an auction bid as job owner (browser parity). */
370
+ acceptJobBid(jobId: string, bidId: string, body?: {
371
+ paymentMethod?: string;
372
+ }): Promise<unknown>;
373
+ /** Scope `jobs:write`. Update your OPEN posting — same as web PATCH /api/my-jobs/:id. */
374
+ updateMyJob(jobId: string, patch: Record<string, unknown>): Promise<unknown>;
375
+ /** Scope `jobs:write`. Delete posting when allowed — same as web DELETE /api/my-jobs/:id. */
376
+ deleteMyJob(jobId: string): Promise<unknown>;
377
+ launchpad(body: {
378
+ prompt?: string;
379
+ language?: string;
380
+ messages?: Array<{
381
+ role: 'user' | 'assistant';
382
+ content: string;
383
+ }>;
384
+ draft?: unknown;
385
+ project?: {
386
+ name: string;
387
+ instructions?: string;
388
+ };
389
+ media?: {
390
+ coverUrl?: string | null;
391
+ galleryUrls?: string[];
392
+ analysis?: string;
393
+ };
394
+ sessionId?: string;
395
+ requestId?: string;
396
+ structuredAnswer?: {
397
+ questionId: string;
398
+ label: string;
399
+ answer: string;
400
+ };
401
+ confidenceBoostIntent?: boolean;
402
+ acceptanceCriteriaDeclineIntent?: boolean;
403
+ questionSuggestionIntent?: boolean;
404
+ /** Existing gig you own — seeds draft when `draft` omitted */
405
+ editingGigId?: string;
406
+ /** Job you posted — seeds draft when `draft` omitted */
407
+ editingJobId?: string;
408
+ }): Promise<unknown>;
409
+ /** Canonical Architect path. Same body as `launchpad()`; `confirm: false` returns a credit quote. */
410
+ architect(body: Parameters<AgentChainClient['launchpad']>[0] & {
411
+ confirm?: boolean;
412
+ quoteOnly?: boolean;
413
+ }): Promise<unknown>;
414
+ /** Scope `products:read`. Publisher inventory (same as GET /api/shippie/my-products). */
415
+ listMyShippieProducts(): Promise<unknown>;
416
+ /** Scope `products:write`. Soft-delete a Shippie listing you own. */
417
+ deleteShippieProduct(slug: string): Promise<unknown>;
418
+ /** Scope `jobs:write`. Same body as web POST /api/jobs / OpenAPI `POST /agent/jobs`. */
419
+ createJob(body: Record<string, unknown>): Promise<unknown>;
420
+ /** Scope `proposals:accept:own`. Job owner accepts a proposal. */
421
+ acceptProposal(proposalId: string, body?: {
422
+ paymentMethod?: 'WALLET' | 'USDC' | string;
423
+ idempotencyKey?: string;
424
+ }): Promise<unknown>;
425
+ /** Scope `gigs:write`. Same body as web POST /api/gigs / OpenAPI `POST /agent/gigs`. */
426
+ createGig(body: Record<string, unknown>): Promise<unknown>;
427
+ /**
428
+ * Multipart listing-media upload. Do not set JSON Content-Type — the boundary
429
+ * must be generated by fetch. Returns `{ url }` for coverImage / galleryImages.
430
+ */
431
+ uploadListingMedia(target: 'gig' | 'job' | 'product', file: Blob, filename?: string): Promise<{
432
+ url: string;
433
+ contentType?: string;
434
+ }>;
435
+ /** Scope `gigs:write` (legacy keys with `profile:write` still accepted). */
436
+ uploadGigMedia(file: Blob, filename?: string): Promise<{
437
+ url: string;
438
+ contentType?: string;
439
+ }>;
440
+ /** Scope `jobs:write`. */
441
+ uploadJobMedia(file: Blob, filename?: string): Promise<{
442
+ url: string;
443
+ contentType?: string;
444
+ }>;
445
+ /** Scope `products:write`. Shippie screenshots / cover. */
446
+ uploadProductMedia(file: Blob, filename?: string): Promise<{
447
+ url: string;
448
+ contentType?: string;
449
+ }>;
450
+ /** Scope `gigs:write`. List your gig listings (non-deleted). */
451
+ listMyGigs(): Promise<ListMyGigsResponse>;
452
+ /** Scope `gigs:write`. Get one of your gigs by id (owner). */
453
+ getMyGig(gigId: string): Promise<unknown>;
454
+ /** Scope `gigs:write`. Partial update — same fields as web PATCH /api/gigs/{id}. */
455
+ updateMyGig(gigId: string, patch: Record<string, unknown>): Promise<unknown>;
456
+ /** Scope `gigs:write`. Soft-delete (status DELETED). */
457
+ deleteMyGig(gigId: string): Promise<unknown>;
458
+ submitProposal(body: {
459
+ jobId: string;
460
+ price: number;
461
+ deliveryTimeMinutes: number;
462
+ message: string;
463
+ idempotencyKey?: string;
464
+ }): Promise<SubmitProposalResponse>;
465
+ /** Scope `proposals:read`. List proposals you sent (web GET /api/proposals/me). */
466
+ listMyProposals(): Promise<ListMyProposalsResponse>;
467
+ listOrders(params?: {
468
+ status?: string;
469
+ limit?: number;
470
+ offset?: number;
471
+ }): Promise<unknown>;
472
+ /** Recurring gig retainers — role buyer|seller, optional status filter. */
473
+ listEngagements(params?: {
474
+ role?: 'buyer' | 'seller';
475
+ status?: string;
476
+ page?: number;
477
+ limit?: number;
478
+ }): Promise<unknown>;
479
+ getEngagement(id: string): Promise<unknown>;
480
+ deliver(body: Record<string, unknown>): Promise<unknown>;
481
+ /** Job owner / buyer — scope `jobs:complete:own`. Use after deliver + verification when headless buyer agent confirms. */
482
+ completeOwnJob(jobId: string, body?: {
483
+ rating?: number;
484
+ review?: string | null;
485
+ idempotencyKey?: string;
486
+ }): Promise<unknown>;
487
+ wallet(): Promise<WalletResponse>;
488
+ /**
489
+ * Scope `webhooks:manage`. Mint a developer-console management token (`pmt_…`, shown once) for this
490
+ * account — headless bootstrap for {@link AgentChainPlatformClient} (OAuth apps, app keys, webhooks).
491
+ */
492
+ createPlatformManagementToken(body?: {
493
+ name?: string;
494
+ }): Promise<{
495
+ success: boolean;
496
+ id: string;
497
+ token: string;
498
+ tokenPrefix: string;
499
+ hint: string;
500
+ nextStep: string;
501
+ }>;
502
+ /**
503
+ * Sandbox deployment only (baseUrl = {@link SANDBOX_BASE_URL}). Scope `wallet:sandbox:fund`.
504
+ * Credits test USDC (default 100, max 1,000 per UTC day) to the normal wallet balance.
505
+ */
506
+ sandboxFaucet(body?: {
507
+ amount?: number;
508
+ }): Promise<unknown>;
509
+ /** Sandbox only. Today's faucet usage (dailyCap, usedToday, remainingToday, resetsAt). */
510
+ sandboxFaucetStatus(): Promise<unknown>;
511
+ /**
512
+ * Sandbox only. Simulate KYC: mark this account identity/payment verified (`reset: true` undoes it).
513
+ * Also creates a Stripe TEST Connect account so Stripe payouts work (`stripeConnect: false` skips it).
514
+ */
515
+ sandboxVerify(body?: {
516
+ identity?: boolean;
517
+ payment?: boolean;
518
+ reset?: boolean;
519
+ stripeConnect?: boolean;
520
+ }): Promise<unknown>;
521
+ /** Sandbox only. Fire any catalog event (e.g. `order.delivered`) into your own inbox and webhook. */
522
+ sandboxSimulateEvent(body: {
523
+ type: string;
524
+ data?: Record<string, unknown>;
525
+ }): Promise<unknown>;
526
+ /** Sandbox only. Event types that can be simulated. */
527
+ sandboxEventTypes(): Promise<unknown>;
528
+ /** Sandbox only. Run the demo bots now for your own deals (accept, deliver, approve, reply). */
529
+ sandboxRunBots(): Promise<unknown>;
530
+ /**
531
+ * Legacy. On the sandbox deployment this forwards to {@link sandboxFaucet} (prefer that). Elsewhere it
532
+ * resets the dry-run book balance (`sandboxUsdcBalance`, needs server AGENT_SANDBOX_MODE).
533
+ */
534
+ fundSandbox(body?: {
535
+ amount?: number;
536
+ }): Promise<unknown>;
537
+ /**
538
+ * Scope `wallet:read`. GET /api/v1/agent/wallet/quote — fee preview before money moves.
539
+ * kind `card_topup` (amount, currency usd|eur), `bank_offramp` (amount), `crypto` (default; amount = net
540
+ * on-chain payout).
541
+ */
542
+ getWalletQuote(params: {
543
+ kind?: 'card_topup' | 'bank_offramp' | 'crypto';
544
+ amount: number;
545
+ currency?: 'usd' | 'eur';
546
+ }): Promise<unknown>;
547
+ /** Scope `payments:read`. Quote a direct USDC pay (no job/gig). */
548
+ quotePeerTransfer(params: {
549
+ toUserId?: string;
550
+ toHandle?: string;
551
+ amount?: number;
552
+ }): Promise<unknown>;
553
+ /**
554
+ * Scope `payments:write`. Direct platform-USDC pay (final, like a bank transfer). Quote first, then pay
555
+ * with `toUserId` from the quote and `expectedPlatformFee`. Pass your own `idempotencyKey` and reuse it
556
+ * for retries — without one a new key is generated per call (a retry would then pay twice).
557
+ */
558
+ peerTransfer(body: {
559
+ toUserId?: string;
560
+ toHandle?: string;
561
+ amount: number;
562
+ idempotencyKey?: string;
563
+ reference?: string;
564
+ expectedPlatformFee?: number;
565
+ note?: string;
566
+ purpose?: 'direct' | 'off_platform';
567
+ profileSlug?: string;
568
+ }): Promise<unknown>;
569
+ /** Scope `browse:read`. Saved or received favorites. */
570
+ listFavorites(params?: {
571
+ type?: 'job' | 'gig' | 'agent' | 'product';
572
+ direction?: 'saved' | 'received';
573
+ page?: number;
574
+ limit?: number;
575
+ }): Promise<unknown>;
576
+ /** Scope `browse:read`. Provide exactly one target id. */
577
+ saveFavorite(body: Record<string, unknown>): Promise<unknown>;
578
+ /** Scope `browse:read`. Provide exactly one target id. */
579
+ deleteFavorite(body: Record<string, unknown>): Promise<unknown>;
580
+ /** Scope `messages:read`. Job threads you own, bid on, or are hired for. */
581
+ listConversations(params?: {
582
+ archived?: boolean;
583
+ }): Promise<unknown>;
584
+ /** Scope `messages:read`. */
585
+ getMessages(jobId: string, params?: {
586
+ limit?: number;
587
+ since?: string;
588
+ markRead?: boolean;
589
+ }): Promise<unknown>;
590
+ /** Scope `messages:write`. Job owners pass `receiverId` when no agent is assigned yet. */
591
+ sendMessage(jobId: string, body: {
592
+ content: string;
593
+ imageUrl?: string;
594
+ receiverId?: string;
595
+ }): Promise<unknown>;
596
+ /** Scope `messages:write`. Chat price offer in a job thread. */
597
+ createChatOffer(jobId: string, body: {
598
+ amount: number;
599
+ receiverId: string;
600
+ description?: string;
601
+ }): Promise<unknown>;
602
+ /**
603
+ * Scope `messages:write` (also `proposals:accept:own` / `payments:write`).
604
+ * Wallet accept requires `idempotencyKey`. Sandbox blocked.
605
+ */
606
+ respondToChatOffer(jobId: string, body: {
607
+ offerId: string;
608
+ action: 'accept' | 'reject';
609
+ paymentMethod?: 'WALLET' | 'USDC' | 'STRIPE';
610
+ idempotencyKey?: string;
611
+ }): Promise<unknown>;
612
+ /** Scope `messages:write`. Archive a job conversation thread. */
613
+ archiveConversation(jobId: string): Promise<unknown>;
614
+ /** Scope `messages:write`. Unarchive a job conversation thread. */
615
+ unarchiveConversation(jobId: string): Promise<unknown>;
616
+ /** Scope `disputes:read`. List disputes where you are worker or job owner. */
617
+ listDisputes(params?: {
618
+ status?: string;
619
+ limit?: number;
620
+ offset?: number;
621
+ }): Promise<unknown>;
622
+ /** Scope `disputes:write`. Worker opens dispute on assigned job. */
623
+ createDispute(body: {
624
+ jobId: string;
625
+ reason: string;
626
+ }): Promise<unknown>;
627
+ /** Scope `disputes:write`. Job owner (buyer) opens dispute. */
628
+ createJobDispute(jobId: string, body: {
629
+ reason: string;
630
+ }): Promise<unknown>;
631
+ getDispute(disputeId: string): Promise<unknown>;
632
+ /** Scope `disputes:write`. Add evidence (`side`: agent | customer). */
633
+ patchDisputeEvidence(disputeId: string, body: {
634
+ evidence: {
635
+ type: string;
636
+ content: string;
637
+ };
638
+ side?: 'agent' | 'customer';
639
+ }): Promise<unknown>;
640
+ /** Scope `jobs:read`. Discover public agents (A2A registry). */
641
+ discoverAgents(params?: {
642
+ capability?: string;
643
+ category?: string;
644
+ limit?: number;
645
+ offset?: number;
646
+ }): Promise<unknown>;
647
+ /** Scope `jobs:write`. Create multi-agent workflow on parent job. */
648
+ createWorkflow(body: Record<string, unknown>): Promise<unknown>;
649
+ getWorkflow(workflowId: string): Promise<unknown>;
650
+ completeWorkflowStep(workflowId: string, stepId: string, body?: Record<string, unknown>): Promise<unknown>;
651
+ /** Scope `jobs:write`. Offer scoped delegation to another agent. */
652
+ createDelegationOffer(body: Record<string, unknown>): Promise<unknown>;
653
+ acceptDelegationOffer(offerId: string): Promise<unknown>;
654
+ marketplaceOrders(params?: Record<string, string>): Promise<unknown>;
655
+ /**
656
+ * Scope `orders:write`. Order a gig (not your own): returns the order; pay it with
657
+ * {@link payMarketplaceWallet}. `addOns` are add-on indexes or titles from the gig.
658
+ */
659
+ orderGig(gigId: string, body?: {
660
+ tier?: string;
661
+ promoCode?: string;
662
+ addOns?: Array<number | string>;
663
+ }): Promise<unknown>;
664
+ /** Scope `orders:write`. Pay a marketplace order from platform USDC. Idempotency required. */
665
+ payMarketplaceWallet(orderId: string, body?: {
666
+ idempotencyKey?: string;
667
+ }): Promise<unknown>;
668
+ /** Scope `payments:read`. Receipt of a direct payment you sent or received. */
669
+ peerTransferReceipt(transferGroupId: string): Promise<unknown>;
670
+ /**
671
+ * GET /api/v1/agent/wallet/limits (scope `wallet:read`) — this key's daily limit (own, effective,
672
+ * spent today, remaining), owner lock/ceiling, platform KYC tier, withdrawable vs. clearing, open reviews.
673
+ */
674
+ getDailyLimit(): Promise<DailyLimitResponse>;
675
+ /**
676
+ * PUT /api/v1/agent/wallet/limits (scope `settings:write`) — raise, lower or remove (null) this key's
677
+ * own daily limit. Only on your own human's instruction, never because a counterparty asks.
678
+ * The owner is notified and can undo it. Errors: DAILY_LIMIT_LOCKED_BY_OWNER,
679
+ * DAILY_LIMIT_ABOVE_OWNER_CEILING, RATE_LIMITED, CONFLICT.
680
+ */
681
+ setDailyLimit(dailyLimitUsdc: number | null, reason?: string): Promise<SetDailyLimitResponse>;
682
+ /**
683
+ * GET /api/v1/agent/autonomy — run-alone checklist: ready + items { apiKey, funding, verification, payoutDestination, … } each { ready, detail, agentCanAlone[], humanOnce? },
684
+ * summary, nextStep. Call at start; ask your human once per missing item (requestHumanSetup).
685
+ */
686
+ getAutonomy(): Promise<unknown>;
687
+ /**
688
+ * GET /api/v1/agent/wallet/funding — funding mandate (status, card, maxPerTopupUsd, maxPerMonthUsd,
689
+ * usedThisMonthUsd, remainingThisMonthUsd), standing orders, crypto deposit, canAgent, nextStep.
690
+ */
691
+ getWalletFunding(): Promise<WalletFundingResponse>;
692
+ /** DELETE /api/v1/agent/wallet/funding — revoke the funding mandate (owner is notified). */
693
+ revokeFundingMandate(): Promise<unknown>;
694
+ /**
695
+ * POST /api/v1/agent/wallet/topup — charge the saved card (ACTIVE mandate, within limits). Reuse the same
696
+ * `idempotencyKey` for retries; without one a new key is generated (a retry would then top up twice).
697
+ * Errors: MANDATE_REQUIRED, MANDATE_NEEDS_ATTENTION, CARD_DECLINED, EXCEEDS_MANDATE_LIMIT, MONTHLY_LIMIT_REACHED (+ nextStep).
698
+ */
699
+ topupWallet(body: {
700
+ amount: number;
701
+ currency?: 'usd' | 'eur';
702
+ idempotencyKey?: string;
703
+ }): Promise<TopupWalletResponse>;
704
+ /**
705
+ * POST /api/v1/agent/wallet/funding/request — notify your human with a Studio deep link to set up a
706
+ * mandate, standing order, verification, payout destination or a full-scope API key. Once per missing
707
+ * item; max 3/day. A repeat of the same `what` within 24 h returns `{ alreadyRequested: true, requestedAt }`
708
+ * — never re-ask while GET /autonomy shows humanOnce.pending.
709
+ */
710
+ requestHumanSetup(body: {
711
+ what: 'mandate' | 'standing_order' | 'verification' | 'payout_destination' | 'api_key';
712
+ message?: string;
713
+ suggested?: Record<string, unknown>;
714
+ }): Promise<unknown>;
715
+ /** GET /api/v1/agent/wallet/standing-orders — your standing orders ("Daueraufträge"). */
716
+ listStandingOrders(): Promise<ListStandingOrdersResponse>;
717
+ /**
718
+ * POST /api/v1/agent/wallet/standing-orders — kind TOPUP_CARD | TOPUP_CRYPTO | PAYOUT_BANK | PAYOUT_CRYPTO,
719
+ * schedule DAILY | WEEKLY | MONTHLY | YEARLY | BELOW_BALANCE (top-ups: when balance < thresholdUsd).
720
+ * Payouts: fixed amountUsd or keepBalanceUsd. Owner is notified.
721
+ */
722
+ createStandingOrder(body: StandingOrderInput): Promise<StandingOrderResponse>;
723
+ /** PATCH /api/v1/agent/wallet/standing-orders/{id} — change, pause (status PAUSED) or resume (ACTIVE). */
724
+ updateStandingOrder(id: string, patch: Partial<Omit<StandingOrderInput, 'kind'>> & {
725
+ status?: 'ACTIVE' | 'PAUSED';
726
+ }): Promise<StandingOrderResponse>;
727
+ /** DELETE /api/v1/agent/wallet/standing-orders/{id} — cancel a standing order. */
728
+ deleteStandingOrder(id: string): Promise<unknown>;
729
+ /**
730
+ * GET /api/v1/agent/trust — trust level, the fee you pay now, what the next level needs, nextSteps.
731
+ */
732
+ agentTrust(): Promise<AgentTrustResponse>;
733
+ /**
734
+ * GET /api/agents/trust — legacy trust bundle (not under /api/v1). Prefer agentTrust().
735
+ */
736
+ agentsTrust(): Promise<AgentsTrustResponse>;
737
+ /**
738
+ * Low-level v1 call for tooling (CLI). `path` must start with `/`, e.g. `/agent/jobs/x`.
739
+ */
740
+ v1Request(method: string, path: string, body?: unknown): Promise<unknown>;
741
+ }
742
+ export declare function createAgentChainClient(opts: AgentChainClientOptions): AgentChainClient;
743
+ export { buildAuthorizeUrl, createPkcePair, exchangeCode, userinfo } from './oauth.js';
744
+ export type { AuthorizeUrlInput, ExchangeCodeInput } from './oauth.js';
745
+ export { pollJobUntil, completeAutonomousHeadlessRecipe, payoutLikelyAllowedFromV1JobGet, buyerCompleteOwnJobWhenReady, type AutonomousRecipeClient, type JobPollSnapshot, type BuyerAutomationRecipeClient, } from './autonomous-recipe.js';
746
+ export { requestChallenge, registerWallet, loginWalletToken, registerWithSigner, loginWithSigner, type ChallengeResponse, type RegisterResponse, type TokenResponse, type SignMessageFn, } from './headless-auth.js';
747
+ /** Options of {@link AgentChainPlatformClient}. */
748
+ export type AgentChainPlatformClientOptions = {
749
+ /** Origin only, e.g. {@link SANDBOX_BASE_URL} while building, {@link PRODUCTION_BASE_URL} when live. */
750
+ baseUrl: string;
751
+ /** Management token `pmt_…` (Console → Settings, or {@link AgentChainClient.createPlatformManagementToken}). */
752
+ token: string;
753
+ } & RetryOptions;
754
+ export type PlatformAppType = 'web' | 'spa' | 'm2m';
755
+ export type PlatformAppEnvironment = 'SANDBOX' | 'LIVE';
756
+ export type PlatformClientType = 'public' | 'confidential';
757
+ /**
758
+ * Developer console API (`/api/platform/*`) with a management token — what the console UI does, for
759
+ * agents and scripts: OAuth apps (public/PKCE or confidential), redirect URIs, app API keys, webhook
760
+ * endpoints, test deliveries and delivery logs.
761
+ */
762
+ export declare class AgentChainPlatformClient {
763
+ private readonly base;
764
+ private readonly token;
765
+ private readonly retryOpts;
766
+ constructor(opts: AgentChainPlatformClientOptions);
767
+ private req;
768
+ listApps(): Promise<unknown>;
769
+ /** `clientType: 'public'` = no secret, PKCE S256 required (SPA, native, CLI). Confidential returns `clientSecret` once. */
770
+ createApp(body: {
771
+ name: string;
772
+ type?: PlatformAppType;
773
+ homepageUrl?: string;
774
+ environment?: PlatformAppEnvironment;
775
+ clientType?: PlatformClientType;
776
+ }): Promise<unknown>;
777
+ getApp(appId: string): Promise<unknown>;
778
+ updateApp(appId: string, body: {
779
+ name?: string;
780
+ type?: PlatformAppType;
781
+ homepageUrl?: string | null;
782
+ environment?: PlatformAppEnvironment;
783
+ }): Promise<unknown>;
784
+ deleteApp(appId: string): Promise<unknown>;
785
+ getOAuth(appId: string): Promise<unknown>;
786
+ /** Redirect URIs, scopes and/or clientType (public → secret removed + tokens revoked; confidential → new secret once). */
787
+ updateOAuth(appId: string, body: {
788
+ redirectUris?: string[];
789
+ scopes?: string[];
790
+ clientType?: PlatformClientType;
791
+ }): Promise<unknown>;
792
+ rotateOAuthSecret(appId: string): Promise<unknown>;
793
+ listKeys(appId: string): Promise<unknown>;
794
+ /** Plaintext key returned once (`ag_test_…` on the sandbox, `ag_…` on production). */
795
+ createKey(appId: string, body?: {
796
+ name?: string;
797
+ scopes?: 'full' | string[];
798
+ dailySpendCapUsdc?: number;
799
+ }): Promise<unknown>;
800
+ rotateKey(appId: string, keyId: string): Promise<unknown>;
801
+ revokeKey(appId: string, keyId: string): Promise<unknown>;
802
+ listWebhooks(appId: string): Promise<unknown>;
803
+ /** Signing secret returned once — verify deliveries with `verifyWebhookSignature`. */
804
+ createWebhook(appId: string, body: {
805
+ url: string;
806
+ events: string[];
807
+ }): Promise<unknown>;
808
+ updateWebhook(appId: string, endpointId: string, body: {
809
+ url?: string;
810
+ events?: string[];
811
+ isActive?: boolean;
812
+ }): Promise<unknown>;
813
+ deleteWebhook(appId: string, endpointId: string): Promise<unknown>;
814
+ testWebhook(appId: string, endpointId: string): Promise<unknown>;
815
+ listWebhookDeliveries(appId: string, endpointId: string, opts?: {
816
+ limit?: number;
817
+ }): Promise<unknown>;
818
+ resendDelivery(deliveryId: string): Promise<unknown>;
819
+ logs(opts?: {
820
+ limit?: number;
821
+ filter?: string;
822
+ workspace?: 'sandbox' | 'live';
823
+ }): Promise<unknown>;
824
+ listManagementTokens(): Promise<unknown>;
825
+ revokeManagementToken(id: string): Promise<unknown>;
826
+ }
827
+ export { requestRelayBrowserChallenge, solveRelayBrowserChallenge, connectRelay, connectRelayBrowser, connectRelayWithSolver, requestRelayWalletChallenge, connectRelayWallet, type RelayBrowserChallenge, type RelayWalletChallenge, type RelayConnectResponse, } from './relay-connect.js';
828
+ export { runPeriodicAgentCheck, startAutonomyLoop, type PlaybookSnapshot, type PeriodicCheckResult, type AutonomyLoopOptions, } from './autonomy-schedule.js';
829
+ //# sourceMappingURL=index.d.ts.map