feat(persistence): durable sandbox persistence (SandboxStore + shared lock)#988
feat(persistence): durable sandbox persistence (SandboxStore + shared lock)#988AlemTuzlak wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Changeset Version Preview14 package(s) bumped directly, 37 bumped as dependents. 🟥 Major bumps
🟨 Minor bumps
🟩 Patch bumps
|
|
View your CI Pipeline Execution ↗ for commit e1e51d0
☁️ Nx Cloud last updated this comment at |
4b2e68a to
e1e51d0
Compare
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-code-mode
@tanstack/ai-code-mode-skills
@tanstack/ai-codex
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-mcp
@tanstack/ai-mistral
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-persistence
@tanstack/ai-persistence-cloudflare
@tanstack/ai-persistence-drizzle
@tanstack/ai-persistence-prisma
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-sandbox
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-vercel
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-utils
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
commit: |
e1e51d0 to
ef3e5f5
Compare
Sandbox resume (SandboxStore + shared lock) is provided by withPersistence and consumed by withSandbox. SandboxStore/SandboxStoreCapability and the lock primitives live in core @tanstack/ai; the persistence backends carry a durable sandbox store; conformance testkit, e2e, docs, and the ai-sandbox skill updated.
Summary
Stacked on #984. Lands the sandbox persistence piece #984 explicitly deferred: durable, multi-instance-correct resume for
@tanstack/ai-sandbox.withSandboxalready consumesSandboxStore(which sandbox to resume) andLockStore(mutual exclusion around ensure) as optional capabilities, defaulting to in-memory (single-process). This adds the durable half — no behavioral change to the sandbox layer.Core: one shared
lockstokenThe
'locks'capability now lives in core@tanstack/ai(LocksCapability,LockStore,InMemoryLockStore,getLocks,provideLocks);@tanstack/ai-sandboxand@tanstack/ai-persistencere-export it. Because capability identity is by reference, one shared token means awithPersistence({ stores: { locks } })already in the chain feeds the sandbox lock automatically — this is the "sandbox-consumer bridge" #984 noted as deferred.@tanstack/ai-sandboxwithSandboxPersistence({ store, locks? })— provides a durableSandboxStore(and optional distributed lock) towithSandbox. Compose beforewithSandbox.SandboxStoreconformance testkit exported at@tanstack/ai-sandbox/testkit(runSandboxStoreConformance).Durable
SandboxStorebackends@tanstack/ai-persistence-drizzle—createDrizzleSandboxStore(db)+ a newsandboxestable folded into the initial migration (regenerated; asset synced to the Cloudflare sibling).@tanstack/ai-persistence-prisma—createPrismaSandboxStore(prisma)+ aSandboxmodel in the fragment.@tanstack/ai-persistence-cloudflare—createD1SandboxStore(d1)(delegates to Drizzle); the existing Durable-Object lock doubles as the distributed sandbox lock.The three backends add
@tanstack/ai-sandboxas an optional peer dependency. Sandboxes stays out of the chat BYO schema/model contract, so chat-only users are unaffected.Tests / docs / skill
withSandboxPersistenceprovide + cross-run-resume unit tests.docs/sandbox/persistence.md(+ nav, overview callout, cross-links from the persistence backend docs).ai-sandboxagent skill./api/sandbox-durabilityharness route + spec asserting a second run resumes the persisted sandbox (create stays 1).Testing
Green locally (canonical nx targets,
--skip-nx-cache):test:sherif,test:knip,test:docs,test:kiira,test:oxlint,test:types, andtest:libfor@tanstack/ai,@tanstack/ai-sandbox, and all four persistence packages (conformance + wiring).@tanstack/ai-sandboxbuilds clean including the testkit + DTS.Deferred to CI (per #984's precedent — this dev machine's nx output-materialization is unreliable here, which also blocks the Playwright dev server for every route): the full workspace
build/test:buildand the Playwrighttest:e2erun. The sandbox-durability spec is authored, registered in the route tree, and typechecks; the identical server-side-resume behavior is covered by the@tanstack/ai-sandboxpersistence.test.tsunit test.Release
Changeset: minor for
@tanstack/ai,@tanstack/ai-sandbox, and the four persistence packages.