Commit Graph
380 Commits
Author SHA1 Message Date
weishu 685c846b91 feat: handle thinking blocks as reasoning blocks in chat normalization 2025-12-26 13:35:27 +08:00
weishu 8122768a01 feat: add reasoning block support to chat system
Add comprehensive support for handling reasoning blocks throughout the chat pipeline, including normalization, reconciliation, type definitions, and UI rendering. Implements collapsible reasoning group component with auto-expand during streaming and shimmer indicator.
2025-12-26 13:35:27 +08:00
weishu 5d5023883e refactor: safely access Bun.main with optional chaining 2025-12-26 12:40:44 +08:00
weishu 76b84a0b52 refactor: unify bun compiled detection with windows support
- Add shared isBunCompiled() function for consistent runtime detection
- Support Windows virtual filesystem paths (/~BUN/) alongside Linux/macOS (/$bunfs/)
- Use Bun.main for reliable detection instead of process.argv[1]
- Remove redundant $bunfs checks from cli/src/index.ts
- Update cli/src/utils/bunRuntime.ts to use shared detection function
- Create server/src/utils/bunCompiled.ts for server-side compilation check
2025-12-26 11:29:12 +08:00
weishu abec6d958d refactor: update dependencies including zod, vitest, and type packages 2025-12-25 23:18:13 +08:00
weishu 0769d498ba refactor: upgrade to Tailwind CSS v4 and update dependencies
Migrate to Tailwind CSS v4 with new @tailwindcss/postcss plugin, upgrade xterm.js to v6, vite to v7, and other core dependencies for improved performance and compatibility.
2025-12-25 23:13:44 +08:00
weishu 3765cc539b refactor: update dependencies and fix TypeScript instantiation depth issues
Updates ModelContextProtocol SDK and multiple dependent libraries to latest versions. Refactors TypeScript schemas to avoid instantiation depth issues by widening Zod types and using explicit type parameters.
2025-12-25 22:56:08 +08:00
weishu 38e8fe8d02 refactor: remove eslint and tsx-related dependencies after bun migration
Removes dev dependencies no longer needed after migrating from tsx to bun as TypeScript runtime and removing linting toolchain. Moves workbox-window to web package dependencies where it's actually used.
2025-12-25 22:29:35 +08:00
weishu 4314aececd refactor: migrate from tsx to bun as TypeScript runtime
Remove tsx dependency and update all dev scripts and documentation to use bun
as the primary TypeScript runtime for development. Consolidate process detection
logic in daemon.ts to check for dev mode via src/index.ts regardless of runtime.
2025-12-25 22:13:58 +08:00
weishu e9b1f9983d refactor: simplify connection indicator component with inline styling 2025-12-25 21:57:18 +08:00
weishu 18e6310451 feat: implement web terminal feature with xterm.js and Socket.IO proxy
- Add CLI-side terminal management via Bun.Terminal with TerminalManager
- Implement server-side Socket.IO proxy for terminal I/O between web and CLI
- Create web terminal UI component with xterm.js and support for resize/reconnect
- Add terminal route and navigation button in session chat
- Include comprehensive terminal implementation plan and architecture docs
2025-12-25 21:57:18 +08:00
weishu 0762f0772f refactor: move directory creation before lock file operations. fix #6 2025-12-25 21:48:33 +08:00
weishuandGitHub d083a73cb0 Revise diagrams and data flow for Happy and HAPI
Updated diagrams and data flow descriptions for Happy and HAPI models in WHY_NOT_HAPPY.md.
2025-12-25 20:40:36 +08:00
weishu 6dc80f14bc refactor: adjust safe area padding for Safari browser 2025-12-25 19:27:31 +08:00
weishu 8e6ab5394b refactor: optimize safe area handling in web components
Apply safe area insets to sticky/fixed headers (using top inset) and bottom-fixed elements (using bottom inset), rather than to scroll containers. This ensures proper spacing on devices with notches and home indicators (e.g., iPhone).

- Sessions List page: Move header outside scroll container with sticky positioning and pt-[env(safe-area-inset-top)]
- SessionList component: Add renderHeader prop to optionally hide internal header when parent renders it
- HappyComposer: Change bottom padding to pb-[calc(0.75rem+env(safe-area-inset-bottom))] for proper iPhone home indicator spacing
2025-12-25 17:44:44 +08:00
weishu 0be023b23b feat: add configurable server URL for standalone web hosting
Adds support for hosting the web UI separately from the hapi server on static hosts (GitHub Pages, Cloudflare Pages). Users can now set a custom server origin via a dialog on the login screen, with the ability to return to same-origin behavior.

Changes include:
- New useServerUrl hook for managing server URL configuration and storage
- Updated API client to support baseUrl parameter for all requests
- Enhanced login UI with server picker dialog (top-right button)
- Auth system now keys tokens per baseUrl to support multiple servers
- SSE connection updated to use configured baseUrl
- Documentation updates for standalone hosting setup
2025-12-25 17:42:30 +08:00
weishu 73f5a51548 fix url of happy project 2025-12-25 17:42:22 +08:00
5adf0f20e7 docs: add macOS quarantine fix and Access Token guide (#5)
- Add macOS quarantine fix instructions for prebuilt binaries
- Document Access Token location (~/.hapi/settings.json)
- Show how to view and set custom token

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 17:37:43 +08:00
weishu 21ed9fca2f docs: update Gemini default args to experimental-acp
Update HAPPY_GEMINI_ARGS default from --acp to --experimental-acp and add note about Gemini remote-only mode.
2025-12-25 16:56:26 +08:00
weishu fa63529d04 fix: persist CLI_API_TOKEN from env var to settings when not already saved
When CLI_API_TOKEN is provided via environment variable, persist it to settings.json
if not already saved. This prevents token regeneration if the env var fails to load
on subsequent startups, ensuring token consistency across server restarts.
2025-12-25 15:48:45 +08:00
weishu 1405e2bca9 Release version 0.1.3 2025-12-25 15:18:03 +08:00
abe215d5d5 fix: use Bun.main to detect compiled binary instead of Bun.isCompiled (#4)
Bun.isCompiled does not exist and always returns undefined, causing
embeddedAssetMap to be null. This makes the server fall back to looking
for web/dist directory, which doesn't exist when running the compiled
binary from a different location.

The correct way to detect a compiled Bun binary is to check if Bun.main
starts with '/$bunfs' (the virtual filesystem path used by compiled binaries).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 15:15:04 +08:00
weishu b953391737 fix: improve message counter initialization with bootstrap check
Add hasBootstrappedRef to track component initialization and prevent
counting messages during the initial render. This fixes the new message
counter behavior when messages load on component mount and ensures
accurate message tracking when autoScroll is disabled.
2025-12-25 14:58:56 +08:00
weishu 6829ca35a4 docs: add architectural comparison with Happy and update README
Add comprehensive WHY_NOT_HAPPY.md documenting the architectural
differences between HAPI's local-first design and Happy's cloud-first
approach. Update README with clearer project description and link to
new documentation.
2025-12-25 14:01:13 +08:00
weishu 3cdfee0c36 0.1.2 2025-12-25 13:05:15 +08:00
weishu 8353d34dfb refactor: move web asset module declarations to dedicated types file 2025-12-25 12:48:41 +08:00
weishu c224188dd3 chore: allow release dry-run without npm login 2025-12-25 12:46:26 +08:00
weishu ffabc0196d chore: remove unused 2025-12-25 12:34:16 +08:00
weishu 4fb2a203c6 feat: add pre-checks to release-all script for safety
Add validation checks before releasing:
- Ensure we're on the main branch to prevent accidental releases from feature branches
- Verify npm authentication to prevent failed publish attempts

This prevents common release mistakes and improves release workflow reliability.
2025-12-25 12:30:10 +08:00
weishu e5f9d8cbe8 feat: implement server configuration persistence to ~/.hapi/settings.json
Configuration now loads with priority: environment variable > settings.json > default value.
When values are read from environment variables and not present in settings.json, they are automatically saved for future use. This eliminates the need to repeatedly set environment variables.

- New serverSettings.ts module handles loading/saving with persistence logic
- Async createConfiguration() factory for proper initialization ordering
- Configuration sources tracked and displayed in startup logs
- Exported Settings interface and read/write functions from cliApiToken.ts
- Updated index.ts to display configuration sources in log output
2025-12-25 12:27:14 +08:00
weishu dbbeedea0d refactor: unify release workflow into single release-all script
Consolidate version bumping, building, npm publishing, and git operations into a single release script that handles platform packages first. This solves the issue where optionalDependencies needed platform packages published before bun install could generate complete lockfile hashes.

Changes:
- Created cli/scripts/release-all.ts with support for --dry-run, --publish-npm, and --skip-build flags
- Removed release-it dependency and old release/publish-npm scripts
- Simplified GitHub Actions release workflow to always use --generate-notes
- Deleted obsolete release configuration files (.release-it.json, .release-it.notes.js, publish-npm.ts)
2025-12-25 12:26:49 +08:00
weishu d11bfbef86 chore: prepare release 0.1.0 with native binary support
- Update CLI version to 0.1.0
- Change bin script extension from .js to .cjs for ES module compatibility
- Add release-it as dev dependency for version management
- Update all platform-specific binary package versions to 0.1.0
- Enhance release workflow to support custom RELEASE_NOTES.md
2025-12-25 11:31:03 +08:00
weishu f65611b287 chore: run tools:unpack before tests 2025-12-25 11:12:29 +08:00
weishu 19abddb997 chore: setup integration test environment in CI workflow 2025-12-25 11:07:47 +08:00
weishuandGitHub ac50ae3df0 Merge pull request #3 from CherryLover/fix/esm-cjs-compatibility
fix: use .cjs extension for bin script to fix ES module compatibility
2025-12-25 10:41:28 +08:00
jiangjiweiandClaude Opus 4.5 cde0a09134 fix: use .cjs extension for bin script to fix ES module compatibility
The package.json has "type": "module" but bin/hapi.js uses CommonJS
require() syntax. Renaming to .cjs forces Node.js to treat it as
CommonJS regardless of the package type setting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 10:30:58 +08:00
weishu 90cb7dae05 feat: add Homebrew installation support for hapi CLI
- Update CI workflow to package release artifacts with correct naming (hapi-* prefix)
- Generate SHA256 checksums for all artifacts
- Auto-update homebrew-tap repository on release
- Add Installation section to README with Homebrew, npm, and binary options
- Simplify .release-it.json config as CI now handles release process
- Add update-homebrew-formula script to update formula in homebrew-tap
- Add release-artifacts directory to .gitignore

Users can now install via: brew install tiann/tap/hapi
2025-12-25 10:23:16 +08:00
weishu 5a3f10078e chore: add GitHub Actions CI/CD workflows 2025-12-25 09:19:34 +08:00
weishu 958e78dc6e refactor: rename HAPI_BOT_URL to HAPI_SERVER_URL
The project is no longer primarily a bot - it now provides HTTP API,
Socket.IO, SSE, and web app backend services. This rename reflects the
broader scope of server functionality.

Updates references in:
- cli/src/configuration.ts (core config)
- cli/src/ui/logger.ts (remote logging)
- cli/src/ui/doctor.ts (diagnostics)
- cli/src/commands/auth.ts (auth status)
- cli/src/daemon/daemon.integration.test.ts (test comments)
- README.md (quickstart docs)
- cli/README.md (CLI docs)
- cli/CLAUDE.md (dev docs)
2025-12-24 19:15:47 +08:00
weishu 4017590af9 docs: recommend npx @twsxtd/hapi as primary installation method
Update documentation to promote npm package usage over binary downloads:
- Changed primary quickstart command to use npx @twsxtd/hapi
- Moved binary download to alternative option with link to releases
- Updated Multi-agent support section to use npx commands
- Simplified Quickstart section title
- Adjusted step numbering to reflect changes
2025-12-24 19:08:53 +08:00
weishu 31dfaebc85 chore: remove Windows ARM64 build support and add npm publish scripts
- Add publish-npm and publish-npm:dry-run scripts to root package.json (forwarding to cli)
- Remove Windows ARM64 (bun-windows-arm64) from DEFAULT_TARGETS in build-executable.ts
- Remove Windows ARM64 check from getPlatformDir in build-executable.ts
- Remove HAPI_TARGET_WIN32_ARM64 from bunBundle.d.ts type definitions
- Remove Windows ARM64 check from embeddedAssets.bun.ts
2025-12-24 18:51:49 +08:00
weishu c47316d173 fix: prevent flash of white background in dark mode 2025-12-24 18:42:15 +08:00
weishu 92d9546a9d chore: add module declaration for web asset imports 2025-12-24 18:17:06 +08:00
weishu e0f0221453 fix: improve "Load older" button styling and alignment
- Centered button using mx-auto w-fit wrapper (matches SystemMessage pattern)
- Changed variant from secondary to outline for subtler appearance
- Reduced visual weight with text-xs opacity-80 hover:opacity-100
- Added ↑ arrow icon before the text
- Adjusted spacing to py-1 mb-2 and gap-1.5

Fixes alignment issues where button wasn't centered with content below and improves visual consistency with page design.
2025-12-24 18:16:26 +08:00
weishu d15eafba4c fix: prevent LoginPrompt flash on page refresh with stored token
Add additional condition to check for the intermediate auth state where
authSource exists but token hasn't been fetched yet. This prevents the
LoginPrompt from briefly flashing when the page is refreshed and the user
already has a stored access token.

Changes the condition from just `isAuthLoading` to also cover the gap
before the useAuth effect starts fetching the token, displaying the
loading state instead of the login prompt.
2025-12-24 18:16:23 +08:00
weishu 4497f437fd docs: rewrite daemon README with current codebase state
Complete documentation refresh covering:
- Version detection via CLI binary mtime (not package.json)
- Multi-Agent Support section with token authentication for claude/codex/gemini
- Directory creation approval flow for session spawning
- HTTP Control Server endpoints with Fastify + Zod schemas
- State persistence fields including startedWithCliMtimeMs
- Integration Testing section with test environment and key scenarios
- Typed shutdown sources (hapi-app, hapi-cli, os-signal, exception)
- MachineMetadata with new happyLibDir field
- WebSocket communication patterns and RPC methods
- Machine sync architecture with separated metadata and daemon state

Replaces CLAUDE.md with structured daemon documentation.
2025-12-24 18:16:01 +08:00
weishu b2eeb97d27 fix: handle abort signal before and during codex spawn
Add checks to gracefully handle abort signals:
- Check if abort is already signaled before attempting spawn
- Check if abort caused the spawn error instead of rejecting
2025-12-24 17:56:51 +08:00
weishu 2b3fa635f6 fix: constrain session disabled banner width to max-w-content 2025-12-24 17:56:37 +08:00
weishu eee4489b0f docs: update all README files with comprehensive documentation
Update documentation across the project to reflect current state of codebase:
- cli/README.md: Add all commands (codex, gemini, daemon subcommands, doctor, mcp),
  configuration options, storage locations, and source structure references
- server/README.md: Add complete HTTP API reference, Socket.IO events, Telegram bot
  features, core logic descriptions, and source structure
- web/README.md: Add all routes, feature descriptions, authentication flow, data
  fetching, real-time updates, and source structure
- README.md: Improve feature list clarity, add HTTPS exposure instructions in
  quickstart, add multi-agent support section
2025-12-24 17:56:07 +08:00
weishu 852c7f4c4e Licenses 2025-12-24 17:35:19 +08:00