|
| 1 | +# SDK Versioning Documentation |
| 2 | + |
| 3 | +This document tracks the version-specific configuration changes for each SDK. |
| 4 | + |
| 5 | +## JavaScript SDK (js-sdk) |
| 6 | + |
| 7 | +### Verified Version History |
| 8 | + |
| 9 | +All version ranges have been verified by checking actual git tags and TypeDoc configurations. |
| 10 | + |
| 11 | +| Version Range | Entry Points | Notes | |
| 12 | +|--------------|-------------|--------| |
| 13 | +| `1.0.0` | sandbox/index.ts, filesystem/index.ts, process/index.ts, **pty.ts**, errors.ts | Used pty.ts instead of commands.ts | |
| 14 | +| `>=1.1.0 <2.3.0` | sandbox/index.ts, filesystem/index.ts, process/index.ts, **commands/index.ts**, errors.ts | Standard sandbox APIs | |
| 15 | +| `>=2.3.0` | + **template/index.ts**, **template/readycmd.ts**, **template/logger.ts** | Added template build support | |
| 16 | + |
| 17 | +### Configuration in sdks.config.ts |
| 18 | + |
| 19 | +```typescript |
| 20 | +"js-sdk": { |
| 21 | + defaultConfig: { |
| 22 | + entryPoints: [ |
| 23 | + // v2.3.0+ configuration (with template modules) |
| 24 | + "src/sandbox/index.ts", |
| 25 | + "src/sandbox/filesystem/index.ts", |
| 26 | + "src/sandbox/process/index.ts", |
| 27 | + "src/sandbox/commands/index.ts", |
| 28 | + "src/errors.ts", |
| 29 | + "src/template/index.ts", |
| 30 | + "src/template/readycmd.ts", |
| 31 | + "src/template/logger.ts", |
| 32 | + ], |
| 33 | + }, |
| 34 | + configOverrides: { |
| 35 | + "1.0.0": { |
| 36 | + entryPoints: [/* pty.ts version */], |
| 37 | + }, |
| 38 | + ">=1.1.0 <2.3.0": { |
| 39 | + entryPoints: [/* without template */], |
| 40 | + }, |
| 41 | + }, |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +## Python SDK (python-sdk) |
| 46 | + |
| 47 | +### Verified Version History |
| 48 | + |
| 49 | +All version ranges have been verified by checking actual git tags and package structure. |
| 50 | + |
| 51 | +| Version Range | Allowed Packages | Notes | |
| 52 | +|--------------|-----------------|--------| |
| 53 | +| `>=1.0.0 <2.1.0` | e2b.sandbox_sync, e2b.sandbox_async, e2b.exceptions | Basic sandbox APIs only | |
| 54 | +| `>=2.1.0` | + e2b.template, e2b.template_sync, e2b.template_async, e2b.template.logger, e2b.template.readycmd | Template SDK added in v2.1.0 (PR #871) | |
| 55 | + |
| 56 | +### Configuration in sdks.config.ts |
| 57 | + |
| 58 | +```typescript |
| 59 | +"python-sdk": { |
| 60 | + defaultConfig: { |
| 61 | + allowedPackages: [ |
| 62 | + // v2.1.0+ configuration (with template modules) |
| 63 | + "e2b.sandbox_sync", |
| 64 | + "e2b.sandbox_async", |
| 65 | + "e2b.exceptions", |
| 66 | + "e2b.template", |
| 67 | + "e2b.template_sync", |
| 68 | + "e2b.template_async", |
| 69 | + "e2b.template.logger", |
| 70 | + "e2b.template.readycmd", |
| 71 | + ], |
| 72 | + }, |
| 73 | + configOverrides: { |
| 74 | + ">=1.0.0 <2.1.0": { |
| 75 | + allowedPackages: [ |
| 76 | + "e2b.sandbox_sync", |
| 77 | + "e2b.sandbox_async", |
| 78 | + "e2b.exceptions", |
| 79 | + ], |
| 80 | + }, |
| 81 | + }, |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +## Code Interpreter SDKs |
| 86 | + |
| 87 | +### code-interpreter-js-sdk |
| 88 | + |
| 89 | +**Current Configuration**: Single entry point (`src/index.ts`) |
| 90 | + |
| 91 | +No version-specific overrides needed - the SDK has a simple, stable structure since v1.0.0. The code-interpreter is a focused wrapper around the base E2B SDK for code execution. |
| 92 | + |
| 93 | +### code-interpreter-python-sdk |
| 94 | + |
| 95 | +**Current Configuration**: Single package (`e2b_code_interpreter`) |
| 96 | + |
| 97 | +No version-specific overrides needed - the Python package structure has remained consistent. |
| 98 | + |
| 99 | +## Desktop SDKs |
| 100 | + |
| 101 | +### desktop-js-sdk & desktop-python-sdk |
| 102 | + |
| 103 | +**Current Configuration**: Simple defaults (`src/index.ts` and `e2b_desktop`) |
| 104 | + |
| 105 | +No version-specific overrides needed yet. These SDKs are relatively new and haven't had breaking structural changes requiring versioned configs. |
| 106 | + |
| 107 | +**Note**: If any of these SDKs introduce breaking changes in future versions (e.g., new modules, renamed packages), add appropriate `configOverrides` following the same pattern used for js-sdk and python-sdk. |
| 108 | + |
| 109 | +## Adding New Version Overrides |
| 110 | + |
| 111 | +When you discover that a specific version range needs different configuration: |
| 112 | + |
| 113 | +1. **Identify the version range** using semver syntax (e.g., `>=1.5.0 <2.0.0`) |
| 114 | +2. **Add to configOverrides** with partial config (only override what changed) |
| 115 | +3. **Add tests** in `src/__tests__/sdks-config.test.ts` |
| 116 | +4. **Document here** with notes on what changed and why |
| 117 | + |
| 118 | +### Example: Adding a new override |
| 119 | + |
| 120 | +```typescript |
| 121 | +configOverrides: { |
| 122 | + ">=1.0.0 <1.5.0": { |
| 123 | + // Old structure |
| 124 | + }, |
| 125 | + ">=1.5.0 <2.0.0": { |
| 126 | + // New structure introduced in 1.5.0 |
| 127 | + }, |
| 128 | + ">=2.0.0": { |
| 129 | + // Breaking changes in 2.0.0 |
| 130 | + }, |
| 131 | +} |
| 132 | +``` |
| 133 | + |
| 134 | +## Resolution Logic |
| 135 | + |
| 136 | +The config resolution follows these rules: |
| 137 | + |
| 138 | +1. Start with `defaultConfig` |
| 139 | +2. Find the **first matching** semver range in `configOverrides` |
| 140 | +3. Shallow merge override into default (override wins) |
| 141 | +4. Return merged config |
| 142 | + |
| 143 | +This means: |
| 144 | +- `defaultConfig` should represent the **latest/current** structure |
| 145 | +- `configOverrides` handles older versions or special cases |
| 146 | +- Order matters when multiple ranges could match (first match wins) |
| 147 | + |
| 148 | +## Testing |
| 149 | + |
| 150 | +Tests in `src/__tests__/sdks-config.test.ts` verify: |
| 151 | +- Correct packages/entry points for each version range |
| 152 | +- Proper semver range matching |
| 153 | +- Expected counts of items per version |
| 154 | + |
| 155 | +Run tests with: |
| 156 | +```bash |
| 157 | +pnpm test src/__tests__/sdks-config.test.ts |
| 158 | +``` |
| 159 | + |
0 commit comments