diff --git a/src/vs/workbench/contrib/void/browser/editCodeService.ts b/src/vs/workbench/contrib/void/browser/editCodeService.ts
index b3e59526..e6ab1854 100644
--- a/src/vs/workbench/contrib/void/browser/editCodeService.ts
+++ b/src/vs/workbench/contrib/void/browser/editCodeService.ts
@@ -1606,6 +1606,7 @@ class EditCodeService extends Disposable implements IEditCodeService {
// if this is the first time we're seeing this block, add it as a diffarea so we can start streaming
if (!(blockNum in addedTrackingZoneOfBlockNum)) {
+ console.log('finding text in code...', { orig: block.orig })
const originalBounds = findTextInCode(block.orig, originalFileCode)
// if error
@@ -1616,7 +1617,6 @@ class EditCodeService extends Disposable implements IEditCodeService {
{ role: 'user', content: content } // user explanation of what's wrong
)
- console.log('RETRYING!!!!!!!!!!', content, JSON.stringify(messages, null, 2))
if (streamRequestIdRef.current) this._llmMessageService.abort(streamRequestIdRef.current)
// REVERT
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 3407d868..10a72b73 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
@@ -23,13 +23,13 @@ import { SidebarThreadSelector } from './SidebarThreadSelector.js';
import { useScrollbarStyles } from '../util/useScrollbarStyles.js';
import { VOID_CTRL_L_ACTION_ID } from '../../../actionIDs.js';
import { VOID_OPEN_SETTINGS_ACTION_ID } from '../../../voidSettingsPane.js';
-import { ChevronRight, Pencil, X, AlertTriangle } from 'lucide-react';
import { FeatureName, isFeatureNameDisabled } from '../../../../../../../workbench/contrib/void/common/voidSettingsTypes.js';
import { WarningBox } from '../void-settings-tsx/WarningBox.js';
-import { ChatMessage, StagingSelectionItem, ToolMessage } from '../../../chatThreadService.js';
+import { ChatMessage, StagingSelectionItem, ToolMessage, ToolRequestApproval } from '../../../chatThreadService.js';
import { filenameToVscodeLanguage } from '../../../../common/helpers/detectLanguage.js';
import { ToolName } from '../../../toolsService.js';
import { getModelSelectionState, getModelCapabilities } from '../../../../common/modelCapabilities.js';
+import { AlertTriangle, ChevronRight, Dot, Pencil, X } from 'lucide-react';
@@ -249,7 +249,7 @@ const ReasoningOptionDropdown = () => {
step={stepSize}
value={value}
onChange={(newVal) => {
- console.log('NEWVAL',newVal)
+ console.log('NEWVAL', newVal)
const disabled = newVal === min && canToggleReasoning
voidSettingsService.setOptionsOfModelSelection(modelSelection.providerName, modelSelection.modelName, { reasoningEnabled: !disabled, reasoningBudget: newVal })
}}
@@ -665,6 +665,7 @@ interface DropdownComponentProps {
numResults?: number;
children?: React.ReactNode;
onClick?: () => void;
+ icon?: React.ReactNode;
}
const DropdownComponent = ({
@@ -674,6 +675,7 @@ const DropdownComponent = ({
numResults,
children,
onClick,
+ icon,
}: DropdownComponentProps) => {
const [isExpanded, setIsExpanded] = useState(false);
@@ -696,6 +698,7 @@ const DropdownComponent = ({
/>
)}
+ {icon}
{title}
{desc1}
{desc2 &&
@@ -935,10 +938,11 @@ const AssistantMessageComponent = ({ chatMessage, isLoading, messageIdx }: ChatB
return <>
- {/* reasoning token (anthropic) */}
+ {/* reasoning token */}
{hasReasoning && }
>
= {
+const ToolRequestAcceptRejectButtons = ({ toolRequest }: { toolRequest: ToolRequestApproval }) => {
+ const accessor = useAccessor()
+ const chatThreadsService = accessor.get('IChatThreadService')
+ return <>
+ { chatThreadsService.approveTool(toolRequest.voidToolId) }}>Accept
+ { chatThreadsService.rejectTool(toolRequest.voidToolId) }}>Reject
+ >
+}
-const toolNameToComponent: { [T in ToolName]: (props: { chatMessage: ToolMessage }) => React.ReactNode } = {
- 'read_file': ({ chatMessage }) => {
-
- const accessor = useAccessor()
- const commandService = accessor.get('ICommandService')
- const title = toolNameToTitle[chatMessage.name]
-
- if (chatMessage.result.type === 'error') return
-
- const { value, params } = chatMessage.result
- return (
- { commandService.executeCommand('vscode.open', params.uri, { preview: true }) }}
- >
+const toolNameToComponent: { [T in ToolName]: {
+ requestWrapper: (props: { toolRequest: ToolRequestApproval }) => React.ReactNode,
+ resultWrapper: (props: { toolMessage: ToolMessage & { result: { type: 'success' } } }) => React.ReactNode,
+} } = {
+ 'read_file': {
+ requestWrapper: ({ toolRequest }) => {
+ const title = toolNameToTitle[toolRequest.name]
+ const { params } = toolRequest
+ return } />
+ },
+ resultWrapper: ({ toolMessage }) => {
+ const accessor = useAccessor()
+ const commandService = accessor.get('ICommandService')
+ const title = toolNameToTitle[toolMessage.name]
+ const { value, params } = toolMessage.result
+ return }>
{ commandService.executeCommand('vscode.open', params.uri, { preview: true }) }}
@@ -1040,25 +1052,30 @@ const toolNameToComponent: { [T in ToolName]: (props: { chatMessage: ToolMessage
{params.uri.fsPath}
{value.hasNextPage && (AI can scroll for more content...
)}
-
- )
+
+
+ },
},
- 'list_dir': ({ chatMessage }) => {
- const accessor = useAccessor()
- const commandService = accessor.get('ICommandService')
- const explorerService = accessor.get('IExplorerService')
- const title = toolNameToTitle[chatMessage.name]
- // message.result.hasNextPage = true
- // message.result.itemsRemaining = 400
- if (chatMessage.result.type === 'error') return
+ 'list_dir': {
+ requestWrapper: ({ toolRequest }) => {
+ const title = toolNameToTitle[toolRequest.name]
+ const { params } = toolRequest
+ return } />
+ },
+ resultWrapper: ({ toolMessage }) => {
+ const accessor = useAccessor()
+ const commandService = accessor.get('ICommandService')
+ const explorerService = accessor.get('IExplorerService')
+ const title = toolNameToTitle[toolMessage.name]
+ // message.result.hasNextPage = true
+ // message.result.itemsRemaining = 400
- const { value, params } = chatMessage.result
- return (
-
- }
>
{value.children?.map((child, i) => (
- )
+ }
},
- 'pathname_search': ({ chatMessage }) => {
+ 'pathname_search': {
+ requestWrapper: ({ toolRequest }) => {
+ const title = toolNameToTitle[toolRequest.name]
+ const { params } = toolRequest
+ return
} />
+ },
+ resultWrapper: ({ toolMessage }) => {
- const accessor = useAccessor()
- const commandService = accessor.get('ICommandService')
- const title = toolNameToTitle[chatMessage.name]
- if (chatMessage.result.type === 'error') return
+ const accessor = useAccessor()
+ const commandService = accessor.get('ICommandService')
+ const title = toolNameToTitle[toolMessage.name]
- const { value, params } = chatMessage.result
- return (
-
- {value.uris.map((uri, i) => (
- {
- commandService.executeCommand('vscode.open', uri, { preview: true })
- }}
- >
-
- {uri.fsPath.split('/').pop()}
-
- ))
- }
- {value.hasNextPage && (
-
- More results available...
-
- )}
-
- )
- },
- 'search': ({ chatMessage }) => {
- const accessor = useAccessor()
- const commandService = accessor.get('ICommandService')
- const title = toolNameToTitle[chatMessage.name]
- if (chatMessage.result.type === 'error') return
-
- const { value, params } = chatMessage.result
- return (
-
- {value.uris.map((uri, i) => (
- { commandService.executeCommand('vscode.open', uri, { preview: true }) }}
- >
-
- {uri.fsPath.split('/').pop()}
-
- ))}
- {value.hasNextPage && (More results available...
)}
-
- )
- },
-
- 'create_uri': ({ chatMessage }) => {
- const accessor = useAccessor()
- const commandService = accessor.get('ICommandService')
- const title = toolNameToTitle[chatMessage.name]
-
- if (chatMessage.result.type === 'error') return
-
- const { params } = chatMessage.result
- return (
-
{ commandService.executeCommand('vscode.open', params.uri, { preview: true }) }}
- />
- )
- },
- 'delete_uri': ({ chatMessage }) => {
- const accessor = useAccessor()
- const commandService = accessor.get('ICommandService')
- const title = toolNameToTitle[chatMessage.name]
-
- if (chatMessage.result.type === 'error') return
-
- const { params } = chatMessage.result
- return (
- { commandService.executeCommand('vscode.open', params.uri, { preview: true }) }}
- />
- )
- },
- 'edit': ({ chatMessage }) => {
- const accessor = useAccessor()
- const commandService = accessor.get('ICommandService')
- const title = toolNameToTitle[chatMessage.name]
-
- if (chatMessage.result.type === 'error') return
-
- const { params } = chatMessage.result
- return (
- { commandService.executeCommand('vscode.open', params.uri, { preview: true }) }}
- />
- )
- },
- 'terminal_command': ({ chatMessage }) => {
- const accessor = useAccessor()
- const commandService = accessor.get('ICommandService')
- const title = toolNameToTitle[chatMessage.name]
-
- if (chatMessage.result.type === 'error') return
-
- const { params } = chatMessage.result
- return (
-
- }
>
-
-
-
-
- )
+ {value.uris.map((uri, i) => (
+ {
+ commandService.executeCommand('vscode.open', uri, { preview: true })
+ }}
+ >
+
+ {uri.fsPath.split('/').pop()}
+
+ ))
+ }
+ {value.hasNextPage && (
+
+ More results available...
+
+ )}
+
+ )
+ }
+ },
+ 'search': {
+ requestWrapper: ({ toolRequest }) => {
+ const title = toolNameToTitle[toolRequest.name]
+ const { params } = toolRequest
+ return } />
+ },
+ resultWrapper: ({ toolMessage }) => {
+ const accessor = useAccessor()
+ const commandService = accessor.get('ICommandService')
+ const title = toolNameToTitle[toolMessage.name]
+
+ const { value, params } = toolMessage.result
+ return (
+ }
+ >
+ {value.uris.map((uri, i) => (
+ { commandService.executeCommand('vscode.open', uri, { preview: true }) }}
+ >
+
+ {uri.fsPath.split('/').pop()}
+
+ ))}
+ {value.hasNextPage && (More results available...
)}
+
+ )
+ }
+ },
+
+ 'create_uri': {
+ requestWrapper: ({ toolRequest }) => {
+ const title = toolNameToTitle[toolRequest.name]
+ const { params } = toolRequest
+ return } />
+ },
+ resultWrapper: ({ toolMessage }) => {
+ const accessor = useAccessor()
+ const commandService = accessor.get('ICommandService')
+ const title = toolNameToTitle[toolMessage.name]
+ const { params } = toolMessage.result
+ return (
+ { commandService.executeCommand('vscode.open', params.uri, { preview: true }) }}
+ icon={}
+ />
+ )
+ }
+ },
+ 'delete_uri': {
+ requestWrapper: ({ toolRequest }) => {
+ const title = toolNameToTitle[toolRequest.name]
+ const { params } = toolRequest
+ return
+ },
+ resultWrapper: ({ toolMessage }) => {
+ const accessor = useAccessor()
+ const commandService = accessor.get('ICommandService')
+ const title = toolNameToTitle[toolMessage.name]
+ const { params } = toolMessage.result
+ return (
+ { commandService.executeCommand('vscode.open', params.uri, { preview: true }) }}
+ />
+ )
+ }
+ },
+ 'edit': {
+ requestWrapper: ({ toolRequest }) => {
+ const title = toolNameToTitle[toolRequest.name]
+ const { params } = toolRequest
+ return } />
+ },
+ resultWrapper: ({ toolMessage }) => {
+ const accessor = useAccessor()
+ const commandService = accessor.get('ICommandService')
+ const title = toolNameToTitle[toolMessage.name]
+
+ const { params } = toolMessage.result
+ return (
+ { commandService.executeCommand('vscode.open', params.uri, { preview: true }) }}
+ icon={}
+ />
+ )
+ }
+ },
+ 'terminal_command': {
+ requestWrapper: ({ toolRequest }) => {
+ const title = toolNameToTitle[toolRequest.name]
+ const { params } = toolRequest
+ return } />
+ },
+ resultWrapper: ({ toolMessage }) => {
+ const accessor = useAccessor()
+ const commandService = accessor.get('ICommandService')
+ const title = toolNameToTitle[toolMessage.name]
+
+ const { params } = toolMessage.result
+ return (
+ }
+ >
+
+
+ )
+ }
}
};
@@ -1226,35 +1278,37 @@ const ChatBubble = ({ chatMessage, isLoading, messageIdx }: ChatBubbleProps) =>
const role = chatMessage.role
if (role === 'user') {
-
return
-
}
-
else if (role === 'assistant') {
-
return
-
+ }
+ else if (role === 'tool_request') {
+ if (!isLoading) return null
+ const ToolMessageComponent = toolNameToComponent[chatMessage.name].requestWrapper as React.FC<{ toolRequest: any }> // ts isnt smart enough...
+ return <>
+
+
+ >
}
else if (role === 'tool') {
+ const title = toolNameToTitle[chatMessage.name]
+ if (chatMessage.result.type === 'error') return
-
- const ToolMessageComponent = toolNameToComponent[chatMessage.name] as React.FC<{ chatMessage: any, messageIdx: any, isLoading: any }> // ts isnt smart enough...
-
+ const ToolMessageComponent = toolNameToComponent[chatMessage.name].resultWrapper as React.FC<{ toolMessage: any }> // ts isnt smart enough...
return
-
}
diff --git a/src/vs/workbench/contrib/void/browser/toolsService.ts b/src/vs/workbench/contrib/void/browser/toolsService.ts
index f27b821d..fd93c5b2 100644
--- a/src/vs/workbench/contrib/void/browser/toolsService.ts
+++ b/src/vs/workbench/contrib/void/browser/toolsService.ts
@@ -399,7 +399,6 @@ export class ToolsService implements IToolsService {
const toIdx = MAX_FILE_CHARS_PAGE * pageNumber - 1
const fileContents = readFileContents.slice(fromIdx, toIdx + 1) || '(empty)' // paginate
const hasNextPage = (readFileContents.length - 1) - toIdx >= 1
- console.log('read_file result:', fileContents)
return { fileContents, hasNextPage }
},
@@ -449,12 +448,14 @@ export class ToolsService implements IToolsService {
},
edit: async ({ uri, changeDescription }) => {
+ console.log('editing!!!!')
const [_, p] = editCodeService.startApplying({
uri,
applyStr: changeDescription,
from: 'ClickApply',
type: 'searchReplace',
}) ?? []
+ console.log('B')
await p
return {}