fix: route file_permission scope by cmd (once=1, conversation=2)
This commit is contained in:
@@ -1987,11 +1987,16 @@ async function processResponseFile(filePath) {
|
||||
|| pending.source === 'dom_observer';
|
||||
pendingStepType = pending.step_type || '';
|
||||
pendingStepIndex = pending.step_index ?? lastPendingStepIndex;
|
||||
// Infer step_type from cmd if not explicitly set
|
||||
if (!pendingStepType && pending.command) {
|
||||
const cmd = (pending.command || '').toLowerCase();
|
||||
if (cmd.includes('allow once') || cmd.includes('allow this conversation')) {
|
||||
pendingStepType = 'file_permission';
|
||||
if (cmd.includes('allow this conversation')) {
|
||||
pendingStepType = 'file_permission_conversation';
|
||||
}
|
||||
else if (cmd.includes('allow once')) {
|
||||
pendingStepType = 'file_permission_once';
|
||||
}
|
||||
else if (cmd.includes('allow')) {
|
||||
pendingStepType = 'file_permission_once'; // default to once
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2311,8 +2316,10 @@ async function tryApprovalStrategies(approved, sessionId, stepType = '', stepInd
|
||||
interactionPayload = { runExtensionCode: { confirm: true } };
|
||||
}
|
||||
else if (typeLower.includes('file_permission')) {
|
||||
// FilePermissionInteraction: allow=true, scope=ONCE(1) or CONVERSATION(2)
|
||||
interactionPayload = { filePermission: { allow: true, scope: 1 } }; // PERMISSION_SCOPE_ONCE
|
||||
// FilePermissionInteraction: allow=true, scope depends on cmd
|
||||
// file_permission_once → 1, file_permission_conversation → 2
|
||||
const scope = typeLower.includes('conversation') ? 2 : 1;
|
||||
interactionPayload = { filePermission: { allow: true, scope } };
|
||||
}
|
||||
else if (typeLower.includes('elicitation')) {
|
||||
interactionPayload = { elicitation: {} }; // ElicitationInteraction (TBD)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user