Implement a visibility-aware notification system that delivers toast messages via SSE to visible browser tabs instead of sending push notifications, reducing unnecessary push requests. Includes VisibilityTracker for monitoring connection visibility, toast UI components, and enhanced SSEManager with toast delivery capability.
Introduces visibility tracking for pending messages to distinguish between
total pending messages and those that are actually visible to the user. This
allows the overflow warning to trigger only when visible messages are dropped,
not just any messages. Includes caching of visibility checks for pending
messages to improve performance.
Introduces a new message-window-store module to manage message state with
automatic windowing of visible and pending messages. This replaces manual
React Query cache operations with a centralized, observable state system.
close#39
Key changes:
- New MessageWindowState tracks visible/pending messages with size limits
- Automatic trimming of message windows (400 visible, 200 pending messages)
- Pending message buffering when user scrolls away from bottom
- Centralized status updates for optimistic messages
- Thread component simplified with forwarded scroll and pending callbacks
- Removes message count tracking from components
This improves performance for chats with many messages and provides a
cleaner separation of concerns between UI and state management.
Use relative paths with .md extension for docs/guide/*.md files and
relative paths in README.md to support both GitHub rendering and
VitePress website (which has base: '/docs/'). Fixes#36
Add configurable host binding for the Mini App HTTP server through:
- New `webappHost` configuration (defaults to 127.0.0.1 for security)
- CLI arguments `--host` and `--port` with flexible parsing (--host=value or --host value)
- Priority order: CLI args > env vars > settings.json > defaults
- Updated Bun.serve() to bind to the configured hostname
Modified:
- server/src/config/settings.ts
- server/src/config/serverSettings.ts
- server/src/configuration.ts
- server/src/web/server.ts
- server/src/index.ts
- cli/src/commands/server.ts
Reorganizes the LoginPrompt layout by moving the Server button from an
absolute-positioned top-right corner into the main content flow as a text
link in a new "Help links" section below the login form. Also adds a
"Needs help?" link pointing to the documentation. This reduces visual
clutter, improves hierarchy by grouping related actions, and provides
better guidance for new users.
## What changed
The website currently suggests installing `hapi` directly from npm, which
resolves to the deprecated `hapi@18.1.0` package (with known security issues).
This PR updates the installation command to use the correct CLI package:
`@twsxtd/hapi`.
## Why
Running `npm install -g hapi` triggers a deprecation and security warning:
> This version contains severe security issues and defects and should not be used
This is confusing for users and may lead them to believe HAPI itself is insecure.
## Result
- Users install the correct package
- No npm security warning
- Instructions now match the actual CLI package name
- Update subtitle to official slogan "Vibe Coding Anytime, Anywhere"
- Simplify input placeholder to "Access token"
- Remove verbose help text below the input field
- Move server settings from top-right corner to footer below form
- Add "Needs help?" link to docs (https://hapi.run/docs)
- Add underline styling to both help and server links for better affordance
- Add footer with copyright and Vibe Coding message
Extract duplicate MCP bridge initialization code from codexLocalLauncher and
codexRemoteLauncher into a new buildHapiMcpBridge utility. This ensures both
modes use identical server setup logic and provides a single source of truth
for MCP configuration.
Update codexStartConfig to deliver system prompt via developer_instructions
instead of appending to the user message. This ensures consistent behavior
between local and remote modes and properly separates system guidance from
user intent.
Implements MCP server configuration and developer instructions support in
Codex local mode, bringing it to parity with remote mode.
Key additions:
- buildMcpServerConfigArgs() and buildDeveloperInstructionsArg() utilities
to construct -c config arguments for passing MCP servers and instructions
to the Codex CLI at runtime
- TITLE_INSTRUCTION for Codex to call hapi__change_title to update chat
session titles dynamically
- Codex local mode now starts hapi MCP bridge server and passes both MCP
configuration and developer instructions to Claude, enabling full feature
parity with remote mode
Files changed:
- New: codexMcpConfig.ts (utilities), systemPrompt.ts (prompt definition),
codexMcpConfig.test.ts (comprehensive tests)
- Updated: codexLocal.ts (accepts mcpServers, builds config args),
codexLocalLauncher.ts (starts hapi server, passes config),
codexStartConfig.ts (imports TITLE_INSTRUCTION)
Create BaseSessionScanner abstract class to consolidate common session
scanning logic shared between Claude and Codex session scanners. Both
scanners now inherit from this base, reducing duplication and providing
consistent patterns for file watching, event processing, and state
management.
Introduces support for displaying API error system messages in the web UI with
automatic folding of consecutive retry messages to show only the latest state.
Extract permission and model mode validation into reusable functions utilizing
@hapi/protocol schemas. Use isPermissionModeAllowedForFlavor and
isModelModeAllowedForFlavor to validate modes based on session flavor (claude/codex).
Replace inline type definitions with shared types from @hapi/protocol.
Consolidates duplicate cleanup, signal handling, and state management logic from
runClaude and runCodex into a reusable createRunnerLifecycle factory function.
Extracts mode switching handler and controlled user state updates into utilities.
Adds runLocalRemoteSession wrapper to handle session ready callbacks in loop base.
Extract permission mode display logic into shared utilities for better reusability and maintainability. Add PermissionModeTone type and related helpers to centralize mode-based styling rules across components. Update components to use new PermissionModeOption type for consistent permission mode presentation.
Extract duplicate version acknowledgment logic from apiMachine and
apiSession into a reusable applyVersionedAck utility. This handles
success, version-mismatch, and error responses consistently with
customizable parsing and error handling via options object.
Restructure CLI entry point and RPC handler registration to improve maintainability:
- Introduce command registry pattern with CommandDefinition interface for consistent command structure
- Extract individual command modules (claude, codex, daemon, doctor, gemini, auth, connect, etc.)
- Move RPC handlers into separate feature modules (bash, files, git, directories, ripgrep, difftastic, slashCommands)
- Create shared RPC types and response helpers (rpcTypes.ts, rpcResponses.ts)
- Move SpawnSessionOptions and SpawnSessionResult to rpcTypes for proper type organization
- Simplify index.ts to minimal entrypoint using command registry
- Update imports in apiMachine.ts and daemon/run.ts to use rpcTypes module
This enables:
- Better code organization by feature/command
- Easier testing of individual commands
- Safer RPC handler registration without side effects
- Clearer separation of concerns between routing and business logic
Extracted five focused modules from SyncEngine to improve maintainability
and separation of concerns:
- EventPublisher: handles event broadcasting and listener management
- SessionCache: manages session state and lifecycle
- MachineCache: manages machine state and lifecycle
- MessageService: handles message storage and retrieval
- RpcGateway: handles RPC communication with sessions and machines
- aliveTime: utility for clamping and validating alive timestamps
Removed unused members (sessionMessages cache, fetchMessages,
getSessionMessages, setPermissionMode, setModelMode) that added
complexity without clear value.
SyncEngine now orchestrates these services as a lightweight facade,
improving code organization and testability.
Instead of throwing a schema mismatch error when version is 0 but tables already exist, set the version and return. This allows the database to properly initialize without erroring.
Add close button to Chrome/Edge install prompt and respect dismissed state
when determining if prompt can be shown. iOS version already had dismiss
capability, so this brings feature parity across all supported browsers.
Replace legacy migration logic (ALTER TABLE, missing column checks) with explicit
schema version tracking. This prevents silent schema mismatches and simplifies the
database lifecycle—users must rebuild or offline-migrate on version mismatch.
Changes:
- Add SCHEMA_VERSION and REQUIRED_TABLES constants
- Refactor initSchema() to check version and table presence
- Extract createSchema() and helper methods (getUserVersion, setUserVersion, etc)
- Add compound indexes for better query performance (tag+namespace, platform+namespace)
- Store dbPath for better error messages