* update plan and add learnings * feat: sandbox lifecycle management with durable workflows Implement automatic sandbox hibernation, rollover, and restore using Vercel Workflow DevKit for durable scheduling. Key changes: - Add lifecycle state machine (active → hibernating → hibernated → restoring) - Durable workflow sleeps until hibernateAfter or near-expiry, then evaluates - Refresh activity timestamps at chat start (not just onFinish) to prevent mid-request hibernation - Status endpoint checks expiry with same 10s buffer as chat route - Reconnect probe no longer resets inactivity timer - Safety nets: status poll kicks overdue lifecycles, workflow retries on skip Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add sandbox lifecycle architecture doc Documents the full sandbox lifecycle state machine, workflow scheduling, activity tracking, safety nets, and client-side UI sync behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: remove sandbox hard-timeout rollover The rollover feature (snapshot + restore into fresh sandbox at hard timeout) added significant complexity for a scenario that rarely occurs — the 5-hour hard timeout is almost never reached before inactivity hibernation kicks in. When the hard timeout is reached, the sandbox now simply hibernates like any other idle sandbox. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove redundant chat-started lifecycle workflow kick The chat-started workflow kick was wrapped in Next.js `after()`, which defers execution until the response stream completes. This caused it to fire at the same time as the chat-finished kick, spawning two redundant workflows. The DB activity refresh (`buildActiveLifecycleUpdate`) already runs immediately at request start, which is sufficient to prevent mid-request hibernation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update timeouts * Update apps/web/next.config.ts Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> * fix: sandbox lifecycle bug fixes and utility deduplication - Extract shared `hasRuntimeSandboxState` and `isSandboxUnavailableError` into lib/sandbox/utils.ts, replacing 4 duplicate copies across route files - Tighten "not found" match to "sandbox not found" to prevent false positives from unrelated errors (e.g. "command not found", "file not found") - Reset lifecycleState back to "active" when snapshot is not supported, fixing sessions getting stuck in "hibernating" state - Only forward expiresAt to client on transient reconnect errors if still in the future, preventing negative timeout computation - Unify diff/files routes to use the full unavailability check (4 patterns) instead of only matching "expected a stream of command data" - Clean up commented-out debug config values in config.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * remove prebuild script --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
38 lines
710 B
JSON
38 lines
710 B
JSON
{
|
|
"compilerOptions": {
|
|
"target": "ES2017",
|
|
"lib": ["dom", "dom.iterable", "esnext"],
|
|
"allowJs": true,
|
|
"skipLibCheck": true,
|
|
"strict": true,
|
|
"noEmit": true,
|
|
"esModuleInterop": true,
|
|
"module": "esnext",
|
|
"moduleResolution": "bundler",
|
|
"resolveJsonModule": true,
|
|
"isolatedModules": true,
|
|
"jsx": "react-jsx",
|
|
"incremental": true,
|
|
"plugins": [
|
|
{
|
|
"name": "next"
|
|
},
|
|
{
|
|
"name": "workflow"
|
|
}
|
|
],
|
|
"paths": {
|
|
"@/*": ["./*"]
|
|
}
|
|
},
|
|
"include": [
|
|
"next-env.d.ts",
|
|
"**/*.ts",
|
|
"**/*.tsx",
|
|
".next/types/**/*.ts",
|
|
".next/dev/types/**/*.ts",
|
|
"**/*.mts"
|
|
],
|
|
"exclude": ["node_modules"]
|
|
}
|