diff --git a/product.json b/product.json index 00cc284c..e82926c9 100644 --- a/product.json +++ b/product.json @@ -35,5 +35,9 @@ "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", "itemUrl": "https://marketplace.visualstudio.com/items" }, - "builtInExtensions": [] + "builtInExtensions": [], + "linkProtectionTrustedDomains": [ + "https://voideditor.com", + "https://voideditor.dev" + ] } diff --git a/src/vs/workbench/browser/parts/editor/editorGroupWatermark.ts b/src/vs/workbench/browser/parts/editor/editorGroupWatermark.ts index 287299ff..a1175ae3 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupWatermark.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupWatermark.ts @@ -250,7 +250,9 @@ export class EditorGroupWatermark extends Disposable { linkSpan.appendChild(dirSpan); return linkSpan - }).filter(v => !!v) + }) + .filter(v => !!v) + .slice(0, 5) // take 5 most recent ) } diff --git a/src/vs/workbench/contrib/void/browser/aiRegexService.ts b/src/vs/workbench/contrib/void/browser/aiRegexService.ts index 6495a310..4e37f99c 100644 --- a/src/vs/workbench/contrib/void/browser/aiRegexService.ts +++ b/src/vs/workbench/contrib/void/browser/aiRegexService.ts @@ -34,7 +34,7 @@ // // const result = await new Promise((res, rej) => { // // sendLLMMessage({ // // messages, -// // tools: ['text_search'], +// // tools: ['grep_search'], // // onFinalMessage: ({ result: r, }) => { // // res(r) // // }, @@ -73,7 +73,7 @@ // // const result = new Promise((res, rej) => { // // sendLLMMessage({ // // messages, -// // tools: ['text_search'], +// // tools: ['grep_search'], // // onResult: (r) => { // // res(r) // // } diff --git a/src/vs/workbench/contrib/void/browser/chatThreadService.ts b/src/vs/workbench/contrib/void/browser/chatThreadService.ts index e3024792..ca2f6369 100644 --- a/src/vs/workbench/contrib/void/browser/chatThreadService.ts +++ b/src/vs/workbench/contrib/void/browser/chatThreadService.ts @@ -392,7 +392,7 @@ class ChatThreadService extends Disposable implements IChatThreadService { { role: 'tool', - name: 'text_search', + name: 'grep_search', id: 'tool-4', paramsStr: '{"query": "function main"}', content: 'Found matches in 3 files', @@ -408,15 +408,15 @@ class ChatThreadService extends Disposable implements IChatThreadService { hasNextPage: false } }, - } satisfies ToolMessage<'text_search'>, + } satisfies ToolMessage<'grep_search'>, // { // role: 'tool_request', - // name: 'text_search', + // name: 'grep_search', // params: { queryStr: 'function main', pageNumber: 0 }, // paramsStr: '{"query": "function main"}', // id: 'request-4', - // } satisfies ToolRequestApproval<'text_search'>, + // } satisfies ToolRequestApproval<'grep_search'>, // --- diff --git a/src/vs/workbench/contrib/void/browser/editCodeService.ts b/src/vs/workbench/contrib/void/browser/editCodeService.ts index ccf5484e..098b073e 100644 --- a/src/vs/workbench/contrib/void/browser/editCodeService.ts +++ b/src/vs/workbench/contrib/void/browser/editCodeService.ts @@ -1628,7 +1628,7 @@ class EditCodeService extends Disposable implements IEditCodeService { this._notifyError(e) onDone() this._undoHistory(uri) - throw e.fullError // throw error h + throw e.fullError || new Error(e.message) // throw error h } // refresh now in case onText takes a while to get 1st message diff --git a/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx b/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx index b09a22ba..1069b635 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx @@ -267,7 +267,7 @@ export const useApplyButtonHTML = ({ codeStr, applyBoxId, uri }: { codeStr: stri } - const statusIndicatorHTML =
+ const statusIndicatorHTML =
{title} - {desc1} + {desc1}
{/* right */} @@ -740,7 +740,7 @@ const ToolHeaderWrapper = ({ } {numResults !== undefined && ( - {`(${numResults}${hasNextPage ? '+' : ''} result${numResults !== 1 ? 's' : ''})`} + {`${numResults}${hasNextPage ? '+' : ''} result${numResults !== 1 ? 's' : ''}`} )} {isError && } @@ -750,8 +750,8 @@ const ToolHeaderWrapper = ({
{/* children */} {
@@ -1018,6 +1018,9 @@ const SmallProseWrapper = ({ children }: { children: React.ReactNode }) => { leading-snug text-[13px] + [&>:first-child]:!mt-0 + [&>:last-child]:!mb-0 + prose-h1:text-[14px] prose-h1:my-4 @@ -1154,7 +1157,7 @@ const ReasoningWrapper = ({ isDoneReasoning, isStreaming, children }: { isDoneRe if (!isWriting) setIsOpen(false) // if just finished reasoning, close }, [isWriting]) return : ''} isOpen={isOpen} onClick={() => setIsOpen(v => !v)}> - +
{children}
@@ -1178,7 +1181,7 @@ const titleOfToolName = { 'read_file': { done: 'Read file', proposed: 'Read file', running: loadingTitleWrapper('Reading file') }, 'list_dir': { done: 'Inspected folder', proposed: 'Inspect folder', running: loadingTitleWrapper('Inspecting folder') }, 'pathname_search': { done: 'Searched by file name', proposed: 'Search by file name', running: loadingTitleWrapper('Searching by file name') }, - 'text_search': { done: 'Searched', proposed: 'Search text', running: loadingTitleWrapper('Searching') }, + 'grep_search': { done: 'Searched', proposed: 'Search', running: loadingTitleWrapper('Searching') }, 'create_uri': { done: (isFolder: boolean) => `Created ${folderFileStr(isFolder)}`, proposed: (isFolder: boolean | null) => isFolder === null ? 'Create URI' : `Create ${folderFileStr(isFolder)}`, @@ -1210,8 +1213,8 @@ const toolNameToDesc = (toolName: ToolName, _toolParams: ToolCallParams[ToolName } else if (toolName === 'pathname_search') { const toolParams = _toolParams as ToolCallParams['pathname_search'] return `"${toolParams.queryStr}"`; - } else if (toolName === 'text_search') { - const toolParams = _toolParams as ToolCallParams['text_search'] + } else if (toolName === 'grep_search') { + const toolParams = _toolParams as ToolCallParams['grep_search'] return `"${toolParams.queryStr}"`; } else if (toolName === 'create_uri') { const toolParams = _toolParams as ToolCallParams['create_uri'] @@ -1310,7 +1313,7 @@ const ToolRequestAcceptRejectButtons = () => { } export const ToolChildrenWrapper = ({ children, className }: { children: React.ReactNode, className?: string }) => { - return
+ return
{children}
@@ -1490,7 +1493,7 @@ const toolNameToComponent: { [T in ToolName]: ToolComponent } = { return } }, - 'text_search': { + 'grep_search': { requestWrapper: null, resultWrapper: ({ toolMessage }) => { const accessor = useAccessor() @@ -1763,17 +1766,19 @@ const toolNameToComponent: { [T in ToolName]: ToolComponent } = { resolveReason.type === 'toofull' ? `\n(truncated)` : null - componentParams.children = - terminalToolsService.openTerminal(terminalId)} - /> + componentParams.children = +
- {resolveReason.type === 'bgtask' ? 'Result so far:\n' : null} - {result} - {resultStr} +
+ {`Ran command: `} + {command} +
+
+ {resolveReason.type === 'bgtask' ? 'Result so far:\n' : null} + {`Result: `} + {result} + {resultStr} +
diff --git a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx index ec2b2e94..8e82d750 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx @@ -152,6 +152,37 @@ export const VoidInputBox2 = forwardRef(fun }) + +export const VoidSimpleInputBox = ({ value, onChangeValue, placeholder, className, disabled, passwordBlur, ...inputProps }: { + value: string; + onChangeValue: (value: string) => void; + placeholder: string; + className?: string; + disabled?: boolean; + passwordBlur?: boolean; +} & React.InputHTMLAttributes) => { + + return ( + onChangeValue(e.target.value)} + placeholder={placeholder} + disabled={disabled} + className={`w-full resize-none text-void-fg-1 placeholder:text-void-fg-3 px-2 py-1 rounded-sm + ${disabled ? 'opacity-50 cursor-not-allowed' : ''} + ${className}`} + style={{ + ...passwordBlur && { WebkitTextSecurity: 'disc' }, + background: asCssVariable(inputBackground), + color: asCssVariable(inputForeground) + }} + {...inputProps} + type={undefined} // VS Code is doing some annoyingness that breaks paste if this is defined + /> + ); +}; + + export const VoidInputBox = ({ onChangeText, onCreateInstance, inputBoxRef, placeholder, isPasswordField, multiline }: { onChangeText: (value: string) => void; styles?: Partial, @@ -319,7 +350,7 @@ export const VoidSlider = ({ size === 'xs' ? 'h-1' : size === 'sm' ? 'h-1.5' : size === 'sm+' ? 'h-2' : 'h-2.5' - } bg-gray-200 dark:bg-gray-700 rounded-full cursor-pointer`} + } bg-void-bg-2 rounded-full cursor-pointer`} onClick={handleTrackClick} > {/* Filled part of track */} @@ -328,12 +359,12 @@ export const VoidSlider = ({ size === 'xs' ? 'h-1' : size === 'sm' ? 'h-1.5' : size === 'sm+' ? 'h-2' : 'h-2.5' - } bg-gray-900 dark:bg-white rounded-full`} + } bg-void-fg-1 rounded-full`} style={{ width: `${percentage}%` }} />
- {/* Thumb with sizes matching VoidSwitch */} + {/* Thumb */}
{ if (disabled) return; @@ -393,7 +425,7 @@ export const VoidSwitch = ({ className={` cursor-pointer relative inline-flex items-center rounded-full transition-colors duration-200 ease-in-out - ${value ? 'bg-gray-900 dark:bg-white' : 'bg-gray-200 dark:bg-gray-700'} + ${value ? 'bg-zinc-900 dark:bg-white' : 'bg-white dark:bg-zinc-600'} ${disabled ? 'opacity-25' : ''} ${size === 'xxs' ? 'h-3 w-5' : ''} ${size === 'xs' ? 'h-4 w-7' : ''} @@ -404,7 +436,7 @@ export const VoidSwitch = ({ > void }) => { return } diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-command-bar-tsx/VoidCommandBar.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-command-bar-tsx/VoidCommandBar.tsx index 25ffbaec..99dbf770 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-command-bar-tsx/VoidCommandBar.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-command-bar-tsx/VoidCommandBar.tsx @@ -97,7 +97,7 @@ const VoidCommandBar = ({ uri, editor }: VoidCommandBarProps) => { if (diffid === undefined) return const diff = editCodeService.diffOfId[diffid] if (!diff) return - editor.revealLineNearTop(diff.startLine, ScrollType.Immediate) + editor.revealLineNearTop(diff.startLine - 1, ScrollType.Immediate) commandBarService.setDiffIdx(uri, idx) } const getNextUriIdx = (step: 1 | -1) => { 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 375e5086..3b97463a 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 @@ -7,7 +7,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { InputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js' import { ProviderName, SettingName, displayInfoOfSettingName, providerNames, VoidModelInfo, globalSettingNames, customSettingNamesOfProvider, RefreshableProviderName, refreshableProviderNames, displayInfoOfProviderName, defaultProviderSettings, nonlocalProviderNames, localProviderNames, GlobalSettingName, featureNames, displayInfoOfFeatureName, isProviderNameDisabled, FeatureName } from '../../../../common/voidSettingsTypes.js' import ErrorBoundary from '../sidebar-tsx/ErrorBoundary.js' -import { VoidButton, VoidCheckBox, VoidCustomDropdownBox, VoidInputBox, VoidInputBox2, VoidSwitch } from '../util/inputs.js' +import { VoidButton, VoidCheckBox, VoidCustomDropdownBox, VoidInputBox, VoidInputBox2, VoidSimpleInputBox, VoidSwitch } from '../util/inputs.js' import { useAccessor, useIsDark, useRefreshModelListener, useRefreshModelState, useSettingsState } from '../util/services.js' import { X, RefreshCw, Loader2, Check, MoveRight } from 'lucide-react' import { useScrollbarStyles } from '../util/useScrollbarStyles.js' @@ -255,45 +255,29 @@ export const ModelDump = () => { const ProviderSetting = ({ providerName, settingName }: { providerName: ProviderName, settingName: SettingName }) => { - - // const { title: providerTitle, } = displayInfoOfProviderName(providerName) - const { title: settingTitle, placeholder, isPasswordField, subTextMd } = displayInfoOfSettingName(providerName, settingName) const accessor = useAccessor() const voidSettingsService = accessor.get('IVoidSettingsService') + const settingsState = useSettingsState() - let weChangedTextRef = false + const settingValue = settingsState.settingsOfProvider[providerName][settingName] as string // this should always be a string in this component + console.log(`providerName:${providerName} settingName: ${settingName}, settingValue: ${settingValue}`) + if (typeof settingValue !== 'string') { + console.log('Error: Provider setting had a non-string value.') + return + } return
- { - if (weChangedTextRef) return + { voidSettingsService.setSettingOfProvider(providerName, settingName, newVal) }, [voidSettingsService, providerName, settingName])} - - // we are responsible for setting the initial value. always sync the instance whenever there's a change to state. - onCreateInstance={useCallback((instance: InputBox) => { - const syncInstance = () => { - const settingsAtProvider = voidSettingsService.state.settingsOfProvider[providerName]; - const stateVal = settingsAtProvider[settingName as SettingName] - - // console.log('SYNCING TO', providerName, settingName, stateVal) - weChangedTextRef = true - instance.value = stateVal as string - weChangedTextRef = false - } - - syncInstance() - const disposable = voidSettingsService.onDidChangeState(syncInstance) - return [disposable] - }, [voidSettingsService, providerName, settingName])} - multiline={false} - isPasswordField={isPasswordField} + // placeholder={`${providerTitle} ${settingTitle} (${placeholder})`} + placeholder={`${settingTitle} (${placeholder})`} + passwordBlur={isPasswordField} /> {subTextMd === undefined ? null :
diff --git a/src/vs/workbench/contrib/void/browser/toolsService.ts b/src/vs/workbench/contrib/void/browser/toolsService.ts index 45048458..ad773cd0 100644 --- a/src/vs/workbench/contrib/void/browser/toolsService.ts +++ b/src/vs/workbench/contrib/void/browser/toolsService.ts @@ -227,7 +227,7 @@ export class ToolsService implements IToolsService { return { queryStr, pageNumber } }, - text_search: async (params: string) => { + grep_search: async (params: string) => { const o = validateJSON(params) const { query: queryUnknown, pageNumber: pageNumberUnknown } = o @@ -314,7 +314,7 @@ export class ToolsService implements IToolsService { return { result: { uris, hasNextPage } } }, - text_search: async ({ queryStr, pageNumber }) => { + grep_search: async ({ queryStr, pageNumber }) => { const query = queryBuilder.text({ pattern: queryStr, isRegExp: true, @@ -388,7 +388,7 @@ export class ToolsService implements IToolsService { pathname_search: (params, result) => { return result.uris.map(uri => uri.fsPath).join('\n') + nextPageStr(result.hasNextPage) }, - text_search: (params, result) => { + grep_search: (params, result) => { return result.uris.map(uri => uri.fsPath).join('\n') + nextPageStr(result.hasNextPage) }, // --- diff --git a/src/vs/workbench/contrib/void/common/prompt/prompts.ts b/src/vs/workbench/contrib/void/common/prompt/prompts.ts index b6e27ce6..29ac971a 100644 --- a/src/vs/workbench/contrib/void/common/prompt/prompts.ts +++ b/src/vs/workbench/contrib/void/common/prompt/prompts.ts @@ -69,16 +69,16 @@ export const voidTools = { pathname_search: { name: 'pathname_search', - description: `Returns all pathnames that match a given grep query. You should use this when looking for a file with a specific name or path. This does NOT search file content. ${paginationHelper.desc}`, + description: `Returns all pathnames that match a given \`find\`-style query (searches ONLY file names). You should use this when looking for a file with a specific name or path. ${paginationHelper.desc}`, params: { query: { type: 'string', description: undefined }, ...paginationHelper.param, }, }, - text_search: { - name: 'text_search', - description: `Returns pathnames of files with an exact match of the query. The query can be any regex. This does NOT search pathname. As a follow-up, you may want to use read_file to view the full file contents of the results. ${paginationHelper.desc}`, + grep_search: { + name: 'grep_search', + description: `Returns all pathnames that match a given \`grep\`-style query (searches ONLY file contents). The query can be any regex. This is often followed by the \`read_file\` tool to view the full file contents of results. ${paginationHelper.desc}`, params: { query: { type: 'string', description: undefined }, ...paginationHelper.param, @@ -146,7 +146,7 @@ Here's an example of a good description:\n${editToolDescription}.` export const chat_systemMessage = (workspaces: string[], runningTerminalIds: string[], mode: ChatMode) => `\ You are an expert coding ${mode === 'agent' ? 'agent' : 'assistant'} that runs in the Void code editor. Your job is \ -${mode === 'agent' ? `to help the user develop, run, deploy, and make changes to their codebase. You should ALWAYS bring user's task to completion to the fullest extent possible, calling tools to make all necessary changes. Do not be lazy.` +${mode === 'agent' ? `to help the user develop, run, deploy, and make changes to their codebase. You should ALWAYS bring user's task to completion to the fullest extent possible, calling tools to make all necessary changes.` : mode === 'gather' ? `to search and understand the user's codebase. You MUST use tools to read files and help the user understand the codebase, even if you were initially given files.` : mode === 'normal' ? `to assist the user with their coding tasks.` : ''} @@ -163,7 +163,9 @@ ${/* tool use */ mode === 'agent' || mode === 'gather' ? `\ You will be given tools you can call. ${mode === 'agent' ? `\ - Only use tools if they help you accomplish the user's goal. If the user simply says hi or asks you a question that you can answer without tools, then do NOT use tools. -- ALWAYS use tools to take actions. For example, if you would like to edit a file, you MUST use a tool.` +- ALWAYS use tools to take actions. For example, if you would like to edit a file, you MUST use a tool. +- You will OFTEN need to gather context before making a change. Do not immediately make a change unless you have ALL relevant context. +- ALWAYS have maximal certainty in a change BEFORE you make it. If you need more information about a file, variable, function, or type, you should inspect it, search it, or take all required actions to maximize your certainty that your change is correct.` : mode === 'gather' ? `\ - Your primary use of tools should be to gather information to help the user understand the codebase and answer their query. - You should extensively read files, types, etc and gather relevant context.` diff --git a/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts b/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts index adefa286..90d34311 100644 --- a/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts +++ b/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts @@ -44,7 +44,7 @@ export type ToolCallParams = { 'read_file': { uri: URI, pageNumber: number }, 'list_dir': { rootURI: URI, pageNumber: number }, 'pathname_search': { queryStr: string, pageNumber: number }, - 'text_search': { queryStr: string, pageNumber: number }, + 'grep_search': { queryStr: string, pageNumber: number }, // --- 'edit': { uri: URI, changeDescription: string }, 'create_uri': { uri: URI, isFolder: boolean }, @@ -57,7 +57,7 @@ export type ToolResultType = { 'read_file': { fileContents: string, hasNextPage: boolean }, 'list_dir': { children: ToolDirectoryItem[] | null, hasNextPage: boolean, hasPrevPage: boolean, itemsRemaining: number }, 'pathname_search': { uris: URI[], hasNextPage: boolean }, - 'text_search': { uris: URI[], hasNextPage: boolean }, + 'grep_search': { uris: URI[], hasNextPage: boolean }, // --- 'edit': Promise, 'create_uri': {},