Skip to content

Commit fa78c08

Browse files
committed
fix(codemode): explicitly request JavaScript in default tool prompt to prevent TypeScript syntax errors
1 parent f45c5e6 commit fa78c08

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

.changeset/petite-walls-invite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/codemode": patch
3+
---
4+
5+
Updated default tool prompt to explicitly request JavaScript code from LLMs, preventing TypeScript syntax errors in the Dynamic Worker executor.

packages/codemode/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# `@cloudflare/codemode`
22

3-
Instead of asking LLMs to call tools directly, Code Mode lets them write executable code that orchestrates multiple operations. LLMs are better at writing code than calling tools — they've seen millions of lines of real-world TypeScript but only contrived tool-calling examples.
3+
Instead of asking LLMs to call tools directly, Code Mode lets them write executable code that orchestrates multiple operations. LLMs are better at writing code than calling tools — they've seen millions of lines of real-world code but only contrived tool-calling examples.
44

5-
Code Mode converts your tools into TypeScript APIs and executes the generated code in secure, isolated sandboxes with millisecond startup times.
5+
Code Mode generates TypeScript type definitions from your tools for LLM context, and executes the generated JavaScript in secure, isolated sandboxes with millisecond startup times.
66

77
> **Experimental** — may have breaking changes. Use with caution in production.
88

packages/codemode/src/tool.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const DEFAULT_DESCRIPTION = `Execute code to achieve a goal.
1010
Available:
1111
{{types}}
1212
13-
Write an async arrow function that returns the result.
13+
Write an async arrow function in JavaScript that returns the result.
14+
Do NOT use TypeScript syntax — no type annotations, interfaces, or generics.
1415
Do NOT define named functions then call them — just write the arrow function body directly.
1516
1617
Example: async () => { const r = await codemode.searchWeb({ query: "test" }); return r; }`;

0 commit comments

Comments
 (0)