Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fixed zod validation for wait

rafaelsideguide28db4dd3b587
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index 229893d1c..45aa3c9bd 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -61,9 +61,14 @@ export type ExtractOptions = z.infer<typeof extractOptions>;
export const actionsSchema = z.array(z.union([
z.object({
type: z.literal("wait"),
- milliseconds: z.number().int().positive().finite(),
+ milliseconds: z.number().int().positive().finite().optional(),
selector: z.string().optional(),
- }),
+ }).refine(
+ (data) => (data.milliseconds !== undefined || data.selector !== undefined) && !(data.milliseconds !== undefined && data.selector !== undefined),
+ {
+ message: "Either 'milliseconds' or 'selector' must be provided, but not both.",
+ }
+ ),
z.object({
type: z.literal("click"),
selector: z.string(),