File tree Expand file tree Collapse file tree
components/action-selector
features/sessions/components
packages/agent/src/adapters/claude/permissions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import type { PermissionOption } from "@agentclientprotocol/sdk" ;
2+
13export const OTHER_OPTION_ID = "_other" ;
24export const OTHER_OPTION_ID_ALT = "other" ;
35export const SUBMIT_OPTION_ID = "_submit" ;
46export const CANCEL_OPTION_ID = "cancel" ;
57export const OPTION_ID_PREFIX = "option_" ;
8+ export const REJECT_OPTION_ID = "reject" ;
9+
10+ export function isRejectWithInstructionOption (
11+ permissionOption : PermissionOption ,
12+ ) : boolean {
13+ return (
14+ permissionOption . optionId === REJECT_OPTION_ID &&
15+ permissionOption . _meta ?. customInput === true
16+ ) ;
17+ }
618
719export function isOtherOption ( optionId : string ) : boolean {
820 return optionId === OTHER_OPTION_ID || optionId === OTHER_OPTION_ID_ALT ;
Original file line number Diff line number Diff line change 1- import { isOtherOption } from "@components/action-selector/constants" ;
1+ import {
2+ isOtherOption ,
3+ isRejectWithInstructionOption ,
4+ } from "@components/action-selector/constants" ;
25import { PermissionSelector } from "@components/permissions/PermissionSelector" ;
36import {
47 MessageEditor ,
@@ -252,7 +255,10 @@ export function SessionView({
252255 }
253256
254257 if ( customInput ) {
255- if ( isOtherOption ( optionId ) ) {
258+ if (
259+ isOtherOption ( optionId ) ||
260+ ( selectedOption && isRejectWithInstructionOption ( selectedOption ) )
261+ ) {
256262 await getSessionService ( ) . respondToPermission (
257263 taskId ,
258264 firstPendingPermission . toolCallId ,
Original file line number Diff line number Diff line change @@ -388,12 +388,14 @@ async function handleDefaultPermissionFlow(
388388 updatedInput : toolInput as Record < string , unknown > ,
389389 } ;
390390 } else {
391- const message = "User refused permission to run tool" ;
391+ const feedback = (
392+ response . _meta ?. customInput as string | undefined
393+ ) ?. trim ( ) ;
394+ const message = feedback
395+ ? `User refused permission to run tool with feedback: ${ feedback } `
396+ : "User refused permission to run tool" ;
392397 await emitToolDenial ( context , message ) ;
393- return {
394- behavior : "deny" ,
395- message,
396- } ;
398+ return { behavior : "deny" , message, interrupt : ! feedback } ;
397399 }
398400}
399401
You can’t perform that action at this time.
0 commit comments