@nimble-way/nimble-js 0.9.0 → 0.11.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/client.d.mts +3 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +1 -1
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agent.d.mts +119 -1
  12. package/resources/agent.d.mts.map +1 -1
  13. package/resources/agent.d.ts +119 -1
  14. package/resources/agent.d.ts.map +1 -1
  15. package/resources/agent.js +6 -0
  16. package/resources/agent.js.map +1 -1
  17. package/resources/agent.mjs +6 -0
  18. package/resources/agent.mjs.map +1 -1
  19. package/resources/crawl.d.mts +1 -1
  20. package/resources/crawl.d.mts.map +1 -1
  21. package/resources/crawl.d.ts +1 -1
  22. package/resources/crawl.d.ts.map +1 -1
  23. package/resources/index.d.mts +1 -1
  24. package/resources/index.d.mts.map +1 -1
  25. package/resources/index.d.ts +1 -1
  26. package/resources/index.d.ts.map +1 -1
  27. package/resources/index.js.map +1 -1
  28. package/resources/index.mjs.map +1 -1
  29. package/resources/top-level.d.mts +205 -22
  30. package/resources/top-level.d.mts.map +1 -1
  31. package/resources/top-level.d.ts +205 -22
  32. package/resources/top-level.d.ts.map +1 -1
  33. package/src/client.ts +5 -1
  34. package/src/resources/agent.ts +149 -0
  35. package/src/resources/crawl.ts +1 -1
  36. package/src/resources/index.ts +2 -0
  37. package/src/resources/top-level.ts +1135 -31
  38. package/src/version.ts +1 -1
  39. package/version.d.mts +1 -1
  40. package/version.d.mts.map +1 -1
  41. package/version.d.ts +1 -1
  42. package/version.d.ts.map +1 -1
  43. package/version.js +1 -1
  44. package/version.js.map +1 -1
  45. package/version.mjs +1 -1
  46. package/version.mjs.map +1 -1
package/src/client.ts CHANGED
@@ -37,6 +37,8 @@ import {
37
37
  AgentListResponse,
38
38
  AgentRunAsyncParams,
39
39
  AgentRunAsyncResponse,
40
+ AgentRunBatchParams,
41
+ AgentRunBatchResponse,
40
42
  AgentRunParams,
41
43
  AgentRunResponse,
42
44
  } from './resources/agent';
@@ -268,7 +270,7 @@ export class Nimble {
268
270
  * @example
269
271
  * ```ts
270
272
  * const response = await client.extractBatch({
271
- * params: [{ url: 'url' }],
273
+ * inputs: [{}],
272
274
  * });
273
275
  * ```
274
276
  */
@@ -867,9 +869,11 @@ export declare namespace Nimble {
867
869
  type AgentGetResponse as AgentGetResponse,
868
870
  type AgentRunResponse as AgentRunResponse,
869
871
  type AgentRunAsyncResponse as AgentRunAsyncResponse,
872
+ type AgentRunBatchResponse as AgentRunBatchResponse,
870
873
  type AgentListParams as AgentListParams,
871
874
  type AgentRunParams as AgentRunParams,
872
875
  type AgentRunAsyncParams as AgentRunAsyncParams,
876
+ type AgentRunBatchParams as AgentRunBatchParams,
873
877
  };
874
878
 
875
879
  export {
@@ -36,6 +36,13 @@ export class Agent extends APIResource {
36
36
  runAsync(body: AgentRunAsyncParams, options?: RequestOptions): APIPromise<AgentRunAsyncResponse> {
37
37
  return this._client.post('/v1/agents/async', { body, ...options });
38
38
  }
39
+
40
+ /**
41
+ * Execute WSA Batch Endpoint
42
+ */
43
+ runBatch(body: AgentRunBatchParams, options?: RequestOptions): APIPromise<AgentRunBatchResponse> {
44
+ return this._client.post('/v1/agents/batch', { body, ...options });
45
+ }
39
46
  }
40
47
 
41
48
  export type AgentListResponse = Array<AgentListResponse.AgentListResponseItem>;
@@ -191,6 +198,11 @@ export namespace AgentRunResponse {
191
198
  */
192
199
  network_capture?: Array<Data.NetworkCapture>;
193
200
 
201
+ /**
202
+ * Individual HTML content of each pagination page, before merging.
203
+ */
204
+ pages_html?: Array<string>;
205
+
194
206
  /**
195
207
  * The parsing results extracted from the HTML & network content.
196
208
  */
@@ -472,6 +484,99 @@ export interface AgentRunAsyncResponse {
472
484
  task: { [key: string]: unknown };
473
485
  }
474
486
 
487
+ /**
488
+ * Response when a batch of extract tasks is created successfully.
489
+ */
490
+ export interface AgentRunBatchResponse {
491
+ /**
492
+ * Unique identifier for the batch.
493
+ */
494
+ batch_id: string;
495
+
496
+ /**
497
+ * Number of tasks in the batch.
498
+ */
499
+ batch_size: number;
500
+
501
+ /**
502
+ * List of created tasks.
503
+ */
504
+ tasks: Array<AgentRunBatchResponse.Task>;
505
+ }
506
+
507
+ export namespace AgentRunBatchResponse {
508
+ export interface Task {
509
+ /**
510
+ * Unique task identifier.
511
+ */
512
+ id: string;
513
+
514
+ _query: unknown;
515
+
516
+ /**
517
+ * Timestamp when the task was created.
518
+ */
519
+ created_at: string;
520
+
521
+ /**
522
+ * Original input data for the task.
523
+ */
524
+ input: unknown;
525
+
526
+ /**
527
+ * Current state of the task.
528
+ */
529
+ state: 'pending' | 'success' | 'error';
530
+
531
+ /**
532
+ * URL for checking the task status.
533
+ */
534
+ status_url: string;
535
+
536
+ /**
537
+ * Account name that owns the task.
538
+ */
539
+ account_name?: string;
540
+
541
+ api_type?: 'web' | 'serp' | 'ecommerce' | 'social' | 'media' | 'agent' | 'extract';
542
+
543
+ /**
544
+ * Batch ID if this task is part of a batch.
545
+ */
546
+ batch_id?: string;
547
+
548
+ /**
549
+ * URL for downloading the task results.
550
+ */
551
+ download_url?: string;
552
+
553
+ /**
554
+ * Error message if the task failed.
555
+ */
556
+ error?: string;
557
+
558
+ /**
559
+ * Classification of the error type.
560
+ */
561
+ error_type?: string;
562
+
563
+ /**
564
+ * Timestamp when the task was last modified.
565
+ */
566
+ modified_at?: string;
567
+
568
+ /**
569
+ * Storage location of the output data.
570
+ */
571
+ output_url?: string;
572
+
573
+ /**
574
+ * HTTP status code from the task execution.
575
+ */
576
+ status_code?: number;
577
+ }
578
+ }
579
+
475
580
  export interface AgentListParams {
476
581
  /**
477
582
  * Number of results per page
@@ -504,6 +609,11 @@ export interface AgentRunParams {
504
609
 
505
610
  params: { [key: string]: unknown };
506
611
 
612
+ /**
613
+ * Response formats to include. All disabled by default.
614
+ */
615
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
616
+
507
617
  localization?: boolean;
508
618
  }
509
619
 
@@ -517,6 +627,11 @@ export interface AgentRunAsyncParams {
517
627
  */
518
628
  callback_url?: string;
519
629
 
630
+ /**
631
+ * Response formats to include. All disabled by default.
632
+ */
633
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
634
+
520
635
  localization?: boolean;
521
636
 
522
637
  /**
@@ -540,14 +655,48 @@ export interface AgentRunAsyncParams {
540
655
  storage_url?: string;
541
656
  }
542
657
 
658
+ export interface AgentRunBatchParams {
659
+ inputs: Array<AgentRunBatchParams.Input>;
660
+
661
+ shared_inputs: AgentRunBatchParams.SharedInputs;
662
+ }
663
+
664
+ export namespace AgentRunBatchParams {
665
+ export interface Input {
666
+ /**
667
+ * Response formats to include. All disabled by default.
668
+ */
669
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
670
+
671
+ localization?: boolean;
672
+
673
+ params?: { [key: string]: unknown };
674
+ }
675
+
676
+ export interface SharedInputs {
677
+ agent: string;
678
+
679
+ /**
680
+ * Response formats to include. All disabled by default.
681
+ */
682
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
683
+
684
+ localization?: boolean;
685
+
686
+ params?: { [key: string]: unknown };
687
+ }
688
+ }
689
+
543
690
  export declare namespace Agent {
544
691
  export {
545
692
  type AgentListResponse as AgentListResponse,
546
693
  type AgentGetResponse as AgentGetResponse,
547
694
  type AgentRunResponse as AgentRunResponse,
548
695
  type AgentRunAsyncResponse as AgentRunAsyncResponse,
696
+ type AgentRunBatchResponse as AgentRunBatchResponse,
549
697
  type AgentListParams as AgentListParams,
550
698
  type AgentRunParams as AgentRunParams,
551
699
  type AgentRunAsyncParams as AgentRunAsyncParams,
700
+ type AgentRunBatchParams as AgentRunBatchParams,
552
701
  };
553
702
  }
@@ -718,7 +718,7 @@ export namespace CrawlRunParams {
718
718
  /**
719
719
  * List of acceptable response formats in order of preference
720
720
  */
721
- formats?: Array<'html' | 'markdown' | 'screenshot'>;
721
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
722
722
 
723
723
  /**
724
724
  * Custom HTTP headers to include in the request
@@ -7,9 +7,11 @@ export {
7
7
  type AgentGetResponse,
8
8
  type AgentRunResponse,
9
9
  type AgentRunAsyncResponse,
10
+ type AgentRunBatchResponse,
10
11
  type AgentListParams,
11
12
  type AgentRunParams,
12
13
  type AgentRunAsyncParams,
14
+ type AgentRunBatchParams,
13
15
  } from './agent';
14
16
  export { Batches, type BatchGetResponse, type BatchProgressResponse } from './batches';
15
17
  export {