Commit Graph
213 Commits
Author SHA1 Message Date
weishu b2c29a8cbd Add OpenAI new models 2026-03-08 10:53:26 +08:00
METOandGitHub a0c35bc225 feat(web): add appearance setting (follow system / dark / light) (#253)
* feat(web): add appearance setting (follow system / dark / light)

Add user-facing appearance preference to the settings page, allowing
users to choose between Follow System, Dark, and Light themes. The
preference is persisted to localStorage and takes priority over
automatic detection in the existing theme pipeline.

* fix(web): update theme on cross-tab appearance change

The storage event handler only updated React state without calling
updateScheme(), leaving data-theme and useTheme subscribers stale.

* fix(web): move cross-tab appearance sync to global initializeTheme

The storage event listener was inside useAppearance(), which is only
mounted on the settings page. Other pages never received cross-tab
theme updates. Move the listener into initializeTheme() so all pages
respond to appearance changes from other tabs.
2026-03-08 10:47:53 +08:00
METOandGitHub 446649576c fix(web): use i18n translation for hardcoded "Create Session" strings (#259)
Replace hardcoded English strings with translation function calls
in SpawnSession.tsx and router.tsx. Add newSession.title key for
the NewSessionPage header to match the newSession.* namespace.
2026-03-07 14:49:57 +08:00
JlovecandGitHub ef3328f48f fix(cli): support project slash command completion (#245)
Add project-level slash command discovery with recursive nested command scanning, pass workingDirectory through slash-command handlers, and align hub/web source unions to include project commands.
2026-03-05 12:50:59 +08:00
Mao MrandGitHub c9be2894ac feat(cursor): add support for Cursor Agent CLI integration (#236)
* feat(cursor): add support for Cursor Agent CLI integration

- Introduced new command `hapi cursor` to start Cursor Agent sessions.
- Added functionality for resuming sessions and managing permission modes.
- Updated documentation to include Cursor Agent usage and installation instructions.
- Enhanced existing codebase to accommodate Cursor as a recognized agent flavor.
- Implemented local and remote session handling for Cursor Agent.

This update expands HAPI's capabilities by integrating support for the Cursor Agent, allowing users to leverage its features alongside existing agents.

* Remove TODO.md file as it is no longer needed following the integration of Cursor Agent CLI support. This cleanup helps streamline project documentation and reflects the completion of the associated tasks.

* feat(cursor): implement remote mode and fix --hapi-starting-mode

- Consume --hapi-starting-mode in cursor command (do not forward to agent)
- Implement cursorRemoteLauncher: spawn agent -p with stream-json, --trust
- Add cursorEventConverter for NDJSON parsing (system/assistant/tool_call/result)
- Multi-turn via --resume session_id
- Update docs: cursor supports both local and remote modes

Made-with: Cursor

* fix: type error

* fix(cursor): address PR review - model UI, sessionId metadata, duplicate flags

- HappyComposer: use isClaudeFlavor for model mode (cursor has no model modes)
- cursorLocalLauncher: call onSessionFound for resume so cursorSessionId in metadata
- cursorCommand: do not forward parsed flags to cursorArgs (avoid duplicates)

Made-with: Cursor
2026-03-03 10:02:47 +08:00
LihengwannaflyandGitHub 1942f088ff fix(sync): add SSE heartbeat and alive status (#223) 2026-02-28 01:46:21 +08:00
ElderDogeandGitHub da71d235f3 fix(web): show agent messages immediately regardless of scroll position (#228) 2026-02-28 01:44:12 +08:00
467fb54231 fix(web): add Shift+Enter keyboard shortcut to send messages (#209)
On iPadOS with a hardware keyboard, `isTouch` is true (via pointer:coarse)
so submitOnEnter is disabled and there's no keyboard-based way to send.

Add Shift+Enter as a send shortcut that works on all platforms without
changing existing behavior — desktop Enter-to-send is preserved.

Closes #175

via [HAPI](https://hapi.run)

Co-authored-by: HAPI <noreply@hapi.run>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:57:40 +08:00
gaius-codiusandGitHub 77cfa715f9 fix(web): harden clipboard copy and terminal paste flows (#187) 2026-02-19 08:08:52 +08:00
Him188andGitHub b11e6ed7eb feat(web): persist new session agent and yolo preferences (#171) 2026-02-10 15:40:45 +08:00
Fdcode6andGitHub 2080ee8c7f feat(cli): support slash commands from installed plugins (#155)
* feat(cli): support slash commands from installed plugins

Allows HAPI to automatically scan and load slash commands from installed Claude plugins (e.g. superpowers). Commands are indexed with their plugin namespace prefix.

* fix(web): add 'plugin' to SlashCommand source type

This fixes the typecheck error identified by the PR review bot.

* fix(web): update Suggestion type to include 'plugin' source

* fix(slashCommands): 修复 scoped 插件名称解析及多版本安装选择逻辑

- 使用 lastIndexOf('@') 替代 split('@')[0] 以正确解析带 scope 的插件名
- 按 lastUpdated 降序排序选择最新的安装实例
- 增加 installations 空数组边界检查
2026-02-08 10:37:04 +08:00
Mark LandGitHub 4a59d4896f fix: prevent /sessions/new from matching as dynamic sessionId route (#164) 2026-02-07 22:33:08 +08:00
weishu 93d4028d83 fix(web): improve git status unavailable handling in files view 2026-02-06 21:04:27 +08:00
weishu fb9abc18d4 feat: Add directory tree tab to session files 2026-02-06 20:18:46 +08:00
weishu cc9b9279bd fix(web): require hub URL without clearing input 2026-02-06 17:03:46 +08:00
2f6bbcd400 fix(web): 修复切换会话时消息乱序问题 (#150)
* feat(web): add built-in Nerd Font for terminal icon support

Add MesloLGLDZ Nerd Font as a built-in web font to ensure Powerlevel10k
and other Nerd Font-dependent prompts render correctly in the web terminal,
even on devices without local Nerd Fonts installed (e.g., mobile phones).

Changes:
- Add MesloLGLDZNerdFontMono-Regular.woff2 to web/public/fonts/
- Load font via FontFace API with BASE_URL support for subpath deployments
- Merge font loading and terminal creation in same useEffect to ensure
  font is ready before terminal renders

Fixes #121

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: use CDN for Nerd Font instead of bundled file

Load MesloLGLDZ Nerd Font from jsDelivr CDN instead of bundling the 1.2MB
font file. This reduces the bundle size significantly while still ensuring
Nerd Font icons display correctly on all devices.

CDN URL: https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/fonts/MesloLGLDZNerdFontMono-Regular.woff2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(web): prevent message ordering issues when switching sessions

When switching between sessions or loading paginated messages, old tool
blocks from agentState.requests were being mixed with current messages,
causing display order issues.

Root cause: reduceChatBlocks creates tool blocks for all permissions in
agentState, including those older than the current message page. These
old blocks (with earlier createdAt) would appear mixed with newer messages.

Fix:
1. In reducer.ts: Skip creating permission-only tool blocks if their
   createdAt is older than the oldest message in the current view
2. In SessionChat.tsx: Clear caches synchronously in useMemo when session
   changes, since useEffect runs after render

Closes #148

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <noreply@hapi.run>

---------

Co-authored-by: tfq <tfq@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: HAPI <noreply@hapi.run>
2026-02-03 12:51:27 +08:00
61dd69d5df feat(web): add built-in Nerd Font for terminal icon support (#122)
* feat(web): add built-in Nerd Font for terminal icon support

Co-authored-by: tfq <tfq@gmail.com>
Co-authored-by: weishu <twsxtd@gmail.com>
2026-02-02 11:17:48 +08:00
weishu 5b27f6b41e feat(web): Add reconnecting feedback when SSE connection is lost (#125)
- Add ReconnectingBanner component to show "Reconnecting..." status
- Track SSE connection state in App.tsx with onDisconnect handler
- Add onBlocked callback to useSendMessage for handling blocked send attempts
- Provide haptic feedback when send is blocked due to no API or session
- Show toast notification when message cannot be sent due to server disconnection
- Add translation keys for reconnecting message and send blocked feedback in en/zh-CN

close #125
2026-02-01 19:40:43 +08:00
therainismeandGitHub e9cc98b7ee feat(web): Add session sidebar for desktop, keep mobile single-page layout (#112)
* feat(web): Responsive session sidebar + split chat layout

* Update sidebar width

* Fixed dialog

* Move the sidebar scrollbar to the left without flipping content
2026-01-31 10:06:43 +08:00
Trustin LeeandGitHub 7cad11ca27 Add About section to settings page with version info and tests (#119)
* feat(web): add About section to settings page

- Add website link to hapi.run
- Display app version from CLI package
- Display protocol version from shared module
- Add Vitest testing setup with settings page tests

🤖 Generated with Claude Code

* test(web): add tests for website link and i18n key usage

Address residual risks mentioned in PR review:
- Test website link URL and security attributes (target, rel)
- Verify correct i18n keys are used for About section via spy

Simplify test setup by using real I18nProvider and en locale.

🤖 Generated with Claude Code
2026-01-30 09:48:49 +08:00
weishu 308249abdb fix(web): improve font scale compatibility and defaults 2026-01-29 16:33:30 +08:00
therainismeandweishu efbe4f8d90 feat(web): add font size setting
- Add Settings > Display > Font Size selector (80/90/100/110/120%)
- Persist preference (hapi-font-scale) and apply globally via --app-font-scale
- Normalize main UI typography to match Settings
2026-01-29 16:25:47 +08:00
weishu b7c06db327 refactor: extract agent flavor utility functions into shared module 2026-01-29 15:41:19 +08:00
weishu cdf8226a9d refactor: extract tool input utility functions into shared module
Move getInputString, getInputStringAny, and truncate functions from
individual ToolCard components into a dedicated toolInputUtils module
to eliminate duplication across PermissionFooter, ToolCard, and
knownTools components.
2026-01-29 14:37:06 +08:00
weishu 70b5c22c8f feat: support opencode 2026-01-29 10:34:57 +08:00
J. F. ZhangandGitHub 66ab96bf38 fix(web): allow newline on mobile enter (#116) 2026-01-29 09:00:37 +08:00
weishu aef4da9ea9 docs: update cli, hub, and web README files with new features and configuration
- cli/README.md: Remove non-existent runner commands, add codex resume and worktree config
- hub/README.md: Document auto-generated CLI_API_TOKEN, add session/machines/events endpoints and push notifications
- web/README.md: Add settings and terminal routes, terminal and voice assistant sections
- docs/guide: Fix broken anchor link and add terminal FAQ entry
- AGENTS.md: Add new source directory references
2026-01-27 20:46:39 +08:00
weishu 37e10a831b feat: rename server package to hub
Rename the `server/` directory to `hub/` and update all references
across CLI, docs, web, and workspace configuration.
2026-01-27 19:51:21 +08:00
weishu 87c79c3b94 feat: add session resume capability with automatic continuation
Add ability to resume inactive sessions and automatically continue with new
session ID. Includes message merging for preserving conversation history,
UI improvements to allow sending during inactive state, and database schema
migration. close #87
2026-01-27 14:44:53 +08:00
weishu 7a8f1c3e87 feat: add compact_boundary event support in web UI
https://github.com/tiann/hapi/issues/108#issuecomment-3799439152
2026-01-27 10:04:01 +08:00
weishu 40c232ef8b fix: handle option highlighting in request_user_input component
- Trim selected value to match option labels during comparison
- Parse tool.result as JSON when loaded from history, as it's stored as string
2026-01-26 14:08:35 +08:00
weishu ae9650ca7c feat: add support for Codex's request_user_input tool
Implement full support for the request_user_input tool with both Web UI and CLI
components. This includes:

- New view and footer components for request_user_input tool UI
- Tool registration in knownTools and view registries
- Nested answer format support (Record<string, { answers: string[] }>)
- Backward compatibility with flat answer format (Record<string, string[]>)
- Permission handler updates for CLI request_user_input acceptance
- Type definitions and schema updates across shared/cli/server/web packages
- Translation strings for request_user_input UI elements
- Conditional footer rendering in ToolCard for question tools
2026-01-26 11:58:36 +08:00
weishu 8137ce4f23 feat: add microcompact_boundary event handling in web UI
Adds support for Claude Code's microcompact_boundary system message type to display context microcompaction events with token savings information in the chat UI. Shows a package icon with formatted token count (e.g., "Context compacted (saved 32K tokens)"). close #108
2026-01-26 10:30:27 +08:00
weishu 6f8f44a314 refactor: move attachment metadata schema to shared protocol package 2026-01-23 16:04:37 +08:00
weishu 9922588c6f refactor: consolidate utility functions into shared package
Move duplicate isObject, asString, asNumber, and safeStringify functions from multiple modules into a centralized shared/src/utils.ts module and update imports across cli, server, and web packages. This eliminates code duplication and improves maintainability.
2026-01-23 16:04:37 +08:00
weishu e130dfd24b feat: add model selection for AI agents (claude, codex, gemini)
Add a new ModelSelector component that allows users to choose specific model variants for different AI agents. This includes:
- ModelSelector UI component with agent-specific model options
- Model parameter propagation through API, RPC, and spawning layers
- Support for auto model selection (default behavior)
- Localization strings for English and Chinese
- Type definitions for model options per agent
2026-01-23 11:55:29 +08:00
weishu 29551478cc feat: add image paste functionality to composer
Implements paste event handler that automatically adds pasted images as attachments
to the composer. Adds Windows x64 binary support to dependencies.
2026-01-23 11:42:12 +08:00
weishu 8793362b5f docs: update installation guide and fix environment variable references (#85)
- Replace outdated WEBAPP_URL with HAPI_PUBLIC_URL in server and web READMEs
- Add CLI version verification steps in prerequisites section
- Enhance Cloudflare Tunnel documentation with quick and named tunnel examples
- Add --protocol http2 recommendation for tunnel stability
- Include pm2 alternative for runner process management
- Add Telegram Mini App troubleshooting notes and verification steps
2026-01-21 20:08:10 +08:00
weishu 6a498ec251 feat: redesign voice assistant icon with sound wave visualization 2026-01-21 19:33:59 +08:00
freespace8andGitHub 2cb8727874 feat: expose skills and $ autocomplete (#92) 2026-01-21 16:28:15 +08:00
weishu 26f6249fef fix: reposition ReactQueryDevtools button to middle-right
The button was blocking UI elements at the bottom-right corner. This CSS
override moves it to the middle-right position while keeping the same
horizontal placement, providing better UI visibility and interaction.
2026-01-20 10:28:13 +08:00
weishu 15d550d39a feat: add voice language selection in settings
Add support for users to select voice language preference, which is passed through to ElevenLabs agents via platform settings overrides. Includes new language mapping utilities, UI controls in settings page, and updated voice session initialization.
2026-01-20 00:57:01 +08:00
weishu 7a5946731d feat: add settings page with language dropdown 2026-01-19 21:33:22 +08:00
weishu 8a89d23e1b fix: properly clean up voice session resources on disconnect
- Add resetRealtimeSessionState() function to reset session state
- Store and stop media stream from permission request to prevent resource leak
- Call reset function when voice session disconnects
2026-01-19 19:14:46 +08:00
weishu a928e82db2 Add error hint 2026-01-19 19:03:01 +08:00
weishu 8f5b773b23 feat: voice assistant 2026-01-19 18:16:57 +08:00
weishu 53e4de6684 feat: add file upload support 2026-01-17 19:38:12 +08:00
weishu 940d7b8233 feat(web): add turn-duration event display 2026-01-17 15:00:04 +08:00
4f25fa2da4 feat(web): terminal quick keys + modifiers + long-press (#67)
* feat: expand terminal quick keys

Add navigation keys plus ctrl/alt modifiers for the web terminal.

* feat: make terminal modifiers sticky

Keep Ctrl/Alt active until toggled off, Termux-style.

* style: improve terminal quick key buttons

Boost active contrast and adjust sizing for mobile.

* feat: add terminal key popups

Use long-press popups for / and - keys.

* fix: make terminal modifiers mutually exclusive

* fix(web): keep soft keyboard open on terminal buttons

* fix(web): allow mouse clicks on terminal quick keys

* refactor(web): simplify terminal quick input modifier handling

Remove the applyModifiers callback and inline modifier state application.
Add automatic modifier reset after quick input when appropriate.

* refactor(web): extract dispatchSequence helper for terminal input handling

Create a reusable dispatchSequence callback to handle modifier application
and reset logic for both terminal data input and quick input handlers.

---------

Co-authored-by: weishu <twsxtd@gmail.com>
2026-01-14 11:55:58 +08:00
weishu 7003bda706 fix: use baseUrl for Socket.IO connection to support separate frontend hosting
Previously, useTerminalSocket used a relative path `/terminal` for Socket.IO,
which would connect to the frontend host instead of the actual HAPI server.
Now it uses the baseUrl from context to connect to the correct server, enabling
scenarios like hosting the frontend on GitHub Pages while the server runs elsewhere.
2026-01-14 11:27:35 +08:00