Skip to content

Commit 1e264bc

Browse files
author
bcode
committed
browser_execute: move description after code in parameter schema
Providers stream tool-call args in schema-declared order, so a leading description field commits the model to a stated intent before code generation. Matches the shell tool's command-first, description-last shape.
1 parent 74c2e2d commit 1e264bc

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

packages/bcode-browser/src/browser-execute.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,22 @@ import { Skills } from "./skills"
4949
const DEFAULT_TIMEOUT_MS = 60 * 1000
5050
const MAX_TIMEOUT_MS = 10 * 60 * 1000
5151

52+
// Field order matters: providers stream tool-call args in schema-declared
53+
// order, so the model commits to whichever field comes first. `code` is the
54+
// substantive output; `description` is a summary written after the code
55+
// exists, mirroring the shell tool's `command` → ... → `description` shape.
5256
export const parameters = Schema.Struct({
53-
description: Schema.String.annotate({
54-
description:
55-
"Clear, concise summary of what this snippet does in 3-7 words. Examples:\nInput: code that connects to local Chrome\nOutput: Connect to local Chrome\n\nInput: scrape product titles from current page\nOutput: Scrape product titles\n\nInput: capture a screenshot of the homepage\nOutput: Screenshot homepage",
56-
}),
5757
code: Schema.String.annotate({
5858
description:
5959
"JavaScript source. Wrapped in an async function with `session` (CDP Session) and `console` (per-call capture; same `log/error/warn/info` API) bound.",
6060
}),
6161
timeout: Schema.optional(Schema.Number).annotate({
6262
description: `Timeout in milliseconds. Default ${DEFAULT_TIMEOUT_MS}, max ${MAX_TIMEOUT_MS}.`,
6363
}),
64+
description: Schema.String.annotate({
65+
description:
66+
"Clear, concise summary of what this snippet does in 3-7 words. Examples:\nInput: code that connects to local Chrome\nOutput: Connect to local Chrome\n\nInput: scrape product titles from current page\nOutput: Scrape product titles\n\nInput: capture a screenshot of the homepage\nOutput: Screenshot homepage",
67+
}),
6468
})
6569

6670
export type Parameters = Schema.Schema.Type<typeof parameters>

0 commit comments

Comments
 (0)