valyu-js 2.7.1 → 2.7.2
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 +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +57 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -451,6 +451,7 @@ interface WaitOptions {
|
|
|
451
451
|
pollInterval?: number;
|
|
452
452
|
maxWaitTime?: number;
|
|
453
453
|
onProgress?: (status: DeepResearchStatusResponse) => void;
|
|
454
|
+
onInteraction?: (interaction: Interaction) => Promise<Record<string, any> | null | undefined> | Record<string, any> | null | undefined;
|
|
454
455
|
}
|
|
455
456
|
interface StreamCallback {
|
|
456
457
|
onMessage?: (message: any) => void;
|
|
@@ -683,6 +684,16 @@ declare class Valyu {
|
|
|
683
684
|
togglePublic: (taskId: string, isPublic: boolean) => Promise<DeepResearchTogglePublicResponse>;
|
|
684
685
|
getAssets: (taskId: string, assetId: string, options?: DeepResearchGetAssetsOptions) => Promise<DeepResearchGetAssetsResponse>;
|
|
685
686
|
respond: (taskId: string, interactionId: string, response: Record<string, any>) => Promise<DeepResearchRespondResponse>;
|
|
687
|
+
respondPlanningQuestions: (taskId: string, interactionId: string, answers: {
|
|
688
|
+
question: string;
|
|
689
|
+
answer: string;
|
|
690
|
+
}[]) => Promise<DeepResearchRespondResponse>;
|
|
691
|
+
approvePlan: (taskId: string, interactionId: string, modifications?: string) => Promise<DeepResearchRespondResponse>;
|
|
692
|
+
respondSourceReview: (taskId: string, interactionId: string, options?: {
|
|
693
|
+
includedDomains?: string[];
|
|
694
|
+
excludedDomains?: string[];
|
|
695
|
+
}) => Promise<DeepResearchRespondResponse>;
|
|
696
|
+
approveOutline: (taskId: string, interactionId: string, modifications?: string) => Promise<DeepResearchRespondResponse>;
|
|
686
697
|
};
|
|
687
698
|
batch: {
|
|
688
699
|
create: (options?: CreateBatchOptions) => Promise<CreateBatchResponse>;
|
|
@@ -808,6 +819,22 @@ declare class Valyu {
|
|
|
808
819
|
* @param response - Response data matching the checkpoint type
|
|
809
820
|
*/
|
|
810
821
|
private _deepresearchRespond;
|
|
822
|
+
/**
|
|
823
|
+
* DeepResearch: Respond to a planning_questions checkpoint
|
|
824
|
+
*/
|
|
825
|
+
private _deepresearchRespondPlanningQuestions;
|
|
826
|
+
/**
|
|
827
|
+
* DeepResearch: Approve or request modifications to a plan_review checkpoint
|
|
828
|
+
*/
|
|
829
|
+
private _deepresearchApprovePlan;
|
|
830
|
+
/**
|
|
831
|
+
* DeepResearch: Respond to a source_review checkpoint
|
|
832
|
+
*/
|
|
833
|
+
private _deepresearchRespondSourceReview;
|
|
834
|
+
/**
|
|
835
|
+
* DeepResearch: Approve or request modifications to an outline_review checkpoint
|
|
836
|
+
*/
|
|
837
|
+
private _deepresearchApproveOutline;
|
|
811
838
|
/**
|
|
812
839
|
* DeepResearch: Cancel task
|
|
813
840
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -451,6 +451,7 @@ interface WaitOptions {
|
|
|
451
451
|
pollInterval?: number;
|
|
452
452
|
maxWaitTime?: number;
|
|
453
453
|
onProgress?: (status: DeepResearchStatusResponse) => void;
|
|
454
|
+
onInteraction?: (interaction: Interaction) => Promise<Record<string, any> | null | undefined> | Record<string, any> | null | undefined;
|
|
454
455
|
}
|
|
455
456
|
interface StreamCallback {
|
|
456
457
|
onMessage?: (message: any) => void;
|
|
@@ -683,6 +684,16 @@ declare class Valyu {
|
|
|
683
684
|
togglePublic: (taskId: string, isPublic: boolean) => Promise<DeepResearchTogglePublicResponse>;
|
|
684
685
|
getAssets: (taskId: string, assetId: string, options?: DeepResearchGetAssetsOptions) => Promise<DeepResearchGetAssetsResponse>;
|
|
685
686
|
respond: (taskId: string, interactionId: string, response: Record<string, any>) => Promise<DeepResearchRespondResponse>;
|
|
687
|
+
respondPlanningQuestions: (taskId: string, interactionId: string, answers: {
|
|
688
|
+
question: string;
|
|
689
|
+
answer: string;
|
|
690
|
+
}[]) => Promise<DeepResearchRespondResponse>;
|
|
691
|
+
approvePlan: (taskId: string, interactionId: string, modifications?: string) => Promise<DeepResearchRespondResponse>;
|
|
692
|
+
respondSourceReview: (taskId: string, interactionId: string, options?: {
|
|
693
|
+
includedDomains?: string[];
|
|
694
|
+
excludedDomains?: string[];
|
|
695
|
+
}) => Promise<DeepResearchRespondResponse>;
|
|
696
|
+
approveOutline: (taskId: string, interactionId: string, modifications?: string) => Promise<DeepResearchRespondResponse>;
|
|
686
697
|
};
|
|
687
698
|
batch: {
|
|
688
699
|
create: (options?: CreateBatchOptions) => Promise<CreateBatchResponse>;
|
|
@@ -808,6 +819,22 @@ declare class Valyu {
|
|
|
808
819
|
* @param response - Response data matching the checkpoint type
|
|
809
820
|
*/
|
|
810
821
|
private _deepresearchRespond;
|
|
822
|
+
/**
|
|
823
|
+
* DeepResearch: Respond to a planning_questions checkpoint
|
|
824
|
+
*/
|
|
825
|
+
private _deepresearchRespondPlanningQuestions;
|
|
826
|
+
/**
|
|
827
|
+
* DeepResearch: Approve or request modifications to a plan_review checkpoint
|
|
828
|
+
*/
|
|
829
|
+
private _deepresearchApprovePlan;
|
|
830
|
+
/**
|
|
831
|
+
* DeepResearch: Respond to a source_review checkpoint
|
|
832
|
+
*/
|
|
833
|
+
private _deepresearchRespondSourceReview;
|
|
834
|
+
/**
|
|
835
|
+
* DeepResearch: Approve or request modifications to an outline_review checkpoint
|
|
836
|
+
*/
|
|
837
|
+
private _deepresearchApproveOutline;
|
|
811
838
|
/**
|
|
812
839
|
* DeepResearch: Cancel task
|
|
813
840
|
*/
|
package/dist/index.js
CHANGED
|
@@ -98,7 +98,11 @@ var Valyu = class {
|
|
|
98
98
|
delete: this._deepresearchDelete.bind(this),
|
|
99
99
|
togglePublic: this._deepresearchTogglePublic.bind(this),
|
|
100
100
|
getAssets: this._deepresearchGetAssets.bind(this),
|
|
101
|
-
respond: this._deepresearchRespond.bind(this)
|
|
101
|
+
respond: this._deepresearchRespond.bind(this),
|
|
102
|
+
respondPlanningQuestions: this._deepresearchRespondPlanningQuestions.bind(this),
|
|
103
|
+
approvePlan: this._deepresearchApprovePlan.bind(this),
|
|
104
|
+
respondSourceReview: this._deepresearchRespondSourceReview.bind(this),
|
|
105
|
+
approveOutline: this._deepresearchApproveOutline.bind(this)
|
|
102
106
|
};
|
|
103
107
|
this.batch = {
|
|
104
108
|
create: this._batchCreate.bind(this),
|
|
@@ -765,6 +769,19 @@ var Valyu = class {
|
|
|
765
769
|
if (options.onProgress) {
|
|
766
770
|
options.onProgress(status);
|
|
767
771
|
}
|
|
772
|
+
if ((status.status === "awaiting_input" || status.status === "paused") && status.interaction) {
|
|
773
|
+
if (options.onInteraction) {
|
|
774
|
+
const response = await options.onInteraction(status.interaction);
|
|
775
|
+
if (response) {
|
|
776
|
+
await this._deepresearchRespond(
|
|
777
|
+
taskId,
|
|
778
|
+
status.interaction.interaction_id,
|
|
779
|
+
response
|
|
780
|
+
);
|
|
781
|
+
continue;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
768
785
|
if (status.status === "completed" || status.status === "failed" || status.status === "cancelled") {
|
|
769
786
|
return status;
|
|
770
787
|
}
|
|
@@ -890,6 +907,45 @@ var Valyu = class {
|
|
|
890
907
|
};
|
|
891
908
|
}
|
|
892
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* DeepResearch: Respond to a planning_questions checkpoint
|
|
912
|
+
*/
|
|
913
|
+
async _deepresearchRespondPlanningQuestions(taskId, interactionId, answers) {
|
|
914
|
+
return this._deepresearchRespond(taskId, interactionId, {
|
|
915
|
+
answers
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* DeepResearch: Approve or request modifications to a plan_review checkpoint
|
|
920
|
+
*/
|
|
921
|
+
async _deepresearchApprovePlan(taskId, interactionId, modifications) {
|
|
922
|
+
const response = { approved: true };
|
|
923
|
+
if (modifications) {
|
|
924
|
+
response.approved = false;
|
|
925
|
+
response.modifications = modifications;
|
|
926
|
+
}
|
|
927
|
+
return this._deepresearchRespond(taskId, interactionId, response);
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* DeepResearch: Respond to a source_review checkpoint
|
|
931
|
+
*/
|
|
932
|
+
async _deepresearchRespondSourceReview(taskId, interactionId, options = {}) {
|
|
933
|
+
return this._deepresearchRespond(taskId, interactionId, {
|
|
934
|
+
included_domains: options.includedDomains || [],
|
|
935
|
+
excluded_domains: options.excludedDomains || []
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* DeepResearch: Approve or request modifications to an outline_review checkpoint
|
|
940
|
+
*/
|
|
941
|
+
async _deepresearchApproveOutline(taskId, interactionId, modifications) {
|
|
942
|
+
const response = { approved: true };
|
|
943
|
+
if (modifications) {
|
|
944
|
+
response.approved = false;
|
|
945
|
+
response.modifications = modifications;
|
|
946
|
+
}
|
|
947
|
+
return this._deepresearchRespond(taskId, interactionId, response);
|
|
948
|
+
}
|
|
893
949
|
/**
|
|
894
950
|
* DeepResearch: Cancel task
|
|
895
951
|
*/
|