fix(acp): finish prompt turn when extension/custom command is handled locally
Extension commands (e.g. /sonnet) and TypeScript custom commands that consume the input without calling the LLM return early from session.prompt() with no agent turn. In ACP mode this left the pending prompt promise unresolved, hanging the client forever. Change session.prompt() to return Promise<boolean>: true when the LLM was invoked, false when the command was fully handled locally. #runPromptOrCommand calls #finishPrompt immediately on a false return so the ACP turn completes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ describe("submitInteractiveInput", () => {
|
||||
checkShutdownRequested: vi.fn(async () => {}),
|
||||
};
|
||||
const session = {
|
||||
prompt: vi.fn(async () => {}),
|
||||
prompt: vi.fn(async () => true),
|
||||
promptCustomMessage: vi.fn(async () => {}),
|
||||
};
|
||||
const input = createInput({ text: "resume now", started: true, synthetic: true });
|
||||
@@ -42,7 +42,7 @@ describe("submitInteractiveInput", () => {
|
||||
checkShutdownRequested: vi.fn(async () => {}),
|
||||
};
|
||||
const session = {
|
||||
prompt: vi.fn(async () => {}),
|
||||
prompt: vi.fn(async () => true),
|
||||
promptCustomMessage: vi.fn(async () => {}),
|
||||
};
|
||||
const input = createInput();
|
||||
@@ -63,7 +63,7 @@ describe("submitInteractiveInput", () => {
|
||||
checkShutdownRequested: vi.fn(async () => {}),
|
||||
};
|
||||
const session = {
|
||||
prompt: vi.fn(async () => {}),
|
||||
prompt: vi.fn(async () => true),
|
||||
promptCustomMessage: vi.fn(async () => {}),
|
||||
};
|
||||
const input = createInput({ text: "continue goal", customType: "goal-continuation" });
|
||||
|
||||
Reference in New Issue
Block a user