feat(sandbox): per-session sandbox VMs with resource settings and provider arbitration

- Sandbox new root sessions by default with a per-session composer toggle;
  child sessions inherit their root session's mode (OM-82)
- Run each sandboxed root session in its own microVM that mounts only the
  session's repository, with per-session CPU/memory overrides, Settings
  defaults, idle stop, and a cap on running VMs (OM-89)
- Arbitrate shell sandboxing with other plugins (opencode-forge) through the
  shared opencode.sandbox-arbiter.v1 registry so exactly one provider
  sandboxes each call regardless of load order; fail closed on claim errors
- Throw when another plugin rewrites a pinned sandbox shell setting
- Tag sandboxed tool results with the owning provider and show it in the badge
- Hint the agent to start Docker inside the VM only when OCM owns the session
This commit is contained in:
Chris Scott committed 2026-10-15 16:53:49 -04:00
1 parent ccdf75d803
commit b21fdf5b94
48 files changed
+5666 -3375

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { fetchWrapper } from './fetchWrapper'
import { API_BASE_URL } from '@/config'
import type { SessionSandboxState, SetSessionSandboxRequest } from '@opencode-manager/shared/schemas'
export async function getSessionSandbox(sessionId: string): Promise<SessionSandboxState> {
return fetchWrapper<SessionSandboxState>(
`${API_BASE_URL}/api/session-sandbox/${encodeURIComponent(sessionId)}`,
)
}
export async function setSessionSandbox(
sessionId: string,
input: SetSessionSandboxRequest,
): Promise<SessionSandboxState> {
return fetchWrapper<SessionSandboxState>(
`${API_BASE_URL}/api/session-sandbox/${encodeURIComponent(sessionId)}`,
{
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(input),
},
)
}