fix: align headless interactive tool behavior with bidirectional parity (#894)
This commit is contained in:
24
src/tools/interactivePolicy.ts
Normal file
24
src/tools/interactivePolicy.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// Interactive tool capability policy shared across UI/headless/SDK-compatible paths.
|
||||
// This avoids scattering name-based checks throughout approval handling.
|
||||
|
||||
const INTERACTIVE_APPROVAL_TOOLS = new Set([
|
||||
"AskUserQuestion",
|
||||
"EnterPlanMode",
|
||||
"ExitPlanMode",
|
||||
]);
|
||||
|
||||
const RUNTIME_USER_INPUT_TOOLS = new Set(["AskUserQuestion", "ExitPlanMode"]);
|
||||
|
||||
const HEADLESS_AUTO_ALLOW_TOOLS = new Set(["EnterPlanMode"]);
|
||||
|
||||
export function isInteractiveApprovalTool(toolName: string): boolean {
|
||||
return INTERACTIVE_APPROVAL_TOOLS.has(toolName);
|
||||
}
|
||||
|
||||
export function requiresRuntimeUserInput(toolName: string): boolean {
|
||||
return RUNTIME_USER_INPUT_TOOLS.has(toolName);
|
||||
}
|
||||
|
||||
export function isHeadlessAutoAllowTool(toolName: string): boolean {
|
||||
return HEADLESS_AUTO_ALLOW_TOOLS.has(toolName);
|
||||
}
|
||||
Reference in New Issue
Block a user