Commit Graph
512 Commits
Author SHA1 Message Date
weishu 78f56ad0f7 refactor: migrate socket types and payloads to shared protocol package
Move socket-related type definitions and schemas from cli and server packages
into a shared @hapi/protocol package for centralized type management. This
includes migrating Update types, socket event interfaces (ClientToServerEvents,
ServerToClientEvents), and terminal payload schemas. Add strongly-typed socket
handlers that reference the protocol package instead of duplicating definitions.
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 a41d6aa662 feat: add --model parameter support to command handlers
Pass model selection through command pipeline to enable model switching during runtime

close #83, close #64
2026-01-23 11:55:40 +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 0ea5b5f8f6 docs: add background service deployment section with nohup, pm2, launchd, and systemd examples 2026-01-22 20:43:16 +08:00
weishu cd6cbe2686 docs: add Architecture section explaining HAPI components and workflows 2026-01-22 20:37:48 +08:00
weishu 4852362e3c Release version 0.12.0 2026-01-22 20:33:11 +08:00
weishu 442f6765b3 fix: prevent Gemini orphan processes when switching modes
Kill entire process tree instead of just the direct child to prevent
orphans when Gemini CLI ignores SIGTERM. Implements killProcessTree that
collects all PIDs synchronously, signals children first, then waits for
termination with auto-escalation to SIGKILL after 2 seconds. Also removes
Node.js signal option from spawn since built-in abort handling doesn't
handle grandchildren.
2026-01-22 20:17:26 +08:00
weishu 2c1179baf7 feat: gemini local/remote mode 2026-01-22 17:07:54 +08:00
weishu e36759115c feat: improve ACP stability and UX with initialization retry and error handling
- AcpStdioTransport: Fix stdout JSON validation to filter non-object JSON (numbers, strings, booleans) that could break protocol
- AcpStdioTransport: Add request timeout with 2-minute default, properly cleared on settle, using unref() for graceful shutdown
- AcpStdioTransport: Add stderr error parsing for rate limit (429), model not found (404), auth errors, quota exceeded
- AcpSdkBackend: Add initialization retry mechanism using withRetry() for initialize and session/new (3 attempts, 1-5s backoff)
- AcpSdkBackend: Add waitForResponseComplete() for safe session swaps and preventing race conditions
- AcpSdkBackend: Add onStderrError() handler and processingMessage getter for error reporting
- AcpSdkBackend: Use Infinity timeout for session/prompt to support long-running tasks
2026-01-22 11:53:17 +08:00
weishu ca63984f7e Release version 0.11.1 2026-01-21 20:11:06 +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
instartloveandGitHub 8b368024e3 feat(cli): support HAPI_HOSTNAME env to override machine hostname (#94) 2026-01-21 16:05:51 +08:00
NieiRandGitHub 835133519e fix: prevent model parameter from being set to arbitrary strings (#93) 2026-01-21 15:59:38 +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 55dbfa397b Release version 0.11.0 2026-01-19 19:17:26 +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 e9db67e18b docs: add voice assistant documentation 2026-01-19 18:48:13 +08:00
weishu 8f5b773b23 feat: voice assistant 2026-01-19 18:16:57 +08:00
weishu 53fff54c84 Release version 0.10.0 2026-01-19 13:07:25 +08:00
weishu 9e335fa305 refactor: rename configuration variables for clarity
Standardize naming across CLI and server components:
- CLI: serverUrl → apiUrl, HAPI_SERVER_URL → HAPI_API_URL
- Server: webapp* → listen*, miniAppUrl → publicUrl, WEBAPP_* → HAPI_LISTEN_*, WEBAPP_URL → HAPI_PUBLIC_URL
- Rename serverUrlInit.ts → apiUrlInit.ts with updated logic for backward compatibility
- Update all imports, function calls, and documentation accordingly
2026-01-19 12:57:37 +08:00
weishu 0228146b99 refactor: rename daemon to runner throughout codebase 2026-01-19 11:12:48 +08:00
weishu ccdcb3d75d feat: add attachment support for Codex and Gemini agents
close #84
2026-01-18 20:30:09 +08:00
weishu 662ed952a3 Release version 0.9.2 2026-01-18 12:34:18 +08:00
weishu f00c290204 fix: add postinstall script to set bin/hapi.cjs executable permission (#78)
This fixes an issue where npx @twsxtd/hapi fails because npm doesn't create
bin symlinks for packages with optionalDependencies. The postinstall script
ensures bin/hapi.cjs has executable permission.
2026-01-18 12:27:43 +08:00
weishu b93533b381 refactor: extract isBunCompiled to separate utils module 2026-01-18 12:19:13 +08:00
weishu 0d80e9245d Release version 0.9.0 2026-01-17 20:08:07 +08:00
weishu 3f465cd47d fix: escape newlines in shell arguments on Windows
close #70
2026-01-17 19:59:59 +08:00
weishu c44eae0b17 fix: use --add-dir flag for granting Claude read access to uploads 2026-01-17 19:38:12 +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
weishu f33d142446 fix: send session-alive signal immediately on socket connect to prevent initial offline flicker 2026-01-15 22:21:03 +08:00
weishuandGitHub 9d2cbd949e Add demo section to README
Added demo section with a link to the demo.
2026-01-14 14:54:20 +08:00
weishu f11db23d9e Release version 0.8.2 2026-01-14 12:34:28 +08:00
weishu 0163eb372d fix: set default TUNWG_PATH and support ~ in HAPI_HOME
Extract getHapiHome() helper to properly expand ~ prefix in HAPI_HOME
env var. Set TUNWG_PATH default to $HAPI_HOME/tunwg when not specified.
2026-01-14 12:26:00 +08:00
weishu 860124a772 fix: require runtime assets for server command 2026-01-14 12:22:15 +08:00
weishu 659ccc7023 Release version 0.8.1 2026-01-14 11:58:23 +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 9131429a05 refactor: extract and reuse CORS options for Socket.IO and Engine 2026-01-14 11:40:27 +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
weishu 584a912311 docs: README 2026-01-14 11:12:42 +08:00
weishu f138bbf469 Release version 0.8.0 2026-01-14 10:53:58 +08:00
weishu ce88171d8e feat: disable static file serving in relay mode
When relay mode is enabled, skip serving frontend assets through the relay tunnel to reduce bandwidth pressure. Instead, show a helpful page on root directing users to the official frontend at app.hapi.run.

Changes:
- server/src/web/server.ts: Add relayMode and officialWebUrl options, skip static serving in relay mode, show helpful page on root
- server/src/index.ts: Pass relayMode and officialWebUrl to startWebServer
2026-01-14 10:49:37 +08:00
weishu c3c89a2773 docs: default to --relay for simplified remote access with E2EE
Update documentation across README, installation, and quick-start guides
to highlight the new relay-based access method with WireGuard + TLS
end-to-end encryption. Changes include:
- Recommend `hapi server --relay` as the default startup command
- Explain URL and QR code generation in terminal for instant access
- Note end-to-end encryption for security assurance
- Reorganize self-hosted tunnel options (Cloudflare, Tailscale, IP)
- Update website installation steps and add E2EE badge
2026-01-14 10:36:46 +08:00