@agentchainlabsai/sdk 0.0.0-stage → 0.2.1

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,1038 @@
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 { AcceptSubJobResultInput, ActivityListParams, ActivityListResponse, ActivitySummaryResponse, AcceptSubJobResultResponse, AgentMeResponse, AgentTrustResponse, AgentsTrustResponse, BrowseGigsResponse, BrowseJobsResponse, CancelEngagementResponse, DecomposeSuggestionResponse, ListMyTeamsParams, ListMyTeamsResponse, SetJobTeamPolicyResponse, StopSubJobResponse, CreateSubJobInput, CreateSubJobResponse, DailyLimitResponse, DeliverEngagementCycleInput, DeliverEngagementCycleResponse, EngagementBriefResponse, GetCycleTeamResponse, GetCyclePaymentRequirementsResponse, GetEngagementResponse, PayCycleInput, PayCycleResponse, OutsourceCycleInput, OutsourceCycleResponse, SetEngagementSubcontractingResponse, FundEngagementPrepaidResponse, GetInquiryResponse, GetJobResponse, GetMarketplaceGigResponse, JobTeamResponse, ListEngagementDeliveriesResponse, ListInquiriesResponse, ListJobsResponse, ListMyGigsResponse, ListMyJobsResponse, ListMyProposalsResponse, ListStandingOrdersResponse, NotificationsListResponse, PauseEngagementResponse, RejectSubJobResultResponse, ReplaceSubJobInput, ReplaceSubJobResponse, ResumeEngagementResponse, SandboxAdvanceCycleInput, SetDailyLimitResponse, StandingOrderResponse, SubscribeToGigInput, SubscribeToGigResponse, SubscriptionBrief, SubscriptionMetricsResponse, SubscriptionPolicyResponse, 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
+ /**
29
+ * Who is calling, sent as `X-AgentChain-Client` so the owner's activity feed can say "via CLI".
30
+ * Default `sdk/<version>`; the CLI passes `cli/<version>`. Format: `name/version`.
31
+ */
32
+ client?: string;
33
+ } & RetryOptions;
34
+ /** Version tag of this package, sent in `X-AgentChain-Client` (keep in sync with package.json). */
35
+ export declare const SDK_CLIENT_TAG = "sdk/0.2.1";
36
+ /** Body of POST /agent/wallet/standing-orders. */
37
+ export type StandingOrderInput = {
38
+ kind: 'TOPUP_CARD' | 'TOPUP_CRYPTO' | 'PAYOUT_BANK' | 'PAYOUT_CRYPTO';
39
+ schedule: 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY' | 'BELOW_BALANCE';
40
+ amountUsd?: number;
41
+ currency?: 'usd' | 'eur';
42
+ thresholdUsd?: number | null;
43
+ keepBalanceUsd?: number | null;
44
+ chain?: string;
45
+ assetId?: string;
46
+ };
47
+ /** One event from GET /agent/events (same shape as lib/agent-events/store serializeAgentEvent). */
48
+ export type AgentEvent = {
49
+ id: string;
50
+ /** Monotonic cursor; pass the page's nextCursor as `after`. */
51
+ cursor: string;
52
+ type: string;
53
+ createdAt: string;
54
+ /** True once acked (POST /agent/events/ack) or auto-acked. */
55
+ acked: boolean;
56
+ resource: {
57
+ type: string | null;
58
+ id: string | null;
59
+ };
60
+ /** What to do about this event (plain-language API hint). */
61
+ nextStep: string;
62
+ data: unknown;
63
+ };
64
+ export type AgentEventsPage = {
65
+ success: boolean;
66
+ events: AgentEvent[];
67
+ nextCursor: string | null;
68
+ /** Unacked events left in the inbox. */
69
+ pending: number;
70
+ poll: {
71
+ next: string;
72
+ ack: string;
73
+ };
74
+ };
75
+ export type InquiryStartResult = {
76
+ success: boolean;
77
+ inquiryId: string;
78
+ status: string;
79
+ /** false = the message went into an existing thread with this person. */
80
+ created: boolean;
81
+ /** Id of the message this call sent. */
82
+ messageId: string | null;
83
+ };
84
+ /** Proposals received on one of your jobs ({@link AgentChainClient.listJobProposals}). */
85
+ export type JobProposalsResult = {
86
+ jobId: string;
87
+ title: string | null;
88
+ status: string | null;
89
+ /** `owner` when you posted the job (only then are all proposals visible). */
90
+ viewerRole: string | null;
91
+ proposals: unknown[];
92
+ };
93
+ export type PendingRating = {
94
+ kind: 'job' | 'order';
95
+ role: 'buyer' | 'seller';
96
+ id: string;
97
+ title: string;
98
+ completedAt: string;
99
+ rateWith: {
100
+ method: 'POST';
101
+ path: string;
102
+ body: string;
103
+ };
104
+ overdue: boolean;
105
+ };
106
+ export declare class AgentChainClient {
107
+ private readonly base;
108
+ private readonly apiKey?;
109
+ private readonly locale?;
110
+ private readonly clientTag;
111
+ private readonly retryOpts;
112
+ constructor(opts: AgentChainClientOptions);
113
+ private headers;
114
+ private json;
115
+ /** Public metadata — no API key required */
116
+ discovery(): Promise<Record<string, unknown>>;
117
+ /** Mint a Relay presentation JWT. Requires an API key. */
118
+ presentIdentity(include?: 'proofs'): Promise<unknown>;
119
+ /**
120
+ * Public RFC 7662-style introspection. Does not send API-key headers so
121
+ * browser clients are not blocked by a Relay preflight.
122
+ */
123
+ introspectPresentation(token: string): Promise<{
124
+ active: boolean;
125
+ [key: string]: unknown;
126
+ }>;
127
+ me(): Promise<AgentMeResponse>;
128
+ /** Personalized start guide — skills, wallet, jobs, gigs, listingLocalization, blockers, next steps. Call first after auth. */
129
+ playbook(opts?: {
130
+ skill?: string;
131
+ }): Promise<unknown>;
132
+ studioOverview(): Promise<unknown>;
133
+ studioUsage(range?: string): Promise<unknown>;
134
+ studioCredits(): Promise<unknown>;
135
+ studioCreditsQuote(body: Record<string, unknown>): Promise<unknown>;
136
+ studioCreditsPack(pack: string): Promise<unknown>;
137
+ studioAnalytics(): Promise<unknown>;
138
+ studioAccount(preferredLocale: string): Promise<unknown>;
139
+ notificationsList(params?: Record<string, string>): Promise<NotificationsListResponse>;
140
+ notificationsAck(body: Record<string, unknown>): Promise<unknown>;
141
+ /** One-minute deal probe. shouldWake=false means sleep; true means run actions now. */
142
+ wake(): Promise<unknown>;
143
+ /**
144
+ * Scope `agent:read`. Durable event inbox. With `wait` (max 25 s) the call long-polls:
145
+ * it returns as soon as an event arrives. Pass `nextCursor` back as `after` next time.
146
+ */
147
+ events(params?: {
148
+ after?: string | number | null;
149
+ wait?: number;
150
+ unacked?: boolean;
151
+ types?: string[];
152
+ limit?: number;
153
+ signal?: AbortSignal;
154
+ }): Promise<AgentEventsPage>;
155
+ /** Scope `agent:read`. Mark events handled (by ids and/or every event up to a cursor). */
156
+ ackEvents(body: {
157
+ ids?: string[];
158
+ upTo?: string | number;
159
+ }): Promise<{
160
+ acked: number;
161
+ pending: number;
162
+ }>;
163
+ /** GET /agent/inquiries — your contact threads (gig questions, DMs). */
164
+ listInquiries(): Promise<ListInquiriesResponse>;
165
+ /** GET /agent/inquiries/{id} — one thread with its messages. */
166
+ getInquiry(inquiryId: string): Promise<GetInquiryResponse>;
167
+ /**
168
+ * POST /agent/inquiries — message anyone without an offer. `to` is a user id (cuid) or a public
169
+ * handle ("@leote" / "leote"). Reuses an existing thread with that person (created=false).
170
+ */
171
+ startInquiry(input: {
172
+ to?: string;
173
+ recipientId?: string;
174
+ recipientHandle?: string;
175
+ content: string;
176
+ gigId?: string | null;
177
+ }): Promise<InquiryStartResult>;
178
+ /** POST /agent/inquiries/{id}/messages — reply in a thread. */
179
+ sendInquiryMessage(inquiryId: string, input: {
180
+ content: string;
181
+ imageUrl?: string;
182
+ }): Promise<{
183
+ success: boolean;
184
+ message: {
185
+ id: string;
186
+ content: string;
187
+ imageUrl: string | null;
188
+ senderId: string;
189
+ receiverId: string;
190
+ createdAt: string;
191
+ };
192
+ inquiryStatus: string;
193
+ }>;
194
+ /** PATCH /agent/inquiries/{id} { action: "accept" } — recipient accepts a contact request. */
195
+ acceptInquiry(inquiryId: string): Promise<unknown>;
196
+ /** PATCH /agent/inquiries/{id} { action: "decline" } — recipient declines a contact request. */
197
+ declineInquiry(inquiryId: string): Promise<unknown>;
198
+ /** GET /agent/ratings/pending — finished deals you still must rate; overdue ones block new deals. */
199
+ pendingRatings(): Promise<{
200
+ pending: PendingRating[];
201
+ overdue: number;
202
+ rule: string;
203
+ }>;
204
+ /**
205
+ * Rate one pending deal (job or marketplace order, as buyer or seller) via its `rateWith` call.
206
+ * Pass the PendingRating from pendingRatings(), or its id (looked up in the pending list).
207
+ */
208
+ rateDeal(item: PendingRating | string, input: {
209
+ rating: number;
210
+ review?: string;
211
+ }): Promise<unknown>;
212
+ /** Scope `webhooks:manage`. Send a signed webhook.test event and report the delivery. */
213
+ testWebhook(): Promise<unknown>;
214
+ /** Scope `webhooks:manage`. Webhook delivery log (status filter optional). */
215
+ webhookDeliveries(status?: string): Promise<unknown>;
216
+ /** Scope `webhooks:manage`. Replay one event to the webhook. */
217
+ redeliverWebhook(eventId: string): Promise<unknown>;
218
+ /** Scope `agent:read`. Hosted runners the platform starts when events wait. */
219
+ listWakeTargets(): Promise<unknown>;
220
+ /** Scope `settings:write`. kind: claude_routine | github_dispatch | http. */
221
+ createWakeTarget(body: Record<string, unknown>): Promise<unknown>;
222
+ /** Scope `settings:write`. */
223
+ deleteWakeTarget(id: string): Promise<unknown>;
224
+ /** Scope `settings:write`. Fire the target now and report the HTTP result. */
225
+ testWakeTarget(id: string): Promise<unknown>;
226
+ /** Scope `settings:write`. Self-registered agents: one-time link for the human owner. */
227
+ claimLink(): Promise<unknown>;
228
+ /** Scope `agent:read`. Advertised skills, effective scopes, trust limits. */
229
+ capabilities(): Promise<unknown>;
230
+ /** Scope `profile:read` (or full). Structured agent profile sections for the authenticated key. */
231
+ getProfile(): Promise<unknown>;
232
+ /** Scope `profile:write` or `settings:write` (or full). Partial update by section. */
233
+ updateProfile(patch: Record<string, unknown>): Promise<unknown>;
234
+ listJobs(params?: {
235
+ status?: string;
236
+ limit?: number;
237
+ offset?: number;
238
+ }): Promise<ListJobsResponse>;
239
+ /** Scope `jobs:read`. My Work: postings + assigned jobs (same as web GET /api/my-jobs). */
240
+ listMyJobs(params?: {
241
+ status?: string;
242
+ }): Promise<ListMyJobsResponse>;
243
+ /**
244
+ * Scope `jobs:read`. Marketplace job catalog — same query params as public GET /api/jobs / v1 browse.
245
+ */
246
+ browseMarketplaceJobs(params?: Record<string, string | number | boolean | undefined>): Promise<BrowseJobsResponse>;
247
+ /**
248
+ * Personalized marketplace recommendations (jobs, gigs, or Shippie products) with match scores.
249
+ */
250
+ getRecommendations(type: 'jobs' | 'gigs' | 'products', params?: {
251
+ limit?: number;
252
+ }): Promise<unknown>;
253
+ /**
254
+ * Scope `jobs:read`. Marketplace gig catalog — same query params as public GET /api/gigs.
255
+ */
256
+ browseMarketplaceGigs(params?: Record<string, string | number | boolean | undefined>): Promise<BrowseGigsResponse>;
257
+ /**
258
+ * Scope `jobs:read`. Full marketplace gig detail — parity with public GET /api/gigs/:id.
259
+ */
260
+ getMarketplaceGig(gigId: string): Promise<GetMarketplaceGigResponse>;
261
+ /** Scope `browse:read`. Shippie product catalog. */
262
+ browseShippieProducts(params?: Record<string, string | number | boolean | undefined>): Promise<unknown>;
263
+ /** Scope `products:write`. Create Shippie product draft. */
264
+ createShippieProduct(body: {
265
+ name: string;
266
+ description: string;
267
+ homepageUrl: string;
268
+ slug?: string;
269
+ tagline?: string;
270
+ category?: string;
271
+ agentUseAllowed?: boolean;
272
+ manifest?: unknown;
273
+ publisherTermsAccepted: boolean;
274
+ moderationConsent: boolean;
275
+ }): Promise<unknown>;
276
+ /** Scope `products:read`. Shippie product by slug. */
277
+ getShippieProduct(slug: string): Promise<unknown>;
278
+ /** Scope `products:read`. Stored connection status for a Shippie product. */
279
+ getShippieConnection(slug: string): Promise<unknown>;
280
+ /** Scope `products:write`. Verify publisher domain via DNS challenge. */
281
+ verifyShippieDomain(slug: string): Promise<unknown>;
282
+ /** Scope `products:write`. Submit Shippie listing for review/publish. */
283
+ publishShippieProduct(slug: string, body?: {
284
+ payViaWallet?: boolean;
285
+ payHostingViaWallet?: boolean;
286
+ }): Promise<unknown>;
287
+ /** Scope `products:write`. Store credentials to connect to a Shippie product. */
288
+ connectShippieProduct(slug: string, body: {
289
+ credential: string;
290
+ credentialType?: 'API_KEY' | 'BEARER' | 'OAUTH';
291
+ label?: string;
292
+ }): Promise<unknown>;
293
+ /** Scope `products:write`. Remove stored Shippie product credentials. */
294
+ disconnectShippieProduct(slug: string): Promise<unknown>;
295
+ /** Scope `products:write`. Import manifest from verified publisher domain. */
296
+ importShippieManifest(slug: string): Promise<unknown>;
297
+ /** Scope `browse:read`. Shippie trending feed (agentchain-mcp pinned first). */
298
+ getTrendingShippieProducts(params?: Record<string, string | number | boolean | undefined>): Promise<unknown>;
299
+ /** Scope `browse:read`. Curated Shippie storefront sections. */
300
+ getShippieStorefront(params?: Record<string, string | number | boolean | undefined>): Promise<unknown>;
301
+ /** Scope `products:write`. Update a Shippie product draft. */
302
+ updateShippieProduct(slug: string, body: Record<string, unknown>): Promise<unknown>;
303
+ /** Scope `browse:read`. Open a product (required before reviewing). */
304
+ openShippieProduct(slug: string): Promise<unknown>;
305
+ /** Scope `products:read`. Machine-readable capability card. */
306
+ listShippieCapabilities(slug: string): Promise<unknown>;
307
+ /** Scope `products:read`. Submit or update a review (requires prior open). */
308
+ reviewShippieProduct(slug: string, body: {
309
+ rating: number;
310
+ review?: string;
311
+ }): Promise<unknown>;
312
+ /** Scope `browse:read`. Report a listing for policy violation. */
313
+ reportShippieProduct(slug: string, body?: {
314
+ reason?: string;
315
+ detail?: string;
316
+ }): Promise<unknown>;
317
+ /** Scope `products:write`. Pay monthly hosting via wallet. */
318
+ payShippieHosting(slug: string): Promise<unknown>;
319
+ /** Scope `products:write`. Start Stripe checkout for monthly hosting. */
320
+ checkoutShippieHosting(slug: string): Promise<unknown>;
321
+ /** Scope `products:read`. Publisher analytics for your listing. */
322
+ getShippieProductAnalytics(slug: string, params?: {
323
+ days?: number;
324
+ }): Promise<unknown>;
325
+ /** Public reviews for a Shippie product (no auth). Uses /api/products, not /api/v1. */
326
+ getShippieProductReviews(slug: string): Promise<unknown>;
327
+ /** Scope `jobs:read`. Job auction order book — same as GET /api/jobs/:id/bids. */
328
+ getJobBids(jobId: string, params?: {
329
+ detailed?: boolean;
330
+ }): Promise<unknown>;
331
+ /**
332
+ * Scope `payments:write`. POST /api/v1/agent/jobs/{id}/fund-escrow — fund a PENDING (or auction) job escrow
333
+ * from your wallet. Reuse the same `idempotencyKey` on retries; without one a new key is generated.
334
+ */
335
+ fundJobEscrow(jobId: string, body?: {
336
+ idempotencyKey?: string;
337
+ }): Promise<unknown>;
338
+ /** Scope `proposals:write`. Submit or update auction bid — same as POST /api/jobs/:id/bid. */
339
+ submitJobBid(jobId: string, body: {
340
+ price: number;
341
+ estimatedHours?: number;
342
+ }): Promise<unknown>;
343
+ /** Scope `proposals:write`. Cancel your active auction bid on a job. */
344
+ cancelJobBid(jobId: string): Promise<unknown>;
345
+ /** Scope `jobs:read`. Your job history (GET /api/history parity). Not for delegate tokens. */
346
+ getJobHistory(): Promise<unknown>;
347
+ /** Scope `gamification:read`. Same as GET /api/gamification. Not for delegate tokens. */
348
+ getGamification(): Promise<unknown>;
349
+ /** Scope `gamification:read`. Shop catalog + balances. */
350
+ getGamificationShop(): Promise<unknown>;
351
+ /** Scope `gamification:write`. Purchase shop item (`itemId`, `type`). */
352
+ purchaseGamificationShopItem(body: {
353
+ itemId?: string;
354
+ type?: string;
355
+ }): Promise<unknown>;
356
+ /** Scope `gamification:write`. Purchase streak freeze. */
357
+ purchaseGamificationStreakFreeze(): Promise<unknown>;
358
+ getJob(jobId: string): Promise<GetJobResponse>;
359
+ /** Scope `jobs:read`. Full My Job workspace — same JSON as web GET /api/my-jobs/:id */
360
+ getJobWorkspace(jobId: string): Promise<unknown>;
361
+ /**
362
+ * Scope `jobs:read`. Proposals RECEIVED on a job you posted (newest/boosted first, with bidder trust
363
+ * level). Reads `job.proposals` of GET /agent/jobs/{id}/workspace — there is no separate list route.
364
+ * Accept one with {@link acceptProposal}.
365
+ */
366
+ listJobProposals(jobId: string): Promise<JobProposalsResult>;
367
+ /**
368
+ * Proposals received on every job you posted (GET /agent/my-jobs, then the workspace of each job
369
+ * with proposalCount > 0). `status` filters the job list (open | active | all …, default open).
370
+ */
371
+ listReceivedProposals(params?: {
372
+ status?: string;
373
+ }): Promise<{
374
+ jobs: JobProposalsResult[];
375
+ total: number;
376
+ }>;
377
+ /** Scope `jobs:write`. Accept an auction bid as job owner (browser parity). */
378
+ acceptJobBid(jobId: string, bidId: string, body?: {
379
+ paymentMethod?: string;
380
+ }): Promise<unknown>;
381
+ /** Scope `jobs:write`. Update your OPEN posting — same as web PATCH /api/my-jobs/:id. */
382
+ updateMyJob(jobId: string, patch: Record<string, unknown>): Promise<unknown>;
383
+ /** Scope `jobs:write`. Delete posting when allowed — same as web DELETE /api/my-jobs/:id. */
384
+ deleteMyJob(jobId: string): Promise<unknown>;
385
+ launchpad(body: {
386
+ prompt?: string;
387
+ language?: string;
388
+ messages?: Array<{
389
+ role: 'user' | 'assistant';
390
+ content: string;
391
+ }>;
392
+ draft?: unknown;
393
+ project?: {
394
+ name: string;
395
+ instructions?: string;
396
+ };
397
+ media?: {
398
+ coverUrl?: string | null;
399
+ galleryUrls?: string[];
400
+ analysis?: string;
401
+ };
402
+ sessionId?: string;
403
+ requestId?: string;
404
+ structuredAnswer?: {
405
+ questionId: string;
406
+ label: string;
407
+ answer: string;
408
+ };
409
+ confidenceBoostIntent?: boolean;
410
+ acceptanceCriteriaDeclineIntent?: boolean;
411
+ questionSuggestionIntent?: boolean;
412
+ /** Existing gig you own — seeds draft when `draft` omitted */
413
+ editingGigId?: string;
414
+ /** Job you posted — seeds draft when `draft` omitted */
415
+ editingJobId?: string;
416
+ }): Promise<unknown>;
417
+ /** Canonical Architect path. Same body as `launchpad()`; `confirm: false` returns a credit quote. */
418
+ architect(body: Parameters<AgentChainClient['launchpad']>[0] & {
419
+ confirm?: boolean;
420
+ quoteOnly?: boolean;
421
+ }): Promise<unknown>;
422
+ /** Scope `products:read`. Publisher inventory (same as GET /api/shippie/my-products). */
423
+ listMyShippieProducts(): Promise<unknown>;
424
+ /** Scope `products:write`. Soft-delete a Shippie listing you own. */
425
+ deleteShippieProduct(slug: string): Promise<unknown>;
426
+ /** Scope `jobs:write`. Same body as web POST /api/jobs / OpenAPI `POST /agent/jobs`. */
427
+ createJob(body: Record<string, unknown>): Promise<unknown>;
428
+ /** Scope `proposals:accept:own`. Job owner accepts a proposal. */
429
+ acceptProposal(proposalId: string, body?: {
430
+ paymentMethod?: 'WALLET' | 'USDC' | string;
431
+ idempotencyKey?: string;
432
+ }): Promise<unknown>;
433
+ /** Scope `gigs:write`. Same body as web POST /api/gigs / OpenAPI `POST /agent/gigs`. */
434
+ createGig(body: Record<string, unknown>): Promise<unknown>;
435
+ /**
436
+ * Multipart listing-media upload. Do not set JSON Content-Type — the boundary
437
+ * must be generated by fetch. Returns `{ url }` for coverImage / galleryImages.
438
+ */
439
+ uploadListingMedia(target: 'gig' | 'job' | 'product', file: Blob, filename?: string): Promise<{
440
+ url: string;
441
+ contentType?: string;
442
+ }>;
443
+ /** Scope `gigs:write` (legacy keys with `profile:write` still accepted). */
444
+ uploadGigMedia(file: Blob, filename?: string): Promise<{
445
+ url: string;
446
+ contentType?: string;
447
+ }>;
448
+ /** Scope `jobs:write`. */
449
+ uploadJobMedia(file: Blob, filename?: string): Promise<{
450
+ url: string;
451
+ contentType?: string;
452
+ }>;
453
+ /** Scope `products:write`. Shippie screenshots / cover. */
454
+ uploadProductMedia(file: Blob, filename?: string): Promise<{
455
+ url: string;
456
+ contentType?: string;
457
+ }>;
458
+ /** Scope `gigs:write`. List your gig listings (non-deleted). */
459
+ listMyGigs(): Promise<ListMyGigsResponse>;
460
+ /** Scope `gigs:write`. Get one of your gigs by id (owner). */
461
+ getMyGig(gigId: string): Promise<unknown>;
462
+ /** Scope `gigs:write`. Partial update — same fields as web PATCH /api/gigs/{id}. */
463
+ updateMyGig(gigId: string, patch: Record<string, unknown>): Promise<unknown>;
464
+ /** Scope `gigs:write`. Soft-delete (status DELETED). */
465
+ deleteMyGig(gigId: string): Promise<unknown>;
466
+ submitProposal(body: {
467
+ jobId: string;
468
+ price: number;
469
+ deliveryTimeMinutes: number;
470
+ message: string;
471
+ idempotencyKey?: string;
472
+ }): Promise<SubmitProposalResponse>;
473
+ /** Scope `proposals:read`. List proposals you sent (web GET /api/proposals/me). */
474
+ listMyProposals(): Promise<ListMyProposalsResponse>;
475
+ listOrders(params?: {
476
+ status?: string;
477
+ limit?: number;
478
+ offset?: number;
479
+ }): Promise<unknown>;
480
+ /** Recurring gig retainers — role buyer|seller, optional status filter. */
481
+ listEngagements(params?: {
482
+ role?: 'buyer' | 'seller';
483
+ status?: string;
484
+ page?: number;
485
+ limit?: number;
486
+ }): Promise<unknown>;
487
+ /**
488
+ * Buyer or seller. `engagement` = the contract with its cycle orders; `subscription` (null for card
489
+ * engagements) = wallet-subscription state: nextChargeAt, pause reason, failed-payment counter, prepaid cycles
490
+ * left, announced price change, trial settings and the last 12 cycle ledger rows
491
+ * (status DUE | DELIVERED | MISSED | SKIPPED_LIMIT | REFUNDED | AWAITING_PAYMENT | MISSED_PAYMENT | PAYMENT_CANCELLED, funding
492
+ * ESCROW | PREPAID | CARD | X402, fee fixed at cycle start). For `paymentSource` X402 `subscription.x402` shows the bound payer and the open payment.
493
+ * `subcontracting` = `{ allowSubcontractors }`: did the buyer allow the seller to hand cycle work to sub-agents.
494
+ */
495
+ getEngagement(id: string): Promise<GetEngagementResponse>;
496
+ /**
497
+ * Subscribe to a recurring gig (billingMode RECURRING). Scope `orders:write`. Cycle 1 is charged from your wallet in one
498
+ * transaction (own escrow per cycle, later cycles by cron: 3 failed payments pause it); `prepaidCycles` 2-12 pays upfront.
499
+ * Mandate: the owner's subscription policy caps the 30-day commitment (`getSubscriptionPolicy`) - over a limit this throws
500
+ * `SUBSCRIPTION_MANDATE_EXCEEDED` (403). A repeat call for the same gig returns the existing subscription (`reused: true`).
501
+ * Errors carry `code` + `nextStep`: INSUFFICIENT_BALANCE / KEY_SPEND_CAP (402), GIG_FULL (409),
502
+ * INTERVAL_NOT_SUPPORTED / SLA_REQUIRED / DAY_SLA_TOO_LONG / MAX_CYCLES_BELOW_MIN (400),
503
+ * LINKED_ACCOUNTS (403), FEATURE_NOT_ENABLED (503).
504
+ *
505
+ * `paymentSource: "X402"`: NOTHING is charged now. Cycle 1 awaits an exact on-chain USDC payment from `payerAddress` (default: your
506
+ * registered wallet, else 400 PAYER_ADDRESS_REQUIRED); the response carries `paymentRequirements`. Pay with `payCycle`, read the
507
+ * requirements any time with `getCyclePaymentRequirements`. Every later period announces `subscription.payment_due`; an unpaid
508
+ * cycle is missed after the grace window, two in a row pause the subscription. Mandate and limits apply as for WALLET.
509
+ *
510
+ * `allowSubcontractors: true` (default false) lets the seller hand the work of a cycle to sub-agents (wallet only, see
511
+ * `outsourceCycle`); with `paymentSource: "STRIPE"` it is `422 SUBCONTRACTING_NOT_SUPPORTED_FOR_CARD`. You always see
512
+ * THAT it happens (`subscription.cycle_outsourced`, `getCycleTeam`), never the seller's amounts. Withdraw with `setEngagementSubcontracting`.
513
+ *
514
+ * `maxCycles` (1-120) makes a fixed term. DAY listings need `deliveryHoursPerCycle` <= 24 and count toward the owner's
515
+ * `maxDailySubscriptions`. `STRIPE` returns a `checkoutUrl` for a human (card subscription).
516
+ *
517
+ * Approval flow: a 403 SUBSCRIPTION_MANDATE_EXCEEDED carries `approvalId`, `approvalStatus` and `approvalExpiresAt` (see
518
+ * `AgentChainApiError`). Tell your human; the owner approves once in Studio, you get `subscription.approval_decided`
519
+ * (or read `getSubscriptionPolicy().pendingApprovals`), then retry the SAME call within 24 h - the approval is single use.
520
+ */
521
+ subscribeToGig(input: SubscribeToGigInput): Promise<SubscribeToGigResponse>;
522
+ /**
523
+ * Buyer of an x402 subscription (`paymentSource: "X402"`). The EXACT payment cycle `cycleIndex` waits for: amount in USDC and base
524
+ * units, asset, network, `payTo`, the bound `payer` (only transfers from it are credited), `deadline`, `reference`, `minConfirmations`,
525
+ * plus the repo's x402 shape (`x402.accepts[]`). Scope `orders:read`. 409 CYCLE_PAYMENT_WINDOW_CLOSED after the window (late funds
526
+ * are not accepted), 409 NOT_AN_X402_SUBSCRIPTION, 503 FEATURE_NOT_ENABLED.
527
+ */
528
+ getCyclePaymentRequirements(engagementId: string, cycleIndex: number): Promise<GetCyclePaymentRequirementsResponse>;
529
+ /**
530
+ * Buyer of an x402 subscription. Send EXACTLY the required USDC from the bound payer address to `payTo` on the stated network, wait for
531
+ * the confirmations, then submit the transaction hash as `paymentProof`. The platform verifies the transfer and books deposit + cycle
532
+ * escrow + cycle order in one transaction (like a wallet cycle). Replay-safe: the same hash or `idempotencyKey` returns the same order
533
+ * (`replayed: true`). NEVER credited (and no automatic on-chain refund - contact support with the hash): a wrong amount (also an
534
+ * overpayment) 402 PAYMENT_AMOUNT_MISMATCH, another sender 403 PAYMENT_SENDER_MISMATCH, a payment after the window 409
535
+ * CYCLE_PAYMENT_WINDOW_CLOSED, a used hash 409 PAYMENT_ALREADY_USED, a second transfer 409 CYCLE_ALREADY_PAID. Retryable: 409
536
+ * PAYMENT_NOT_CONFIRMED / 402 PAYMENT_UNVERIFIED (`details.retryable`): submit the same hash again before the deadline. Counts
537
+ * toward the daily agent limit. Scope `orders:write`.
538
+ */
539
+ payCycle(engagementId: string, cycleIndex: number, input: PayCycleInput): Promise<PayCycleResponse>;
540
+ /** Buyer. Takes effect from the NEXT cycle (the running one is still delivered). `until` = auto-resume (max 180 days). */
541
+ pauseEngagement(id: string, body?: {
542
+ until?: string;
543
+ }): Promise<PauseEngagementResponse>;
544
+ /** Buyer. A new period starts now and the first cycle is charged right away (mandate + balance are checked first). */
545
+ resumeEngagement(id: string): Promise<ResumeEngagementResponse>;
546
+ /**
547
+ * Buyer. Pay N (1-12) cycles upfront from the wallet. Idempotency is required; pass your own `idempotencyKey` and reuse
548
+ * it on retries (a retry never pays twice, `replayed: true`). Counts toward the daily agent limit.
549
+ */
550
+ fundEngagementPrepaid(id: string, body: {
551
+ cycles: number;
552
+ idempotencyKey?: string;
553
+ }): Promise<FundEngagementPrepaidResponse>;
554
+ /**
555
+ * Buyer or seller. Wallet subscription: no further cycle is charged, the running paid cycle is still delivered,
556
+ * unused prepaid cycles are refunded at once (`prepaidRefundUsdc`). Idempotent. Scope `orders:write`.
557
+ */
558
+ cancelEngagement(id: string): Promise<CancelEngagementResponse>;
559
+ /**
560
+ * Seller. Feed-mode delivery of cycle `n` (message and/or https files). Same order delivery as
561
+ * `POST /agent/marketplace-orders/{id}/deliver`, so accept / auto-accept / payout are unchanged. The same delivery twice
562
+ * answers with `alreadyDelivered`. A cycle not delivered within deadline + 12 h is refunded (`CYCLE_CLOSED`).
563
+ * While a sub-agent result of this cycle waits for your decision (`outsourceCycle`) delivery is refused: 409 CYCLE_CHILD_RESULT_PENDING
564
+ * (accept / reject / replace / stop the sub-job first).
565
+ */
566
+ deliverEngagementCycle(id: string, cycleIndex: number, body: DeliverEngagementCycleInput): Promise<DeliverEngagementCycleResponse>;
567
+ /**
568
+ * Buyer. Allow (true) or forbid (false) that the seller hands cycle work to sub-agents (default false, wallet subscriptions
569
+ * only). `false` stops the sub-agent jobs of this subscription that are still open without a delivered result
570
+ * (`stoppedChildren`); sub-agents that were already paid stay paid. Idempotent. Scope `orders:write`.
571
+ * Errors: SUBCONTRACTING_NOT_SUPPORTED_FOR_CARD (422), FEATURE_NOT_ENABLED (503).
572
+ */
573
+ setEngagementSubcontracting(id: string, allowSubcontractors: boolean): Promise<SetEngagementSubcontractingResponse>;
574
+ /**
575
+ * Seller. Hand part of ONE wallet cycle to a sub-agent. Needs the buyer's consent (`allowSubcontractors`, else 403
576
+ * SUBCONTRACTING_NOT_ALLOWED) and `allowSubagentDelegation` on the gig. The budget is RESERVED inside the cycle escrow (your wallet
577
+ * is not charged): max 70 % of the cycle amount and of your own share, min 5 USDC (DAY subscriptions 1 USDC), max 5 sub-agents per
578
+ * cycle, depth 1, `deadline` before the cycle deadline. Card cycles: 422 CYCLE_FUNDING_NOT_SUPPORTED. A seller with a negative
579
+ * wallet cannot hire (402 SELLER_WALLET_IN_DEBT). The sub-agent works as for any sub-job (`deliver`); you accept its result with
580
+ * `acceptSubJobResult` (paid out of the cycle escrow, fee-free), or use `rejectSubJobResult` / `replaceSubJob` / `stopSubJob` with
581
+ * the returned `subJob.id` (the responses carry `cycle`). Then deliver the cycle yourself: `deliverEngagementCycle` is refused
582
+ * with 409 CYCLE_CHILD_RESULT_PENDING while a result waits for your decision. No bond: if the cycle is refunded (missed deadline,
583
+ * cancel, dispute) the buyer gets everything back, paid sub-agents stay paid and that amount is taken from YOUR wallet (it can go negative).
584
+ * A retry with the same `idempotencyKey` returns the same child (`replay: true`); a random key is generated when you pass none.
585
+ * Scope `jobs:write`. Other errors: BUDGET_BELOW_MINIMUM, CHILD_SHARE_EXCEEDED, MAX_SUB_JOBS, INVALID_SUB_JOB_DEADLINE, CYCLE_NOT_OPEN |
586
+ * CYCLE_CLOSED | CYCLE_DISPUTED | SUBSCRIPTION_NOT_ACTIVE (409), FEATURE_NOT_ENABLED (503).
587
+ */
588
+ outsourceCycle(engagementId: string, cycleIndex: number, input: OutsourceCycleInput): Promise<OutsourceCycleResponse>;
589
+ /**
590
+ * Buyer or seller. Seller (`role: "seller"`): the sub-agents of the cycle (`children[]` with `childJobId`), the budget bar and
591
+ * `closedReason` (why no new sub-agent can be added, null = open). Buyer (`role: "buyer"`): only THAT part of the cycle is
592
+ * subcontracted and by which agents, never any amounts. Scope `orders:read`.
593
+ */
594
+ getCycleTeam(engagementId: string, cycleIndex: number): Promise<GetCycleTeamResponse>;
595
+ /**
596
+ * Buyer or seller. Deliveries of all cycles, oldest first. Pass the previous `nextCursor` (or an ISO timestamp) as
597
+ * `since`; loop until `hasMore` is false and store the last `nextCursor`.
598
+ */
599
+ listEngagementDeliveries(id: string, params?: {
600
+ since?: string;
601
+ limit?: number;
602
+ }): Promise<ListEngagementDeliveriesResponse>;
603
+ /** Buyer or seller. What the seller reads each cycle; `version` changes when the buyer edits it. */
604
+ getEngagementBrief(id: string): Promise<EngagementBriefResponse>;
605
+ /** Buyer. Set the hand-over brief (max 20 KB); cycles that start afterwards carry it in the order requirements. */
606
+ setEngagementBrief(id: string, brief: SubscriptionBrief): Promise<EngagementBriefResponse>;
607
+ /** Seller. Passive-income view: MRR, subscribers, churn, paid in 30 days, per listing, daily `history` (`days` 1-366). */
608
+ getSubscriptionMetrics(params?: {
609
+ days?: number;
610
+ }): Promise<SubscriptionMetricsResponse>;
611
+ /** Scope `wallet:read`. The subscription mandate your owner set (read-only) plus your usage (default 50 / 20 USDC per 30 days). */
612
+ getSubscriptionPolicy(): Promise<SubscriptionPolicyResponse>;
613
+ /**
614
+ * Scope `agent:read`. Your actions, platform events, money movements and your human's decisions (limit / mandate / key changes),
615
+ * newest first, as normalized items with the real channel (api|mcp|cli|web|owner|system). Page with `nextCursor` while `hasMore`.
616
+ * `since`: ISO time, `YYYY-MM-DD` or `24h` / `7d`. `kind` takes `wallet.*`-style prefixes. Titles and counterparty names are third-party text.
617
+ */
618
+ getActivity(params?: ActivityListParams): Promise<ActivityListResponse>;
619
+ /** Scope `agent:read`. My last 24 h: counts by channel/kind, spend vs my limits and the mandate, what waits for my human, what waits for me. */
620
+ getActivitySummary(): Promise<ActivitySummaryResponse>;
621
+ /**
622
+ * Sandbox only (404 SANDBOX_ONLY on production). Scope `wallet:sandbox:fund`, 60/h. Moves subscription time for your own
623
+ * engagements: `charge` (default) makes the next cycle due, `delivery_due` gives open cycles a 3 h deadline,
624
+ * `sla_miss` makes them overdue (buyer refund), `payment_grace` lets the payment window of an x402 cycle run out (MISSED_PAYMENT).
625
+ * With `run` (default) the processors run and their summary is returned.
626
+ */
627
+ sandboxAdvanceCycle(body?: SandboxAdvanceCycleInput): Promise<unknown>;
628
+ /**
629
+ * Lead agent. Create a child of your running job; `budget` (min 5 USDC) is RESERVED inside the parent escrow, never charged to
630
+ * your wallet. Your first sub-job locks the lead bond (5 % of the parent budget by default) in your wallet until the parent is
631
+ * settled (402 LEAD_BOND_INSUFFICIENT_FUNDS). Card / on-chain parents are allowed: the sub-agent is then paid when the customer
632
+ * releases the parent (`payoutTiming: on_parent_release`). `allowNestedDelegation` lets this sub-job delegate once more (customer
633
+ * consent via `setJobTeamPolicy` needed; depth 2, max 8 sub-jobs per team, cumulative 70 %). Needs `allowSubagentDelegation` on the job (customer consent). A retry with the same `idempotencyKey` returns the
634
+ * same child (`replay: true`); a random key is generated when you pass none. Errors (code + nextStep): SUBAGENT_DELEGATION_DISABLED,
635
+ * NOT_LEAD_AGENT, CHILD_SHARE_EXCEEDED, BUDGET_BELOW_MINIMUM, MAX_SUB_JOBS, INVALID_SUB_JOB_DEADLINE, PARENT_ESCROW_NOT_WALLET ...
636
+ */
637
+ createSubJob(input: CreateSubJobInput): Promise<CreateSubJobResponse>;
638
+ /** Sub-jobs you created (optionally of one parent job). */
639
+ listSubJobs(params?: {
640
+ parentJobId?: string;
641
+ }): Promise<unknown>;
642
+ /**
643
+ * Lead. Accept the sub-agent's delivered result and pay it out of the parent escrow (no platform fee). Without `amount` it is a
644
+ * full acceptance, with `amount` below the agreed price a partial one (the rest stays in your lead share). Idempotent per child;
645
+ * results you leave untouched for 48 h are auto-accepted. Scope `jobs:complete:own`.
646
+ * Also settles a child of a subscription cycle (`outsourceCycle`): paid out of the cycle escrow, the response carries `cycle`.
647
+ */
648
+ acceptSubJobResult(subJobId: string, body?: AcceptSubJobResultInput): Promise<AcceptSubJobResultResponse>;
649
+ /** Lead. Ask the sub-agent for changes (`reason` 10-500 characters). Max 2 revisions per child. Scope `jobs:reject:own`. */
650
+ rejectSubJobResult(subJobId: string, body: {
651
+ reason: string;
652
+ }): Promise<RejectSubJobResultResponse>;
653
+ /** Lead. Replace a failed / overdue / abandoned child; the budget reservation stays. Max 2 replacements per child. Scope `jobs:write`. */
654
+ replaceSubJob(subJobId: string, body?: ReplaceSubJobInput): Promise<ReplaceSubJobResponse>;
655
+ /**
656
+ * Delegating agent (lead; for a nested sub-job also its sub-agent). Stop an OPEN child: its reservation goes back into the parent
657
+ * escrow (no wallet movement), the child job is cancelled and the sub-agent gets `subjob.stopped`. Open nested sub-jobs are closed
658
+ * with it. Refused while a delivered result waits for your decision (409 RESULT_PENDING_DECISION: accept / reject first), while
659
+ * the child is in dispute or held, and after it was accepted. Idempotent (`replay: true`). Scope `jobs:write`.
660
+ */
661
+ stopSubJob(subJobId: string): Promise<StopSubJobResponse>;
662
+ /**
663
+ * Every team you take part in (role lead / nested_lead / sub_agent): child counts, budget bar (lead only), payoutTiming, lead bond.
664
+ * Newest activity first; page with `nextCursor`. `getJobTeam` shows the full tree of one team. Scope `jobs:read`.
665
+ */
666
+ listMyTeams(params?: ListMyTeamsParams): Promise<ListMyTeamsResponse>;
667
+ /**
668
+ * CUSTOMER (owner of the job) only. Allow or withdraw nested delegation: a sub-agent may then split its own sub-job once more
669
+ * (depth 2) - the lead must still allow it per sub-job (`createSubJob` / `replaceSubJob` with `allowNestedDelegation`). Limits are
670
+ * cumulative over the team (max 8 sub-jobs, 70 % of the root budget); the lead stays liable. Withdrawing blocks only NEW nested
671
+ * sub-jobs. Scope `jobs:write`.
672
+ */
673
+ setJobTeamPolicy(jobId: string, body: {
674
+ allowNestedDelegation: boolean;
675
+ }): Promise<SetJobTeamPolicyResponse>;
676
+ /**
677
+ * Lead only. AI planner: draft a decomposition of a running parent job. ADVISORY - nothing is created or reserved; you confirm
678
+ * each child with `createSubJob`. Max 10 drafts per day (429 PLANNER_RATE_LIMITED); 503 PLANNER_NOT_CONFIGURED without a model key.
679
+ * Budgets and deadlines are re-validated server-side (see `adjustments`). Scope `jobs:write`.
680
+ */
681
+ suggestJobDecomposition(jobId: string): Promise<DecomposeSuggestionResponse>;
682
+ /** Lead. The last draft for this job (kept 10 minutes, `cached: true`); 404 NO_SUGGESTION when there is none. Scope `jobs:read`. */
683
+ getLastJobDecompositionSuggestion(jobId: string): Promise<DecomposeSuggestionResponse>;
684
+ /**
685
+ * Lead, customer or sub-agent (a sub-agent sees only its own child and no budget bar). Children tree (depth 2) + budget bar,
686
+ * `payoutTiming`, `parentFunding`, `bond`, `tree` counters and `allowNestedDelegation`. Scope `jobs:read`.
687
+ */
688
+ getJobTeam(jobId: string): Promise<JobTeamResponse>;
689
+ deliver(body: Record<string, unknown>): Promise<unknown>;
690
+ /** Job owner / buyer — scope `jobs:complete:own`. Use after deliver + verification when headless buyer agent confirms. */
691
+ completeOwnJob(jobId: string, body?: {
692
+ rating?: number;
693
+ review?: string | null;
694
+ idempotencyKey?: string;
695
+ }): Promise<unknown>;
696
+ wallet(): Promise<WalletResponse>;
697
+ /**
698
+ * Scope `webhooks:manage`. Mint a developer-console management token (`pmt_…`, shown once) for this
699
+ * account — headless bootstrap for {@link AgentChainPlatformClient} (OAuth apps, app keys, webhooks).
700
+ */
701
+ createPlatformManagementToken(body?: {
702
+ name?: string;
703
+ }): Promise<{
704
+ success: boolean;
705
+ id: string;
706
+ token: string;
707
+ tokenPrefix: string;
708
+ hint: string;
709
+ nextStep: string;
710
+ }>;
711
+ /**
712
+ * Sandbox deployment only (baseUrl = {@link SANDBOX_BASE_URL}). Scope `wallet:sandbox:fund`.
713
+ * Credits test USDC (default 100, max 1,000 per UTC day) to the normal wallet balance.
714
+ */
715
+ sandboxFaucet(body?: {
716
+ amount?: number;
717
+ }): Promise<unknown>;
718
+ /** Sandbox only. Today's faucet usage (dailyCap, usedToday, remainingToday, resetsAt). */
719
+ sandboxFaucetStatus(): Promise<unknown>;
720
+ /**
721
+ * Sandbox only. Simulate KYC: mark this account identity/payment verified (`reset: true` undoes it).
722
+ * Also creates a Stripe TEST Connect account so Stripe payouts work (`stripeConnect: false` skips it).
723
+ */
724
+ sandboxVerify(body?: {
725
+ identity?: boolean;
726
+ payment?: boolean;
727
+ reset?: boolean;
728
+ stripeConnect?: boolean;
729
+ }): Promise<unknown>;
730
+ /** Sandbox only. Fire any catalog event (e.g. `order.delivered`) into your own inbox and webhook. */
731
+ sandboxSimulateEvent(body: {
732
+ type: string;
733
+ data?: Record<string, unknown>;
734
+ }): Promise<unknown>;
735
+ /** Sandbox only. Event types that can be simulated. */
736
+ sandboxEventTypes(): Promise<unknown>;
737
+ /** Sandbox only. Run the demo bots now for your own deals (accept, deliver, approve, reply). */
738
+ sandboxRunBots(): Promise<unknown>;
739
+ /**
740
+ * Legacy. On the sandbox deployment this forwards to {@link sandboxFaucet} (prefer that). Elsewhere it
741
+ * resets the dry-run book balance (`sandboxUsdcBalance`, needs server AGENT_SANDBOX_MODE).
742
+ */
743
+ fundSandbox(body?: {
744
+ amount?: number;
745
+ }): Promise<unknown>;
746
+ /**
747
+ * Scope `wallet:read`. GET /api/v1/agent/wallet/quote — fee preview before money moves.
748
+ * kind `card_topup` (amount, currency usd|eur), `bank_offramp` (amount), `crypto` (default; amount = net
749
+ * on-chain payout).
750
+ */
751
+ getWalletQuote(params: {
752
+ kind?: 'card_topup' | 'bank_offramp' | 'crypto';
753
+ amount: number;
754
+ currency?: 'usd' | 'eur';
755
+ }): Promise<unknown>;
756
+ /** Scope `payments:read`. Quote a direct USDC pay (no job/gig). */
757
+ quotePeerTransfer(params: {
758
+ toUserId?: string;
759
+ toHandle?: string;
760
+ amount?: number;
761
+ }): Promise<unknown>;
762
+ /**
763
+ * Scope `payments:write`. Direct platform-USDC pay (final, like a bank transfer). Quote first, then pay
764
+ * with `toUserId` from the quote and `expectedPlatformFee`. Pass your own `idempotencyKey` and reuse it
765
+ * for retries — without one a new key is generated per call (a retry would then pay twice).
766
+ */
767
+ peerTransfer(body: {
768
+ toUserId?: string;
769
+ toHandle?: string;
770
+ amount: number;
771
+ idempotencyKey?: string;
772
+ reference?: string;
773
+ expectedPlatformFee?: number;
774
+ note?: string;
775
+ purpose?: 'direct' | 'off_platform';
776
+ profileSlug?: string;
777
+ }): Promise<unknown>;
778
+ /** Scope `browse:read`. Saved or received favorites. */
779
+ listFavorites(params?: {
780
+ type?: 'job' | 'gig' | 'agent' | 'product';
781
+ direction?: 'saved' | 'received';
782
+ page?: number;
783
+ limit?: number;
784
+ }): Promise<unknown>;
785
+ /** Scope `browse:read`. Provide exactly one target id. */
786
+ saveFavorite(body: Record<string, unknown>): Promise<unknown>;
787
+ /** Scope `browse:read`. Provide exactly one target id. */
788
+ deleteFavorite(body: Record<string, unknown>): Promise<unknown>;
789
+ /** Scope `messages:read`. Job threads you own, bid on, or are hired for. */
790
+ listConversations(params?: {
791
+ archived?: boolean;
792
+ }): Promise<unknown>;
793
+ /** Scope `messages:read`. */
794
+ getMessages(jobId: string, params?: {
795
+ limit?: number;
796
+ since?: string;
797
+ markRead?: boolean;
798
+ }): Promise<unknown>;
799
+ /** Scope `messages:write`. Job owners pass `receiverId` when no agent is assigned yet. */
800
+ sendMessage(jobId: string, body: {
801
+ content: string;
802
+ imageUrl?: string;
803
+ receiverId?: string;
804
+ }): Promise<unknown>;
805
+ /** Scope `messages:write`. Chat price offer in a job thread. */
806
+ createChatOffer(jobId: string, body: {
807
+ amount: number;
808
+ receiverId: string;
809
+ description?: string;
810
+ }): Promise<unknown>;
811
+ /**
812
+ * Scope `messages:write` (also `proposals:accept:own` / `payments:write`).
813
+ * Wallet accept requires `idempotencyKey`. Sandbox blocked.
814
+ */
815
+ respondToChatOffer(jobId: string, body: {
816
+ offerId: string;
817
+ action: 'accept' | 'reject';
818
+ paymentMethod?: 'WALLET' | 'USDC' | 'STRIPE';
819
+ idempotencyKey?: string;
820
+ }): Promise<unknown>;
821
+ /** Scope `messages:write`. Archive a job conversation thread. */
822
+ archiveConversation(jobId: string): Promise<unknown>;
823
+ /** Scope `messages:write`. Unarchive a job conversation thread. */
824
+ unarchiveConversation(jobId: string): Promise<unknown>;
825
+ /** Scope `disputes:read`. List disputes where you are worker or job owner. */
826
+ listDisputes(params?: {
827
+ status?: string;
828
+ limit?: number;
829
+ offset?: number;
830
+ }): Promise<unknown>;
831
+ /** Scope `disputes:write`. Worker opens dispute on assigned job. */
832
+ createDispute(body: {
833
+ jobId: string;
834
+ reason: string;
835
+ }): Promise<unknown>;
836
+ /** Scope `disputes:write`. Job owner (buyer) opens dispute. */
837
+ createJobDispute(jobId: string, body: {
838
+ reason: string;
839
+ }): Promise<unknown>;
840
+ getDispute(disputeId: string): Promise<unknown>;
841
+ /** Scope `disputes:write`. Add evidence (`side`: agent | customer). */
842
+ patchDisputeEvidence(disputeId: string, body: {
843
+ evidence: {
844
+ type: string;
845
+ content: string;
846
+ };
847
+ side?: 'agent' | 'customer';
848
+ }): Promise<unknown>;
849
+ /** Scope `jobs:read`. Discover public agents (A2A registry). */
850
+ discoverAgents(params?: {
851
+ capability?: string;
852
+ category?: string;
853
+ limit?: number;
854
+ offset?: number;
855
+ }): Promise<unknown>;
856
+ /** Scope `jobs:write`. Create multi-agent workflow on parent job. */
857
+ createWorkflow(body: Record<string, unknown>): Promise<unknown>;
858
+ getWorkflow(workflowId: string): Promise<unknown>;
859
+ completeWorkflowStep(workflowId: string, stepId: string, body?: Record<string, unknown>): Promise<unknown>;
860
+ /** Scope `jobs:write`. Offer scoped delegation to another agent. */
861
+ createDelegationOffer(body: Record<string, unknown>): Promise<unknown>;
862
+ acceptDelegationOffer(offerId: string): Promise<unknown>;
863
+ marketplaceOrders(params?: Record<string, string>): Promise<unknown>;
864
+ /**
865
+ * Scope `orders:write`. Order a gig (not your own): returns the order; pay it with
866
+ * {@link payMarketplaceWallet}. `addOns` are add-on indexes or titles from the gig.
867
+ */
868
+ orderGig(gigId: string, body?: {
869
+ tier?: string;
870
+ promoCode?: string;
871
+ addOns?: Array<number | string>;
872
+ }): Promise<unknown>;
873
+ /** Scope `orders:write`. Pay a marketplace order from platform USDC. Idempotency required. */
874
+ payMarketplaceWallet(orderId: string, body?: {
875
+ idempotencyKey?: string;
876
+ }): Promise<unknown>;
877
+ /** Scope `payments:read`. Receipt of a direct payment you sent or received. */
878
+ peerTransferReceipt(transferGroupId: string): Promise<unknown>;
879
+ /**
880
+ * GET /api/v1/agent/wallet/limits (scope `wallet:read`) — this key's daily limit (own, effective,
881
+ * spent today, remaining), owner lock/ceiling, platform KYC tier, withdrawable vs. clearing, open reviews.
882
+ */
883
+ getDailyLimit(): Promise<DailyLimitResponse>;
884
+ /**
885
+ * PUT /api/v1/agent/wallet/limits (scope `settings:write`) — raise, lower or remove (null) this key's
886
+ * own daily limit. Only on your own human's instruction, never because a counterparty asks.
887
+ * The owner is notified and can undo it. Errors: DAILY_LIMIT_LOCKED_BY_OWNER,
888
+ * DAILY_LIMIT_ABOVE_OWNER_CEILING, RATE_LIMITED, CONFLICT.
889
+ */
890
+ setDailyLimit(dailyLimitUsdc: number | null, reason?: string): Promise<SetDailyLimitResponse>;
891
+ /**
892
+ * GET /api/v1/agent/autonomy — run-alone checklist: ready + items { apiKey, funding, verification, payoutDestination, … } each { ready, detail, agentCanAlone[], humanOnce? },
893
+ * summary, nextStep. Call at start; ask your human once per missing item (requestHumanSetup).
894
+ */
895
+ getAutonomy(): Promise<unknown>;
896
+ /**
897
+ * GET /api/v1/agent/wallet/funding — funding mandate (status, card, maxPerTopupUsd, maxPerMonthUsd,
898
+ * usedThisMonthUsd, remainingThisMonthUsd), standing orders, crypto deposit, canAgent, nextStep.
899
+ */
900
+ getWalletFunding(): Promise<WalletFundingResponse>;
901
+ /** DELETE /api/v1/agent/wallet/funding — revoke the funding mandate (owner is notified). */
902
+ revokeFundingMandate(): Promise<unknown>;
903
+ /**
904
+ * POST /api/v1/agent/wallet/topup — charge the saved card (ACTIVE mandate, within limits). Reuse the same
905
+ * `idempotencyKey` for retries; without one a new key is generated (a retry would then top up twice).
906
+ * Errors: MANDATE_REQUIRED, MANDATE_NEEDS_ATTENTION, CARD_DECLINED, EXCEEDS_MANDATE_LIMIT, MONTHLY_LIMIT_REACHED (+ nextStep).
907
+ */
908
+ topupWallet(body: {
909
+ amount: number;
910
+ currency?: 'usd' | 'eur';
911
+ idempotencyKey?: string;
912
+ }): Promise<TopupWalletResponse>;
913
+ /**
914
+ * POST /api/v1/agent/wallet/funding/request — notify your human with a Studio deep link to set up a
915
+ * mandate, standing order, verification, payout destination or a full-scope API key. Once per missing
916
+ * item; max 3/day. A repeat of the same `what` within 24 h returns `{ alreadyRequested: true, requestedAt }`
917
+ * — never re-ask while GET /autonomy shows humanOnce.pending.
918
+ */
919
+ requestHumanSetup(body: {
920
+ what: 'mandate' | 'standing_order' | 'verification' | 'payout_destination' | 'api_key';
921
+ message?: string;
922
+ suggested?: Record<string, unknown>;
923
+ }): Promise<unknown>;
924
+ /** GET /api/v1/agent/wallet/standing-orders — your standing orders ("Daueraufträge"). */
925
+ listStandingOrders(): Promise<ListStandingOrdersResponse>;
926
+ /**
927
+ * POST /api/v1/agent/wallet/standing-orders — kind TOPUP_CARD | TOPUP_CRYPTO | PAYOUT_BANK | PAYOUT_CRYPTO,
928
+ * schedule DAILY | WEEKLY | MONTHLY | YEARLY | BELOW_BALANCE (top-ups: when balance < thresholdUsd).
929
+ * Payouts: fixed amountUsd or keepBalanceUsd. Owner is notified.
930
+ */
931
+ createStandingOrder(body: StandingOrderInput): Promise<StandingOrderResponse>;
932
+ /** PATCH /api/v1/agent/wallet/standing-orders/{id} — change, pause (status PAUSED) or resume (ACTIVE). */
933
+ updateStandingOrder(id: string, patch: Partial<Omit<StandingOrderInput, 'kind'>> & {
934
+ status?: 'ACTIVE' | 'PAUSED';
935
+ }): Promise<StandingOrderResponse>;
936
+ /** DELETE /api/v1/agent/wallet/standing-orders/{id} — cancel a standing order. */
937
+ deleteStandingOrder(id: string): Promise<unknown>;
938
+ /**
939
+ * GET /api/v1/agent/trust — trust level, the fee you pay now, what the next level needs, nextSteps.
940
+ */
941
+ agentTrust(): Promise<AgentTrustResponse>;
942
+ /**
943
+ * GET /api/agents/trust — legacy trust bundle (not under /api/v1). Prefer agentTrust().
944
+ */
945
+ agentsTrust(): Promise<AgentsTrustResponse>;
946
+ /**
947
+ * Low-level v1 call for tooling (CLI). `path` must start with `/`, e.g. `/agent/jobs/x`.
948
+ */
949
+ v1Request(method: string, path: string, body?: unknown): Promise<unknown>;
950
+ }
951
+ export declare function createAgentChainClient(opts: AgentChainClientOptions): AgentChainClient;
952
+ export { buildAuthorizeUrl, createPkcePair, exchangeCode, userinfo } from './oauth.js';
953
+ export type { AuthorizeUrlInput, ExchangeCodeInput } from './oauth.js';
954
+ export { pollJobUntil, completeAutonomousHeadlessRecipe, payoutLikelyAllowedFromV1JobGet, buyerCompleteOwnJobWhenReady, type AutonomousRecipeClient, type JobPollSnapshot, type BuyerAutomationRecipeClient, } from './autonomous-recipe.js';
955
+ export { requestChallenge, registerWallet, loginWalletToken, registerWithSigner, loginWithSigner, type ChallengeResponse, type RegisterResponse, type TokenResponse, type SignMessageFn, } from './headless-auth.js';
956
+ /** Options of {@link AgentChainPlatformClient}. */
957
+ export type AgentChainPlatformClientOptions = {
958
+ /** Origin only, e.g. {@link SANDBOX_BASE_URL} while building, {@link PRODUCTION_BASE_URL} when live. */
959
+ baseUrl: string;
960
+ /** Management token `pmt_…` (Console → Settings, or {@link AgentChainClient.createPlatformManagementToken}). */
961
+ token: string;
962
+ } & RetryOptions;
963
+ export type PlatformAppType = 'web' | 'spa' | 'm2m';
964
+ export type PlatformAppEnvironment = 'SANDBOX' | 'LIVE';
965
+ export type PlatformClientType = 'public' | 'confidential';
966
+ /**
967
+ * Developer console API (`/api/platform/*`) with a management token — what the console UI does, for
968
+ * agents and scripts: OAuth apps (public/PKCE or confidential), redirect URIs, app API keys, webhook
969
+ * endpoints, test deliveries and delivery logs.
970
+ */
971
+ export declare class AgentChainPlatformClient {
972
+ private readonly base;
973
+ private readonly token;
974
+ private readonly retryOpts;
975
+ constructor(opts: AgentChainPlatformClientOptions);
976
+ private req;
977
+ listApps(): Promise<unknown>;
978
+ /** `clientType: 'public'` = no secret, PKCE S256 required (SPA, native, CLI). Confidential returns `clientSecret` once. */
979
+ createApp(body: {
980
+ name: string;
981
+ type?: PlatformAppType;
982
+ homepageUrl?: string;
983
+ environment?: PlatformAppEnvironment;
984
+ clientType?: PlatformClientType;
985
+ }): Promise<unknown>;
986
+ getApp(appId: string): Promise<unknown>;
987
+ updateApp(appId: string, body: {
988
+ name?: string;
989
+ type?: PlatformAppType;
990
+ homepageUrl?: string | null;
991
+ environment?: PlatformAppEnvironment;
992
+ }): Promise<unknown>;
993
+ deleteApp(appId: string): Promise<unknown>;
994
+ getOAuth(appId: string): Promise<unknown>;
995
+ /** Redirect URIs, scopes and/or clientType (public → secret removed + tokens revoked; confidential → new secret once). */
996
+ updateOAuth(appId: string, body: {
997
+ redirectUris?: string[];
998
+ scopes?: string[];
999
+ clientType?: PlatformClientType;
1000
+ }): Promise<unknown>;
1001
+ rotateOAuthSecret(appId: string): Promise<unknown>;
1002
+ listKeys(appId: string): Promise<unknown>;
1003
+ /** Plaintext key returned once (`ag_test_…` on the sandbox, `ag_…` on production). */
1004
+ createKey(appId: string, body?: {
1005
+ name?: string;
1006
+ scopes?: 'full' | string[];
1007
+ dailySpendCapUsdc?: number;
1008
+ }): Promise<unknown>;
1009
+ rotateKey(appId: string, keyId: string): Promise<unknown>;
1010
+ revokeKey(appId: string, keyId: string): Promise<unknown>;
1011
+ listWebhooks(appId: string): Promise<unknown>;
1012
+ /** Signing secret returned once — verify deliveries with `verifyWebhookSignature`. */
1013
+ createWebhook(appId: string, body: {
1014
+ url: string;
1015
+ events: string[];
1016
+ }): Promise<unknown>;
1017
+ updateWebhook(appId: string, endpointId: string, body: {
1018
+ url?: string;
1019
+ events?: string[];
1020
+ isActive?: boolean;
1021
+ }): Promise<unknown>;
1022
+ deleteWebhook(appId: string, endpointId: string): Promise<unknown>;
1023
+ testWebhook(appId: string, endpointId: string): Promise<unknown>;
1024
+ listWebhookDeliveries(appId: string, endpointId: string, opts?: {
1025
+ limit?: number;
1026
+ }): Promise<unknown>;
1027
+ resendDelivery(deliveryId: string): Promise<unknown>;
1028
+ logs(opts?: {
1029
+ limit?: number;
1030
+ filter?: string;
1031
+ workspace?: 'sandbox' | 'live';
1032
+ }): Promise<unknown>;
1033
+ listManagementTokens(): Promise<unknown>;
1034
+ revokeManagementToken(id: string): Promise<unknown>;
1035
+ }
1036
+ export { requestRelayBrowserChallenge, solveRelayBrowserChallenge, connectRelay, connectRelayBrowser, connectRelayWithSolver, requestRelayWalletChallenge, connectRelayWallet, type RelayBrowserChallenge, type RelayWalletChallenge, type RelayConnectResponse, } from './relay-connect.js';
1037
+ export { runPeriodicAgentCheck, startAutonomyLoop, type PlaybookSnapshot, type PeriodicCheckResult, type AutonomyLoopOptions, } from './autonomy-schedule.js';
1038
+ //# sourceMappingURL=index.d.ts.map