An open-source, faster Devin alternative
TypeScript
update docs
Brian Reardond466638f6677
diff --git a/docs/api-reference/checkpoints/fork.mdx b/docs/api-reference/checkpoints/fork.mdxindex 6e4dc096..bb61a14b 100644--- a/docs/api-reference/checkpoints/fork.mdx+++ b/docs/api-reference/checkpoints/fork.mdx@@ -13,6 +13,14 @@ Create a new sandbox from a checkpoint.Idle timeout for the new sandbox (default: `300`)</ParamField>+<ParamField body="envs" type="object">+ Environment variables to override on the fork. Keys that match the checkpoint's stored envs are replaced; new keys are added.+</ParamField>++<ParamField body="secretStore" type="string">+ Name of a secret store to attach. If the checkpoint already has a store, secrets are merged — the new store's values win on collision and egress allowlists are aggregated.+</ParamField>+<ResponseExample>```json 201{diff --git a/docs/reference/python-sdk/secrets.mdx b/docs/reference/python-sdk/secrets.mdxindex 2909cfb0..1c7582e3 100644--- a/docs/reference/python-sdk/secrets.mdx+++ b/docs/reference/python-sdk/secrets.mdx@@ -141,3 +141,22 @@ api_result = await sandbox.commands.run('curl -s https://api.anthropic.com/v1/messages -H "x-api-key: $ANTHROPIC_API_KEY" ...')```++## Using Secrets with Snapshots and Checkpoints++Attach a secret store when forking from a snapshot or checkpoint — even if the original didn't have one:++```python+# Bake a base environment+base = await Sandbox.create(secret_store='git-creds')+await base.exec.run('git clone https://github.com/org/repo /app')+cp = await base.create_checkpoint('repo-cloned')++# Fork with different credentials per sandbox+worker = await Sandbox.create_from_checkpoint(+ cp['id'],+ secret_store='worker-keys', # layered on top of git-creds+)+```++When layered, secrets merge (fork's store wins on collision) and egress allowlists aggregate.diff --git a/docs/reference/typescript-sdk/secrets.mdx b/docs/reference/typescript-sdk/secrets.mdxindex a86504ca..d1ed367e 100644--- a/docs/reference/typescript-sdk/secrets.mdx+++ b/docs/reference/typescript-sdk/secrets.mdx@@ -153,6 +153,24 @@ const apiResult = await sandbox.commands.run();```+## Using Secrets with Snapshots and Checkpoints++Attach a secret store when forking from a snapshot or checkpoint — even if the original didn't have one:++```typescript+// Bake a base environment+const base = await Sandbox.create({ secretStore: 'git-creds' });+await base.exec.run('git clone https://github.com/org/repo /app', { cwd: '/' });+const cp = await base.createCheckpoint('repo-cloned');++// Fork with different credentials per sandbox+const worker = await Sandbox.createFromCheckpoint(cp.id, {+ secretStore: 'worker-keys', // layered on top of git-creds+});+```++When layered, secrets merge (fork's store wins on collision) and egress allowlists aggregate.+---## Typesdiff --git a/docs/sandboxes/secrets.mdx b/docs/sandboxes/secrets.mdxindex d2285e37..e26269ce 100644--- a/docs/sandboxes/secrets.mdx+++ b/docs/sandboxes/secrets.mdx@@ -200,6 +200,56 @@ await SecretStore.delete(store['id'])</CodeGroup>+## Secrets with snapshots and checkpoints++You can attach a secret store when creating a sandbox from a snapshot or checkpoint, even if the original didn't have one. This is useful for baking a base environment (e.g., installed dependencies) and then giving each fork its own scoped credentials.++<CodeGroup>++```typescript TypeScript+// Bake a base snapshot with git credentials+const base = await Sandbox.create({ secretStore: 'git-creds' });+await base.exec.run('git clone https://github.com/org/repo /app');+const cp = await base.createCheckpoint('repo-cloned');++// Fork with sandbox-specific API credentials+const worker1 = await Sandbox.createFromCheckpoint(cp.id, {+ secretStore: 'worker-1-keys',+});+const worker2 = await Sandbox.createFromCheckpoint(cp.id, {+ secretStore: 'worker-2-keys',+});+```++```python Python+# Bake a base snapshot with git credentials+base = await Sandbox.create(secret_store='git-creds')+await base.exec.run('git clone https://github.com/org/repo /app')+cp = await base.create_checkpoint('repo-cloned')++# Fork with sandbox-specific API credentials+worker1 = await Sandbox.create_from_checkpoint(cp['id'],+ secret_store='worker-1-keys',+)+worker2 = await Sandbox.create_from_checkpoint(cp['id'],+ secret_store='worker-2-keys',+)+```++</CodeGroup>++### Layering rules++When a checkpoint already has a secret store and you attach another at fork time, the stores are **merged**:++- **Secrets**: Both stores' secrets are available. On name collision, the fork's store wins.+- **Egress allowlists**: Aggregated (union of both stores' lists).+- **Per-secret host restrictions**: Follow the winning secret's store.++This means a base snapshot can provide broad credentials (e.g., git access) while each fork adds its own scoped credentials (e.g., limited API keys).++On a fork-of-fork, the checkpoint's merged result becomes the new base — there's no unbounded chain of stores to resolve.+## Security properties| Property | Detail |