Skip to content

feat: add local sandbox provider#23

Open
Karrq wants to merge 1 commit intoaliou:mainfrom
Karrq:feat/local-provider
Open

feat: add local sandbox provider#23
Karrq wants to merge 1 commit intoaliou:mainfrom
Karrq:feat/local-provider

Conversation

@Karrq
Copy link

@Karrq Karrq commented Mar 10, 2026

Adds a local sandbox provider that runs pi agent sessions directly on the host machine as child processes, without requiring Docker, Cloudflare, or Gondolin VMs.

What

  • New provider: local (server/relay/src/sandbox/local.ts) - Spawns pi --mode rpc --continue as a local child process with isolated session directories (agent config, git, workspace). Supports attach (stdin/stdout JSON-RPC), exec, and PTY via node-pty.
  • Host auth forwarding - Copies the host's auth.json into each sandbox's agent dir so OAuth-gated providers (e.g. Anthropic) work without re-authentication.
  • Workspace path support - Local sessions accept a filesystem path instead of a GitHub repo. The repoId field is reinterpreted as a local directory path for local environments, validated at the route level.
  • Model introspection fallback - No longer Gondolin-only. Tries all configured environments in priority order (local > gondolin > docker > cloudflare), falling back on failure. Timeout increased to 30s.
  • Dashboard UI - New "Local" sandbox type option in environment config. Code session creation shows a local path input instead of the GitHub repo selector when a local environment is selected. Environment selector is now visible in both chat and code modes.

Changes across layers

  • DB schema - sandboxType and sandboxProvider enums extended with "local"
  • Sandbox manager - Provider instantiation, secret resolution, and type unions updated
  • Routes - Sessions, environments, settings, and models routes all handle the new type
  • Git config - safe.directory is now configurable (not hardcoded to /workspace)
  • Dashboard - API types, environment dialog, session creation, terminal WebSocket URL handling, and client ID generation updated
  • Tests - 3 new session route tests for local workspace handling; existing fixtures updated

New dependency

  • node-pty for terminal/PTY support in local sandboxes

@Karrq
Copy link
Author

Karrq commented Mar 10, 2026

Honestly, I assumed this "provider" has been explicitly omitted for safety, but your app is very useful nonetheless, with everything else it provides, but I personally don't need the sandboxing.
Feel free to close the PR if it's an unwanted feature. Thanks for the work and your extensions (loving processes) ;)

@Karrq Karrq force-pushed the feat/local-provider branch from 9c9b886 to 0ee0d9a Compare March 10, 2026 14:21
@aliou
Copy link
Owner

aliou commented Mar 11, 2026

@Karrq Hello! Sorry i completely missed this and went a slop adventure today which seemed to have added a bunch of conflicts 😅

Taking a look tomorrow, I'll also fix the conflicts when I'll test it!

I can't promise I'll merge it but I approciate taking the time to make a PR here 🙏

@Karrq
Copy link
Author

Karrq commented Mar 11, 2026

No worries, I’ll see if I can get a model to rebase the changes in the morning :)
Can’t wait to see the new features

@Karrq Karrq force-pushed the feat/local-provider branch from 0ee0d9a to 1a94650 Compare March 12, 2026 17:42
@aliou
Copy link
Owner

aliou commented Mar 16, 2026

Hey @Karrq, didn't have time last week but saving some time to take a look later today or tomorrow morning!

@Karrq
Copy link
Author

Karrq commented Mar 16, 2026

No worries, thanks for keeping it mind 🫶
The rebase should help :)

@aliou
Copy link
Owner

aliou commented Mar 18, 2026

Hey @Karrq !

Finally, took some time to look at your pr and I love the idea! However I'm going to do it slightly differently.

Working on it in the next few days is it ok if I ask you for a review to see what you think and if that works for you? Totally ok if not!

Thanks again for the pr!

@Karrq
Copy link
Author

Karrq commented Mar 18, 2026

yeah absolutely, that's fine as well. My usecase is just no sandboxing (similar to the original Pi), so I think there are more approaches that work too

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.

2 participants