diff --git a/alembic/versions/2025_05_15_1507-d90177b2b935_add_include_action_history_in_.py b/alembic/versions/2025_05_15_1507-d90177b2b935_add_include_action_history_in_.py new file mode 100644 index 00000000..791e15cf --- /dev/null +++ b/alembic/versions/2025_05_15_1507-d90177b2b935_add_include_action_history_in_.py @@ -0,0 +1,35 @@ +"""add_include_action_history_in_verification_to_tasks + +Revision ID: d90177b2b935 +Revises: 11b84609ef08 +Create Date: 2025-05-15 15:07:22.825001+00:00 + +""" + +from typing import Sequence, Union + +import sqlalchemy as sa + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "d90177b2b935" +down_revision: Union[str, None] = "11b84609ef08" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column("tasks", sa.Column("include_action_history_in_verification", sa.Boolean(), nullable=True)) + op.add_column( + "workflow_run_blocks", sa.Column("include_action_history_in_verification", sa.Boolean(), nullable=True) + ) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column("workflow_run_blocks", "include_action_history_in_verification") + op.drop_column("tasks", "include_action_history_in_verification") + # ### end Alembic commands ### diff --git a/skyvern-frontend/src/api/types.ts b/skyvern-frontend/src/api/types.ts index 206f9166..234af7b3 100644 --- a/skyvern-frontend/src/api/types.ts +++ b/skyvern-frontend/src/api/types.ts @@ -139,6 +139,7 @@ export type CreateTaskRequest = { totp_verification_url?: string | null; totp_identifier?: string | null; application?: string | null; + include_action_history_in_verification?: boolean | null; }; export type User = { diff --git a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx index 1609d9d4..8631daa3 100644 --- a/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx +++ b/skyvern-frontend/src/routes/tasks/create/CreateNewTaskForm.tsx @@ -38,7 +38,7 @@ import { CreateNewTaskFormValues, } from "./taskFormTypes"; import { ProxySelector } from "@/components/ProxySelector"; - +import { Switch } from "@/components/ui/switch"; type Props = { initialValues: CreateNewTaskFormValues; }; @@ -80,6 +80,8 @@ function createTaskRequestObject( extracted_information_schema: extractedInformationSchema, totp_identifier: transform(formValues.totpIdentifier), error_code_mapping: errorCodeMapping, + include_action_history_in_verification: + formValues.includeActionHistoryInVerification, }; } @@ -425,6 +427,36 @@ function CreateNewTaskForm({ initialValues }: Props) { {isActive("advanced") && (
+ ( + +
+ +
+

Include Action History

+

+ Whether to include action history when verifying + the task completion. +

+
+
+
+ + { + field.onChange(checked); + }} + /> + + +
+
+
+ )} + />
@@ -127,6 +128,9 @@ function CreateNewTaskFormPage() { maxStepsOverride, totpIdentifier: data.workflow_definition.blocks[0].totp_identifier, errorCodeMapping: JSON.stringify(errorCodeMapping, null, 2), + includeActionHistoryInVerification: + data.workflow_definition.blocks[0] + .include_action_history_in_verification, }} />
diff --git a/skyvern-frontend/src/routes/tasks/create/SavedTaskForm.tsx b/skyvern-frontend/src/routes/tasks/create/SavedTaskForm.tsx index 05fc8220..8b6e7ac9 100644 --- a/skyvern-frontend/src/routes/tasks/create/SavedTaskForm.tsx +++ b/skyvern-frontend/src/routes/tasks/create/SavedTaskForm.tsx @@ -99,6 +99,8 @@ function createTaskTemplateRequestObject(values: SavedTaskFormValues) { max_steps_per_run: values.maxStepsOverride, totp_identifier: values.totpIdentifier, error_code_mapping: safeParseMaybeJSONString(values.errorCodeMapping), + include_action_history_in_verification: + values.includeActionHistoryInVerification, }, ], }, diff --git a/skyvern-frontend/src/routes/tasks/create/retry/RetryTask.tsx b/skyvern-frontend/src/routes/tasks/create/retry/RetryTask.tsx index 3a2ad368..6755b5d1 100644 --- a/skyvern-frontend/src/routes/tasks/create/retry/RetryTask.tsx +++ b/skyvern-frontend/src/routes/tasks/create/retry/RetryTask.tsx @@ -42,6 +42,8 @@ function RetryTask() { ? JSON.stringify(task.request.error_code_mapping, null, 2) : "", proxyLocation: task.request.proxy_location ?? null, + includeActionHistoryInVerification: + task.request.include_action_history_in_verification ?? false, }} /> diff --git a/skyvern-frontend/src/routes/tasks/create/taskFormTypes.ts b/skyvern-frontend/src/routes/tasks/create/taskFormTypes.ts index a9a4262a..efafcbcf 100644 --- a/skyvern-frontend/src/routes/tasks/create/taskFormTypes.ts +++ b/skyvern-frontend/src/routes/tasks/create/taskFormTypes.ts @@ -14,6 +14,7 @@ const createNewTaskFormSchemaBase = z.object({ totpIdentifier: z.string().or(z.null()), errorCodeMapping: z.string().or(z.null()), proxyLocation: z.nativeEnum(ProxyLocation).or(z.null()), + includeActionHistoryInVerification: z.boolean().or(z.null()).default(false), }); const savedTaskFormSchemaBase = createNewTaskFormSchemaBase.extend({ diff --git a/skyvern-frontend/src/routes/tasks/detail/TaskParameters.tsx b/skyvern-frontend/src/routes/tasks/detail/TaskParameters.tsx index be09695c..49300b06 100644 --- a/skyvern-frontend/src/routes/tasks/detail/TaskParameters.tsx +++ b/skyvern-frontend/src/routes/tasks/detail/TaskParameters.tsx @@ -3,6 +3,7 @@ import { TaskApiResponse } from "@/api/types"; import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea"; import { Input } from "@/components/ui/input"; import { Skeleton } from "@/components/ui/skeleton"; +import { Switch } from "@/components/ui/switch"; import { useCredentialGetter } from "@/hooks/useCredentialGetter"; import { CodeEditor } from "@/routes/workflows/components/CodeEditor"; import { useQuery } from "@tanstack/react-query"; @@ -123,6 +124,22 @@ function TaskParameters() { +
+
+

Include Action History

+

+ Include the action history in the completion verification +

+
+
+ +
+
); } diff --git a/skyvern-frontend/src/routes/workflows/editor/helpContent.ts b/skyvern-frontend/src/routes/workflows/editor/helpContent.ts index 7d43ce50..b99086e9 100644 --- a/skyvern-frontend/src/routes/workflows/editor/helpContent.ts +++ b/skyvern-frontend/src/routes/workflows/editor/helpContent.ts @@ -24,6 +24,8 @@ export const baseHelpTooltipContent = { continueOnFailure: "Allow the workflow to continue if it encounters a failure.", cacheActions: "Cache the actions of this block.", + includeActionHistoryInVerification: + "Include the action history in the completion verification.", } as const; export const basePlaceholderContent = { 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 c025ed6f..2169bb4b 100644 --- a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx +++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx @@ -56,6 +56,7 @@ function NavigationNode({ id, data }: NodeProps) { totpIdentifier: data.totpIdentifier, completeCriterion: data.completeCriterion, terminateCriterion: data.terminateCriterion, + includeActionHistoryInVerification: data.includeActionHistoryInVerification, }); const deleteNodeCallback = useDeleteNodeCallback(); @@ -257,6 +258,31 @@ function NavigationNode({ id, data }: NodeProps) { )} +
+
+ + +
+
+ { + handleChange( + "includeActionHistoryInVerification", + checked, + ); + }} + /> +
+
+
+
+ + +
+
+ { + handleChange( + "includeActionHistoryInVerification", + checked, + ); + }} + /> +
+