@oneshot-agent/sdk 0.12.0 → 0.13.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.
package/README.md CHANGED
@@ -55,7 +55,7 @@ const site = await agent.build({
55
55
  description: 'AI-powered task management for remote teams'
56
56
  }
57
57
  });
58
- console.log('Live at:', site.url);
58
+ console.log('Live at:', site.production_url);
59
59
 
60
60
  // Research
61
61
  const report = await agent.research({ topic: 'AI agents', depth: 'deep' });
@@ -124,7 +124,7 @@ All methods accept these common options:
124
124
 
125
125
  ```typescript
126
126
  interface ToolOptions {
127
- maxCost?: number; // Max USDC willing to pay
127
+ maxCost?: number; // Max USDC willing to pay (see supported tools below)
128
128
  timeout?: number; // Timeout in seconds
129
129
  signal?: AbortSignal; // Cancel before payment (see Cancellation section)
130
130
  wait?: boolean; // Wait for async jobs (default: true)
@@ -132,6 +132,19 @@ interface ToolOptions {
132
132
  }
133
133
  ```
134
134
 
135
+ ### `maxCost` Support
136
+
137
+ The `maxCost` option is a client-side guard — the SDK compares the quoted price against your limit and throws before signing any payment if it exceeds it. This is supported on tools with variable pricing:
138
+
139
+ | Method | `maxCost` |
140
+ |--------|:---------:|
141
+ | `commerceBuy()` | Supported |
142
+ | `voice()` | Supported |
143
+ | `sms()` | Supported |
144
+ | `build()` / `updateBuild()` | Supported |
145
+ | `browser()` | Supported |
146
+ | All other tools | Not applicable (fixed low-cost pricing) |
147
+
135
148
  ## Error Handling
136
149
 
137
150
  ```typescript
@@ -188,8 +201,8 @@ const site = await agent.build({
188
201
  }
189
202
  });
190
203
 
191
- console.log('Website URL:', site.url);
192
- console.log('Leads go to:', site.lead_capture_email);
204
+ console.log('Website URL:', site.production_url);
205
+ console.log('Preview:', site.preview_url);
193
206
 
194
207
  // Update existing website
195
208
  const updated = await agent.updateBuild({
package/dist/index.d.ts CHANGED
@@ -60,6 +60,12 @@ export interface PaymentRequirements {
60
60
  }
61
61
  export interface PaymentAuthorization {
62
62
  x402Version: 2;
63
+ resource?: {
64
+ url: string;
65
+ description?: string;
66
+ mimeType?: string;
67
+ };
68
+ extensions?: Record<string, unknown>;
63
69
  accepted: PaymentRequirements;
64
70
  payload: {
65
71
  signature: string;
@@ -132,6 +138,7 @@ export interface PeopleSearchOptions extends ToolOptions {
132
138
  job_titles?: string[];
133
139
  keywords?: string[];
134
140
  companies?: string[];
141
+ company_domains?: string[];
135
142
  location?: string[];
136
143
  skills?: string[];
137
144
  seniority?: string[];
@@ -228,8 +235,6 @@ export interface WebReadOptions extends ToolOptions {
228
235
  url: string;
229
236
  }
230
237
  export interface WebReadResult {
231
- request_id: string;
232
- status: string;
233
238
  url: string;
234
239
  markdown: string;
235
240
  screenshot_url?: string;
@@ -307,8 +312,9 @@ export interface PeopleSearchResult {
307
312
  status: string;
308
313
  results: PersonResult[];
309
314
  total_found: number;
310
- provider: string;
311
- completed_at: string;
315
+ request_id?: string;
316
+ completed_at?: string;
317
+ filters?: Record<string, unknown>;
312
318
  }
313
319
  export interface ResearchResult {
314
320
  report_content: string;
@@ -325,31 +331,163 @@ export interface ResearchResult {
325
331
  report_gcs_uri: string;
326
332
  }
327
333
  export interface EmailResult {
328
- success: boolean;
329
- message_id?: string;
330
- job_id?: string;
334
+ status: string;
335
+ timeline?: Array<Record<string, unknown>>;
336
+ error?: string;
337
+ email?: {
338
+ id: string;
339
+ provider_message_id: string;
340
+ status: string;
341
+ };
342
+ domain?: {
343
+ domain: string;
344
+ status: string;
345
+ was_provisioned: boolean;
346
+ };
331
347
  }
332
348
  export interface EnrichProfileResult {
333
349
  status: string;
334
350
  profile: PersonResult;
335
- provider: string;
351
+ request_id?: string;
352
+ completed_at?: string;
336
353
  }
337
354
  export interface FindEmailResult {
338
355
  status: string;
339
356
  email: string | null;
340
357
  found: boolean;
341
- provider: string;
358
+ full_name?: string;
359
+ company_domain?: string;
360
+ request_id?: string;
361
+ completed_at?: string;
342
362
  }
343
363
  export interface AsyncJobResult {
344
364
  request_id: string;
345
365
  status: string;
346
366
  }
367
+ /** Enrichment data nested inside deep research and enrichment responses. */
368
+ export interface PersonEnrichment {
369
+ displayname?: string;
370
+ firstname?: string;
371
+ lastname?: string;
372
+ bio?: string;
373
+ location?: string;
374
+ altemails?: string[];
375
+ best_work_email?: string;
376
+ best_personal_email?: string;
377
+ fullphone?: Array<{
378
+ fullphone: string;
379
+ type: string;
380
+ }>;
381
+ organizations?: Array<{
382
+ name?: string;
383
+ title?: string;
384
+ startDate?: string;
385
+ endDate?: string;
386
+ endDate_formatted?: {
387
+ is_current: boolean;
388
+ };
389
+ }>;
390
+ schools_info?: Array<{
391
+ name?: string;
392
+ degree?: string;
393
+ title?: string;
394
+ }>;
395
+ social_profiles?: Record<string, {
396
+ url?: string;
397
+ username?: string;
398
+ followers?: number;
399
+ }>;
400
+ newsfeed?: Array<{
401
+ source?: string;
402
+ type?: string;
403
+ content?: string;
404
+ date_posted?: string;
405
+ engagement?: {
406
+ likes?: number;
407
+ replies?: number;
408
+ shares?: number;
409
+ };
410
+ }>;
411
+ }
412
+ export interface DeepResearchPersonResult {
413
+ status: string;
414
+ result: {
415
+ enrichment: PersonEnrichment;
416
+ following?: Record<string, unknown>[];
417
+ articles?: Array<{
418
+ title?: string;
419
+ url?: string;
420
+ source?: string;
421
+ published_date?: string;
422
+ snippet?: string;
423
+ }>;
424
+ dossier?: Record<string, unknown>;
425
+ };
426
+ request_id: string;
427
+ completed_at: string;
428
+ }
429
+ export interface SocialProfilesResult {
430
+ status: string;
431
+ result: Record<string, {
432
+ url?: string;
433
+ username?: string;
434
+ followers?: number;
435
+ bio?: string;
436
+ }>;
437
+ request_id: string;
438
+ completed_at: string;
439
+ }
440
+ export interface ArticleSearchResult {
441
+ status: string;
442
+ result: Array<{
443
+ title?: string;
444
+ url?: string;
445
+ source?: string;
446
+ published_date?: string;
447
+ snippet?: string;
448
+ }>;
449
+ request_id: string;
450
+ completed_at: string;
451
+ }
452
+ export interface PersonNewsfeedResult {
453
+ status: string;
454
+ result: Array<{
455
+ platform?: string;
456
+ content?: string;
457
+ url?: string;
458
+ posted_at?: string;
459
+ likes?: number;
460
+ replies?: number;
461
+ shares?: number;
462
+ }>;
463
+ request_id: string;
464
+ completed_at: string;
465
+ }
466
+ export interface PersonInterestsResult {
467
+ status: string;
468
+ result: Record<string, unknown>;
469
+ request_id: string;
470
+ completed_at: string;
471
+ }
472
+ export interface PersonInteractionsResult {
473
+ status: string;
474
+ result: {
475
+ followers?: Array<Record<string, unknown>>;
476
+ following?: Array<Record<string, unknown>>;
477
+ replies?: Array<Record<string, unknown>>;
478
+ };
479
+ request_id: string;
480
+ completed_at: string;
481
+ }
347
482
  export interface VerifyEmailResult {
348
483
  status: string;
349
484
  email: string;
485
+ valid: boolean;
350
486
  deliverable: boolean;
351
- reason?: string;
352
- provider: string;
487
+ catch_all: boolean;
488
+ disposable: boolean;
489
+ request_id?: string;
490
+ completed_at?: string;
353
491
  }
354
492
  export interface InboxEmail {
355
493
  id: string;
@@ -382,16 +520,30 @@ export interface CommerceQuote {
382
520
  total: string;
383
521
  }
384
522
  export interface CommerceBuyResult {
385
- request_id: string;
386
523
  status: string;
387
- product?: {
388
- title: string;
389
- total_charged: string;
390
- };
524
+ order_id: string;
525
+ order_status: string;
526
+ tracking_url?: string;
527
+ provider: string;
528
+ }
529
+ export interface CommerceSearchProduct {
530
+ product_url: string;
531
+ title: string;
532
+ price: number;
533
+ currency: string;
534
+ image_url?: string;
535
+ vendor?: string;
536
+ rating?: number;
537
+ review_count?: number;
538
+ in_stock?: boolean;
539
+ description?: string;
391
540
  }
392
541
  export interface CommerceSearchResult {
393
- request_id: string;
394
542
  status: string;
543
+ query: string;
544
+ provider: string;
545
+ products: CommerceSearchProduct[];
546
+ count: number;
395
547
  }
396
548
  export interface VoiceQuote {
397
549
  quote_id: string;
@@ -410,7 +562,6 @@ export interface VoiceQuote {
410
562
  expires_at: string;
411
563
  }
412
564
  export interface VoiceCallResult {
413
- request_id: string;
414
565
  status: string;
415
566
  ended_reason?: string;
416
567
  duration_seconds?: number;
@@ -434,11 +585,17 @@ export interface SmsQuote {
434
585
  expires_at: string;
435
586
  }
436
587
  export interface SmsSendResult {
437
- request_id: string;
438
588
  status: string;
439
- delivered?: number;
440
- failed?: number;
441
- total?: number;
589
+ sent: number;
590
+ failed: number;
591
+ total: number;
592
+ details: Array<{
593
+ to: string;
594
+ from?: string;
595
+ status: string;
596
+ message_sid?: string;
597
+ error?: string;
598
+ }>;
442
599
  }
443
600
  export interface SmsInboxMessage {
444
601
  id: string;
@@ -553,12 +710,16 @@ export interface BuildQuote {
553
710
  expires_at: string;
554
711
  }
555
712
  export interface BuildResult {
556
- request_id: string;
557
713
  status: string;
558
- url?: string;
714
+ success: boolean;
715
+ production_url?: string;
559
716
  preview_url?: string;
560
- lead_capture_email?: string;
561
717
  design_score?: number;
718
+ iterations?: number;
719
+ v0_chat_id?: string;
720
+ vercel_deployment_id?: string;
721
+ vercel_project_id?: string;
722
+ github_repo?: string;
562
723
  error?: string;
563
724
  }
564
725
  export interface BrowserTaskOptions extends ToolOptions {
@@ -586,8 +747,6 @@ export interface BrowserQuote {
586
747
  expires_at: string;
587
748
  }
588
749
  export interface BrowserResult {
589
- request_id: string;
590
- status: string;
591
750
  output?: string | Record<string, unknown>;
592
751
  steps?: Array<{
593
752
  number: number;
@@ -597,6 +756,7 @@ export interface BrowserResult {
597
756
  cost?: number;
598
757
  output_files?: string[];
599
758
  browser_task_id?: string;
759
+ session_id?: string;
600
760
  }
601
761
  export interface UpdateBuildOptions extends ToolOptions {
602
762
  /** Existing build ID to update (required) */
@@ -660,6 +820,128 @@ export interface ReceiptsListResult {
660
820
  count: number;
661
821
  has_more: boolean;
662
822
  }
823
+ export interface UnifiedBalance {
824
+ on_chain_balance: string;
825
+ credits_balance: string;
826
+ currency: string;
827
+ address: string;
828
+ chain_id: number;
829
+ }
830
+ export interface ComputeSchedule {
831
+ /** Cron expression (UTC). Minimum interval: 15 minutes. */
832
+ cron: string;
833
+ /** USDC budget per run */
834
+ budget_per_run: number;
835
+ /** Maximum number of runs (optional — runs indefinitely if omitted) */
836
+ max_runs?: number;
837
+ }
838
+ export interface ComputeOptions extends ToolOptions {
839
+ /** Natural language objective for the orchestrator */
840
+ objective: string;
841
+ /** Additional parameters / constraints */
842
+ params?: Record<string, unknown>;
843
+ /** Suggested budget in USDC (server will estimate if omitted) */
844
+ budget_usdc?: number;
845
+ /** ISO deadline for completion */
846
+ deadline?: string;
847
+ /** Route to a specific Soul agent */
848
+ soul_slug?: string;
849
+ /** Route to a specific Soul service */
850
+ soul_service_slug?: string;
851
+ /** Make this a recurring goal */
852
+ schedule?: ComputeSchedule;
853
+ }
854
+ export interface ComputeQuote {
855
+ quote_id: string;
856
+ objective_summary: string;
857
+ estimated_phases: number;
858
+ estimated_tasks: number;
859
+ estimated_duration_days: number;
860
+ budget_breakdown: Record<string, string>;
861
+ total_budget: string;
862
+ expires_at: string;
863
+ schedule_cron?: string;
864
+ budget_per_run?: number;
865
+ max_runs?: number;
866
+ projected_runs?: number;
867
+ }
868
+ export interface ComputeGoalResult {
869
+ goal_id: string;
870
+ request_id: string;
871
+ receipt_id?: string;
872
+ status: string;
873
+ message: string;
874
+ goal: {
875
+ objective: string;
876
+ budget_usdc: string;
877
+ deadline?: string;
878
+ schedule_cron?: string;
879
+ budget_per_run?: number;
880
+ max_runs?: number;
881
+ next_run_at?: string;
882
+ };
883
+ }
884
+ export interface ComputeGoalStatus {
885
+ id: string;
886
+ status: string;
887
+ name: string;
888
+ objective: string;
889
+ current_phase: number | null;
890
+ plan: unknown;
891
+ budget: {
892
+ total: string;
893
+ spent: string;
894
+ reserved: string;
895
+ remaining: string;
896
+ } | null;
897
+ soul_agent_id: string | null;
898
+ deadline: string | null;
899
+ started_at: string | null;
900
+ completed_at: string | null;
901
+ last_wake_at: string | null;
902
+ next_wake_at: string | null;
903
+ created_at: string;
904
+ schedule?: {
905
+ cron: string;
906
+ budget_per_run: string;
907
+ max_runs: number | null;
908
+ run_count: number;
909
+ last_run_at: string | null;
910
+ next_run_at: string | null;
911
+ };
912
+ }
913
+ export interface ComputeTask {
914
+ id: string;
915
+ task_type: string;
916
+ tool: string | null;
917
+ description: string;
918
+ status: string;
919
+ phase: number | null;
920
+ sequence: number | null;
921
+ progress_pct: number | null;
922
+ progress_message: string | null;
923
+ result: unknown;
924
+ quoted_usdc: string | null;
925
+ actual_usdc: string | null;
926
+ run_number: number | null;
927
+ started_at: string | null;
928
+ completed_at: string | null;
929
+ created_at: string;
930
+ }
931
+ export interface ComputeBudgetStatus {
932
+ budgetId: string;
933
+ goalId: string;
934
+ totalBudgetUsdc: string;
935
+ spentUsdc: string;
936
+ reservedUsdc: string;
937
+ remainingUsdc: string;
938
+ spend_entries: Array<{
939
+ category: string;
940
+ amount_usdc: string;
941
+ description: string;
942
+ created_at: string;
943
+ }>;
944
+ }
663
945
  /**
664
946
  * OneShot Agent SDK - Execute commercial transactions with automatic x402 payments.
665
947
  *
@@ -708,12 +990,12 @@ export declare class OneShot {
708
990
  enrichProfile(options: EnrichProfileOptions): Promise<EnrichProfileResult>;
709
991
  findEmail(options: FindEmailOptions): Promise<FindEmailResult>;
710
992
  verifyEmail(options: VerifyEmailOptions): Promise<VerifyEmailResult>;
711
- deepResearchPerson(options: DeepResearchPersonOptions): Promise<any>;
712
- socialProfiles(options: SocialProfilesOptions): Promise<any>;
713
- articleSearch(options: ArticleSearchOptions): Promise<any>;
714
- personNewsfeed(options: PersonNewsfeedOptions): Promise<any>;
715
- personInterests(options: PersonInterestsOptions): Promise<any>;
716
- personInteractions(options: PersonInteractionsOptions): Promise<any>;
993
+ deepResearchPerson(options: DeepResearchPersonOptions): Promise<DeepResearchPersonResult>;
994
+ socialProfiles(options: SocialProfilesOptions): Promise<SocialProfilesResult>;
995
+ articleSearch(options: ArticleSearchOptions): Promise<ArticleSearchResult>;
996
+ personNewsfeed(options: PersonNewsfeedOptions): Promise<PersonNewsfeedResult>;
997
+ personInterests(options: PersonInterestsOptions): Promise<PersonInterestsResult>;
998
+ personInteractions(options: PersonInteractionsOptions): Promise<PersonInteractionsResult>;
717
999
  inboxList(options?: InboxListOptions): Promise<InboxListResult>;
718
1000
  inboxGet(emailId: string): Promise<InboxEmail>;
719
1001
  commerceBuy(options: CommerceBuyOptions): Promise<CommerceBuyResult>;
@@ -837,7 +1119,139 @@ export declare class OneShot {
837
1119
  * ```
838
1120
  */
839
1121
  markNotificationRead(notificationId: string): Promise<void>;
840
- getBalance(tokenAddress: string): Promise<string>;
1122
+ getUnifiedBalance(): Promise<UnifiedBalance>;
1123
+ getBalance(tokenAddress?: string): Promise<string>;
1124
+ /**
1125
+ * Create a compute goal — the orchestrator will plan, execute, and iterate autonomously.
1126
+ *
1127
+ * Uses the quote-then-pay flow: first call gets a 402 with a budget estimate,
1128
+ * second call (with payment) creates the goal.
1129
+ *
1130
+ * @example
1131
+ * ```typescript
1132
+ * const goal = await agent.compute({
1133
+ * objective: 'Research the top 10 AI startups and build a comparison website',
1134
+ * budget_usdc: 5.00
1135
+ * });
1136
+ * console.log(goal.goal_id);
1137
+ *
1138
+ * // Check progress
1139
+ * const status = await agent.getComputeGoal(goal.goal_id);
1140
+ * console.log(status.status, status.budget);
1141
+ * ```
1142
+ */
1143
+ compute(options: ComputeOptions): Promise<ComputeGoalResult>;
1144
+ /**
1145
+ * Get the status of a compute goal
1146
+ *
1147
+ * @example
1148
+ * ```typescript
1149
+ * const status = await agent.getComputeGoal('goal_01HX...');
1150
+ * console.log(status.status, status.budget?.remaining);
1151
+ * ```
1152
+ */
1153
+ getComputeGoal(goalId: string): Promise<ComputeGoalStatus>;
1154
+ /**
1155
+ * List tasks under a compute goal
1156
+ *
1157
+ * @example
1158
+ * ```typescript
1159
+ * const tasks = await agent.getComputeTasks('goal_01HX...');
1160
+ * for (const t of tasks) {
1161
+ * console.log(`${t.tool}: ${t.status} (${t.progress_pct ?? 0}%)`);
1162
+ * }
1163
+ * ```
1164
+ */
1165
+ getComputeTasks(goalId: string): Promise<ComputeTask[]>;
1166
+ /**
1167
+ * Get budget status for a compute goal
1168
+ *
1169
+ * @example
1170
+ * ```typescript
1171
+ * const budget = await agent.getComputeBudget('goal_01HX...');
1172
+ * console.log(`Spent: $${budget.spentUsdc} / $${budget.totalBudgetUsdc}`);
1173
+ * ```
1174
+ */
1175
+ getComputeBudget(goalId: string): Promise<ComputeBudgetStatus>;
1176
+ /**
1177
+ * Cancel a compute goal. Remaining budget will be credited.
1178
+ *
1179
+ * @example
1180
+ * ```typescript
1181
+ * const result = await agent.cancelComputeGoal('goal_01HX...');
1182
+ * console.log(`Cancelled. Remaining: $${result.remaining_budget}`);
1183
+ * ```
1184
+ */
1185
+ cancelComputeGoal(goalId: string, reason?: string): Promise<{
1186
+ goal_id: string;
1187
+ status: string;
1188
+ remaining_budget: string;
1189
+ }>;
1190
+ /**
1191
+ * Respond to a human-in-the-loop approval task
1192
+ *
1193
+ * @example
1194
+ * ```typescript
1195
+ * await agent.respondToComputeTask('goal_01HX...', {
1196
+ * task_id: 'task_01HX...',
1197
+ * approved: true,
1198
+ * response: 'Looks good, proceed'
1199
+ * });
1200
+ * ```
1201
+ */
1202
+ respondToComputeTask(goalId: string, input: {
1203
+ task_id: string;
1204
+ response?: string;
1205
+ approved?: boolean;
1206
+ }): Promise<{
1207
+ task_id: string;
1208
+ goal_id: string;
1209
+ task_status: string;
1210
+ orchestrator_action: string;
1211
+ }>;
1212
+ /**
1213
+ * Pause a recurring compute goal
1214
+ *
1215
+ * @example
1216
+ * ```typescript
1217
+ * await agent.pauseComputeGoal('goal_01HX...');
1218
+ * ```
1219
+ */
1220
+ pauseComputeGoal(goalId: string, reason?: string): Promise<{
1221
+ goal_id: string;
1222
+ status: string;
1223
+ run_count: number;
1224
+ }>;
1225
+ /**
1226
+ * Resume a paused recurring compute goal
1227
+ *
1228
+ * @example
1229
+ * ```typescript
1230
+ * const result = await agent.resumeComputeGoal('goal_01HX...');
1231
+ * console.log(`Resumed. Next run: ${result.next_run_at}`);
1232
+ * ```
1233
+ */
1234
+ resumeComputeGoal(goalId: string): Promise<{
1235
+ goal_id: string;
1236
+ status: string;
1237
+ next_run_at: string;
1238
+ run_count: number;
1239
+ }>;
1240
+ /**
1241
+ * Top up budget for a recurring compute goal
1242
+ *
1243
+ * @example
1244
+ * ```typescript
1245
+ * const result = await agent.fundComputeGoal('goal_01HX...', 10.00);
1246
+ * console.log(`New total: $${result.total_budget}`);
1247
+ * ```
1248
+ */
1249
+ fundComputeGoal(goalId: string, amount: number): Promise<{
1250
+ goal_id: string;
1251
+ topped_up: number;
1252
+ total_budget: string;
1253
+ remaining: string;
1254
+ }>;
841
1255
  /**
842
1256
  * Get spend breakdown by category
843
1257
  *
@@ -909,8 +1323,14 @@ export declare class OneShot {
909
1323
  * This is called before signing the x402 payment authorization.
910
1324
  */
911
1325
  private ensureUsdcBalance;
912
- /** Parse the PAYMENT-REQUIRED header from a 402 response into the accepted requirements. */
1326
+ /** Parse the PAYMENT-REQUIRED header from a 402 response into the accepted requirements and Bazaar metadata. */
913
1327
  private parsePaymentRequired;
1328
+ /**
1329
+ * Get payment requirements for a quote-based endpoint.
1330
+ * Quote-based routes don't include payment-required header on the initial 402.
1331
+ * If missing, probe with quote ID (no payment) to trigger the x402 middleware's 402.
1332
+ */
1333
+ private getAcceptedRequirements;
914
1334
  private signPaymentAuthorization;
915
1335
  }
916
1336
  //# sourceMappingURL=index.d.ts.map