136
137
getPreConfirmActions(ref: ILanguageModelToolConfirmationRef): ILanguageModelToolConfirmationActions[] {
139
>
if (!pathInfo || !ref.chatSessionResource) {
140
return [];
141
}
143
>
// Parse the path to a URI
144
>
let pathUri: URI;
145
>
try {
146
>
pathUri = URI.file(pathInfo.path);
147
>
} catch {
148
return [];
149
}
151
>
// For directories, use the path itself; for files, use the parent directory
152
>
const folderUri = pathInfo.isDirectory ? pathUri : dirname(pathUri);
153
>
const sessionResource = ref.chatSessionResource;
154
>
155
>
const actions: ILanguageModelToolConfirmationActions[] = [
156
>
{
157
>
label: localize('allowFolderSession', 'Allow this folder in this session'),
158
>
detail: localize('allowFolderSessionDetail', 'Allow reading files from this folder without further confirmation in this chat session'),
159
>
select: async () => {
160
let folders = this._sessionFolderAllowlist.get(sessionResource);
161
if (!folders) {