Skip to content

feat(platforms/browser): just-bash integration — full Workspace parity in browser - #23

Merged
arjunkmrm merged 1 commit into
mainfrom
feat/browser-memory-fs
May 28, 2026
Merged

feat(platforms/browser): just-bash integration — full Workspace parity in browser#23
arjunkmrm merged 1 commit into
mainfrom
feat/browser-memory-fs

Conversation

@arjunkmrm

Copy link
Copy Markdown
Collaborator

Summary

Wires `just-bash` (Vercel Labs' in-browser bash interpreter + VFS) into the browser platform. `` now works in browser context with all five tools — same parity as Node and Bun, except just-bash is a "broad subset" of POSIX bash rather than a full system shell (no system binaries, no real subprocesses).

What ships

  • `src/platforms/browser/just-bash.ts` — wraps just-bash's `FileSystem` as Effect's `FileSystem.FileSystem` and just-bash's `Bash` as Effect's `CommandExecutor.CommandExecutor`. Both wrappers share one `Bash` instance per layer, so the VFS stays consistent across fs-tool calls and bash-tool calls.
  • `justBashPlatform(opts?)` — composed layer (FileSystem + Path + CommandExecutor) ready to pass as `createAgentRuntime({ platform })`. Accepts `files` / `env` / `cwd` options forwarded to the just-bash `Bash` constructor.
  • `src/platforms/browser/index.ts` — exports `justBashPlatform` alongside the existing `partialPlatform` (HttpClient only) for users who don't want shell.
  • `just-bash` added as peer-optional + devDep.

How non-`bash` commands work

Commands like `Command.make("grep", "-rIn", ...)` are reassembled via single-quote shell-escaping and run as a single script through `bash.exec()`. just-bash bundles a `grep` built-in so Workspace's grep works against the VFS. `PipedCommand` (`a | b`) glues with `|` and dispatches the same way.

Usage

```tsx
import { createAgentRuntime } from "@flamecast/agentjsx"
import { justBashPlatform } from "@flamecast/agentjsx/platforms/browser"
import { Agent, Block, Workspace, Messages } from "@flamecast/agentjsx/components"

const agent = createAgentRuntime({
platform: justBashPlatform({ files: { "/README.md": "# In-browser workspace" } }),
infer: fetchBackedInferFn,
context: () => render(





),
})
```

Test plan

  • `pnpm run check-types` clean
  • `pnpm run test` — 160/160 passing (159 + 1 new integration test that exercises write_file → read_file → bash → list_dir, proving the VFS is shared across fs and bash tools)
  • Manual browser test — would need a real bundler + browser to verify the integration genuinely runs in browser context. Test runs in Node since just-bash works there natively; the browser-specific concern is bundler compat (no Node-only fs/child_process imports leak in), which we'd verify with a tree-shake test in a follow-up.

@arjunkmrm
arjunkmrm merged commit 6f97ca1 into main May 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant