Merge remote-tracking branch 'upstream/main' into commit-prompt

This commit is contained in:
Steven Wexler 2025-06-05 09:33:28 -04:00
commit 9920bd3366
7 changed files with 55 additions and 59 deletions

View file

@ -1,8 +1,8 @@
{
"nameShort": "Void",
"nameLong": "Void",
"voidVersion": "1.3.10",
"voidRelease": "0034",
"voidVersion": "1.4.2",
"voidRelease": "0037",
"applicationName": "void",
"dataFolderName": ".void-editor",
"win32MutexName": "voideditor",

View file

@ -26,7 +26,6 @@ import { IViewsService } from '../../../services/views/common/viewsService.js';
/* eslint-disable */ // Void
import { VOID_CTRL_K_ACTION_ID, VOID_CTRL_L_ACTION_ID } from '../../../contrib/void/browser/actionIDs.js';
import { VOID_OPEN_SETTINGS_ACTION_ID } from '../../../contrib/void/browser/voidSettingsPane.js';
import { VIEWLET_ID as REMOTE_EXPLORER_VIEWLET_ID } from '../../../contrib/remote/browser/remoteExplorer.js';
/* eslint-enable */
@ -306,21 +305,21 @@ export class EditorGroupWatermark extends Disposable {
label2.set(keys2);
this.currentDisposables.add(label2);
const keys3 = this.keybindingService.lookupKeybinding('workbench.action.openGlobalKeybindings');
const button3 = append(recentsBox, $('button'));
button3.textContent = `Void Settings`
button3.style.display = 'block'
button3.style.marginLeft = 'auto'
button3.style.marginRight = 'auto'
button3.classList.add('void-settings-watermark-button')
// const keys3 = this.keybindingService.lookupKeybinding('workbench.action.openGlobalKeybindings');
// const button3 = append(recentsBox, $('button'));
// button3.textContent = `Void Settings`
// button3.style.display = 'block'
// button3.style.marginLeft = 'auto'
// button3.style.marginRight = 'auto'
// button3.classList.add('void-settings-watermark-button')
const label3 = new KeybindingLabel(button3, OS, { renderUnboundKeybindings: true, ...defaultKeybindingLabelStyles });
if (keys3)
label3.set(keys3);
button3.onclick = () => {
this.commandService.executeCommand(VOID_OPEN_SETTINGS_ACTION_ID)
}
this.currentDisposables.add(label3);
// const label3 = new KeybindingLabel(button3, OS, { renderUnboundKeybindings: true, ...defaultKeybindingLabelStyles });
// if (keys3)
// label3.set(keys3);
// button3.onclick = () => {
// this.commandService.executeCommand(VOID_OPEN_SETTINGS_ACTION_ID)
// }
// this.currentDisposables.add(label3);
}

View file

@ -34,6 +34,7 @@ import ErrorBoundary from './ErrorBoundary.js';
import { ToolApprovalTypeSwitch } from '../void-settings-tsx/Settings.js';
import { persistentTerminalNameOfId } from '../../../terminalToolService.js';
import { removeMCPToolNamePrefix } from '../../../../common/mcpServiceTypes.js';
@ -1857,7 +1858,7 @@ const MCPToolWrapper = ({ toolMessage }: WrapperProps<string>) => {
const mcpService = accessor.get('IMCPService')
const title = getTitle(toolMessage)
const desc1 = toolMessage.name
const desc1 = removeMCPToolNamePrefix(toolMessage.name)
const icon = null

View file

@ -297,11 +297,12 @@ export class TerminalToolService extends Disposable implements ITerminalToolServ
const cmdCap = await this._waitForCommandDetectionCapability(terminal)
if (!cmdCap) throw new Error(`There was an error using the terminal: CommandDetection capability did not mount yet. Please try again in a few seconds or report this to the Void team.`)
// if (!cmdCap) throw new Error(`There was an error using the terminal: CommandDetection capability did not mount yet. Please try again in a few seconds or report this to the Void team.`)
// Prefer the structured command-detection capability when available
const waitUntilDone = new Promise<void>(resolve => {
if (!cmdCap) return
const l = cmdCap.onCommandFinished(cmd => {
if (resolveReason) return // already resolved
resolveReason = { type: 'done', exitCode: cmd.exitCode ?? 0 };

View file

@ -42,8 +42,16 @@ const validateStr = (argName: string, value: unknown) => {
const validateURI = (uriStr: unknown) => {
if (uriStr === null) throw new Error(`Invalid LLM output: uri was null.`)
if (typeof uriStr !== 'string') throw new Error(`Invalid LLM output format: Provided uri must be a string, but it's a(n) ${typeof uriStr}. Full value: ${JSON.stringify(uriStr)}.`)
const uri = URI.file(uriStr)
return uri
// Try to parse as full URI first (for remote schemes like ssh://, wsl://, etc.)
try {
const uri = URI.parse(uriStr)
return uri
} catch (e) {
// If parsing as URI fails, treat as file path (backwards compatibility)
const uri = URI.file(uriStr)
return uri
}
}
const validateOptionalURI = (uriStr: unknown) => {

View file

@ -234,3 +234,9 @@ export interface MCPToolCallParams {
toolName: string;
params: Record<string, unknown>;
}
export const removeMCPToolNamePrefix = (name: string) => {
return name.split('_').slice(1).join('_')
}

View file

@ -13,7 +13,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
import { MCPConfigFileJSON, MCPConfigFileEntryJSON, MCPServer, RawMCPToolCall, MCPToolErrorResponse, MCPServerEventResponse, MCPToolCallParams } from '../common/mcpServiceTypes.js';
import { MCPConfigFileJSON, MCPConfigFileEntryJSON, MCPServer, RawMCPToolCall, MCPToolErrorResponse, MCPServerEventResponse, MCPToolCallParams, removeMCPToolNamePrefix } from '../common/mcpServiceTypes.js';
import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
import { MCPUserStateOfName } from '../common/voidSettingsTypes.js';
@ -245,10 +245,6 @@ export class MCPChannel implements IServerChannel {
}
}
private _removeUniquePrefix(name: string) {
return name.split('_').slice(1).join('_')
}
private async _closeAllMCPServers() {
for (const serverName in this.infoOfClientId) {
await this._closeClient(serverName)
@ -314,7 +310,7 @@ export class MCPChannel implements IServerChannel {
// Call the tool with the provided parameters
const response = await client.callTool({
name: this._removeUniquePrefix(toolName),
name: removeMCPToolNamePrefix(toolName),
arguments: params
})
const { content } = response as CallToolResult
@ -357,41 +353,26 @@ export class MCPChannel implements IServerChannel {
const response = await this._callTool(serverName, toolName, params)
return response
} catch (err) {
let errorMessage: string;
if (typeof err === 'object' && err !== null && err['code']) {
const code = err.code
let codeDescription = ''
if (code === -32700)
codeDescription = 'Parse Error';
if (code === -32600)
codeDescription = 'Invalid Request';
if (code === -32601)
codeDescription = 'Method Not Found';
if (code === -32602)
codeDescription = 'Invalid Parameters';
if (code === -32603)
codeDescription = 'Internal Error';
errorMessage = `${codeDescription}. Full response:\n${JSON.stringify(err, null, 2)}`
}
// Check if it's an MCP error with a code
if (err && typeof err === 'object' && 'code' in err) {
const errorCode = err.code;
const errorName = err.name || 'Unknown Error';
const errorMsg = err.message || '';
// Map common JSON-RPC error codes to user-friendly messages
let codeDescription = '';
switch (errorCode) {
case -32700:
codeDescription = 'Parse Error';
break;
case -32600:
codeDescription = 'Invalid Request';
break;
case -32601:
codeDescription = 'Method Not Found';
break;
case -32602:
codeDescription = 'Invalid Parameters';
break;
case -32603:
codeDescription = 'Internal Error';
break;
default:
codeDescription = `Error Code ${errorCode}`;
}
errorMessage = `${errorName} (${codeDescription})${errorMsg ? ': ' + errorMsg : ''}`;
} else if (err && typeof err === 'object' && 'message' in err) {
// Standard error with message
errorMessage = err.message;
} else if (typeof err === 'string') {
else if (typeof err === 'string') {
// String error
errorMessage = err;
} else {