diff --git a/src/vs/workbench/contrib/void/browser/chatThreadService.ts b/src/vs/workbench/contrib/void/browser/chatThreadService.ts index cace66d1..9d4326bf 100644 --- a/src/vs/workbench/contrib/void/browser/chatThreadService.ts +++ b/src/vs/workbench/contrib/void/browser/chatThreadService.ts @@ -428,9 +428,14 @@ class ChatThreadService extends Disposable implements IChatThreadService { // 1. validate tool params let toolParams: ToolCallParams[typeof toolName] try { + console.log('A') + const params = await this._toolsService.validateParams[toolName](tool.paramsStr) + console.log('B') + toolParams = params } catch (error) { + console.log('ERR1') const errorMessage = getErrorMessage(error) this._addMessageToThread(threadId, { role: 'tool', name: toolName, paramsStr: tool.paramsStr, id: tool.id, content: errorMessage, result: { type: 'error', value: errorMessage }, }) res_() @@ -439,14 +444,22 @@ class ChatThreadService extends Disposable implements IChatThreadService { // 2. if tool requires approval, await the approval if (toolNamesThatRequireApproval.has(toolName)) { + console.log('C') + const voidToolId = generateUuid() + console.log('D') const toolApprovalPromise = new Promise((res, rej) => { this.resRejOfToolAwaitingApproval[voidToolId] = { res, rej } }) + console.log('E') this._addMessageToThread(threadId, { role: 'tool_request', name: toolName, params: toolParams, voidToolId: voidToolId }) try { + console.log('F') + await toolApprovalPromise // accepted tool } catch (e) { + console.log('ERR2') + const errorMessage = 'Tool call was rejected by the user.' this._addMessageToThread(threadId, { role: 'tool', name: toolName, paramsStr: tool.paramsStr, id: tool.id, content: errorMessage, result: { type: 'error', value: errorMessage }, }) res_() @@ -457,8 +470,10 @@ class ChatThreadService extends Disposable implements IChatThreadService { // 3. call the tool let toolResult: ToolResultType[typeof toolName] try { + console.log('G') toolResult = await this._toolsService.callTool[toolName](toolParams as any) // typescript is so bad it doesn't even couple the type of ToolResult with the type of the function being called here } catch (error) { + console.log('ERR3') const errorMessage = getErrorMessage(error) this._addMessageToThread(threadId, { role: 'tool', name: toolName, paramsStr: tool.paramsStr, id: tool.id, content: errorMessage, result: { type: 'error', value: errorMessage }, }) res_() @@ -468,7 +483,11 @@ class ChatThreadService extends Disposable implements IChatThreadService { // 4. stringify the result to give the LLM let toolResultStr: string try { - toolResultStr = await this._toolsService.stringOfResult[toolName](toolParams as any, toolResult as any) + + console.log('H') + toolResultStr = this._toolsService.stringOfResult[toolName](toolParams as any, toolResult as any) + // if (Math.random() > 0) throw new Error('This is not an allowed repo.') + } catch (error) { const errorMessage = `Tool call succeeded, but there was an error stringifying the output.\n${getErrorMessage(error)}` this._addMessageToThread(threadId, { role: 'tool', name: toolName, paramsStr: tool.paramsStr, id: tool.id, content: errorMessage, result: { type: 'error', value: errorMessage }, }) @@ -476,6 +495,8 @@ class ChatThreadService extends Disposable implements IChatThreadService { return } + console.log('I') + // 5. add to history this._addMessageToThread(threadId, { role: 'tool', name: toolName, paramsStr: tool.paramsStr, id: tool.id, content: toolResultStr, result: { type: 'success', params: toolParams, value: toolResult }, }) res_() @@ -492,7 +513,9 @@ class ChatThreadService extends Disposable implements IChatThreadService { if (llmCancelToken === null) break this._setStreamState(threadId, { streamingToken: llmCancelToken }) + console.log('awaiting agentloop') await awaitable + console.log('done') } } diff --git a/src/vs/workbench/contrib/void/browser/editCodeService.ts b/src/vs/workbench/contrib/void/browser/editCodeService.ts index e6ab1854..2424f218 100644 --- a/src/vs/workbench/contrib/void/browser/editCodeService.ts +++ b/src/vs/workbench/contrib/void/browser/editCodeService.ts @@ -1636,8 +1636,7 @@ class EditCodeService extends Disposable implements IEditCodeService { latestStreamLocationMutable = null shouldUpdateOrigStreamStyle = true oldBlocks = [] - addedTrackingZoneOfBlockNum.slice(0, Infinity) // clear the array - console.log('SHOULD BE EMPTY', addedTrackingZoneOfBlockNum) + addedTrackingZoneOfBlockNum.splice(0, Infinity) // clear the array shouldSendAnotherMessage = true this._refreshStylesAndDiffsInURI(uri) diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index 10a72b73..6dab5ce1 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -1008,12 +1008,12 @@ const ToolError = ({ title, errorMessage }: { title: string, errorMessage: strin const toolNameToTitle: Record = { 'read_file': 'Read file', - 'list_dir': 'Inspected folder', - 'pathname_search': 'Searched filename', - 'search': 'Searched', - 'create_uri': 'Created file', - 'delete_uri': 'Deleted file', - 'edit': 'Edited file', + 'list_dir': 'Inspect folder', + 'pathname_search': 'Search (path only)', + 'search': 'Search (file contents)', + 'create_uri': 'Create file', + 'delete_uri': 'Delete file', + 'edit': 'Edit file', 'terminal_command': 'Ran terminal command' } @@ -1292,7 +1292,8 @@ const ChatBubble = ({ chatMessage, isLoading, messageIdx }: ChatBubbleProps) => /> } else if (role === 'tool_request') { - if (!isLoading) return null + const isLastMessage = true // TODO!!! fix this + if (!isLastMessage) return null const ToolMessageComponent = toolNameToComponent[chatMessage.name].requestWrapper as React.FC<{ toolRequest: any }> // ts isnt smart enough... return <> { return previousMessages.map((message, i) => ) - }, [previousMessages]) + }, [previousMessages, currentThread]) + const streamingChatIdx = pastMessagesHTML.length diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx index 80082d77..9a380878 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx @@ -459,7 +459,7 @@ export const FeaturesTab = () => {

{displayInfoOfFeatureName('Apply')}

-
We recommend the smartest model you{`'`}ve got, like Claude 3.7 or Grok 3.
+
We recommend the smartest model you{`'`}ve got, like Claude 3.7 or GPT 4o.
diff --git a/src/vs/workbench/contrib/void/browser/toolsService.ts b/src/vs/workbench/contrib/void/browser/toolsService.ts index fd93c5b2..40c55dbd 100644 --- a/src/vs/workbench/contrib/void/browser/toolsService.ts +++ b/src/vs/workbench/contrib/void/browser/toolsService.ts @@ -316,8 +316,6 @@ export class ToolsService implements IToolsService { this.validateParams = { read_file: async (params: string) => { - console.log('read_file') - const o = validateJSON(params) const { uri: uriStr, pageNumber: pageNumberUnknown } = o @@ -372,12 +370,12 @@ export class ToolsService implements IToolsService { }, edit: async (params: string) => { + console.log('validating edit!!!') const o = validateJSON(params) const { uri: uriStr, changeDescription: changeDescriptionUnknown } = o const uri = validateURI(uriStr) const changeDescription = validateStr('changeDescription', changeDescriptionUnknown) - return { uri, changeDescription } },