Commit Graph
406 Commits
Author SHA1 Message Date
weishu c1092bcfec refactor: improve LoginPrompt UI/UX with simplified layout and better navigation
- 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
2026-01-05 21:28:42 +08:00
weishu 43e55b3ecb refactor: decompose Store into domain-specific substore classes 2026-01-05 19:35:20 +08:00
weishu ff35c52160 Release version 0.6.0 2026-01-05 18:42:37 +08:00
weishu 9a28e6e0a1 refactor: unify MCP bridge setup and system prompt delivery
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.
2026-01-05 18:38:58 +08:00
weishu c50621e85a feat: add MCP config and system prompt support for Codex local mode
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)
2026-01-05 18:38:58 +08:00
weishu 45822afa49 refactor: split CLI handlers into modular handler files 2026-01-05 18:32:52 +08:00
weishu 908d2f694a refactor: extract permission handler base class for code reuse 2026-01-05 18:04:51 +08:00
weishu e8252c601f refactor: extract remote launcher base class for code reuse 2026-01-05 16:50:22 +08:00
weishu 0e360f0a48 refactor: extract session scanner base class for code reuse
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.
2026-01-05 15:53:30 +08:00
weishu 6ce521c3f8 refactor: consolidate configuration files into dedicated config module 2026-01-05 13:53:00 +08:00
weishu 77eefcd8da refactor: move path utilities to utils directory 2026-01-05 13:00:48 +08:00
weishu d388c92114 refactor: remove CLI dead code
Remove unused daemon installation/uninstallation logic and unnecessary re-exports:
- Delete cli/src/daemon/mac/ directory (macOS LaunchDaemon install/uninstall not used)
- Delete cli/src/daemon/install.ts and uninstall.ts wrappers
- Remove daemon install/uninstall subcommands from cli/src/commands/daemon.ts
- Delete cli/src/api/encryption.ts (misleading name, just base64 encoding)
- Inline base64 encoding directly in cli/src/persistence.ts
- Delete cli/src/modules/common/gitHandlers.ts (unnecessary re-export)
- Update cli/src/modules/common/registerCommonHandlers.ts to import directly from handlers/git

Part of refactoring plan item #1 "删除 CLI 死代码".
2026-01-05 13:00:48 +08:00
weishu 23887ce040 refactor: remove unused/deprecated code and legacy socket events 2026-01-05 13:00:48 +08:00
weishu 21a64dfb49 refactor: extract session summary utilities to shared module 2026-01-05 13:00:48 +08:00
weishu f7d161e6cf feat: add api-error event support with folding for retry messages
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.
2026-01-05 13:00:25 +08:00
weishu b665e34d3c refactor: modularize store implementation into domain-specific modules 2026-01-05 11:51:49 +08:00
weishu f82728e9b3 refactor: remove deprecated logout command and legacy sidechain logic 2026-01-05 10:49:23 +08:00
weishu 7a487269ea refactor: replace hardcoded permission/model modes with centralized schema validation
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.
2026-01-04 22:07:03 +08:00
weishu c8325b921a refactor: extract session lifecycle management and mode switching to shared module
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.
2026-01-04 20:50:33 +08:00
Ruihang XiaandGitHub 2e8d644945 feat(terminal): add quick input for control keys (#31)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
2026-01-04 20:48:46 +08:00
Ruihang XiaandGitHub d1c532301e feat: sync thinking state to session list view (#32)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
2026-01-04 20:48:21 +08:00
weishu 37c6bc83d7 chore: migrate to AGPL-3.0-only 2026-01-04 20:45:15 +08:00
weishu 34cfe49f87 refactor: extract chat normalization and reducer logic, cleanup legacy credentials
- Split normalize.ts into focused modules: normalizeAgent, normalizeUser, normalizeUtils
- Extract reducer.ts into specialized modules: reducerCliOutput, reducerEvents, reducerTimeline, reducerTools
- Remove legacy credentials support (zod schema, readCredentials, writeCredentialsLegacy)
- Refactor NewSession component from monolithic file into modular subcomponents
- Improves code organization and maintainability across chat and authentication layers
2026-01-03 23:39:10 +08:00
weishu 63f3bcac3d fix: correct npm repository URL format in cli package
Use git+https://...git format to prevent npm publish warning about
auto-correction of repository URL field.
2026-01-03 23:15:23 +08:00
weishu 47e9d316c9 Release version 0.5.0 2026-01-03 22:54:52 +08:00
weishu 920ef29ab4 fix: docker build 2026-01-03 22:52:04 +08:00
weishu 4d18789d50 refactor: extract permission mode utilities and consolidate styling logic
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.
2026-01-03 22:49:40 +08:00
weishu f2f46e9383 refactor(api): extract versioned update handling to shared utility
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.
2026-01-03 22:23:29 +08:00
weishu 705933e17b refactor: extract message utilities to shared module
Consolidate RoleWrappedRecord type and message envelope utilities into
a new shared module to reduce duplication across server and web packages.
2026-01-03 22:23:29 +08:00
weishu 83bf40fa53 Fix npm release wrapper package 2026-01-03 22:22:45 +08:00
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