feat: add Cursor as a first-class HAPI agent option#3
feat: add Cursor as a first-class HAPI agent option#3gaius-codius wants to merge 3 commits intopr/session-sort-backend-upstreamfrom
Conversation
Expose Cursor across shared/hub/web agent selection and implement a dedicated `hapi cursor` runtime so sessions can be spawned, resumed, and displayed consistently like other supported agents.
PR #3 Review: "feat: add Cursor as a first-class HAPI agent option"Summary: This PR adds Cursor as a supported agent across all layers (shared types, CLI backend, hub routing, web UI) — 478 additions, 24 deletions across 32 files. The architecture follows established patterns from codex/gemini/opencode agent integrations. The core addition is Blocking1. if (this.options.forceWrites !== false) { // undefined !== false → true
args.push('--force');
}When the user doesn't pass 2. Tool call ID correlation broken when const callId = toText(event.call_id) ?? randomUUID();A new 3. No tests for Zero test coverage for a substantial new module with 5 pure functions ( Should-Fix4. Arrays pass 5. Misleading indentation in ternary chains The cursor branch insertions break the progressive nesting pattern, making the else-branches appear to belong to the wrong condition. Cosmetic but actively misleading for future maintainers. 6. Cursor-specific logic hardcoded in generic
7. The handler is saved to a field with a 8. All other agent commands parse and forward 9. Semicolons inconsistency in Uses semicolons while all sibling command files ( 10. Gemini omitted from Local Mode docs Lists "Claude Code, Codex, OpenCode, or Cursor" but omits Gemini, which is supported elsewhere in the same file. 11. Missing test case for The Nit12. Duplicated process-killing logic — 13. 14. 15. CSS variable 16. Closure references Verdict: Request ChangesThe PR is well-structured and follows existing agent integration patterns, but has 3 blocking issues that should be resolved before merging:
The should-fix items (especially tiann#4 |
PR #3 Review — Revised After Validation
Summary: This PR adds Cursor as a supported agent across all layers (shared types, CLI backend, hub routing, web UI) — 478 additions, 24 deletions across 32 files. The architecture follows established patterns from codex/gemini/opencode agent integrations. The core addition is No Blocking IssuesThe three original blocking findings were all resolved:
Should-Fix1. Misleading indentation in ternary chains Both files have genuinely misleading indentation where the cursor branch insertion breaks the progressive nesting pattern. In 2. Unsafe type assertion in const maybeSessionIdProvider = backend as { getActiveSessionId?: () => string | null };
3. Semicolons inconsistency in Uses semicolons throughout, while all sibling command files ( 4. Gemini omitted from Local Mode docs Lists "Claude Code, Codex, OpenCode, or Cursor" but omits Gemini, which has full local mode support and is referenced elsewhere in the same file. Nit5. 6. 7. 8. 9. Duplicated process-killing logic — 10. 11. Missing Verdict: Approve (with minor suggestions)The PR is well-structured, follows established patterns, and has no blocking issues. The |
Improve maintainability and correctness by removing unsafe casts and dead options, clarifying Cursor-specific CLI behavior, and simplifying branch-specific selection logic in runner/resume paths.
Allow the agent radio list to wrap on narrow screens so all options, including Cursor, remain visible in the WebUI session creation form.
Summary
cursoras a supported agent flavor across shared, hub, web, and CLI unions/schemas so it can be selected, spawned, and resumed consistentlyhapi cursorwith a dedicated Cursor CLI backend that runsagentin stream-json mode and maps its output into HAPI session eventsTest plan
bun run typecheckcd web && bunx vitest run "src/components/NewSession/preferences.test.ts" "src/components/SessionList.test.tsx"hapi cursorin a real environment with Cursor CLI installed