add screencast (#67)
* docs * updates * Fix: The handleCopy function fails to handle errors from navigator.clipboard.writeText(), causing unhandled exceptions and misleading UI feedback when clipboard operations fail. Co-authored-by: ctate <chris@ctate.dev> * Fix: The benchmark file uses emojis (📊, 🚀, 🔨, 📈, 📋, ✅, ⏱️, ⚠) in console output, violating repository guidelines that forbid emojis in code and output. Co-authored-by: ctate <chris@ctate.dev> * Remove benchmark/run.ts from PR * screencast * update docs * address comments --------- Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Vercel <vercel[bot]@users.noreply.github.com>
parent
673e2e266e
commit
2dc093cd62
@@ -585,6 +585,55 @@ const responseBodySchema = baseCommandSchema.extend({
|
||||
timeout: z.number().positive().optional(),
|
||||
});
|
||||
|
||||
// Screencast schemas for streaming browser viewport
|
||||
const screencastStartSchema = baseCommandSchema.extend({
|
||||
action: z.literal('screencast_start'),
|
||||
format: z.enum(['jpeg', 'png']).optional(),
|
||||
quality: z.number().min(0).max(100).optional(),
|
||||
maxWidth: z.number().positive().optional(),
|
||||
maxHeight: z.number().positive().optional(),
|
||||
everyNthFrame: z.number().positive().optional(),
|
||||
});
|
||||
|
||||
const screencastStopSchema = baseCommandSchema.extend({
|
||||
action: z.literal('screencast_stop'),
|
||||
});
|
||||
|
||||
// Input injection schemas for pair browsing
|
||||
const inputMouseSchema = baseCommandSchema.extend({
|
||||
action: z.literal('input_mouse'),
|
||||
type: z.enum(['mousePressed', 'mouseReleased', 'mouseMoved', 'mouseWheel']),
|
||||
x: z.number(),
|
||||
y: z.number(),
|
||||
button: z.enum(['left', 'right', 'middle', 'none']).optional(),
|
||||
clickCount: z.number().positive().optional(),
|
||||
deltaX: z.number().optional(),
|
||||
deltaY: z.number().optional(),
|
||||
modifiers: z.number().optional(),
|
||||
});
|
||||
|
||||
const inputKeyboardSchema = baseCommandSchema.extend({
|
||||
action: z.literal('input_keyboard'),
|
||||
type: z.enum(['keyDown', 'keyUp', 'char']),
|
||||
key: z.string().optional(),
|
||||
code: z.string().optional(),
|
||||
text: z.string().optional(),
|
||||
modifiers: z.number().optional(),
|
||||
});
|
||||
|
||||
const inputTouchSchema = baseCommandSchema.extend({
|
||||
action: z.literal('input_touch'),
|
||||
type: z.enum(['touchStart', 'touchEnd', 'touchMove', 'touchCancel']),
|
||||
touchPoints: z.array(
|
||||
z.object({
|
||||
x: z.number(),
|
||||
y: z.number(),
|
||||
id: z.number().optional(),
|
||||
})
|
||||
),
|
||||
modifiers: z.number().optional(),
|
||||
});
|
||||
|
||||
const pressSchema = baseCommandSchema.extend({
|
||||
action: z.literal('press'),
|
||||
key: z.string().min(1),
|
||||
@@ -795,6 +844,11 @@ const commandSchema = z.discriminatedUnion('action', [
|
||||
multiSelectSchema,
|
||||
waitForDownloadSchema,
|
||||
responseBodySchema,
|
||||
screencastStartSchema,
|
||||
screencastStopSchema,
|
||||
inputMouseSchema,
|
||||
inputKeyboardSchema,
|
||||
inputTouchSchema,
|
||||
]);
|
||||
|
||||
// Parse result type
|
||||
|
||||
Reference in New Issue
Block a user