Skip to content

Commit 44bf776

Browse files
committed
Merge feature/beta into autoMerge/feature/beta
2 parents d8c5c16 + a1a7619 commit 44bf776

File tree

4 files changed

+63
-15
lines changed

4 files changed

+63
-15
lines changed

chat-client/src/client/mynahUi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,7 @@ export const createMynahUi = (
14111411
? { 'insert-to-cursor': null }
14121412
: undefined,
14131413
...(shouldMute ? { muted: true } : {}),
1414+
modifiedFilesTracker: message.modifiedFilesTracker,
14141415
}
14151416
}
14161417

server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,11 @@ export class AgenticChatController implements ChatHandlers {
495495
const fileList = cachedToolUse.chatResult?.header?.fileList
496496
const button = cachedToolUse.chatResult?.header?.buttons?.filter(button => button.id !== BUTTON_UNDO_CHANGES)
497497

498+
const updatedModifiedFilesTracker = {
499+
...cachedToolUse.chatResult?.modifiedFilesTracker,
500+
removeFile: true,
501+
}
502+
498503
const updatedHeader = {
499504
...cachedToolUse.chatResult?.header,
500505
buttons: button,
@@ -531,6 +536,7 @@ export class AgenticChatController implements ChatHandlers {
531536
{
532537
...cachedToolUse.chatResult,
533538
header: updatedHeader,
539+
modifiedFilesTracker: updatedModifiedFilesTracker,
534540
},
535541
],
536542
},
@@ -2547,6 +2553,9 @@ export class AgenticChatController implements ChatHandlers {
25472553
keepCardAfterClick: false,
25482554
},
25492555
],
2556+
modifiedFilesTracker: {
2557+
title: 'Following files were modified : ',
2558+
},
25502559
})
25512560
session.currentUndoAllId = undefined
25522561
}
@@ -3197,6 +3206,9 @@ export class AgenticChatController implements ChatHandlers {
31973206
},
31983207
buttons: [{ id: BUTTON_UNDO_CHANGES, text: 'Undo', icon: 'undo' }],
31993208
},
3209+
modifiedFilesTracker: {
3210+
title: 'Following files were modified : ',
3211+
},
32003212
}
32013213
}
32023214

server/aws-lsp-codewhisperer/src/language-server/localProjectContext/localProjectContextServer.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,14 @@ export const LocalProjectContextServer =
166166
try {
167167
localProjectContextEnabled = updatedConfig.projectContext?.enableLocalIndexing === true
168168
if (process.env.DISABLE_INDEXING_LIBRARY === 'true') {
169-
logging.log('Skipping local project context initialization')
169+
logging.log('Skipping local project context initialization due to DISABLE_INDEXING_LIBRARY=true')
170170
localProjectContextEnabled = false
171+
// Ensure instance is set even when disabled
172+
LocalProjectContextController.createFallbackInstance(
173+
'vscode',
174+
workspace.getAllWorkspaceFolders() || [],
175+
logging
176+
)
171177
} else {
172178
logging.log(
173179
`Setting project context indexing enabled to ${updatedConfig.projectContext?.enableLocalIndexing}`
@@ -183,7 +189,13 @@ export const LocalProjectContextServer =
183189
})
184190
}
185191
} catch (error) {
186-
logging.error(`Error handling configuration change: ${error}`)
192+
logging.error(`Error handling configuration change: ${error}. Creating fallback instance.`)
193+
// Create fallback instance if initialization fails
194+
LocalProjectContextController.createFallbackInstance(
195+
'vscode',
196+
workspace.getAllWorkspaceFolders() || [],
197+
logging
198+
)
187199
}
188200
}
189201

server/aws-lsp-codewhisperer/src/shared/localProjectContextController.ts

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,19 @@ export class LocalProjectContextController {
101101
}
102102
}
103103

104+
public static createFallbackInstance(
105+
clientName: string,
106+
workspaceFolders: WorkspaceFolder[],
107+
logging: Logging
108+
): LocalProjectContextController {
109+
if (!this.instance) {
110+
const fallbackInstance = new LocalProjectContextController(clientName, workspaceFolders, logging)
111+
this.instance = fallbackInstance
112+
logging.warn('Created fallback LocalProjectContextController instance without vector library')
113+
}
114+
return this.instance
115+
}
116+
104117
public async init({
105118
vectorLib,
106119
ignoreFilePatterns = [],
@@ -159,22 +172,32 @@ export class LocalProjectContextController {
159172

160173
// initialize vecLib and index if needed
161174
const libraryPath = this.getVectorLibraryPath()
162-
const vecLib = vectorLib ?? (await eval(`import("${libraryPath}")`))
163-
if (vecLib) {
164-
this._vecLib = await vecLib.start(LIBRARY_DIR, this.clientName, this.indexCacheDirPath)
165-
if (enableIndexing) {
166-
this.buildIndex('all').catch(e => {
167-
this.log.error(`Error building index on init with indexing enabled: ${e}`)
168-
})
175+
try {
176+
const vecLib = vectorLib ?? (await eval(`import("${libraryPath}")`))
177+
if (vecLib) {
178+
this._vecLib = await vecLib.start(LIBRARY_DIR, this.clientName, this.indexCacheDirPath)
179+
if (enableIndexing) {
180+
this.buildIndex('all').catch(e => {
181+
this.log.error(`Error building index on init with indexing enabled: ${e}`)
182+
})
183+
} else {
184+
this.buildIndex('default').catch(e => {
185+
this.log.error(`Error building index on init with indexing disabled: ${e}`)
186+
})
187+
}
188+
this._isIndexingEnabled = enableIndexing
169189
} else {
170-
this.buildIndex('default').catch(e => {
171-
this.log.error(`Error building index on init with indexing disabled: ${e}`)
172-
})
190+
this.log.warn(`Vector library could not be imported from: ${libraryPath}`)
173191
}
192+
} catch (importError) {
193+
this.log.warn(
194+
`Failed to import vector library from ${libraryPath}: ${importError}. Local indexing will be disabled.`
195+
)
196+
}
197+
198+
// Always set the instance, even if vector library failed to load
199+
if (!LocalProjectContextController.instance) {
174200
LocalProjectContextController.instance = this
175-
this._isIndexingEnabled = enableIndexing
176-
} else {
177-
this.log.warn(`Vector library could not be imported from: ${libraryPath}`)
178201
}
179202
} catch (error) {
180203
this.log.error('Vector library failed to initialize:' + error)

0 commit comments

Comments
 (0)