feat(cursor): multitask slash, autoReview mode, native worktree/add-dir (#1014)

* feat(cursor): multitask slash, autoReview mode, native worktree/add-dir

Close the highest-value Cursor Agent gaps for remote HAPI: expand ACP-safe
slash pass-through (/multitask, worktree, add-dir, …), add autoReview
permission mode (--auto-review spawn + mid-session slash), and route Cursor
New Session worktrees through agent --worktree instead of HAPI sibling trees.

Fixes #1013

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): accept --mode autoReview for hapi cursor

Align --mode parsing with CURSOR_PERMISSION_MODES so documented
`hapi cursor --mode autoReview` enables Smart Auto instead of silently
falling back to default.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
SSU-WEI HUANG
2026-07-12 18:41:52 +08:00
committed by GitHub
co-authored by Cursor
parent b104c38f3a
commit 73584e925a
24 changed files with 630 additions and 143 deletions
+9 -3
View File
@@ -75,6 +75,7 @@ function buildAgentArgs(opts: {
mode?: string;
model?: string;
yolo?: boolean;
autoReview?: boolean;
}): string[] {
const args = ['-p', opts.message, '--output-format', 'stream-json', '--trust', '--workspace', opts.cwd];
@@ -90,15 +91,19 @@ function buildAgentArgs(opts: {
if (opts.yolo) {
args.push('--yolo');
}
if (opts.autoReview) {
args.push('--auto-review');
}
return args;
}
function permissionModeToAgentArgs(mode?: string): { mode?: string; yolo?: boolean } {
function permissionModeToAgentArgs(mode?: string): { mode?: string; yolo?: boolean; autoReview?: boolean } {
if (mode === 'plan') return { mode: 'plan' };
if (mode === 'ask') return { mode: 'ask' };
if (mode === 'debug') return { mode: 'debug' };
if (mode === 'yolo') return { yolo: true };
if (mode === 'autoReview') return { autoReview: true };
return {};
}
@@ -155,7 +160,7 @@ class CursorRemoteLauncher extends RemoteLauncherBase {
const { message, mode, isolate: batchIsolated } = batch;
const specialCommand = parseCursorSpecialCommand(message);
const { mode: agentMode, yolo } = permissionModeToAgentArgs(mode.permissionMode as string);
const { mode: agentMode, yolo, autoReview } = permissionModeToAgentArgs(mode.permissionMode as string);
this.applyDisplayMode(mode.permissionMode as string);
messageBuffer.addMessage(message, 'user');
@@ -170,7 +175,8 @@ class CursorRemoteLauncher extends RemoteLauncherBase {
sessionId: cursorSessionId,
mode: agentMode,
model: mode.model,
yolo
yolo,
autoReview
});
logger.debug(`[cursor-remote] Spawning agent with args: ${args.join(' ')}`);