@nimble-way/nimble-js 0.11.0 → 0.13.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 (56) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/client.d.mts +9 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +9 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +17 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +17 -1
  9. package/client.mjs.map +1 -1
  10. package/internal/types.d.mts +6 -6
  11. package/internal/types.d.mts.map +1 -1
  12. package/internal/types.d.ts +6 -6
  13. package/internal/types.d.ts.map +1 -1
  14. package/internal/utils/env.js +2 -2
  15. package/internal/utils/env.js.map +1 -1
  16. package/internal/utils/env.mjs +2 -2
  17. package/internal/utils/env.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/agent.d.mts +180 -9
  20. package/resources/agent.d.mts.map +1 -1
  21. package/resources/agent.d.ts +180 -9
  22. package/resources/agent.d.ts.map +1 -1
  23. package/resources/agent.js +71 -2
  24. package/resources/agent.js.map +1 -1
  25. package/resources/agent.mjs +71 -2
  26. package/resources/agent.mjs.map +1 -1
  27. package/resources/crawl.d.mts +32 -2
  28. package/resources/crawl.d.mts.map +1 -1
  29. package/resources/crawl.d.ts +32 -2
  30. package/resources/crawl.d.ts.map +1 -1
  31. package/resources/crawl.js +24 -0
  32. package/resources/crawl.js.map +1 -1
  33. package/resources/crawl.mjs +24 -0
  34. package/resources/crawl.mjs.map +1 -1
  35. package/resources/index.d.mts +1 -1
  36. package/resources/index.d.mts.map +1 -1
  37. package/resources/index.d.ts +1 -1
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js.map +1 -1
  40. package/resources/index.mjs.map +1 -1
  41. package/resources/top-level.d.mts +36 -8
  42. package/resources/top-level.d.mts.map +1 -1
  43. package/resources/top-level.d.ts +36 -8
  44. package/resources/top-level.d.ts.map +1 -1
  45. package/src/client.ts +34 -0
  46. package/src/internal/types.ts +6 -8
  47. package/src/internal/utils/env.ts +2 -2
  48. package/src/resources/agent.ts +270 -8
  49. package/src/resources/crawl.ts +33 -2
  50. package/src/resources/index.ts +5 -0
  51. package/src/resources/top-level.ts +41 -8
  52. package/src/version.ts +1 -1
  53. package/version.d.mts +1 -1
  54. package/version.d.ts +1 -1
  55. package/version.js +1 -1
  56. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -32,9 +32,14 @@ import {
32
32
  import { APIPromise } from './core/api-promise';
33
33
  import {
34
34
  Agent,
35
+ AgentGenerateParams,
36
+ AgentGenerateResponse,
37
+ AgentGetGenerationResponse,
35
38
  AgentGetResponse,
36
39
  AgentListParams,
37
40
  AgentListResponse,
41
+ AgentPublishParams,
42
+ AgentPublishResponse,
38
43
  AgentRunAsyncParams,
39
44
  AgentRunAsyncResponse,
40
45
  AgentRunBatchParams,
@@ -78,6 +83,11 @@ export interface ClientOptions {
78
83
  */
79
84
  apiKey?: string | null | undefined;
80
85
 
86
+ /**
87
+ * Defaults to process.env['CLIENT_SOURCE'].
88
+ */
89
+ clientSource?: string | null | undefined;
90
+
81
91
  /**
82
92
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
83
93
  *
@@ -152,6 +162,7 @@ export interface ClientOptions {
152
162
  */
153
163
  export class Nimble {
154
164
  apiKey: string | null;
165
+ clientSource: string | null;
155
166
 
156
167
  baseURL: string;
157
168
  maxRetries: number;
@@ -169,6 +180,7 @@ export class Nimble {
169
180
  * API Client for interfacing with the Nimble API.
170
181
  *
171
182
  * @param {string | null | undefined} [opts.apiKey=process.env['NIMBLE_API_KEY'] ?? null]
183
+ * @param {string | null | undefined} [opts.clientSource=process.env['CLIENT_SOURCE'] ?? sdk]
172
184
  * @param {string} [opts.baseURL=process.env['NIMBLE_BASE_URL'] ?? https://sdk.nimbleway.com] - Override the default base URL for the API.
173
185
  * @param {number} [opts.timeout=3 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
174
186
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
@@ -180,10 +192,12 @@ export class Nimble {
180
192
  constructor({
181
193
  baseURL = readEnv('NIMBLE_BASE_URL'),
182
194
  apiKey = readEnv('NIMBLE_API_KEY') ?? null,
195
+ clientSource = readEnv('CLIENT_SOURCE') ?? 'sdk',
183
196
  ...opts
184
197
  }: ClientOptions = {}) {
185
198
  const options: ClientOptions = {
186
199
  apiKey,
200
+ clientSource,
187
201
  ...opts,
188
202
  baseURL: baseURL || `https://sdk.nimbleway.com`,
189
203
  };
@@ -203,9 +217,22 @@ export class Nimble {
203
217
  this.fetch = options.fetch ?? Shims.getDefaultFetch();
204
218
  this.#encoder = Opts.FallbackEncoder;
205
219
 
220
+ const customHeadersEnv = readEnv('NIMBLE_CUSTOM_HEADERS');
221
+ if (customHeadersEnv) {
222
+ const parsed: Record<string, string> = {};
223
+ for (const line of customHeadersEnv.split('\n')) {
224
+ const colon = line.indexOf(':');
225
+ if (colon >= 0) {
226
+ parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
227
+ }
228
+ }
229
+ options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
230
+ }
231
+
206
232
  this._options = options;
207
233
 
208
234
  this.apiKey = apiKey;
235
+ this.clientSource = clientSource;
209
236
  }
210
237
 
211
238
  /**
@@ -222,6 +249,7 @@ export class Nimble {
222
249
  fetch: this.fetch,
223
250
  fetchOptions: this.fetchOptions,
224
251
  apiKey: this.apiKey,
252
+ clientSource: this.clientSource,
225
253
  ...options,
226
254
  });
227
255
  return client;
@@ -754,6 +782,7 @@ export class Nimble {
754
782
  'X-Stainless-Retry-Count': String(retryCount),
755
783
  ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
756
784
  ...getPlatformHeaders(),
785
+ 'X-Client-Source': this.clientSource,
757
786
  },
758
787
  await this.authHeaders(options),
759
788
  this._options.defaultHeaders,
@@ -866,11 +895,16 @@ export declare namespace Nimble {
866
895
  export {
867
896
  Agent as Agent,
868
897
  type AgentListResponse as AgentListResponse,
898
+ type AgentGenerateResponse as AgentGenerateResponse,
869
899
  type AgentGetResponse as AgentGetResponse,
900
+ type AgentGetGenerationResponse as AgentGetGenerationResponse,
901
+ type AgentPublishResponse as AgentPublishResponse,
870
902
  type AgentRunResponse as AgentRunResponse,
871
903
  type AgentRunAsyncResponse as AgentRunAsyncResponse,
872
904
  type AgentRunBatchResponse as AgentRunBatchResponse,
873
905
  type AgentListParams as AgentListParams,
906
+ type AgentGenerateParams as AgentGenerateParams,
907
+ type AgentPublishParams as AgentPublishParams,
874
908
  type AgentRunParams as AgentRunParams,
875
909
  type AgentRunAsyncParams as AgentRunAsyncParams,
876
910
  type AgentRunBatchParams as AgentRunBatchParams,
@@ -40,7 +40,6 @@ type OverloadedParameters<T> =
40
40
  : T extends (...args: infer A) => unknown ? A
41
41
  : never;
42
42
 
43
- /* eslint-disable */
44
43
  /**
45
44
  * These imports attempt to get types from a parent package's dependencies.
46
45
  * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
@@ -63,19 +62,18 @@ type OverloadedParameters<T> =
63
62
  *
64
63
  * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
65
64
  */
66
- /** @ts-ignore For users with \@types/node */
65
+ /** @ts-ignore For users with \@types/node */ /* prettier-ignore */
67
66
  type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
68
- /** @ts-ignore For users with undici */
67
+ /** @ts-ignore For users with undici */ /* prettier-ignore */
69
68
  type UndiciRequestInit = NotAny<import('../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
70
- /** @ts-ignore For users with \@types/bun */
69
+ /** @ts-ignore For users with \@types/bun */ /* prettier-ignore */
71
70
  type BunRequestInit = globalThis.FetchRequestInit;
72
- /** @ts-ignore For users with node-fetch@2 */
71
+ /** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */
73
72
  type NodeFetch2RequestInit = NotAny<import('../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
74
- /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
73
+ /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */
75
74
  type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
76
- /** @ts-ignore For users who use Deno */
75
+ /** @ts-ignore For users who use Deno */ /* prettier-ignore */
77
76
  type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
78
- /* eslint-enable */
79
77
 
80
78
  type RequestInits =
81
79
  | NotAny<UndiciTypesRequestInit>
@@ -9,10 +9,10 @@
9
9
  */
10
10
  export const readEnv = (env: string): string | undefined => {
11
11
  if (typeof (globalThis as any).process !== 'undefined') {
12
- return (globalThis as any).process.env?.[env]?.trim() ?? undefined;
12
+ return (globalThis as any).process.env?.[env]?.trim() || undefined;
13
13
  }
14
14
  if (typeof (globalThis as any).Deno !== 'undefined') {
15
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
15
+ return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
16
16
  }
17
17
  return undefined;
18
18
  };
@@ -7,7 +7,12 @@ import { path } from '../internal/utils/path';
7
7
 
8
8
  export class Agent extends APIResource {
9
9
  /**
10
- * List Templates
10
+ * List Agent Templates
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const agents = await client.agent.list();
15
+ * ```
11
16
  */
12
17
  list(
13
18
  query: AgentListParams | null | undefined = {},
@@ -17,14 +22,69 @@ export class Agent extends APIResource {
17
22
  }
18
23
 
19
24
  /**
20
- * Get Template
25
+ * Create Agent Generation
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const response = await client.agent.generate({
30
+ * prompt: 'prompt',
31
+ * url: 'url',
32
+ * });
33
+ * ```
34
+ */
35
+ generate(body: AgentGenerateParams, options?: RequestOptions): APIPromise<AgentGenerateResponse> {
36
+ return this._client.post('/v1/agents/generations', { body, ...options });
37
+ }
38
+
39
+ /**
40
+ * Get Agent Template
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const agent = await client.agent.get('template_name');
45
+ * ```
21
46
  */
22
47
  get(templateName: string, options?: RequestOptions): APIPromise<AgentGetResponse> {
23
48
  return this._client.get(path`/v1/agents/${templateName}`, options);
24
49
  }
25
50
 
51
+ /**
52
+ * Get Agent Generation
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const response = await client.agent.getGeneration(
57
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
58
+ * );
59
+ * ```
60
+ */
61
+ getGeneration(generationID: string, options?: RequestOptions): APIPromise<AgentGetGenerationResponse> {
62
+ return this._client.get(path`/v1/agents/generations/${generationID}`, options);
63
+ }
64
+
65
+ /**
66
+ * Publish Agent Version
67
+ *
68
+ * @deprecated
69
+ */
70
+ publish(
71
+ agentName: string,
72
+ body: AgentPublishParams,
73
+ options?: RequestOptions,
74
+ ): APIPromise<AgentPublishResponse> {
75
+ return this._client.post(path`/v1/agents/${agentName}/publish`, { body, ...options });
76
+ }
77
+
26
78
  /**
27
79
  * Execute WSA Realtime Endpoint
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const response = await client.agent.run({
84
+ * agent: 'agent',
85
+ * params: { foo: 'bar' },
86
+ * });
87
+ * ```
28
88
  */
29
89
  run(body: AgentRunParams, options?: RequestOptions): APIPromise<AgentRunResponse> {
30
90
  return this._client.post('/v1/agents/run', { body, ...options });
@@ -32,6 +92,14 @@ export class Agent extends APIResource {
32
92
 
33
93
  /**
34
94
  * Execute WSA Async Endpoint
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const response = await client.agent.runAsync({
99
+ * agent: 'agent',
100
+ * params: { foo: 'bar' },
101
+ * });
102
+ * ```
35
103
  */
36
104
  runAsync(body: AgentRunAsyncParams, options?: RequestOptions): APIPromise<AgentRunAsyncResponse> {
37
105
  return this._client.post('/v1/agents/async', { body, ...options });
@@ -39,6 +107,14 @@ export class Agent extends APIResource {
39
107
 
40
108
  /**
41
109
  * Execute WSA Batch Endpoint
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * const response = await client.agent.runBatch({
114
+ * inputs: [{}],
115
+ * shared_inputs: { agent: 'agent' },
116
+ * });
117
+ * ```
42
118
  */
43
119
  runBatch(body: AgentRunBatchParams, options?: RequestOptions): APIPromise<AgentRunBatchResponse> {
44
120
  return this._client.post('/v1/agents/batch', { body, ...options });
@@ -67,6 +143,70 @@ export namespace AgentListResponse {
67
143
  }
68
144
  }
69
145
 
146
+ export interface AgentGenerateResponse {
147
+ id: string;
148
+
149
+ status: string;
150
+
151
+ agent_name?: string | null;
152
+
153
+ completed_at?: string | null;
154
+
155
+ created_at?: string | null;
156
+
157
+ error?: string | null;
158
+
159
+ generated_version?: AgentGenerateResponse.GeneratedVersion | null;
160
+
161
+ generated_version_id?: string | null;
162
+
163
+ source_version_id?: string | null;
164
+
165
+ started_at?: string | null;
166
+
167
+ summary?: string | null;
168
+ }
169
+
170
+ export namespace AgentGenerateResponse {
171
+ export interface GeneratedVersion {
172
+ id: string;
173
+
174
+ agent_name: string;
175
+
176
+ created_at: string;
177
+
178
+ input_schema: unknown;
179
+
180
+ metadata: GeneratedVersion.Metadata;
181
+
182
+ output_schema: unknown;
183
+
184
+ steps: Array<unknown>;
185
+
186
+ version_number: number;
187
+
188
+ output_sample_data?: unknown;
189
+ }
190
+
191
+ export namespace GeneratedVersion {
192
+ export interface Metadata {
193
+ data_source?: string | null;
194
+
195
+ description?: string | null;
196
+
197
+ display_name?: string | null;
198
+
199
+ domain?: string | null;
200
+
201
+ entity_type?: string | null;
202
+
203
+ tags?: Array<string>;
204
+
205
+ vertical?: string | null;
206
+ }
207
+ }
208
+ }
209
+
70
210
  export interface AgentGetResponse {
71
211
  display_name: string;
72
212
 
@@ -99,14 +239,16 @@ export namespace AgentGetResponse {
99
239
  }
100
240
 
101
241
  export interface InputProperty {
102
- default?: string | null;
242
+ default?: string | boolean | number | null;
103
243
 
104
244
  description?: string | null;
105
245
 
106
- examples?: Array<string> | null;
246
+ examples?: Array<unknown> | null;
107
247
 
108
248
  is_localization_param?: boolean;
109
249
 
250
+ is_pagination_param?: boolean;
251
+
110
252
  name?: string;
111
253
 
112
254
  required?: boolean;
@@ -117,6 +259,76 @@ export namespace AgentGetResponse {
117
259
  }
118
260
  }
119
261
 
262
+ export interface AgentGetGenerationResponse {
263
+ id: string;
264
+
265
+ status: string;
266
+
267
+ agent_name?: string | null;
268
+
269
+ completed_at?: string | null;
270
+
271
+ created_at?: string | null;
272
+
273
+ error?: string | null;
274
+
275
+ generated_version?: AgentGetGenerationResponse.GeneratedVersion | null;
276
+
277
+ generated_version_id?: string | null;
278
+
279
+ source_version_id?: string | null;
280
+
281
+ started_at?: string | null;
282
+
283
+ summary?: string | null;
284
+ }
285
+
286
+ export namespace AgentGetGenerationResponse {
287
+ export interface GeneratedVersion {
288
+ id: string;
289
+
290
+ agent_name: string;
291
+
292
+ created_at: string;
293
+
294
+ input_schema: unknown;
295
+
296
+ metadata: GeneratedVersion.Metadata;
297
+
298
+ output_schema: unknown;
299
+
300
+ steps: Array<unknown>;
301
+
302
+ version_number: number;
303
+
304
+ output_sample_data?: unknown;
305
+ }
306
+
307
+ export namespace GeneratedVersion {
308
+ export interface Metadata {
309
+ data_source?: string | null;
310
+
311
+ description?: string | null;
312
+
313
+ display_name?: string | null;
314
+
315
+ domain?: string | null;
316
+
317
+ entity_type?: string | null;
318
+
319
+ tags?: Array<string>;
320
+
321
+ vertical?: string | null;
322
+ }
323
+ }
324
+ }
325
+
326
+ export interface AgentPublishResponse {
327
+ agent_name: string;
328
+
329
+ published_version_id: string;
330
+ }
331
+
120
332
  export interface AgentRunResponse {
121
333
  data: AgentRunResponse.Data;
122
334
 
@@ -188,6 +400,11 @@ export namespace AgentRunResponse {
188
400
  */
189
401
  html?: string;
190
402
 
403
+ /**
404
+ * List of all unique URLs found on the page.
405
+ */
406
+ links?: Array<string>;
407
+
191
408
  /**
192
409
  * The Markdown version of the HTML content.
193
410
  */
@@ -604,6 +821,46 @@ export interface AgentListParams {
604
821
  search?: string | null;
605
822
  }
606
823
 
824
+ export type AgentGenerateParams =
825
+ | AgentGenerateParams.CreateAgentGenerationRequest
826
+ | AgentGenerateParams.CreateAgentRefinementRequest;
827
+
828
+ export declare namespace AgentGenerateParams {
829
+ export interface CreateAgentGenerationRequest {
830
+ prompt: string;
831
+
832
+ url: string;
833
+
834
+ agent_name?: string | null;
835
+
836
+ input_schema?: unknown;
837
+
838
+ metadata?: CreateAgentGenerationRequest.Metadata | null;
839
+
840
+ output_schema?: unknown;
841
+ }
842
+
843
+ export namespace CreateAgentGenerationRequest {
844
+ export interface Metadata {
845
+ description?: string | null;
846
+
847
+ display_name?: string | null;
848
+
849
+ tags?: Array<string>;
850
+ }
851
+ }
852
+
853
+ export interface CreateAgentRefinementRequest {
854
+ from_agent: string;
855
+
856
+ prompt: string;
857
+ }
858
+ }
859
+
860
+ export interface AgentPublishParams {
861
+ version_id: string;
862
+ }
863
+
607
864
  export interface AgentRunParams {
608
865
  agent: string;
609
866
 
@@ -612,7 +869,7 @@ export interface AgentRunParams {
612
869
  /**
613
870
  * Response formats to include. All disabled by default.
614
871
  */
615
- formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
872
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers' | 'links'>;
616
873
 
617
874
  localization?: boolean;
618
875
  }
@@ -630,7 +887,7 @@ export interface AgentRunAsyncParams {
630
887
  /**
631
888
  * Response formats to include. All disabled by default.
632
889
  */
633
- formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
890
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers' | 'links'>;
634
891
 
635
892
  localization?: boolean;
636
893
 
@@ -666,7 +923,7 @@ export namespace AgentRunBatchParams {
666
923
  /**
667
924
  * Response formats to include. All disabled by default.
668
925
  */
669
- formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
926
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers' | 'links'>;
670
927
 
671
928
  localization?: boolean;
672
929
 
@@ -679,7 +936,7 @@ export namespace AgentRunBatchParams {
679
936
  /**
680
937
  * Response formats to include. All disabled by default.
681
938
  */
682
- formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
939
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers' | 'links'>;
683
940
 
684
941
  localization?: boolean;
685
942
 
@@ -690,11 +947,16 @@ export namespace AgentRunBatchParams {
690
947
  export declare namespace Agent {
691
948
  export {
692
949
  type AgentListResponse as AgentListResponse,
950
+ type AgentGenerateResponse as AgentGenerateResponse,
693
951
  type AgentGetResponse as AgentGetResponse,
952
+ type AgentGetGenerationResponse as AgentGetGenerationResponse,
953
+ type AgentPublishResponse as AgentPublishResponse,
694
954
  type AgentRunResponse as AgentRunResponse,
695
955
  type AgentRunAsyncResponse as AgentRunAsyncResponse,
696
956
  type AgentRunBatchResponse as AgentRunBatchResponse,
697
957
  type AgentListParams as AgentListParams,
958
+ type AgentGenerateParams as AgentGenerateParams,
959
+ type AgentPublishParams as AgentPublishParams,
698
960
  type AgentRunParams as AgentRunParams,
699
961
  type AgentRunAsyncParams as AgentRunAsyncParams,
700
962
  type AgentRunBatchParams as AgentRunBatchParams,
@@ -9,6 +9,11 @@ import { path } from '../internal/utils/path';
9
9
  export class Crawl extends APIResource {
10
10
  /**
11
11
  * Crawl by Filter
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const crawls = await client.crawl.list();
16
+ * ```
12
17
  */
13
18
  list(
14
19
  query: CrawlListParams | null | undefined = {},
@@ -19,6 +24,11 @@ export class Crawl extends APIResource {
19
24
 
20
25
  /**
21
26
  * Create crawl task
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const response = await client.crawl.run({ url: 'url' });
31
+ * ```
22
32
  */
23
33
  run(body: CrawlRunParams, options?: RequestOptions): APIPromise<CrawlRunResponse> {
24
34
  return this._client.post('/v1/crawl', { body, ...options });
@@ -26,6 +36,13 @@ export class Crawl extends APIResource {
26
36
 
27
37
  /**
28
38
  * Get crawl data
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const response = await client.crawl.status(
43
+ * '123e4567-e89b-12d3-a456-426614174000',
44
+ * );
45
+ * ```
29
46
  */
30
47
  status(id: string, options?: RequestOptions): APIPromise<CrawlStatusResponse> {
31
48
  return this._client.get(path`/v1/crawl/${id}`, options);
@@ -33,6 +50,13 @@ export class Crawl extends APIResource {
33
50
 
34
51
  /**
35
52
  * Cancel Crawl
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const response = await client.crawl.terminate(
57
+ * '123e4567-e89b-12d3-a456-426614174000',
58
+ * );
59
+ * ```
36
60
  */
37
61
  terminate(id: string, options?: RequestOptions): APIPromise<CrawlTerminateResponse> {
38
62
  return this._client.delete(path`/v1/crawl/${id}`, options);
@@ -708,7 +732,7 @@ export namespace CrawlRunParams {
708
732
  /**
709
733
  * Browser driver to use
710
734
  */
711
- driver?: 'vx6' | 'vx8' | 'vx8-pro' | 'vx10' | 'vx10-pro' | 'vx12' | 'vx12-pro';
735
+ driver?: 'vx6' | 'vx8' | 'vx8-pro' | 'vx10' | 'vx10-pro' | 'vx12' | 'vx12-pro' | 'media-vx6';
712
736
 
713
737
  /**
714
738
  * Expected HTTP status codes for successful requests
@@ -718,7 +742,7 @@ export namespace CrawlRunParams {
718
742
  /**
719
743
  * List of acceptable response formats in order of preference
720
744
  */
721
- formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers'>;
745
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers' | 'links'>;
722
746
 
723
747
  /**
724
748
  * Custom HTTP headers to include in the request
@@ -1273,6 +1297,13 @@ export namespace CrawlRunParams {
1273
1297
  | 'zu-ZA'
1274
1298
  | 'auto';
1275
1299
 
1300
+ /**
1301
+ * Selects which markdown conversion strategy to use. "full_page" converts the
1302
+ * entire HTML page. "main_content" uses Mozilla Readability to extract the main
1303
+ * article content before converting.
1304
+ */
1305
+ markdown_backend?: 'full_page' | 'main_content';
1306
+
1276
1307
  /**
1277
1308
  * HTTP method for the request
1278
1309
  */
@@ -4,11 +4,16 @@ export * from './shared';
4
4
  export {
5
5
  Agent,
6
6
  type AgentListResponse,
7
+ type AgentGenerateResponse,
7
8
  type AgentGetResponse,
9
+ type AgentGetGenerationResponse,
10
+ type AgentPublishResponse,
8
11
  type AgentRunResponse,
9
12
  type AgentRunAsyncResponse,
10
13
  type AgentRunBatchResponse,
11
14
  type AgentListParams,
15
+ type AgentGenerateParams,
16
+ type AgentPublishParams,
12
17
  type AgentRunParams,
13
18
  type AgentRunAsyncParams,
14
19
  type AgentRunBatchParams,