@aws/language-server-runtimes
Advanced tools
Comparing version 0.2.6 to 0.2.7
{ | ||
"name": "@aws/language-server-runtimes", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "Runtimes to host Language Servers for AWS", | ||
@@ -27,8 +27,7 @@ "files": [ | ||
"prepare": "husky install", | ||
"prepub:copyFiles": "cp ../.npmignore CHANGELOG.md ../LICENSE ../NOTICE README.md ../SECURITY.md package.json out/", | ||
"prepub:copyFiles": "shx cp ../.npmignore CHANGELOG.md ../LICENSE ../NOTICE README.md ../SECURITY.md package.json out/", | ||
"prepub": "npm run clean && npm run test && npm run compile && npm run prepub:copyFiles", | ||
"pub": "cd out && npm publish", | ||
"test:prettier": "prettier . --check", | ||
"test:unit": "ts-mocha -b './**/*.test.ts'", | ||
"test": "npm run test:prettier && npm run test:unit", | ||
"test": "npm run test:unit", | ||
"preversion": "npm run test", | ||
@@ -38,4 +37,4 @@ "version": "npm run compile && git add -A ." | ||
"dependencies": { | ||
"@aws/language-server-runtimes-types": "0.x.x", | ||
"jose": "^5.3.0", | ||
"@aws/language-server-runtimes-types": "^0.0.6", | ||
"jose": "^5.4.0", | ||
"rxjs": "^7.8.1", | ||
@@ -47,7 +46,7 @@ "vscode-languageserver": "^9.0.1", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^20.12.11", | ||
"@types/node": "^20.14.2", | ||
"assert": "^2.0.0", | ||
"husky": "^9.0.11", | ||
"prettier": "3.2.5", | ||
"sinon": "^17.0.2", | ||
"prettier": "3.3.2", | ||
"sinon": "^18.0.0", | ||
"ts-mocha": "^10.0.0", | ||
@@ -54,0 +53,0 @@ "ts-sinon": "^2.0.2", |
@@ -1,2 +0,2 @@ | ||
import { UpdateCredentialsParams, ConnectionMetadata, ProtocolNotificationType0, ProtocolRequestType0, AutoParameterStructuresProtocolRequestType } from './lsp'; | ||
import { AutoParameterStructuresProtocolRequestType, ConnectionMetadata, ProtocolNotificationType0, ProtocolRequestType0, UpdateCredentialsParams } from './lsp'; | ||
export declare const iamCredentialsUpdateRequestType: AutoParameterStructuresProtocolRequestType<UpdateCredentialsParams, null, void, void, void>; | ||
@@ -3,0 +3,0 @@ export declare const iamCredentialsDeleteNotificationType: ProtocolNotificationType0<void>; |
@@ -1,33 +0,5 @@ | ||
import { ChatParams, ChatResult, EndChatParams, FeedbackParams, FollowUpClickParams, InfoLinkClickParams, InsertToCursorPositionParams, LinkClickParams, QuickActionParams, SourceLinkClickParams, TabAddParams, TabChangeParams, TabRemoveParams, ProtocolNotificationType, ProtocolRequestType, ProgressToken } from './lsp'; | ||
/** | ||
* Configuration object for chat quick action. | ||
*/ | ||
export interface QuickActionCommand { | ||
command: string; | ||
disabled?: boolean; | ||
description?: string; | ||
placeholder?: string; | ||
} | ||
/** | ||
* Configuration object for registering chat quick actions groups. | ||
*/ | ||
export interface QuickActionCommandGroup { | ||
groupName?: string; | ||
commands: QuickActionCommand[]; | ||
} | ||
/** | ||
* Registration options for a Chat QuickActionRequest. | ||
*/ | ||
export interface QuickActionsOptions { | ||
/** | ||
* The chat quick actions groupd and commands to be executed on server. | ||
*/ | ||
quickActionsCommandGroups: QuickActionCommandGroup[]; | ||
} | ||
export interface ChatRequest extends ChatParams { | ||
partialResultToken?: ProgressToken; | ||
} | ||
export declare const chatRequestType: ProtocolRequestType<ChatRequest, ChatResult, ChatResult, void, void>; | ||
import { ChatParams, ChatResult, EndChatParams, FeedbackParams, FollowUpClickParams, InfoLinkClickParams, InsertToCursorPositionParams, LinkClickParams, QuickActionParams, SourceLinkClickParams, TabAddParams, TabChangeParams, TabRemoveParams, ProtocolNotificationType, ProtocolRequestType, AutoParameterStructuresProtocolRequestType, EncryptedChatParams, EncryptedQuickActionParams, QuickActionResult } from './lsp'; | ||
export declare const chatRequestType: AutoParameterStructuresProtocolRequestType<ChatParams | EncryptedChatParams, string | ChatResult, string | ChatResult, void, void>; | ||
export declare const endChatRequestType: ProtocolRequestType<EndChatParams, boolean, never, void, void>; | ||
export declare const quickActionRequestType: ProtocolRequestType<QuickActionParams, ChatResult, ChatResult, void, void>; | ||
export declare const quickActionRequestType: AutoParameterStructuresProtocolRequestType<QuickActionParams | EncryptedQuickActionParams, string | QuickActionResult, string | QuickActionResult, void, void>; | ||
export declare const readyNotificationType: ProtocolNotificationType<void, void>; | ||
@@ -34,0 +6,0 @@ export declare const feedbackNotificationType: ProtocolNotificationType<FeedbackParams, void>; |
@@ -5,5 +5,5 @@ "use strict"; | ||
const lsp_1 = require("./lsp"); | ||
exports.chatRequestType = new lsp_1.ProtocolRequestType(lsp_1.CHAT_REQUEST_METHOD); | ||
exports.chatRequestType = new lsp_1.AutoParameterStructuresProtocolRequestType(lsp_1.CHAT_REQUEST_METHOD); | ||
exports.endChatRequestType = new lsp_1.ProtocolRequestType(lsp_1.END_CHAT_REQUEST_METHOD); | ||
exports.quickActionRequestType = new lsp_1.ProtocolRequestType(lsp_1.QUICK_ACTION_REQUEST_METHOD); | ||
exports.quickActionRequestType = new lsp_1.AutoParameterStructuresProtocolRequestType(lsp_1.QUICK_ACTION_REQUEST_METHOD); | ||
exports.readyNotificationType = new lsp_1.ProtocolNotificationType(lsp_1.READY_NOTIFICATION_METHOD); | ||
@@ -10,0 +10,0 @@ exports.feedbackNotificationType = new lsp_1.ProtocolNotificationType(lsp_1.FEEDBACK_NOTIFICATION_METHOD); |
import { _EM } from 'vscode-jsonrpc'; | ||
import { InitializeResult as InitializeResultBase, ProgressType, RegistrationType, RequestType } from 'vscode-languageserver-protocol'; | ||
import { QuickActionsOptions } from './chat'; | ||
import { ChatOptions } from '@aws/language-server-runtimes-types'; | ||
export * from '@aws/language-server-runtimes-types'; | ||
@@ -27,7 +27,4 @@ export { TextDocument } from 'vscode-languageserver-textdocument'; | ||
awsServerCapabilities?: { | ||
/** | ||
* The server provides quick actions support. | ||
*/ | ||
chatQuickActionsProvider?: QuickActionsOptions; | ||
chatOptions?: ChatOptions; | ||
}; | ||
} |
@@ -31,1 +31,5 @@ /// <reference types="node" /> | ||
export declare function readEncryptionDetails(stream: Readable): Promise<EncryptionInitialization>; | ||
/** | ||
* Encrypt an object with the provided key | ||
*/ | ||
export declare function encryptObjectWithKey(request: Object, key: string): Promise<string>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.readEncryptionDetails = exports.validateEncryptionDetails = exports.shouldWaitForEncryptionKey = void 0; | ||
exports.encryptObjectWithKey = exports.readEncryptionDetails = exports.validateEncryptionDetails = exports.shouldWaitForEncryptionKey = void 0; | ||
const jose_1 = require("jose"); | ||
function shouldWaitForEncryptionKey() { | ||
@@ -63,2 +64,11 @@ return process.argv.some(arg => arg === '--set-credentials-encryption-key'); | ||
exports.readEncryptionDetails = readEncryptionDetails; | ||
/** | ||
* Encrypt an object with the provided key | ||
*/ | ||
function encryptObjectWithKey(request, key) { | ||
const payload = new TextEncoder().encode(JSON.stringify(request)); | ||
const keyBuffer = Buffer.from(key, 'base64'); | ||
return new jose_1.CompactEncrypt(payload).setProtectedHeader({ alg: 'dir', enc: 'A256GCM' }).encrypt(keyBuffer); | ||
} | ||
exports.encryptObjectWithKey = encryptObjectWithKey; | ||
//# sourceMappingURL=encryption.js.map |
@@ -41,2 +41,3 @@ "use strict"; | ||
const auth_1 = require("./auth"); | ||
const encryptedChat_1 = require("./chat/encryptedChat"); | ||
const versioning_1 = require("./versioning"); | ||
@@ -79,2 +80,3 @@ const lsp_1 = require("./lsp"); | ||
let auth; | ||
let chat; | ||
initializeAuth(); | ||
@@ -91,3 +93,4 @@ // Initialize Auth service | ||
auth = new auth_1.Auth(lspConnection, encryptionDetails.key, encryptionDetails.mode); | ||
initializeRuntime(); | ||
chat = new encryptedChat_1.EncryptedChat(lspConnection, encryptionDetails.key, encryptionDetails.mode); | ||
initializeRuntime(encryptionDetails.key); | ||
}, error => { | ||
@@ -107,3 +110,3 @@ console.error(error); | ||
// capabilities parameter. | ||
function initializeRuntime() { | ||
function initializeRuntime(encryptionKey) { | ||
const documents = new vscode_languageserver_1.TextDocuments(protocol_1.TextDocument); | ||
@@ -163,17 +166,2 @@ // Set up logging over LSP | ||
}; | ||
const chat = { | ||
onChatPrompt: handler => lspConnection.onRequest(protocol_1.chatRequestType.method, handler), | ||
onEndChat: handler => lspConnection.onRequest(protocol_1.endChatRequestType, handler), | ||
onQuickAction: handler => lspConnection.onRequest(protocol_1.quickActionRequestType, handler), | ||
onSendFeedback: handler => lspConnection.onNotification(protocol_1.feedbackNotificationType.method, handler), | ||
onReady: handler => lspConnection.onNotification(protocol_1.readyNotificationType.method, handler), | ||
onTabAdd: handler => lspConnection.onNotification(protocol_1.tabAddNotificationType.method, handler), | ||
onTabChange: handler => lspConnection.onNotification(protocol_1.tabChangeNotificationType.method, handler), | ||
onTabRemove: handler => lspConnection.onNotification(protocol_1.tabRemoveNotificationType.method, handler), | ||
onCodeInsertToCursorPosition: handler => lspConnection.onNotification(protocol_1.insertToCursorPositionNotificationType.method, handler), | ||
onLinkClick: handler => lspConnection.onNotification(protocol_1.linkClickNotificationType.method, handler), | ||
onInfoLinkClick: handler => lspConnection.onNotification(protocol_1.infoLinkClickNotificationType.method, handler), | ||
onSourceLinkClick: handler => lspConnection.onNotification(protocol_1.sourceLinkClickNotificationType.method, handler), | ||
onFollowUpClicked: handler => lspConnection.onNotification(protocol_1.followUpClickNotificationType.method, handler), | ||
}; | ||
const credentialsProvider = auth.getCredentialsProvider(); | ||
@@ -213,5 +201,9 @@ // Create router that will be routing LSP events from the client to server(s) | ||
publishDiagnostics: params => lspConnection.sendNotification(protocol_1.PublishDiagnosticsNotification.method, params), | ||
sendProgress: (type, token, value) => { | ||
sendProgress: (type, token, value) => __awaiter(this, void 0, void 0, function* () { | ||
if (encryptionKey) { | ||
const encryptedProgress = yield (0, encryption_1.encryptObjectWithKey)(value, encryptionKey); | ||
return lspConnection.sendProgress(type, token, encryptedProgress); | ||
} | ||
return lspConnection.sendProgress(type, token, value); | ||
}, | ||
}), | ||
onHover: handler => lspConnection.onHover(handler), | ||
@@ -225,2 +217,19 @@ extensions: { | ||
}; | ||
if (!encryptionKey) { | ||
chat = { | ||
onChatPrompt: handler => lspConnection.onRequest(protocol_1.chatRequestType.method, handler), | ||
onEndChat: handler => lspConnection.onRequest(protocol_1.endChatRequestType.method, handler), | ||
onQuickAction: handler => lspConnection.onRequest(protocol_1.quickActionRequestType.method, handler), | ||
onSendFeedback: handler => lspConnection.onNotification(protocol_1.feedbackNotificationType.method, handler), | ||
onReady: handler => lspConnection.onNotification(protocol_1.readyNotificationType.method, handler), | ||
onTabAdd: handler => lspConnection.onNotification(protocol_1.tabAddNotificationType.method, handler), | ||
onTabChange: handler => lspConnection.onNotification(protocol_1.tabChangeNotificationType.method, handler), | ||
onTabRemove: handler => lspConnection.onNotification(protocol_1.tabRemoveNotificationType.method, handler), | ||
onCodeInsertToCursorPosition: handler => lspConnection.onNotification(protocol_1.insertToCursorPositionNotificationType.method, handler), | ||
onLinkClick: handler => lspConnection.onNotification(protocol_1.linkClickNotificationType.method, handler), | ||
onInfoLinkClick: handler => lspConnection.onNotification(protocol_1.infoLinkClickNotificationType.method, handler), | ||
onSourceLinkClick: handler => lspConnection.onNotification(protocol_1.sourceLinkClickNotificationType.method, handler), | ||
onFollowUpClicked: handler => lspConnection.onNotification(protocol_1.followUpClickNotificationType.method, handler), | ||
}; | ||
} | ||
return s({ chat, credentialsProvider, lsp, workspace, telemetry, logging }); | ||
@@ -227,0 +236,0 @@ }); |
@@ -53,4 +53,4 @@ "use strict"; | ||
onChatPrompt: handler => lspConnection.onRequest(protocol_1.chatRequestType.method, handler), | ||
onEndChat: handler => lspConnection.onRequest(protocol_1.endChatRequestType, handler), | ||
onQuickAction: handler => lspConnection.onRequest(protocol_1.quickActionRequestType, handler), | ||
onEndChat: handler => lspConnection.onRequest(protocol_1.endChatRequestType.method, handler), | ||
onQuickAction: handler => lspConnection.onRequest(protocol_1.quickActionRequestType.method, handler), | ||
onSendFeedback: handler => lspConnection.onNotification(protocol_1.feedbackNotificationType.method, handler), | ||
@@ -57,0 +57,0 @@ onReady: handler => lspConnection.onNotification(protocol_1.readyNotificationType.method, handler), |
@@ -1,2 +0,2 @@ | ||
import { CompletionItem, CompletionList, CompletionParams, DidChangeConfigurationParams, DidChangeTextDocumentParams, DidChangeWorkspaceFoldersParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, DocumentFormattingParams, ExecuteCommandParams, Hover, HoverParams, InitializeError, InitializeParams, InitializedParams, InlineCompletionItem, InlineCompletionItemWithReferences, InlineCompletionList, InlineCompletionListWithReferences, InlineCompletionParams, LogInlineCompletionSessionResultsParams, NotificationHandler, ProgressToken, ProgressType, PublishDiagnosticsParams, QuickActionsOptions, RequestHandler, ServerCapabilities, TextEdit } from '../protocol'; | ||
import { CompletionItem, CompletionList, CompletionParams, DidChangeConfigurationParams, DidChangeTextDocumentParams, DidChangeWorkspaceFoldersParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, DocumentFormattingParams, ExecuteCommandParams, Hover, HoverParams, InitializeError, InitializeParams, InitializedParams, InlineCompletionItem, InlineCompletionItemWithReferences, InlineCompletionList, InlineCompletionListWithReferences, InlineCompletionParams, LogInlineCompletionSessionResultsParams, NotificationHandler, ProgressToken, ProgressType, PublishDiagnosticsParams, ChatOptions, RequestHandler, ServerCapabilities, TextEdit } from '../protocol'; | ||
export * from '../protocol/lsp'; | ||
@@ -7,3 +7,3 @@ export type PartialServerCapabilities<T = any> = Pick<ServerCapabilities<T>, 'completionProvider' | 'hoverProvider' | 'executeCommandProvider'>; | ||
awsServerCapabilities?: { | ||
chatQuickActionsProvider?: QuickActionsOptions; | ||
chatOptions?: ChatOptions; | ||
}; | ||
@@ -10,0 +10,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
233433
111
2569
0
+ Added@aws/language-server-runtimes-types@0.0.6(transitive)
- Removed@aws/language-server-runtimes-types@0.1.1(transitive)
Updatedjose@^5.4.0