Visitar URL original
Add sandbox snapshot support to the TypeScript SDK by jdc123 · Pull Request #284 · gofixpoint/amika · GitHub
Skip to content

Add sandbox snapshot support to the TypeScript SDK - #284

Merged
dbmikus merged 2 commits into
mainfrom
jakub/sdk-snapshot-support
Jul 16, 2026
Merged

dbmikus merged 2 commits into
mainfrom
jakub/sdk-snapshot-support

Conversation

@jdc123

@jdc123 jdc123 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Brings @amika/sdk to parity with the CLI's snapshot commands and lets
callers fork a new sandbox from a captured snapshot. Closes the TS-SDK
snapshot gaps from the parity audit (KAPRO-570).

What's new

New AmikaClient methods, mirroring the Go apiclient 1:1:

Method Endpoint
listSandboxSnapshots(filters?) GET /sandbox-snapshots
createSandboxSnapshot(req) POST /sandbox-snapshots
getSandboxScrubPreview(ref) GET /sandbox-snapshots/scrub-preview
deleteSandboxSnapshot(ref) DELETE /sandbox-snapshots/{ref}?by=ref

New tri-state snapshot field on CreateSandboxRequest:

  • slug → boot the new sandbox from that snapshot
  • null → explicitly opt out of the repo-level default snapshot
  • omitted → keep the full default chain (repo default, else preset/size)

New exported types: SandboxSnapshot, CreateSandboxSnapshotRequest,
SandboxScrubPreview (with snake_case ↔ camelCase wire mappers).

Testing

pnpm run ci (typecheck, lint, formatcheck, build, vitest) is green —
50 tests pass, 9 new: list (with/without filters, empty envelope),
create (+ optional-field omission), delete (?by=ref, URL-encoded ref),
scrub-preview, and fork-on-create (slug + explicit null).

Note

The Go apiclient.CreateSandboxRequest doesn't yet carry a snapshot
field, so the SDK is briefly ahead of the Go client on
fork-from-snapshot. Happy to backport the Go field (and a CLI
--snapshot flag) in a follow-up to restore strict 1:1.

Bring `@amika/sdk` to parity with the CLI's snapshot commands and let
callers fork a new sandbox from a captured snapshot.

Add `AmikaClient` methods mirroring the Go apiclient 1:1:

- `listSandboxSnapshots(filters)` -> GET /sandbox-snapshots
- `createSandboxSnapshot(req)`    -> POST /sandbox-snapshots
- `getSandboxScrubPreview(ref)`   -> GET /sandbox-snapshots/scrub-preview
- `deleteSandboxSnapshot(ref)`    -> DELETE /sandbox-snapshots/{ref}?by=ref

Add a tri-state `snapshot` field to `CreateSandboxRequest` so a new
sandbox can boot from a captured snapshot (slug), explicitly opt out of
the repo-level default (`null`), or keep the full default chain
(omitted). The wire mapper relies on `omitUndefined` keeping `null`
while dropping `undefined`.

Add `SandboxSnapshot`, `CreateSandboxSnapshotRequest`, and
`SandboxScrubPreview` types with wire mappers, export them, document the
methods in the README, and cover everything with unit tests.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

dbmikus pushed a commit that referenced this pull request Jul 16, 2026
## Summary

Brings the Go CLI to parity with the TypeScript SDK (#284) on
fork-from-snapshot: `amika sandbox create --snapshot <slug>` now boots a
remote sandbox from a captured snapshot. Part of the parity audit
(KAPRO-570).

## Changes

- **`apiclient.CreateSandboxRequest`** — new `Snapshot *string` field
  (`json:"snapshot,omitempty"`). nil omits the field (server keeps its
  default snapshot chain); a slug forks the new sandbox from that
  snapshot.
- **`--snapshot` flag** on `sandbox create`, gated to `--remote` mode
  (mirrors the existing `--github-auth-mode` guard) — the local Docker /
  OSS `/v1` path has no cloud-snapshot store.
- Docs (`cli-reference.md`) + tests.

## Testing

Ran with Go 1.25.3 against the affected packages:

- `gofmt -l` clean · `go build ./...` OK · `go vet` OK
- `go test ./internal/apiclient/... ./cmd/amika/...` — pass
- New tests: `TestCreateSandboxSnapshotField` (slug sent / nil omitted),
`TestSandboxCreateHasSnapshotFlag`,
`TestSandboxCreateSnapshotRequiresRemote`

## Known limitation

`*string` + `omitempty` can't encode the server's explicit-`null`
opt-out (the repo-default bypass the TS SDK's `snapshot: null` exposes):
nil omits the field rather than sending `null`. Supporting it would need
a custom nullable type — out of scope here, since the CLI's need is
"fork from a slug." Called out in a comment on the field.

---------

Co-authored-by: Jakub Cichon <jakub@amika.dev>
@dbmikus
dbmikus merged commit 663909e into main Jul 16, 2026
2 checks passed
@dbmikus
dbmikus deleted the jakub/sdk-snapshot-support branch July 16, 2026 17:37
dbmikus added a commit that referenced this pull request Jul 16, 2026
Release sdk-typescript@v0.10.0.

Changes since sdk-typescript@v0.9.3:
- Add sandbox snapshot support to the TypeScript SDK (#284) (663909e)
- Document AgentCredentialRef resolution rules in TS SDK (#267) (aa784c2)
jdc123 added a commit that referenced this pull request Jul 17, 2026
Release `amika@v0.12.0` by bumping `DEFAULT_VERSION` in `install.sh`
from `0.11.2` to `0.12.0`.

## Changes since amika@v0.11.2

**Sandbox & CLI:**
- Add top-level `amika scp` command for SSH file copy (#278)
- Add `amika snapshot create/list/delete` commands (#282)
- Add `--snapshot` flag to `amika sandbox create` (#285)
- Support remote mode in `service list` (#283)
- Add (then hide) the `--github-auth-mode` flag on `sandbox create`
(#270, #273)
- Show command aliases in `amika` CLI help output (#263)

**Sandbox images & VM snapshots:**
- Install amika and amikalog CLIs in sandbox images (#280)
- Auto-install amikalog hooks in sandbox images (#281)
- Bump L/XL sandbox disk to 24 GB / 32 GB (#279)
- Match VM snapshot sizes to container sizes; add XL (#272)
- Version linux-vm snapshots by git short hash (#276)
- Don't publish the xs VM snapshot for coder-dind (#275)
- Publish Daytona linux-vm snapshots and restore setuid on VM boot
(#271)
- Drop user@host line from sandbox shell prompt (#269)
- Clear stale dockerd pidfile before starting daemon (#268)

**TypeScript SDK:**
- Release TypeScript SDK v0.10.0 with sandbox snapshot support (#287,
#284)
- Add `*.functional.test.ts` convention and prod guard (#286)
- Document AgentCredentialRef resolution rules (#267)

**Docs & internal:**
- Keep README local-first and add Amika Cloud section (#260)
- Fix stale API route paths in CLI client comments (#264)
dbmikus pushed a commit that referenced this pull request Oct 23, 2026
Bumps [pnpm/action-setup](https://github.com/pnpm/action-setup) from 5.0.0 to 6.1.0.

## Release notes

Sourced from pnpm/action-setup's releases.

### v6.1.0

### What's Changed
- feat: support pnpm v12 by `@zkochan` in pnpm/action-setup#288

Full Changelog: pnpm/action-setup@v6.0.10...v6.1.0

### v6.0.10

### What's Changed
- docs(README): point users to the successor pnpm/setup action by `@BlackHole1` in pnpm/action-setup#282
- refactor: introduce restore keys for cache by `@SukkaW` in pnpm/action-setup#280
- ci: use pnpm 11 for `pr-check` by `@jamietanna` in pnpm/action-setup#284
- fix: update pnpm to v11.19.0 by `@jamietanna` in pnpm/action-setup#283
- docs: update README to include devEngines.packageManager by `@nemchik` in pnpm/action-setup#273

### New Contributors
- `@jamietanna` made their first contribution in pnpm/action-setup#284
- `@nemchik` made their first contribution in pnpm/action-setup#273

Full Changelog: pnpm/action-setup@v6...v6.0.10

### v6.0.9

### What's Changed
- fix: update pnpm to v11.7.0 by `@zkochan` in pnpm/action-setup#267

Full Changelog: pnpm/action-setup@v6...v6.0.9

### v6.0.8

### What's Changed
- docs(README): fix `cache_dependency_path` type by `@haines` in pnpm/action-setup#257
- fix: drop patchPnpmEnv so standalone+self-update works on Windows by `@zkochan` in pnpm/action-setup#258
- fix: update pnpm to 11.1.1 by `@mungodewar` in pnpm/action-setup#248

### New Contributors
- `@mungodewar` made their first contribution in pnpm/action-setup#248

Full Changelog: pnpm/action-setup@v6.0.7...v6.0.8

### v6.0.7

### What's Changed
- fix: honor devEngines.packageManager.onFail=error (#252) by `@zkochan` in pnpm/action-setup#254
- fix: restore inputs from state in post by `@haines` in pnpm/action-setup#255
- fix: self-update bootstrap to packageManager-pinned version (#233) by `@zkochan` in pnpm/action-setup#256

### New Contributors
- `@haines` made their first contribution in pnpm/action-setup#255

Full Changelog: pnpm/action-setup@v6.0.6...v6.0.7

... (truncated)

## Commits
- `ea17c68` feat: support pnpm v12 (#288)
- `0977fd9` docs: Update README to include devEngines.packageManager (#273)
- `48261ac` fix: update pnpm to v11.19.0 (#283)
- `75677f7` ci: use pnpm 11 for `pr-check` (#284)
- `769ae71` refactor: introduce restore keys for cache (#280)
- `6fed91f` docs(README): point users to the successor pnpm/setup action (#282)
- `0ebf471` fix: update pnpm to v11.7.0 (#267)
- `0e279bb` fix: update pnpm to 11.1.1 (#248)
- `3e83581` fix: drop patchPnpmEnv so standalone+self-update works on Windows (#258)
- `551b42e` docs(README): fix `cache_dependency_path` type (#257)
- Additional commits viewable in compare view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants