better prompt

This commit is contained in:
Tommy D. Rossi
2025-11-16 14:59:28 +01:00
parent 2a286686d6
commit 7c3809b1d4
3 changed files with 9 additions and 5 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import { startRelayServer } from '../src/extension/cdp-relay.js'
import { startPlayWriterCDPRelayServer } from '../src/extension/cdp-relay.js'
async function main() {
const server = await startRelayServer({ port: 19988 })
const server = await startPlayWriterCDPRelayServer({ port: 19988 })
console.log('Server running. Press Ctrl+C to stop.')
+3 -3
View File
@@ -169,7 +169,7 @@ server.tool(
code: z
.string()
.describe(
'JavaScript code to execute with page, state, context in scope. Should be one line, using ; to execute multiple statements. To execute complex actions call execute multiple times. ',
'js playwright code, has {page, state, context} in scope. Should be one line, using ; to execute multiple statements. you MUST call execute multiple times instead of writing complex scripts in a single tool call.',
),
timeout: z.number().default(3000).describe('Timeout in milliseconds for code execution (default: 3000ms)'),
},
@@ -221,9 +221,9 @@ server.tool(
accessibilitySnapshot,
resetPlaywright: async () => {
const { page: newPage, context: newContext } = await resetConnection()
Object.keys(state).forEach(key => delete state[key])
const resetObj: VMContext = {
page: newPage,
context: newContext,
+4
View File
@@ -4,6 +4,10 @@ if you get an error Extension not running tell user to install and enable the pl
execute tool let you run playwright js code snippets to control user Chrome window, these js code snippets are preferred to be in a single line to make them more readable in agent interface. separating statements with semicolons
you MUST use multiple execute tool calls for running complex logic. this ensures
- you have clear understanding of intermediate state between interactions
- you can split finding an element from interacting with it. making it simpler to understand what is the issue when an action is not successful
it will control an existing user Chrome window. The js code will be run in a sandbox with some variables in context:
- state: an object shared between runs that you can mutate to persist functions and objects. for example `state.requests = []` to monitor network requests between runs