mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat(sandbox): add KVM-backed agent sandboxing via microsandbox
This commit is contained in:
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()
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user