valyu-js 2.7.0 → 2.7.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/dist/index.d.mts CHANGED
@@ -204,7 +204,7 @@ interface AlertEmailConfig {
204
204
  custom_url?: string;
205
205
  }
206
206
  type DeepResearchMode = "fast" | "standard" | "lite" | "heavy" | "max";
207
- type DeepResearchStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
207
+ type DeepResearchStatus = "queued" | "running" | "awaiting_input" | "paused" | "completed" | "failed" | "cancelled";
208
208
  type DeepResearchOutputFormat = "markdown" | "pdf" | "toon" | Record<string, any>;
209
209
  type DeepResearchOutputType = "markdown" | "json" | "toon";
210
210
  type ImageType = "chart" | "ai_generated";
@@ -281,6 +281,30 @@ interface DeepResearchCreateOptions {
281
281
  alertEmail?: string | AlertEmailConfig;
282
282
  brandCollectionId?: string;
283
283
  metadata?: Record<string, string | number | boolean>;
284
+ hitl?: HitlConfig;
285
+ }
286
+ interface HitlConfig {
287
+ planningQuestions?: boolean;
288
+ planReview?: boolean;
289
+ sourceReview?: boolean;
290
+ outlineReview?: boolean;
291
+ }
292
+ type InteractionType = "planning_questions" | "plan_review" | "source_review" | "outline_review";
293
+ interface Interaction {
294
+ interaction_id: string;
295
+ type: InteractionType;
296
+ data: Record<string, any>;
297
+ created_at: number;
298
+ timeout_ms: number;
299
+ expected_response?: Record<string, any>;
300
+ }
301
+ interface InteractionHistoryEntry {
302
+ interaction_id: string;
303
+ type: InteractionType;
304
+ created_at: number;
305
+ responded_at?: number;
306
+ auto_continued: boolean;
307
+ response?: Record<string, any>;
284
308
  }
285
309
  interface Progress {
286
310
  current_step: number;
@@ -365,6 +389,9 @@ interface DeepResearchStatusResponse {
365
389
  usage?: DeepResearchUsage;
366
390
  batch_id?: string;
367
391
  batch_task_id?: string;
392
+ hitl_config?: Record<string, boolean>;
393
+ interaction?: Interaction;
394
+ hitl_history?: InteractionHistoryEntry[];
368
395
  error?: string;
369
396
  }
370
397
  interface DeepResearchTaskListItem {
@@ -414,6 +441,12 @@ interface DeepResearchGetAssetsResponse {
414
441
  contentType?: string;
415
442
  error?: string;
416
443
  }
444
+ interface DeepResearchRespondResponse {
445
+ success: boolean;
446
+ status?: string;
447
+ deepresearch_id?: string;
448
+ error?: string;
449
+ }
417
450
  interface WaitOptions {
418
451
  pollInterval?: number;
419
452
  maxWaitTime?: number;
@@ -649,6 +682,7 @@ declare class Valyu {
649
682
  delete: (taskId: string) => Promise<DeepResearchDeleteResponse>;
650
683
  togglePublic: (taskId: string, isPublic: boolean) => Promise<DeepResearchTogglePublicResponse>;
651
684
  getAssets: (taskId: string, assetId: string, options?: DeepResearchGetAssetsOptions) => Promise<DeepResearchGetAssetsResponse>;
685
+ respond: (taskId: string, interactionId: string, response: Record<string, any>) => Promise<DeepResearchRespondResponse>;
652
686
  };
653
687
  batch: {
654
688
  create: (options?: CreateBatchOptions) => Promise<CreateBatchResponse>;
@@ -767,6 +801,13 @@ declare class Valyu {
767
801
  * DeepResearch: Add follow-up instruction
768
802
  */
769
803
  private _deepresearchUpdate;
804
+ /**
805
+ * DeepResearch: Respond to a HITL checkpoint
806
+ * @param taskId - The task ID to respond to
807
+ * @param interactionId - The interaction_id from the task's interaction field
808
+ * @param response - Response data matching the checkpoint type
809
+ */
810
+ private _deepresearchRespond;
770
811
  /**
771
812
  * DeepResearch: Cancel task
772
813
  */
@@ -900,4 +941,4 @@ declare class Valyu {
900
941
  private _datasourcesCategories;
901
942
  }
902
943
 
903
- export { type AIUsage, type AddBatchTasksOptions, type AddBatchTasksResponse, type AlertEmailConfig, type AnswerErrorResponse, type AnswerOptions, type AnswerResponse, type AnswerStreamChunk, type AnswerStreamChunkType, type AnswerSuccessResponse, type BatchCounts, type BatchPagination, type BatchStatus, type BatchStatusResponse, type BatchTaskCreated, type BatchTaskInput, type BatchTaskListItem, type BatchWaitOptions, type CancelBatchResponse, type ChartDataPoint, type ChartDataSeries, type ChartType, type ContentResponseLength, type ContentResult, type ContentResultFailed, type ContentResultSuccess, type ContentsAsyncJobResponse, type ContentsJobResponse, type ContentsJobStatus, type ContentsJobWaitOptions, type ContentsOptions, type ContentsResponse, type Cost, type CountryCode, type CreateBatchOptions, type CreateBatchResponse, type Datasource, type DatasourceCategory, type DatasourceCategoryId, type DatasourceCoverage, type DatasourceModality, type DatasourcePricing, type DatasourcesCategoriesResponse, type DatasourcesListOptions, type DatasourcesListResponse, type DeepResearchBatch, type DeepResearchCancelResponse, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type ImageMetadata, type ImageType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, Valyu, type WaitOptions, verifyContentsWebhookSignature };
944
+ export { type AIUsage, type AddBatchTasksOptions, type AddBatchTasksResponse, type AlertEmailConfig, type AnswerErrorResponse, type AnswerOptions, type AnswerResponse, type AnswerStreamChunk, type AnswerStreamChunkType, type AnswerSuccessResponse, type BatchCounts, type BatchPagination, type BatchStatus, type BatchStatusResponse, type BatchTaskCreated, type BatchTaskInput, type BatchTaskListItem, type BatchWaitOptions, type CancelBatchResponse, type ChartDataPoint, type ChartDataSeries, type ChartType, type ContentResponseLength, type ContentResult, type ContentResultFailed, type ContentResultSuccess, type ContentsAsyncJobResponse, type ContentsJobResponse, type ContentsJobStatus, type ContentsJobWaitOptions, type ContentsOptions, type ContentsResponse, type Cost, type CountryCode, type CreateBatchOptions, type CreateBatchResponse, type Datasource, type DatasourceCategory, type DatasourceCategoryId, type DatasourceCoverage, type DatasourceModality, type DatasourcePricing, type DatasourcesCategoriesResponse, type DatasourcesListOptions, type DatasourcesListResponse, type DeepResearchBatch, type DeepResearchCancelResponse, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchRespondResponse, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type HitlConfig, type ImageMetadata, type ImageType, type Interaction, type InteractionHistoryEntry, type InteractionType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, Valyu, type WaitOptions, verifyContentsWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -204,7 +204,7 @@ interface AlertEmailConfig {
204
204
  custom_url?: string;
205
205
  }
206
206
  type DeepResearchMode = "fast" | "standard" | "lite" | "heavy" | "max";
207
- type DeepResearchStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
207
+ type DeepResearchStatus = "queued" | "running" | "awaiting_input" | "paused" | "completed" | "failed" | "cancelled";
208
208
  type DeepResearchOutputFormat = "markdown" | "pdf" | "toon" | Record<string, any>;
209
209
  type DeepResearchOutputType = "markdown" | "json" | "toon";
210
210
  type ImageType = "chart" | "ai_generated";
@@ -281,6 +281,30 @@ interface DeepResearchCreateOptions {
281
281
  alertEmail?: string | AlertEmailConfig;
282
282
  brandCollectionId?: string;
283
283
  metadata?: Record<string, string | number | boolean>;
284
+ hitl?: HitlConfig;
285
+ }
286
+ interface HitlConfig {
287
+ planningQuestions?: boolean;
288
+ planReview?: boolean;
289
+ sourceReview?: boolean;
290
+ outlineReview?: boolean;
291
+ }
292
+ type InteractionType = "planning_questions" | "plan_review" | "source_review" | "outline_review";
293
+ interface Interaction {
294
+ interaction_id: string;
295
+ type: InteractionType;
296
+ data: Record<string, any>;
297
+ created_at: number;
298
+ timeout_ms: number;
299
+ expected_response?: Record<string, any>;
300
+ }
301
+ interface InteractionHistoryEntry {
302
+ interaction_id: string;
303
+ type: InteractionType;
304
+ created_at: number;
305
+ responded_at?: number;
306
+ auto_continued: boolean;
307
+ response?: Record<string, any>;
284
308
  }
285
309
  interface Progress {
286
310
  current_step: number;
@@ -365,6 +389,9 @@ interface DeepResearchStatusResponse {
365
389
  usage?: DeepResearchUsage;
366
390
  batch_id?: string;
367
391
  batch_task_id?: string;
392
+ hitl_config?: Record<string, boolean>;
393
+ interaction?: Interaction;
394
+ hitl_history?: InteractionHistoryEntry[];
368
395
  error?: string;
369
396
  }
370
397
  interface DeepResearchTaskListItem {
@@ -414,6 +441,12 @@ interface DeepResearchGetAssetsResponse {
414
441
  contentType?: string;
415
442
  error?: string;
416
443
  }
444
+ interface DeepResearchRespondResponse {
445
+ success: boolean;
446
+ status?: string;
447
+ deepresearch_id?: string;
448
+ error?: string;
449
+ }
417
450
  interface WaitOptions {
418
451
  pollInterval?: number;
419
452
  maxWaitTime?: number;
@@ -649,6 +682,7 @@ declare class Valyu {
649
682
  delete: (taskId: string) => Promise<DeepResearchDeleteResponse>;
650
683
  togglePublic: (taskId: string, isPublic: boolean) => Promise<DeepResearchTogglePublicResponse>;
651
684
  getAssets: (taskId: string, assetId: string, options?: DeepResearchGetAssetsOptions) => Promise<DeepResearchGetAssetsResponse>;
685
+ respond: (taskId: string, interactionId: string, response: Record<string, any>) => Promise<DeepResearchRespondResponse>;
652
686
  };
653
687
  batch: {
654
688
  create: (options?: CreateBatchOptions) => Promise<CreateBatchResponse>;
@@ -767,6 +801,13 @@ declare class Valyu {
767
801
  * DeepResearch: Add follow-up instruction
768
802
  */
769
803
  private _deepresearchUpdate;
804
+ /**
805
+ * DeepResearch: Respond to a HITL checkpoint
806
+ * @param taskId - The task ID to respond to
807
+ * @param interactionId - The interaction_id from the task's interaction field
808
+ * @param response - Response data matching the checkpoint type
809
+ */
810
+ private _deepresearchRespond;
770
811
  /**
771
812
  * DeepResearch: Cancel task
772
813
  */
@@ -900,4 +941,4 @@ declare class Valyu {
900
941
  private _datasourcesCategories;
901
942
  }
902
943
 
903
- export { type AIUsage, type AddBatchTasksOptions, type AddBatchTasksResponse, type AlertEmailConfig, type AnswerErrorResponse, type AnswerOptions, type AnswerResponse, type AnswerStreamChunk, type AnswerStreamChunkType, type AnswerSuccessResponse, type BatchCounts, type BatchPagination, type BatchStatus, type BatchStatusResponse, type BatchTaskCreated, type BatchTaskInput, type BatchTaskListItem, type BatchWaitOptions, type CancelBatchResponse, type ChartDataPoint, type ChartDataSeries, type ChartType, type ContentResponseLength, type ContentResult, type ContentResultFailed, type ContentResultSuccess, type ContentsAsyncJobResponse, type ContentsJobResponse, type ContentsJobStatus, type ContentsJobWaitOptions, type ContentsOptions, type ContentsResponse, type Cost, type CountryCode, type CreateBatchOptions, type CreateBatchResponse, type Datasource, type DatasourceCategory, type DatasourceCategoryId, type DatasourceCoverage, type DatasourceModality, type DatasourcePricing, type DatasourcesCategoriesResponse, type DatasourcesListOptions, type DatasourcesListResponse, type DeepResearchBatch, type DeepResearchCancelResponse, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type ImageMetadata, type ImageType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, Valyu, type WaitOptions, verifyContentsWebhookSignature };
944
+ export { type AIUsage, type AddBatchTasksOptions, type AddBatchTasksResponse, type AlertEmailConfig, type AnswerErrorResponse, type AnswerOptions, type AnswerResponse, type AnswerStreamChunk, type AnswerStreamChunkType, type AnswerSuccessResponse, type BatchCounts, type BatchPagination, type BatchStatus, type BatchStatusResponse, type BatchTaskCreated, type BatchTaskInput, type BatchTaskListItem, type BatchWaitOptions, type CancelBatchResponse, type ChartDataPoint, type ChartDataSeries, type ChartType, type ContentResponseLength, type ContentResult, type ContentResultFailed, type ContentResultSuccess, type ContentsAsyncJobResponse, type ContentsJobResponse, type ContentsJobStatus, type ContentsJobWaitOptions, type ContentsOptions, type ContentsResponse, type Cost, type CountryCode, type CreateBatchOptions, type CreateBatchResponse, type Datasource, type DatasourceCategory, type DatasourceCategoryId, type DatasourceCoverage, type DatasourceModality, type DatasourcePricing, type DatasourcesCategoriesResponse, type DatasourcesListOptions, type DatasourcesListResponse, type DeepResearchBatch, type DeepResearchCancelResponse, type DeepResearchCreateOptions, type DeepResearchCreateResponse, type DeepResearchDeleteResponse, type DeepResearchGetAssetsOptions, type DeepResearchGetAssetsResponse, type DeepResearchListResponse, type DeepResearchMode, type DeepResearchOutputFormat, type DeepResearchRespondResponse, type DeepResearchSearchConfig, type DeepResearchSource, type DeepResearchStatus, type DeepResearchStatusResponse, type DeepResearchTaskListItem, type DeepResearchTogglePublicResponse, type DeepResearchUpdateResponse, type DeepResearchUsage, type ExtractEffort, type ExtractionMetadata, type FeedbackResponse, type FeedbackSentiment, type FileAttachment, type HitlConfig, type ImageMetadata, type ImageType, type Interaction, type InteractionHistoryEntry, type InteractionType, type ListBatchTasksOptions, type ListBatchTasksResponse, type ListBatchesOptions, type ListBatchesResponse, type ListOptions, type MCPServerConfig, type Progress, type ResponseLength, type SearchMetadata, type SearchOptions, type SearchResponse, type SearchResult, type SearchType, type StreamCallback, Valyu, type WaitOptions, verifyContentsWebhookSignature };
package/dist/index.js CHANGED
@@ -97,7 +97,8 @@ var Valyu = class {
97
97
  cancel: this._deepresearchCancel.bind(this),
98
98
  delete: this._deepresearchDelete.bind(this),
99
99
  togglePublic: this._deepresearchTogglePublic.bind(this),
100
- getAssets: this._deepresearchGetAssets.bind(this)
100
+ getAssets: this._deepresearchGetAssets.bind(this),
101
+ respond: this._deepresearchRespond.bind(this)
101
102
  };
102
103
  this.batch = {
103
104
  create: this._batchCreate.bind(this),
@@ -708,6 +709,17 @@ var Valyu = class {
708
709
  }
709
710
  }
710
711
  if (options.metadata) payload.metadata = options.metadata;
712
+ if (options.hitl) {
713
+ payload.hitl = {};
714
+ if (options.hitl.planningQuestions !== void 0)
715
+ payload.hitl.planning_questions = options.hitl.planningQuestions;
716
+ if (options.hitl.planReview !== void 0)
717
+ payload.hitl.plan_review = options.hitl.planReview;
718
+ if (options.hitl.sourceReview !== void 0)
719
+ payload.hitl.source_review = options.hitl.sourceReview;
720
+ if (options.hitl.outlineReview !== void 0)
721
+ payload.hitl.outline_review = options.hitl.outlineReview;
722
+ }
711
723
  const response = await import_axios.default.post(
712
724
  `${this.baseUrl}/deepresearch/tasks`,
713
725
  payload,
@@ -854,6 +866,30 @@ var Valyu = class {
854
866
  };
855
867
  }
856
868
  }
869
+ /**
870
+ * DeepResearch: Respond to a HITL checkpoint
871
+ * @param taskId - The task ID to respond to
872
+ * @param interactionId - The interaction_id from the task's interaction field
873
+ * @param response - Response data matching the checkpoint type
874
+ */
875
+ async _deepresearchRespond(taskId, interactionId, response) {
876
+ try {
877
+ const resp = await import_axios.default.post(
878
+ `${this.baseUrl}/deepresearch/tasks/${taskId}/respond`,
879
+ {
880
+ interaction_id: interactionId,
881
+ response
882
+ },
883
+ { headers: this.headers }
884
+ );
885
+ return { success: true, ...resp.data };
886
+ } catch (e) {
887
+ return {
888
+ success: false,
889
+ error: e.response?.data?.error || e.message
890
+ };
891
+ }
892
+ }
857
893
  /**
858
894
  * DeepResearch: Cancel task
859
895
  */