Skip to content

Commit bf40214

Browse files
fix(cli): tighten ACP host input handling
1 parent 13a44cf commit bf40214

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

packages/cli/src/acp/acpClient.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
partListUnionToString,
3636
LlmRole,
3737
ApprovalMode,
38+
checkExhaustive,
3839
getVersion,
3940
convertSessionToClientHistory,
4041
DEFAULT_GEMINI_MODEL,
@@ -1080,7 +1081,7 @@ export class Session {
10801081

10811082
await confirmationDetails.onConfirm(
10821083
ToolConfirmationOutcome.ProceedOnce,
1083-
mapExitPlanModeAnswers(output.answers ?? {}),
1084+
mapExitPlanModeAnswers(output.answers),
10841085
);
10851086
return ToolConfirmationOutcome.ProceedOnce;
10861087
}
@@ -2066,11 +2067,11 @@ function toPermissionOptions(
20662067
break;
20672068
case 'ask_user':
20682069
case 'exit_plan_mode':
2070+
case 'sandbox_expansion':
20692071
// askuser and exit_plan_mode don't need "always allow" options
20702072
break;
20712073
default:
2072-
// No "always allow" options for other types.
2073-
break;
2074+
return checkExhaustive(confirmation);
20742075
}
20752076
}
20762077

@@ -2087,18 +2088,12 @@ function toPermissionOptions(
20872088
case 'sandbox_expansion':
20882089
break;
20892090
default:
2090-
return assertUnreachableConfirmation(confirmation);
2091+
return checkExhaustive(confirmation);
20912092
}
20922093

20932094
return options;
20942095
}
20952096

2096-
function assertUnreachableConfirmation(value: never): never {
2097-
throw new Error(
2098-
`Unhandled tool confirmation details: ${JSON.stringify(value)}`,
2099-
);
2100-
}
2101-
21022097
/**
21032098
* Maps our internal tool kind to the ACP ToolKind.
21042099
* Fallback to 'other' for kinds that are not supported by the ACP protocol.

packages/cli/src/acp/hostInput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export interface HostInputRequest {
5454
toolCall?: {
5555
toolCallId: string;
5656
title: string;
57-
locations?: unknown[];
57+
locations?: acp.ToolCallLocation[];
5858
kind: acp.ToolKind;
5959
};
6060
_meta?: Record<string, unknown>;

0 commit comments

Comments
 (0)