diff --git a/.changeset/clean-birds-fetch.md b/.changeset/clean-birds-fetch.md new file mode 100644 index 000000000..c54b0da2f --- /dev/null +++ b/.changeset/clean-birds-fetch.md @@ -0,0 +1,5 @@ +--- +"@browserbasehq/stagehand": patch +--- + +Enforce - regex validation on act/observe for elementId diff --git a/packages/core/lib/inference.ts b/packages/core/lib/inference.ts index 7d60b4ae2..0779900b0 100644 --- a/packages/core/lib/inference.ts +++ b/packages/core/lib/inference.ts @@ -245,6 +245,7 @@ export async function observe({ z.object({ elementId: z .string() + .regex(/^\d+-\d+$/) .describe( "the ID string associated with the element. Never include surrounding square brackets. This field must follow the format of 'number-number'.", ), @@ -382,6 +383,7 @@ export async function act({ const actSchema = z.object({ elementId: z .string() + .regex(/^\d+-\d+$/) .describe( "the ID string associated with the element. Never include surrounding square brackets. This field must follow the format of 'number-number'.", ),