From 7c8103133568294fe6c657f114c91f1a492744e1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 24 Sep 2026 22:41:50 +0000 Subject: [PATCH] chore: import the Chrome battery; tell the model which builtins need imports swarmrt now compiles chrome_launch, pdf_* and the audio_* codecs into a program only when the calling module imports Chrome / Pdf / Audio (skyblanket/swarmrt#6). browser.sw imports Chrome, and the sw-writing section of the system prompt names the imports so generated programs compile. On a swarmrt without lib/Chrome.sw the import is an unresolved-import warning and the build proceeds, so this is safe to merge first. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016jS65kn5WxDsbVU2teBZZE --- src/browser.sw | 1 + src/prompts.sw | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/browser.sw b/src/browser.sw index f0d943e..3065f58 100644 --- a/src/browser.sw +++ b/src/browser.sw @@ -2,6 +2,7 @@ module Browser import UI import PathGuard +import Chrome # chrome_launch is a swarmrt battery: only importers get it # ============================================================ # Browser — CDP-over-WebSocket browser control, no Node, no Python diff --git a/src/prompts.sw b/src/prompts.sw index 943f8ff..a73d8bf 100644 --- a/src/prompts.sw +++ b/src/prompts.sw @@ -239,11 +239,15 @@ fun sw_capabilities() { "wsc_connect_tls(url, headers) → handle, wsc_send, wsc_recv(handle, " ++ "timeout_ms) (non-blocking poll with 0), wsc_close. This is how you build " ++ "real-time bidirectional agents.\n" ++ - "- Audio codecs (base64 string twins AND raw-bytes twins): " ++ + "- Audio codecs (base64 string twins AND raw-bytes twins; need `import Audio` " ++ + "in the calling module): " ++ "audio_ulaw_to_pcm16 / audio_pcm16_to_ulaw / audio_resample(b64, from_hz, " ++ "to_hz), and the bytes versions audio_ulaw_to_pcm16_b / audio_pcm16_to_ulaw_b " ++ "/ audio_resample_b. For G.711 mu-law passthrough you stay in base64 ASCII " ++ "end-to-end and never touch raw bytes.\n" ++ + "- Batteries: pdf_text / pdf_pages / pdf_meta need `import Pdf`, " ++ + "chrome_launch needs `import Chrome`, the audio_* codecs need `import Audio` — " ++ + "in each module that calls them; swc rejects the call otherwise.\n" ++ "- Voice module (`import Voice`): native real-time voice-agent helpers " ++ "bridging a telephony provider (Telnyx Media Streaming, a swarmrt WS " ++ "*server*) to a speech-to-speech model (OpenAI Realtime, reached as a WS " ++