Commit Graph
276 Commits
Author SHA1 Message Date
weishu aa0c3f2f0d refactor(cli): split command routing and modularize RPC handlers
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
2026-01-03 17:29:05 +08:00
weishu 680a37071e refactor(sync): split SyncEngine into modular services
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.
2026-01-03 16:27:35 +08:00
weishu 7fe61d1564 Release version 0.4.2 2026-01-03 16:13:01 +08:00
weishu 41e5ce8eca fix(store): handle version 0 with existing tables gracefully
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.
2026-01-03 16:10:29 +08:00
weishu a2c4315e99 fix: allow dismissing PWA install prompt in Chrome/Edge
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.
2026-01-03 16:09:07 +08:00
weishu 365728aed7 refactor(store): introduce schema versioning and remove compatibility migrations
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
2026-01-03 15:52:29 +08:00
weishu 89b6fc34f7 refactor(cli): unify session bootstrap 2026-01-03 15:34:49 +08:00
weishu 8ce568ea70 Fix sync event typing 2026-01-03 14:57:00 +08:00
weishu e2028b6914 Unify protocol types and modes 2026-01-03 14:43:59 +08:00
weishu bfca058967 Release version 0.4.1 2026-01-03 13:07:38 +08:00
weishu 4fe20b74c7 fix: use relative path for PWA push notification URL 2026-01-03 12:55:09 +08:00
weishu 8e03cadcf8 refactor: restructure notification system with NotificationHub abstraction
Extract notification logic from PushNotifier into a modular architecture
with NotificationHub as the central coordinator and NotificationChannel
interface for different notification providers (push, telegram). This
enables better separation of concerns and easier addition of new
notification channels in the future.

- Create NotificationHub to coordinate multiple notification channels
- Create NotificationChannel interface for channel implementations
- Move push notification logic to PushNotificationChannel
- Update HappyBot to implement NotificationChannel
- Simplify HappyBot by removing sync event handling (delegated to hub)
- Add notification helper utilities (sessionInfo, eventParsing)
- Update index.ts to use new notification architecture
2026-01-03 12:36:44 +08:00
weishu b0652bddf8 chore: disable blank issues 2026-01-03 11:05:14 +08:00
weishu 90a8929881 chore: Add github issue template 2026-01-03 10:55:43 +08:00
weishu 83fa0157b4 feat: make session metadata updated_at timestamp optional
Allow updateSessionMetadata to conditionally update the updated_at timestamp
by adding an optional touchUpdatedAt flag. When set to false, the timestamp is
not modified, enabling metadata updates without changing the last modified time.
2026-01-03 10:31:58 +08:00
weishu bc602ff5ea fix: archive session 2026-01-03 10:31:54 +08:00
weishu d87250aff2 fix: docker build 2026-01-03 08:59:22 +08:00
weishu 690fbb3fba Release version 0.4.0 2026-01-02 21:47:45 +08:00
weishu 2de3a3d635 fix: expand codex custom prompt 2026-01-02 21:45:29 +08:00
weishu c112f3f93e docs: add push notifications documentation 2026-01-02 19:35:15 +08:00
weishu 43519621f3 feat: add web push notifications support
Implement push notification system with VAPID keys, client service worker integration, and push subscription management. Includes server-side PushService for sending notifications and PushNotifier for reactive event handling, plus client-side usePushNotifications hook and service worker support.
2026-01-02 19:19:40 +08:00
weishu 41fd1abd53 feat: add session management (rename, archive, delete)
Implements comprehensive session lifecycle management with user-friendly interactions:

Rename: Update session metadata.name via PATCH endpoint with conflict detection
Archive: Abort active sessions via DELETE endpoint with validation
Delete: Permanently remove inactive sessions with cascade cleanup

Backend:
- Store.deleteSession() removes session and cascade-deletes messages
- SyncEngine.renameSession() with concurrency error handling
- SyncEngine.deleteSession() with active session validation
- PATCH /sessions/:id for rename, DELETE /sessions/:id for delete

Frontend Components:
- RenameSessionDialog: Text input with auto-focus and error display
- SessionActionMenu: Modal with rename, archive, delete buttons
- ConfirmDialog: Reusable confirmation with error feedback
- SessionHeader: Menu button (⋮) triggering action menu
- SessionList: Long-press detection triggering item actions

Interactions:
- Long-press on session list items (500ms threshold) opens action menu
- Menu button in session header (non-Telegram environments only)
- Confirmation dialogs with descriptive warnings for destructive actions
- Real-time error display in dialogs on operation failure
- Haptic feedback on long-press via usePlatform hook

Accessibility:
- Keyboard support (Enter/Space) for long-press handler
- Focus management in RenameSessionDialog
- Proper ARIA labels and semantic HTML
2026-01-02 19:15:01 +08:00
weishu c2d1f8c507 feat: auto-scroll selected suggestion into view 2026-01-02 19:11:43 +08:00
weishu c3cc9be593 fix: correct diff/file toggle button styling in dark mode
The selected button was using bg-[var(--app-link)] with white text, which
resulted in invisible text in dark mode (white background + white text).
Changed to use bg-[var(--app-button)] and text-[var(--app-button-text)]
with opacity-80 for proper contrast in both light and dark themes.
2026-01-02 17:13:23 +08:00
weishu e6ae00f998 docs: update 2026-01-02 16:26:40 +08:00
weishu 94823b7a8b feat: add auto-start server feature for CLI
- Added /health endpoint to server for readiness checks (no auth required)
- Created autoStartServer module that auto-starts server when:
  - HAPI_SERVER_URL not set (using default localhost:3006)
  - cliApiToken exists in settings (server previously used)
  - Port 3006 is not currently listening
- Server runs as child process (not daemon) and exits when CLI exits
- Integrated maybeAutoStartServer() into hapi, codex, and gemini commands
2026-01-02 16:21:14 +08:00
weishu 11c95126e3 fix: handle back navigation from single file view to files list 2026-01-02 16:02:35 +08:00
weishu db6b227122 docs: dynamically fetch latest version from GitHub API 2026-01-02 13:30:56 +08:00
weishu 8cacd04db4 docs: add Seamless Handoff documentation and showcase
Introduce comprehensive documentation of HAPI's Seamless Handoff feature:

- README: Add Seamless Handoff to Features section
- how-it-works: Add complete Seamless Handoff guide with local/remote modes and switching workflow
- quick-start: Add Seamless Handoff link to Next steps
- AppShowcase: Add third card featuring "Switch Freely" mode switching capability
- Locales: Update English and Chinese translations for showcase content
2026-01-02 13:24:05 +08:00
weishu 721a56443c docs: simplify Getting Started section for 30-second onboarding 2026-01-02 13:03:57 +08:00
weishu 8258885cdc docs: clarify HAPI supports single user and small teams via namespaces 2026-01-02 13:00:40 +08:00
weishu 68f4f336c9 docs: clarify server deployment options and remote access methods
- Support both local and remote server deployment
- Add direct public IP access option for remote servers
- Remove tunnel requirement messaging
- Organize remote access options with details sections
2026-01-02 12:56:44 +08:00
weishu 2e9cb46a39 docs: add Steps component and refactor quick-start guide 2026-01-01 19:12:16 +08:00
weishu 0e98dadd50 docs: improve quick-start guide with next steps section 2026-01-01 14:44:13 +08:00
weishu 1e46bd3295 fix: update documentation routing and simplify navigation
- Replace VitePress router with window.location for docs index redirect
- Add redirect rules for /docs and /docs/ paths to quick-start guide
- Simplify navigation by removing section anchor links
- Update all CTA buttons to link directly to /docs/ instead of home sections
- Consolidate navigation layout on both desktop and mobile views
2026-01-01 14:23:44 +08:00
weishu 4d2f91b9f5 fix: ensure workspace dependencies are installed via bun workspaces
Add "website" and "docs" to bun workspaces in root package.json and remove
pnpm packageManager field from website/package.json to fix bun run build:site.
2026-01-01 12:54:10 +08:00
weishu 77a2eee236 site: Add official website source
- Set VitePress base to '/docs/' for serving documentation at /docs/ route
- Update favicon path in head config to '/docs/favicon.ico'
- Add build:site script to build website and docs, then merge outputs
2026-01-01 12:48:45 +08:00
weishu 5c059b6023 Release version 0.3.3 2025-12-31 23:44:12 +08:00
weishu 7ae7158127 fix: improve namespace-based multi-user 2025-12-31 23:28:29 +08:00
weishu e821458af8 feat: add namespace-based multi-user isolation
Implement namespace support across sessions, machines, and users for multi-user server deployments. Add access control with specific error reasons (namespace-missing, access-denied, not-found) and database schema updates with namespace columns and indexes.
2025-12-31 21:56:01 +08:00
weishu 460c393006 docs: add documentation site with VitePress setup
- Initialize VitePress documentation site with config, index, and guides
- Add guides for quick-start, installation, PWA, how-it-works, FAQ, and why HAPI
- Update .gitignore to exclude VitePress cache directory
- Update logo.svg with actual icon from web/public/icon.svg
- Simplify README.md with link to full installation guide
- Remove redundant WHY_NOT_HAPPY.md (content migrated to why-hapi guide)
2025-12-31 20:41:02 +08:00
weishu 8f7dcf848b refactor: Add Telegram binding storage and auth 2025-12-31 17:43:57 +08:00
weishu a0b1bb1524 refactor: remove unused onboardingCompleted field from Settings 2025-12-31 17:24:13 +08:00
weishu 4efc263d9b chore: add LGPL-3.0-or-later license and update package.json licenses
- Add LICENSE file to root and cli/ directories with LGPL-3.0-or-later text
- Create cli/NOTICE file with MIT attribution for happy-cli derived code
- Update license field in cli/, server/, and web/ package.json to "LGPL-3.0-or-later"
- Add NOTICE to cli/package.json files array for npm publishing
2025-12-31 13:08:02 +08:00
weishu d61cfc90c2 refactor: replace specific character regex with comprehensive non-alphanumeric pattern
Update the regex in getProjectPath to replace all non-alphanumeric characters
with dashes instead of only specific ones. This provides more robust handling
of edge cases in working directory paths.
2025-12-31 12:18:34 +08:00
weishu 705ce24e17 refactor: remove unnecessary getCleanEnv() function
Simplify environment handling by removing the getCleanEnv() function that was
filtering out local node_modules/.bin paths. Running from home directory is
sufficient to avoid local cwd side effects.
2025-12-31 11:16:45 +08:00
weishu f796ad8749 feat(web): add sticky group headers to session list 2025-12-30 18:49:38 +08:00
weishu 6afee1f7ff Release version 0.3.1 2025-12-30 17:58:53 +08:00
ecfe0eff60 feat(web): 优化会话列表展示 - 按目录分组并显示更新时间 (#22)
* feat(web): add session list grouping by project directory

- Group sessions by project path with collapsible sections
- Sort groups by active status first, then by latest update time
- Sort sessions within each group by update time (descending)
- Add visual indicators for groups with active sessions
- Display project count in header statistics

Co-authored-by: weishu <twsxtd@gmail.com>
2025-12-30 17:42:20 +08:00
weishu b7dce6bf3f refactor: use undefined instead of null for optional return type 2025-12-30 17:39:24 +08:00