feat(sandbox): add KVM-backed agent sandboxing via microsandbox

This commit is contained in:
Chris Scott committed 2026-08-13 16:14:16 -04:00
1 parent 1d477bdee4
commit aa3fb48a62
80 files changed
+17304 -204

No files matched your search

@@ -724,3 +724,31 @@ describe('installAssistantWorkspace', () => {
expect(result.defaultAgent?.created).toBe(false)
})
})
describe('assistant mode directory contract', () => {
it('resolves the assistant directory from the shared sandbox mount owner', async () => {
const ws = await createTempAssistantWorkspace()
try {
const { getAssistantModePath, getAssistantOpenCodeDir } = await import('@opencode-manager/shared/config/env')
const { getAssistantModeDirectory } = await import('../../src/services/assistant-mode')
const { sandboxSecretMaskPath } = await import('../../src/services/sandbox/command')
expect(getAssistantModeDirectory()).toBe(getAssistantModePath())
expect(sandboxSecretMaskPath()).toBe(getAssistantOpenCodeDir())
expect(getAssistantOpenCodeDir()).toBe(path.join(ws.assistantDir, '.opencode'))
} finally {
await ws.cleanup()
}
})
it('keeps the internal token underneath the sandboxed assistant .opencode directory', async () => {
const ws = await createTempAssistantWorkspace()
try {
const { getAssistantOpenCodeDir } = await import('@opencode-manager/shared/config/env')
const tokenPath = path.join(ws.assistantDir, '.opencode/internal-token')
expect(tokenPath).toContain(getAssistantOpenCodeDir())
} finally {
await ws.cleanup()
}
})
})