* test: add comprehensive tests for delete message endpoint
* refactor: extract session auth checks into reusable helpers
* docs: add test:verbose script and align formatting in AGENTS.md
* style: format test file with consistent indentation
* test: add isolated test runner and update sandbox status mocks
* refactor: consolidate session auth checks into reusable helpers
* feat: extract PR generation helpers into separate module
* test: add comprehensive test coverage for PR generation helpers
* docs: remove completed API refactoring plan
* style: format function signatures and long lines
* test: refactor session API route mocks to use session-context
---------
Co-authored-by: nicoalbanese <49612682+nicoalbanese@users.noreply.github.com>
* docs: add database migration audit and preview deployment guide
* feat: add migration baseline for db:push-bootstrapped databases
* feat: add shares and usage_events tables with indexes
* refactor: improve db migration baseline detection and logging
* fix: make postgres url optional in drizzle config and add db check to ci
* docs: clarify db branching and format code
* refactor: use db:generate script instead of direct drizzle-kit
* docs: add CI/script execution rules to AGENTS.md
* feat: add database table existence check in migration baseline
* update ci script
---------
Co-authored-by: nicoalbanese <49612682+nicoalbanese@users.noreply.github.com>
Co-authored-by: nicoalbanese <gcalbanese96@gmail.com>
* ci: add bun test to ci script
* docs: update ci script description to include tests
---------
Co-authored-by: nicoalbanese <49612682+nicoalbanese@users.noreply.github.com>
* Exempt API routes and install script from Vercel deployment protection
Use vercel.ts with deploymentEnv() to add x-vercel-protection-bypass
headers at the edge for /api/* and /install routes. This replaces the
previous approach of threading the bypass secret through React component
props and CLI fetch headers, which exposed the secret in the browser.
* fix vercel.ts import parsing for config compilation
* document bunx --bun vercel config validation
* fix vercel header config when bypass secret is unset
* fix vercel.ts export shape for header schema
* guard vercel bypass headers on missing secret
* Add configurable installer and homepage install card
* Redesign unauthed homepage with improved visual design and UX
* Add CLI connect banner to authenticated homepage and install card to tokens settings
* Use drizzle-kit migrate in prebuild and document POSTGRES_URL requirement
* Rename deep agent exports to Open Harness
* Redesign landing and CLI auth pages with dark terminal aesthetic
* Add design system documentation for dark terminal aesthetic
* Remove tech stack pills from landing page
* Add sign in button to landing page navbar
* Use drizzle-kit push in web prebuild
* tui: migrate from Ink to OpenTUI for improved input performance
Replace Ink with OpenTUI (@opentui/core, @opentui/react) to fix input lag
issues that were noticeable in long conversations.
Key changes:
- Add ink-shim.tsx compatibility layer to minimize component rewrites
- Replace manual chalk/marked markdown rendering with native <Markdown>
- Use TreeSitter-based syntax highlighting via OpenTUI
- Add ScrollBox with sticky scroll for better chat UX
- Refactor text-input to use segment-based rendering with attributes
- Update renderer initialization to use OpenTUI's createCliRenderer
The shim layer preserves Ink's API surface (Box, Text, useInput, useApp)
while using OpenTUI's renderer underneath. This enables incremental
migration to native OpenTUI patterns in follow-up work.
Removed dependencies: ink, ink-spinner, ink-text-input, cli-highlight
Added dependencies: @opentui/core, @opentui/react
* tui: align layout rows and centralize primary color
* tui: keep tool output readable in narrow terminals
* tui: align assistant text and show copy feedback
* tui: refine input shortcuts and mouse filtering
* tui: chunk stream output by line
* web: format avatar and dropdown menu components
* db: format migration metadata
* tui: use OpenTUI diff and code previews
* tui: refine clipboard toast styling
* fix: fetch models via web api
* feat: surface model context limits
* tui: improve interruption and question flow readability
* fix tui auto-submit after abort
* tui: keep input visible on typing
* chore: add ci script for core checks
* docs: note ci script in agent guide
* fix: use authenticated gateway models
* fix: enrich gateway models with context limits
* update lock
* update agents md
* Add token usage reporting for subagents
Display input tokens inline in task views next to tool count and duration.
Shows tokens while streaming and final count on completion.
Changes:
- Add messageMetadata callback to task tool to attach usage data
- Add token display to TUI and web task-group-view components
- Add tokens to task-renderer completion views
- Refactor web task-renderer to use proper types instead of casts
- Switch tool-call.tsx to narrow on part.type instead of derived string
- Add SubagentUIMessage type for proper typing of subagent output
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Consolidate formatTokens and improve type safety
- Move formatTokens to shared package to eliminate duplication across 4 files
- Add getToolSummary helper with proper type narrowing (replaces unsafe cast)
- Simplify IIFE patterns to ternary expressions in task renderers
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Migrate from custom blob snapshots to native Vercel snapshots
Replace the custom tarball-based snapshot system with Vercel's native
snapshot API. This simplifies the codebase and removes the @vercel/blob
dependency.
Key changes:
- snapshot() now uses native SDK method (automatically stops sandbox)
- Restoration happens at sandbox creation via source: { type: 'snapshot' }
- Added backwards compatibility for legacy blob URLs (https://)
- Removed SnapshotOptions, renamed RestoreOptions to LegacyRestoreOptions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix code review issues from snapshot migration
- Configure git user after native snapshot restoration in vercel and hybrid sandboxes
- Only render expanded input when non-empty in task-renderer
- Restore getToolSummary fallback for unknown tool types
- Remove legacy blob snapshot code (isLegacySnapshot, restoreLegacySnapshot, LegacyRestoreOptions)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Extract configureGitUser utility and remove legacy blob comments
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add sandbox snapshot reliability plan
Documents two approaches for ensuring sandboxes are snapshotted before
timeout even when clients are inactive:
- Approach A: Snapshot after every assistant response + auto-extend
- Approach B: Cron-based snapshot for sandboxes near expiration
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Preserve sandbox type on stop/snapshot for correct restoration
- Add isSandboxActive() type guard and clearSandboxState() helper
- Update API routes to use isSandboxActive() for active sandbox checks
- Preserve sandbox type in sandboxState when stopping/snapshotting
- Fix snapshot restoration to not create sandbox first (was preventing
snapshot restore due to sandboxId taking precedence over snapshotId)
- Update frontend task context to preserve type on state clearing
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add expiresAt tracking to sandbox state for client-side expiration checks
Store expiresAt timestamp in persisted sandbox state so the client can
immediately determine if a sandbox has expired without making a network
call. This fixes the issue where the UI shows "active" for expired
sandboxes until a network call fails.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix sandbox timeout snapshot and cleanup flow
- Add canOperateOnSandbox() to allow operations on expired sandboxes
- Make DELETE /api/sandbox idempotent (return success if already stopped)
- Fix snapshot response parsing to use snapshotId instead of downloadUrl
The client was looking for 'downloadUrl' but the API returns 'snapshotId',
causing the task's snapshotUrl to never be updated locally. This made the
UI show "Create sandbox" instead of "Resume sandbox" after timeout.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* add comment
* Fix sandbox utils type safety and snapshot restore race condition
- Add comprehensive JSDoc comments to isSandboxActive and canOperateOnSandbox
- Extract hasRuntimeState helper to reduce code duplication
- Fix clearSandboxState to use explicit switch instead of type cast
- Add null check for getState result in extend route
- Prevent snapshot restore while sandbox is running (race condition fix)
- Only pass type and snapshotId when restoring (avoid stale sandboxId)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Consolidate sandbox timeout configuration into single file
- Create apps/web/lib/sandbox/config.ts with timeout constants
- Replace hardcoded 300_000 values across web app with shared constants
- DEFAULT_SANDBOX_TIMEOUT_MS for new sandboxes
- EXTEND_TIMEOUT_DURATION_MS for timeout extensions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix sandbox timeout propagation and client display on refresh
- Add timeout option to ConnectOptions and pass through to Vercel SDK
- Pass DEFAULT_SANDBOX_TIMEOUT_MS when creating sandboxes in web app
- Return expiresAt from reconnect endpoint for accurate client display
- Calculate remaining timeout from expiresAt on reconnect (not default)
- Pass remainingTimeout when restoring from snapshot
- Display remaining seconds next to sandbox status indicator
Previously, the timeout was only sent to the client but not to the SDK,
causing sandboxes to use the SDK's 300s default. On refresh, the client
would also reset to the default instead of showing actual remaining time.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* update
* Fix timeout propagation when restoring hybrid sandbox from snapshot
Pass remainingTimeout to VercelSandbox.connect() during snapshot restoration,
matching the pattern in vercel/connect.ts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Add slash commands for CLI settings with /model command
Implement a slash command system for the CLI that allows users to
configure settings via interactive panels. The first command is /model
which opens a searchable model selection panel.
Features:
- Slash command detection when typing "/" at start of input
- Generic SettingsPanel component with search/filter support
- Model selection with name, description, and pricing info
- Settings persistence to ~/.config/open-harness/settings.json
- Dynamic model switching without restarting the CLI
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Improve model selector with windowed display and cleaner UI
- Limit visible options to 5 at a time with scroll indicators
- Remove model descriptions, show only name and pricing
- Fix vim keys (j/k) to only work when not actively searching
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add dynamic model fetching from gateway API
Fetch available models from the AI gateway at startup instead of using
a hardcoded list. Add Zod schema validation for settings. Pass available
models through TUI options to the chat context.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Improve model selector UX and add defensive pricing handling
- Remove getModelDisplayName, display raw model ID in header instead
- Remove tab key navigation from settings panel
- Add model ID to search filter for easier lookup
- Add NaN check in formatPricing to handle invalid gateway data
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix settings panel lag when navigating with arrow keys
Memoize options array and callbacks in app.tsx to prevent unnecessary
re-renders. Replace useEffect with synchronous state updates and refs
in settings-panel.tsx to avoid render cascades when navigating.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix settings panel React state management and suppress SDK warnings
Move search query reset logic to useEffect for proper React lifecycle
handling and add guards to prevent callbacks from firing during initial
render. Also suppress AI SDK log warnings in the CLI dev script.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Refactor TUIOptions to use standard type imports
Replace inline import("...").Type syntax with proper type imports at
the top of the file for Settings and ModelInfo types.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix exports
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* add plan for docs sandbox
* update plan
* Fix sandbox update condition for recreation
* Add snapshot schema and migration
* Add snapshot types to sandbox interface
* Implement snapshot and restore in Vercel sandbox
* Add snapshot API endpoints
* Add snapshot UI and state management
* Fix snapshot security and error handling issues
- Add sandbox ownership check to PUT restore endpoint
- Clean up temporary archive file after snapshot upload
- Add error state and UI feedback for restore failures
- Extract shared snapshot save logic to reduce duplication
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix snapshot restore option not appearing after first save
Update task state in React context after saving a snapshot so the
restore option appears immediately without requiring a page refresh.
Also sync sandboxId state between frontend and database to prevent
stale state issues.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Use scoped client token for blob uploads
Generate a short-lived, scoped client token instead of passing the
full BLOB_READ_WRITE_TOKEN to the sandbox. This mitigates token
exposure in shell commands and logs.
The client token is:
- Scoped to the specific snapshot pathname
- Valid for only 5 minutes
- Limited to 500MB uploads
- Restricted to gzip content types
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix snapshot restore failing for unpushed branches
For isNewBranch tasks, the branch only exists locally in the sandbox.
When restoring a snapshot, the code was trying to clone from that branch
which doesn't exist on origin, causing git clone to fail.
Now uses prNumber as a proxy for "branch exists on origin" - if no PR
was created, the branch was never pushed, so we clone the default branch
and create the new branch locally instead.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix chat route security and error handling
- Require taskId in chat route to ensure sandbox ownership is always verified
- Add JSON parse error handling for malformed request bodies
- Improve error message when blob upload returns non-JSON response
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Add just-bash dependency to package.json
* Implement JustBashSandbox class
* Export JustBashSandbox from sandbox index
* Add type property to Sandbox interface
* Add type property to LocalSandbox
* Add type property to VercelSandbox
* Add just-bash sandbox type to factory
* Adjust agent instructions for just-bash sandbox
* Add Biome and oxlint as dev dependencies
* Add Biome configuration file
* format
* lint
* add lint info
* Extract addTokens helper to module level
* Extract getTodoIcon and getTodoColor helpers
* Extract pad helper to module level
* Add oxlint configuration
* Enable React linting rules in oxlint config
* Move useMemo before early return in Suggestions
* Disable exhaustive-deps lint for intentional mount-only effect
* Add @vercel/sandbox dependency
* Extend Sandbox interface with env and stop methods
* Support env vars in LocalSandbox
* Export VercelSandbox from sandbox module
* Add sandbox cleanup on agent finish
* Fix potential undefined array access in status bar
* add vercel sandbox and updated plan