Commit Graph
264 Commits
Author SHA1 Message Date
c02f392d81 fix(cli): correct Homebrew formula URL for Linux x64 baseline build (#408)
The release workflow produces `hapi-linux-x64-baseline.tar.gz` (from
bun-linux-x64-baseline target), but the Homebrew formula generator wrote
the URL as `hapi-linux-x64.tar.gz`, causing `brew install` to fail on
Linux x64 with a 404.

Closes #365

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

Co-authored-by: HAPI <noreply@hapi.run>
2026-04-06 20:41:41 +08:00
Junmo KimandGitHub 00ba610ab0 feat: display rate limit warnings instead of raw JSON (#388)
* refactor(web): extract normalizeTimestamp helper in presentation

Extract the shared seconds-vs-milliseconds normalization logic into
a private `normalizeTimestamp()` helper. No behavior change —
`formatUnixTimestamp()` produces identical output.

* refactor(web): return AgentEvent from parseClaudeUsageLimit

Change return type from `number | null` to `AgentEvent | null` so
the caller doesn't need to construct the event object. No behavior
change — the same `limit-reached` event is produced.

* feat(cli): convert rate_limit_event to standardized text format

Parse undocumented Claude `rate_limit_event` JSON in the CLI adapter
layer (AcpMessageHandler) before it reaches the web.

Converted text format (pipe-delimited):
  - "Claude AI usage limit warning|{ts}|{pct}|{rateLimitType}"
  - "Claude AI usage limit reached|{ts}|{rateLimitType}"

Status handling:
  - `allowed_warning` → warning text with utilization and limit type
  - `rejected` → reached text with limit type
  - `allowed` → silently suppressed (noise)
  - unknown statuses → passed through as-is (forward-compatible)

* feat(web): display rate limit warnings with limit type

Parse standardized pipe-delimited text from the CLI adapter into
`limit-warning` and `limit-reached` events, displaying the rate
limit type (5-hour, 7-day) when available.

- `limit-warning`: "⚠️ Usage limit 90% (5-hour) · resets 2:00 PM"
- `limit-reached`: " Usage limit reached (5-hour) until 4/2/2026"
- Backward compatible: `limit-reached` without limitType still works

The `reached` regex uses `(?:\|([^|]*))?$` to optionally match the
limitType field, maintaining compatibility with the existing format.

* refactor(cli): move rate limit parsing out of flushText

Remove rate limit detection from flushText() back to plain buffer
flush. The next commit will re-add parsing at the chunk level
(handleUpdate) where it can intercept before buffer merging.

Includes failing tests that demonstrate the mixed-chunk bug:
when a rate_limit_event chunk arrives in the same turn as normal
text, the JSON leaks into the merged buffer.

* fix(cli): intercept rate_limit_event at chunk level, not flush

Move rate limit detection from flushText() to the agentMessageChunk
handler so it fires before the chunk enters the shared text buffer.

Previously, a rate_limit_event chunk arriving in the same turn as
normal text would merge into bufferedText and leak as raw JSON.
Now the chunk is intercepted individually, the existing buffer is
flushed first (preserving prior text), and the converted message
is emitted separately.

* fix(cli): skip flush when suppressing allowed rate_limit_event

Only flush the text buffer when the parsed event will actually be
displayed. Suppressed events (e.g. status: 'allowed') now return
immediately without flushing, preventing a text → allowed → text
sequence from splitting one answer into two agent-text blocks.

* fix(web): include limitType in limit-reached reconcile key

Without this, reprocessing a message from the old format (no
limitType) to the new typed format reuses the stale block and
the (5-hour)/(7-day) suffix never appears.
2026-04-03 08:25:22 +08:00
Junmo KimandGitHub 4eb88c5d7e feat(gemini): support mid-session model change (#379) 2026-04-01 11:15:11 +08:00
weishu fa0ce1ca94 Release version 0.16.5 2026-03-31 18:53:38 +08:00
weishu 4248540fb4 auto approve in yolo mode for codex 2026-03-31 18:51:34 +08:00
weishu ca7cb9ac90 auto approve title tool for codex 2026-03-31 18:36:31 +08:00
Junmo KimandGitHub 3a073dc4a9 fix(gemini): wire --resume flag through to Gemini backend (#378) 2026-03-31 10:46:21 +08:00
Wong ChihungandGitHub 1f67d36c06 feat(models): support new gemini models and codex gpt-5.4-mini (#376) 2026-03-29 21:33:33 +08:00
xyzhang626andGitHub 63337873c3 fix(claude): handle async background task notifications in remote mode (#354) 2026-03-26 08:07:06 +08:00
Haoqing WangandGitHub 279f75815e fix(cli): prevent system-injected messages from appearing as user role (#361) 2026-03-26 08:06:30 +08:00
Haoqing WangandGitHub 6384697b03 fix(cli): filter isMeta and isCompactSummary messages in local and remote mode (#359) 2026-03-25 05:36:41 +08:00
a200fe9628 feat(claude): add effort setting parity with model across stack (#353)
Co-authored-by: Xiaoyi <xiaoyizhang@microsoft.com>
2026-03-24 21:15:48 +08:00
Haoqing WangandGitHub 30265fdc25 fix(cli): filter invisible system messages in local mode (#351) 2026-03-24 19:21:17 +08:00
weishu 7da6f7c5c5 Release version 0.16.4 2026-03-24 13:04:42 +08:00
weishu 304789620b Fix reason effort setting not working. close #346, close #333 2026-03-24 12:04:52 +08:00
Haoqing WangandGitHub b802092bf7 fix(cli): treat any exit code as expected when abort was requested (#347) 2026-03-24 02:41:13 +08:00
Haoqing WangandGitHub 8eea49f9da fix(cli): fix process exit handling deadlock and error masking in Claude SDK (#343) 2026-03-23 14:56:45 +08:00
lifu963andGitHub 895654ddf6 fix(terminal): prevent infinite reconnect loop on Windows hosts (#336) 2026-03-21 21:45:40 +08:00
pppobearandGitHub ae39fc5e77 Fix Codex default approval policy for remote sessions (#328) 2026-03-20 18:45:18 +08:00
weishu a02f908dc5 fix test 2026-03-20 13:19:10 +08:00
weishu 32f05d99a0 Release version 0.16.3 2026-03-20 12:17:35 +08:00
Junmo KimandGitHub d76b1a6ac0 refactor: introduce model-agnostic agent interfaces (#323) 2026-03-20 08:45:32 +08:00
ROOOOandGitHub 397ef35f5c fix(cli): preserve requested cwd for runner-spawned sessions (#315) 2026-03-19 15:15:41 +08:00
ROOOOandGitHub 987010f447 fix(codex): pass session cwd to app-server (#316) 2026-03-19 15:12:11 +08:00
ROOOOandGitHub f967bd9928 fix(runner): restart when hub identity changes (#303)
* fix(runner): restart when hub identity changes

* fix(runner): fail closed on missing identity
2026-03-18 10:43:36 +08:00
2ecd56dbe8 fix(gemini): notify hub when session is aborted (#307) (#308)
Co-authored-by: Junmo Kim <me@junmo.kim>
2026-03-18 08:12:57 +08:00
ROOOOandGitHub a30bb398e1 fix(codex): keep local session timeout non-fatal (#304) 2026-03-18 07:27:23 +08:00
ROOOOandGitHub f24ea4fea8 fix(codex): improve reused session adoption (#305) 2026-03-18 07:26:58 +08:00
ROOOOandGitHub 9c043b42da fix(cli): load configured API URL in auth status (#306) 2026-03-18 07:26:21 +08:00
ROOOOandGitHub cb09f0b898 feat: add codex reasoning effort option (#297) 2026-03-17 22:55:55 +08:00
ROOOOandGitHub caa76826f4 fix(cli): preserve invoked cwd for local launcher (#299) 2026-03-17 22:55:23 +08:00
weishu 34f931ef59 remove codex mcp backend 2026-03-16 21:50:09 +08:00
weishu 16829b7c78 Add support for codex plan mode 2026-03-16 20:48:39 +08:00
weishu 329d28a93c remove , using instead 2026-03-16 18:29:09 +08:00
weishu 02c8e12e80 unify model selection 2026-03-16 18:29:09 +08:00
weishu 1f02bb7de1 Fix codex approve policy 2026-03-16 13:00:09 +08:00
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