mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 08:15:56 +01:00
Fix error messages and improve type imports (#304837)
* Tweak error message And fix inline type imports Co-authored-by: Copilot <copilot@github.com> * Fix Co-authored-by: Copilot <copilot@github.com> --------- Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -66,8 +66,10 @@ import type {
|
||||
ISessionModelChangedAction,
|
||||
ISessionReasoningAction,
|
||||
ISessionResponsePartAction,
|
||||
ISessionToolCallApprovedAction,
|
||||
ISessionToolCallCompleteAction,
|
||||
ISessionToolCallConfirmedAction,
|
||||
ISessionToolCallDeniedAction,
|
||||
ISessionToolCallDeltaAction,
|
||||
ISessionToolCallReadyAction,
|
||||
ISessionToolCallResultConfirmedAction,
|
||||
@@ -102,8 +104,8 @@ export type IResponsePartAction = ISessionResponsePartAction;
|
||||
export type IToolCallStartAction = ISessionToolCallStartAction;
|
||||
export type IToolCallDeltaAction = ISessionToolCallDeltaAction;
|
||||
export type IToolCallReadyAction = ISessionToolCallReadyAction;
|
||||
export type IToolCallApprovedAction = import('./protocol/actions.js').ISessionToolCallApprovedAction;
|
||||
export type IToolCallDeniedAction = import('./protocol/actions.js').ISessionToolCallDeniedAction;
|
||||
export type IToolCallApprovedAction = ISessionToolCallApprovedAction;
|
||||
export type IToolCallDeniedAction = ISessionToolCallDeniedAction;
|
||||
export type IToolCallConfirmedAction = ISessionToolCallConfirmedAction;
|
||||
export type IToolCallCompleteAction = ISessionToolCallCompleteAction;
|
||||
export type IToolCallResultConfirmedAction = ISessionToolCallResultConfirmedAction;
|
||||
|
||||
@@ -221,7 +221,7 @@ export class RemoteAgentHostService extends Disposable implements IRemoteAgentHo
|
||||
this._resolvePendingConnectionWait(address);
|
||||
this._onDidChangeConnections.fire();
|
||||
}).catch(err => {
|
||||
this._logService.error(`[RemoteAgentHost] Failed to connect to ${address}`, err);
|
||||
this._logService.error(`[RemoteAgentHost] Failed to connect to ${address}. Verify address and connectionToken`, err);
|
||||
this._rejectPendingConnectionWait(address, err);
|
||||
guardedRemove();
|
||||
});
|
||||
|
||||
@@ -12,6 +12,9 @@ import { connectionTokenQueryName } from '../../../base/common/network.js';
|
||||
import { ILogService } from '../../log/common/log.js';
|
||||
import { JSON_RPC_PARSE_ERROR, type IAhpServerNotification, type IJsonRpcResponse, type IProtocolMessage } from '../common/state/sessionProtocol.js';
|
||||
import type { IProtocolServer, IProtocolTransport } from '../common/state/sessionTransport.js';
|
||||
import type * as wsTypes from 'ws';
|
||||
import type * as httpTypes from 'http';
|
||||
import type * as urlTypes from 'url';
|
||||
|
||||
/**
|
||||
* Options for creating a {@link WebSocketProtocolServer}.
|
||||
@@ -46,8 +49,8 @@ export class WebSocketProtocolTransport extends Disposable implements IProtocolT
|
||||
readonly onClose = this._onClose.event;
|
||||
|
||||
constructor(
|
||||
private readonly _ws: import('ws').WebSocket,
|
||||
private readonly _WebSocket: typeof import('ws').WebSocket,
|
||||
private readonly _ws: wsTypes.WebSocket,
|
||||
private readonly _WebSocket: typeof wsTypes.WebSocket,
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -94,9 +97,9 @@ export class WebSocketProtocolTransport extends Disposable implements IProtocolT
|
||||
*/
|
||||
export class WebSocketProtocolServer extends Disposable implements IProtocolServer {
|
||||
|
||||
private readonly _wss: import('ws').WebSocketServer;
|
||||
private readonly _httpServer: import('http').Server | undefined;
|
||||
private readonly _WebSocket: typeof import('ws').WebSocket;
|
||||
private readonly _wss: wsTypes.WebSocketServer;
|
||||
private readonly _httpServer: httpTypes.Server | undefined;
|
||||
private readonly _WebSocket: typeof wsTypes.WebSocket;
|
||||
|
||||
private readonly _onConnection = this._register(new Emitter<IProtocolTransport>());
|
||||
readonly onConnection = this._onConnection.event;
|
||||
@@ -128,9 +131,9 @@ export class WebSocketProtocolServer extends Disposable implements IProtocolServ
|
||||
private constructor(
|
||||
options: IWebSocketServerOptions | number,
|
||||
private readonly _logService: ILogService,
|
||||
ws: typeof import('ws'),
|
||||
http: typeof import('http'),
|
||||
url: typeof import('url'),
|
||||
ws: typeof wsTypes,
|
||||
http: typeof httpTypes,
|
||||
url: typeof urlTypes,
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -141,7 +144,7 @@ export class WebSocketProtocolServer extends Disposable implements IProtocolServ
|
||||
const host = opts.host ?? '127.0.0.1';
|
||||
|
||||
const verifyClient = opts.connectionTokenValidate
|
||||
? (info: { req: import('http').IncomingMessage }, cb: (res: boolean, code?: number, message?: string) => void) => {
|
||||
? (info: { req: httpTypes.IncomingMessage }, cb: (res: boolean, code?: number, message?: string) => void) => {
|
||||
const parsedUrl = url.parse(info.req.url ?? '', true);
|
||||
const token = parsedUrl.query[connectionTokenQueryName];
|
||||
if (!opts.connectionTokenValidate!(token)) {
|
||||
|
||||
Reference in New Issue
Block a user