-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
component-e2bE2B sandbox integrationE2B sandbox integrationenhancementNew feature or requestNew feature or requestphase-2-multi-providerPhase 2: Multi-provider sandbox architecture (v1.5)Phase 2: Multi-provider sandbox architecture (v1.5)priority-highHigh priority - address soonHigh priority - address soontype-refactorCode refactoring or restructuringCode refactoring or restructuring
Description
Overview
Extract existing E2B logic from sandbox-manager.ts and file-sync.ts into a new E2BProvider class that implements the SandboxProvider interface.
Scope
Move to E2BProvider
- Sandbox creation logic
- File upload/download operations
- Execution handling
- Health monitoring
- Reconnection logic
Keep in SandboxManager
- Provider registry
- Provider selection
- Session tracking
- High-level orchestration
Implementation
// src/e2b/providers/e2b-provider.ts
import { SandboxProvider, SandboxConfig, SandboxInstance } from './types.js';
import { Sandbox } from 'e2b';
export class E2BProvider implements SandboxProvider {
readonly name = 'e2b';
readonly version = '1.0.0';
private sandboxes: Map<string, Sandbox> = new Map();
async create(config: SandboxConfig): Promise<SandboxInstance> {
// Move logic from SandboxManager.createSandbox()
}
async destroy(instanceId: string): Promise<void> {
// Move logic from SandboxManager.terminateSandbox()
}
// ... implement remaining interface methods
}Migration Steps
- Create E2BProvider class skeleton
- Move createSandbox logic
- Move terminateSandbox logic
- Move file upload/download
- Update SandboxManager to use E2BProvider
- Verify all tests pass
- Remove dead code from old locations
Files to Modify
src/e2b/providers/e2b-provider.ts- New provider classsrc/e2b/sandbox-manager.ts- Refactor to use providersrc/e2b/file-sync.ts- May be split into provider
Acceptance Criteria
- E2BProvider implements full SandboxProvider interface
- All existing tests pass
- No behavior changes for CLI users
- Code is cleaner and more modular
- Good test coverage for E2BProvider
Dependencies
- Depends on [v1.5] Define SandboxProvider interface and typesย #30 (SandboxProvider interface)
coderabbitai
Metadata
Metadata
Assignees
Labels
component-e2bE2B sandbox integrationE2B sandbox integrationenhancementNew feature or requestNew feature or requestphase-2-multi-providerPhase 2: Multi-provider sandbox architecture (v1.5)Phase 2: Multi-provider sandbox architecture (v1.5)priority-highHigh priority - address soonHigh priority - address soontype-refactorCode refactoring or restructuringCode refactoring or restructuring