Commit Graph
278 Commits
Author SHA1 Message Date
weishu ce5edc42e1 Add support for claude 1M context. close #291 2026-03-16 08:51:40 +08:00
初沐andGitHub fedc8e79eb feat: add ~/.claude/skills/ and .claude/skills/ directory scanning support (#288) 2026-03-14 19:14:29 +08:00
Next2012andGitHub c730ad568e feat: add gemini yolo mode (#280) 2026-03-11 09:17:55 +08:00
4716d315b7 feat: improve spawn error handling and reporting across full stack (#249)
* feat: improve spawn error handling and reporting across full stack

- Return error result instead of throwing in apiMachine spawn handler
- Add lastSpawnError field to RunnerState for persistent error tracking
- Add error awaiter system for early process exit/error detection before webhook
- Build detailed webhook failure messages with exit code, signal, and stderr tail
- Report spawn outcomes to hub via runner state updates
- Handle more spawn result types in rpcGateway with better error messages
- Display runner last spawn error in web UI (NewSession & SpawnSession)
- Extract shared formatRunnerSpawnError utility to avoid duplication

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

* fix(cli): narrow spawnResult type check to fix TS2339 error

Use `type === 'error'` instead of `type !== 'success'` to properly
narrow the discriminated union, allowing TypeScript to infer errorMessage.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 20:55:50 +08:00
weishu b4b73d4405 Release version 0.16.1 2026-03-08 16:07:36 +08:00
06b71dbe98 feat: Add Claude Code Agent Teams support (#258)
* feat: Add Claude Code Agent Teams support

- Add TeamState schemas and types for team collaboration
- Extract team state from TeamCreate, SendMessage, Task tools
- Add database migration V3→V4 for team_state storage
- Add TeamPanel component to display team members, tasks, messages
- Add team tool icons and presentation rules
- Support vite proxy configuration via VITE_HUB_PROXY env var

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

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

* fix: Add timestamp protection for team_state updates

Prevent old messages from overwriting newer team state by checking
team_state_updated_at before updating.

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

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

* fix: Extract team tasks from Task/TaskCreate/TaskUpdate tools

- Enhance processTaskToolWithTeam to also generate task entries from
  the Task tool's description field when spawning teammates
- Add processTaskCreate handler for TaskCreate tool calls
- Add processTaskUpdate handler for TaskUpdate tool calls
- Register both new tools in the extraction switch statement

This fixes the gap where the Tasks section in TeamPanel could never
populate because team task data was not being extracted from the
message stream.

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

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

* fix: Skip orphan TaskUpdate without title to prevent schema validation failure

When TaskUpdate arrives before TaskCreate (message ordering), skip inserting
incomplete tasks that lack required title field, preventing entire teamState
from being dropped by schema validation.

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

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

* test: Add unit tests for orphan TaskUpdate handling

Verify that applyTeamStateDelta correctly skips inserting tasks without
title field (orphan TaskUpdate) while still allowing normal task creation
and updates to existing tasks.

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

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

---------

Co-authored-by: tfq <tfq@gmail.com>
Co-authored-by: HAPI <noreply@hapi.run>
2026-03-08 11:26:11 +08:00
weishu fff474ccd7 Add project skills for codex, close #241 2026-03-06 11:01:29 +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
JlovecandGitHub 55f08bd562 fix(cli): hide windows console windows for runner/claude subprocesses (#242) 2026-03-04 20:47:16 +08:00
weishu 5ceab49630 Release version 0.16.0 2026-03-03 10:36:22 +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
weishu 72a23fc761 build baseline variant for linux x64. 2026-03-02 13:11:06 +08:00
weishu 673e0c8aec refactor(cli): extract platform validation and error reporting from binary launcher
Refactor platform detection and error reporting logic into dedicated,
testable functions. This improves code organization and enables better
error handling for unsupported platforms and missing platform packages.

- Add SUPPORTED_PLATFORMS constant with platform labels
- Extract getPlatformKey() utility function
- Extract isSupportedPlatform() validation function
- Extract reportUnsupportedPlatform() error reporting function
- Extract reportMissingPlatformPackage() error reporting function
- Update main() to use new functions for clearer error handling
2026-03-02 11:58:08 +08:00
weishu 9c2bdfb1ae refactor(cli): extract platform validation and error reporting functions
Extract platform detection and error reporting logic into reusable functions
to improve testability and reduce code duplication in the binary launcher.
Adds comprehensive test coverage for platform validation and error messages.
2026-03-02 11:57:41 +08:00
weishu 2bdae8fe2d Release version 0.15.4 2026-03-01 11:05:36 +08:00
ElderDogeandGitHub 4ace791aa4 feat(cli): support subdirectory slash commands with colon-separated names (#227) 2026-02-28 01:44:50 +08:00
Mark LandGitHub 1f958f44fa fix(cli): report binary startup failures with actionable diagnostics (#220) 2026-02-27 09:01:24 +08:00
METOandGitHub acfc777d08 fix(cli): use getDefaultClaudeCodePath() in claudeRemote (#218)
Replace hardcoded 'claude' string with getDefaultClaudeCodePath() to
ensure the correct Claude Code executable path is resolved, consistent
with claudeLocal.ts. This respects HAPI_CLAUDE_PATH env var and finds
the global claude installation path properly.
2026-02-26 16:58:58 +08:00
weishu a74dcc9477 Release version 0.15.3 2026-02-25 17:38:32 +08:00
10f7e1404e fix(cli): harden ACP/Codex event handling (#211)
Co-authored-by: Lihengwannafly <Lihengwannafly@users.noreply.github.com>
2026-02-25 16:57:28 +08:00
weishu c8682047bf fix(cli): gemini hook settings schema (#173) 2026-02-14 15:46:34 +08:00
weishu eb8e749946 Release version 0.15.2 2026-02-11 10:25:00 +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
weishu fb9abc18d4 feat: Add directory tree tab to session files 2026-02-06 20:18:46 +08:00
weishu 674133d8c7 Release version 0.15.1 2026-02-03 13:37:13 +08:00
798317cd05 fix(windows): use absolute path with shell:false for Claude spawn (#143)
On Windows, spawning Claude with shell: true causes the process to
exit immediately with code 1. This happens because shell: true invokes
cmd.exe /c claude <args>, and cmd.exe's PATH resolution differs from
direct process creation, leading to environment inconsistencies.

This fix:
- Adds findWindowsClaudePath() to locate claude.exe absolute path
- Changes spawn to use absolute path with shell: false on Windows
- Maintains Unix behavior (command name works fine with shell: false)
- Adds HAPI_CLAUDE_PATH env var for user override

Tested on Windows 11 with Claude Code v2.1.29 and hapi v0.15.0.

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

Co-authored-by: HAPI <noreply@hapi.run>
2026-02-03 13:28:14 +08:00
weishu 2735421e3f remove unsupported builtin commands for codex 2026-02-02 12:25:15 +08:00
weishu c5190b4079 refactor: extract local launcher logic into shared BaseLocalLauncher class 2026-01-29 16:45:44 +08:00
weishu 19ba69c6e4 Release version 0.15.0 2026-01-29 10:57:02 +08:00
weishu 7e0b139d24 feat: add change_title MCP tool support to OpenCode 2026-01-29 10:53:15 +08:00
weishu 70b5c22c8f feat: support opencode 2026-01-29 10:34:57 +08:00
weishu dbc5cb9f5f Release version 0.14.0 2026-01-27 21:00:17 +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 b4bf3ca1e0 remove unused claude.md 2026-01-27 19:54:48 +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 10fe9f0cd9 Release version 0.13.0 2026-01-27 16:31:49 +08:00
weishu 1b22fe0f82 feat: add CLI-server protocol version mismatch detection
- Define PROTOCOL_VERSION constant in shared/src/version.ts
- Server sets X-Hapi-Protocol-Version header on /cli/* responses
- Server includes protocolVersion in /health endpoint
- CLI extracts serverProtocolVersion from API responses
- CLI shows version mismatch hints in both directions
- Add tests for error utilities and version extraction

close #104
2026-01-27 16:28:52 +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 b63089f3f9 fix test 2026-01-26 23:04:28 +08:00
weishu 83f07c199d feat: support codex collaboration_modes 2026-01-26 22:48:02 +08:00
weishu 3a1379dc01 feat: new codex remote mode 2026-01-26 22:22:32 +08:00
weishu 6acde5a9b9 Release version 0.12.1 2026-01-26 18:38:53 +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 e53abfb840 refactor: consolidate permission handler auto-approval logic into base class
Extract auto-approval decision resolution and common RPC handler registration into BasePermissionHandler to eliminate duplication across Claude, Codex, and Gemini implementations. Make handlePermissionResponse async throughout the hierarchy to properly support awaitable permission completions.
2026-01-23 16:04:37 +08:00
weishu c78ba1da1a refactor: consolidate hook settings generation into shared common module 2026-01-23 16:04:37 +08:00
weishu 6567f22978 refactor: remove passthrough() from zod schemas and make validation explicit
- Replace .passthrough() with explicit field definitions across all schemas
- Add missing optional fields (homeDir, happyHomeDir, happyLibDir, displayName)
- Refactor RawJSONLinesSchema to use structured base schema for clarity
- Improve schema validation strictness and type safety
- Update Machine interface to reflect explicit fields instead of index signature
2026-01-23 16:04:37 +08:00
weishu 6f8f44a314 refactor: move attachment metadata schema to shared protocol package 2026-01-23 16:04:37 +08:00
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