Skip to content

Automate browser based workflows with AI

add completion criteria to navigation block as well (#1385)

Shuchang Zhenge61f6632c38d
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx
index 43119f6ee..25d13c333 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx
@@ -41,6 +41,8 @@ function LoginNode({ id, data }: NodeProps<LoginNode>) {
cacheActions: data.cacheActions,
totpVerificationUrl: data.totpVerificationUrl,
totpIdentifier: data.totpIdentifier,
+ completeCriterion: data.completeCriterion,
+ terminateCriterion: data.terminateCriterion,
});
const deleteNodeCallback = useDeleteNodeCallback();
@@ -155,6 +157,20 @@ function LoginNode({ id, data }: NodeProps<LoginNode>) {
</AccordionTrigger>
<AccordionContent className="pl-6 pr-1 pt-1">
<div className="space-y-4">
+ <div className="space-y-2">
+ <Label className="text-xs text-slate-300">
+ Complete if...
+ </Label>
+ <WorkflowBlockInputTextarea
+ nodeId={id}
+ onChange={(value) => {
+ handleChange("completeCriterion", value);
+ }}
+ value={inputs.completeCriterion}
+ className="nopan text-xs"
+ />
+ </div>
+ <Separator />
<div className="flex items-center justify-between">
<div className="flex gap-2">
<Label className="text-xs font-normal text-slate-300">
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts
index 3868f5d5e..78b7f5748 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/types.ts
@@ -11,6 +11,8 @@ export type LoginNodeData = NodeBaseData & {
totpVerificationUrl: string | null;
totpIdentifier: string | null;
cacheActions: boolean;
+ completeCriterion: string;
+ terminateCriterion: string;
};
export type LoginNode = Node<LoginNodeData, "login">;
@@ -29,6 +31,8 @@ export const loginNodeDefaultData: LoginNodeData = {
totpIdentifier: null,
continueOnFailure: false,
cacheActions: false,
+ completeCriterion: "",
+ terminateCriterion: "",
} as const;
export function isLoginNode(node: Node): node is LoginNode {
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx
index 40bfe81cd..119a991f0 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx
@@ -43,6 +43,8 @@ function NavigationNode({ id, data }: NodeProps<NavigationNode>) {
downloadSuffix: data.downloadSuffix,
totpVerificationUrl: data.totpVerificationUrl,
totpIdentifier: data.totpIdentifier,
+ completeCriterion: data.completeCriterion,
+ terminateCriterion: data.terminateCriterion,
});
const deleteNodeCallback = useDeleteNodeCallback();
@@ -142,6 +144,20 @@ function NavigationNode({ id, data }: NodeProps<NavigationNode>) {
</AccordionTrigger>
<AccordionContent className="pl-6 pr-1 pt-1">
<div className="space-y-4">
+ <div className="space-y-2">
+ <Label className="text-xs text-slate-300">
+ Complete if...
+ </Label>
+ <WorkflowBlockInputTextarea
+ nodeId={id}
+ onChange={(value) => {
+ handleChange("completeCriterion", value);
+ }}
+ value={inputs.completeCriterion}
+ className="nopan text-xs"
+ />
+ </div>
+ <Separator />
<div className="flex items-center justify-between">
<div className="flex gap-2">
<Label className="text-xs font-normal text-slate-300">
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/types.ts
index 8f19a7474..16d4166f7 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/types.ts
@@ -5,6 +5,8 @@ export type NavigationNodeData = NodeBaseData & {
url: string;
navigationGoal: string;
errorCodeMapping: string;
+ completeCriterion: string;
+ terminateCriterion: string;
maxRetries: number | null;
maxStepsOverride: number | null;
allowDownloads: boolean;
@@ -21,6 +23,8 @@ export const navigationNodeDefaultData: NavigationNodeData = {
label: "",
url: "",
navigationGoal: "",
+ completeCriterion: "",
+ terminateCriterion: "",
errorCodeMapping: "null",
maxRetries: null,
maxStepsOverride: null,
diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
index 16152d6b0..5ea9c20a7 100644
--- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
@@ -247,6 +247,8 @@ function convertToNode(
totpVerificationUrl: block.totp_verification_url ?? null,
cacheActions: block.cache_actions,
maxStepsOverride: block.max_steps_per_run ?? null,
+ completeCriterion: block.complete_criterion ?? "",
+ terminateCriterion: block.terminate_criterion ?? "",
},
};
}
@@ -283,6 +285,8 @@ function convertToNode(
totpVerificationUrl: block.totp_verification_url ?? null,
cacheActions: block.cache_actions,
maxStepsOverride: block.max_steps_per_run ?? null,
+ completeCriterion: block.complete_criterion ?? "",
+ terminateCriterion: block.terminate_criterion ?? "",
},
};
}
@@ -879,6 +883,8 @@ function getWorkflowBlock(node: WorkflowBlockNode): BlockYAML {
totp_identifier: node.data.totpIdentifier,
totp_verification_url: node.data.totpVerificationUrl,
cache_actions: node.data.cacheActions,
+ complete_criterion: node.data.completeCriterion,
+ terminate_criterion: node.data.terminateCriterion,
};
}
case "extraction": {
@@ -916,6 +922,8 @@ function getWorkflowBlock(node: WorkflowBlockNode): BlockYAML {
totp_identifier: node.data.totpIdentifier,
totp_verification_url: node.data.totpVerificationUrl,
cache_actions: node.data.cacheActions,
+ complete_criterion: node.data.completeCriterion,
+ terminate_criterion: node.data.terminateCriterion,
};
}
case "wait": {
@@ -1491,6 +1499,8 @@ function convertBlocksToBlockYAML(
totp_identifier: block.totp_identifier,
totp_verification_url: block.totp_verification_url,
cache_actions: block.cache_actions,
+ complete_criterion: block.complete_criterion,
+ terminate_criterion: block.terminate_criterion,
};
return blockYaml;
}
@@ -1523,6 +1533,8 @@ function convertBlocksToBlockYAML(
totp_identifier: block.totp_identifier,
totp_verification_url: block.totp_verification_url,
cache_actions: block.cache_actions,
+ complete_criterion: block.complete_criterion,
+ terminate_criterion: block.terminate_criterion,
};
return blockYaml;
}
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
index 6381a7e73..12942628e 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
@@ -255,6 +255,8 @@ export type NavigationBlock = WorkflowBlockBase & {
totp_verification_url?: string | null;
totp_identifier?: string | null;
cache_actions: boolean;
+ complete_criterion: string | null;
+ terminate_criterion: string | null;
};
export type ExtractionBlock = WorkflowBlockBase & {
@@ -281,6 +283,8 @@ export type LoginBlock = WorkflowBlockBase & {
totp_verification_url?: string | null;
totp_identifier?: string | null;
cache_actions: boolean;
+ complete_criterion: string | null;
+ terminate_criterion: string | null;
};
export type WaitBlock = WorkflowBlockBase & {
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
index 066d3891e..ad865a656 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
@@ -167,6 +167,8 @@ export type NavigationBlockYAML = BlockYAMLBase & {
totp_verification_url?: string | null;
totp_identifier?: string | null;
cache_actions: boolean;
+ complete_criterion: string | null;
+ terminate_criterion: string | null;
};
export type ExtractionBlockYAML = BlockYAMLBase & {
@@ -193,6 +195,8 @@ export type LoginBlockYAML = BlockYAMLBase & {
totp_verification_url?: string | null;
totp_identifier?: string | null;
cache_actions: boolean;
+ complete_criterion: string | null;
+ terminate_criterion: string | null;
};
export type WaitBlockYAML = BlockYAMLBase & {