From 91c839857f8aa4d79098189f9fb620b361c51289 Mon Sep 17 00:00:00 2001 From: Lei Gao <97199248+leigaol@users.noreply.github.com> Date: Wed, 13 Aug 2025 14:04:19 -0700 Subject: [PATCH 01/74] fix: Use file context override in the inline completion params for Jupyter Notebook (#2114) --- app/aws-lsp-antlr4-runtimes/package.json | 2 +- app/aws-lsp-buildspec-runtimes/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- app/aws-lsp-identity-runtimes/package.json | 2 +- app/aws-lsp-json-runtimes/package.json | 2 +- .../package.json | 2 +- app/aws-lsp-partiql-runtimes/package.json | 2 +- app/aws-lsp-s3-runtimes/package.json | 2 +- app/aws-lsp-yaml-json-webworker/package.json | 2 +- app/aws-lsp-yaml-runtimes/package.json | 2 +- app/hello-world-lsp-runtimes/package.json | 2 +- chat-client/package.json | 2 +- client/vscode/package.json | 2 +- core/aws-lsp-core/package.json | 2 +- .../q-agentic-chat-server/package.json | 2 +- package-lock.json | 70 +++++++++---------- server/aws-lsp-antlr4/package.json | 2 +- server/aws-lsp-buildspec/package.json | 2 +- server/aws-lsp-cloudformation/package.json | 2 +- server/aws-lsp-codewhisperer/package.json | 2 +- .../codeWhispererServer.test.ts | 49 ++++++++++++- .../inline-completion/codeWhispererServer.ts | 46 +++++++++--- .../inline-completion/trigger.ts | 17 ++--- .../src/shared/codeWhispererService.ts | 20 +++--- server/aws-lsp-identity/package.json | 2 +- server/aws-lsp-json/package.json | 2 +- server/aws-lsp-notification/package.json | 2 +- server/aws-lsp-partiql/package.json | 2 +- server/aws-lsp-s3/package.json | 2 +- server/aws-lsp-yaml/package.json | 2 +- server/device-sso-auth-lsp/package.json | 2 +- server/hello-world-lsp/package.json | 2 +- 33 files changed, 163 insertions(+), 95 deletions(-) diff --git a/app/aws-lsp-antlr4-runtimes/package.json b/app/aws-lsp-antlr4-runtimes/package.json index bf7cf47bf1..4289cec4b1 100644 --- a/app/aws-lsp-antlr4-runtimes/package.json +++ b/app/aws-lsp-antlr4-runtimes/package.json @@ -12,7 +12,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-antlr4": "*", "antlr4-c3": "^3.4.1", "antlr4ng": "^3.0.4" diff --git a/app/aws-lsp-buildspec-runtimes/package.json b/app/aws-lsp-buildspec-runtimes/package.json index b9c36946b2..700afb3e7f 100644 --- a/app/aws-lsp-buildspec-runtimes/package.json +++ b/app/aws-lsp-buildspec-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-buildspec": "^0.0.1" } } diff --git a/app/aws-lsp-cloudformation-runtimes/package.json b/app/aws-lsp-cloudformation-runtimes/package.json index a88386db4e..5cc04150cb 100644 --- a/app/aws-lsp-cloudformation-runtimes/package.json +++ b/app/aws-lsp-cloudformation-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-cloudformation": "^0.0.1" } } diff --git a/app/aws-lsp-codewhisperer-runtimes/package.json b/app/aws-lsp-codewhisperer-runtimes/package.json index 487d2c5b1a..fc31e64589 100644 --- a/app/aws-lsp-codewhisperer-runtimes/package.json +++ b/app/aws-lsp-codewhisperer-runtimes/package.json @@ -23,7 +23,7 @@ "local-build": "node scripts/local-build.js" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-codewhisperer": "*", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", diff --git a/app/aws-lsp-identity-runtimes/package.json b/app/aws-lsp-identity-runtimes/package.json index 46abf7d958..869a30cb20 100644 --- a/app/aws-lsp-identity-runtimes/package.json +++ b/app/aws-lsp-identity-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-identity": "^0.0.1" } } diff --git a/app/aws-lsp-json-runtimes/package.json b/app/aws-lsp-json-runtimes/package.json index 24ae3535ac..f63dd4e985 100644 --- a/app/aws-lsp-json-runtimes/package.json +++ b/app/aws-lsp-json-runtimes/package.json @@ -11,7 +11,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-json": "*" }, "devDependencies": { diff --git a/app/aws-lsp-notification-runtimes/package.json b/app/aws-lsp-notification-runtimes/package.json index 1e7641e2a8..faf9e4c24c 100644 --- a/app/aws-lsp-notification-runtimes/package.json +++ b/app/aws-lsp-notification-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-notification": "^0.0.1" } } diff --git a/app/aws-lsp-partiql-runtimes/package.json b/app/aws-lsp-partiql-runtimes/package.json index 0d5e07cddf..d483f3d0ce 100644 --- a/app/aws-lsp-partiql-runtimes/package.json +++ b/app/aws-lsp-partiql-runtimes/package.json @@ -11,7 +11,7 @@ "package": "npm run compile && npm run compile:webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.120", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-partiql": "^0.0.5" }, "devDependencies": { diff --git a/app/aws-lsp-s3-runtimes/package.json b/app/aws-lsp-s3-runtimes/package.json index ad84f62776..42efa998be 100644 --- a/app/aws-lsp-s3-runtimes/package.json +++ b/app/aws-lsp-s3-runtimes/package.json @@ -10,7 +10,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-s3": "^0.0.1" } } diff --git a/app/aws-lsp-yaml-json-webworker/package.json b/app/aws-lsp-yaml-json-webworker/package.json index 7079d1fa3b..6190893816 100644 --- a/app/aws-lsp-yaml-json-webworker/package.json +++ b/app/aws-lsp-yaml-json-webworker/package.json @@ -11,7 +11,7 @@ "serve:webpack": "NODE_ENV=development webpack serve" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*" }, diff --git a/app/aws-lsp-yaml-runtimes/package.json b/app/aws-lsp-yaml-runtimes/package.json index a59f919477..eb76a46e38 100644 --- a/app/aws-lsp-yaml-runtimes/package.json +++ b/app/aws-lsp-yaml-runtimes/package.json @@ -11,7 +11,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-yaml": "*" }, "devDependencies": { diff --git a/app/hello-world-lsp-runtimes/package.json b/app/hello-world-lsp-runtimes/package.json index 54018d89d0..14a3a75ff4 100644 --- a/app/hello-world-lsp-runtimes/package.json +++ b/app/hello-world-lsp-runtimes/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@aws/hello-world-lsp": "^0.0.1", - "@aws/language-server-runtimes": "^0.2.123" + "@aws/language-server-runtimes": "^0.2.125" }, "devDependencies": { "@types/chai": "^4.3.5", diff --git a/chat-client/package.json b/chat-client/package.json index df0378f3e4..2ee60a8bec 100644 --- a/chat-client/package.json +++ b/chat-client/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/language-server-runtimes-types": "^0.1.50", "@aws/mynah-ui": "^4.36.4" }, diff --git a/client/vscode/package.json b/client/vscode/package.json index 975a395d66..409a4fc50d 100644 --- a/client/vscode/package.json +++ b/client/vscode/package.json @@ -352,7 +352,7 @@ "@aws-sdk/credential-providers": "^3.731.1", "@aws-sdk/types": "^3.734.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@types/uuid": "^9.0.8", "@types/vscode": "^1.98.0", "jose": "^5.2.4", diff --git a/core/aws-lsp-core/package.json b/core/aws-lsp-core/package.json index aeff582d34..5a3d438d47 100644 --- a/core/aws-lsp-core/package.json +++ b/core/aws-lsp-core/package.json @@ -28,7 +28,7 @@ "prepack": "shx cp ../../LICENSE ../../NOTICE ../../SECURITY.md ." }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@gerhobbelt/gitignore-parser": "^0.2.0-9", "cross-spawn": "7.0.6", "jose": "^5.2.4", diff --git a/integration-tests/q-agentic-chat-server/package.json b/integration-tests/q-agentic-chat-server/package.json index 5431142f5c..1e93a252dd 100644 --- a/integration-tests/q-agentic-chat-server/package.json +++ b/integration-tests/q-agentic-chat-server/package.json @@ -9,7 +9,7 @@ "test-integ": "npm run compile && mocha --timeout 30000 \"./out/**/*.test.js\" --retries 2" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "*" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index b42f206c44..d1ac2ece1c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "name": "@aws/lsp-antlr4-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-antlr4": "*", "antlr4-c3": "^3.4.1", "antlr4ng": "^3.0.4" @@ -71,7 +71,7 @@ "name": "@aws/lsp-buildspec-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-buildspec": "^0.0.1" } }, @@ -79,7 +79,7 @@ "name": "@aws/lsp-cloudformation-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-cloudformation": "^0.0.1" } }, @@ -87,7 +87,7 @@ "name": "@aws/lsp-codewhisperer-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-codewhisperer": "*", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", @@ -120,7 +120,7 @@ "name": "@aws/lsp-identity-runtimes", "version": "0.1.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-identity": "^0.0.1" } }, @@ -128,7 +128,7 @@ "name": "@aws/lsp-json-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-json": "*" }, "devDependencies": { @@ -148,7 +148,7 @@ "name": "@aws/lsp-notification-runtimes", "version": "0.1.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-notification": "^0.0.1" } }, @@ -156,7 +156,7 @@ "name": "@aws/lsp-partiql-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.120", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-partiql": "^0.0.5" }, "devDependencies": { @@ -181,7 +181,7 @@ "name": "@aws/lsp-s3-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-s3": "^0.0.1" }, "bin": { @@ -192,7 +192,7 @@ "name": "@aws/lsp-yaml-json-webworker", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*" }, @@ -212,7 +212,7 @@ "name": "@aws/lsp-yaml-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-yaml": "*" }, "devDependencies": { @@ -234,7 +234,7 @@ "version": "0.0.1", "dependencies": { "@aws/hello-world-lsp": "^0.0.1", - "@aws/language-server-runtimes": "^0.2.123" + "@aws/language-server-runtimes": "^0.2.125" }, "devDependencies": { "@types/chai": "^4.3.5", @@ -255,7 +255,7 @@ "license": "Apache-2.0", "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/language-server-runtimes-types": "^0.1.50", "@aws/mynah-ui": "^4.36.4" }, @@ -280,7 +280,7 @@ "@aws-sdk/credential-providers": "^3.731.1", "@aws-sdk/types": "^3.734.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@types/uuid": "^9.0.8", "@types/vscode": "^1.98.0", "jose": "^5.2.4", @@ -296,7 +296,7 @@ "version": "0.0.13", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@gerhobbelt/gitignore-parser": "^0.2.0-9", "cross-spawn": "7.0.6", "jose": "^5.2.4", @@ -327,7 +327,7 @@ "name": "@aws/q-agentic-chat-server-integration-tests", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "*" }, "devDependencies": { @@ -4036,12 +4036,12 @@ "link": true }, "node_modules/@aws/language-server-runtimes": { - "version": "0.2.123", - "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes/-/language-server-runtimes-0.2.123.tgz", - "integrity": "sha512-gxjnBcQY+HR9+F1NXQUEQ6ikJhrLMJEbrpIxlBLILtQ75hVtRDsfGET3KW5Nn0dgbrQTx6VqwvXDfolUkmi06g==", + "version": "0.2.125", + "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes/-/language-server-runtimes-0.2.125.tgz", + "integrity": "sha512-tjXJEagZ6rm09fcgJGu1zbFNzi0+7R1mdNFa6zCIv68c76xq5JHjc++Hne9aOgp61O6BM9uNnX3KR57v9/0E1g==", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes-types": "^0.1.55", + "@aws/language-server-runtimes-types": "^0.1.56", "@opentelemetry/api": "^1.9.0", "@opentelemetry/api-logs": "^0.200.0", "@opentelemetry/core": "^2.0.0", @@ -4068,9 +4068,9 @@ } }, "node_modules/@aws/language-server-runtimes-types": { - "version": "0.1.55", - "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes-types/-/language-server-runtimes-types-0.1.55.tgz", - "integrity": "sha512-KRy3fTCNGvAQxA4amTODXPuubxrYlqKsyJOXPaIn+YDACwJa7shrOryHg6xrib6uHAHT2fEkcTMk9TT4MRPxQA==", + "version": "0.1.56", + "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes-types/-/language-server-runtimes-types-0.1.56.tgz", + "integrity": "sha512-Md/L750JShCHUsCQUJva51Ofkn/GDBEX8PpZnWUIVqkpddDR00SLQS2smNf4UHtKNJ2fefsfks/Kqfuatjkjvg==", "license": "Apache-2.0", "dependencies": { "vscode-languageserver-textdocument": "^1.0.12", @@ -28608,7 +28608,7 @@ "version": "0.1.17", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.13" }, "devDependencies": { @@ -28650,7 +28650,7 @@ "name": "@aws/lsp-buildspec", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*", "vscode-languageserver": "^9.0.1", @@ -28661,7 +28661,7 @@ "name": "@aws/lsp-cloudformation", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "*", "@aws/lsp-json": "*", "vscode-languageserver": "^9.0.1", @@ -28683,7 +28683,7 @@ "@aws-sdk/util-arn-parser": "^3.723.0", "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.13", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", @@ -28823,7 +28823,7 @@ "dependencies": { "@aws-sdk/client-sso-oidc": "^3.616.0", "@aws-sdk/token-providers": "^3.744.0", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.12", "@smithy/node-http-handler": "^3.2.5", "@smithy/shared-ini-file-loader": "^4.0.1", @@ -28888,7 +28888,7 @@ "version": "0.1.17", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.13", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" @@ -28905,7 +28905,7 @@ "version": "0.0.1", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1" }, @@ -28966,7 +28966,7 @@ "version": "0.0.16", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "antlr4-c3": "3.4.2", "antlr4ng": "3.0.14", "web-tree-sitter": "0.22.6" @@ -28988,7 +28988,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.623.0", "@aws-sdk/types": "^3.734.0", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" @@ -29019,7 +29019,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.13", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", @@ -29033,7 +29033,7 @@ "name": "@amzn/device-sso-auth-lsp", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "vscode-languageserver": "^9.0.1" }, "devDependencies": { @@ -29044,7 +29044,7 @@ "name": "@aws/hello-world-lsp", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "vscode-languageserver": "^9.0.1" }, "devDependencies": { diff --git a/server/aws-lsp-antlr4/package.json b/server/aws-lsp-antlr4/package.json index 9d6c925b40..f540c8ae21 100644 --- a/server/aws-lsp-antlr4/package.json +++ b/server/aws-lsp-antlr4/package.json @@ -28,7 +28,7 @@ "clean": "rm -rf node_modules" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.13" }, "peerDependencies": { diff --git a/server/aws-lsp-buildspec/package.json b/server/aws-lsp-buildspec/package.json index f59edb5549..2cf0b776ac 100644 --- a/server/aws-lsp-buildspec/package.json +++ b/server/aws-lsp-buildspec/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*", "vscode-languageserver": "^9.0.1", diff --git a/server/aws-lsp-cloudformation/package.json b/server/aws-lsp-cloudformation/package.json index bfc8ebd7e5..ad01b4457a 100644 --- a/server/aws-lsp-cloudformation/package.json +++ b/server/aws-lsp-cloudformation/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "*", "@aws/lsp-json": "*", "vscode-languageserver": "^9.0.1", diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index fdd34884b1..8600148090 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -36,7 +36,7 @@ "@aws-sdk/util-arn-parser": "^3.723.0", "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.13", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts index 29390248f7..8151602dd4 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts @@ -12,7 +12,7 @@ import { TestFeatures } from '@aws/language-server-runtimes/testing' import * as assert from 'assert' import { AWSError } from 'aws-sdk' import sinon, { StubbedInstance } from 'ts-sinon' -import { CodewhispererServerFactory } from './codeWhispererServer' +import { CodewhispererServerFactory, getLanguageIdFromUri } from './codeWhispererServer' import { CodeWhispererServiceBase, CodeWhispererServiceToken, @@ -2427,4 +2427,51 @@ describe('CodeWhisperer Server', () => { TestAmazonQServiceManager.resetInstance() }) }) + describe('getLanguageIdFromUri', () => { + it('should return python for notebook cell URIs', () => { + const uri = 'vscode-notebook-cell:/some/path/notebook.ipynb#cell1' + assert.strictEqual(getLanguageIdFromUri(uri), 'python') + }) + + it('should return abap for files with ABAP extensions', () => { + const uris = ['file:///path/to/file.asprog'] + + uris.forEach(uri => { + assert.strictEqual(getLanguageIdFromUri(uri), 'abap') + }) + }) + + it('should return empty string for non-ABAP files', () => { + const uris = ['file:///path/to/file.js', 'file:///path/to/file.ts', 'file:///path/to/file.py'] + + uris.forEach(uri => { + assert.strictEqual(getLanguageIdFromUri(uri), '') + }) + }) + + it('should return empty string for invalid URIs', () => { + const invalidUris = ['', 'invalid-uri', 'file:///'] + + invalidUris.forEach(uri => { + assert.strictEqual(getLanguageIdFromUri(uri), '') + }) + }) + + it('should log errors when provided with a logging object', () => { + const mockLogger = { + log: sinon.spy(), + } + + const invalidUri = {} as string // Force type error + getLanguageIdFromUri(invalidUri, mockLogger) + + sinon.assert.calledOnce(mockLogger.log) + sinon.assert.calledWith(mockLogger.log, sinon.match(/Error parsing URI to determine language:.*/)) + }) + + it('should handle URIs without extensions', () => { + const uri = 'file:///path/to/file' + assert.strictEqual(getLanguageIdFromUri(uri), '') + }) + }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts index 23a72e3528..c1f2b464b2 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts @@ -15,13 +15,14 @@ import { } from '@aws/language-server-runtimes/server-interface' import { autoTrigger, getAutoTriggerType, getNormalizeOsName, triggerType } from './auto-trigger/autoTrigger' import { + FileContext, GenerateSuggestionsRequest, GenerateSuggestionsResponse, getFileContext, Suggestion, SuggestionType, } from '../../shared/codeWhispererService' -import { getSupportedLanguageId } from '../../shared/languageDetection' +import { CodewhispererLanguage, getSupportedLanguageId } from '../../shared/languageDetection' import { mergeEditSuggestionsWithFileContext, truncateOverlapWithRightContext } from './mergeRightUtils' import { CodeWhispererSession, SessionManager } from './session/sessionManager' import { CodePercentageTracker } from './codePercentage' @@ -41,7 +42,6 @@ import { AmazonQWorkspaceConfig } from '../../shared/amazonQServiceManager/confi import { hasConnectionExpired } from '../../shared/utils' import { getOrThrowBaseIAMServiceManager } from '../../shared/amazonQServiceManager/AmazonQIAMServiceManager' import { WorkspaceFolderManager } from '../workspaceContext/workspaceFolderManager' -import path = require('path') import { UserWrittenCodeTracker } from '../../shared/userWrittenCodeTracker' import { RecentEditTracker, RecentEditTrackerDefaultConfig } from './tracker/codeEditTracker' import { CursorTracker } from './tracker/cursorTracker' @@ -191,7 +191,10 @@ export const CodewhispererServerFactory = return EMPTY_RESULT } - const inferredLanguageId = getSupportedLanguageId(textDocument) + let inferredLanguageId = getSupportedLanguageId(textDocument) + if (params.fileContextOverride?.programmingLanguage) { + inferredLanguageId = params.fileContextOverride?.programmingLanguage as CodewhispererLanguage + } if (!inferredLanguageId) { logging.log( `textDocument [${params.textDocument.uri}] with languageId [${textDocument.languageId}] not supported` @@ -204,12 +207,29 @@ export const CodewhispererServerFactory = params.context.triggerKind == InlineCompletionTriggerKind.Automatic const maxResults = isAutomaticLspTriggerKind ? 1 : 5 const selectionRange = params.context.selectedCompletionInfo?.range - const fileContext = getFileContext({ - textDocument, - inferredLanguageId, - position: params.position, - workspaceFolder: workspace.getWorkspaceFolder(textDocument.uri), - }) + + // For Jupyter Notebook in VSC, the language server does not have access to + // its internal states including current active cell index, etc + // we rely on VSC to calculate file context + let fileContext: FileContext | undefined = undefined + if (params.fileContextOverride) { + fileContext = { + leftFileContent: params.fileContextOverride.leftFileContent, + rightFileContent: params.fileContextOverride.rightFileContent, + filename: params.fileContextOverride.filename, + fileUri: params.fileContextOverride.fileUri, + programmingLanguage: { + languageName: inferredLanguageId, + }, + } + } else { + fileContext = getFileContext({ + textDocument, + inferredLanguageId, + position: params.position, + workspaceFolder: workspace.getWorkspaceFolder(textDocument.uri), + }) + } const workspaceState = WorkspaceFolderManager.getInstance()?.getWorkspaceState() const workspaceId = workspaceState?.webSocketClient?.isConnected() @@ -327,7 +347,7 @@ export const CodewhispererServerFactory = document: textDocument, startPosition: params.position, triggerType: isAutomaticLspTriggerKind ? 'AutoTrigger' : 'OnDemand', - language: fileContext.programmingLanguage.languageName, + language: fileContext.programmingLanguage.languageName as CodewhispererLanguage, requestContext: requestContext, autoTriggerType: isAutomaticLspTriggerKind ? codewhispererAutoTriggerType : undefined, triggerCharacter: triggerCharacters, @@ -892,8 +912,12 @@ export const CodewhispererServerFactory = export const CodeWhispererServerIAM = CodewhispererServerFactory(getOrThrowBaseIAMServiceManager) export const CodeWhispererServerToken = CodewhispererServerFactory(getOrThrowBaseTokenServiceManager) -const getLanguageIdFromUri = (uri: string, logging?: any): string => { +export const getLanguageIdFromUri = (uri: string, logging?: any): string => { try { + if (uri.startsWith('vscode-notebook-cell:')) { + // use python for now as lsp does not support JL cell language detection + return 'python' + } const extension = uri.split('.').pop()?.toLowerCase() return ABAP_EXTENSIONS.has(extension || '') ? 'abap' : '' } catch (err) { diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/trigger.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/trigger.ts index 06453355a8..305b9b6e5c 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/trigger.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/trigger.ts @@ -1,24 +1,19 @@ -import { CodewhispererLanguage } from '../../shared/languageDetection' import { SessionManager } from './session/sessionManager' import { InlineCompletionWithReferencesParams } from '@aws/language-server-runtimes/protocol' import { editPredictionAutoTrigger } from './auto-trigger/editPredictionAutoTrigger' import { CursorTracker } from './tracker/cursorTracker' import { RecentEditTracker } from './tracker/codeEditTracker' -import { CodeWhispererServiceBase, CodeWhispererServiceToken } from '../../shared/codeWhispererService' +import { + CodeWhispererServiceBase, + CodeWhispererServiceToken, + ClientFileContext, +} from '../../shared/codeWhispererService' export class NepTrigger {} export function shouldTriggerEdits( service: CodeWhispererServiceBase, - fileContext: { - fileUri: string - filename: string - programmingLanguage: { - languageName: CodewhispererLanguage - } - leftFileContent: string - rightFileContent: string - }, + fileContext: ClientFileContext, inlineParams: InlineCompletionWithReferencesParams, cursorTracker: CursorTracker, recentEditsTracker: RecentEditTracker, diff --git a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts index aafc0aaf4d..01101d68a8 100644 --- a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts +++ b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts @@ -71,20 +71,22 @@ export interface GenerateSuggestionsResponse { responseContext: ResponseContext } +export interface ClientFileContext { + leftFileContent: string + rightFileContent: string + filename: string + fileUri: string + programmingLanguage: { + languageName: CodewhispererLanguage + } +} + export function getFileContext(params: { textDocument: TextDocument position: Position inferredLanguageId: CodewhispererLanguage workspaceFolder: WorkspaceFolder | null | undefined -}): { - fileUri: string - filename: string - programmingLanguage: { - languageName: CodewhispererLanguage - } - leftFileContent: string - rightFileContent: string -} { +}): ClientFileContext { const left = params.textDocument.getText({ start: { line: 0, character: 0 }, end: params.position, diff --git a/server/aws-lsp-identity/package.json b/server/aws-lsp-identity/package.json index e8cb3b2c8a..acaeb6d15d 100644 --- a/server/aws-lsp-identity/package.json +++ b/server/aws-lsp-identity/package.json @@ -26,7 +26,7 @@ "dependencies": { "@aws-sdk/client-sso-oidc": "^3.616.0", "@aws-sdk/token-providers": "^3.744.0", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.12", "@smithy/node-http-handler": "^3.2.5", "@smithy/shared-ini-file-loader": "^4.0.1", diff --git a/server/aws-lsp-json/package.json b/server/aws-lsp-json/package.json index 298f3820f0..7b1768f995 100644 --- a/server/aws-lsp-json/package.json +++ b/server/aws-lsp-json/package.json @@ -26,7 +26,7 @@ "prepack": "shx cp ../../LICENSE ../../NOTICE ../../SECURITY.md ." }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.13", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" diff --git a/server/aws-lsp-notification/package.json b/server/aws-lsp-notification/package.json index a9e3cf9d4c..45194be66b 100644 --- a/server/aws-lsp-notification/package.json +++ b/server/aws-lsp-notification/package.json @@ -22,7 +22,7 @@ "coverage:report": "c8 report --reporter=html --reporter=text" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1" }, diff --git a/server/aws-lsp-partiql/package.json b/server/aws-lsp-partiql/package.json index 9ff685cfdc..263275dced 100644 --- a/server/aws-lsp-partiql/package.json +++ b/server/aws-lsp-partiql/package.json @@ -24,7 +24,7 @@ "out" ], "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "antlr4-c3": "3.4.2", "antlr4ng": "3.0.14", "web-tree-sitter": "0.22.6" diff --git a/server/aws-lsp-s3/package.json b/server/aws-lsp-s3/package.json index caa7801b5f..53355ff18a 100644 --- a/server/aws-lsp-s3/package.json +++ b/server/aws-lsp-s3/package.json @@ -9,7 +9,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.623.0", "@aws-sdk/types": "^3.734.0", - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" diff --git a/server/aws-lsp-yaml/package.json b/server/aws-lsp-yaml/package.json index 58fd5e591d..deeddd9694 100644 --- a/server/aws-lsp-yaml/package.json +++ b/server/aws-lsp-yaml/package.json @@ -26,7 +26,7 @@ "postinstall": "node patchYamlPackage.js" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "@aws/lsp-core": "^0.0.13", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", diff --git a/server/device-sso-auth-lsp/package.json b/server/device-sso-auth-lsp/package.json index 573170a3a9..698bbf353e 100644 --- a/server/device-sso-auth-lsp/package.json +++ b/server/device-sso-auth-lsp/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "vscode-languageserver": "^9.0.1" }, "devDependencies": { diff --git a/server/hello-world-lsp/package.json b/server/hello-world-lsp/package.json index 827509803e..a0ad8e8469 100644 --- a/server/hello-world-lsp/package.json +++ b/server/hello-world-lsp/package.json @@ -13,7 +13,7 @@ "coverage:report": "c8 report --reporter=html --reporter=text" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.123", + "@aws/language-server-runtimes": "^0.2.125", "vscode-languageserver": "^9.0.1" }, "devDependencies": { From 93cf229149ba60491f9f5763793db4a9f570b611 Mon Sep 17 00:00:00 2001 From: Tai Lai Date: Wed, 13 Aug 2025 16:19:26 -0700 Subject: [PATCH 02/74] feat(amazonq): read tool ui revamp (#2113) (#2121) * feat(amazonq): read tool ui revamp * feat(amazonq): read tool message revamp (#2049) * feat(amazonq): read tool message revamp * fix tests * feat: file search ui (#2078) * feat: file search ui * fix tests * fix integration tests * remove unnecessary type check * fix: use quotes instead of backticks * fix header update issue * fix integration test --- chat-client/src/client/mynahUi.ts | 16 +- .../src/tests/agenticChatInteg.test.ts | 13 +- .../agenticChat/agenticChatController.test.ts | 6 +- .../agenticChat/agenticChatController.ts | 188 ++++++++++++------ .../agenticChat/agenticChatResultStream.ts | 63 ++---- .../agenticChat/tools/fileSearch.ts | 4 + 6 files changed, 163 insertions(+), 127 deletions(-) diff --git a/chat-client/src/client/mynahUi.ts b/chat-client/src/client/mynahUi.ts index 3b42249331..527dea06f3 100644 --- a/chat-client/src/client/mynahUi.ts +++ b/chat-client/src/client/mynahUi.ts @@ -1353,10 +1353,15 @@ export const createMynahUi = ( fileTreeTitle: '', hideFileCount: true, details: toDetailsWithoutIcon(header.fileList.details), + renderAsPills: + !header.fileList.details || + (Object.values(header.fileList.details).every(detail => !detail.changes) && + (!header.buttons || !header.buttons.some(button => button.id === 'undo-changes')) && + !header.status?.icon), } } if (!isPartialResult) { - if (processedHeader) { + if (processedHeader && !message.header?.status) { processedHeader.status = undefined } } @@ -1369,7 +1374,8 @@ export const createMynahUi = ( processedHeader.buttons !== null && processedHeader.buttons.length > 0) || processedHeader.status !== undefined || - processedHeader.icon !== undefined) + processedHeader.icon !== undefined || + processedHeader.fileList !== undefined) const padding = message.type === 'tool' ? (fileList ? true : message.messageId?.endsWith('_permission')) : undefined @@ -1380,8 +1386,10 @@ export const createMynahUi = ( // Adding this conditional check to show the stop message in the center. const contentHorizontalAlignment: ChatItem['contentHorizontalAlignment'] = undefined - // If message.header?.status?.text is Stopped or Rejected or Ignored or Completed etc.. card should be in disabled state. - const shouldMute = message.header?.status?.text !== undefined && message.header?.status?.text !== 'Completed' + // If message.header?.status?.text is Stopped or Rejected or Ignored etc.. card should be in disabled state. + const shouldMute = + message.header?.status?.text !== undefined && + ['Stopped', 'Rejected', 'Ignored', 'Failed', 'Error'].includes(message.header.status.text) return { body: message.body, diff --git a/integration-tests/q-agentic-chat-server/src/tests/agenticChatInteg.test.ts b/integration-tests/q-agentic-chat-server/src/tests/agenticChatInteg.test.ts index 897ee02071..c5a8046bd5 100644 --- a/integration-tests/q-agentic-chat-server/src/tests/agenticChatInteg.test.ts +++ b/integration-tests/q-agentic-chat-server/src/tests/agenticChatInteg.test.ts @@ -169,11 +169,11 @@ describe('Q Agentic Chat Server Integration Tests', async () => { expect(decryptedResult.additionalMessages).to.be.an('array') const fsReadMessage = decryptedResult.additionalMessages?.find( - msg => msg.type === 'tool' && msg.fileList?.rootFolderTitle === '1 file read' + msg => msg.type === 'tool' && msg.header?.body === '1 file read' ) expect(fsReadMessage).to.exist const expectedPath = path.join(rootPath, 'test.py') - const actualPaths = fsReadMessage?.fileList?.filePaths?.map(normalizePath) || [] + const actualPaths = fsReadMessage?.header?.fileList?.filePaths?.map(normalizePath) || [] expect(actualPaths).to.include.members([normalizePath(expectedPath)]) expect(fsReadMessage?.messageId?.startsWith('tooluse_')).to.be.true }) @@ -191,10 +191,10 @@ describe('Q Agentic Chat Server Integration Tests', async () => { expect(decryptedResult.additionalMessages).to.be.an('array') const listDirectoryMessage = decryptedResult.additionalMessages?.find( - msg => msg.type === 'tool' && msg.fileList?.rootFolderTitle === '1 directory listed' + msg => msg.type === 'tool' && msg.header?.body === '1 directory listed' ) expect(listDirectoryMessage).to.exist - const actualPaths = listDirectoryMessage?.fileList?.filePaths?.map(normalizePath) || [] + const actualPaths = listDirectoryMessage?.header?.fileList?.filePaths?.map(normalizePath) || [] expect(actualPaths).to.include.members([normalizePath(rootPath)]) expect(listDirectoryMessage?.messageId?.startsWith('tooluse_')).to.be.true }) @@ -371,11 +371,12 @@ describe('Q Agentic Chat Server Integration Tests', async () => { expect(decryptedResult.additionalMessages).to.be.an('array') const fileSearchMessage = decryptedResult.additionalMessages?.find( - msg => msg.type === 'tool' && msg.fileList?.rootFolderTitle === '1 directory searched' + msg => msg.type === 'tool' && msg.header?.body === 'Searched for "test" in ' ) expect(fileSearchMessage).to.exist expect(fileSearchMessage?.messageId?.startsWith('tooluse_')).to.be.true - const actualPaths = fileSearchMessage?.fileList?.filePaths?.map(normalizePath) || [] + expect(fileSearchMessage?.header?.status?.text).to.equal('3 results found') + const actualPaths = fileSearchMessage?.header?.fileList?.filePaths?.map(normalizePath) || [] expect(actualPaths).to.include.members([normalizePath(rootPath)]) }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts index 6c8af7a272..616848d0b5 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts @@ -451,7 +451,7 @@ describe('AgenticChatController', () => { assert.deepStrictEqual(chatResult, { additionalMessages: [], - body: '\n\nHello World!', + body: '\nHello World!', messageId: 'mock-message-id', buttons: [], codeReference: [], @@ -1150,7 +1150,7 @@ describe('AgenticChatController', () => { sinon.assert.callCount(testFeatures.lsp.sendProgress, mockChatResponseList.length + 1) // response length + 1 loading messages assert.deepStrictEqual(chatResult, { additionalMessages: [], - body: '\n\nHello World!', + body: '\nHello World!', messageId: 'mock-message-id', codeReference: [], buttons: [], @@ -1169,7 +1169,7 @@ describe('AgenticChatController', () => { sinon.assert.callCount(testFeatures.lsp.sendProgress, mockChatResponseList.length + 1) // response length + 1 loading message assert.deepStrictEqual(chatResult, { additionalMessages: [], - body: '\n\nHello World!', + body: '\nHello World!', messageId: 'mock-message-id', buttons: [], codeReference: [], diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 72217fae07..09bf965819 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -169,7 +169,7 @@ import { ExecuteBash, ExecuteBashParams } from './tools/executeBash' import { ExplanatoryParams, InvokeOutput, ToolApprovalException } from './tools/toolShared' import { validatePathBasic, validatePathExists, validatePaths as validatePathsSync } from './utils/pathValidation' import { GrepSearch, SanitizedRipgrepOutput } from './tools/grepSearch' -import { FileSearch, FileSearchParams } from './tools/fileSearch' +import { FileSearch, FileSearchParams, isFileSearchParams } from './tools/fileSearch' import { FsReplace, FsReplaceParams } from './tools/fsReplace' import { loggingUtils, timeoutUtils } from '@aws/lsp-core' import { diffLines } from 'diff' @@ -1695,8 +1695,7 @@ export class AgenticChatController implements ChatHandlers { // remove progress UI await chatResultStream.removeResultBlockAndUpdateUI(progressPrefix + toolUse.toolUseId) - // fsRead and listDirectory write to an existing card and could show nothing in the current position - if (![FS_WRITE, FS_REPLACE, FS_READ, LIST_DIRECTORY].includes(toolUse.name)) { + if (![FS_WRITE, FS_REPLACE].includes(toolUse.name)) { await this.#showUndoAllIfRequired(chatResultStream, session) } // fsWrite can take a long time, so we render fsWrite Explanatory upon partial streaming responses. @@ -1911,10 +1910,19 @@ export class AgenticChatController implements ChatHandlers { switch (toolUse.name) { case FS_READ: case LIST_DIRECTORY: + const readToolResult = await this.#processReadTool(toolUse, chatResultStream) + if (readToolResult) { + await chatResultStream.writeResultBlock(readToolResult) + } + break case FILE_SEARCH: - const initialListDirResult = this.#processReadOrListOrSearch(toolUse, chatResultStream) - if (initialListDirResult) { - await chatResultStream.writeResultBlock(initialListDirResult) + if (isFileSearchParams(toolUse.input)) { + await this.#processFileSearchTool( + toolUse.input, + toolUse.toolUseId, + result, + chatResultStream + ) } break // no need to write tool result for listDir,fsRead,fileSearch into chat stream @@ -2315,7 +2323,6 @@ export class AgenticChatController implements ChatHandlers { } const toolMsgId = toolUse.toolUseId! - const chatMsgId = chatResultStream.getResult().messageId let headerEmitted = false const initialHeader: ChatMessage['header'] = { @@ -2353,13 +2360,6 @@ export class AgenticChatController implements ChatHandlers { header: completedHeader, }) - await chatResultStream.writeResultBlock({ - type: 'answer', - messageId: chatMsgId, - body: '', - header: undefined, - }) - this.#stoppedToolUses.add(toolMsgId) }, }) @@ -2877,70 +2877,135 @@ export class AgenticChatController implements ChatHandlers { } } - #processReadOrListOrSearch(toolUse: ToolUse, chatResultStream: AgenticChatResultStream): ChatMessage | undefined { - let messageIdToUpdate = toolUse.toolUseId! - const currentId = chatResultStream.getMessageIdToUpdateForTool(toolUse.name!) + async #processFileSearchTool( + toolInput: FileSearchParams, + toolUseId: string, + result: InvokeOutput, + chatResultStream: AgenticChatResultStream + ): Promise { + if (typeof result.output.content !== 'string') return - if (currentId) { - messageIdToUpdate = currentId - } else { - chatResultStream.setMessageIdToUpdateForTool(toolUse.name!, messageIdToUpdate) + const { queryName, path: inputPath } = toolInput + const resultCount = result.output.content + .split('\n') + .filter(line => line.trim().startsWith('[F]') || line.trim().startsWith('[D]')).length + + const chatMessage: ChatMessage = { + type: 'tool', + messageId: toolUseId, + header: { + body: `Searched for "${queryName}" in `, + icon: 'search', + status: { + text: `${resultCount} result${resultCount !== 1 ? 's' : ''} found`, + }, + fileList: { + filePaths: [inputPath], + details: { + [inputPath]: { + description: inputPath, + visibleName: path.basename(inputPath), + clickable: false, + }, + }, + }, + }, } - let currentPaths = [] + await chatResultStream.writeResultBlock(chatMessage) + } + + async #processReadTool( + toolUse: ToolUse, + chatResultStream: AgenticChatResultStream + ): Promise { + let currentPaths: string[] = [] if (toolUse.name === FS_READ) { - currentPaths = (toolUse.input as unknown as FsReadParams)?.paths + currentPaths = (toolUse.input as unknown as FsReadParams)?.paths || [] + } else if (toolUse.name === LIST_DIRECTORY) { + const singlePath = (toolUse.input as unknown as ListDirectoryParams)?.path + if (singlePath) { + currentPaths = [singlePath] + } + } else if (toolUse.name === FILE_SEARCH) { + const queryName = (toolUse.input as unknown as FileSearchParams)?.queryName + if (queryName) { + currentPaths = [queryName] + } } else { - currentPaths.push((toolUse.input as unknown as ListDirectoryParams | FileSearchParams)?.path) + return } - if (!currentPaths) return + if (currentPaths.length === 0) return - for (const currentPath of currentPaths) { - const existingPaths = chatResultStream.getMessageOperation(messageIdToUpdate)?.filePaths || [] - // Check if path already exists in the list - const isPathAlreadyProcessed = existingPaths.some(path => path.relativeFilePath === currentPath) - if (!isPathAlreadyProcessed) { - const currentFileDetail = { - relativeFilePath: currentPath, - lineRanges: [{ first: -1, second: -1 }], - } - chatResultStream.addMessageOperation(messageIdToUpdate, toolUse.name!, [ - ...existingPaths, - currentFileDetail, - ]) + // Check if the last message is the same tool type + const lastMessage = chatResultStream.getLastMessage() + const isSameToolType = + lastMessage?.type === 'tool' && lastMessage.header?.icon === this.#toolToIcon(toolUse.name) + + let allPaths = currentPaths + + if (isSameToolType && lastMessage.messageId) { + // Combine with existing paths and overwrite the last message + const existingPaths = lastMessage.header?.fileList?.filePaths || [] + allPaths = [...existingPaths, ...currentPaths] + + const blockId = chatResultStream.getMessageBlockId(lastMessage.messageId) + if (blockId !== undefined) { + // Create the updated message with combined paths + const updatedMessage = this.#createFileListToolMessage(toolUse, allPaths, lastMessage.messageId) + // Overwrite the existing block + await chatResultStream.overwriteResultBlock(updatedMessage, blockId) + return undefined // Don't return a message since we already wrote it } } + + // Create new message with current paths + return this.#createFileListToolMessage(toolUse, allPaths, toolUse.toolUseId!) + } + + #createFileListToolMessage(toolUse: ToolUse, filePaths: string[], messageId: string): ChatMessage { + const itemCount = filePaths.length let title: string - const itemCount = chatResultStream.getMessageOperation(messageIdToUpdate)?.filePaths.length - const filePathsPushed = chatResultStream.getMessageOperation(messageIdToUpdate)?.filePaths ?? [] - if (!itemCount) { + if (itemCount === 0) { title = 'Gathering context' } else { title = toolUse.name === FS_READ ? `${itemCount} file${itemCount > 1 ? 's' : ''} read` - : toolUse.name === FILE_SEARCH - ? `${itemCount} ${itemCount === 1 ? 'directory' : 'directories'} searched` - : `${itemCount} ${itemCount === 1 ? 'directory' : 'directories'} listed` + : toolUse.name === LIST_DIRECTORY + ? `${itemCount} ${itemCount === 1 ? 'directory' : 'directories'} listed` + : '' } const details: Record = {} - for (const item of filePathsPushed) { - details[item.relativeFilePath] = { - lineRanges: item.lineRanges, - description: item.relativeFilePath, + for (const filePath of filePaths) { + details[filePath] = { + description: filePath, + visibleName: path.basename(filePath), + clickable: toolUse.name === FS_READ, } } - - const fileList: FileList = { - rootFolderTitle: title, - filePaths: filePathsPushed.map(item => item.relativeFilePath), - details, - } return { type: 'tool', - fileList, - messageId: messageIdToUpdate, - body: '', + header: { + body: title, + icon: this.#toolToIcon(toolUse.name), + fileList: { + filePaths, + details, + }, + }, + messageId, + } + } + + #toolToIcon(toolName: string | undefined): string | undefined { + switch (toolName) { + case FS_READ: + return 'eye' + case LIST_DIRECTORY: + return 'check-list' + default: + return undefined } } @@ -2956,14 +3021,7 @@ export class AgenticChatController implements ChatHandlers { return undefined } - let messageIdToUpdate = toolUse.toolUseId! - const currentId = chatResultStream.getMessageIdToUpdateForTool(toolUse.name!) - - if (currentId) { - messageIdToUpdate = currentId - } else { - chatResultStream.setMessageIdToUpdateForTool(toolUse.name!, messageIdToUpdate) - } + const messageIdToUpdate = toolUse.toolUseId! // Extract search results from the tool output const output = result.output.content as SanitizedRipgrepOutput diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatResultStream.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatResultStream.ts index 70b3452361..195e1e880b 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatResultStream.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatResultStream.ts @@ -1,4 +1,4 @@ -import { ChatResult, FileDetails, ChatMessage } from '@aws/language-server-runtimes/protocol' +import { ChatResult, ChatMessage } from '@aws/language-server-runtimes/protocol' import { randomUUID } from 'crypto' export interface ResultStreamWriter { @@ -32,33 +32,20 @@ export interface ResultStreamWriter { close(): Promise } +export const progressPrefix = 'progress_' + /** * This class wraps around lsp.sendProgress to provide a more helpful interface for streaming a ChatResult to the client. * ChatResults are grouped into blocks that can be written directly, or streamed in. * In the final message, blocks are seperated by resultDelimiter defined below. */ - -interface FileDetailsWithPath extends FileDetails { - relativeFilePath: string -} - -type OperationType = 'read' | 'write' | 'listDir' - -export const progressPrefix = 'progress_' - -interface FileOperation { - type: OperationType - filePaths: FileDetailsWithPath[] -} export class AgenticChatResultStream { - static readonly resultDelimiter = '\n\n' + static readonly resultDelimiter = '\n' #state = { chatResultBlocks: [] as ChatMessage[], isLocked: false, uuid: randomUUID(), messageId: undefined as string | undefined, - messageIdToUpdateForTool: new Map(), - messageOperations: new Map(), } readonly #sendProgress: (newChatResult: ChatResult | string) => Promise @@ -70,33 +57,6 @@ export class AgenticChatResultStream { return this.#joinResults(this.#state.chatResultBlocks, only) } - setMessageIdToUpdateForTool(toolName: string, messageId: string) { - this.#state.messageIdToUpdateForTool.set(toolName as OperationType, messageId) - } - - getMessageIdToUpdateForTool(toolName: string): string | undefined { - return this.#state.messageIdToUpdateForTool.get(toolName as OperationType) - } - - /** - * Adds a file operation for a specific message - * @param messageId The ID of the message - * @param type The type of operation ('fsRead' or 'listDirectory' or 'fsWrite') - * @param filePaths Array of FileDetailsWithPath involved in the operation - */ - addMessageOperation(messageId: string, type: string, filePaths: FileDetailsWithPath[]) { - this.#state.messageOperations.set(messageId, { type: type as OperationType, filePaths }) - } - - /** - * Gets the file operation details for a specific message - * @param messageId The ID of the message - * @returns The file operation details or undefined if not found - */ - getMessageOperation(messageId: string): FileOperation | undefined { - return this.#state.messageOperations.get(messageId) - } - #joinResults(chatResults: ChatMessage[], only?: string): ChatResult { const result: ChatResult = { body: '', @@ -111,9 +71,9 @@ export class AgenticChatResultStream { return { ...acc, buttons: [...(acc.buttons ?? []), ...(c.buttons ?? [])], - body: acc.body + AgenticChatResultStream.resultDelimiter + c.body, - ...(c.contextList && { contextList: c.contextList }), - header: Object.prototype.hasOwnProperty.call(c, 'header') ? c.header : acc.header, + body: acc.body + (c.body ? AgenticChatResultStream.resultDelimiter + c.body : ''), + ...(c.contextList && c.type !== 'tool' && { contextList: c.contextList }), + header: c.header !== undefined ? c.header : acc.header, codeReference: [...(acc.codeReference ?? []), ...(c.codeReference ?? [])], } } else if (acc.additionalMessages!.some(am => am.messageId === c.messageId)) { @@ -127,9 +87,10 @@ export class AgenticChatResultStream { : am.buttons, body: am.messageId === c.messageId - ? am.body + AgenticChatResultStream.resultDelimiter + c.body + ? am.body + (c.body ? AgenticChatResultStream.resultDelimiter + c.body : '') : am.body, ...(am.messageId === c.messageId && + c.type !== 'tool' && (c.contextList || acc.contextList) && { contextList: { filePaths: [ @@ -161,7 +122,7 @@ export class AgenticChatResultStream { }, }, }), - header: Object.prototype.hasOwnProperty.call(c, 'header') ? c.header : am.header, + ...(am.messageId === c.messageId && c.header !== undefined && { header: c.header }), })), } } else { @@ -246,6 +207,10 @@ export class AgenticChatResultStream { return undefined } + getLastMessage(): ChatMessage { + return this.#state.chatResultBlocks[this.#state.chatResultBlocks.length - 1] + } + getResultStreamWriter(): ResultStreamWriter { // Note: if write calls are not awaited, stream can be out-of-order. if (this.#state.isLocked) { diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/fileSearch.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/fileSearch.ts index fb6486996e..37d11afe4f 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/fileSearch.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/fileSearch.ts @@ -158,3 +158,7 @@ export class FileSearch { } as const } } + +export function isFileSearchParams(input: any): input is FileSearchParams { + return input && typeof input.path === 'string' && typeof input.queryName === 'string' +} From 8975f10e3e709da20f164397604a54df83202f8b Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:09:38 -0700 Subject: [PATCH 03/74] refactor: improve generateCompletion logging format (#2125) --- .../src/shared/codeWhispererService.ts | 72 ++++++++++--------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts index 01101d68a8..030f7f7ee4 100644 --- a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts +++ b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts @@ -422,58 +422,60 @@ export class CodeWhispererServiceToken extends CodeWhispererServiceBase { async generateSuggestions(request: GenerateSuggestionsRequest): Promise { // add cancellation check // add error check - if (this.customizationArn) request.customizationArn = this.customizationArn - const beforeApiCall = performance.now() - let recentEditsLogStr = '' - const recentEdits = request.supplementalContexts?.filter(it => it.type === 'PreviousEditorState') - if (recentEdits) { - if (recentEdits.length === 0) { - recentEditsLogStr += `No recent edits` - } else { - recentEditsLogStr += '\n' - for (let i = 0; i < recentEdits.length; i++) { - const e = recentEdits[i] - recentEditsLogStr += `[recentEdits ${i}th]:\n` - recentEditsLogStr += `${e.content}\n` + let logstr = `GenerateCompletion activity:\n` + try { + if (this.customizationArn) request.customizationArn = this.customizationArn + const beforeApiCall = performance.now() + let recentEditsLogStr = '' + const recentEdits = request.supplementalContexts?.filter(it => it.type === 'PreviousEditorState') + if (recentEdits) { + if (recentEdits.length === 0) { + recentEditsLogStr += `No recent edits` + } else { + recentEditsLogStr += '\n' + for (let i = 0; i < recentEdits.length; i++) { + const e = recentEdits[i] + recentEditsLogStr += `[recentEdits ${i}th]:\n` + recentEditsLogStr += `${e.content}\n` + } } } - } - this.logging.info( - `GenerateCompletion request: + logstr += `@@request metadata@@ "endpoint": ${this.codeWhispererEndpoint}, "predictionType": ${request.predictionTypes?.toString() ?? 'Not specified (COMPLETIONS)'}, "filename": ${request.fileContext.filename}, "language": ${request.fileContext.programmingLanguage.languageName}, "supplementalContextCount": ${request.supplementalContexts?.length ?? 0}, "request.nextToken": ${request.nextToken}, - "recentEdits": ${recentEditsLogStr}` - ) + "recentEdits": ${recentEditsLogStr}\n` - const response = await this.client.generateCompletions(this.withProfileArn(request)).promise() + const response = await this.client.generateCompletions(this.withProfileArn(request)).promise() - const responseContext = { - requestId: response?.$response?.requestId, - codewhispererSessionId: response?.$response?.httpResponse?.headers['x-amzn-sessionid'], - nextToken: response.nextToken, - } + const responseContext = { + requestId: response?.$response?.requestId, + codewhispererSessionId: response?.$response?.httpResponse?.headers['x-amzn-sessionid'], + nextToken: response.nextToken, + } - const r = this.mapCodeWhispererApiResponseToSuggestion(response, responseContext) - const firstSuggestionLogstr = r.suggestions.length > 0 ? `\n${r.suggestions[0].content}` : 'No suggestion' + const r = this.mapCodeWhispererApiResponseToSuggestion(response, responseContext) + const firstSuggestionLogstr = r.suggestions.length > 0 ? `\n${r.suggestions[0].content}` : 'No suggestion' - this.logging.info( - `GenerateCompletion response: - "endpoint": ${this.codeWhispererEndpoint}, + logstr += `@@response metadata@@ "requestId": ${responseContext.requestId}, "sessionId": ${responseContext.codewhispererSessionId}, - "responseCompletionCount": ${response.completions?.length ?? 0}, - "responsePredictionCount": ${response.predictions?.length ?? 0}, - "predictionType": ${request.predictionTypes?.toString() ?? ''}, + "response.completions.length": ${response.completions?.length ?? 0}, + "response.predictions.length": ${response.predictions?.length ?? 0}, "latency": ${performance.now() - beforeApiCall}, - "filename": ${request.fileContext.filename}, "response.nextToken": ${response.nextToken}, "firstSuggestion": ${firstSuggestionLogstr}` - ) - return r + + return r + } catch (e) { + logstr += `error: ${(e as Error).message}` + throw e + } finally { + this.logging.info(logstr) + } } private mapCodeWhispererApiResponseToSuggestion( From 0e23e2d29b8cad14403d372b9bbb08ca8ffa7ac7 Mon Sep 17 00:00:00 2001 From: BlakeLazarine Date: Thu, 14 Aug 2025 12:36:43 -0700 Subject: [PATCH 04/74] fix(amazonq): handle case where multiple rules are provided with the same name (#2118) * fix(amazonq): handle case where multiple rules are provided with the same name * fix(amazonq): add unit test for duplicate custom guidelines * fix(amazonq): add unit test for processToolUses * fix(amazonq): set context type for AmazonQ.md to rule * fix(amazonq): add README.md back as rule context type --------- Co-authored-by: Blake Lazarine --- .../agenticChat/agenticChatController.test.ts | 86 ++++++++++++++++++- .../agenticChat/agenticChatController.ts | 25 ++++-- .../tools/qCodeAnalysis/codeReview.test.ts | 28 ++++++ .../tools/qCodeAnalysis/codeReview.ts | 5 ++ 4 files changed, 134 insertions(+), 10 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts index 616848d0b5..a307ce3fc6 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts @@ -241,7 +241,7 @@ describe('AgenticChatController', () => { testFeatures.agent = { runTool: sinon.stub().resolves({}), getTools: sinon.stub().returns( - ['mock-tool-name', 'mock-tool-name-1', 'mock-tool-name-2'].map(toolName => ({ + ['mock-tool-name', 'mock-tool-name-1', 'mock-tool-name-2', 'codeReview'].map(toolName => ({ toolSpecification: { name: toolName, description: 'Mock tool for testing' }, })) ), @@ -3283,6 +3283,90 @@ ${' '.repeat(8)}} assert.strictEqual(returnValue, undefined) }) }) + + describe('processToolUses', () => { + it('filters rule artifacts from additionalContext for CodeReview tool', async () => { + const mockAdditionalContext = [ + { + type: 'file', + description: '', + name: '', + relativePath: '', + startLine: 0, + endLine: 0, + path: '/test/file.js', + }, + { + type: 'rule', + description: '', + name: '', + relativePath: '', + startLine: 0, + endLine: 0, + path: '/test/rule1.json', + }, + { + type: 'rule', + description: '', + name: '', + relativePath: '', + startLine: 0, + endLine: 0, + path: '/test/rule2.json', + }, + ] + + const toolUse = { + toolUseId: 'test-id', + name: 'codeReview', + input: { fileLevelArtifacts: [{ path: '/test/file.js' }] }, + stop: true, + } + + const runToolStub = testFeatures.agent.runTool as sinon.SinonStub + runToolStub.resolves({}) + + // Create a mock session with toolUseLookup + const mockSession = { + toolUseLookup: new Map(), + pairProgrammingMode: true, + } as any + + // Create a minimal mock of AgenticChatResultStream + const mockChatResultStream = { + removeResultBlockAndUpdateUI: sinon.stub().resolves(), + writeResultBlock: sinon.stub().resolves(1), + overwriteResultBlock: sinon.stub().resolves(), + removeResultBlock: sinon.stub().resolves(), + getMessageBlockId: sinon.stub().returns(undefined), + hasMessage: sinon.stub().returns(false), + updateOngoingProgressResult: sinon.stub().resolves(), + getResult: sinon.stub().returns({ messageId: 'test', body: '' }), + setMessageIdToUpdateForTool: sinon.stub(), + getMessageIdToUpdateForTool: sinon.stub().returns(undefined), + addMessageOperation: sinon.stub(), + getMessageOperation: sinon.stub().returns(undefined), + } + + // Call processToolUses directly + await chatController.processToolUses( + [toolUse], + mockChatResultStream as any, + mockSession, + 'tabId', + mockCancellationToken, + mockAdditionalContext + ) + + // Verify runTool was called with ruleArtifacts + sinon.assert.calledOnce(runToolStub) + const toolInput = runToolStub.firstCall.args[1] + assert.ok(toolInput.ruleArtifacts) + assert.strictEqual(toolInput.ruleArtifacts.length, 2) + assert.strictEqual(toolInput.ruleArtifacts[0].path, '/test/rule1.json') + assert.strictEqual(toolInput.ruleArtifacts[1].path, '/test/rule2.json') + }) + }) }) // The body may include text-based progress updates from tool invocations. diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 09bf965819..991d95a6ad 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -1387,7 +1387,14 @@ export class AgenticChatController implements ChatHandlers { session.setConversationType('AgenticChatWithToolUse') if (result.success) { // Process tool uses and update the request input for the next iteration - toolResults = await this.#processToolUses(pendingToolUses, chatResultStream, session, tabId, token) + toolResults = await this.processToolUses( + pendingToolUses, + chatResultStream, + session, + tabId, + token, + additionalContext + ) if (toolResults.some(toolResult => this.#shouldSendBackErrorContent(toolResult))) { content = 'There was an error processing one or more tool uses. Try again, do not apologize.' shouldDisplayMessage = false @@ -1662,12 +1669,13 @@ export class AgenticChatController implements ChatHandlers { /** * Processes tool uses by running the tools and collecting results */ - async #processToolUses( + async processToolUses( toolUses: Array, chatResultStream: AgenticChatResultStream, session: ChatSessionService, tabId: string, - token?: CancellationToken + token?: CancellationToken, + additionalContext?: AdditionalContentEntryAddition[] ): Promise { const results: ToolResult[] = [] @@ -1868,12 +1876,11 @@ export class AgenticChatController implements ChatHandlers { if (toolUse.name === CodeReview.toolName) { try { let initialInput = JSON.parse(JSON.stringify(toolUse.input)) - let ruleArtifacts = await this.#additionalContextProvider.collectWorkspaceRules(tabId) - if (ruleArtifacts !== undefined || ruleArtifacts !== null) { - this.#features.logging.info(`RuleArtifacts: ${JSON.stringify(ruleArtifacts)}`) - let pathsToRulesMap = ruleArtifacts.map(ruleArtifact => ({ path: ruleArtifact.id })) - this.#features.logging.info(`PathsToRules: ${JSON.stringify(pathsToRulesMap)}`) - initialInput['ruleArtifacts'] = pathsToRulesMap + + if (additionalContext !== undefined) { + initialInput['ruleArtifacts'] = additionalContext + .filter(c => c.type === 'rule') + .map(c => ({ path: c.path })) } toolUse.input = initialInput } catch (e) { diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts index c587253bbc..3509cd1730 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts @@ -385,6 +385,34 @@ describe('CodeReview', () => { expect(error.message).to.include('There are no valid files to scan') } }) + + it('should handle duplicate rule filenames with unique UUIDs', async () => { + const fileArtifacts = [{ path: '/test/file.js' }] + const folderArtifacts: any[] = [] + const ruleArtifacts = [{ path: '/test/path1/rule.json' }, { path: '/test/path2/rule.json' }] + + const mockZip = { + file: sandbox.stub(), + generateAsync: sandbox.stub().resolves(Buffer.from('test')), + } + sandbox.stub(JSZip.prototype, 'file').callsFake(mockZip.file) + sandbox.stub(JSZip.prototype, 'generateAsync').callsFake(mockZip.generateAsync) + sandbox.stub(CodeReviewUtils, 'countZipFiles').returns(3) + sandbox.stub(require('crypto'), 'randomUUID').returns('test-uuid-123') + + await (codeReview as any).prepareFilesAndFoldersForUpload( + fileArtifacts, + folderArtifacts, + ruleArtifacts, + false + ) + + // Verify first file uses original name + expect(mockZip.file.firstCall.args[0]).to.include('/test/file.js') + expect(mockZip.file.secondCall.args[0]).to.include('rule.json') + // Verify second file gets UUID suffix + expect(mockZip.file.thirdCall.args[0]).to.include('rule_test-uuid-123.json') + }) }) describe('collectFindings', () => { diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts index adcea2ec33..b1ef4c3e61 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts @@ -716,6 +716,7 @@ export class CodeReview { * @param customerCodeZip JSZip instance for the customer code */ private async processRuleArtifacts(ruleArtifacts: RuleArtifacts, customerCodeZip: JSZip): Promise { + let ruleNameSet = new Set() for (const artifact of ruleArtifacts) { await CodeReviewUtils.withErrorHandling( async () => { @@ -725,6 +726,10 @@ export class CodeReview { !CodeReviewUtils.shouldSkipFile(fileName) && existsSync(artifact.path) ) { + if (ruleNameSet.has(fileName)) { + fileName = fileName.split('.')[0] + '_' + crypto.randomUUID() + '.' + fileName.split('.')[1] + } + ruleNameSet.add(fileName) const fileContent = await this.workspace.fs.readFile(artifact.path) customerCodeZip.file( `${CodeReview.CUSTOMER_CODE_BASE_PATH}/${CodeReview.RULE_ARTIFACT_PATH}/${fileName}`, From 963b6e9b7887da23a85a826c55a6ed95ff36d956 Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:15:39 -0700 Subject: [PATCH 05/74] perf: remove edit completion retry mechanism on document change (#2124) --- .../inline-completion/codeWhispererServer.ts | 4 +- .../inline-completion/constants.ts | 1 - .../editCompletionHandler.ts | 85 ++++++++----------- .../session/sessionManager.ts | 12 ++- 4 files changed, 48 insertions(+), 54 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts index c1f2b464b2..46a3241978 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts @@ -633,7 +633,9 @@ export const CodewhispererServerFactory = } if (session.state !== 'ACTIVE') { - logging.log(`ERROR: Trying to record trigger decision for not-active session ${sessionId}`) + logging.log( + `ERROR: Trying to record trigger decision for not-active session ${sessionId} with wrong state ${session.state}` + ) return } diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/constants.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/constants.ts index c5810924b6..8cab372053 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/constants.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/constants.ts @@ -3,7 +3,6 @@ export const FILENAME_CHARS_LIMIT = 1024 export const CONTEXT_CHARACTERS_LIMIT = 10240 export const EMPTY_RESULT = { sessionId: '', items: [] } export const EDIT_DEBOUNCE_INTERVAL_MS = 500 -export const EDIT_STALE_RETRY_COUNT = 3 // ABAP ADT extensions commonly used with Eclipse export const ABAP_EXTENSIONS = new Set([ 'asprog', diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts index 3c72e368f4..28e29ee271 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts @@ -16,7 +16,6 @@ import { GenerateSuggestionsRequest, GenerateSuggestionsResponse, getFileContext, - SuggestionType, } from '../../shared/codeWhispererService' import { CodeWhispererSession, SessionManager } from './session/sessionManager' import { CursorTracker } from './tracker/cursorTracker' @@ -36,7 +35,7 @@ import { RejectedEditTracker } from './tracker/rejectedEditTracker' import { getErrorMessage, hasConnectionExpired } from '../../shared/utils' import { AmazonQError, AmazonQServiceConnectionExpiredError } from '../../shared/amazonQServiceManager/errors' import { DocumentChangedListener } from './documentChangedListener' -import { EMPTY_RESULT, EDIT_DEBOUNCE_INTERVAL_MS, EDIT_STALE_RETRY_COUNT } from './constants' +import { EMPTY_RESULT, EDIT_DEBOUNCE_INTERVAL_MS } from './constants' export class EditCompletionHandler { private readonly editsEnabled: boolean @@ -74,12 +73,12 @@ export class EditCompletionHandler { */ documentChanged() { if (this.debounceTimeout) { - this.logging.info('[NEP] refresh timeout') - this.debounceTimeout.refresh() - } - - if (this.isWaiting) { - this.hasDocumentChangedSinceInvocation = true + if (this.isWaiting) { + this.hasDocumentChangedSinceInvocation = true + } else { + this.logging.info(`refresh and debounce edits suggestion for another ${EDIT_DEBOUNCE_INTERVAL_MS}`) + this.debounceTimeout.refresh() + } } } @@ -87,9 +86,6 @@ export class EditCompletionHandler { params: InlineCompletionWithReferencesParams, token: CancellationToken ): Promise { - this.hasDocumentChangedSinceInvocation = false - this.debounceTimeout = undefined - // On every new completion request close current inflight session. const currentSession = this.sessionManager.getCurrentSession() if (currentSession && currentSession.state == 'REQUESTING' && !params.partialResultToken) { @@ -156,46 +152,37 @@ export class EditCompletionHandler { } } - // TODO: telemetry, discarded suggestions - // The other easy way to do this is simply not return any suggestion (which is used when retry > 3) - const invokeWithRetry = async (attempt: number = 0): Promise => { - return new Promise(async resolve => { - this.debounceTimeout = setTimeout(async () => { - try { - this.isWaiting = true - const result = await this._invoke( - params, - token, - textDocument, - inferredLanguageId, - currentSession - ).finally(() => { - this.isWaiting = false + return new Promise(async resolve => { + this.debounceTimeout = setTimeout(async () => { + try { + this.isWaiting = true + const result = await this._invoke( + params, + token, + textDocument, + inferredLanguageId, + currentSession + ).finally(() => { + this.isWaiting = false + }) + if (this.hasDocumentChangedSinceInvocation) { + this.logging.info( + 'EditCompletionHandler - Document changed during execution, resolving empty result' + ) + resolve({ + sessionId: SessionManager.getInstance('EDITS').getActiveSession()?.id ?? '', + items: [], }) - if (this.hasDocumentChangedSinceInvocation) { - if (attempt < EDIT_STALE_RETRY_COUNT) { - this.logging.info( - `EditCompletionHandler - Document changed during execution, retrying (attempt ${attempt + 1})` - ) - this.hasDocumentChangedSinceInvocation = false - const retryResult = await invokeWithRetry(attempt + 1) - resolve(retryResult) - } else { - this.logging.info('EditCompletionHandler - Max retries reached, returning empty result') - resolve(EMPTY_RESULT) - } - } else { - this.logging.info('EditCompletionHandler - No document changes, resolving result') - resolve(result) - } - } finally { - this.debounceTimeout = undefined + } else { + this.logging.info('EditCompletionHandler - No document changes, resolving result') + resolve(result) } - }, EDIT_DEBOUNCE_INTERVAL_MS) - }) - } - - return invokeWithRetry() + } finally { + this.debounceTimeout = undefined + this.hasDocumentChangedSinceInvocation = false + } + }, EDIT_DEBOUNCE_INTERVAL_MS) + }) } async _invoke( diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts index cb873a2920..a0ddf742f6 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts @@ -14,7 +14,6 @@ import { } from '../../../shared/codeWhispererService' import { CodewhispererLanguage } from '../../../shared/languageDetection' import { CodeWhispererSupplementalContext } from '../../../shared/models/model' -import { Logging } from '@aws/language-server-runtimes/server-interface' type SessionState = 'REQUESTING' | 'ACTIVE' | 'CLOSED' | 'ERROR' | 'DISCARD' export type UserDecision = 'Empty' | 'Filter' | 'Discard' | 'Accept' | 'Ignore' | 'Reject' | 'Unseen' @@ -45,7 +44,13 @@ export class CodeWhispererSession { startTime: number // Time when Session was closed and final state of user decisions is recorded in suggestionsStates closeTime?: number = 0 - state: SessionState + private _state: SessionState + get state(): SessionState { + return this._state + } + private set state(newState: SessionState) { + this._state = newState + } codewhispererSessionId?: string startPosition: Position = { line: 0, @@ -96,7 +101,8 @@ export class CodeWhispererSession { this.classifierThreshold = data.classifierThreshold this.customizationArn = data.customizationArn this.supplementalMetadata = data.supplementalMetadata - this.state = 'REQUESTING' + this._state = 'REQUESTING' + this.startTime = new Date().getTime() } From 0bf825ec41e0593766e34e4c1b21f063931e03d1 Mon Sep 17 00:00:00 2001 From: Richard Li <742829+rli@users.noreply.github.com> Date: Thu, 14 Aug 2025 14:18:35 -0700 Subject: [PATCH 06/74] ci: remove need for custom PAT for release branch workflow (#2126) The token from GitHub Actions is sufficient --- .../workflows/create-release-candidate-branch.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create-release-candidate-branch.yml b/.github/workflows/create-release-candidate-branch.yml index 2071f69ed4..b447f11803 100644 --- a/.github/workflows/create-release-candidate-branch.yml +++ b/.github/workflows/create-release-candidate-branch.yml @@ -28,14 +28,15 @@ jobs: setupRcBranch: name: Set up a Release Candidate Branch runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Sync code uses: actions/checkout@v4 with: ref: ${{ inputs.commitId }} - # Use RELEASE_CANDIDATE_BRANCH_CREATION_PAT to ensure workflow triggering works - token: ${{ secrets.RELEASE_CANDIDATE_BRANCH_CREATION_PAT }} + token: ${{ secrets.GITHUB_TOKEN }} persist-credentials: true - name: Setup Node.js @@ -109,15 +110,8 @@ jobs: env: BRANCH_NAME: ${{ steps.release-branch.outputs.BRANCH_NAME }} RELEASE_VERSION: ${{ steps.release-version.outputs.RELEASE_VERSION }} - # We use the toolkit-automation account, basically something that - # isn't the default GitHub Token, because you cannot chain actions with that. - # In our case, after pushing a commit (below), we want create-agent-standalone.yml - # to start automatically. - REPO_PAT: ${{ secrets.RELEASE_CANDIDATE_BRANCH_CREATION_PAT }} run: | git config --global user.email "<>" git config --global user.name "aws-toolkit-automation" - # Configure git to use the PAT token for authentication - git remote set-url origin "https://x-access-token:${REPO_PAT}@github.com/${{ github.repository }}.git" - git commit -m "chore: bump agentic version: $RELEASE_VERSION" + git commit --no-verify -m "chore: bump agentic version: $RELEASE_VERSION" git push --set-upstream origin "$BRANCH_NAME" From 971eaa505d948e9d2090c85f9b965f554ea7f2c8 Mon Sep 17 00:00:00 2001 From: chungjac Date: Fri, 15 Aug 2025 15:55:37 -0700 Subject: [PATCH 07/74] fix: proper path handling for additional context (#2129) * fix: proper pathing for additonal context * fix: update existing tests to also mock path.join() --- .../context/additionalContextProvider.test.ts | 117 ++++++++++++++++++ .../context/additionalContextProvider.ts | 2 +- 2 files changed, 118 insertions(+), 1 deletion(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/context/additionalContextProvider.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/context/additionalContextProvider.test.ts index 6c745f20b3..e6742fee1b 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/context/additionalContextProvider.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/context/additionalContextProvider.test.ts @@ -174,6 +174,12 @@ describe('AdditionalContextProvider', () => { workspaceFolder: mockWorkspaceFolder, } + // Mock path.join to simulate Unix behavior + sinon.stub(path, 'join').callsFake((...args) => { + // Simulate Unix path.join behavior + return args.join('/').replace(/\\/g, '/') + }) + const explicitContext = [ { id: 'explicit-file', @@ -208,6 +214,9 @@ describe('AdditionalContextProvider', () => { assert.strictEqual(result.length, 1) assert.strictEqual(result[0].name, 'Explicit File') assert.strictEqual(result[0].pinned, false) + + // Restore original path.join + ;(path.join as sinon.SinonStub).restore() }) it('should avoid duplicates between explicit and pinned context', async () => { @@ -220,6 +229,12 @@ describe('AdditionalContextProvider', () => { workspaceFolder: mockWorkspaceFolder, } + // Mock path.join to simulate Unix behavior + sinon.stub(path, 'join').callsFake((...args) => { + // Simulate Unix path.join behavior + return args.join('/').replace(/\\/g, '/') + }) + const sharedContext = { id: 'shared-file', command: 'Shared File', @@ -255,6 +270,9 @@ describe('AdditionalContextProvider', () => { assert.strictEqual(result.length, 1) assert.strictEqual(result[0].name, 'Shared File') assert.strictEqual(result[0].pinned, false) // Should be marked as explicit, not pinned + + // Restore original path.join + ;(path.join as sinon.SinonStub).restore() }) it('should handle Active File context correctly', async () => { @@ -358,6 +376,105 @@ describe('AdditionalContextProvider', () => { assert.strictEqual(triggerContext.contextInfo?.pinnedContextCount.codeContextCount, 1) assert.strictEqual(triggerContext.contextInfo?.pinnedContextCount.promptContextCount, 1) }) + + it('should handle Unix path separators correctly', async () => { + const mockWorkspaceFolder = { uri: URI.file('/workspace').toString(), name: 'test' } + sinon.stub(workspaceUtils, 'getWorkspaceFolderPaths').returns(['/workspace']) + + // Mock path.join to simulate Unix behavior + sinon.stub(path, 'join').callsFake((...args) => { + // Simulate Unix path.join behavior + return args.join('/').replace(/\\/g, '/') + }) + + const explicitContext = [ + { + id: 'unix-prompt', + command: 'Unix Prompt', + label: 'file' as any, + route: ['/Users/test/.aws/amazonq/prompts', 'hello.md'], + }, + ] + + fsExistsStub.callsFake((path: string) => path.includes('.amazonq/rules')) + fsReadDirStub.resolves([]) + + // Reset stub - return data for first call (explicit context), empty for second call (pinned context) + getContextCommandPromptStub.reset() + getContextCommandPromptStub.onFirstCall().resolves([ + { + // promptContextCommands - explicit context + name: 'Unix Prompt', + content: 'content', + filePath: '/Users/test/.aws/amazonq/prompts/hello.md', // Proper Unix path + relativePath: 'hello.md', + startLine: 1, + endLine: 10, + }, + ]) + getContextCommandPromptStub.onSecondCall().resolves([]) // pinnedContextCommands - empty + + const result = await provider.getAdditionalContext( + { workspaceFolder: mockWorkspaceFolder }, + 'tab1', + explicitContext + ) + assert.strictEqual(result.length, 1) + assert.strictEqual(result[0].name, 'Unix Prompt') + + // Restore original path.join + ;(path.join as sinon.SinonStub).restore() + }) + + it('should handle Windows path separators correctly', async () => { + const mockWorkspaceFolder = { uri: URI.file('/workspace').toString(), name: 'test' } + sinon.stub(workspaceUtils, 'getWorkspaceFolderPaths').returns(['/workspace']) + + // Mock path.join to simulate Windows behavior + const originalPathJoin = path.join + sinon.stub(path, 'join').callsFake((...args) => { + // Simulate Windows path.join behavior + return args.join('\\').replace(/\//g, '\\') + }) + + const explicitContext = [ + { + id: 'windows-prompt', + command: 'Windows Prompt', + label: 'file' as any, + route: ['C:\\Users\\test\\.aws\\amazonq\\prompts', 'hello.md'], + }, + ] + + fsExistsStub.callsFake((path: string) => path.includes('.amazonq/rules')) + fsReadDirStub.resolves([]) + + // Reset stub - return data for first call (explicit context), empty for second call (pinned context) + getContextCommandPromptStub.reset() + getContextCommandPromptStub.onFirstCall().resolves([ + { + // promptContextCommands - explicit context + name: 'Windows Prompt', + content: 'content', + filePath: 'C:\\Users\\test\\.aws\\amazonq\\prompts\\hello.md', // Proper Windows path + relativePath: 'hello.md', + startLine: 1, + endLine: 10, + }, + ]) + getContextCommandPromptStub.onSecondCall().resolves([]) // pinnedContextCommands - empty + + const result = await provider.getAdditionalContext( + { workspaceFolder: mockWorkspaceFolder }, + 'tab1', + explicitContext + ) + assert.strictEqual(result.length, 1) + assert.strictEqual(result[0].name, 'Windows Prompt') + + // Restore original path.join + ;(path.join as sinon.SinonStub).restore() + }) }) describe('getFileListFromContext', () => { diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/context/additionalContextProvider.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/context/additionalContextProvider.ts index d71da1a1fe..733d1df28c 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/context/additionalContextProvider.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/context/additionalContextProvider.ts @@ -406,7 +406,7 @@ export class AdditionalContextProvider { const image = imageMap.get(item.description) if (image) ordered.push(image) } else { - const doc = item.route ? docMap.get(item.route.join('/')) : undefined + const doc = item.route ? docMap.get(path.join(...item.route)) : undefined if (doc) ordered.push(doc) } } From e4e8bbb89e4b597926582bead2b14ffc43f2a7f8 Mon Sep 17 00:00:00 2001 From: Dung Dong Date: Mon, 18 Aug 2025 09:59:45 -0700 Subject: [PATCH 08/74] fix(amazonq): fix regression of mcp config in agent config (#2101) * fix(amazonq): update process-permission-updates to be the same as previous behavior * fix(chat-client): update package.json chat-client to prod * fix(amazonq): retain mcp permissions after disable/enable server * fix: dont call initOneServer on Built-in * fix: deny permission does not persist after restart IDE --------- Co-authored-by: Boyu --- .../agenticChat/tools/mcp/mcpEventHandler.ts | 71 ++++----- .../agenticChat/tools/mcp/mcpManager.ts | 137 +++++++++--------- .../agenticChat/tools/mcp/mcpUtils.ts | 56 +------ 3 files changed, 98 insertions(+), 166 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts index bf8c91b533..5b3ac84e98 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts @@ -35,6 +35,7 @@ import { ProfileStatusMonitor } from './profileStatusMonitor' interface PermissionOption { label: string value: string + description?: string } export class McpEventHandler { @@ -913,20 +914,15 @@ export class McpEventHandler { } const mcpManager = McpManager.instance - // Get the appropriate agent path const agentPath = mcpManager.getAllServerConfigs().get(serverName)?.__configPath__ - - const perm: MCPServerPermission = { - enabled: true, - toolPerms: {}, - __configPath__: agentPath, - } - // Set flag to ignore file changes during permission update this.#isProgrammaticChange = true try { + const perm = mcpManager.getMcpServerPermissions(serverName)! + perm.enabled = true + perm.__configPath__ = agentPath await mcpManager.updateServerPermission(serverName, perm) this.#emitMCPConfigEvent() } catch (error) { @@ -944,21 +940,15 @@ export class McpEventHandler { if (!serverName) { return { id: params.id } } - const mcpManager = McpManager.instance - // Get the appropriate agent path + // Set flag to ignore file changes during permission update const agentPath = mcpManager.getAllServerConfigs().get(serverName)?.__configPath__ - - const perm: MCPServerPermission = { - enabled: false, - toolPerms: {}, - __configPath__: agentPath, - } - // Set flag to ignore file changes during permission update this.#isProgrammaticChange = true - try { + const perm = mcpManager.getMcpServerPermissions(serverName)! + perm.enabled = false + perm.__configPath__ = agentPath await mcpManager.updateServerPermission(serverName, perm) this.#emitMCPConfigEvent() } catch (error) { @@ -1078,17 +1068,16 @@ export class McpEventHandler { // Add tool select options toolsWithPermissions.forEach(item => { const toolName = item.tool.toolName - const currentPermission = this.#getCurrentPermission(item.permission) // For Built-in server, use a special function that doesn't include the 'Deny' option - const permissionOptions = this.#buildPermissionOptions(item.permission) + let permissionOptions = this.#buildPermissionOptions() filterOptions.push({ type: 'select', id: `${toolName}`, title: toolName, description: item.tool.description, - placeholder: currentPermission, options: permissionOptions, + ...{ value: item.permission, boldTitle: true, mandatory: true, hideMandatoryIcon: true }, }) }) @@ -1141,20 +1130,22 @@ export class McpEventHandler { /** * Builds permission options excluding the current one */ - #buildPermissionOptions(currentPermission: string) { + #buildPermissionOptions() { const permissionOptions: PermissionOption[] = [] - if (currentPermission !== McpPermissionType.alwaysAllow) { - permissionOptions.push({ label: 'Always allow', value: McpPermissionType.alwaysAllow }) - } + permissionOptions.push({ + label: 'Ask', + value: McpPermissionType.ask, + description: 'Ask for your approval each time this tool is run', + }) - if (currentPermission !== McpPermissionType.ask) { - permissionOptions.push({ label: 'Ask', value: McpPermissionType.ask }) - } + permissionOptions.push({ + label: 'Always allow', + value: McpPermissionType.alwaysAllow, + description: 'Always allow this tool to run without asking for approval', + }) - if (currentPermission !== McpPermissionType.deny) { - permissionOptions.push({ label: 'Deny', value: McpPermissionType.deny }) - } + permissionOptions.push({ label: 'Deny', value: McpPermissionType.deny, description: 'Never run this tool' }) return permissionOptions } @@ -1203,6 +1194,7 @@ export class McpEventHandler { } const mcpServerPermission = await this.#processPermissionUpdates( + serverName, updatedPermissionConfig, serverConfig?.__configPath__ ) @@ -1400,27 +1392,20 @@ export class McpEventHandler { /** * Processes permission updates from the UI */ - async #processPermissionUpdates(updatedPermissionConfig: any, agentPath: string | undefined) { + async #processPermissionUpdates(serverName: string, updatedPermissionConfig: any, agentPath: string | undefined) { + const builtInToolAgentPath = await this.#getAgentPath() const perm: MCPServerPermission = { enabled: true, toolPerms: {}, - __configPath__: agentPath, + __configPath__: serverName === 'Built-in' ? builtInToolAgentPath : agentPath, } // Process each tool permission setting for (const [key, val] of Object.entries(updatedPermissionConfig)) { if (key === 'scope') continue - // // Get the default permission for this tool from McpManager - // let defaultPermission = McpManager.instance.getToolPerm(serverName, key) - - // // If no default permission is found, use 'alwaysAllow' for Built-in and 'ask' for MCP servers - // if (!defaultPermission) { - // defaultPermission = serverName === 'Built-in' ? 'alwaysAllow' : 'ask' - // } - - // If the value is an empty string (''), skip this tool to preserve its existing permission in the persona file - if (val === '') continue + const currentPerm = McpManager.instance.getToolPerm(serverName, key) + if (val === currentPerm) continue switch (val) { case McpPermissionType.alwaysAllow: perm.toolPerms[key] = McpPermissionType.alwaysAllow diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index 04f827ff2c..e639807929 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -178,14 +178,49 @@ export class McpManager { // Reset permissions map this.mcpServerPermissions.clear() - - // Initialize permissions for servers from agent config + // Create init state for (const [sanitizedName, _] of this.mcpServers.entries()) { - const name = this.serverNameMapping.get(sanitizedName) || sanitizedName - // Set server status to UNINITIALIZED initially this.setState(sanitizedName, McpServerStatus.UNINITIALIZED, 0) + } + // Get all servers that need to be initialized + const serversToInit: Array<[string, MCPServerConfig]> = [] + + for (const [name, cfg] of this.mcpServers.entries()) { + if (this.isServerDisabled(name)) { + this.features.logging.info(`MCP: server '${name}' is disabled by persona settings, skipping`) + this.setState(name, McpServerStatus.DISABLED, 0) + this.emitToolsChanged(name) + continue + } + serversToInit.push([name, cfg]) + } + + // Process servers in batches of 5 at a time + const MAX_CONCURRENT_SERVERS = 5 + const totalServers = serversToInit.length + + if (totalServers > 0) { + this.features.logging.info( + `MCP: initializing ${totalServers} servers with max concurrency of ${MAX_CONCURRENT_SERVERS}` + ) + + // Process servers in batches + for (let i = 0; i < totalServers; i += MAX_CONCURRENT_SERVERS) { + const batch = serversToInit.slice(i, i + MAX_CONCURRENT_SERVERS) + const batchPromises = batch.map(([name, cfg]) => this.initOneServer(name, cfg)) + + this.features.logging.debug( + `MCP: initializing batch of ${batch.length} servers (${i + 1}-${Math.min(i + MAX_CONCURRENT_SERVERS, totalServers)} of ${totalServers})` + ) + await Promise.all(batchPromises) + } + this.features.logging.info(`MCP: completed initialization of ${totalServers} servers`) + } + + for (const [sanitizedName, _] of this.mcpServers.entries()) { + const name = this.serverNameMapping.get(sanitizedName) || sanitizedName // Initialize permissions for this server const serverPrefix = `@${name}` @@ -208,9 +243,18 @@ export class McpManager { }) } else { // Only specific tools are enabled + // get allTools of this server, if it's not in tools --> it's denied + // have to move the logic after all servers finish init, because that's when we have list of tools + const deniedTools = new Set( + this.getAllTools() + .filter(tool => tool.serverName === name) + .map(tool => tool.toolName) + ) this.agentConfig.tools.forEach(tool => { if (tool.startsWith(serverPrefix + '/')) { + // remove this from deniedTools const toolName = tool.substring(serverPrefix.length + 1) + deniedTools.delete(toolName) if (toolName) { // Check if tool is in allowedTools if (this.agentConfig.allowedTools.includes(tool)) { @@ -221,6 +265,11 @@ export class McpManager { } } }) + + // update permission to deny for rest of the tools + deniedTools.forEach(tool => { + toolPerms[tool] = McpPermissionType.deny + }) } this.mcpServerPermissions.set(sanitizedName, { @@ -228,42 +277,6 @@ export class McpManager { toolPerms, }) } - - // Get all servers that need to be initialized - const serversToInit: Array<[string, MCPServerConfig]> = [] - - for (const [name, cfg] of this.mcpServers.entries()) { - if (this.isServerDisabled(name)) { - this.features.logging.info(`MCP: server '${name}' is disabled by persona settings, skipping`) - this.setState(name, McpServerStatus.DISABLED, 0) - this.emitToolsChanged(name) - continue - } - serversToInit.push([name, cfg]) - } - - // Process servers in batches of 5 at a time - const MAX_CONCURRENT_SERVERS = 5 - const totalServers = serversToInit.length - - if (totalServers > 0) { - this.features.logging.info( - `MCP: initializing ${totalServers} servers with max concurrency of ${MAX_CONCURRENT_SERVERS}` - ) - - // Process servers in batches - for (let i = 0; i < totalServers; i += MAX_CONCURRENT_SERVERS) { - const batch = serversToInit.slice(i, i + MAX_CONCURRENT_SERVERS) - const batchPromises = batch.map(([name, cfg]) => this.initOneServer(name, cfg)) - - this.features.logging.debug( - `MCP: initializing batch of ${batch.length} servers (${i + 1}-${Math.min(i + MAX_CONCURRENT_SERVERS, totalServers)} of ${totalServers})` - ) - await Promise.all(batchPromises) - } - - this.features.logging.info(`MCP: completed initialization of ${totalServers} servers`) - } } /** @@ -658,13 +671,7 @@ export class McpManager { } // Save agent config once with all changes - await saveAgentConfig( - this.features.workspace, - this.features.logging, - this.agentConfig, - agentPath, - serverName - ) + await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, agentPath) // Add server tools to tools list after initialization await this.initOneServer(sanitizedName, newCfg) @@ -728,13 +735,7 @@ export class McpManager { }) // Save agent config - await saveAgentConfig( - this.features.workspace, - this.features.logging, - this.agentConfig, - cfg.__configPath__, - unsanitizedName - ) + await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, cfg.__configPath__) // Get all config paths and delete the server from each one const wsUris = this.features.workspace.getAllWorkspaceFolders()?.map(f => f.uri) ?? [] @@ -817,13 +818,7 @@ export class McpManager { this.agentConfig.mcpServers[unsanitizedServerName] = updatedConfig // Save agent config - await saveAgentConfig( - this.features.workspace, - this.features.logging, - this.agentConfig, - agentPath, - unsanitizedServerName - ) + await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, agentPath) } const newCfg: MCPServerConfig = { @@ -1035,13 +1030,7 @@ export class McpManager { // Save agent config const agentPath = perm.__configPath__ if (agentPath) { - await saveAgentConfig( - this.features.workspace, - this.features.logging, - this.agentConfig, - agentPath, - unsanitizedServerName - ) + await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, agentPath) } // Update mcpServerPermissions map @@ -1059,7 +1048,7 @@ export class McpManager { } this.setState(serverName, McpServerStatus.DISABLED, 0) } else { - if (!this.clients.has(serverName)) { + if (!this.clients.has(serverName) && serverName !== 'Built-in') { await this.initOneServer(serverName, this.mcpServers.get(serverName)!) } } @@ -1087,6 +1076,13 @@ export class McpManager { return !this.agentConfig.allowedTools.includes(toolId) } + /** + * get server's tool permission + */ + public getMcpServerPermissions(serverName: string): MCPServerPermission | undefined { + return this.mcpServerPermissions.get(serverName) + } + /** * Returns any errors that occurred during loading of MCP configuration files */ @@ -1152,8 +1148,7 @@ export class McpManager { this.features.workspace, this.features.logging, this.agentConfig, - cfg.__configPath__, - unsanitizedName + cfg.__configPath__ ) } } catch (err) { diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts index 7b212bad49..ffd2cfb4fc 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts @@ -958,61 +958,13 @@ export async function saveAgentConfig( workspace: Workspace, logging: Logger, config: AgentConfig, - configPath: string, - serverName?: string + configPath: string ): Promise { try { await workspace.fs.mkdir(path.dirname(configPath), { recursive: true }) - - if (!serverName) { - // Save the whole config - await workspace.fs.writeFile(configPath, JSON.stringify(config, null, 2)) - logging.info(`Saved agent config to ${configPath}`) - return - } - - // Read existing config if it exists, otherwise use default - let existingConfig: any - try { - const configExists = await workspace.fs.exists(configPath) - if (configExists) { - const raw = (await workspace.fs.readFile(configPath)).toString().trim() - existingConfig = raw ? JSON.parse(raw) : JSON.parse(DEFAULT_AGENT_RAW) - } else { - existingConfig = JSON.parse(DEFAULT_AGENT_RAW) - } - } catch (err) { - logging.warn(`Failed to read existing config at ${configPath}: ${err}`) - existingConfig = JSON.parse(DEFAULT_AGENT_RAW) - } - - // Update only the specific server's config - if (config.mcpServers[serverName]) { - existingConfig.mcpServers[serverName] = config.mcpServers[serverName] - } - - // Remove existing tools for this server - const serverToolPattern = `@${serverName}` - existingConfig.tools = existingConfig.tools.filter( - (tool: string) => tool !== serverToolPattern && !tool.startsWith(`${serverToolPattern}/`) - ) - existingConfig.allowedTools = existingConfig.allowedTools.filter( - (tool: string) => tool !== serverToolPattern && !tool.startsWith(`${serverToolPattern}/`) - ) - - // Add only tools for this server - const serverTools = config.tools.filter( - tool => tool === serverToolPattern || tool.startsWith(`${serverToolPattern}/`) - ) - const serverAllowedTools = config.allowedTools.filter( - tool => tool === serverToolPattern || tool.startsWith(`${serverToolPattern}/`) - ) - - existingConfig.tools.push(...serverTools) - existingConfig.allowedTools.push(...serverAllowedTools) - - await workspace.fs.writeFile(configPath, JSON.stringify(existingConfig, null, 2)) - logging.info(`Saved agent config for server ${serverName} to ${configPath}`) + // Save the whole config + await workspace.fs.writeFile(configPath, JSON.stringify(config, null, 2)) + logging.info(`Saved agent config to ${configPath}`) } catch (err: any) { logging.error(`Failed to save agent config to ${configPath}: ${err.message}`) throw err From d397161cc3448c63016e27f5ac2a1917cdaae1cb Mon Sep 17 00:00:00 2001 From: Rajanna-Karthik Date: Mon, 18 Aug 2025 10:04:18 -0700 Subject: [PATCH 09/74] feat: remove project type validation from LSP layer (#2103) * feat: remove project type validation from LSP layer * refactor: remove unused validation functions from LSP layer --- .../resources/SupportedProjects.ts | 3 + .../netTransform/tests/validation.test.ts | 120 +----------------- .../netTransform/transformHandler.ts | 12 -- .../netTransform/validation.ts | 30 +---- 4 files changed, 5 insertions(+), 160 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/netTransform/resources/SupportedProjects.ts b/server/aws-lsp-codewhisperer/src/language-server/netTransform/resources/SupportedProjects.ts index a3d6322a07..69881dfc89 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/netTransform/resources/SupportedProjects.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/netTransform/resources/SupportedProjects.ts @@ -1,3 +1,6 @@ +/** + * Reference only - validation moved to backend service. + */ export const supportedProjects = [ 'AspNetCoreMvc', 'AspNetCoreWebApi', diff --git a/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/validation.test.ts b/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/validation.test.ts index a8cfcf3475..90ce3d1f7a 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/validation.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/validation.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai' import { StartTransformRequest, TransformProjectMetadata } from '../models' -import { isProject, isSolution, validateProject, validateSolution } from '../validation' +import { isProject, isSolution } from '../validation' import { supportedProjects, unsupportedViewComponents } from '../resources/SupportedProjects' import mock = require('mock-fs') import { Logging } from '@aws/language-server-runtimes/server-interface' @@ -46,122 +46,4 @@ describe('Test validation functionality', () => { mockStartTransformationRequest.SelectedProjectPath = 'test.csproj' expect(isSolution(mockStartTransformationRequest)).to.equal(false) }) - - it('should return true when project is a supported type', () => { - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest - const mockProjectMeta = { - Name: '', - ProjectTargetFramework: '', - ProjectPath: 'test.csproj', - SourceCodeFilePaths: [], - ProjectLanguage: '', - ProjectType: 'AspNetCoreMvc', - ExternalReferences: [], - } - mockStartTransformationRequest.ProjectMetadata.push(mockProjectMeta) - - expect(validateProject(mockStartTransformationRequest, mockedLogging)).to.equal(true) - }) - - it('should return false when project is not a supported type', () => { - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest - const mockProjectMeta = { - Name: '', - ProjectTargetFramework: '', - ProjectPath: 'test.csproj', - SourceCodeFilePaths: [], - ProjectLanguage: '', - ProjectType: 'not supported', - ExternalReferences: [], - } - mockStartTransformationRequest.ProjectMetadata = [] - mockStartTransformationRequest.ProjectMetadata.push(mockProjectMeta) - - expect(validateProject(mockStartTransformationRequest, mockedLogging)).to.equal(false) - }) - - it('should return false when there is no project path that is the same as the selected project path', () => { - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest - const mockProjectMeta = { - Name: '', - ProjectTargetFramework: '', - ProjectPath: 'different.csproj', - SourceCodeFilePaths: [], - ProjectLanguage: '', - ProjectType: 'AspNetCoreMvc', - ExternalReferences: [], - } - mockStartTransformationRequest.ProjectMetadata = [] - mockStartTransformationRequest.ProjectMetadata.push(mockProjectMeta) - - expect(validateProject(mockStartTransformationRequest, mockedLogging)).to.equal(false) - }) - - // New tests for AspNetWebForms validation - it('should return true when project is AspNetWebForms type', () => { - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest - const mockProjectMeta = { - Name: '', - ProjectTargetFramework: '', - ProjectPath: 'test.csproj', - SourceCodeFilePaths: [], - ProjectLanguage: '', - ProjectType: 'AspNetWebForms', - ExternalReferences: [], - } - mockStartTransformationRequest.ProjectMetadata = [] - mockStartTransformationRequest.ProjectMetadata.push(mockProjectMeta) - - expect(validateProject(mockStartTransformationRequest, mockedLogging)).to.equal(true) - }) - - it('should not include AspNetWebForms in unsupported projects list', () => { - let mockStartTransformationRequest: StartTransformRequest = sampleStartTransformRequest - - // Add a supported project - const supportedProjectMeta = { - Name: 'Supported', - ProjectTargetFramework: '', - ProjectPath: 'supported.csproj', - SourceCodeFilePaths: [], - ProjectLanguage: '', - ProjectType: 'AspNetCoreMvc', - ExternalReferences: [], - } - - // Add an unsupported project - const unsupportedProjectMeta = { - Name: 'Unsupported', - ProjectTargetFramework: '', - ProjectPath: 'unsupported.csproj', - SourceCodeFilePaths: [], - ProjectLanguage: '', - ProjectType: 'UnsupportedType', - ExternalReferences: [], - } - - // Add an AspNetWebForms project - const webFormsProjectMeta = { - Name: 'WebForms', - ProjectTargetFramework: '', - ProjectPath: 'webforms.csproj', - SourceCodeFilePaths: [], - ProjectLanguage: '', - ProjectType: 'AspNetWebForms', - ExternalReferences: [], - } - - mockStartTransformationRequest.ProjectMetadata = [ - supportedProjectMeta, - unsupportedProjectMeta, - webFormsProjectMeta, - ] - - const unsupportedProjects = validateSolution(mockStartTransformationRequest) - - // Should only contain the unsupported project, not the AspNetWebForms project - expect(unsupportedProjects).to.have.lengthOf(1) - expect(unsupportedProjects[0]).to.equal('unsupported.csproj') - expect(unsupportedProjects).to.not.include('webforms.csproj') - }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/netTransform/transformHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/netTransform/transformHandler.ts index b0afaa06f1..b8bc80b30c 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/netTransform/transformHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/netTransform/transformHandler.ts @@ -54,18 +54,6 @@ export class TransformHandler { isProject, this.logging ) - if (isProject) { - let isValid = validation.validateProject(userInputrequest, this.logging) - if (!isValid) { - return { - Error: 'NotSupported', - IsSupported: false, - ContainsUnsupportedViews: containsUnsupportedViews, - } as StartTransformResponse - } - } else { - unsupportedProjects = validation.validateSolution(userInputrequest) - } const artifactManager = new ArtifactManager( this.workspace, diff --git a/server/aws-lsp-codewhisperer/src/language-server/netTransform/validation.ts b/server/aws-lsp-codewhisperer/src/language-server/netTransform/validation.ts index 0d244e09a8..efb443fb0f 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/netTransform/validation.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/netTransform/validation.ts @@ -6,9 +6,7 @@ import { TransformationJob } from '../../client/token/codewhispererbearertokencl import { TransformationErrorCode } from './models' /** - * TEMPORARY HACK: AspNetWebForms project type is allowed in validateProject and validateSolution - * functions without being added to the supportedProjects array. This is to enable WebForms to Blazor - * transformation without officially supporting it yet. + * Project type validation moved to backend service. */ export function isProject(userInputrequest: StartTransformRequest): boolean { @@ -19,32 +17,6 @@ export function isSolution(userInputrequest: StartTransformRequest): boolean { return userInputrequest.SelectedProjectPath.endsWith('.sln') } -export function validateProject(userInputrequest: StartTransformRequest, logging: Logging): boolean { - var selectedProject = userInputrequest.ProjectMetadata.find( - project => project.ProjectPath == userInputrequest.SelectedProjectPath - ) - - if (selectedProject) { - // Temporary hack: Allow AspNetWebForms project type without adding it to supportedProjects - var isValid = - supportedProjects.includes(selectedProject?.ProjectType) || - selectedProject?.ProjectType === 'AspNetWebForms' - logging.log( - `Selected project ${userInputrequest?.SelectedProjectPath} has project type ${selectedProject.ProjectType}` + - (isValid ? '' : ' that is not supported') - ) - return isValid - } - logging.log(`Error occured in verifying selected project with path ${userInputrequest.SelectedProjectPath}`) - return false -} - -export function validateSolution(userInputrequest: StartTransformRequest): string[] { - return userInputrequest.ProjectMetadata.filter( - project => !supportedProjects.includes(project.ProjectType) && project.ProjectType !== 'AspNetWebForms' - ).map(project => project.ProjectPath) -} - export async function checkForUnsupportedViews( userInputRequest: StartTransformRequest, isProject: boolean, From 2a4171a74c15c23c23c481060496162bcc9e6284 Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Mon, 18 Aug 2025 13:04:17 -0700 Subject: [PATCH 10/74] fix: fix for button text and remove profilearn caching (#2137) --- chat-client/src/client/mcpMynahUi.ts | 1 + .../agenticChat/tools/mcp/profileStatusMonitor.ts | 13 +++---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/chat-client/src/client/mcpMynahUi.ts b/chat-client/src/client/mcpMynahUi.ts index 5ece955dfa..5cdae85da1 100644 --- a/chat-client/src/client/mcpMynahUi.ts +++ b/chat-client/src/client/mcpMynahUi.ts @@ -276,6 +276,7 @@ export class McpMynahUi { params.header.actions?.map(action => ({ ...action, icon: action.icon ? toMynahIcon(action.icon) : undefined, + text: undefined, })) || [], } : undefined, diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts index 4a1cc705e4..a436e152ff 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts @@ -18,7 +18,6 @@ export class ProfileStatusMonitor { private intervalId?: NodeJS.Timeout private readonly CHECK_INTERVAL = 24 * 60 * 60 * 1000 // 24 hours private codeWhispererClient?: CodeWhispererServiceToken - private cachedProfileArn?: string private static lastMcpState?: boolean constructor( @@ -85,7 +84,8 @@ export class ProfileStatusMonitor { const response = await retryUtils.retryWithBackoff(() => this.codeWhispererClient!.getProfile({ profileArn }) ) - const isMcpEnabled = response?.profile?.optInFeatures?.mcpConfiguration?.toggle === 'ON' + const mcpConfig = response?.profile?.optInFeatures?.mcpConfiguration + const isMcpEnabled = mcpConfig ? mcpConfig.toggle === 'ON' : true if (ProfileStatusMonitor.lastMcpState !== isMcpEnabled) { ProfileStatusMonitor.lastMcpState = isMcpEnabled @@ -107,16 +107,9 @@ export class ProfileStatusMonitor { } private getProfileArn(): string | undefined { - // Use cached value if available - if (this.cachedProfileArn) { - return this.cachedProfileArn - } - try { - // Get profile ARN from service manager like in agenticChatController const serviceManager = AmazonQTokenServiceManager.getInstance() - this.cachedProfileArn = serviceManager.getActiveProfileArn() - return this.cachedProfileArn + return serviceManager.getActiveProfileArn() } catch (error) { this.logging.debug(`Failed to get profile ARN: ${error}`) } From b3938c1c3ef33e9872d84782d1dd0d6dff617f44 Mon Sep 17 00:00:00 2001 From: tsmithsz <84354541+tsmithsz@users.noreply.github.com> Date: Mon, 18 Aug 2025 15:29:49 -0700 Subject: [PATCH 11/74] chore: bump runtimes to 0.2.126 (#2138) --- app/aws-lsp-antlr4-runtimes/package.json | 2 +- app/aws-lsp-buildspec-runtimes/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- app/aws-lsp-identity-runtimes/package.json | 2 +- app/aws-lsp-json-runtimes/package.json | 2 +- .../package.json | 2 +- app/aws-lsp-s3-runtimes/package.json | 2 +- app/aws-lsp-yaml-json-webworker/package.json | 2 +- app/aws-lsp-yaml-runtimes/package.json | 2 +- app/hello-world-lsp-runtimes/package.json | 2 +- chat-client/package.json | 2 +- client/vscode/package.json | 2 +- core/aws-lsp-core/package.json | 2 +- .../q-agentic-chat-server/package.json | 2 +- package-lock.json | 60 +++++++++---------- server/aws-lsp-antlr4/package.json | 2 +- server/aws-lsp-buildspec/package.json | 2 +- server/aws-lsp-cloudformation/package.json | 2 +- server/aws-lsp-codewhisperer/package.json | 2 +- server/aws-lsp-identity/package.json | 2 +- server/aws-lsp-json/package.json | 2 +- server/aws-lsp-notification/package.json | 2 +- server/aws-lsp-partiql/package.json | 2 +- server/aws-lsp-s3/package.json | 2 +- server/aws-lsp-yaml/package.json | 2 +- server/device-sso-auth-lsp/package.json | 2 +- server/hello-world-lsp/package.json | 2 +- 28 files changed, 57 insertions(+), 57 deletions(-) diff --git a/app/aws-lsp-antlr4-runtimes/package.json b/app/aws-lsp-antlr4-runtimes/package.json index 4289cec4b1..30b9b57a65 100644 --- a/app/aws-lsp-antlr4-runtimes/package.json +++ b/app/aws-lsp-antlr4-runtimes/package.json @@ -12,7 +12,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-antlr4": "*", "antlr4-c3": "^3.4.1", "antlr4ng": "^3.0.4" diff --git a/app/aws-lsp-buildspec-runtimes/package.json b/app/aws-lsp-buildspec-runtimes/package.json index 700afb3e7f..47a88b907a 100644 --- a/app/aws-lsp-buildspec-runtimes/package.json +++ b/app/aws-lsp-buildspec-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-buildspec": "^0.0.1" } } diff --git a/app/aws-lsp-cloudformation-runtimes/package.json b/app/aws-lsp-cloudformation-runtimes/package.json index 5cc04150cb..68547449cc 100644 --- a/app/aws-lsp-cloudformation-runtimes/package.json +++ b/app/aws-lsp-cloudformation-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-cloudformation": "^0.0.1" } } diff --git a/app/aws-lsp-codewhisperer-runtimes/package.json b/app/aws-lsp-codewhisperer-runtimes/package.json index fc31e64589..24e06d87ea 100644 --- a/app/aws-lsp-codewhisperer-runtimes/package.json +++ b/app/aws-lsp-codewhisperer-runtimes/package.json @@ -23,7 +23,7 @@ "local-build": "node scripts/local-build.js" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-codewhisperer": "*", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", diff --git a/app/aws-lsp-identity-runtimes/package.json b/app/aws-lsp-identity-runtimes/package.json index 869a30cb20..2bf37011c3 100644 --- a/app/aws-lsp-identity-runtimes/package.json +++ b/app/aws-lsp-identity-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-identity": "^0.0.1" } } diff --git a/app/aws-lsp-json-runtimes/package.json b/app/aws-lsp-json-runtimes/package.json index f63dd4e985..8a2ea3203a 100644 --- a/app/aws-lsp-json-runtimes/package.json +++ b/app/aws-lsp-json-runtimes/package.json @@ -11,7 +11,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-json": "*" }, "devDependencies": { diff --git a/app/aws-lsp-notification-runtimes/package.json b/app/aws-lsp-notification-runtimes/package.json index faf9e4c24c..b1877ae13e 100644 --- a/app/aws-lsp-notification-runtimes/package.json +++ b/app/aws-lsp-notification-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-notification": "^0.0.1" } } diff --git a/app/aws-lsp-s3-runtimes/package.json b/app/aws-lsp-s3-runtimes/package.json index 42efa998be..a242281ff2 100644 --- a/app/aws-lsp-s3-runtimes/package.json +++ b/app/aws-lsp-s3-runtimes/package.json @@ -10,7 +10,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-s3": "^0.0.1" } } diff --git a/app/aws-lsp-yaml-json-webworker/package.json b/app/aws-lsp-yaml-json-webworker/package.json index 6190893816..8eebf1ea84 100644 --- a/app/aws-lsp-yaml-json-webworker/package.json +++ b/app/aws-lsp-yaml-json-webworker/package.json @@ -11,7 +11,7 @@ "serve:webpack": "NODE_ENV=development webpack serve" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*" }, diff --git a/app/aws-lsp-yaml-runtimes/package.json b/app/aws-lsp-yaml-runtimes/package.json index eb76a46e38..1428ef3058 100644 --- a/app/aws-lsp-yaml-runtimes/package.json +++ b/app/aws-lsp-yaml-runtimes/package.json @@ -11,7 +11,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-yaml": "*" }, "devDependencies": { diff --git a/app/hello-world-lsp-runtimes/package.json b/app/hello-world-lsp-runtimes/package.json index 14a3a75ff4..352bf82f88 100644 --- a/app/hello-world-lsp-runtimes/package.json +++ b/app/hello-world-lsp-runtimes/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@aws/hello-world-lsp": "^0.0.1", - "@aws/language-server-runtimes": "^0.2.125" + "@aws/language-server-runtimes": "^0.2.126" }, "devDependencies": { "@types/chai": "^4.3.5", diff --git a/chat-client/package.json b/chat-client/package.json index 2ee60a8bec..65dee12960 100644 --- a/chat-client/package.json +++ b/chat-client/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/language-server-runtimes-types": "^0.1.50", "@aws/mynah-ui": "^4.36.4" }, diff --git a/client/vscode/package.json b/client/vscode/package.json index 409a4fc50d..4cb42a0752 100644 --- a/client/vscode/package.json +++ b/client/vscode/package.json @@ -352,7 +352,7 @@ "@aws-sdk/credential-providers": "^3.731.1", "@aws-sdk/types": "^3.734.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@types/uuid": "^9.0.8", "@types/vscode": "^1.98.0", "jose": "^5.2.4", diff --git a/core/aws-lsp-core/package.json b/core/aws-lsp-core/package.json index 5a3d438d47..04081f13fc 100644 --- a/core/aws-lsp-core/package.json +++ b/core/aws-lsp-core/package.json @@ -28,7 +28,7 @@ "prepack": "shx cp ../../LICENSE ../../NOTICE ../../SECURITY.md ." }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@gerhobbelt/gitignore-parser": "^0.2.0-9", "cross-spawn": "7.0.6", "jose": "^5.2.4", diff --git a/integration-tests/q-agentic-chat-server/package.json b/integration-tests/q-agentic-chat-server/package.json index 1e93a252dd..7415e1653e 100644 --- a/integration-tests/q-agentic-chat-server/package.json +++ b/integration-tests/q-agentic-chat-server/package.json @@ -9,7 +9,7 @@ "test-integ": "npm run compile && mocha --timeout 30000 \"./out/**/*.test.js\" --retries 2" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "*" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index d1ac2ece1c..128ae8083d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "name": "@aws/lsp-antlr4-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-antlr4": "*", "antlr4-c3": "^3.4.1", "antlr4ng": "^3.0.4" @@ -71,7 +71,7 @@ "name": "@aws/lsp-buildspec-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-buildspec": "^0.0.1" } }, @@ -79,7 +79,7 @@ "name": "@aws/lsp-cloudformation-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-cloudformation": "^0.0.1" } }, @@ -87,7 +87,7 @@ "name": "@aws/lsp-codewhisperer-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-codewhisperer": "*", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", @@ -120,7 +120,7 @@ "name": "@aws/lsp-identity-runtimes", "version": "0.1.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-identity": "^0.0.1" } }, @@ -128,7 +128,7 @@ "name": "@aws/lsp-json-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-json": "*" }, "devDependencies": { @@ -148,7 +148,7 @@ "name": "@aws/lsp-notification-runtimes", "version": "0.1.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-notification": "^0.0.1" } }, @@ -181,7 +181,7 @@ "name": "@aws/lsp-s3-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-s3": "^0.0.1" }, "bin": { @@ -192,7 +192,7 @@ "name": "@aws/lsp-yaml-json-webworker", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*" }, @@ -212,7 +212,7 @@ "name": "@aws/lsp-yaml-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-yaml": "*" }, "devDependencies": { @@ -234,7 +234,7 @@ "version": "0.0.1", "dependencies": { "@aws/hello-world-lsp": "^0.0.1", - "@aws/language-server-runtimes": "^0.2.125" + "@aws/language-server-runtimes": "^0.2.126" }, "devDependencies": { "@types/chai": "^4.3.5", @@ -255,7 +255,7 @@ "license": "Apache-2.0", "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/language-server-runtimes-types": "^0.1.50", "@aws/mynah-ui": "^4.36.4" }, @@ -280,7 +280,7 @@ "@aws-sdk/credential-providers": "^3.731.1", "@aws-sdk/types": "^3.734.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@types/uuid": "^9.0.8", "@types/vscode": "^1.98.0", "jose": "^5.2.4", @@ -296,7 +296,7 @@ "version": "0.0.13", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@gerhobbelt/gitignore-parser": "^0.2.0-9", "cross-spawn": "7.0.6", "jose": "^5.2.4", @@ -327,7 +327,7 @@ "name": "@aws/q-agentic-chat-server-integration-tests", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "*" }, "devDependencies": { @@ -4036,9 +4036,9 @@ "link": true }, "node_modules/@aws/language-server-runtimes": { - "version": "0.2.125", - "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes/-/language-server-runtimes-0.2.125.tgz", - "integrity": "sha512-tjXJEagZ6rm09fcgJGu1zbFNzi0+7R1mdNFa6zCIv68c76xq5JHjc++Hne9aOgp61O6BM9uNnX3KR57v9/0E1g==", + "version": "0.2.126", + "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes/-/language-server-runtimes-0.2.126.tgz", + "integrity": "sha512-dUIKTL6+AOxdberwHLvigSJcbhFv6oUS3POhZWoNlBV9XJZRWwzNW9gkjkUsI03YTVshqMuVHT/HaoRW/hDkIA==", "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes-types": "^0.1.56", @@ -28608,7 +28608,7 @@ "version": "0.1.17", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.13" }, "devDependencies": { @@ -28650,7 +28650,7 @@ "name": "@aws/lsp-buildspec", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*", "vscode-languageserver": "^9.0.1", @@ -28661,7 +28661,7 @@ "name": "@aws/lsp-cloudformation", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "*", "@aws/lsp-json": "*", "vscode-languageserver": "^9.0.1", @@ -28683,7 +28683,7 @@ "@aws-sdk/util-arn-parser": "^3.723.0", "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.13", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", @@ -28823,7 +28823,7 @@ "dependencies": { "@aws-sdk/client-sso-oidc": "^3.616.0", "@aws-sdk/token-providers": "^3.744.0", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.12", "@smithy/node-http-handler": "^3.2.5", "@smithy/shared-ini-file-loader": "^4.0.1", @@ -28888,7 +28888,7 @@ "version": "0.1.17", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.13", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" @@ -28905,7 +28905,7 @@ "version": "0.0.1", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1" }, @@ -28966,7 +28966,7 @@ "version": "0.0.16", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "antlr4-c3": "3.4.2", "antlr4ng": "3.0.14", "web-tree-sitter": "0.22.6" @@ -28988,7 +28988,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.623.0", "@aws-sdk/types": "^3.734.0", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" @@ -29019,7 +29019,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.13", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", @@ -29033,7 +29033,7 @@ "name": "@amzn/device-sso-auth-lsp", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "vscode-languageserver": "^9.0.1" }, "devDependencies": { @@ -29044,7 +29044,7 @@ "name": "@aws/hello-world-lsp", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "vscode-languageserver": "^9.0.1" }, "devDependencies": { diff --git a/server/aws-lsp-antlr4/package.json b/server/aws-lsp-antlr4/package.json index f540c8ae21..9ba8186aab 100644 --- a/server/aws-lsp-antlr4/package.json +++ b/server/aws-lsp-antlr4/package.json @@ -28,7 +28,7 @@ "clean": "rm -rf node_modules" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.13" }, "peerDependencies": { diff --git a/server/aws-lsp-buildspec/package.json b/server/aws-lsp-buildspec/package.json index 2cf0b776ac..3a23338dac 100644 --- a/server/aws-lsp-buildspec/package.json +++ b/server/aws-lsp-buildspec/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*", "vscode-languageserver": "^9.0.1", diff --git a/server/aws-lsp-cloudformation/package.json b/server/aws-lsp-cloudformation/package.json index ad01b4457a..75223b4791 100644 --- a/server/aws-lsp-cloudformation/package.json +++ b/server/aws-lsp-cloudformation/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "*", "@aws/lsp-json": "*", "vscode-languageserver": "^9.0.1", diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index 8600148090..78297c702e 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -36,7 +36,7 @@ "@aws-sdk/util-arn-parser": "^3.723.0", "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.13", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", diff --git a/server/aws-lsp-identity/package.json b/server/aws-lsp-identity/package.json index acaeb6d15d..0e61d97dc8 100644 --- a/server/aws-lsp-identity/package.json +++ b/server/aws-lsp-identity/package.json @@ -26,7 +26,7 @@ "dependencies": { "@aws-sdk/client-sso-oidc": "^3.616.0", "@aws-sdk/token-providers": "^3.744.0", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.12", "@smithy/node-http-handler": "^3.2.5", "@smithy/shared-ini-file-loader": "^4.0.1", diff --git a/server/aws-lsp-json/package.json b/server/aws-lsp-json/package.json index 7b1768f995..66604360fa 100644 --- a/server/aws-lsp-json/package.json +++ b/server/aws-lsp-json/package.json @@ -26,7 +26,7 @@ "prepack": "shx cp ../../LICENSE ../../NOTICE ../../SECURITY.md ." }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.13", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" diff --git a/server/aws-lsp-notification/package.json b/server/aws-lsp-notification/package.json index 45194be66b..f6483e3e32 100644 --- a/server/aws-lsp-notification/package.json +++ b/server/aws-lsp-notification/package.json @@ -22,7 +22,7 @@ "coverage:report": "c8 report --reporter=html --reporter=text" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1" }, diff --git a/server/aws-lsp-partiql/package.json b/server/aws-lsp-partiql/package.json index 263275dced..efc073c7e9 100644 --- a/server/aws-lsp-partiql/package.json +++ b/server/aws-lsp-partiql/package.json @@ -24,7 +24,7 @@ "out" ], "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "antlr4-c3": "3.4.2", "antlr4ng": "3.0.14", "web-tree-sitter": "0.22.6" diff --git a/server/aws-lsp-s3/package.json b/server/aws-lsp-s3/package.json index 53355ff18a..b574da9bc0 100644 --- a/server/aws-lsp-s3/package.json +++ b/server/aws-lsp-s3/package.json @@ -9,7 +9,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.623.0", "@aws-sdk/types": "^3.734.0", - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" diff --git a/server/aws-lsp-yaml/package.json b/server/aws-lsp-yaml/package.json index deeddd9694..e18a72ea29 100644 --- a/server/aws-lsp-yaml/package.json +++ b/server/aws-lsp-yaml/package.json @@ -26,7 +26,7 @@ "postinstall": "node patchYamlPackage.js" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "@aws/lsp-core": "^0.0.13", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", diff --git a/server/device-sso-auth-lsp/package.json b/server/device-sso-auth-lsp/package.json index 698bbf353e..6eba3692a9 100644 --- a/server/device-sso-auth-lsp/package.json +++ b/server/device-sso-auth-lsp/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "vscode-languageserver": "^9.0.1" }, "devDependencies": { diff --git a/server/hello-world-lsp/package.json b/server/hello-world-lsp/package.json index a0ad8e8469..b221272541 100644 --- a/server/hello-world-lsp/package.json +++ b/server/hello-world-lsp/package.json @@ -13,7 +13,7 @@ "coverage:report": "c8 report --reporter=html --reporter=text" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.126", "vscode-languageserver": "^9.0.1" }, "devDependencies": { From f947e1a9da4431d6089b22825f992010c30a470b Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Tue, 19 Aug 2025 08:59:01 -0700 Subject: [PATCH 12/74] fix: fix to add disk caching for mcp admin state (#2139) * fix: fix to add disk caching for mcp admin state * fix: fix to add logging * fix: fix to initialize mcpManager in any case and discover servers based on mcpState * fix: fix for unit test failure --- .../agenticChat/tools/mcp/mcpManager.ts | 18 ++++- .../tools/mcp/profileStatusMonitor.test.ts | 4 +- .../tools/mcp/profileStatusMonitor.ts | 72 ++++++++++++++++--- .../agenticChat/tools/toolServer.ts | 62 +++++++++++----- .../AmazonQTokenServiceManager.ts | 19 +++++ 5 files changed, 142 insertions(+), 33 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index e639807929..844a872485 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -37,6 +37,7 @@ import { Mutex } from 'async-mutex' import path = require('path') import { URI } from 'vscode-uri' import { sanitizeInput } from '../../../../shared/utils' +import { ProfileStatusMonitor } from './profileStatusMonitor' export const MCP_SERVER_STATUS_CHANGED = 'mcpServerStatusChanged' export const AGENT_TOOLS_CHANGED = 'agentToolsChanged' @@ -85,8 +86,15 @@ export class McpManager { if (!McpManager.#instance) { const mgr = new McpManager(agentPaths, features) McpManager.#instance = mgr - await mgr.discoverAllServers() - features.logging.info(`MCP: discovered ${mgr.mcpTools.length} tools across all servers`) + + const shouldDiscoverServers = ProfileStatusMonitor.getMcpState() + + if (shouldDiscoverServers) { + await mgr.discoverAllServers() + features.logging.info(`MCP: discovered ${mgr.mcpTools.length} tools across all servers`) + } else { + features.logging.info('MCP: initialized without server discovery') + } // Emit MCP configuration metrics const serverConfigs = mgr.getAllServerConfigs() @@ -896,7 +904,11 @@ export class McpManager { // Restore the saved tool name mapping this.setToolNameMapping(savedToolNameMapping) - await this.discoverAllServers() + const shouldDiscoverServers = ProfileStatusMonitor.getMcpState() + + if (shouldDiscoverServers) { + await this.discoverAllServers() + } const reinitializedServerCount = McpManager.#instance?.mcpServers.size this.features.logging.info( diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.test.ts index 8ee8454374..77080bf08a 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.test.ts @@ -169,8 +169,8 @@ describe('ProfileStatusMonitor', () => { mockOnMcpEnabled ) - // Initially undefined - expect(ProfileStatusMonitor.getMcpState()).to.be.undefined + // Initially true (default value) + expect(ProfileStatusMonitor.getMcpState()).to.be.true // Set through internal mechanism (simulating state change) ;(ProfileStatusMonitor as any).lastMcpState = false diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts index a436e152ff..ad34550270 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts @@ -13,12 +13,22 @@ import { retryUtils } from '@aws/lsp-core' import { CodeWhispererServiceToken } from '../../../../shared/codeWhispererService' import { DEFAULT_AWS_Q_ENDPOINT_URL, DEFAULT_AWS_Q_REGION } from '../../../../shared/constants' import { AmazonQTokenServiceManager } from '../../../../shared/amazonQServiceManager/AmazonQTokenServiceManager' +import * as fs from 'fs' +import * as path from 'path' +import * as os from 'os' +import { EventEmitter } from 'events' + +export const AUTH_SUCCESS_EVENT = 'authSuccess' export class ProfileStatusMonitor { private intervalId?: NodeJS.Timeout private readonly CHECK_INTERVAL = 24 * 60 * 60 * 1000 // 24 hours private codeWhispererClient?: CodeWhispererServiceToken - private static lastMcpState?: boolean + private static lastMcpState: boolean = true + private static readonly MCP_CACHE_DIR = path.join(os.homedir(), '.aws', 'amazonq', 'mcpAdmin') + private static readonly MCP_CACHE_FILE = path.join(ProfileStatusMonitor.MCP_CACHE_DIR, 'mcp-state.json') + private static eventEmitter = new EventEmitter() + private static logging?: Logging constructor( private credentialsProvider: CredentialsProvider, @@ -27,7 +37,15 @@ export class ProfileStatusMonitor { private sdkInitializator: SDKInitializator, private onMcpDisabled: () => void, private onMcpEnabled?: () => void - ) {} + ) { + ProfileStatusMonitor.logging = logging + ProfileStatusMonitor.loadMcpStateFromDisk() + + // Listen for auth success events + ProfileStatusMonitor.eventEmitter.on(AUTH_SUCCESS_EVENT, () => { + void this.isMcpEnabled() + }) + } async checkInitialState(): Promise { try { @@ -35,8 +53,7 @@ export class ProfileStatusMonitor { return isMcpEnabled !== false // Return true if enabled or API failed } catch (error) { this.logging.debug(`Initial MCP state check failed, defaulting to enabled: ${error}`) - ProfileStatusMonitor.lastMcpState = true - return true + return ProfileStatusMonitor.getMcpState() } } @@ -65,7 +82,7 @@ export class ProfileStatusMonitor { const profileArn = this.getProfileArn() if (!profileArn) { this.logging.debug('No profile ARN available for MCP configuration check') - ProfileStatusMonitor.lastMcpState = true // Default to enabled if no profile + ProfileStatusMonitor.setMcpState(true) return true } @@ -88,7 +105,7 @@ export class ProfileStatusMonitor { const isMcpEnabled = mcpConfig ? mcpConfig.toggle === 'ON' : true if (ProfileStatusMonitor.lastMcpState !== isMcpEnabled) { - ProfileStatusMonitor.lastMcpState = isMcpEnabled + ProfileStatusMonitor.setMcpState(isMcpEnabled) if (!isMcpEnabled) { this.logging.info('MCP configuration disabled - removing tools') this.onMcpDisabled() @@ -101,8 +118,7 @@ export class ProfileStatusMonitor { return isMcpEnabled } catch (error) { this.logging.debug(`MCP configuration check failed, defaulting to enabled: ${error}`) - ProfileStatusMonitor.lastMcpState = true - return true + return ProfileStatusMonitor.getMcpState() } } @@ -116,7 +132,45 @@ export class ProfileStatusMonitor { return undefined } - static getMcpState(): boolean | undefined { + static getMcpState(): boolean { return ProfileStatusMonitor.lastMcpState } + + private static loadMcpStateFromDisk(): void { + try { + if (fs.existsSync(ProfileStatusMonitor.MCP_CACHE_FILE)) { + const data = fs.readFileSync(ProfileStatusMonitor.MCP_CACHE_FILE, 'utf8') + const parsed = JSON.parse(data) + ProfileStatusMonitor.lastMcpState = parsed.enabled ?? true + } + } catch (error) { + ProfileStatusMonitor.logging?.debug(`Failed to load MCP state from disk: ${error}`) + } + ProfileStatusMonitor.setMcpState(ProfileStatusMonitor.lastMcpState) + } + + private static saveMcpStateToDisk(): void { + try { + fs.mkdirSync(ProfileStatusMonitor.MCP_CACHE_DIR, { recursive: true }) + fs.writeFileSync( + ProfileStatusMonitor.MCP_CACHE_FILE, + JSON.stringify({ enabled: ProfileStatusMonitor.lastMcpState }) + ) + } catch (error) { + ProfileStatusMonitor.logging?.debug(`Failed to save MCP state to disk: ${error}`) + } + } + + private static setMcpState(enabled: boolean): void { + ProfileStatusMonitor.lastMcpState = enabled + ProfileStatusMonitor.saveMcpStateToDisk() + } + + static resetMcpState(): void { + ProfileStatusMonitor.setMcpState(true) + } + + static emitAuthSuccess(): void { + ProfileStatusMonitor.eventEmitter.emit(AUTH_SUCCESS_EVENT) + } } diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts index fd692e6e8e..78871faa69 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts @@ -227,7 +227,16 @@ export const McpToolsServer: Server = ({ } registered[server] = [] } - void McpManager.instance.close(true) //keep the instance but close all servers. + + // Only close McpManager if it has been initialized + try { + if (McpManager.instance) { + void McpManager.instance.close(true) //keep the instance but close all servers. + } + } catch (error) { + // McpManager not initialized, skip closing + logging.debug('McpManager not initialized, skipping close operation') + } try { chat?.sendChatUpdate({ @@ -255,11 +264,19 @@ export const McpToolsServer: Server = ({ // Sanitize the tool name // Check if this tool name is already in use + let toolNameMapping = new Map() + try { + toolNameMapping = McpManager.instance.getToolNameMapping() + } catch (error) { + // McpManager not initialized, use empty mapping + logging.debug('McpManager not initialized, using empty tool name mapping') + } + const namespaced = createNamespacedToolName( def.serverName, def.toolName, allNamespacedTools, - McpManager.instance.getToolNameMapping() + toolNameMapping ) const tool = new McpTool({ logging, workspace, lsp }, def) @@ -315,17 +332,20 @@ export const McpToolsServer: Server = ({ McpManager.instance.clearToolNameMapping() - const byServer: Record = {} - for (const d of mgr.getEnabledTools()) { - ;(byServer[d.serverName] ||= []).push(d) - } - for (const [server, defs] of Object.entries(byServer)) { - registerServerTools(server, defs) - } + // Only register tools if MCP is enabled + if (ProfileStatusMonitor.getMcpState()) { + const byServer: Record = {} + for (const d of mgr.getEnabledTools()) { + ;(byServer[d.serverName] ||= []).push(d) + } + for (const [server, defs] of Object.entries(byServer)) { + registerServerTools(server, defs) + } - mgr.events.on(AGENT_TOOLS_CHANGED, (server: string, defs: McpToolDefinition[]) => { - registerServerTools(server, defs) - }) + mgr.events.on(AGENT_TOOLS_CHANGED, (server: string, defs: McpToolDefinition[]) => { + registerServerTools(server, defs) + }) + } } catch (e) { logging.error(`Failed to initialize MCP:' ${e}`) } @@ -353,11 +373,15 @@ export const McpToolsServer: Server = ({ // Wait for profile ARN to be available before checking MCP state const checkAndInitialize = async () => { - const shouldInitialize = await profileStatusMonitor!.checkInitialState() - if (shouldInitialize) { - logging.info('MCP enabled, initializing immediately') - await initializeMcp() + await profileStatusMonitor!.checkInitialState() + // Always initialize McpManager to handle UI requests + await initializeMcp() + + // Remove tools if MCP is disabled + if (!ProfileStatusMonitor.getMcpState()) { + removeAllMcpTools() } + profileStatusMonitor!.start() } @@ -375,7 +399,7 @@ export const McpToolsServer: Server = ({ } else if (Date.now() - startTime < SERVICE_MANAGER_TIMEOUT_MS) { setTimeout(pollForReady, SERVICE_MANAGER_POLL_INTERVAL_MS) } else { - logging.warn('Service manager not ready after 10s, defaulting MCP to enabled') + logging.warn('Service manager not ready after 10s, initializing MCP manager') await initializeMcp() profileStatusMonitor!.start() } @@ -383,8 +407,8 @@ export const McpToolsServer: Server = ({ setTimeout(pollForReady, SERVICE_MANAGER_POLL_INTERVAL_MS) } } catch (error) { - // Service manager not initialized yet, default to enabled - logging.info('Service manager not ready, defaulting MCP to enabled') + // Service manager not initialized yet, always initialize McpManager + logging.info('Service manager not ready, initializing MCP manager') await initializeMcp() profileStatusMonitor!.start() } diff --git a/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/AmazonQTokenServiceManager.ts b/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/AmazonQTokenServiceManager.ts index 8db60a69ab..5a919c9192 100644 --- a/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/AmazonQTokenServiceManager.ts +++ b/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/AmazonQTokenServiceManager.ts @@ -33,6 +33,7 @@ import { getAmazonQRegionAndEndpoint } from './configurationUtils' import { getUserAgent } from '../telemetryUtils' import { StreamingClientServiceToken } from '../streamingClientService' import { parse } from '@aws-sdk/util-arn-parser' +import { ProfileStatusMonitor } from '../../language-server/agenticChat/tools/mcp/profileStatusMonitor' /** * AmazonQTokenServiceManager manages state and provides centralized access to @@ -152,6 +153,9 @@ export class AmazonQTokenServiceManager extends BaseAmazonQServiceManager< this.resetCodewhispererService() this.connectionType = 'none' this.state = 'PENDING_CONNECTION' + + // Reset MCP state cache when auth changes + ProfileStatusMonitor.resetMcpState() } public async handleOnUpdateConfiguration(params: UpdateConfigurationParams, _token: CancellationToken) { @@ -245,6 +249,9 @@ export class AmazonQTokenServiceManager extends BaseAmazonQServiceManager< this.state = 'INITIALIZED' this.log('Initialized Amazon Q service with builderId connection') + // Emit auth success event + ProfileStatusMonitor.emitAuthSuccess() + return } @@ -267,6 +274,9 @@ export class AmazonQTokenServiceManager extends BaseAmazonQServiceManager< this.state = 'INITIALIZED' this.log('Initialized Amazon Q service with identityCenter connection') + // Emit auth success event + ProfileStatusMonitor.emitAuthSuccess() + return } @@ -375,6 +385,9 @@ export class AmazonQTokenServiceManager extends BaseAmazonQServiceManager< `Initialized identityCenter connection to region ${newProfile.identityDetails.region} for profile ${newProfile.arn}` ) + // Emit auth success event + ProfileStatusMonitor.emitAuthSuccess() + return } @@ -385,6 +398,9 @@ export class AmazonQTokenServiceManager extends BaseAmazonQServiceManager< this.activeIdcProfile = newProfile this.state = 'INITIALIZED' + // Emit auth success event + ProfileStatusMonitor.emitAuthSuccess() + return } @@ -428,6 +444,9 @@ export class AmazonQTokenServiceManager extends BaseAmazonQServiceManager< ) this.state = 'INITIALIZED' + // Emit auth success event + ProfileStatusMonitor.emitAuthSuccess() + return } From 43bc9b1120e52f206a4178d0125572aaaccf3c8b Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Tue, 19 Aug 2025 09:44:39 -0700 Subject: [PATCH 13/74] refactor: cleanup old nep code path which is no longered being used in codewhispererServer.ts (#2141) --- .../inline-completion/codeWhispererServer.ts | 124 +++++++----------- 1 file changed, 44 insertions(+), 80 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts index 46a3241978..988bdd418f 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts @@ -468,93 +468,57 @@ export const CodewhispererServerFactory = return false }) - if (suggestionResponse.suggestionType === SuggestionType.COMPLETION) { - const { includeImportsWithSuggestions } = amazonQServiceManager.getConfiguration() - const suggestionsWithRightContext = mergeSuggestionsWithRightContext( - session.requestContext.fileContext.rightFileContent, - filteredSuggestions, - includeImportsWithSuggestions, - selectionRange - ).filter(suggestion => { - // Discard suggestions that have empty string insertText after right context merge and can't be displayed anymore - if (suggestion.insertText === '') { - session.setSuggestionState(suggestion.itemId, 'Discard') - return false - } - - return true - }) - - suggestionsWithRightContext.forEach(suggestion => { - const cachedSuggestion = session.suggestions.find(s => s.itemId === suggestion.itemId) - if (cachedSuggestion) cachedSuggestion.insertText = suggestion.insertText.toString() - }) + const { includeImportsWithSuggestions } = amazonQServiceManager.getConfiguration() + const suggestionsWithRightContext = mergeSuggestionsWithRightContext( + session.requestContext.fileContext.rightFileContent, + filteredSuggestions, + includeImportsWithSuggestions, + selectionRange + ).filter(suggestion => { + // Discard suggestions that have empty string insertText after right context merge and can't be displayed anymore + if (suggestion.insertText === '') { + session.setSuggestionState(suggestion.itemId, 'Discard') + return false + } - // TODO: need dedupe after right context merging but I don't see one - session.suggestionsAfterRightContextMerge.push(...suggestionsWithRightContext) + return true + }) - session.codewhispererSuggestionImportCount = - session.codewhispererSuggestionImportCount + - suggestionsWithRightContext.reduce((total, suggestion) => { - return total + (suggestion.mostRelevantMissingImports?.length || 0) - }, 0) + suggestionsWithRightContext.forEach(suggestion => { + const cachedSuggestion = session.suggestions.find(s => s.itemId === suggestion.itemId) + if (cachedSuggestion) cachedSuggestion.insertText = suggestion.insertText.toString() + }) - // If after all server-side filtering no suggestions can be displayed, and there is no nextToken - // close session and return empty results - if ( - session.suggestionsAfterRightContextMerge.length === 0 && - !suggestionResponse.responseContext.nextToken - ) { - completionSessionManager.closeSession(session) - await emitUserTriggerDecisionTelemetry( - telemetry, - telemetryService, - session, - timeSinceLastUserModification - ) + // TODO: need dedupe after right context merging but I don't see one + session.suggestionsAfterRightContextMerge.push(...suggestionsWithRightContext) - return EMPTY_RESULT - } + session.codewhispererSuggestionImportCount = + session.codewhispererSuggestionImportCount + + suggestionsWithRightContext.reduce((total, suggestion) => { + return total + (suggestion.mostRelevantMissingImports?.length || 0) + }, 0) - return { - items: suggestionsWithRightContext, - sessionId: session.id, - partialResultToken: suggestionResponse.responseContext.nextToken, - } - } else { - return { - items: suggestionResponse.suggestions - .map(suggestion => { - // Check if this suggestion is similar to a previously rejected edit - const isSimilarToRejected = rejectedEditTracker.isSimilarToRejected( - suggestion.content, - textDocument?.uri || '' - ) + // If after all server-side filtering no suggestions can be displayed, and there is no nextToken + // close session and return empty results + if ( + session.suggestionsAfterRightContextMerge.length === 0 && + !suggestionResponse.responseContext.nextToken + ) { + completionSessionManager.closeSession(session) + await emitUserTriggerDecisionTelemetry( + telemetry, + telemetryService, + session, + timeSinceLastUserModification + ) - if (isSimilarToRejected) { - // Mark as rejected in the session - session.setSuggestionState(suggestion.itemId, 'Reject') - logging.debug( - `[EDIT_PREDICTION] Filtered out suggestion similar to previously rejected edit` - ) - // Return empty item that will be filtered out - return { - insertText: '', - isInlineEdit: true, - itemId: suggestion.itemId, - } - } + return EMPTY_RESULT + } - return { - insertText: suggestion.content, - isInlineEdit: true, - itemId: suggestion.itemId, - } - }) - .filter(item => item.insertText !== ''), - sessionId: session.id, - partialResultToken: suggestionResponse.responseContext.nextToken, - } + return { + items: suggestionsWithRightContext, + sessionId: session.id, + partialResultToken: suggestionResponse.responseContext.nextToken, } } From 5e4435dfaea7bf8c00e6a27b9bb0d40f699d4e01 Mon Sep 17 00:00:00 2001 From: Jiatong Li Date: Tue, 19 Aug 2025 12:12:39 -0700 Subject: [PATCH 14/74] fix(amazonq): add server side control for WCS features (#2128) Co-authored-by: Jiatong Li --- .../workspaceContext/IdleWorkspaceManager.ts | 6 +- .../workspaceContextServer.ts | 3 +- .../workspaceFolderManager.test.ts | 90 +++++++++++++++++++ .../workspaceFolderManager.ts | 47 ++++++++-- 4 files changed, 139 insertions(+), 7 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/IdleWorkspaceManager.ts b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/IdleWorkspaceManager.ts index 5a8359ccac..1e27a7f762 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/IdleWorkspaceManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/IdleWorkspaceManager.ts @@ -2,7 +2,7 @@ import { WorkspaceFolderManager } from './workspaceFolderManager' export class IdleWorkspaceManager { private static readonly idleThreshold = 30 * 60 * 1000 // 30 minutes - private static lastActivityTimestamp = 0 // treat session as idle as the start + private static lastActivityTimestamp = 0 // treat session as idle at the start private constructor() {} @@ -30,6 +30,10 @@ export class IdleWorkspaceManager { } } + public static setSessionAsIdle(): void { + IdleWorkspaceManager.lastActivityTimestamp = 0 + } + public static isSessionIdle(): boolean { const currentTime = Date.now() const timeSinceLastActivity = currentTime - IdleWorkspaceManager.lastActivityTimestamp diff --git a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceContextServer.ts b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceContextServer.ts index c536c1087d..3d638e337a 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceContextServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceContextServer.ts @@ -221,6 +221,7 @@ export const WorkspaceContextServer = (): Server => features => { isLoggedInUsingBearerToken(credentialsProvider) && abTestingEnabled && !workspaceFolderManager.getOptOutStatus() && + !workspaceFolderManager.isFeatureDisabled() && workspaceIdentifier ) } @@ -302,7 +303,7 @@ export const WorkspaceContextServer = (): Server => features => { await evaluateABTesting() isWorkflowInitialized = true - workspaceFolderManager.resetAdminOptOutStatus() + workspaceFolderManager.resetAdminOptOutAndFeatureDisabledStatus() if (!isUserEligibleForWorkspaceContext()) { return } diff --git a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceFolderManager.test.ts b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceFolderManager.test.ts index 7ab596a930..cbdb71db1d 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceFolderManager.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceFolderManager.test.ts @@ -8,6 +8,7 @@ import { ArtifactManager } from './artifactManager' import { CodeWhispererServiceToken } from '../../shared/codeWhispererService' import { ListWorkspaceMetadataResponse } from '../../client/token/codewhispererbearertokenclient' import { IdleWorkspaceManager } from './IdleWorkspaceManager' +import { AWSError } from 'aws-sdk' describe('WorkspaceFolderManager', () => { let mockServiceManager: StubbedInstance @@ -135,4 +136,93 @@ describe('WorkspaceFolderManager', () => { ) }) }) + + describe('isFeatureDisabled', () => { + it('should return true when feature is disabled', async () => { + // Setup + const workspaceFolders: WorkspaceFolder[] = [ + { + uri: 'file:///test/workspace', + name: 'test-workspace', + }, + ] + + // Mock listWorkspaceMetadata to throw AccessDeniedException with feature not supported + const mockError: AWSError = { + name: 'AccessDeniedException', + message: 'Feature is not supported', + code: 'AccessDeniedException', + time: new Date(), + retryable: false, + statusCode: 403, + } + + mockCodeWhispererService.listWorkspaceMetadata.rejects(mockError) + + // Create the WorkspaceFolderManager instance + workspaceFolderManager = WorkspaceFolderManager.createInstance( + mockServiceManager, + mockLogging, + mockArtifactManager, + mockDependencyDiscoverer, + workspaceFolders, + mockCredentialsProvider, + 'test-workspace-identifier' + ) + + // Spy on clearAllWorkspaceResources and related methods + const clearAllWorkspaceResourcesSpy = sinon.stub( + workspaceFolderManager as any, + 'clearAllWorkspaceResources' + ) + + // Act - trigger listWorkspaceMetadata which sets feature disabled state + await (workspaceFolderManager as any).listWorkspaceMetadata() + + // Assert + expect(workspaceFolderManager.isFeatureDisabled()).toBe(true) + + // Verify that clearAllWorkspaceResources was called + sinon.assert.calledOnce(clearAllWorkspaceResourcesSpy) + }) + + it('should return false when feature is not disabled', async () => { + // Setup + const workspaceFolders: WorkspaceFolder[] = [ + { + uri: 'file:///test/workspace', + name: 'test-workspace', + }, + ] + + // Mock successful response + const mockResponse: ListWorkspaceMetadataResponse = { + workspaces: [ + { + workspaceId: 'test-workspace-id', + workspaceStatus: 'RUNNING', + }, + ], + } + + mockCodeWhispererService.listWorkspaceMetadata.resolves(mockResponse as any) + + // Create the WorkspaceFolderManager instance + workspaceFolderManager = WorkspaceFolderManager.createInstance( + mockServiceManager, + mockLogging, + mockArtifactManager, + mockDependencyDiscoverer, + workspaceFolders, + mockCredentialsProvider, + 'test-workspace-identifier' + ) + + // Act - trigger listWorkspaceMetadata + await (workspaceFolderManager as any).listWorkspaceMetadata() + + // Assert + expect(workspaceFolderManager.isFeatureDisabled()).toBe(false) + }) + }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceFolderManager.ts b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceFolderManager.ts index 99fc9c4628..1644851258 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceFolderManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceFolderManager.ts @@ -55,6 +55,7 @@ export class WorkspaceFolderManager { private optOutMonitorInterval: NodeJS.Timeout | undefined private messageQueueConsumerInterval: NodeJS.Timeout | undefined private isOptedOut: boolean = false + private featureDisabled: boolean = false // Serve as a server-side control. If true, stop WCS features private isCheckingRemoteWorkspaceStatus: boolean = false private isArtifactUploadedToRemoteWorkspace: boolean = false @@ -139,8 +140,13 @@ export class WorkspaceFolderManager { return this.isOptedOut } - resetAdminOptOutStatus(): void { + resetAdminOptOutAndFeatureDisabledStatus(): void { this.isOptedOut = false + this.featureDisabled = false + } + + isFeatureDisabled(): boolean { + return this.featureDisabled } getWorkspaceState(): WorkspaceState { @@ -326,6 +332,7 @@ export class WorkspaceFolderManager { // Reset workspace ID to force operations to wait for new remote workspace information this.resetRemoteWorkspaceId() + IdleWorkspaceManager.setSessionAsIdle() this.isArtifactUploadedToRemoteWorkspace = false // Set up message queue consumer @@ -371,7 +378,9 @@ export class WorkspaceFolderManager { return resolve(false) } - const { metadata, optOut } = await this.listWorkspaceMetadata(this.workspaceIdentifier) + const { metadata, optOut, featureDisabled } = await this.listWorkspaceMetadata( + this.workspaceIdentifier + ) if (optOut) { this.logging.log(`User opted out during initial connection`) @@ -381,6 +390,13 @@ export class WorkspaceFolderManager { return resolve(false) } + if (featureDisabled) { + this.logging.log(`Feature disabled during initial connection`) + this.featureDisabled = true + this.clearAllWorkspaceResources() + return resolve(false) + } + if (!metadata) { // Continue polling by exiting only this iteration return @@ -437,7 +453,9 @@ export class WorkspaceFolderManager { } this.logging.log(`Checking remote workspace status for workspace [${this.workspaceIdentifier}]`) - const { metadata, optOut, error } = await this.listWorkspaceMetadata(this.workspaceIdentifier) + const { metadata, optOut, featureDisabled, error } = await this.listWorkspaceMetadata( + this.workspaceIdentifier + ) if (optOut) { this.logging.log('User opted out, clearing all resources and starting opt-out monitor') @@ -447,6 +465,13 @@ export class WorkspaceFolderManager { return } + if (featureDisabled) { + this.logging.log('Feature disabled, clearing all resources and stoping server-side indexing features') + this.featureDisabled = true + this.clearAllWorkspaceResources() + return + } + if (error) { // Do not do anything if we received an exception but not caused by optOut return @@ -528,7 +553,14 @@ export class WorkspaceFolderManager { if (this.optOutMonitorInterval === undefined) { const intervalId = setInterval(async () => { try { - const { optOut } = await this.listWorkspaceMetadata() + const { optOut, featureDisabled } = await this.listWorkspaceMetadata() + + if (featureDisabled) { + // Stop opt-out monitor when WCS feature is disabled from server-side + this.featureDisabled = true + clearInterval(intervalId) + this.optOutMonitorInterval = undefined + } if (!optOut) { this.isOptedOut = false @@ -735,10 +767,12 @@ export class WorkspaceFolderManager { private async listWorkspaceMetadata(workspaceRoot?: WorkspaceRoot): Promise<{ metadata: WorkspaceMetadata | undefined | null optOut: boolean + featureDisabled: boolean error: any }> { let metadata: WorkspaceMetadata | undefined | null let optOut = false + let featureDisabled = false let error: any try { const params = workspaceRoot ? { workspaceRoot } : {} @@ -754,8 +788,11 @@ export class WorkspaceFolderManager { this.logging.log(`User's administrator opted out server-side workspace context`) optOut = true } + if (isAwsError(e) && e.code === 'AccessDeniedException' && e.message.includes('Feature is not supported')) { + featureDisabled = true + } } - return { metadata, optOut, error } + return { metadata, optOut, featureDisabled, error } } private async createWorkspace(workspaceRoot: WorkspaceRoot): Promise<{ From b76cd85f1f09bcbffed3e368aaf15dd537ddb3f1 Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Tue, 19 Aug 2025 13:00:37 -0700 Subject: [PATCH 15/74] chore: update STE userContext version metadata (#2142) --- .../agenticChat/qAgenticChatServer.ts | 2 +- .../src/language-server/chat/qChatServer.ts | 4 ++- .../inline-completion/codeWhispererServer.ts | 4 ++- .../workspaceContextServer.ts | 7 ++++- .../BaseAmazonQServiceManager.ts | 5 ++++ .../src/shared/telemetryUtils.test.ts | 30 +++++++++++-------- .../src/shared/telemetryUtils.ts | 13 +++++--- 7 files changed, 45 insertions(+), 20 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/qAgenticChatServer.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/qAgenticChatServer.ts index 205e5aff69..445ca78d85 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/qAgenticChatServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/qAgenticChatServer.ts @@ -110,7 +110,7 @@ export const QAgenticChatServer = ) ) - const userContext = makeUserContextObject(clientParams, runtime.platform, 'CHAT') + const userContext = makeUserContextObject(clientParams, runtime.platform, 'CHAT', amazonQServiceManager.serverInfo) telemetryService.updateUserContext(userContext) chatController = new AgenticChatController( diff --git a/server/aws-lsp-codewhisperer/src/language-server/chat/qChatServer.ts b/server/aws-lsp-codewhisperer/src/language-server/chat/qChatServer.ts index 2452426b1b..d110ea4e41 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/chat/qChatServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/chat/qChatServer.ts @@ -59,7 +59,9 @@ export const QChatServerFactory = 'TelemetryService initialized before LSP connection was initialized.' ) ) - telemetryService.updateUserContext(makeUserContextObject(clientParams, runtime.platform, 'CHAT')) + telemetryService.updateUserContext( + makeUserContextObject(clientParams, runtime.platform, 'CHAT', amazonQServiceManager.serverInfo) + ) chatController = new ChatController( chatSessionManagementService, diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts index 988bdd418f..33113fa318 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts @@ -723,7 +723,9 @@ export const CodewhispererServerFactory = ?.inlineCompletionWithReferences?.inlineEditSupport ?? false telemetryService = new TelemetryService(amazonQServiceManager, credentialsProvider, telemetry, logging) - telemetryService.updateUserContext(makeUserContextObject(clientParams, runtime.platform, 'INLINE')) + telemetryService.updateUserContext( + makeUserContextObject(clientParams, runtime.platform, 'INLINE', amazonQServiceManager.serverInfo) + ) codePercentageTracker = new CodePercentageTracker(telemetryService) codeDiffTracker = new CodeDiffTracker( diff --git a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceContextServer.ts b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceContextServer.ts index 3d638e337a..92dc0823e3 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceContextServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/workspaceContext/workspaceContextServer.ts @@ -188,7 +188,12 @@ export const WorkspaceContextServer = (): Server => features => { abTestingEnabled = true } else { const clientParams = safeGet(lsp.getClientInitializeParams()) - const userContext = makeUserContextObject(clientParams, runtime.platform, 'CodeWhisperer') ?? { + const userContext = makeUserContextObject( + clientParams, + runtime.platform, + 'CodeWhisperer', + amazonQServiceManager.serverInfo + ) ?? { ideCategory: 'VSCODE', operatingSystem: 'MAC', product: 'CodeWhisperer', diff --git a/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/BaseAmazonQServiceManager.ts b/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/BaseAmazonQServiceManager.ts index 9c241809a7..cc21cd8766 100644 --- a/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/BaseAmazonQServiceManager.ts +++ b/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/BaseAmazonQServiceManager.ts @@ -17,6 +17,7 @@ import { } from './configurationUtils' import { AmazonQServiceInitializationError } from './errors' import { StreamingClientServiceBase } from '../streamingClientService' +import { UserContext } from '../../client/token/codewhispererbearertokenclient' export interface QServiceManagerFeatures { lsp: Lsp @@ -86,6 +87,10 @@ export abstract class BaseAmazonQServiceManager< abstract getCodewhispererService(): C abstract getStreamingClient(): S + get serverInfo() { + return this.features.runtime.serverInfo + } + public getConfiguration(): Readonly { return this.configurationCache.getConfig() } diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.test.ts b/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.test.ts index 565a9505a4..0cfa7fd768 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.test.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.test.ts @@ -1,6 +1,6 @@ import * as assert from 'assert' import * as sinon from 'sinon' -import { InitializeParams, Platform } from '@aws/language-server-runtimes/server-interface' +import { InitializeParams, Platform, ServerInfo } from '@aws/language-server-runtimes/server-interface' import { getUserAgent, makeUserContextObject } from './telemetryUtils' describe('getUserAgent', () => { @@ -115,6 +115,7 @@ describe('getUserAgent', () => { describe('makeUserContextObject', () => { let mockInitializeParams: InitializeParams + let mockServerInfo: ServerInfo // let osStub: sinon.SinonStubbedInstance<{ now: () => number }> beforeEach(() => { @@ -123,10 +124,10 @@ describe('makeUserContextObject', () => { aws: { clientInfo: { name: 'test-custom-client-name', - version: '1.2.3', + version: '1.0.0', extension: { name: 'AmazonQ-For-VSCode', - version: '2.2.2', + version: '2.0.0', }, clientId: 'test-client-id', }, @@ -138,6 +139,11 @@ describe('makeUserContextObject', () => { }, } as InitializeParams + mockServerInfo = { + name: 'foo', + version: '3.0.0', + } + sinon.stub(process, 'platform').value('win32') }) @@ -146,33 +152,33 @@ describe('makeUserContextObject', () => { }) it('should return a valid UserContext object', () => { - const result = makeUserContextObject(mockInitializeParams, 'win32', 'TestProduct') + const result = makeUserContextObject(mockInitializeParams, 'win32', 'TestProduct', mockServerInfo) assert(result) assert.ok('ideCategory' in result) assert.ok('operatingSystem' in result) assert.strictEqual(result.operatingSystem, 'WINDOWS') assert.strictEqual(result.product, 'TestProduct') assert.strictEqual(result.clientId, 'test-client-id') - assert.strictEqual(result.ideVersion, '1.2.3') + assert.strictEqual(result.ideVersion, 'ide=1.0.0;plugin=2.0.0;lsp=3.0.0') }) it('should prefer initializationOptions.aws version over clientInfo version', () => { - const result = makeUserContextObject(mockInitializeParams, 'linux', 'TestProduct') - assert.strictEqual(result?.ideVersion, '1.2.3') + const result = makeUserContextObject(mockInitializeParams, 'linux', 'TestProduct', mockServerInfo) + assert.strictEqual(result?.ideVersion, 'ide=1.0.0;plugin=2.0.0;lsp=3.0.0') }) it('should use clientInfo version if initializationOptions.aws version is not available', () => { // @ts-ignore mockInitializeParams.initializationOptions.aws.clientInfo.version = undefined - const result = makeUserContextObject(mockInitializeParams, 'linux', 'TestProduct') - assert.strictEqual(result?.ideVersion, '1.1.1') + const result = makeUserContextObject(mockInitializeParams, 'linux', 'TestProduct', mockServerInfo) + assert.strictEqual(result?.ideVersion, 'ide=1.1.1;plugin=2.0.0;lsp=3.0.0') }) it('should return undefined if ideCategory is not in IDE_CATEGORY_MAP', () => { // @ts-ignore mockInitializeParams.initializationOptions.aws.clientInfo.extension.name = 'Unknown IDE' - const result = makeUserContextObject(mockInitializeParams, 'linux', 'TestProduct') + const result = makeUserContextObject(mockInitializeParams, 'linux', 'TestProduct', mockServerInfo) assert.strictEqual(result, undefined) }) @@ -188,7 +194,7 @@ describe('makeUserContextObject', () => { // @ts-ignore mockInitializeParams.initializationOptions.aws.clientInfo.extension.name = clientName - const result = makeUserContextObject(mockInitializeParams, 'linux', 'TestProduct') + const result = makeUserContextObject(mockInitializeParams, 'linux', 'TestProduct', mockServerInfo) switch (clientName) { case 'AmazonQ-For-VSCode': assert.strictEqual(result?.ideCategory, 'VSCODE') @@ -222,7 +228,7 @@ describe('makeUserContextObject', () => { ] platforms.forEach(platform => { - const result = makeUserContextObject(mockInitializeParams, platform, 'TestProduct') + const result = makeUserContextObject(mockInitializeParams, platform, 'TestProduct', mockServerInfo) switch (platform) { case 'win32': assert.strictEqual(result?.operatingSystem, 'WINDOWS') diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.ts b/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.ts index 73e94d4233..49020a8822 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.ts @@ -89,15 +89,20 @@ const getOperatingSystem = (platform: Platform) => { export const makeUserContextObject = ( initializeParams: InitializeParams, platform: Platform, - product: string + product: string, + serverInfo: ServerInfo ): UserContext | undefined => { + const ide = getIdeCategory(initializeParams) + const ideVersion = + initializeParams.initializationOptions?.aws?.clientInfo?.version || initializeParams.clientInfo?.version + const pluginVersion = initializeParams.initializationOptions?.aws?.clientInfo?.extension?.version || '' + const lspVersion = serverInfo.version ?? '' const userContext: UserContext = { - ideCategory: getIdeCategory(initializeParams), + ideCategory: ide, operatingSystem: getOperatingSystem(platform), product: product, clientId: initializeParams.initializationOptions?.aws?.clientInfo?.clientId, - ideVersion: - initializeParams.initializationOptions?.aws?.clientInfo?.version || initializeParams.clientInfo?.version, + ideVersion: `ide=${ideVersion};plugin=${pluginVersion};lsp=${lspVersion}`, } if (userContext.ideCategory === 'UNKNOWN' || userContext.operatingSystem === 'UNKNOWN') { From 04588dfc33f0d85dbd488814a474b5e354398df0 Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Tue, 19 Aug 2025 13:12:00 -0700 Subject: [PATCH 16/74] fix: fix to turn on and off MCP servers incase of error based on last state (#2143) Co-authored-by: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> --- .../agenticChat/tools/mcp/profileStatusMonitor.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts index ad34550270..53a4da9090 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts @@ -118,7 +118,13 @@ export class ProfileStatusMonitor { return isMcpEnabled } catch (error) { this.logging.debug(`MCP configuration check failed, defaulting to enabled: ${error}`) - return ProfileStatusMonitor.getMcpState() + const mcpState = ProfileStatusMonitor.getMcpState() + if (!mcpState) { + this.onMcpDisabled() + } else if (this.onMcpEnabled) { + this.onMcpEnabled() + } + return mcpState } } From b8e52682ac2b2337e1d0a32759e8beccde889cee Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Tue, 19 Aug 2025 14:57:14 -0700 Subject: [PATCH 17/74] fix: empty userTriggerDecision not being sent for NEP code path (#2140) * refactor: clean up old NEP code path which is no longer used * fix: empty userTriggerDecision not being sent for NEP code path * test: disable telemetry test temporarily * fix: patch * revert: a * revert: a --- .../editCompletionHandler.ts | 41 +++++-------------- .../inline-completion/telemetry.ts | 30 ++++++++++++++ 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts index 28e29ee271..005b5ab3f0 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts @@ -23,12 +23,12 @@ import { CodewhispererLanguage, getSupportedLanguageId } from '../../shared/lang import { WorkspaceFolderManager } from '../workspaceContext/workspaceFolderManager' import { shouldTriggerEdits } from './trigger' import { + emitEmptyUserTriggerDecisionTelemetry, emitServiceInvocationFailure, emitServiceInvocationTelemetry, emitUserTriggerDecisionTelemetry, } from './telemetry' import { TelemetryService } from '../../shared/telemetry/telemetryService' -import { mergeEditSuggestionsWithFileContext } from './mergeRightUtils' import { textUtils } from '@aws/lsp-core' import { AmazonQBaseServiceManager } from '../../shared/amazonQServiceManager/BaseAmazonQServiceManager' import { RejectedEditTracker } from './tracker/rejectedEditTracker' @@ -353,35 +353,16 @@ export class EditCompletionHandler { this.sessionManager.activateSession(session) // Process suggestions to apply Empty or Filter filters - const filteredSuggestions = suggestionResponse.suggestions - // Empty suggestion filter - .filter(suggestion => { - if (suggestion.content === '') { - session.setSuggestionState(suggestion.itemId, 'Empty') - return false - } - - return true - }) - // References setting filter - .filter(suggestion => { - // State to track whether code with references should be included in - // the response. No locking or concurrency controls, filtering is done - // right before returning and is only guaranteed to be consistent within - // the context of a single response. - const { includeSuggestionsWithCodeReferences } = this.amazonQServiceManager.getConfiguration() - if (includeSuggestionsWithCodeReferences) { - return true - } - - if (suggestion.references == null || suggestion.references.length === 0) { - return true - } - - // Filter out suggestions that have references when includeSuggestionsWithCodeReferences setting is true - session.setSuggestionState(suggestion.itemId, 'Filter') - return false - }) + if (suggestionResponse.suggestions.length === 0) { + this.sessionManager.closeSession(session) + await emitEmptyUserTriggerDecisionTelemetry( + this.telemetryService, + session, + this.documentChangedListener.timeSinceLastUserModification, + this.editsEnabled ? this.sessionManager.getAndUpdateStreakLength(false) : 0 + ) + return EMPTY_RESULT + } return { items: suggestionResponse.suggestions diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/telemetry.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/telemetry.ts index d53d141a2b..73e3a526a4 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/telemetry.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/telemetry.ts @@ -106,6 +106,36 @@ export const emitPerceivedLatencyTelemetry = (telemetry: Telemetry, session: Cod }) } +export async function emitEmptyUserTriggerDecisionTelemetry( + telemetryService: TelemetryService, + session: CodeWhispererSession, + timeSinceLastUserModification?: number, + streakLength?: number +) { + // Prevent reporting user decision if it was already sent + if (session.reportedUserDecision) { + return + } + + // Non-blocking + emitAggregatedUserTriggerDecisionTelemetry( + telemetryService, + session, + 'Empty', + timeSinceLastUserModification, + 0, + 0, + [], + [], + streakLength + ) + .then() + .catch(e => {}) + .finally(() => { + session.reportedUserDecision = true + }) +} + export const emitUserTriggerDecisionTelemetry = async ( telemetry: Telemetry, telemetryService: TelemetryService, From c5468cbe6a594d16b7619a6ed37676f9f1045c19 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 13:03:46 -0700 Subject: [PATCH 18/74] chore(release): release packages from branch main (#2117) --- .release-please-manifest.json | 14 ++++----- chat-client/CHANGELOG.md | 14 +++++++++ chat-client/package.json | 2 +- core/aws-lsp-core/CHANGELOG.md | 12 ++++++++ core/aws-lsp-core/package.json | 2 +- package-lock.json | 22 +++++++------- server/aws-lsp-antlr4/CHANGELOG.md | 14 +++++++++ server/aws-lsp-antlr4/package.json | 4 +-- server/aws-lsp-codewhisperer/CHANGELOG.md | 35 +++++++++++++++++++++++ server/aws-lsp-codewhisperer/package.json | 4 +-- server/aws-lsp-json/CHANGELOG.md | 14 +++++++++ server/aws-lsp-json/package.json | 4 +-- server/aws-lsp-partiql/CHANGELOG.md | 7 +++++ server/aws-lsp-partiql/package.json | 2 +- server/aws-lsp-yaml/CHANGELOG.md | 14 +++++++++ server/aws-lsp-yaml/package.json | 4 +-- 16 files changed, 139 insertions(+), 29 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e6abdf7be2..159795a30e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,9 +1,9 @@ { - "chat-client": "0.1.32", - "core/aws-lsp-core": "0.0.13", - "server/aws-lsp-antlr4": "0.1.17", - "server/aws-lsp-codewhisperer": "0.0.73", - "server/aws-lsp-json": "0.1.17", - "server/aws-lsp-partiql": "0.0.16", - "server/aws-lsp-yaml": "0.1.17" + "chat-client": "0.1.33", + "core/aws-lsp-core": "0.0.14", + "server/aws-lsp-antlr4": "0.1.18", + "server/aws-lsp-codewhisperer": "0.0.74", + "server/aws-lsp-json": "0.1.18", + "server/aws-lsp-partiql": "0.0.17", + "server/aws-lsp-yaml": "0.1.18" } diff --git a/chat-client/CHANGELOG.md b/chat-client/CHANGELOG.md index 1cd9acfbe0..995ddc8ae6 100644 --- a/chat-client/CHANGELOG.md +++ b/chat-client/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.1.33](https://github.com/aws/language-servers/compare/chat-client/v0.1.32...chat-client/v0.1.33) (2025-08-19) + + +### Features + +* **amazonq:** added mcp admin level configuration with GetProfile ([#2000](https://github.com/aws/language-servers/issues/2000)) ([fd6e9a8](https://github.com/aws/language-servers/commit/fd6e9a829c6229c276de5340dffce52b426a864d)) +* **amazonq:** read tool ui revamp ([#2113](https://github.com/aws/language-servers/issues/2113)) ([#2121](https://github.com/aws/language-servers/issues/2121)) ([93cf229](https://github.com/aws/language-servers/commit/93cf229149ba60491f9f5763793db4a9f570b611)) + + +### Bug Fixes + +* fix for button text and remove profilearn caching ([#2137](https://github.com/aws/language-servers/issues/2137)) ([2a4171a](https://github.com/aws/language-servers/commit/2a4171a74c15c23c23c481060496162bcc9e6284)) +* Use file context override in the inline completion params for Jupyter Notebook ([#2114](https://github.com/aws/language-servers/issues/2114)) ([91c8398](https://github.com/aws/language-servers/commit/91c839857f8aa4d79098189f9fb620b361c51289)) + ## [0.1.32](https://github.com/aws/language-servers/compare/chat-client/v0.1.31...chat-client/v0.1.32) (2025-08-11) diff --git a/chat-client/package.json b/chat-client/package.json index 65dee12960..1af265fdfe 100644 --- a/chat-client/package.json +++ b/chat-client/package.json @@ -1,6 +1,6 @@ { "name": "@aws/chat-client", - "version": "0.1.32", + "version": "0.1.33", "description": "AWS Chat Client", "main": "out/index.js", "repository": { diff --git a/core/aws-lsp-core/CHANGELOG.md b/core/aws-lsp-core/CHANGELOG.md index 9e2e616f55..0e1e63dd38 100644 --- a/core/aws-lsp-core/CHANGELOG.md +++ b/core/aws-lsp-core/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [0.0.14](https://github.com/aws/language-servers/compare/lsp-core/v0.0.13...lsp-core/v0.0.14) (2025-08-19) + + +### Features + +* **amazonq:** added mcp admin level configuration with GetProfile ([#2000](https://github.com/aws/language-servers/issues/2000)) ([fd6e9a8](https://github.com/aws/language-servers/commit/fd6e9a829c6229c276de5340dffce52b426a864d)) + + +### Bug Fixes + +* Use file context override in the inline completion params for Jupyter Notebook ([#2114](https://github.com/aws/language-servers/issues/2114)) ([91c8398](https://github.com/aws/language-servers/commit/91c839857f8aa4d79098189f9fb620b361c51289)) + ## [0.0.13](https://github.com/aws/language-servers/compare/lsp-core/v0.0.12...lsp-core/v0.0.13) (2025-08-04) diff --git a/core/aws-lsp-core/package.json b/core/aws-lsp-core/package.json index 04081f13fc..4ecdd4e238 100644 --- a/core/aws-lsp-core/package.json +++ b/core/aws-lsp-core/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-core", - "version": "0.0.13", + "version": "0.0.14", "description": "Core library, contains common code and utilities", "main": "out/index.js", "repository": { diff --git a/package-lock.json b/package-lock.json index 128ae8083d..97b89d43b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -251,7 +251,7 @@ }, "chat-client": { "name": "@aws/chat-client", - "version": "0.1.32", + "version": "0.1.33", "license": "Apache-2.0", "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", @@ -293,7 +293,7 @@ }, "core/aws-lsp-core": { "name": "@aws/lsp-core", - "version": "0.0.13", + "version": "0.0.14", "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.126", @@ -28605,11 +28605,11 @@ }, "server/aws-lsp-antlr4": { "name": "@aws/lsp-antlr4", - "version": "0.1.17", + "version": "0.1.18", "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.126", - "@aws/lsp-core": "^0.0.13" + "@aws/lsp-core": "^0.0.14" }, "devDependencies": { "@babel/plugin-transform-modules-commonjs": "^7.24.1", @@ -28670,7 +28670,7 @@ }, "server/aws-lsp-codewhisperer": { "name": "@aws/lsp-codewhisperer", - "version": "0.0.73", + "version": "0.0.74", "bundleDependencies": [ "@amzn/codewhisperer-streaming", "@amzn/amazon-q-developer-streaming-client" @@ -28684,7 +28684,7 @@ "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", "@aws/language-server-runtimes": "^0.2.126", - "@aws/lsp-core": "^0.0.13", + "@aws/lsp-core": "^0.0.14", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", "adm-zip": "^0.5.10", @@ -28885,11 +28885,11 @@ }, "server/aws-lsp-json": { "name": "@aws/lsp-json", - "version": "0.1.17", + "version": "0.1.18", "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.126", - "@aws/lsp-core": "^0.0.13", + "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" }, @@ -28963,7 +28963,7 @@ }, "server/aws-lsp-partiql": { "name": "@aws/lsp-partiql", - "version": "0.0.16", + "version": "0.0.17", "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.126", @@ -29015,12 +29015,12 @@ }, "server/aws-lsp-yaml": { "name": "@aws/lsp-yaml", - "version": "0.1.17", + "version": "0.1.18", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.126", - "@aws/lsp-core": "^0.0.13", + "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", "yaml-language-server": "1.13.0" diff --git a/server/aws-lsp-antlr4/CHANGELOG.md b/server/aws-lsp-antlr4/CHANGELOG.md index bde43f2c3c..e1458575e1 100644 --- a/server/aws-lsp-antlr4/CHANGELOG.md +++ b/server/aws-lsp-antlr4/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.1.18](https://github.com/aws/language-servers/compare/lsp-antlr4/v0.1.17...lsp-antlr4/v0.1.18) (2025-08-19) + + +### Bug Fixes + +* Use file context override in the inline completion params for Jupyter Notebook ([#2114](https://github.com/aws/language-servers/issues/2114)) ([91c8398](https://github.com/aws/language-servers/commit/91c839857f8aa4d79098189f9fb620b361c51289)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @aws/lsp-core bumped from ^0.0.13 to ^0.0.14 + ## [0.1.17](https://github.com/aws/language-servers/compare/lsp-antlr4/v0.1.16...lsp-antlr4/v0.1.17) (2025-08-04) diff --git a/server/aws-lsp-antlr4/package.json b/server/aws-lsp-antlr4/package.json index 9ba8186aab..b61239d633 100644 --- a/server/aws-lsp-antlr4/package.json +++ b/server/aws-lsp-antlr4/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-antlr4", - "version": "0.1.17", + "version": "0.1.18", "description": "ANTLR4 language server", "main": "out/index.js", "repository": { @@ -29,7 +29,7 @@ }, "dependencies": { "@aws/language-server-runtimes": "^0.2.126", - "@aws/lsp-core": "^0.0.13" + "@aws/lsp-core": "^0.0.14" }, "peerDependencies": { "antlr4-c3": ">=3.4 < 4", diff --git a/server/aws-lsp-codewhisperer/CHANGELOG.md b/server/aws-lsp-codewhisperer/CHANGELOG.md index 1b2f1011df..048eaee59c 100644 --- a/server/aws-lsp-codewhisperer/CHANGELOG.md +++ b/server/aws-lsp-codewhisperer/CHANGELOG.md @@ -1,5 +1,40 @@ # Changelog +## [0.0.74](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.73...lsp-codewhisperer/v0.0.74) (2025-08-19) + + +### Features + +* **amazonq:** added mcp admin level configuration with GetProfile ([#2000](https://github.com/aws/language-servers/issues/2000)) ([fd6e9a8](https://github.com/aws/language-servers/commit/fd6e9a829c6229c276de5340dffce52b426a864d)) +* **amazonq:** read tool ui revamp ([#2113](https://github.com/aws/language-servers/issues/2113)) ([#2121](https://github.com/aws/language-servers/issues/2121)) ([93cf229](https://github.com/aws/language-servers/commit/93cf229149ba60491f9f5763793db4a9f570b611)) +* remove project type validation from LSP layer ([#2103](https://github.com/aws/language-servers/issues/2103)) ([d397161](https://github.com/aws/language-servers/commit/d397161cc3448c63016e27f5ac2a1917cdaae1cb)) + + +### Bug Fixes + +* **amazonq:** add server side control for WCS features ([#2128](https://github.com/aws/language-servers/issues/2128)) ([5e4435d](https://github.com/aws/language-servers/commit/5e4435dfaea7bf8c00e6a27b9bb0d40f699d4e01)) +* **amazonq:** fix regression of mcp config in agent config ([#2101](https://github.com/aws/language-servers/issues/2101)) ([e4e8bbb](https://github.com/aws/language-servers/commit/e4e8bbb89e4b597926582bead2b14ffc43f2a7f8)) +* **amazonq:** handle case where multiple rules are provided with the same name ([#2118](https://github.com/aws/language-servers/issues/2118)) ([0e23e2d](https://github.com/aws/language-servers/commit/0e23e2d29b8cad14403d372b9bbb08ca8ffa7ac7)) +* **amazonq:** persist mcp configs in agent json on start-up ([#2112](https://github.com/aws/language-servers/issues/2112)) ([817cfe2](https://github.com/aws/language-servers/commit/817cfe2656cb1deec6111c699c4ba46b4ba53e00)) +* empty userTriggerDecision not being sent for NEP code path ([#2140](https://github.com/aws/language-servers/issues/2140)) ([b8e5268](https://github.com/aws/language-servers/commit/b8e52682ac2b2337e1d0a32759e8beccde889cee)) +* fix for button text and remove profilearn caching ([#2137](https://github.com/aws/language-servers/issues/2137)) ([2a4171a](https://github.com/aws/language-servers/commit/2a4171a74c15c23c23c481060496162bcc9e6284)) +* fix to add disk caching for mcp admin state ([#2139](https://github.com/aws/language-servers/issues/2139)) ([f947e1a](https://github.com/aws/language-servers/commit/f947e1a9da4431d6089b22825f992010c30a470b)) +* fix to turn on and off MCP servers incase of error based on last state ([#2143](https://github.com/aws/language-servers/issues/2143)) ([04588df](https://github.com/aws/language-servers/commit/04588dfc33f0d85dbd488814a474b5e354398df0)) +* proper path handling for additional context ([#2129](https://github.com/aws/language-servers/issues/2129)) ([971eaa5](https://github.com/aws/language-servers/commit/971eaa505d948e9d2090c85f9b965f554ea7f2c8)) +* Use file context override in the inline completion params for Jupyter Notebook ([#2114](https://github.com/aws/language-servers/issues/2114)) ([91c8398](https://github.com/aws/language-servers/commit/91c839857f8aa4d79098189f9fb620b361c51289)) + + +### Performance Improvements + +* remove edit completion retry mechanism on document change ([#2124](https://github.com/aws/language-servers/issues/2124)) ([963b6e9](https://github.com/aws/language-servers/commit/963b6e9b7887da23a85a826c55a6ed95ff36d956)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @aws/lsp-core bumped from ^0.0.13 to ^0.0.14 + ## [0.0.73](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.72...lsp-codewhisperer/v0.0.73) (2025-08-11) diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index 78297c702e..c4264e5988 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-codewhisperer", - "version": "0.0.73", + "version": "0.0.74", "description": "CodeWhisperer Language Server", "main": "out/index.js", "repository": { @@ -37,7 +37,7 @@ "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", "@aws/language-server-runtimes": "^0.2.126", - "@aws/lsp-core": "^0.0.13", + "@aws/lsp-core": "^0.0.14", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", "adm-zip": "^0.5.10", diff --git a/server/aws-lsp-json/CHANGELOG.md b/server/aws-lsp-json/CHANGELOG.md index 31c977b978..ecac136295 100644 --- a/server/aws-lsp-json/CHANGELOG.md +++ b/server/aws-lsp-json/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.1.18](https://github.com/aws/language-servers/compare/lsp-json/v0.1.17...lsp-json/v0.1.18) (2025-08-19) + + +### Bug Fixes + +* Use file context override in the inline completion params for Jupyter Notebook ([#2114](https://github.com/aws/language-servers/issues/2114)) ([91c8398](https://github.com/aws/language-servers/commit/91c839857f8aa4d79098189f9fb620b361c51289)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @aws/lsp-core bumped from ^0.0.13 to ^0.0.14 + ## [0.1.17](https://github.com/aws/language-servers/compare/lsp-json/v0.1.16...lsp-json/v0.1.17) (2025-08-04) diff --git a/server/aws-lsp-json/package.json b/server/aws-lsp-json/package.json index 66604360fa..d129734444 100644 --- a/server/aws-lsp-json/package.json +++ b/server/aws-lsp-json/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-json", - "version": "0.1.17", + "version": "0.1.18", "description": "JSON Language Server", "main": "out/index.js", "repository": { @@ -27,7 +27,7 @@ }, "dependencies": { "@aws/language-server-runtimes": "^0.2.126", - "@aws/lsp-core": "^0.0.13", + "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" }, diff --git a/server/aws-lsp-partiql/CHANGELOG.md b/server/aws-lsp-partiql/CHANGELOG.md index b1be4c4050..dc68bdb063 100644 --- a/server/aws-lsp-partiql/CHANGELOG.md +++ b/server/aws-lsp-partiql/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.0.17](https://github.com/aws/language-servers/compare/lsp-partiql/v0.0.16...lsp-partiql/v0.0.17) (2025-08-19) + + +### Bug Fixes + +* Use file context override in the inline completion params for Jupyter Notebook ([#2114](https://github.com/aws/language-servers/issues/2114)) ([91c8398](https://github.com/aws/language-servers/commit/91c839857f8aa4d79098189f9fb620b361c51289)) + ## [0.0.16](https://github.com/aws/language-servers/compare/lsp-partiql/v0.0.15...lsp-partiql/v0.0.16) (2025-08-04) diff --git a/server/aws-lsp-partiql/package.json b/server/aws-lsp-partiql/package.json index efc073c7e9..2a5a5bb73f 100644 --- a/server/aws-lsp-partiql/package.json +++ b/server/aws-lsp-partiql/package.json @@ -3,7 +3,7 @@ "author": "Amazon Web Services", "license": "Apache-2.0", "description": "PartiQL language server", - "version": "0.0.16", + "version": "0.0.17", "repository": { "type": "git", "url": "https://github.com/aws/language-servers" diff --git a/server/aws-lsp-yaml/CHANGELOG.md b/server/aws-lsp-yaml/CHANGELOG.md index 965da41cfc..5858e6eb66 100644 --- a/server/aws-lsp-yaml/CHANGELOG.md +++ b/server/aws-lsp-yaml/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.1.18](https://github.com/aws/language-servers/compare/lsp-yaml/v0.1.17...lsp-yaml/v0.1.18) (2025-08-19) + + +### Bug Fixes + +* Use file context override in the inline completion params for Jupyter Notebook ([#2114](https://github.com/aws/language-servers/issues/2114)) ([91c8398](https://github.com/aws/language-servers/commit/91c839857f8aa4d79098189f9fb620b361c51289)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @aws/lsp-core bumped from ^0.0.13 to ^0.0.14 + ## [0.1.17](https://github.com/aws/language-servers/compare/lsp-yaml/v0.1.16...lsp-yaml/v0.1.17) (2025-08-04) diff --git a/server/aws-lsp-yaml/package.json b/server/aws-lsp-yaml/package.json index e18a72ea29..7d2b942ab5 100644 --- a/server/aws-lsp-yaml/package.json +++ b/server/aws-lsp-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-yaml", - "version": "0.1.17", + "version": "0.1.18", "description": "YAML Language Server", "main": "out/index.js", "repository": { @@ -27,7 +27,7 @@ }, "dependencies": { "@aws/language-server-runtimes": "^0.2.126", - "@aws/lsp-core": "^0.0.13", + "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", "yaml-language-server": "1.13.0" From 0767e074c91682a91d2fe7a6b2a7369c4dea280c Mon Sep 17 00:00:00 2001 From: andrewyuq <89420755+andrewyuq@users.noreply.github.com> Date: Thu, 21 Aug 2025 11:48:21 -0700 Subject: [PATCH 19/74] fix(amazonq): don't let flare send discard for the still valid suggestion in JB (#2145) * fix(amazonq): don't let flare send discard for the still valid suggestion in JB if a valid sessionId is returned back to JB, JB will eventually send a decision for it, but when user types a character to reject the current suggestion, on JB side it will 1) send reject for the current one 2) send a new trigger for the latest context. 2) will happen before 1) which will discard the current active session on flare's end. We don't want flare to do that for JB. * fix(amazonq): createSession doesn't need to close the previous session it should be handled together with telemetry reporting * fix(amazonq): fix test * fix(amazonq): test fix attempt * fix(amazonq): test fix attempt --- .../codeWhispererServer.test.ts | 35 +-------------- .../inline-completion/codeWhispererServer.ts | 44 ++++++++----------- .../editCompletionHandler.ts | 1 + .../session/sessionManager.test.ts | 28 +++--------- .../session/sessionManager.ts | 8 ---- .../userTriggerDecision.test.ts | 6 +-- 6 files changed, 29 insertions(+), 93 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts index 8151602dd4..e15400434c 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts @@ -1503,7 +1503,7 @@ describe('CodeWhisperer Server', () => { manager.activateSession(session) const session2 = manager.createSession(sessionData) manager.activateSession(session2) - assert.equal(session.state, 'CLOSED') + assert.equal(session.state, 'ACTIVE') assert.equal(session2.state, 'ACTIVE') await features.doLogInlineCompletionSessionResults(sessionResultData) @@ -2300,39 +2300,6 @@ describe('CodeWhisperer Server', () => { sinon.assert.calledOnceWithExactly(sessionManagerSpy.closeSession, currentSession) }) - it('Manual completion invocation should close previous session', async () => { - const TRIGGER_KIND = InlineCompletionTriggerKind.Invoked - - const result = await features.doInlineCompletionWithReferences( - { - textDocument: { uri: SOME_FILE.uri }, - position: { line: 0, character: 0 }, - // Manual trigger kind - context: { triggerKind: TRIGGER_KIND }, - }, - CancellationToken.None - ) - - assert.deepEqual(result, EXPECTED_RESULT) - const firstSession = sessionManager.getActiveSession() - - // There is ACTIVE session - assert(firstSession) - assert.equal(sessionManager.getCurrentSession(), firstSession) - assert.equal(firstSession.state, 'ACTIVE') - - const secondResult = await features.doInlineCompletionWithReferences( - { - textDocument: { uri: SOME_FILE.uri }, - position: { line: 0, character: 0 }, - context: { triggerKind: TRIGGER_KIND }, - }, - CancellationToken.None - ) - assert.deepEqual(secondResult, { ...EXPECTED_RESULT, sessionId: SESSION_IDS_LOG[1] }) - sinon.assert.called(sessionManagerSpy.closeCurrentSession) - }) - it('should discard inflight session if merge right recommendations resulted in list of empty strings', async () => { // The suggestion returned by generateSuggestions will be equal to the contents of the file // This test fails when the file starts with a new line, probably due to the way we handle right context merge diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts index 33113fa318..9f2073d85e 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts @@ -311,34 +311,27 @@ export const CodewhispererServerFactory = // Close ACTIVE session and record Discard trigger decision immediately if (currentSession && currentSession.state === 'ACTIVE') { - if (editsEnabled && currentSession.suggestionType === SuggestionType.EDIT) { - const mergedSuggestions = mergeEditSuggestionsWithFileContext( + // Emit user trigger decision at session close time for active session + // TODO: yuxqiang workaround to exclude JB from this logic because JB and VSC handle a + // bit differently in the case when there's a new trigger while a reject/discard event is sent + // for the previous trigger + if (ideCategory !== 'JETBRAINS') { + completionSessionManager.discardSession(currentSession) + const streakLength = editsEnabled + ? completionSessionManager.getAndUpdateStreakLength(false) + : 0 + await emitUserTriggerDecisionTelemetry( + telemetry, + telemetryService, currentSession, - textDocument, - fileContext + timeSinceLastUserModification, + 0, + 0, + [], + [], + streakLength ) - - if (mergedSuggestions.length > 0) { - return { - items: mergedSuggestions, - sessionId: currentSession.id, - } - } } - // Emit user trigger decision at session close time for active session - completionSessionManager.discardSession(currentSession) - const streakLength = editsEnabled ? completionSessionManager.getAndUpdateStreakLength(false) : 0 - await emitUserTriggerDecisionTelemetry( - telemetry, - telemetryService, - currentSession, - timeSinceLastUserModification, - 0, - 0, - [], - [], - streakLength - ) } const supplementalMetadata = supplementalContext?.supContextData @@ -529,6 +522,7 @@ export const CodewhispererServerFactory = logging.log('Recommendation failure: ' + error) emitServiceInvocationFailure(telemetry, session, error) + // UTDE telemetry is not needed here because in error cases we don't care about UTDE for errored out sessions completionSessionManager.closeSession(session) let translatedError = error diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts index 005b5ab3f0..99737d027c 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts @@ -403,6 +403,7 @@ export class EditCompletionHandler { this.logging.log('Recommendation failure: ' + error) emitServiceInvocationFailure(this.telemetry, session, error) + // UTDE telemetry is not needed here because in error cases we don't care about UTDE for errored out sessions this.sessionManager.closeSession(session) let translatedError = error diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.test.ts index db34f885ff..bef684eb9b 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.test.ts @@ -529,12 +529,12 @@ describe('SessionManager', function () { assert.strictEqual(manager.getCurrentSession()?.state, 'REQUESTING') }) - it('should deactivate previous session when creating a new session', function () { + it('should not deactivate previous session when creating a new session', function () { const manager = SessionManager.getInstance() const session = manager.createSession(data) session.activate() manager.createSession(data) - assert.strictEqual(session.state, 'CLOSED') + assert.strictEqual(session.state, 'ACTIVE') }) it('should set previous active session trigger decision from discarded REQUESTING session', function () { @@ -548,7 +548,7 @@ describe('SessionManager', function () { assert.strictEqual(session2.previousTriggerDecision, 'Discard') }) - it('should set previous active session trigger decision to new session object', function () { + it('should not set previous active session trigger decision to new session object if it is not closed', function () { const manager = SessionManager.getInstance() const session1 = manager.createSession(data) assert.strictEqual(session1?.state, 'REQUESTING') @@ -557,22 +557,8 @@ describe('SessionManager', function () { const session2 = manager.createSession(data) - assert.strictEqual(session1?.state, 'CLOSED') - assert.strictEqual(session2.previousTriggerDecision, 'Empty') - }) - }) - - describe('closeCurrentSession()', function () { - it('should add the current session to the sessions log if it is active', function () { - const manager = SessionManager.getInstance() - const session = manager.createSession(data) - assert.strictEqual(session.state, 'REQUESTING') - session.activate() - assert.strictEqual(session.state, 'ACTIVE') - manager.closeCurrentSession() - assert.strictEqual(manager.getSessionsLog().length, 1) - assert.strictEqual(manager.getSessionsLog()[0], session) - assert.strictEqual(session.state, 'CLOSED') + assert.strictEqual(session1?.state, 'ACTIVE') + assert.strictEqual(session2.previousTriggerDecision, undefined) }) }) @@ -599,7 +585,6 @@ describe('SessionManager', function () { session2.activate() const session3 = manager.createSession(data) session3.activate() - manager.closeCurrentSession() const result = manager.getPreviousSession() assert.strictEqual(result, session3) assert.strictEqual(manager.getSessionsLog().length, 3) @@ -612,7 +597,6 @@ describe('SessionManager', function () { const session2 = manager.createSession(data) const session3 = manager.createSession(data) session3.activate() - manager.closeCurrentSession() const result = manager.getPreviousSession() assert.strictEqual(result, session3) assert.strictEqual(manager.getSessionsLog().length, 3) @@ -632,7 +616,6 @@ describe('SessionManager', function () { session.activate() const session2 = manager.createSession({ ...data, triggerType: 'AutoTrigger' }) session2.activate() - manager.closeCurrentSession() assert.strictEqual(manager.getSessionsLog().length, 2) const sessionId = session.id @@ -644,7 +627,6 @@ describe('SessionManager', function () { const manager = SessionManager.getInstance() const session = manager.createSession(data) session.activate() - manager.closeCurrentSession() assert.strictEqual(manager.getSessionsLog().length, 1) const sessionId = session.id + '1' diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts index a0ddf742f6..235c464234 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts @@ -305,8 +305,6 @@ export class SessionManager { } public createSession(data: SessionData): CodeWhispererSession { - this.closeCurrentSession() - // Remove oldest session from log if (this.sessionsLog.length > this.maxHistorySize) { this.sessionsLog.shift() @@ -327,12 +325,6 @@ export class SessionManager { return session } - closeCurrentSession() { - if (this.currentSession) { - this.closeSession(this.currentSession) - } - } - closeSession(session: CodeWhispererSession) { session.close() } diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/userTriggerDecision.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/userTriggerDecision.test.ts index b554b5ef23..c583815b6b 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/userTriggerDecision.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/userTriggerDecision.test.ts @@ -505,7 +505,7 @@ describe('Telemetry', () => { sinon.assert.called(telemetryServiceSpy) }) - it('should not emit User Decision event when session results are received after session was closed', async () => { + it('should not emit User Decision event after second trigger is received', async () => { setServiceResponse(DEFAULT_SUGGESTIONS, { ...EXPECTED_RESPONSE_CONTEXT, codewhispererSessionId: 'cwspr-session-id-1', @@ -519,7 +519,7 @@ describe('Telemetry', () => { sinon.assert.notCalled(sessionManagerSpy.closeSession) sinon.assert.notCalled(telemetryServiceSpy) - // Send second completion request to close first one + // Send second completion request should not close first one setServiceResponse(DEFAULT_SUGGESTIONS, { ...EXPECTED_RESPONSE_CONTEXT, codewhispererSessionId: 'cwspr-session-id-2', @@ -528,7 +528,7 @@ describe('Telemetry', () => { assert.equal(firstSession.state, 'DISCARD') assert.notEqual(firstSession, sessionManager.getCurrentSession()) - sinon.assert.calledWithExactly(sessionManagerSpy.closeSession, firstSession) + sinon.assert.notCalled(sessionManagerSpy.closeSession) // Test that session reports it's status when second request is received const expectedEvent = aUserTriggerDecision({ state: 'DISCARD', From d3cd4556c0fc6cf08d93e0e0733798525ea0b7f8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 12:20:09 -0700 Subject: [PATCH 20/74] chore(release): release packages from branch main (#2149) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- package-lock.json | 2 +- server/aws-lsp-codewhisperer/CHANGELOG.md | 7 +++++++ server/aws-lsp-codewhisperer/package.json | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 159795a30e..49f118f219 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -2,7 +2,7 @@ "chat-client": "0.1.33", "core/aws-lsp-core": "0.0.14", "server/aws-lsp-antlr4": "0.1.18", - "server/aws-lsp-codewhisperer": "0.0.74", + "server/aws-lsp-codewhisperer": "0.0.75", "server/aws-lsp-json": "0.1.18", "server/aws-lsp-partiql": "0.0.17", "server/aws-lsp-yaml": "0.1.18" diff --git a/package-lock.json b/package-lock.json index 97b89d43b8..8dbdc6d513 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28670,7 +28670,7 @@ }, "server/aws-lsp-codewhisperer": { "name": "@aws/lsp-codewhisperer", - "version": "0.0.74", + "version": "0.0.75", "bundleDependencies": [ "@amzn/codewhisperer-streaming", "@amzn/amazon-q-developer-streaming-client" diff --git a/server/aws-lsp-codewhisperer/CHANGELOG.md b/server/aws-lsp-codewhisperer/CHANGELOG.md index 048eaee59c..a70284a4c2 100644 --- a/server/aws-lsp-codewhisperer/CHANGELOG.md +++ b/server/aws-lsp-codewhisperer/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.0.75](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.74...lsp-codewhisperer/v0.0.75) (2025-08-21) + + +### Bug Fixes + +* **amazonq:** don't let flare send discard for the still valid suggestion in JB ([#2145](https://github.com/aws/language-servers/issues/2145)) ([0767e07](https://github.com/aws/language-servers/commit/0767e074c91682a91d2fe7a6b2a7369c4dea280c)) + ## [0.0.74](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.73...lsp-codewhisperer/v0.0.74) (2025-08-19) diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index c4264e5988..c0f6c16afd 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-codewhisperer", - "version": "0.0.74", + "version": "0.0.75", "description": "CodeWhisperer Language Server", "main": "out/index.js", "repository": { From 28d46a7ff65bbc702606d01a616085e572eb1ab5 Mon Sep 17 00:00:00 2001 From: manodnyab <66754471+manodnyab@users.noreply.github.com> Date: Thu, 21 Aug 2025 19:56:29 -0700 Subject: [PATCH 21/74] chore: merge agentic version 1.29.0 (#2151) * chore: bump agentic version: 1.29.0 * chore: empty commit to start Github Action (#2150) --------- Co-authored-by: aws-toolkit-automation <> --- app/aws-lsp-codewhisperer-runtimes/src/version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/aws-lsp-codewhisperer-runtimes/src/version.json b/app/aws-lsp-codewhisperer-runtimes/src/version.json index 4c93c3f549..93401eb637 100644 --- a/app/aws-lsp-codewhisperer-runtimes/src/version.json +++ b/app/aws-lsp-codewhisperer-runtimes/src/version.json @@ -1,3 +1,3 @@ { - "agenticChat": "1.27.0" + "agenticChat": "1.29.0" } From 2fb896e094de0bc5a1b4881067e7dcceb3826015 Mon Sep 17 00:00:00 2001 From: Boyu Date: Thu, 21 Aug 2025 22:08:16 -0700 Subject: [PATCH 22/74] feat: add basic OAuth client for remote MCP (#2136) * feat: add basic mcp oauth client * fix: relax condition for triggering oauth flow; add resilience checks for as availability * feat: add unit test for auth client * fix: multiple fixes for remote mcp error and timeout --- .../agenticChat/tools/mcp/mcpEventHandler.ts | 65 +-- .../agenticChat/tools/mcp/mcpManager.ts | 53 ++- .../tools/mcp/mcpOauthClient.test.ts | 120 +++++ .../agenticChat/tools/mcp/mcpOauthClient.ts | 437 ++++++++++++++++++ 4 files changed, 635 insertions(+), 40 deletions(-) create mode 100644 server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts create mode 100644 server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts index 5b3ac84e98..a5090319ba 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts @@ -3,7 +3,6 @@ import { MCP_SERVER_STATUS_CHANGED, McpManager } from './mcpManager' import { ChatTelemetryController } from '../../../chat/telemetry/chatTelemetryController' import { ChokidarFileWatcher } from './chokidarFileWatcher' // eslint-disable-next-line import/no-nodejs-modules -import * as path from 'path' import { DetailedListGroup, DetailedListItem, @@ -13,14 +12,7 @@ import { Status, } from '@aws/language-server-runtimes/protocol' -import { - getGlobalMcpConfigPath, - getGlobalAgentConfigPath, - getWorkspaceMcpConfigPaths, - getWorkspaceAgentConfigPaths, - sanitizeName, - normalizePathFromUri, -} from './mcpUtils' +import { getGlobalAgentConfigPath, getWorkspaceAgentConfigPaths, sanitizeName, normalizePathFromUri } from './mcpUtils' import { McpPermissionType, MCPServerConfig, @@ -29,7 +21,6 @@ import { McpServerStatus, } from './mcpTypes' import { TelemetryService } from '../../../../shared/telemetry/telemetryService' -import { URI } from 'vscode-uri' import { ProfileStatusMonitor } from './profileStatusMonitor' interface PermissionOption { @@ -38,6 +29,11 @@ interface PermissionOption { description?: string } +enum TransportType { + STDIO = 'stdio', + HTTP = 'http', +} + export class McpEventHandler { #features: Features #eventListenerRegistered: boolean @@ -393,7 +389,7 @@ export class McpEventHandler { const serverStatusError = this.#getServerStatusError(existingValues.name) || {} // Determine which transport is selected (default to stdio) - const selectedTransport = existingValues.transport || 'stdio' + const selectedTransport = existingValues.transport || TransportType.STDIO return { id: params.id, @@ -432,14 +428,14 @@ export class McpEventHandler { title: 'Transport', mandatory: true, options: [ - { label: 'stdio', value: 'stdio' }, - { label: 'http', value: 'http' }, + { label: TransportType.STDIO, value: TransportType.STDIO }, + { label: TransportType.HTTP, value: TransportType.HTTP }, ], value: selectedTransport, }, ] - if (selectedTransport === 'http') { + if (selectedTransport === TransportType.HTTP) { return [ ...common, { @@ -603,8 +599,13 @@ export class McpEventHandler { errors.push('Either command or url is required') } else if (command && url) { errors.push('Provide either command OR url, not both') - } else if (transport && ((transport === 'stdio' && !command) || (transport !== 'stdio' && !url))) { - errors.push(`${transport === 'stdio' ? 'Command' : 'URL'} is required for ${transport} transport`) + } else if ( + transport && + ((transport === TransportType.STDIO && !command) || (transport !== TransportType.STDIO && !url)) + ) { + errors.push( + `${transport === TransportType.STDIO ? 'Command' : 'URL'} is required for ${transport} transport` + ) } if (values.timeout && values.timeout.trim() !== '') { @@ -692,7 +693,7 @@ export class McpEventHandler { // stdio‑specific parsing let args: string[] = [] let env: Record = {} - if (selectedTransport === 'stdio') { + if (selectedTransport === TransportType.STDIO) { try { args = (Array.isArray(params.optionsValues.args) ? params.optionsValues.args : []) .map((item: any) => @@ -719,7 +720,7 @@ export class McpEventHandler { // http‑specific parsing let headers: Record = {} - if (selectedTransport === 'http') { + if (selectedTransport === TransportType.HTTP) { try { const raw = Array.isArray(params.optionsValues.headers) ? params.optionsValues.headers : [] headers = raw.reduce((acc: Record, item: any) => { @@ -743,7 +744,7 @@ export class McpEventHandler { // build final config (no transport field persisted) let config: MCPServerConfig - if (selectedTransport === 'http') { + if (selectedTransport === TransportType.HTTP) { config = { url: params.optionsValues.url, headers, @@ -786,14 +787,15 @@ export class McpEventHandler { } this.#currentEditingServerName = undefined + this.#serverNameBeforeUpdate = undefined // need to check server state now, as there is possibility of error during server initialization const serverStatusError = this.#getServerStatusError(serverName) this.#telemetryController?.emitMCPServerInitializeEvent({ source: isEditMode ? 'updateServer' : 'addServer', - command: selectedTransport === 'stdio' ? params.optionsValues.command : undefined, - url: selectedTransport === 'http' ? params.optionsValues.url : undefined, + command: selectedTransport === TransportType.STDIO ? params.optionsValues.command : undefined, + url: selectedTransport === TransportType.HTTP ? params.optionsValues.url : undefined, enabled: true, numTools: McpManager.instance.getAllToolsWithPermissions(serverName).length, scope: params.optionsValues['scope'] === 'global' ? 'global' : 'workspace', @@ -1014,7 +1016,7 @@ export class McpEventHandler { } // Respect a user flip first; otherwise fall back to what the stored configuration implies. - const transport = params.optionsValues?.transport ?? (config.url ? 'http' : 'stdio') + const transport = params.optionsValues?.transport ?? (config.url ? TransportType.HTTP : TransportType.STDIO) // Convert stored structures to UI‑friendly lists const argsList = (config.args ?? []).map(a => ({ arg_key: a })) // for stdio @@ -1090,8 +1092,9 @@ export class McpEventHandler { // Clean up transport-specific fields if (optionsValues) { - const transport = optionsValues.transport ?? 'stdio' // Maintain default to 'stdio' - const fieldsToDelete = transport === 'http' ? ['command', 'args', 'env_variables'] : ['url', 'headers'] + const transport = optionsValues.transport ?? TransportType.STDIO // Maintain default to 'stdio' + const fieldsToDelete = + transport === TransportType.HTTP ? ['command', 'args', 'env_variables'] : ['url', 'headers'] fieldsToDelete.forEach(field => delete optionsValues[field]) } @@ -1238,11 +1241,11 @@ export class McpEventHandler { const serverConfig = McpManager.instance.getAllServerConfigs().get(serverName) if (serverConfig) { // Emit server initialize event after permission change - const transportType = serverConfig.command ? 'stdio' : 'http' + const transportType = serverConfig.command?.trim() ? TransportType.STDIO : TransportType.HTTP this.#telemetryController?.emitMCPServerInitializeEvent({ source: 'updatePermission', - command: transportType === 'stdio' ? serverConfig.command : undefined, - url: transportType === 'http' ? serverConfig.url : undefined, + command: transportType === TransportType.STDIO ? serverConfig.command : undefined, + url: transportType === TransportType.HTTP ? serverConfig.url : undefined, enabled: true, numTools: McpManager.instance.getAllToolsWithPermissions(serverName).length, scope: @@ -1310,16 +1313,16 @@ export class McpEventHandler { // Emit server initialize events for all active servers for (const [serverName, config] of serverConfigs.entries()) { - const transportType = config.command ? 'stdio' : 'http' + const transportType = config.command ? TransportType.STDIO : TransportType.HTTP const enabled = !mcpManager.isServerDisabled(serverName) this.#telemetryController?.emitMCPServerInitializeEvent({ source: 'reload', - command: transportType === 'stdio' ? config.command : undefined, - url: transportType === 'http' ? config.url : undefined, + command: transportType === TransportType.STDIO ? config.command : undefined, + url: transportType === TransportType.HTTP ? config.url : undefined, enabled: enabled, numTools: mcpManager.getAllToolsWithPermissions(serverName).length, scope: config.__configPath__ === globalAgentPath ? 'global' : 'workspace', - transportType: 'stdio', + transportType: transportType, languageServerVersion: this.#features.runtime.serverInfo.version, }) } diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index 844a872485..7ac6257641 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -38,6 +38,7 @@ import path = require('path') import { URI } from 'vscode-uri' import { sanitizeInput } from '../../../../shared/utils' import { ProfileStatusMonitor } from './profileStatusMonitor' +import { OAuthClient } from './mcpOauthClient' export const MCP_SERVER_STATUS_CHANGED = 'mcpServerStatusChanged' export const AGENT_TOOLS_CHANGED = 'agentToolsChanged' @@ -299,7 +300,7 @@ export class McpManager { this.features.logging.debug(`MCP: initializing server [${serverName}]`) const client = new Client({ - name: `mcp-client-${serverName}`, + name: `q-chat-plugin`, // Do not use server name in the client name to avoid polluting builder-mcp metrics version: '1.0.0', }) @@ -307,6 +308,7 @@ export class McpManager { const isStdio = !!cfg.command const doConnect = async () => { if (isStdio) { + // stdio transport const mergedEnv = { ...(process.env as Record), // Make sure we do not have empty key and value in mergedEnv, or adding server through UI will fail on Windows @@ -347,11 +349,33 @@ export class McpManager { ) } } else { + // streamable http/SSE transport const base = new URL(cfg.url!) try { + // Use HEAD to check if it needs OAuth + let headers: Record = { ...(cfg.headers ?? {}) } + let needsOAuth = false + try { + const headResp = await fetch(base, { method: 'HEAD', headers }) + const www = headResp.headers.get('www-authenticate') || '' + needsOAuth = headResp.status === 401 || headResp.status === 403 || /bearer/i.test(www) + } catch { + this.features.logging.info(`MCP: HEAD not available`) + } + + if (needsOAuth) { + OAuthClient.initialize(this.features.workspace, this.features.logging) + const bearer = await OAuthClient.getValidAccessToken(base) + // add authorization header if we are able to obtain a bearer token + if (bearer) { + headers = { ...headers, Authorization: `Bearer ${bearer}` } + } + } + try { // try streamable http first - transport = new StreamableHTTPClientTransport(base, this.buildHttpOpts(cfg.headers)) + transport = new StreamableHTTPClientTransport(base, this.buildHttpOpts(headers)) + this.features.logging.info(`MCP: Connecting MCP server using StreamableHTTPClientTransport`) await client.connect(transport) } catch (err) { @@ -359,13 +383,14 @@ export class McpManager { this.features.logging.info( `MCP: streamable http connect failed for [${serverName}], fallback to SSEClientTransport: ${String(err)}` ) - transport = new SSEClientTransport(new URL(cfg.url!), this.buildSseOpts(cfg.headers)) + transport = new SSEClientTransport(new URL(cfg.url!), this.buildSseOpts(headers)) await client.connect(transport) } } catch (err: any) { let errorMessage = err?.message ?? String(err) + const oauthHint = /oauth/i.test(errorMessage) ? ' (OAuth)' : '' throw new AgenticChatError( - `MCP: server '${serverName}' failed to connect: ${errorMessage}`, + `MCP: server '${serverName}' failed to connect${oauthHint}: ${errorMessage}`, 'MCPServerConnectionFailed' ) } @@ -645,7 +670,7 @@ export class McpManager { disabled: cfg.disabled ?? false, } // Only add timeout to agent config if it's not 0 - if (cfg.timeout !== 0) { + if (cfg.timeout !== undefined) { serverConfig.timeout = cfg.timeout } if (cfg.args && cfg.args.length > 0) { @@ -1268,11 +1293,21 @@ export class McpManager { private handleError(server: string | undefined, err: unknown) { const msg = err instanceof Error ? err.message : String(err) - this.features.logging.error(`MCP ERROR${server ? ` [${server}]` : ''}: ${msg}`) + const isBenignSseDisconnect = + /SSE error:\s*TypeError:\s*terminated:\s*Body Timeout Error/i.test(msg) || + /TypeError:\s*terminated:\s*Body Timeout Error/i.test(msg) || + /TypeError:\s*terminated:\s*other side closed/i.test(msg) || + /ECONNRESET|ENETRESET|EPIPE/i.test(msg) - if (server) { - this.setState(server, McpServerStatus.FAILED, 0, msg) - this.emitToolsChanged(server) + if (isBenignSseDisconnect) { + this.features.logging.debug(`MCP SSE idle timeout${server ? ` [${server}]` : ''}: ${msg}`) + } else { + // default path for real errors + this.features.logging.error(`MCP ERROR${server ? ` [${server}]` : ''}: ${msg}`) + if (server) { + this.setState(server, McpServerStatus.FAILED, 0, msg) + this.emitToolsChanged(server) + } } } diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts new file mode 100644 index 0000000000..43f68302eb --- /dev/null +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts @@ -0,0 +1,120 @@ +/*! + * Copyright Amazon.com, Inc. or its affiliates. + * All Rights Reserved. SPDX-License-Identifier: Apache-2.0 + */ + +import { expect } from 'chai' +import * as sinon from 'sinon' +import * as crypto from 'crypto' +import * as http from 'http' +import { EventEmitter } from 'events' +import * as path from 'path' +import { OAuthClient } from './mcpOauthClient' + +const fakeLogger = { + log: () => {}, + debug: () => {}, + info: () => {}, + warn: () => {}, + error: () => {}, +} + +const fakeWorkspace = { + fs: { + exists: async (_path: string) => false, + readFile: async (_path: string) => Buffer.from('{}'), + writeFile: async (_path: string, _d: any) => {}, + mkdir: async (_dir: string, _opts: any) => {}, + }, +} as any + +function stubFileSystem(tokenObj?: any, regObj?: any): void { + const cacheDir = (OAuthClient as any).cacheDir as string + const tokPath = path.join(cacheDir, 'testkey.token.json') + const regPath = path.join(cacheDir, 'testkey.registration.json') + + const existsStub = sinon.stub(fakeWorkspace.fs, 'exists') + existsStub.callsFake(async (p: any) => { + if (p === tokPath && tokenObj) return true + if (p === regPath && regObj) return true + return false + }) + + const readStub = sinon.stub(fakeWorkspace.fs, 'readFile') + readStub.callsFake(async (p: any) => { + if (p === tokPath && tokenObj) return Buffer.from(JSON.stringify(tokenObj)) + if (p === regPath && regObj) return Buffer.from(JSON.stringify(regObj)) + return Buffer.from('{}') + }) + + sinon.stub(fakeWorkspace.fs, 'writeFile').resolves() + sinon.stub(fakeWorkspace.fs, 'mkdir').resolves() +} + +function stubHttpServer(): void { + sinon.stub(http, 'createServer').callsFake(() => { + const srv = new EventEmitter() as unknown as http.Server & EventEmitter + ;(srv as any).address = () => ({ address: '127.0.0.1', port: 12345, family: 'IPv4' }) + ;(srv as any).listen = (_port?: any, _host?: any, _backlog?: any, cb?: any) => { + if (typeof cb === 'function') cb() + // simulate async readiness like a real server + process.nextTick(() => srv.emit('listening')) + return srv + } + ;(srv as any).close = (cb?: any) => { + if (typeof cb === 'function') cb() + srv.removeAllListeners() + return srv + } + return srv + }) +} + +describe('OAuthClient helpers', () => { + it('computeKey() generates deterministic SHA-256 hex', () => { + const url = new URL('https://example.com/api') + const expected = crypto + .createHash('sha256') + .update(url.origin + url.pathname) + .digest('hex') + const actual = (OAuthClient as any).computeKey(url) + expect(actual).to.equal(expected) + }) + + it('b64url() strips padding and is URL-safe', () => { + const buf = Buffer.from('hello') + const actual = (OAuthClient as any).b64url(buf) + expect(actual).to.equal('aGVsbG8') + }) +}) + +describe('OAuthClient getValidAccessToken()', () => { + const now = Date.now() + + beforeEach(() => { + sinon.restore() + OAuthClient.initialize(fakeWorkspace, fakeLogger as any) + sinon.stub(OAuthClient as any, 'computeKey').returns('testkey') + stubHttpServer() + }) + + afterEach(() => sinon.restore()) + + it('returns cached token when still valid', async () => { + const cachedToken = { + access_token: 'cached_access', + expires_in: 3600, + obtained_at: now - 1_000, + } + const cachedReg = { + client_id: 'cid', + redirect_uri: 'http://localhost:12345', + } + + stubFileSystem(cachedToken, cachedReg) + + const token = await OAuthClient.getValidAccessToken(new URL('https://api.example.com/mcp')) + expect(token).to.equal('cached_access') + expect((http.createServer as any).calledOnce).to.be.true + }) +}) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts new file mode 100644 index 0000000000..73ffea1a1d --- /dev/null +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts @@ -0,0 +1,437 @@ +/*! + * Copyright Amazon.com, Inc. or its affiliates. + * All Rights Reserved. SPDX-License-Identifier: Apache-2.0 + */ + +import type { RequestInit } from 'node-fetch' +import * as crypto from 'crypto' +import * as path from 'path' +import { spawn } from 'child_process' +import { URL, URLSearchParams } from 'url' +import * as http from 'http' +import { Logger, Workspace } from '@aws/language-server-runtimes/server-interface' + +interface Token { + access_token: string + expires_in: number + refresh_token?: string + obtained_at: number +} + +interface Meta { + authorization_endpoint: string + token_endpoint: string + registration_endpoint?: string +} + +interface Registration { + client_id: string + client_secret?: string + expires_at?: number + redirect_uri: string +} + +export class OAuthClient { + private static logger: Logger + private static workspace: Workspace + + public static initialize(ws: Workspace, logger: Logger): void { + this.workspace = ws + this.logger = logger + } + + /** + * Return a valid Bearer token, reusing cache or refresh-token if possible, + * otherwise driving one interactive PKCE flow. + */ + public static async getValidAccessToken(mcpBase: URL): Promise { + const key = this.computeKey(mcpBase) + const regPath = path.join(this.cacheDir, `${key}.registration.json`) + const tokPath = path.join(this.cacheDir, `${key}.token.json`) + + // 1) Spin up (or reuse) loopback server + redirect URI + let server: http.Server, redirectUri: string + const savedReg = await this.read(regPath) + if (savedReg) { + const port = Number(new URL(savedReg.redirect_uri).port) + server = http.createServer() + try { + await this.listen(server, port) + redirectUri = savedReg.redirect_uri + this.logger.info(`OAuth: reusing redirect URI ${redirectUri}`) + } catch (e: any) { + if (e.code === 'EADDRINUSE') { + try { + server.close() + } catch { + /* ignore */ + } + this.logger.warn(`Port ${port} in use; falling back to new random port`) + ;({ server, redirectUri } = await this.buildCallbackServer()) + this.logger.info(`OAuth: new redirect URI ${redirectUri}`) + await this.workspace.fs.rm(regPath) + } else { + throw e + } + } + } else { + ;({ server, redirectUri } = await this.buildCallbackServer()) + this.logger.info(`OAuth: new redirect URI ${redirectUri}`) + } + + try { + // 2) Try still-valid cached access_token + const cached = await this.read(tokPath) + if (cached) { + const expiry = cached.obtained_at + cached.expires_in * 1000 + if (Date.now() < expiry) { + this.logger.info(`OAuth: using still‑valid cached token`) + return cached.access_token + } + this.logger.info(`OAuth: cached token expired → try refresh`) + } + + // 3) Discover AS metadata + let meta: Meta + try { + meta = await this.discoverAS(mcpBase) + } catch (e: any) { + throw new Error(`OAuth discovery failed: ${e?.message ?? String(e)}`) + } + // 4) Register (or reuse) a dynamic client + const scopes = ['openid', 'offline_access'] + let reg: Registration + try { + reg = await this.obtainClient(meta, regPath, scopes, redirectUri) + } catch (e: any) { + throw new Error(`OAuth client registration failed: ${e?.message ?? String(e)}`) + } + + // 5) Refresh‑token grant (one shot) + const attemptedRefresh = !!cached?.refresh_token + if (cached?.refresh_token) { + const refreshed = await this.refreshGrant(meta, reg, mcpBase, cached.refresh_token) + if (refreshed) { + await this.write(tokPath, refreshed) + this.logger.info(`OAuth: refresh grant succeeded`) + return refreshed.access_token + } + this.logger.info(`OAuth: refresh grant failed`) + } + + // 6) PKCE interactive flow + try { + const fresh = await this.pkceGrant(meta, reg, mcpBase, scopes, redirectUri, server) + await this.write(tokPath, fresh) + return fresh.access_token + } catch (e: any) { + const suffix = attemptedRefresh ? ' after refresh attempt' : '' + throw new Error(`OAuth authorization (PKCE) failed${suffix}: ${e?.message ?? String(e)}`) + } + } finally { + await new Promise(res => server.close(() => res())) + } + } + + /** Spin up a one‑time HTTP listener on localhost:randomPort */ + private static async buildCallbackServer(): Promise<{ server: http.Server; redirectUri: string }> { + const server = http.createServer() + await this.listen(server, 0) + const port = (server.address() as any).port as number + return { server, redirectUri: `http://localhost:${port}` } + } + + /** Discover OAuth endpoints by HEAD/WWW‑Authenticate, well‑known, or fallback */ + private static async discoverAS(rs: URL): Promise { + // a) HEAD → WWW‑Authenticate → resource_metadata + try { + this.logger.info('MCP OAuth: attempting discovery via WWW-Authenticate header') + const h = await this.fetchCompat(rs.toString(), { method: 'HEAD' }) + const header = h.headers.get('www-authenticate') || '' + const m = /resource_metadata=(?:"([^"]+)"|([^,\s]+))/i.exec(header) + if (m) { + const metaUrl = new URL(m[1] || m[2], rs).toString() + this.logger.info(`OAuth: resource_metadata → ${metaUrl}`) + const raw = await this.json(metaUrl) + return await this.fetchASFromResourceMeta(raw, metaUrl) + } + } catch { + this.logger.info('MCP OAuth: no resource_metadata found in WWW-Authenticate header') + } + + // b) well‑known on resource host + this.logger.info('MCP OAuth: attempting discovery via well-known endpoints') + const probes = [ + new URL('.well-known/oauth-authorization-server', rs).toString(), + new URL('.well-known/openid-configuration', rs).toString(), + `${rs.origin}/.well-known/oauth-authorization-server`, + `${rs.origin}/.well-known/openid-configuration`, + ] + for (const url of probes) { + try { + this.logger.info(`MCP OAuth: probing well-known endpoint → ${url}`) + return await this.json(url) + } catch (error) { + this.logger.info(`OAuth: well-known endpoint probe failed for ${url}`) + } + } + + // c) fallback to static OAuth2 endpoints + const base = (rs.origin + rs.pathname).replace(/\/+$/, '') + this.logger.warn(`OAuth: all discovery attempts failed, synthesizing endpoints from ${base}`) + return { + authorization_endpoint: `${base}/authorize`, + token_endpoint: `${base}/access_token`, + } + } + + /** Follow `authorization_server(s)` in resource_metadata JSON */ + private static async fetchASFromResourceMeta(raw: any, metaUrl: string): Promise { + let asBase = raw.authorization_server + if (!asBase && Array.isArray(raw.authorization_servers)) { + asBase = raw.authorization_servers[0] + } + if (!asBase) { + throw new Error(`resource_metadata at ${metaUrl} lacked authorization_server(s)`) + } + + // Attempt both OAuth‑AS and OIDC well‑known + for (const p of ['.well-known/oauth-authorization-server', '.well-known/openid-configuration']) { + try { + return await this.json(new URL(p, asBase).toString()) + } catch { + // next + } + } + // fallback to static OAuth2 endpoints + this.logger.warn(`OAuth: no well-known on ${asBase}, falling back to static endpoints`) + return { + authorization_endpoint: `${asBase}/authorize`, + token_endpoint: `${asBase}/access_token`, + } + } + + /** DCR: POST client metadata → client_id; cache to disk */ + private static async obtainClient( + meta: Meta, + file: string, + scopes: string[], + redirectUri: string + ): Promise { + const existing = await this.read(file) + if (existing && (!existing.expires_at || existing.expires_at * 1000 > Date.now())) { + this.logger.info(`OAuth: reusing client_id ${existing.client_id}`) + return existing + } + + if (!meta.registration_endpoint) { + throw new Error('OAuth: AS does not support dynamic registration') + } + + const body = { + client_name: 'AWS MCP LSP', + grant_types: ['authorization_code', 'refresh_token'], + response_types: ['code'], + token_endpoint_auth_method: 'none', + scope: scopes.join(' '), + redirect_uris: [redirectUri], + } + const resp: any = await this.json(meta.registration_endpoint, { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: JSON.stringify(body), + }) + + const reg: Registration = { + client_id: resp.client_id, + client_secret: resp.client_secret, + expires_at: resp.client_secret_expires_at, + redirect_uri: redirectUri, + } + await this.write(file, reg) + return reg + } + + /** Try one refresh_token grant; returns new Token or `undefined` */ + private static async refreshGrant( + meta: Meta, + reg: Registration, + rs: URL, + refresh: string + ): Promise { + const form = new URLSearchParams({ + grant_type: 'refresh_token', + refresh_token: refresh, + client_id: reg.client_id, + resource: rs.toString(), + }) + const res = await this.fetchCompat(meta.token_endpoint, { + method: 'POST', + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + body: form, + }) + if (!res.ok) { + const msg = await res.text().catch(() => '') + this.logger.warn(`OAuth: refresh grant HTTP ${res.status} — ${msg?.slice(0, 300)}`) + return undefined + } + const tokenResponse = (await res.json()) as Record + return { ...(tokenResponse as object), obtained_at: Date.now() } as Token + } + + /** One PKCE flow: browser + loopback → code → token */ + private static async pkceGrant( + meta: Meta, + reg: Registration, + rs: URL, + scopes: string[], + redirectUri: string, + server: http.Server + ): Promise { + // a) generate PKCE params + const verifier = this.b64url(crypto.randomBytes(32)) + const challenge = this.b64url(crypto.createHash('sha256').update(verifier).digest()) + const state = this.b64url(crypto.randomBytes(16)) + + // b) build authorize URL + launch browser + const authz = new URL(meta.authorization_endpoint) + authz.search = new URLSearchParams({ + client_id: reg.client_id, + response_type: 'code', + code_challenge: challenge, + code_challenge_method: 'S256', + resource: rs.toString(), + scope: scopes.join(' '), + redirect_uri: redirectUri, + state: state, + }).toString() + + const opener = + process.platform === 'win32' + ? { cmd: 'cmd', args: ['/c', 'start', authz.toString()] } + : process.platform === 'darwin' + ? { cmd: 'open', args: [authz.toString()] } + : { cmd: 'xdg-open', args: [authz.toString()] } + + void spawn(opener.cmd, opener.args, { detached: true, stdio: 'ignore' }).unref() + + // c) wait for code on our loopback + const { code, rxState, err } = await new Promise<{ code: string; rxState: string; err?: string }>(resolve => { + server.on('request', (req, res) => { + const u = new URL(req.url || '/', redirectUri) + const c = u.searchParams.get('code') || '' + const s = u.searchParams.get('state') || '' + const e = u.searchParams.get('error') || undefined + res.writeHead(200, { 'content-type': 'text/html' }).end('

You may close this tab.

') + resolve({ code: c, rxState: s, err: e }) + }) + }) + if (err) throw new Error(`Authorization error: ${err}`) + if (!code || rxState !== state) throw new Error('Invalid authorization response (state mismatch)') + + // d) exchange code for token + const form2 = new URLSearchParams({ + grant_type: 'authorization_code', + code, + code_verifier: verifier, + client_id: reg.client_id, + redirect_uri: redirectUri, + resource: rs.toString(), + }) + const res2 = await this.fetchCompat(meta.token_endpoint, { + method: 'POST', + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + body: form2, + }) + if (!res2.ok) { + const txt = await res2.text().catch(() => '') + throw new Error(`Token exchange failed (HTTP ${res2.status}): ${txt?.slice(0, 300)}`) + } + const tk = (await res2.json()) as Record + return { ...(tk as object), obtained_at: Date.now() } as Token + } + + /** Fetch + error‑check + parse JSON */ + private static async json(url: string, init?: RequestInit): Promise { + const r = await this.fetchCompat(url, init) + if (!r.ok) { + const txt = await r.text().catch(() => '') + throw new Error(`HTTP ${r.status}@${url} — ${txt}`) + } + return (await r.json()) as T + } + + /** Read & parse JSON file via workspace.fs */ + private static async read(file: string): Promise { + try { + if (!(await this.workspace.fs.exists(file))) return undefined + const buf = await this.workspace.fs.readFile(file) + return JSON.parse(buf.toString()) as T + } catch { + return undefined + } + } + + /** Write JSON, then clamp file perms to 0600 (owner read/write) */ + private static async write(file: string, obj: unknown): Promise { + const dir = path.dirname(file) + await this.workspace.fs.mkdir(dir, { recursive: true }) + await this.workspace.fs.writeFile(file, JSON.stringify(obj, null, 2), { mode: 0o600 }) + } + + /** SHA‑256 of resourceServer URL → hex key */ + private static computeKey(rs: URL): string { + return crypto + .createHash('sha256') + .update(rs.origin + rs.pathname) + .digest('hex') + } + + /** RFC‑7636 base64url without padding */ + private static b64url(buf: Buffer): string { + return buf.toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_') + } + + /** Directory for caching registration + tokens */ + private static readonly cacheDir = path.join( + process.env.HOME || process.env.USERPROFILE || '.', + '.aws', + 'sso', + 'cache' + ) + + /** + * Await server.listen() but reject if it emits 'error' (eg EADDRINUSE), + * so callers can handle it immediately instead of hanging. + */ + private static listen(server: http.Server, port: number, host: string = '127.0.0.1'): Promise { + return new Promise((resolve, reject) => { + const onListening = () => { + server.off('error', onError) + resolve() + } + const onError = (err: NodeJS.ErrnoException) => { + server.off('listening', onListening) + reject(err) + } + server.once('listening', onListening) + server.once('error', onError) + server.listen(port, host) + }) + } + + /** + * Fetch compatibility: use global fetch on Node >= 18, otherwise dynamically import('node-fetch'). + * Using Function('return import(...)') avoids downleveling to require() in CJS builds. + */ + private static async fetchCompat(url: string, init?: RequestInit): Promise { + const globalObj = globalThis as any + if (typeof globalObj.fetch === 'function') { + return globalObj.fetch(url as any, init as any) + } + // Dynamic import of ESM node-fetch (only when global fetch is unavailable) + const mod = await (Function('return import("node-fetch")')() as Promise) + const f = mod.default ?? mod + return f(url as any, init as any) + } +} From a6c64f2995a17697e3d71d30a1f411f5cf0db279 Mon Sep 17 00:00:00 2001 From: atontb <104926752+atonaamz@users.noreply.github.com> Date: Fri, 22 Aug 2025 10:06:22 -0700 Subject: [PATCH 23/74] fix: adding streakTracker to track streakLength across Completions and Edits (#2147) --- .../inline-completion/codeWhispererServer.ts | 10 +-- .../editCompletionHandler.ts | 9 +- .../session/sessionManager.test.ts | 42 --------- .../session/sessionManager.ts | 13 --- .../tracker/streakTracker.test.ts | 85 +++++++++++++++++++ .../tracker/streakTracker.ts | 42 +++++++++ 6 files changed, 138 insertions(+), 63 deletions(-) create mode 100644 server/aws-lsp-codewhisperer/src/language-server/inline-completion/tracker/streakTracker.test.ts create mode 100644 server/aws-lsp-codewhisperer/src/language-server/inline-completion/tracker/streakTracker.ts diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts index 9f2073d85e..330cf54735 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts @@ -46,6 +46,7 @@ import { UserWrittenCodeTracker } from '../../shared/userWrittenCodeTracker' import { RecentEditTracker, RecentEditTrackerDefaultConfig } from './tracker/codeEditTracker' import { CursorTracker } from './tracker/cursorTracker' import { RejectedEditTracker, DEFAULT_REJECTED_EDIT_TRACKER_CONFIG } from './tracker/rejectedEditTracker' +import { StreakTracker } from './tracker/streakTracker' import { getAddedAndDeletedLines, getCharacterDifferences } from './diffUtils' import { emitPerceivedLatencyTelemetry, @@ -129,6 +130,7 @@ export const CodewhispererServerFactory = const recentEditTracker = RecentEditTracker.getInstance(logging, RecentEditTrackerDefaultConfig) const cursorTracker = CursorTracker.getInstance() const rejectedEditTracker = RejectedEditTracker.getInstance(logging, DEFAULT_REJECTED_EDIT_TRACKER_CONFIG) + const streakTracker = StreakTracker.getInstance() let editsEnabled = false let isOnInlineCompletionHandlerInProgress = false @@ -317,9 +319,7 @@ export const CodewhispererServerFactory = // for the previous trigger if (ideCategory !== 'JETBRAINS') { completionSessionManager.discardSession(currentSession) - const streakLength = editsEnabled - ? completionSessionManager.getAndUpdateStreakLength(false) - : 0 + const streakLength = editsEnabled ? streakTracker.getAndUpdateStreakLength(false) : 0 await emitUserTriggerDecisionTelemetry( telemetry, telemetryService, @@ -405,7 +405,7 @@ export const CodewhispererServerFactory = if (session.discardInflightSessionOnNewInvocation) { session.discardInflightSessionOnNewInvocation = false completionSessionManager.discardSession(session) - const streakLength = editsEnabled ? completionSessionManager.getAndUpdateStreakLength(false) : 0 + const streakLength = editsEnabled ? streakTracker.getAndUpdateStreakLength(false) : 0 await emitUserTriggerDecisionTelemetry( telemetry, telemetryService, @@ -664,7 +664,7 @@ export const CodewhispererServerFactory = // Always emit user trigger decision at session close sessionManager.closeSession(session) - const streakLength = editsEnabled ? sessionManager.getAndUpdateStreakLength(isAccepted) : 0 + const streakLength = editsEnabled ? streakTracker.getAndUpdateStreakLength(isAccepted) : 0 await emitUserTriggerDecisionTelemetry( telemetry, telemetryService, diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts index 99737d027c..193521cce9 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts @@ -36,12 +36,14 @@ import { getErrorMessage, hasConnectionExpired } from '../../shared/utils' import { AmazonQError, AmazonQServiceConnectionExpiredError } from '../../shared/amazonQServiceManager/errors' import { DocumentChangedListener } from './documentChangedListener' import { EMPTY_RESULT, EDIT_DEBOUNCE_INTERVAL_MS } from './constants' +import { StreakTracker } from './tracker/streakTracker' export class EditCompletionHandler { private readonly editsEnabled: boolean private debounceTimeout: NodeJS.Timeout | undefined private isWaiting: boolean = false private hasDocumentChangedSinceInvocation: boolean = false + private readonly streakTracker: StreakTracker constructor( readonly logging: Logging, @@ -60,6 +62,7 @@ export class EditCompletionHandler { this.editsEnabled = this.clientMetadata.initializationOptions?.aws?.awsClientCapabilities?.textDocument ?.inlineCompletionWithReferences?.inlineEditSupport ?? false + this.streakTracker = StreakTracker.getInstance() } get codeWhispererService() { @@ -264,7 +267,7 @@ export class EditCompletionHandler { if (currentSession && currentSession.state === 'ACTIVE') { // Emit user trigger decision at session close time for active session this.sessionManager.discardSession(currentSession) - const streakLength = this.editsEnabled ? this.sessionManager.getAndUpdateStreakLength(false) : 0 + const streakLength = this.editsEnabled ? this.streakTracker.getAndUpdateStreakLength(false) : 0 await emitUserTriggerDecisionTelemetry( this.telemetry, this.telemetryService, @@ -335,7 +338,7 @@ export class EditCompletionHandler { if (session.discardInflightSessionOnNewInvocation) { session.discardInflightSessionOnNewInvocation = false this.sessionManager.discardSession(session) - const streakLength = this.editsEnabled ? this.sessionManager.getAndUpdateStreakLength(false) : 0 + const streakLength = this.editsEnabled ? this.streakTracker.getAndUpdateStreakLength(false) : 0 await emitUserTriggerDecisionTelemetry( this.telemetry, this.telemetryService, @@ -359,7 +362,7 @@ export class EditCompletionHandler { this.telemetryService, session, this.documentChangedListener.timeSinceLastUserModification, - this.editsEnabled ? this.sessionManager.getAndUpdateStreakLength(false) : 0 + this.editsEnabled ? this.streakTracker.getAndUpdateStreakLength(false) : 0 ) return EMPTY_RESULT } diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.test.ts index bef684eb9b..ddf06ffd40 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.test.ts @@ -673,46 +673,4 @@ describe('SessionManager', function () { assert.equal(session.getSuggestionState('id4'), 'Discard') }) }) - - describe('getAndUpdateStreakLength()', function () { - it('should return 0 if user rejects suggestion A', function () { - const manager = SessionManager.getInstance() - - assert.equal(manager.getAndUpdateStreakLength(false), -1) - assert.equal(manager.streakLength, 0) - }) - - it('should return -1 for A and 1 for B if user accepts suggestion A and rejects B', function () { - const manager = SessionManager.getInstance() - - assert.equal(manager.getAndUpdateStreakLength(true), -1) - assert.equal(manager.streakLength, 1) - assert.equal(manager.getAndUpdateStreakLength(false), 1) - assert.equal(manager.streakLength, 0) - }) - - it('should return -1 for A, -1 for B, and 2 for C if user accepts A, accepts B, and rejects C', function () { - const manager = SessionManager.getInstance() - - assert.equal(manager.getAndUpdateStreakLength(true), -1) - assert.equal(manager.streakLength, 1) - assert.equal(manager.getAndUpdateStreakLength(true), -1) - assert.equal(manager.streakLength, 2) - assert.equal(manager.getAndUpdateStreakLength(false), 2) - assert.equal(manager.streakLength, 0) - }) - - it('should return -1 for A, -1 for B, and 1 for C if user accepts A, make an edit, accepts B, and rejects C', function () { - const manager = SessionManager.getInstance() - - assert.equal(manager.getAndUpdateStreakLength(true), -1) - assert.equal(manager.streakLength, 1) - assert.equal(manager.getAndUpdateStreakLength(false), 1) - assert.equal(manager.streakLength, 0) - assert.equal(manager.getAndUpdateStreakLength(true), -1) - assert.equal(manager.streakLength, 1) - assert.equal(manager.getAndUpdateStreakLength(false), 1) - assert.equal(manager.streakLength, 0) - }) - }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts index 235c464234..34dbb12538 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts @@ -282,7 +282,6 @@ export class SessionManager { private currentSession?: CodeWhispererSession private sessionsLog: CodeWhispererSession[] = [] private maxHistorySize = 5 - streakLength: number = 0 // TODO, for user decision telemetry: accepted suggestions (not necessarily the full corresponding session) should be stored for 5 minutes private constructor() {} @@ -362,16 +361,4 @@ export class SessionManager { this.currentSession.activate() } } - - getAndUpdateStreakLength(isAccepted: boolean | undefined): number { - if (!isAccepted && this.streakLength != 0) { - const currentStreakLength = this.streakLength - this.streakLength = 0 - return currentStreakLength - } else if (isAccepted) { - // increment streakLength everytime a suggestion is accepted. - this.streakLength = this.streakLength + 1 - } - return -1 - } } diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/tracker/streakTracker.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/tracker/streakTracker.test.ts new file mode 100644 index 0000000000..4c69879115 --- /dev/null +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/tracker/streakTracker.test.ts @@ -0,0 +1,85 @@ +/*! + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +import * as assert from 'assert' +import { StreakTracker } from './streakTracker' + +describe('StreakTracker', function () { + let tracker: StreakTracker + + beforeEach(function () { + StreakTracker.reset() + tracker = StreakTracker.getInstance() + }) + + afterEach(function () { + StreakTracker.reset() + }) + + describe('getInstance', function () { + it('should return the same instance (singleton)', function () { + const instance1 = StreakTracker.getInstance() + const instance2 = StreakTracker.getInstance() + assert.strictEqual(instance1, instance2) + }) + + it('should create new instance after reset', function () { + const instance1 = StreakTracker.getInstance() + StreakTracker.reset() + const instance2 = StreakTracker.getInstance() + assert.notStrictEqual(instance1, instance2) + }) + }) + + describe('getAndUpdateStreakLength', function () { + it('should return -1 for undefined input', function () { + const result = tracker.getAndUpdateStreakLength(undefined) + assert.strictEqual(result, -1) + }) + + it('should return -1 and increment streak on acceptance', function () { + const result = tracker.getAndUpdateStreakLength(true) + assert.strictEqual(result, -1) + }) + + it('should return -1 for rejection with zero streak', function () { + const result = tracker.getAndUpdateStreakLength(false) + assert.strictEqual(result, -1) + }) + + it('should return previous streak on rejection after acceptances', function () { + tracker.getAndUpdateStreakLength(true) + tracker.getAndUpdateStreakLength(true) + tracker.getAndUpdateStreakLength(true) + + const result = tracker.getAndUpdateStreakLength(false) + assert.strictEqual(result, 3) + }) + + it('should handle acceptance after rejection', function () { + tracker.getAndUpdateStreakLength(true) + tracker.getAndUpdateStreakLength(true) + + const resetResult = tracker.getAndUpdateStreakLength(false) + assert.strictEqual(resetResult, 2) + + tracker.getAndUpdateStreakLength(true) + const newResult = tracker.getAndUpdateStreakLength(true) + assert.strictEqual(newResult, -1) + }) + }) + + describe('cross-instance consistency', function () { + it('should maintain state across getInstance calls', function () { + const tracker1 = StreakTracker.getInstance() + tracker1.getAndUpdateStreakLength(true) + tracker1.getAndUpdateStreakLength(true) + + const tracker2 = StreakTracker.getInstance() + const result = tracker2.getAndUpdateStreakLength(false) + assert.strictEqual(result, 2) + }) + }) +}) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/tracker/streakTracker.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/tracker/streakTracker.ts new file mode 100644 index 0000000000..21d56c4d74 --- /dev/null +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/tracker/streakTracker.ts @@ -0,0 +1,42 @@ +/*! + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * Tracks acceptance streak across both completion and edit suggestion types. + * Shared singleton to maintain consistent streak count between different code paths. + */ +export class StreakTracker { + private static _instance?: StreakTracker + private streakLength: number = 0 + + private constructor() {} + + public static getInstance(): StreakTracker { + if (!StreakTracker._instance) { + StreakTracker._instance = new StreakTracker() + } + return StreakTracker._instance + } + + public static reset() { + StreakTracker._instance = undefined + } + + /** + * Updates and returns the current streak length based on acceptance status. + * @param isAccepted Whether the suggestion was accepted + * @returns Current streak length before update, or -1 if no change + */ + public getAndUpdateStreakLength(isAccepted: boolean | undefined): number { + if (!isAccepted && this.streakLength !== 0) { + const currentStreakLength = this.streakLength + this.streakLength = 0 + return currentStreakLength + } else if (isAccepted) { + this.streakLength += 1 + } + return -1 + } +} From 71b35952333e7581921644ce40fabbc1e6d3c02f Mon Sep 17 00:00:00 2001 From: Boyu Date: Fri, 22 Aug 2025 14:33:11 -0700 Subject: [PATCH 24/74] feat: disable pkce flow during plugin load (#2153) --- .../src/language-server/agenticChat/errors.ts | 1 + .../agenticChat/tools/mcp/mcpManager.ts | 31 +++++++--- .../agenticChat/tools/mcp/mcpOauthClient.ts | 59 ++++++++++++++++--- 3 files changed, 77 insertions(+), 14 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/errors.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/errors.ts index 3038269463..819211dfab 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/errors.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/errors.ts @@ -11,6 +11,7 @@ type AgenticChatErrorCode = | 'MCPServerInitTimeout' // mcp server failed to start within allowed time | 'MCPToolExecTimeout' // mcp tool call failed to complete within allowed time | 'MCPServerConnectionFailed' // mcp server failed to connect + | 'MCPServerAuthFailed' // mcp server failed to complete auth flow | 'RequestAborted' // request was aborted by the user | 'RequestThrottled' // request was aborted by the user diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index 7ac6257641..555bdb2c89 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -42,6 +42,10 @@ import { OAuthClient } from './mcpOauthClient' export const MCP_SERVER_STATUS_CHANGED = 'mcpServerStatusChanged' export const AGENT_TOOLS_CHANGED = 'agentToolsChanged' +export enum AuthIntent { + Interactive = 'interactive', + Silent = 'silent', +} /** * Manages MCP servers and their tools @@ -166,7 +170,7 @@ export class McpManager { /** * Load configurations and initialize each enabled server. */ - private async discoverAllServers(): Promise { + private async discoverAllServers(authIntent: AuthIntent = AuthIntent.Silent): Promise { // Load agent config const result = await loadAgentConfig(this.features.workspace, this.features.logging, this.agentPaths) @@ -217,7 +221,7 @@ export class McpManager { // Process servers in batches for (let i = 0; i < totalServers; i += MAX_CONCURRENT_SERVERS) { const batch = serversToInit.slice(i, i + MAX_CONCURRENT_SERVERS) - const batchPromises = batch.map(([name, cfg]) => this.initOneServer(name, cfg)) + const batchPromises = batch.map(([name, cfg]) => this.initOneServer(name, cfg, authIntent)) this.features.logging.debug( `MCP: initializing batch of ${batch.length} servers (${i + 1}-${Math.min(i + MAX_CONCURRENT_SERVERS, totalServers)} of ${totalServers})` @@ -292,7 +296,11 @@ export class McpManager { * Start a server process, connect client, and register its tools. * Errors are logged but do not stop discovery of other servers. */ - private async initOneServer(serverName: string, cfg: MCPServerConfig): Promise { + private async initOneServer( + serverName: string, + cfg: MCPServerConfig, + authIntent: AuthIntent = AuthIntent.Silent + ): Promise { const DEFAULT_SERVER_INIT_TIMEOUT_MS = 60_000 this.setState(serverName, McpServerStatus.INITIALIZING, 0) @@ -365,10 +373,19 @@ export class McpManager { if (needsOAuth) { OAuthClient.initialize(this.features.workspace, this.features.logging) - const bearer = await OAuthClient.getValidAccessToken(base) + const bearer = await OAuthClient.getValidAccessToken(base, { + interactive: authIntent === 'interactive', + }) // add authorization header if we are able to obtain a bearer token if (bearer) { headers = { ...headers, Authorization: `Bearer ${bearer}` } + } else if (authIntent === 'silent') { + // In silent mode we never launch a browser. If we cannot obtain a token + // from cache/refresh, surface a clear auth-required error and stop here. + throw new AgenticChatError( + `MCP: server '${serverName}' requires OAuth. Open "Edit MCP Server" and save to sign in.`, + 'MCPServerAuthFailed' + ) } } @@ -707,7 +724,7 @@ export class McpManager { await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, agentPath) // Add server tools to tools list after initialization - await this.initOneServer(sanitizedName, newCfg) + await this.initOneServer(sanitizedName, newCfg, AuthIntent.Interactive) } catch (err) { this.features.logging.error( `Failed to add MCP server '${serverName}': ${err instanceof Error ? err.message : String(err)}` @@ -872,7 +889,7 @@ export class McpManager { this.setState(serverName, McpServerStatus.DISABLED, 0) this.emitToolsChanged(serverName) } else { - await this.initOneServer(serverName, newCfg) + await this.initOneServer(serverName, newCfg, AuthIntent.Interactive) } } catch (err) { this.handleError(serverName, err) @@ -1086,7 +1103,7 @@ export class McpManager { this.setState(serverName, McpServerStatus.DISABLED, 0) } else { if (!this.clients.has(serverName) && serverName !== 'Built-in') { - await this.initOneServer(serverName, this.mcpServers.get(serverName)!) + await this.initOneServer(serverName, this.mcpServers.get(serverName)!, AuthIntent.Silent) } } diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts index 73ffea1a1d..86bc7ba027 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts @@ -42,15 +42,55 @@ export class OAuthClient { /** * Return a valid Bearer token, reusing cache or refresh-token if possible, - * otherwise driving one interactive PKCE flow. + * otherwise (when interactive) driving one PKCE flow that may launch a browser. */ - public static async getValidAccessToken(mcpBase: URL): Promise { + public static async getValidAccessToken( + mcpBase: URL, + opts: { interactive?: boolean } = { interactive: true } + ): Promise { + const interactive = opts?.interactive !== false const key = this.computeKey(mcpBase) const regPath = path.join(this.cacheDir, `${key}.registration.json`) const tokPath = path.join(this.cacheDir, `${key}.token.json`) + // ===== Silent branch: try cached token, then refresh, never opens a browser ===== + if (!interactive) { + // 1) cached access token + const cachedTok = await this.read(tokPath) + if (cachedTok) { + const expiry = cachedTok.obtained_at + cachedTok.expires_in * 1000 + if (Date.now() < expiry) { + this.logger.info(`OAuth: using still-valid cached token (silent)`) + return cachedTok.access_token + } + this.logger.info(`OAuth: cached token expired → try refresh (silent)`) + } + + // 2) refresh-token grant (if we have registration and refresh token) + const savedReg = await this.read(regPath) + if (cachedTok?.refresh_token && savedReg) { + try { + const meta = await this.discoverAS(mcpBase) + const refreshed = await this.refreshGrant(meta, savedReg, mcpBase, cachedTok.refresh_token) + if (refreshed) { + await this.write(tokPath, refreshed) + this.logger.info(`OAuth: refresh grant succeeded (silent)`) + return refreshed.access_token + } + this.logger.info(`OAuth: refresh grant did not succeed (silent)`) + } catch (e) { + this.logger.warn(`OAuth: silent refresh failed — ${e instanceof Error ? e.message : String(e)}`) + } + } + + // 3) no token in silent mode → caller should surface auth-required UI + return undefined + } + + // ===== Interactive branch: may open a browser (PKCE) ===== // 1) Spin up (or reuse) loopback server + redirect URI - let server: http.Server, redirectUri: string + let server: http.Server | null = null + let redirectUri: string const savedReg = await this.read(regPath) if (savedReg) { const port = Number(new URL(savedReg.redirect_uri).port) @@ -75,7 +115,9 @@ export class OAuthClient { } } } else { - ;({ server, redirectUri } = await this.buildCallbackServer()) + const created = await this.buildCallbackServer() + server = created.server + redirectUri = created.redirectUri this.logger.info(`OAuth: new redirect URI ${redirectUri}`) } @@ -85,7 +127,7 @@ export class OAuthClient { if (cached) { const expiry = cached.obtained_at + cached.expires_in * 1000 if (Date.now() < expiry) { - this.logger.info(`OAuth: using still‑valid cached token`) + this.logger.info(`OAuth: using still-valid cached token`) return cached.access_token } this.logger.info(`OAuth: cached token expired → try refresh`) @@ -98,6 +140,7 @@ export class OAuthClient { } catch (e: any) { throw new Error(`OAuth discovery failed: ${e?.message ?? String(e)}`) } + // 4) Register (or reuse) a dynamic client const scopes = ['openid', 'offline_access'] let reg: Registration @@ -107,7 +150,7 @@ export class OAuthClient { throw new Error(`OAuth client registration failed: ${e?.message ?? String(e)}`) } - // 5) Refresh‑token grant (one shot) + // 5) Refresh-token grant (one shot) const attemptedRefresh = !!cached?.refresh_token if (cached?.refresh_token) { const refreshed = await this.refreshGrant(meta, reg, mcpBase, cached.refresh_token) @@ -129,7 +172,9 @@ export class OAuthClient { throw new Error(`OAuth authorization (PKCE) failed${suffix}: ${e?.message ?? String(e)}`) } } finally { - await new Promise(res => server.close(() => res())) + if (server) { + await new Promise(res => server!.close(() => res())) + } } } From 7296f9350950a3e28f612d3a9bb75567a6f6a41d Mon Sep 17 00:00:00 2001 From: chungjac Date: Mon, 25 Aug 2025 10:26:21 -0700 Subject: [PATCH 25/74] chore: bump runtimes to 0.2.127 (#2156) --- app/aws-lsp-antlr4-runtimes/package.json | 2 +- app/aws-lsp-buildspec-runtimes/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- app/aws-lsp-identity-runtimes/package.json | 2 +- app/aws-lsp-json-runtimes/package.json | 2 +- .../package.json | 2 +- app/aws-lsp-s3-runtimes/package.json | 2 +- app/aws-lsp-yaml-json-webworker/package.json | 2 +- app/aws-lsp-yaml-runtimes/package.json | 2 +- app/hello-world-lsp-runtimes/package.json | 2 +- chat-client/package.json | 2 +- client/vscode/package.json | 2 +- core/aws-lsp-core/package.json | 2 +- .../q-agentic-chat-server/package.json | 2 +- package-lock.json | 61 +++++++++---------- server/aws-lsp-antlr4/package.json | 2 +- server/aws-lsp-buildspec/package.json | 2 +- server/aws-lsp-cloudformation/package.json | 2 +- server/aws-lsp-codewhisperer/package.json | 2 +- server/aws-lsp-identity/package.json | 2 +- server/aws-lsp-json/package.json | 2 +- server/aws-lsp-notification/package.json | 2 +- server/aws-lsp-partiql/package.json | 2 +- server/aws-lsp-s3/package.json | 2 +- server/aws-lsp-yaml/package.json | 2 +- server/device-sso-auth-lsp/package.json | 2 +- server/hello-world-lsp/package.json | 2 +- 28 files changed, 57 insertions(+), 58 deletions(-) diff --git a/app/aws-lsp-antlr4-runtimes/package.json b/app/aws-lsp-antlr4-runtimes/package.json index 30b9b57a65..89fa95dcb3 100644 --- a/app/aws-lsp-antlr4-runtimes/package.json +++ b/app/aws-lsp-antlr4-runtimes/package.json @@ -12,7 +12,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-antlr4": "*", "antlr4-c3": "^3.4.1", "antlr4ng": "^3.0.4" diff --git a/app/aws-lsp-buildspec-runtimes/package.json b/app/aws-lsp-buildspec-runtimes/package.json index 47a88b907a..0ad07ddb8f 100644 --- a/app/aws-lsp-buildspec-runtimes/package.json +++ b/app/aws-lsp-buildspec-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-buildspec": "^0.0.1" } } diff --git a/app/aws-lsp-cloudformation-runtimes/package.json b/app/aws-lsp-cloudformation-runtimes/package.json index 68547449cc..d211149d0d 100644 --- a/app/aws-lsp-cloudformation-runtimes/package.json +++ b/app/aws-lsp-cloudformation-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-cloudformation": "^0.0.1" } } diff --git a/app/aws-lsp-codewhisperer-runtimes/package.json b/app/aws-lsp-codewhisperer-runtimes/package.json index 24e06d87ea..b890c01a78 100644 --- a/app/aws-lsp-codewhisperer-runtimes/package.json +++ b/app/aws-lsp-codewhisperer-runtimes/package.json @@ -23,7 +23,7 @@ "local-build": "node scripts/local-build.js" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-codewhisperer": "*", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", diff --git a/app/aws-lsp-identity-runtimes/package.json b/app/aws-lsp-identity-runtimes/package.json index 2bf37011c3..f33fa80da4 100644 --- a/app/aws-lsp-identity-runtimes/package.json +++ b/app/aws-lsp-identity-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-identity": "^0.0.1" } } diff --git a/app/aws-lsp-json-runtimes/package.json b/app/aws-lsp-json-runtimes/package.json index 8a2ea3203a..db1949f54b 100644 --- a/app/aws-lsp-json-runtimes/package.json +++ b/app/aws-lsp-json-runtimes/package.json @@ -11,7 +11,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-json": "*" }, "devDependencies": { diff --git a/app/aws-lsp-notification-runtimes/package.json b/app/aws-lsp-notification-runtimes/package.json index b1877ae13e..a5eeecae49 100644 --- a/app/aws-lsp-notification-runtimes/package.json +++ b/app/aws-lsp-notification-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-notification": "^0.0.1" } } diff --git a/app/aws-lsp-s3-runtimes/package.json b/app/aws-lsp-s3-runtimes/package.json index a242281ff2..9feb4f7ddc 100644 --- a/app/aws-lsp-s3-runtimes/package.json +++ b/app/aws-lsp-s3-runtimes/package.json @@ -10,7 +10,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-s3": "^0.0.1" } } diff --git a/app/aws-lsp-yaml-json-webworker/package.json b/app/aws-lsp-yaml-json-webworker/package.json index 8eebf1ea84..fc524cabdc 100644 --- a/app/aws-lsp-yaml-json-webworker/package.json +++ b/app/aws-lsp-yaml-json-webworker/package.json @@ -11,7 +11,7 @@ "serve:webpack": "NODE_ENV=development webpack serve" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*" }, diff --git a/app/aws-lsp-yaml-runtimes/package.json b/app/aws-lsp-yaml-runtimes/package.json index 1428ef3058..09bb93ee9a 100644 --- a/app/aws-lsp-yaml-runtimes/package.json +++ b/app/aws-lsp-yaml-runtimes/package.json @@ -11,7 +11,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-yaml": "*" }, "devDependencies": { diff --git a/app/hello-world-lsp-runtimes/package.json b/app/hello-world-lsp-runtimes/package.json index 352bf82f88..bff976d9b3 100644 --- a/app/hello-world-lsp-runtimes/package.json +++ b/app/hello-world-lsp-runtimes/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@aws/hello-world-lsp": "^0.0.1", - "@aws/language-server-runtimes": "^0.2.126" + "@aws/language-server-runtimes": "^0.2.127" }, "devDependencies": { "@types/chai": "^4.3.5", diff --git a/chat-client/package.json b/chat-client/package.json index 1af265fdfe..59720a0187 100644 --- a/chat-client/package.json +++ b/chat-client/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/language-server-runtimes-types": "^0.1.50", "@aws/mynah-ui": "^4.36.4" }, diff --git a/client/vscode/package.json b/client/vscode/package.json index 4cb42a0752..a5d7f66d21 100644 --- a/client/vscode/package.json +++ b/client/vscode/package.json @@ -352,7 +352,7 @@ "@aws-sdk/credential-providers": "^3.731.1", "@aws-sdk/types": "^3.734.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@types/uuid": "^9.0.8", "@types/vscode": "^1.98.0", "jose": "^5.2.4", diff --git a/core/aws-lsp-core/package.json b/core/aws-lsp-core/package.json index 4ecdd4e238..54ca980fc1 100644 --- a/core/aws-lsp-core/package.json +++ b/core/aws-lsp-core/package.json @@ -28,7 +28,7 @@ "prepack": "shx cp ../../LICENSE ../../NOTICE ../../SECURITY.md ." }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@gerhobbelt/gitignore-parser": "^0.2.0-9", "cross-spawn": "7.0.6", "jose": "^5.2.4", diff --git a/integration-tests/q-agentic-chat-server/package.json b/integration-tests/q-agentic-chat-server/package.json index 7415e1653e..ffb33f1a4e 100644 --- a/integration-tests/q-agentic-chat-server/package.json +++ b/integration-tests/q-agentic-chat-server/package.json @@ -9,7 +9,7 @@ "test-integ": "npm run compile && mocha --timeout 30000 \"./out/**/*.test.js\" --retries 2" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "*" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 8dbdc6d513..e65f8e8c96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "name": "@aws/lsp-antlr4-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-antlr4": "*", "antlr4-c3": "^3.4.1", "antlr4ng": "^3.0.4" @@ -71,7 +71,7 @@ "name": "@aws/lsp-buildspec-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-buildspec": "^0.0.1" } }, @@ -79,7 +79,7 @@ "name": "@aws/lsp-cloudformation-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-cloudformation": "^0.0.1" } }, @@ -87,7 +87,7 @@ "name": "@aws/lsp-codewhisperer-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-codewhisperer": "*", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", @@ -120,7 +120,7 @@ "name": "@aws/lsp-identity-runtimes", "version": "0.1.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-identity": "^0.0.1" } }, @@ -128,7 +128,7 @@ "name": "@aws/lsp-json-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-json": "*" }, "devDependencies": { @@ -148,7 +148,7 @@ "name": "@aws/lsp-notification-runtimes", "version": "0.1.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-notification": "^0.0.1" } }, @@ -181,7 +181,7 @@ "name": "@aws/lsp-s3-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-s3": "^0.0.1" }, "bin": { @@ -192,7 +192,7 @@ "name": "@aws/lsp-yaml-json-webworker", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*" }, @@ -212,7 +212,7 @@ "name": "@aws/lsp-yaml-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-yaml": "*" }, "devDependencies": { @@ -234,7 +234,7 @@ "version": "0.0.1", "dependencies": { "@aws/hello-world-lsp": "^0.0.1", - "@aws/language-server-runtimes": "^0.2.126" + "@aws/language-server-runtimes": "^0.2.127" }, "devDependencies": { "@types/chai": "^4.3.5", @@ -255,7 +255,7 @@ "license": "Apache-2.0", "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/language-server-runtimes-types": "^0.1.50", "@aws/mynah-ui": "^4.36.4" }, @@ -280,7 +280,7 @@ "@aws-sdk/credential-providers": "^3.731.1", "@aws-sdk/types": "^3.734.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@types/uuid": "^9.0.8", "@types/vscode": "^1.98.0", "jose": "^5.2.4", @@ -296,7 +296,7 @@ "version": "0.0.14", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@gerhobbelt/gitignore-parser": "^0.2.0-9", "cross-spawn": "7.0.6", "jose": "^5.2.4", @@ -327,7 +327,7 @@ "name": "@aws/q-agentic-chat-server-integration-tests", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "*" }, "devDependencies": { @@ -4036,10 +4036,9 @@ "link": true }, "node_modules/@aws/language-server-runtimes": { - "version": "0.2.126", - "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes/-/language-server-runtimes-0.2.126.tgz", - "integrity": "sha512-dUIKTL6+AOxdberwHLvigSJcbhFv6oUS3POhZWoNlBV9XJZRWwzNW9gkjkUsI03YTVshqMuVHT/HaoRW/hDkIA==", - "license": "Apache-2.0", + "version": "0.2.127", + "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes/-/language-server-runtimes-0.2.127.tgz", + "integrity": "sha512-UWCfv49MYaBhxArVBWTEw2XVfIyunbm6EfS9AxSLPudcwrpOg3KAVLooXearmyM/r2hgNDGCQYI8HuKf5FAnew==", "dependencies": { "@aws/language-server-runtimes-types": "^0.1.56", "@opentelemetry/api": "^1.9.0", @@ -28608,7 +28607,7 @@ "version": "0.1.18", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.14" }, "devDependencies": { @@ -28650,7 +28649,7 @@ "name": "@aws/lsp-buildspec", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*", "vscode-languageserver": "^9.0.1", @@ -28661,7 +28660,7 @@ "name": "@aws/lsp-cloudformation", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "*", "@aws/lsp-json": "*", "vscode-languageserver": "^9.0.1", @@ -28683,7 +28682,7 @@ "@aws-sdk/util-arn-parser": "^3.723.0", "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.14", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", @@ -28823,7 +28822,7 @@ "dependencies": { "@aws-sdk/client-sso-oidc": "^3.616.0", "@aws-sdk/token-providers": "^3.744.0", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.12", "@smithy/node-http-handler": "^3.2.5", "@smithy/shared-ini-file-loader": "^4.0.1", @@ -28888,7 +28887,7 @@ "version": "0.1.18", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" @@ -28905,7 +28904,7 @@ "version": "0.0.1", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1" }, @@ -28966,7 +28965,7 @@ "version": "0.0.17", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "antlr4-c3": "3.4.2", "antlr4ng": "3.0.14", "web-tree-sitter": "0.22.6" @@ -28988,7 +28987,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.623.0", "@aws-sdk/types": "^3.734.0", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" @@ -29019,7 +29018,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", @@ -29033,7 +29032,7 @@ "name": "@amzn/device-sso-auth-lsp", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "vscode-languageserver": "^9.0.1" }, "devDependencies": { @@ -29044,7 +29043,7 @@ "name": "@aws/hello-world-lsp", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "vscode-languageserver": "^9.0.1" }, "devDependencies": { diff --git a/server/aws-lsp-antlr4/package.json b/server/aws-lsp-antlr4/package.json index b61239d633..2ca49593d7 100644 --- a/server/aws-lsp-antlr4/package.json +++ b/server/aws-lsp-antlr4/package.json @@ -28,7 +28,7 @@ "clean": "rm -rf node_modules" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.14" }, "peerDependencies": { diff --git a/server/aws-lsp-buildspec/package.json b/server/aws-lsp-buildspec/package.json index 3a23338dac..9754645b7d 100644 --- a/server/aws-lsp-buildspec/package.json +++ b/server/aws-lsp-buildspec/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*", "vscode-languageserver": "^9.0.1", diff --git a/server/aws-lsp-cloudformation/package.json b/server/aws-lsp-cloudformation/package.json index 75223b4791..13be6a4859 100644 --- a/server/aws-lsp-cloudformation/package.json +++ b/server/aws-lsp-cloudformation/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "*", "@aws/lsp-json": "*", "vscode-languageserver": "^9.0.1", diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index c0f6c16afd..83ff1cdaee 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -36,7 +36,7 @@ "@aws-sdk/util-arn-parser": "^3.723.0", "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.14", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", diff --git a/server/aws-lsp-identity/package.json b/server/aws-lsp-identity/package.json index 0e61d97dc8..9aa4bedcbf 100644 --- a/server/aws-lsp-identity/package.json +++ b/server/aws-lsp-identity/package.json @@ -26,7 +26,7 @@ "dependencies": { "@aws-sdk/client-sso-oidc": "^3.616.0", "@aws-sdk/token-providers": "^3.744.0", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.12", "@smithy/node-http-handler": "^3.2.5", "@smithy/shared-ini-file-loader": "^4.0.1", diff --git a/server/aws-lsp-json/package.json b/server/aws-lsp-json/package.json index d129734444..ee5fbbc47a 100644 --- a/server/aws-lsp-json/package.json +++ b/server/aws-lsp-json/package.json @@ -26,7 +26,7 @@ "prepack": "shx cp ../../LICENSE ../../NOTICE ../../SECURITY.md ." }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" diff --git a/server/aws-lsp-notification/package.json b/server/aws-lsp-notification/package.json index f6483e3e32..f19ddc54ca 100644 --- a/server/aws-lsp-notification/package.json +++ b/server/aws-lsp-notification/package.json @@ -22,7 +22,7 @@ "coverage:report": "c8 report --reporter=html --reporter=text" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1" }, diff --git a/server/aws-lsp-partiql/package.json b/server/aws-lsp-partiql/package.json index 2a5a5bb73f..dc2fc2ee22 100644 --- a/server/aws-lsp-partiql/package.json +++ b/server/aws-lsp-partiql/package.json @@ -24,7 +24,7 @@ "out" ], "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "antlr4-c3": "3.4.2", "antlr4ng": "3.0.14", "web-tree-sitter": "0.22.6" diff --git a/server/aws-lsp-s3/package.json b/server/aws-lsp-s3/package.json index b574da9bc0..914628d14e 100644 --- a/server/aws-lsp-s3/package.json +++ b/server/aws-lsp-s3/package.json @@ -9,7 +9,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.623.0", "@aws-sdk/types": "^3.734.0", - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" diff --git a/server/aws-lsp-yaml/package.json b/server/aws-lsp-yaml/package.json index 7d2b942ab5..fe115132c8 100644 --- a/server/aws-lsp-yaml/package.json +++ b/server/aws-lsp-yaml/package.json @@ -26,7 +26,7 @@ "postinstall": "node patchYamlPackage.js" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", diff --git a/server/device-sso-auth-lsp/package.json b/server/device-sso-auth-lsp/package.json index 6eba3692a9..e5085aa6bd 100644 --- a/server/device-sso-auth-lsp/package.json +++ b/server/device-sso-auth-lsp/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "vscode-languageserver": "^9.0.1" }, "devDependencies": { diff --git a/server/hello-world-lsp/package.json b/server/hello-world-lsp/package.json index b221272541..8ab207f8b4 100644 --- a/server/hello-world-lsp/package.json +++ b/server/hello-world-lsp/package.json @@ -13,7 +13,7 @@ "coverage:report": "c8 report --reporter=html --reporter=text" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.126", + "@aws/language-server-runtimes": "^0.2.127", "vscode-languageserver": "^9.0.1" }, "devDependencies": { From 472220a745cff4fe91a2cabae4ae059a164ceddd Mon Sep 17 00:00:00 2001 From: Boyu Date: Mon, 25 Aug 2025 13:37:00 -0700 Subject: [PATCH 26/74] fix: multiple fixes on auth flow edge cases (#2155) --- .../agenticChat/tools/mcp/mcpEventHandler.ts | 31 ++++++++----- .../agenticChat/tools/mcp/mcpManager.ts | 45 ++++++++++++------- .../tools/mcp/mcpOauthClient.test.ts | 4 +- .../agenticChat/tools/mcp/mcpOauthClient.ts | 33 +++++++++----- 4 files changed, 73 insertions(+), 40 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts index a5090319ba..d167299106 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts @@ -35,6 +35,7 @@ enum TransportType { } export class McpEventHandler { + private static readonly FILE_WATCH_DEBOUNCE_MS = 2000 #features: Features #eventListenerRegistered: boolean #currentEditingServerName: string | undefined @@ -48,6 +49,12 @@ export class McpEventHandler { #lastProgrammaticState: boolean = false #serverNameBeforeUpdate: string | undefined + #releaseProgrammaticAfterDebounce(padMs = 500) { + setTimeout(() => { + this.#isProgrammaticChange = false + }, McpEventHandler.FILE_WATCH_DEBOUNCE_MS + padMs) + } + constructor(features: Features, telemetryService: TelemetryService) { this.#features = features this.#eventListenerRegistered = false @@ -797,7 +804,7 @@ export class McpEventHandler { command: selectedTransport === TransportType.STDIO ? params.optionsValues.command : undefined, url: selectedTransport === TransportType.HTTP ? params.optionsValues.url : undefined, enabled: true, - numTools: McpManager.instance.getAllToolsWithPermissions(serverName).length, + numTools: McpManager.instance.getAllToolsWithPermissions(sanitizedServerName).length, scope: params.optionsValues['scope'] === 'global' ? 'global' : 'workspace', transportType: selectedTransport, languageServerVersion: this.#features.runtime.serverInfo.version, @@ -812,6 +819,7 @@ export class McpEventHandler { // Stay on add/edit page and show error to user // Keep isProgrammaticChange true during error handling to prevent file watcher triggers + this.#releaseProgrammaticAfterDebounce() if (isEditMode) { params.id = 'edit-mcp' params.title = sanitizedServerName @@ -826,7 +834,7 @@ export class McpEventHandler { this.#newlyAddedServers.delete(serverName) } - this.#isProgrammaticChange = false + this.#releaseProgrammaticAfterDebounce() // Go to tools permissions page return this.#handleOpenMcpServer({ id: 'open-mcp-server', title: sanitizedServerName }) @@ -927,9 +935,10 @@ export class McpEventHandler { perm.__configPath__ = agentPath await mcpManager.updateServerPermission(serverName, perm) this.#emitMCPConfigEvent() + this.#releaseProgrammaticAfterDebounce() } catch (error) { this.#features.logging.error(`Failed to enable MCP server: ${error}`) - this.#isProgrammaticChange = false + this.#releaseProgrammaticAfterDebounce() } return { id: params.id } } @@ -953,9 +962,10 @@ export class McpEventHandler { perm.__configPath__ = agentPath await mcpManager.updateServerPermission(serverName, perm) this.#emitMCPConfigEvent() + this.#releaseProgrammaticAfterDebounce() } catch (error) { this.#features.logging.error(`Failed to disable MCP server: ${error}`) - this.#isProgrammaticChange = false + this.#releaseProgrammaticAfterDebounce() } return { id: params.id } @@ -975,11 +985,11 @@ export class McpEventHandler { try { await McpManager.instance.removeServer(serverName) - + this.#releaseProgrammaticAfterDebounce() return { id: params.id } } catch (error) { this.#features.logging.error(`Failed to delete MCP server: ${error}`) - this.#isProgrammaticChange = false + this.#releaseProgrammaticAfterDebounce() return { id: params.id } } } @@ -1262,10 +1272,11 @@ export class McpEventHandler { this.#pendingPermissionConfig = undefined this.#features.logging.info(`Applied permission changes for server: ${serverName}`) + this.#releaseProgrammaticAfterDebounce() return { id: params.id } } catch (error) { this.#features.logging.error(`Failed to save MCP permissions: ${error}`) - this.#isProgrammaticChange = false + this.#releaseProgrammaticAfterDebounce() return { id: params.id } } } @@ -1430,7 +1441,8 @@ export class McpEventHandler { */ #getServerStatusError(serverName: string): { title: string; icon: string; status: Status } | undefined { const serverStates = McpManager.instance.getAllServerStates() - const serverState = serverStates.get(serverName) + const key = serverName ? sanitizeName(serverName) : serverName + const serverState = key ? serverStates.get(key) : undefined if (!serverState) { return undefined @@ -1494,11 +1506,10 @@ export class McpEventHandler { if (!this.#lastProgrammaticState) { await this.#handleRefreshMCPList({ id: 'refresh-mcp-list' }) } else { - this.#isProgrammaticChange = false this.#features.logging.debug('Skipping refresh due to programmatic change') } this.#debounceTimer = null - }, 2000) + }, McpEventHandler.FILE_WATCH_DEBOUNCE_MS) }) } diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index 555bdb2c89..ec7d16d277 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -170,7 +170,7 @@ export class McpManager { /** * Load configurations and initialize each enabled server. */ - private async discoverAllServers(authIntent: AuthIntent = AuthIntent.Silent): Promise { + private async discoverAllServers(): Promise { // Load agent config const result = await loadAgentConfig(this.features.workspace, this.features.logging, this.agentPaths) @@ -221,7 +221,7 @@ export class McpManager { // Process servers in batches for (let i = 0; i < totalServers; i += MAX_CONCURRENT_SERVERS) { const batch = serversToInit.slice(i, i + MAX_CONCURRENT_SERVERS) - const batchPromises = batch.map(([name, cfg]) => this.initOneServer(name, cfg, authIntent)) + const batchPromises = batch.map(([name, cfg]) => this.initOneServer(name, cfg, AuthIntent.Silent)) this.features.logging.debug( `MCP: initializing batch of ${batch.length} servers (${i + 1}-${Math.min(i + MAX_CONCURRENT_SERVERS, totalServers)} of ${totalServers})` @@ -373,19 +373,29 @@ export class McpManager { if (needsOAuth) { OAuthClient.initialize(this.features.workspace, this.features.logging) - const bearer = await OAuthClient.getValidAccessToken(base, { - interactive: authIntent === 'interactive', - }) - // add authorization header if we are able to obtain a bearer token - if (bearer) { - headers = { ...headers, Authorization: `Bearer ${bearer}` } - } else if (authIntent === 'silent') { - // In silent mode we never launch a browser. If we cannot obtain a token - // from cache/refresh, surface a clear auth-required error and stop here. - throw new AgenticChatError( - `MCP: server '${serverName}' requires OAuth. Open "Edit MCP Server" and save to sign in.`, - 'MCPServerAuthFailed' - ) + try { + const bearer = await OAuthClient.getValidAccessToken(base, { + interactive: authIntent === AuthIntent.Interactive, + }) + if (bearer) { + headers = { ...headers, Authorization: `Bearer ${bearer}` } + } else if (authIntent === AuthIntent.Silent) { + throw new AgenticChatError( + `MCP: server '${serverName}' requires OAuth. Open "Edit MCP Server" and save to sign in.`, + 'MCPServerAuthFailed' + ) + } + } catch (e: any) { + const msg = e?.message || '' + const short = /authorization_timed_out/i.test(msg) + ? 'Sign-in timed out. Please try again.' + : /Authorization error|PKCE|access_denied|login|consent|token exchange failed/i.test( + msg + ) + ? 'Sign-in was cancelled or failed. Please try again.' + : `OAuth failed: ${msg}` + + throw new AgenticChatError(`MCP: ${short}`, 'MCPServerAuthFailed') } } @@ -1156,7 +1166,8 @@ export class McpManager { */ public async removeServerFromConfigFile(serverName: string): Promise { try { - const cfg = this.mcpServers.get(serverName) + const sanitized = sanitizeName(serverName) + const cfg = this.mcpServers.get(sanitized) if (!cfg || !cfg.__configPath__) { this.features.logging.warn( `Cannot remove config for server '${serverName}': Config not found or missing path` @@ -1164,7 +1175,7 @@ export class McpManager { return } - const unsanitizedName = this.serverNameMapping.get(serverName) || serverName + const unsanitizedName = this.serverNameMapping.get(sanitized) || serverName // Remove from agent config if (unsanitizedName && this.agentConfig) { diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts index 43f68302eb..08f8f1dd5c 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts @@ -113,7 +113,9 @@ describe('OAuthClient getValidAccessToken()', () => { stubFileSystem(cachedToken, cachedReg) - const token = await OAuthClient.getValidAccessToken(new URL('https://api.example.com/mcp')) + const token = await OAuthClient.getValidAccessToken(new URL('https://api.example.com/mcp'), { + interactive: true, + }) expect(token).to.equal('cached_access') expect((http.createServer as any).calledOnce).to.be.true }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts index 86bc7ba027..1e9c8745d3 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts @@ -9,6 +9,7 @@ import * as path from 'path' import { spawn } from 'child_process' import { URL, URLSearchParams } from 'url' import * as http from 'http' +import * as os from 'os' import { Logger, Workspace } from '@aws/language-server-runtimes/server-interface' interface Token { @@ -46,9 +47,9 @@ export class OAuthClient { */ public static async getValidAccessToken( mcpBase: URL, - opts: { interactive?: boolean } = { interactive: true } + opts: { interactive?: boolean } = { interactive: false } ): Promise { - const interactive = opts?.interactive !== false + const interactive = opts?.interactive === true const key = this.computeKey(mcpBase) const regPath = path.join(this.cacheDir, `${key}.registration.json`) const tokPath = path.join(this.cacheDir, `${key}.token.json`) @@ -333,6 +334,7 @@ export class OAuthClient { redirectUri: string, server: http.Server ): Promise { + const DEFAULT_PKCE_TIMEOUT_MS = 20_000 // a) generate PKCE params const verifier = this.b64url(crypto.randomBytes(32)) const challenge = this.b64url(crypto.createHash('sha256').update(verifier).digest()) @@ -353,7 +355,10 @@ export class OAuthClient { const opener = process.platform === 'win32' - ? { cmd: 'cmd', args: ['/c', 'start', authz.toString()] } + ? { + cmd: 'cmd', + args: ['/c', 'start', '', `"${authz.toString().replace(/"/g, '""')}"`], + } : process.platform === 'darwin' ? { cmd: 'open', args: [authz.toString()] } : { cmd: 'xdg-open', args: [authz.toString()] } @@ -361,17 +366,26 @@ export class OAuthClient { void spawn(opener.cmd, opener.args, { detached: true, stdio: 'ignore' }).unref() // c) wait for code on our loopback - const { code, rxState, err } = await new Promise<{ code: string; rxState: string; err?: string }>(resolve => { + const waitForFlow = new Promise<{ code: string; rxState: string; err?: string; errDesc?: string }>(resolve => { server.on('request', (req, res) => { const u = new URL(req.url || '/', redirectUri) const c = u.searchParams.get('code') || '' const s = u.searchParams.get('state') || '' const e = u.searchParams.get('error') || undefined + const ed = u.searchParams.get('error_description') || undefined res.writeHead(200, { 'content-type': 'text/html' }).end('

You may close this tab.

') - resolve({ code: c, rxState: s, err: e }) + resolve({ code: c, rxState: s, err: e, errDesc: ed }) }) }) - if (err) throw new Error(`Authorization error: ${err}`) + const { code, rxState, err, errDesc } = await Promise.race([ + waitForFlow, + new Promise((_, reject) => + setTimeout(() => reject(new Error('authorization_timed_out')), DEFAULT_PKCE_TIMEOUT_MS) + ), + ]) + if (err) { + throw new Error(`Authorization error: ${err}${errDesc ? ` - ${errDesc}` : ''}`) + } if (!code || rxState !== state) throw new Error('Invalid authorization response (state mismatch)') // d) exchange code for token @@ -438,12 +452,7 @@ export class OAuthClient { } /** Directory for caching registration + tokens */ - private static readonly cacheDir = path.join( - process.env.HOME || process.env.USERPROFILE || '.', - '.aws', - 'sso', - 'cache' - ) + private static readonly cacheDir = path.join(os.homedir(), '.aws', 'sso', 'cache') /** * Await server.listen() but reject if it emits 'error' (eg EADDRINUSE), From b99df82826d0ba1a1d52df578cb80674c90505b9 Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Mon, 25 Aug 2025 14:31:41 -0700 Subject: [PATCH 27/74] feat: update MCP manager and utilities (#2158) Co-authored-by: Boyu --- .../agenticChat/tools/mcp/mcpManager.test.ts | 15 ++- .../agenticChat/tools/mcp/mcpManager.ts | 24 ---- .../agenticChat/tools/mcp/mcpUtils.test.ts | 6 + .../agenticChat/tools/mcp/mcpUtils.ts | 114 +++++++----------- 4 files changed, 56 insertions(+), 103 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts index 7b239abad0..456b8934df 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts @@ -368,7 +368,7 @@ describe('removeServer()', () => { expect((mgr as any).clients.has('x')).to.be.false }) - it('removes server from all config files', async () => { + it('removes server from agent config', async () => { const mgr = await McpManager.init([], features) const dummy = new Client({ name: 'c', version: 'v' }) ;(mgr as any).clients.set('x', dummy) @@ -395,14 +395,13 @@ describe('removeServer()', () => { await mgr.removeServer('x') - // Verify that writeFile was called for each config path (2 workspace + 1 global) - expect(writeFileStub.callCount).to.equal(3) + // Verify that saveAgentConfig was called + expect(saveAgentConfigStub.calledOnce).to.be.true + expect((mgr as any).clients.has('x')).to.be.false - // Verify the content of the writes (should have removed the server) - writeFileStub.getCalls().forEach(call => { - const content = JSON.parse(call.args[1]) - expect(content.mcpServers).to.not.have.property('x') - }) + // Verify server was removed from agent config + expect((mgr as any).agentConfig.mcpServers).to.not.have.property('x') + expect((mgr as any).agentConfig.tools).to.not.include('@x') }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index ec7d16d277..b66661c1ea 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -796,30 +796,6 @@ export class McpManager { // Save agent config await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, cfg.__configPath__) - - // Get all config paths and delete the server from each one - const wsUris = this.features.workspace.getAllWorkspaceFolders()?.map(f => f.uri) ?? [] - const wsConfigPaths = getWorkspaceMcpConfigPaths(wsUris) - const globalConfigPath = getGlobalMcpConfigPath(this.features.workspace.fs.getUserHomeDir()) - const allConfigPaths = [...wsConfigPaths, globalConfigPath] - - // Delete the server from all config files - for (const configPath of allConfigPaths) { - try { - await this.mutateConfigFile(configPath, json => { - if (json.mcpServers && json.mcpServers[unsanitizedName]) { - delete json.mcpServers[unsanitizedName] - this.features.logging.info( - `Deleted server '${unsanitizedName}' from config file: ${configPath}` - ) - } - }) - } catch (err) { - this.features.logging.warn( - `Failed to delete server '${unsanitizedName}' from config file ${configPath}: ${err}` - ) - } - } } this.mcpServers.delete(serverName) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts index c50f1d62eb..00ec442517 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts @@ -753,6 +753,12 @@ describe('migrateToAgentConfig', () => { }) it('migrates when no existing configs exist', async () => { + // Create empty MCP config to trigger migration + const mcpDir = path.join(tmpDir, '.aws', 'amazonq') + fs.mkdirSync(mcpDir, { recursive: true }) + const mcpPath = path.join(mcpDir, 'mcp.json') + fs.writeFileSync(mcpPath, JSON.stringify({ mcpServers: {} })) + await migrateToAgentConfig(workspace, logger, mockAgent) // Should create default agent config diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts index ffd2cfb4fc..6c5c8a9998 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts @@ -175,7 +175,9 @@ const DEFAULT_AGENT_RAW = `{ "README.md", ".amazonq/rules/**/*.md" ], - "resources": [] + "resources": [], + "createHooks": [], + "promptHooks": [] }` const DEFAULT_PERSONA_RAW = `{ @@ -840,48 +842,40 @@ async function migrateConfigToAgent( const normalizedPersonaPath = normalizePathFromUri(personaPath, logging) agentPath = normalizePathFromUri(agentPath) - // Check if agent config exists + // Check if config and agent files exist + const configExists = await workspace.fs.exists(normalizedConfigPath).catch(() => false) const agentExists = await workspace.fs.exists(agentPath).catch(() => false) - // Load existing agent config if it exists - let existingAgentConfig: AgentConfig | undefined + // Only migrate if agent file does not exist + // If config exists, migrate from it; if not, create default agent config if (agentExists) { - try { - const raw = (await workspace.fs.readFile(agentPath)).toString().trim() - existingAgentConfig = raw ? JSON.parse(raw) : undefined - } catch (err) { - logging.warn(`Failed to read existing agent config at ${agentPath}: ${err}`) - } + return } // Read MCP server configs directly from file const serverConfigs: Record = {} try { - const configExists = await workspace.fs.exists(normalizedConfigPath) - - if (configExists) { - const raw = (await workspace.fs.readFile(normalizedConfigPath)).toString().trim() - if (raw) { - const config = JSON.parse(raw) - - if (config.mcpServers && typeof config.mcpServers === 'object') { - // Add each server to the serverConfigs - for (const [name, serverConfig] of Object.entries(config.mcpServers)) { - serverConfigs[name] = { - command: (serverConfig as any).command, - args: Array.isArray((serverConfig as any).args) ? (serverConfig as any).args : undefined, - env: typeof (serverConfig as any).env === 'object' ? (serverConfig as any).env : undefined, - initializationTimeout: - typeof (serverConfig as any).initializationTimeout === 'number' - ? (serverConfig as any).initializationTimeout - : undefined, - timeout: - typeof (serverConfig as any).timeout === 'number' - ? (serverConfig as any).timeout - : undefined, - } - logging.info(`Added server ${name} to serverConfigs`) + const raw = (await workspace.fs.readFile(normalizedConfigPath)).toString().trim() + if (raw) { + const config = JSON.parse(raw) + + if (config.mcpServers && typeof config.mcpServers === 'object') { + // Add each server to the serverConfigs + for (const [name, serverConfig] of Object.entries(config.mcpServers)) { + serverConfigs[name] = { + command: (serverConfig as any).command, + args: Array.isArray((serverConfig as any).args) ? (serverConfig as any).args : undefined, + env: typeof (serverConfig as any).env === 'object' ? (serverConfig as any).env : undefined, + initializationTimeout: + typeof (serverConfig as any).initializationTimeout === 'number' + ? (serverConfig as any).initializationTimeout + : undefined, + timeout: + typeof (serverConfig as any).timeout === 'number' + ? (serverConfig as any).timeout + : undefined, } + logging.info(`Added server ${name} to serverConfigs`) } } } @@ -908,46 +902,24 @@ async function migrateConfigToAgent( } // Convert to agent config - const newAgentConfig = convertPersonaToAgent(personaConfig, serverConfigs, agent) - newAgentConfig.includedFiles = ['AmazonQ.md', 'README.md', '.amazonq/rules/**/*.md'] - newAgentConfig.resources = [] // Initialize with empty array - - // Merge with existing config if available - let finalAgentConfig: AgentConfig - if (existingAgentConfig) { - // Keep existing metadata - finalAgentConfig = { - ...existingAgentConfig, - // Merge MCP servers, keeping existing ones if they exist - mcpServers: { - ...newAgentConfig.mcpServers, - ...existingAgentConfig.mcpServers, - }, - // Merge tools lists without duplicates - tools: [...new Set([...existingAgentConfig.tools, ...newAgentConfig.tools])], - allowedTools: [...new Set([...existingAgentConfig.allowedTools, ...newAgentConfig.allowedTools])], - // Merge tool settings, preferring existing ones - toolsSettings: { - ...newAgentConfig.toolsSettings, - ...existingAgentConfig.toolsSettings, - }, - // Keep other properties from existing config - includedFiles: existingAgentConfig.includedFiles || newAgentConfig.includedFiles, - createHooks: existingAgentConfig.createHooks || newAgentConfig.createHooks, - promptHooks: [ - ...new Set([...(existingAgentConfig.promptHooks || []), ...(newAgentConfig.promptHooks || [])]), - ], - resources: [...new Set([...(existingAgentConfig.resources || []), ...(newAgentConfig.resources || [])])], - } - } else { - finalAgentConfig = newAgentConfig - logging.info(`Using new config (no existing config to merge)`) - } + const agentConfig = convertPersonaToAgent(personaConfig, serverConfigs, agent) + + // Parse default values from DEFAULT_AGENT_RAW + const defaultAgent = JSON.parse(DEFAULT_AGENT_RAW) + + // Add complete agent format sections using default values + agentConfig.name = defaultAgent.name + agentConfig.description = defaultAgent.description + agentConfig.version = defaultAgent.version + agentConfig.includedFiles = defaultAgent.includedFiles + agentConfig.resources = defaultAgent.resources + agentConfig.createHooks = defaultAgent.createHooks + agentConfig.promptHooks = defaultAgent.promptHooks // Save agent config try { - await saveAgentConfig(workspace, logging, finalAgentConfig, agentPath) - logging.info(`Successfully ${existingAgentConfig ? 'updated' : 'created'} agent config at ${agentPath}`) + await saveAgentConfig(workspace, logging, agentConfig, agentPath) + logging.info(`Successfully created agent config at ${agentPath}`) } catch (err) { logging.error(`Failed to save agent config to ${agentPath}: ${err}`) throw err From db45d01adba10e8a04d868e1062f899df4f5b7e4 Mon Sep 17 00:00:00 2001 From: Tai Lai Date: Mon, 25 Aug 2025 18:31:23 -0700 Subject: [PATCH 28/74] fix(amazonq): disable typewriter animation (#2160) --- chat-client/package.json | 2 +- chat-client/src/client/mynahUi.ts | 1 + package-lock.json | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/chat-client/package.json b/chat-client/package.json index 59720a0187..e4250d42a1 100644 --- a/chat-client/package.json +++ b/chat-client/package.json @@ -27,7 +27,7 @@ "@aws/chat-client-ui-types": "^0.1.56", "@aws/language-server-runtimes": "^0.2.127", "@aws/language-server-runtimes-types": "^0.1.50", - "@aws/mynah-ui": "^4.36.4" + "@aws/mynah-ui": "^4.36.5" }, "devDependencies": { "@types/jsdom": "^21.1.6", diff --git a/chat-client/src/client/mynahUi.ts b/chat-client/src/client/mynahUi.ts index 527dea06f3..d07d0ab291 100644 --- a/chat-client/src/client/mynahUi.ts +++ b/chat-client/src/client/mynahUi.ts @@ -827,6 +827,7 @@ export const createMynahUi = ( // if we want to max user input as 500000, need to configure the maxUserInput as 500096 maxUserInput: 500096, userInputLengthWarningThreshold: 450000, + disableTypewriterAnimation: true, }, } diff --git a/package-lock.json b/package-lock.json index e65f8e8c96..5fc601a1bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -257,7 +257,7 @@ "@aws/chat-client-ui-types": "^0.1.56", "@aws/language-server-runtimes": "^0.2.127", "@aws/language-server-runtimes-types": "^0.1.50", - "@aws/mynah-ui": "^4.36.4" + "@aws/mynah-ui": "^4.36.5" }, "devDependencies": { "@types/jsdom": "^21.1.6", @@ -4203,9 +4203,9 @@ "link": true }, "node_modules/@aws/mynah-ui": { - "version": "4.36.4", - "resolved": "https://registry.npmjs.org/@aws/mynah-ui/-/mynah-ui-4.36.4.tgz", - "integrity": "sha512-vGW4wlNindpr2Ep9x3iuKbrZTXe5KrE8vWpg15DjkN3qK42KMuMEQ67Pqtfgl5EseNYC1ukZm4HIQIMmt+vevA==", + "version": "4.36.5", + "resolved": "https://registry.npmjs.org/@aws/mynah-ui/-/mynah-ui-4.36.5.tgz", + "integrity": "sha512-HMXqvSpZT84mpY67ChzRDrd73Y9AFZVZ8RcOJ/rNWIXR44uryfNFg2nrvoP4GSn2P+kU8WIPGChHGmyX9N0UgA==", "hasInstallScript": true, "license": "Apache License 2.0", "dependencies": { From 558bc1ac3e43a3d93e4de31031bb54d270eea27a Mon Sep 17 00:00:00 2001 From: manodnyab <66754471+manodnyab@users.noreply.github.com> Date: Tue, 26 Aug 2025 09:03:56 -0700 Subject: [PATCH 29/74] ci: generation of builds action can be triggered manually (#2157) Co-authored-by: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> --- .github/workflows/create-agent-standalone.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-agent-standalone.yml b/.github/workflows/create-agent-standalone.yml index 2807a50aea..f50b5b43b0 100644 --- a/.github/workflows/create-agent-standalone.yml +++ b/.github/workflows/create-agent-standalone.yml @@ -3,10 +3,12 @@ name: Create agent-standalone bundles on: push: branches: [main, feature/*, release/agentic/*] + workflow_dispatch: jobs: build: runs-on: ubuntu-latest + if: github.event_name == 'push' || github.actor_id == github.repository_owner_id steps: - name: Checkout repository From d28df09ae41871430cd53064eac1f3050c95ea84 Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Tue, 26 Aug 2025 10:50:15 -0700 Subject: [PATCH 30/74] fix(amazonq): fix for mcp servers operations to edit server config only (#2165) * fix(amazonq): fix for mcp servers operations to edit server specific config * fix(amazonq): additional mcp server config fixes * fix: resolve test failures * fix: update MCP manager configuration --- .../agenticChat/tools/mcp/mcpManager.test.ts | 36 +++-- .../agenticChat/tools/mcp/mcpManager.ts | 94 +++++++++-- .../agenticChat/tools/mcp/mcpUtils.test.ts | 147 ++++++++++++++++++ .../agenticChat/tools/mcp/mcpUtils.ts | 63 ++++++++ 4 files changed, 306 insertions(+), 34 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts index 456b8934df..0418cea553 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts @@ -239,12 +239,12 @@ describe('callTool()', () => { describe('addServer()', () => { let loadStub: sinon.SinonStub let initOneStub: sinon.SinonStub - let saveAgentConfigStub: sinon.SinonStub + let saveServerSpecificAgentConfigStub: sinon.SinonStub beforeEach(() => { loadStub = stubAgentConfig() initOneStub = stubInitOneServer() - saveAgentConfigStub = sinon.stub(mcpUtils, 'saveAgentConfig').resolves() + saveServerSpecificAgentConfigStub = sinon.stub(mcpUtils, 'saveServerSpecificAgentConfig').resolves() }) afterEach(async () => { @@ -268,7 +268,7 @@ describe('addServer()', () => { await mgr.addServer('newS', newCfg, 'path.json') - expect(saveAgentConfigStub.calledOnce).to.be.true + expect(saveServerSpecificAgentConfigStub.calledOnce).to.be.true expect(initOneStub.calledOnceWith('newS', sinon.match(newCfg))).to.be.true }) @@ -301,14 +301,14 @@ describe('addServer()', () => { await mgr.addServer('httpSrv', httpCfg, 'http.json') - expect(saveAgentConfigStub.calledOnce).to.be.true + expect(saveServerSpecificAgentConfigStub.calledOnce).to.be.true expect(initOneStub.calledOnceWith('httpSrv', sinon.match(httpCfg))).to.be.true }) }) describe('removeServer()', () => { let loadStub: sinon.SinonStub - let saveAgentConfigStub: sinon.SinonStub + let saveServerSpecificAgentConfigStub: sinon.SinonStub let existsStub: sinon.SinonStub let readFileStub: sinon.SinonStub let writeFileStub: sinon.SinonStub @@ -318,7 +318,7 @@ describe('removeServer()', () => { beforeEach(() => { loadStub = stubAgentConfig() - saveAgentConfigStub = sinon.stub(mcpUtils, 'saveAgentConfig').resolves() + saveServerSpecificAgentConfigStub = sinon.stub(mcpUtils, 'saveServerSpecificAgentConfig').resolves() existsStub = sinon.stub(fakeWorkspace.fs, 'exists').resolves(true) readFileStub = sinon .stub(fakeWorkspace.fs, 'readFile') @@ -364,7 +364,7 @@ describe('removeServer()', () => { } await mgr.removeServer('x') - expect(saveAgentConfigStub.calledOnce).to.be.true + expect(saveServerSpecificAgentConfigStub.calledOnce).to.be.true expect((mgr as any).clients.has('x')).to.be.false }) @@ -395,8 +395,8 @@ describe('removeServer()', () => { await mgr.removeServer('x') - // Verify that saveAgentConfig was called - expect(saveAgentConfigStub.calledOnce).to.be.true + // Verify that saveServerSpecificAgentConfig was called + expect(saveServerSpecificAgentConfigStub.calledOnce).to.be.true expect((mgr as any).clients.has('x')).to.be.false // Verify server was removed from agent config @@ -472,11 +472,11 @@ describe('mutateConfigFile()', () => { describe('updateServer()', () => { let loadStub: sinon.SinonStub let initOneStub: sinon.SinonStub - let saveAgentConfigStub: sinon.SinonStub + let saveServerSpecificAgentConfigStub: sinon.SinonStub beforeEach(() => { initOneStub = stubInitOneServer() - saveAgentConfigStub = sinon.stub(mcpUtils, 'saveAgentConfig').resolves() + saveServerSpecificAgentConfigStub = sinon.stub(mcpUtils, 'saveServerSpecificAgentConfig').resolves() }) afterEach(async () => { @@ -519,11 +519,11 @@ describe('updateServer()', () => { const closeStub = sinon.stub(fakeClient, 'close').resolves() initOneStub.resetHistory() - saveAgentConfigStub.resetHistory() + saveServerSpecificAgentConfigStub.resetHistory() await mgr.updateServer('u1', { timeout: 999 }, 'u.json') - expect(saveAgentConfigStub.calledOnce).to.be.true + expect(saveServerSpecificAgentConfigStub.calledOnce).to.be.true expect(closeStub.calledOnce).to.be.true expect(initOneStub.calledOnceWith('u1', sinon.match.has('timeout', 999))).to.be.true }) @@ -559,11 +559,11 @@ describe('updateServer()', () => { const mgr = McpManager.instance initOneStub.resetHistory() - saveAgentConfigStub.resetHistory() + saveServerSpecificAgentConfigStub.resetHistory() await mgr.updateServer('srv', { command: undefined, url: 'https://new.host/mcp' }, 'z.json') - expect(saveAgentConfigStub.calledOnce).to.be.true + expect(saveServerSpecificAgentConfigStub.calledOnce).to.be.true expect(initOneStub.calledOnceWith('srv', sinon.match({ url: 'https://new.host/mcp' }))).to.be.true }) }) @@ -1061,9 +1061,11 @@ describe('listServersAndTools()', () => { describe('updateServerPermission()', () => { let saveAgentConfigStub: sinon.SinonStub + let saveServerSpecificAgentConfigStub: sinon.SinonStub beforeEach(() => { saveAgentConfigStub = sinon.stub(mcpUtils, 'saveAgentConfig').resolves() + saveServerSpecificAgentConfigStub = sinon.stub(mcpUtils, 'saveServerSpecificAgentConfig').resolves() }) afterEach(async () => { @@ -1112,8 +1114,8 @@ describe('updateServerPermission()', () => { __configPath__: '/p', }) - // Verify saveAgentConfig was called - expect(saveAgentConfigStub.calledOnce).to.be.true + // Verify saveServerSpecificAgentConfig was called + expect(saveServerSpecificAgentConfigStub.calledOnce).to.be.true // Verify the tool permission was updated expect(mgr.requiresApproval('srv', 'tool1')).to.be.false diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index b66661c1ea..d0fe8ad9cc 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -26,6 +26,7 @@ import { isEmptyEnv, loadAgentConfig, saveAgentConfig, + saveServerSpecificAgentConfig, sanitizeName, getGlobalAgentConfigPath, getWorkspaceMcpConfigPaths, @@ -730,8 +731,23 @@ export class McpManager { this.agentConfig.tools.push(serverPrefix) } - // Save agent config once with all changes - await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, agentPath) + // Save server-specific changes to agent config + const serverTools = this.agentConfig.tools.filter( + tool => tool === serverPrefix || tool.startsWith(`${serverPrefix}/`) + ) + const serverAllowedTools = this.agentConfig.allowedTools.filter( + tool => tool === serverPrefix || tool.startsWith(`${serverPrefix}/`) + ) + + await saveServerSpecificAgentConfig( + this.features.workspace, + this.features.logging, + serverName, + serverConfig, + serverTools, + serverAllowedTools, + agentPath + ) // Add server tools to tools list after initialization await this.initOneServer(sanitizedName, newCfg, AuthIntent.Interactive) @@ -794,8 +810,16 @@ export class McpManager { return true }) - // Save agent config - await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, cfg.__configPath__) + // Save server removal to agent config + await saveServerSpecificAgentConfig( + this.features.workspace, + this.features.logging, + unsanitizedName, + null, // null indicates server should be removed + [], + [], + cfg.__configPath__ + ) } this.mcpServers.delete(serverName) @@ -853,8 +877,24 @@ export class McpManager { } this.agentConfig.mcpServers[unsanitizedServerName] = updatedConfig - // Save agent config - await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, agentPath) + // Save server-specific changes to agent config + const serverPrefix = `@${unsanitizedServerName}` + const serverTools = this.agentConfig.tools.filter( + tool => tool === serverPrefix || tool.startsWith(`${serverPrefix}/`) + ) + const serverAllowedTools = this.agentConfig.allowedTools.filter( + tool => tool === serverPrefix || tool.startsWith(`${serverPrefix}/`) + ) + + await saveServerSpecificAgentConfig( + this.features.workspace, + this.features.logging, + unsanitizedServerName, + updatedConfig, + serverTools, + serverAllowedTools, + agentPath + ) } const newCfg: MCPServerConfig = { @@ -1057,6 +1097,12 @@ export class McpManager { } } + // Update mcpServerPermissions map immediately to reflect changes + this.mcpServerPermissions.set(serverName, { + enabled: perm.enabled, + toolPerms: perm.toolPerms || {}, + }) + // Update server enabled/disabled state in agent config if (this.agentConfig.mcpServers[unsanitizedServerName]) { this.agentConfig.mcpServers[unsanitizedServerName].disabled = !perm.enabled @@ -1067,17 +1113,28 @@ export class McpManager { serverConfig.disabled = !perm.enabled } - // Save agent config + // Save only server-specific changes to agent config const agentPath = perm.__configPath__ if (agentPath) { - await saveAgentConfig(this.features.workspace, this.features.logging, this.agentConfig, agentPath) - } + // Collect server-specific tools and allowedTools + const serverPrefix = `@${unsanitizedServerName}` + const serverTools = this.agentConfig.tools.filter( + tool => tool === serverPrefix || tool.startsWith(`${serverPrefix}/`) + ) + const serverAllowedTools = this.agentConfig.allowedTools.filter( + tool => tool === serverPrefix || tool.startsWith(`${serverPrefix}/`) + ) - // Update mcpServerPermissions map - this.mcpServerPermissions.set(serverName, { - enabled: perm.enabled, - toolPerms: perm.toolPerms || {}, - }) + await saveServerSpecificAgentConfig( + this.features.workspace, + this.features.logging, + unsanitizedServerName, + this.agentConfig.mcpServers[unsanitizedServerName], + serverTools, + serverAllowedTools, + agentPath + ) + } // enable/disable server if (this.isServerDisabled(serverName)) { @@ -1184,11 +1241,14 @@ export class McpManager { return true }) - // Save agent config - await saveAgentConfig( + // Save server removal to agent config + await saveServerSpecificAgentConfig( this.features.workspace, this.features.logging, - this.agentConfig, + unsanitizedName, + null, // null indicates server should be removed + [], + [], cfg.__configPath__ ) } diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts index 00ec442517..43843bd110 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts @@ -22,6 +22,7 @@ import { enabledMCP, normalizePathFromUri, saveAgentConfig, + saveServerSpecificAgentConfig, isEmptyEnv, sanitizeName, convertPersonaToAgent, @@ -788,3 +789,149 @@ describe('migrateToAgentConfig', () => { expect(agentConfig.mcpServers).to.have.property('testServer') }) }) +describe('saveServerSpecificAgentConfig', () => { + let tmpDir: string + let workspace: any + let logger: any + + beforeEach(() => { + tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'saveServerSpecificTest-')) + workspace = { + fs: { + exists: (p: string) => Promise.resolve(fs.existsSync(p)), + readFile: (p: string) => Promise.resolve(Buffer.from(fs.readFileSync(p))), + writeFile: (p: string, d: string) => Promise.resolve(fs.writeFileSync(p, d)), + mkdir: (d: string, opts: any) => Promise.resolve(fs.mkdirSync(d, { recursive: opts.recursive })), + }, + } + logger = { warn: () => {}, info: () => {}, error: () => {} } + }) + + afterEach(() => { + fs.rmSync(tmpDir, { recursive: true, force: true }) + }) + + it('creates new config file when it does not exist', async () => { + const configPath = path.join(tmpDir, 'agent-config.json') + const serverConfig = { command: 'test-cmd', args: ['arg1'] } + const serverTools = ['@testServer'] + const serverAllowedTools = ['@testServer/tool1'] + + await saveServerSpecificAgentConfig( + workspace, + logger, + 'testServer', + serverConfig, + serverTools, + serverAllowedTools, + configPath + ) + + expect(fs.existsSync(configPath)).to.be.true + const content = JSON.parse(fs.readFileSync(configPath, 'utf-8')) + expect(content.mcpServers.testServer).to.deep.equal(serverConfig) + expect(content.tools).to.include('@testServer') + expect(content.allowedTools).to.include('@testServer/tool1') + }) + + it('updates existing config file', async () => { + const configPath = path.join(tmpDir, 'agent-config.json') + + // Create existing config + const existingConfig = { + name: 'existing-agent', + version: '1.0.0', + description: 'Existing agent', + mcpServers: { + existingServer: { command: 'existing-cmd' }, + }, + tools: ['fs_read', '@existingServer'], + allowedTools: ['fs_read'], + toolsSettings: {}, + includedFiles: [], + resources: [], + } + fs.writeFileSync(configPath, JSON.stringify(existingConfig)) + + const serverConfig = { command: 'new-cmd', args: ['arg1'] } + const serverTools = ['@newServer'] + const serverAllowedTools = ['@newServer/tool1'] + + await saveServerSpecificAgentConfig( + workspace, + logger, + 'newServer', + serverConfig, + serverTools, + serverAllowedTools, + configPath + ) + + const content = JSON.parse(fs.readFileSync(configPath, 'utf-8')) + expect(content.name).to.equal('existing-agent') + expect(content.mcpServers.existingServer).to.deep.equal({ command: 'existing-cmd' }) + expect(content.mcpServers.newServer).to.deep.equal(serverConfig) + expect(content.tools).to.include('@newServer') + expect(content.allowedTools).to.include('@newServer/tool1') + }) + + it('removes existing server tools before adding new ones', async () => { + const configPath = path.join(tmpDir, 'agent-config.json') + + // Create existing config with server tools + const existingConfig = { + name: 'test-agent', + version: '1.0.0', + description: 'Test agent', + mcpServers: { + testServer: { command: 'old-cmd' }, + }, + tools: ['fs_read', '@testServer', '@testServer/oldTool'], + allowedTools: ['fs_read', '@testServer/oldAllowedTool'], + toolsSettings: {}, + includedFiles: [], + resources: [], + } + fs.writeFileSync(configPath, JSON.stringify(existingConfig)) + + const serverConfig = { command: 'new-cmd' } + const serverTools = ['@testServer'] + const serverAllowedTools = ['@testServer/newTool'] + + await saveServerSpecificAgentConfig( + workspace, + logger, + 'testServer', + serverConfig, + serverTools, + serverAllowedTools, + configPath + ) + + const content = JSON.parse(fs.readFileSync(configPath, 'utf-8')) + expect(content.tools).to.not.include('@testServer/oldTool') + expect(content.allowedTools).to.not.include('@testServer/oldAllowedTool') + expect(content.tools).to.include('@testServer') + expect(content.allowedTools).to.include('@testServer/newTool') + expect(content.tools).to.include('fs_read') + }) + + it('creates parent directories if they do not exist', async () => { + const configPath = path.join(tmpDir, 'nested', 'dir', 'agent-config.json') + const serverConfig = { command: 'test-cmd' } + const serverTools = ['@testServer'] + const serverAllowedTools: string[] = [] + + await saveServerSpecificAgentConfig( + workspace, + logger, + 'testServer', + serverConfig, + serverTools, + serverAllowedTools, + configPath + ) + + expect(fs.existsSync(configPath)).to.be.true + }) +}) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts index 6c5c8a9998..ef56a54d22 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts @@ -943,6 +943,69 @@ export async function saveAgentConfig( } } +/** + * Save only server-specific changes to agent config file + */ +export async function saveServerSpecificAgentConfig( + workspace: Workspace, + logging: Logger, + serverName: string, + serverConfig: any, + serverTools: string[], + serverAllowedTools: string[], + configPath: string +): Promise { + try { + await workspace.fs.mkdir(path.dirname(configPath), { recursive: true }) + + // Read existing config + let existingConfig: AgentConfig + try { + const raw = await workspace.fs.readFile(configPath) + existingConfig = JSON.parse(raw.toString()) + } catch { + // If file doesn't exist, create minimal config + existingConfig = { + name: 'default-agent', + version: '1.0.0', + description: 'Agent configuration', + mcpServers: {}, + tools: [], + allowedTools: [], + toolsSettings: {}, + includedFiles: [], + resources: [], + } + } + + // Remove existing server tools from arrays + const serverPrefix = `@${serverName}` + existingConfig.tools = existingConfig.tools.filter( + tool => tool !== serverPrefix && !tool.startsWith(`${serverPrefix}/`) + ) + existingConfig.allowedTools = existingConfig.allowedTools.filter( + tool => tool !== serverPrefix && !tool.startsWith(`${serverPrefix}/`) + ) + + if (serverConfig === null) { + // Remove server entirely + delete existingConfig.mcpServers[serverName] + } else { + // Update or add server + existingConfig.mcpServers[serverName] = serverConfig + // Add new server tools + existingConfig.tools.push(...serverTools) + existingConfig.allowedTools.push(...serverAllowedTools) + } + + await workspace.fs.writeFile(configPath, JSON.stringify(existingConfig, null, 2)) + logging.info(`Saved server-specific agent config for ${serverName} to ${configPath}`) + } catch (err: any) { + logging.error(`Failed to save server-specific agent config to ${configPath}: ${err.message}`) + throw err + } +} + export const MAX_TOOL_NAME_LENGTH = 64 /** From bb5f4c6c90566be020a21b32f55741d445509029 Mon Sep 17 00:00:00 2001 From: Shruti Sinha <44882001+shruti0085@users.noreply.github.com> Date: Tue, 26 Aug 2025 12:06:46 -0700 Subject: [PATCH 31/74] fix: allow ci to run on release branches (#2159) Currently release/agentic/* branches used in our release process have rules that require CI to be run. However the corresponding workflows do not actually trigger for release branches. This change ensures no manual overrides are required in the release process and CI mapped with the branch actually runs. --- .github/workflows/lsp-ci.yaml | 4 ++-- .github/workflows/npm-packaging.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lsp-ci.yaml b/.github/workflows/lsp-ci.yaml index bda44ec74a..15f87d2428 100644 --- a/.github/workflows/lsp-ci.yaml +++ b/.github/workflows/lsp-ci.yaml @@ -1,9 +1,9 @@ name: Language Server CI on: push: - branches: [main, dev, feature/*] + branches: [main, dev, feature/*, release/agentic/*] pull_request: - branches: [main, dev, feature/*] + branches: [main, dev, feature/*, release/agentic/*] jobs: test: diff --git a/.github/workflows/npm-packaging.yaml b/.github/workflows/npm-packaging.yaml index 724c9a0c05..d4ce77e07c 100644 --- a/.github/workflows/npm-packaging.yaml +++ b/.github/workflows/npm-packaging.yaml @@ -1,9 +1,9 @@ name: NPM Packaging on: push: - branches: [main, dev, feature/*] + branches: [main, dev, feature/*, release/agentic/*] pull_request: - branches: [main, dev, feature/*] + branches: [main, dev, feature/*, release/agentic/*] jobs: build: From 00e11ff48eafaa0baec48177fa4aa6d60048af2f Mon Sep 17 00:00:00 2001 From: Lei Gao <97199248+leigaol@users.noreply.github.com> Date: Tue, 26 Aug 2025 14:07:47 -0700 Subject: [PATCH 32/74] fix: reduce auto trigger frequency for VSC (#2168) * fix: reduce auto trigger frequency for VSC * fix: skip one unit test * fix: skip unit test --------- Co-authored-by: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> --- .../inline-completion/auto-trigger/autoTrigger.test.ts | 2 +- .../inline-completion/auto-trigger/autoTrigger.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.test.ts index 31bc0a224a..6f96c526de 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.test.ts @@ -158,7 +158,7 @@ describe('Auto Trigger', async () => { assert.strictEqual(getAutoTriggerType(createContentChange('line1\nline2')), undefined) }) }) - describe('Right Context should trigger validation', () => { + describe.skip('Right Context should trigger validation', () => { it('should not trigger when there is immediate right context in VSCode', () => { const params = createBasicParams({ fileContext: createBasicFileContext('console.', 'log()'), diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts index d9dd7f16d5..9fb2efab8e 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts @@ -229,7 +229,12 @@ export const autoTrigger = ( const triggerTypeCoefficient = coefficients.triggerTypeCoefficient[triggerType] ?? 0 const osCoefficient = coefficients.osCoefficient[os] ?? 0 - const charCoefficient = coefficients.charCoefficient[char] ?? 0 + let charCoefficient = coefficients.charCoefficient[char] ?? 0 + // this is a temporary change to lower the auto trigger frequency + if (ide === 'VSCODE') { + charCoefficient = 0 + } + const keyWordCoefficient = coefficients.charCoefficient[keyword] ?? 0 const languageCoefficient = coefficients.languageCoefficient[fileContext.programmingLanguage.languageName] ?? 0 From aa87ae2bd95edc1f38bf90f56093c5bf5ff18c53 Mon Sep 17 00:00:00 2001 From: andrewyuq <89420755+andrewyuq@users.noreply.github.com> Date: Tue, 26 Aug 2025 15:51:07 -0700 Subject: [PATCH 33/74] fix(amazonq): dedupe openTabs supplemental contexts (#2172) --- .../supplementalContextUtil/crossFileContextUtil.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts b/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts index ca5bc40642..06bac73d54 100644 --- a/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts +++ b/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts @@ -209,8 +209,17 @@ export async function fetchOpenTabsContext( }) } + // Dedupe code chunks based on their filePath + content unique key + const seen = new Set() + const deduped = supplementalContexts.filter(item => { + const key = `${item.filePath}:${item.content}` + if (seen.has(key)) return false + seen.add(key) + return true + }) + // DO NOT send code chunk with empty content - return supplementalContexts.filter(item => item.content.trim().length !== 0) + return deduped.filter(item => item.content.trim().length !== 0) } function findBestKChunkMatches(chunkInput: Chunk, chunkReferences: Chunk[], k: number): Chunk[] { From d7b184cb12979877722fa0293e9aebec91ff2c18 Mon Sep 17 00:00:00 2001 From: Boyu Date: Tue, 26 Aug 2025 21:34:11 -0700 Subject: [PATCH 34/74] fix: fix pkce windows url path (#2173) --- .../agenticChat/tools/mcp/mcpManager.ts | 6 ++-- .../tools/mcp/mcpOauthClient.test.ts | 11 +++++-- .../agenticChat/tools/mcp/mcpOauthClient.ts | 29 +++++++------------ 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index d0fe8ad9cc..027e349cf5 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -302,7 +302,7 @@ export class McpManager { cfg: MCPServerConfig, authIntent: AuthIntent = AuthIntent.Silent ): Promise { - const DEFAULT_SERVER_INIT_TIMEOUT_MS = 60_000 + const DEFAULT_SERVER_INIT_TIMEOUT_MS = 120_000 this.setState(serverName, McpServerStatus.INITIALIZING, 0) try { @@ -373,7 +373,7 @@ export class McpManager { } if (needsOAuth) { - OAuthClient.initialize(this.features.workspace, this.features.logging) + OAuthClient.initialize(this.features.workspace, this.features.logging, this.features.lsp) try { const bearer = await OAuthClient.getValidAccessToken(base, { interactive: authIntent === AuthIntent.Interactive, @@ -382,7 +382,7 @@ export class McpManager { headers = { ...headers, Authorization: `Bearer ${bearer}` } } else if (authIntent === AuthIntent.Silent) { throw new AgenticChatError( - `MCP: server '${serverName}' requires OAuth. Open "Edit MCP Server" and save to sign in.`, + `Server '${serverName}' requires OAuth. Click on Save to reauthenticate.`, 'MCPServerAuthFailed' ) } diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts index 08f8f1dd5c..ea711319a5 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.test.ts @@ -19,6 +19,12 @@ const fakeLogger = { error: () => {}, } +const fakeLsp = { + window: { + showDocument: sinon.stub().resolves({ success: true }), + }, +} as any + const fakeWorkspace = { fs: { exists: async (_path: string) => false, @@ -93,9 +99,10 @@ describe('OAuthClient getValidAccessToken()', () => { beforeEach(() => { sinon.restore() - OAuthClient.initialize(fakeWorkspace, fakeLogger as any) + OAuthClient.initialize(fakeWorkspace, fakeLogger as any, fakeLsp) sinon.stub(OAuthClient as any, 'computeKey').returns('testkey') stubHttpServer() + ;(fakeLsp.window.showDocument as sinon.SinonStub).resetHistory() }) afterEach(() => sinon.restore()) @@ -117,6 +124,6 @@ describe('OAuthClient getValidAccessToken()', () => { interactive: true, }) expect(token).to.equal('cached_access') - expect((http.createServer as any).calledOnce).to.be.true + expect((fakeLsp.window.showDocument as sinon.SinonStub).called).to.be.false }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts index 1e9c8745d3..2e207c449e 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpOauthClient.ts @@ -10,7 +10,7 @@ import { spawn } from 'child_process' import { URL, URLSearchParams } from 'url' import * as http from 'http' import * as os from 'os' -import { Logger, Workspace } from '@aws/language-server-runtimes/server-interface' +import { Logger, Workspace, Lsp } from '@aws/language-server-runtimes/server-interface' interface Token { access_token: string @@ -35,10 +35,12 @@ interface Registration { export class OAuthClient { private static logger: Logger private static workspace: Workspace + private static lsp: Lsp - public static initialize(ws: Workspace, logger: Logger): void { + public static initialize(ws: Workspace, logger: Logger, lsp: Lsp): void { this.workspace = ws this.logger = logger + this.lsp = lsp } /** @@ -95,10 +97,11 @@ export class OAuthClient { const savedReg = await this.read(regPath) if (savedReg) { const port = Number(new URL(savedReg.redirect_uri).port) + const normalized = `http://127.0.0.1:${port}` server = http.createServer() try { - await this.listen(server, port) - redirectUri = savedReg.redirect_uri + await this.listen(server, port, '127.0.0.1') + redirectUri = normalized this.logger.info(`OAuth: reusing redirect URI ${redirectUri}`) } catch (e: any) { if (e.code === 'EADDRINUSE') { @@ -182,9 +185,9 @@ export class OAuthClient { /** Spin up a one‑time HTTP listener on localhost:randomPort */ private static async buildCallbackServer(): Promise<{ server: http.Server; redirectUri: string }> { const server = http.createServer() - await this.listen(server, 0) + await this.listen(server, 0, '127.0.0.1') const port = (server.address() as any).port as number - return { server, redirectUri: `http://localhost:${port}` } + return { server, redirectUri: `http://127.0.0.1:${port}` } } /** Discover OAuth endpoints by HEAD/WWW‑Authenticate, well‑known, or fallback */ @@ -334,7 +337,7 @@ export class OAuthClient { redirectUri: string, server: http.Server ): Promise { - const DEFAULT_PKCE_TIMEOUT_MS = 20_000 + const DEFAULT_PKCE_TIMEOUT_MS = 90_000 // a) generate PKCE params const verifier = this.b64url(crypto.randomBytes(32)) const challenge = this.b64url(crypto.createHash('sha256').update(verifier).digest()) @@ -353,17 +356,7 @@ export class OAuthClient { state: state, }).toString() - const opener = - process.platform === 'win32' - ? { - cmd: 'cmd', - args: ['/c', 'start', '', `"${authz.toString().replace(/"/g, '""')}"`], - } - : process.platform === 'darwin' - ? { cmd: 'open', args: [authz.toString()] } - : { cmd: 'xdg-open', args: [authz.toString()] } - - void spawn(opener.cmd, opener.args, { detached: true, stdio: 'ignore' }).unref() + await this.lsp.window.showDocument({ uri: authz.toString(), external: true }) // c) wait for code on our loopback const waitForFlow = new Promise<{ code: string; rxState: string; err?: string; errDesc?: string }>(resolve => { From 8600c524877abb459e9338399352446c0dcff6f0 Mon Sep 17 00:00:00 2001 From: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> Date: Wed, 27 Aug 2025 09:14:48 -0700 Subject: [PATCH 35/74] feat: Auto fetch models from listAvailableModels API (#2171) * Updating the model of listAvailableModels (#2064) * fix(amazonq): fix flickering issue for model selection dropdown and agenticCoding toggle (#2065) * fix(amazonq): fix flickering issue for modelId and agenticCoding * fix(amazonq): Fixing flaky tests * feat(amazonq): Fetching models from backend and adding cache implementation. (#2075) * fix: removing and refactoring legacy code before implementing model selection * feat(amazonq): adding cache implementation and fetching models from listAvailableModels api * feat(amazonq): adding selected model in error case * feat(amazonq): adding test cases * fix: addressing comments * fix: fixing test cases and adding modelName to models * fix: minor edits * fix: minor edits * fix: minor modifications in logs * fix: adding default model if api throws any errors * fix: refactoring code * fix: Improve model selection fallback logic when user's preferred model is unavailable (#2089) * fix: if user preferred model does not exist, fall back to default model * fix: minor test changes * fix: to support backward compatibility for vs and eclipse, adding back modelSelection in chat-client (#2095) * fix: check available models from backend before selecting default model from fallback models (#2102) * feat(amazonq): use model display names (#2123) * fix: cached model list should be invalidated on sign out (#2131) * fix: cached model list should be invalidated on sign out * fix test * avoid throwing error * fix: adding default modelId and setting cache ttl to 30 minutes (#2161) * fix: adding defaultmodelId and setting cache ttl to 30 minutes * fix: fixing tests * fix: updating comments * Updating the model of listAvailableModels (#2064) * fix(amazonq): fix flickering issue for model selection dropdown and agenticCoding toggle (#2065) * fix(amazonq): fix flickering issue for modelId and agenticCoding * fix(amazonq): Fixing flaky tests * feat(amazonq): Fetching models from backend and adding cache implementation. (#2075) * fix: removing and refactoring legacy code before implementing model selection * feat(amazonq): adding cache implementation and fetching models from listAvailableModels api * feat(amazonq): adding selected model in error case * feat(amazonq): adding test cases * fix: addressing comments * fix: fixing test cases and adding modelName to models * fix: minor edits * fix: minor edits * fix: minor modifications in logs * fix: adding default model if api throws any errors * fix: refactoring code * fix: Improve model selection fallback logic when user's preferred model is unavailable (#2089) * fix: if user preferred model does not exist, fall back to default model * fix: minor test changes * fix: to support backward compatibility for vs and eclipse, adding back modelSelection in chat-client (#2095) * fix: check available models from backend before selecting default model from fallback models (#2102) * feat(amazonq): use model display names (#2123) * fix: cached model list should be invalidated on sign out (#2131) * fix: cached model list should be invalidated on sign out * fix test * avoid throwing error * fix: adding default modelId and setting cache ttl to 30 minutes (#2161) * fix: adding defaultmodelId and setting cache ttl to 30 minutes * fix: fixing tests * fix: updating comments * fix: lint issue while resolving merge conflicts --------- Co-authored-by: Tai Lai --- chat-client/src/client/chat.ts | 15 - chat-client/src/client/mynahUi.test.ts | 4 +- chat-client/src/client/mynahUi.ts | 23 +- .../src/client/tabs/tabFactory.test.ts | 7 +- chat-client/src/client/tabs/tabFactory.ts | 7 +- .../src/client/texts/modelSelection.test.ts | 51 +-- .../src/client/texts/modelSelection.ts | 14 +- .../sigv4/codewhisperersigv4client.d.ts | 2 +- .../client/token/bearer-token-service.json | 15 + .../token/codewhispererbearertokenclient.d.ts | 10 + .../agenticChat/agenticChatController.test.ts | 330 +++++++++++------- .../agenticChat/agenticChatController.ts | 163 ++++++--- .../constants/modelSelection.test.ts | 58 +-- .../agenticChat/constants/modelSelection.ts | 19 +- .../agenticChat/tools/chatDb/chatDb.test.ts | 69 +++- .../agenticChat/tools/chatDb/chatDb.ts | 51 ++- .../agenticChat/tools/chatDb/util.ts | 12 + .../utils/agenticChatControllerHelper.ts | 16 - .../AmazonQTokenServiceManager.ts | 5 + .../src/shared/codeWhispererService.ts | 7 + .../src/shared/constants.ts | 2 + 21 files changed, 555 insertions(+), 325 deletions(-) delete mode 100644 server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/agenticChatControllerHelper.ts diff --git a/chat-client/src/client/chat.ts b/chat-client/src/client/chat.ts index d090a33f70..58519d96ef 100644 --- a/chat-client/src/client/chat.ts +++ b/chat-client/src/client/chat.ts @@ -116,7 +116,6 @@ import { InboundChatApi, createMynahUi } from './mynahUi' import { TabFactory } from './tabs/tabFactory' import { ChatClientAdapter } from '../contracts/chatClientAdapter' import { toMynahContextCommand, toMynahIcon } from './utils' -import { modelSelectionForRegion } from './texts/modelSelection' const getDefaultTabConfig = (agenticMode?: boolean) => { return { @@ -264,20 +263,6 @@ export const createChat = ( return option }), }) - } else if (message.params.region) { - // TODO: This can be removed after all clients support aws/chat/listAvailableModels - // get all tabs and update region - const allExistingTabs: MynahUITabStoreModel = mynahUi.getAllTabs() - for (const tabId in allExistingTabs) { - const options = mynahUi.getTabData(tabId).getStore()?.promptInputOptions - mynahUi.updateStore(tabId, { - promptInputOptions: options?.map(option => - option.id === 'model-selection' - ? modelSelectionForRegion[message.params.region] - : option - ), - }) - } } else { tabFactory.setInfoMessages((message.params as ChatOptionsUpdateParams).chatNotifications) } diff --git a/chat-client/src/client/mynahUi.test.ts b/chat-client/src/client/mynahUi.test.ts index 31e64f0e76..727805ebbc 100644 --- a/chat-client/src/client/mynahUi.test.ts +++ b/chat-client/src/client/mynahUi.test.ts @@ -260,7 +260,8 @@ describe('MynahUI', () => { sinon.assert.calledThrice(updateStoreSpy) }) - it('should create a new tab if current tab is loading', () => { + it('should create a new tab if current tab is loading', function (done) { + this.timeout(8000) // clear create tab stub since set up process calls it twice createTabStub.resetHistory() getAllTabsStub.returns({ 'tab-1': { store: { loadingChat: true } } }) @@ -274,6 +275,7 @@ describe('MynahUI', () => { sinon.assert.calledOnceWithExactly(createTabStub, false) sinon.assert.calledThrice(updateStoreSpy) + done() }) it('should not create a new tab if one exists already', () => { diff --git a/chat-client/src/client/mynahUi.ts b/chat-client/src/client/mynahUi.ts index d07d0ab291..15cbeae7ff 100644 --- a/chat-client/src/client/mynahUi.ts +++ b/chat-client/src/client/mynahUi.ts @@ -151,11 +151,20 @@ export const handlePromptInputChange = (mynahUi: MynahUI, tabId: string, options } } + const updatedPromptInputOptions = promptInputOptions?.map(option => { + option.value = optionsValues[option.id] + return option + }) + mynahUi.updateStore(tabId, { - promptInputOptions: promptInputOptions?.map(option => { - option.value = optionsValues[option.id] - return option - }), + promptInputOptions: updatedPromptInputOptions, + }) + + // Store the updated values in tab defaults for new tabs + mynahUi.updateTabDefaults({ + store: { + promptInputOptions: updatedPromptInputOptions, + }, }) } @@ -414,6 +423,12 @@ export const createMynahUi = ( } const tabStore = mynahUi.getTabData(tabId).getStore() + const storedPromptInputOptions = mynahUi.getTabDefaults().store?.promptInputOptions + + // Retrieve stored model selection and pair programming mode from defaults + if (storedPromptInputOptions) { + defaultTabConfig.promptInputOptions = storedPromptInputOptions + } // Tabs can be opened through different methods, including server-initiated 'openTab' requests. // The 'openTab' request is specifically used for loading historical chat sessions with pre-existing messages. diff --git a/chat-client/src/client/tabs/tabFactory.test.ts b/chat-client/src/client/tabs/tabFactory.test.ts index c398c709eb..815e81a22e 100644 --- a/chat-client/src/client/tabs/tabFactory.test.ts +++ b/chat-client/src/client/tabs/tabFactory.test.ts @@ -2,7 +2,7 @@ import { ChatHistory } from '../features/history' import { TabFactory } from './tabFactory' import * as assert from 'assert' import { pairProgrammingPromptInput } from '../texts/pairProgramming' -import { modelSelectionForRegion } from '../texts/modelSelection' +import { modelSelection } from '../texts/modelSelection' describe('tabFactory', () => { describe('getDefaultTabData', () => { @@ -92,10 +92,7 @@ describe('tabFactory', () => { const result = tabFactory.createTab(false) - assert.deepStrictEqual(result.promptInputOptions, [ - pairProgrammingPromptInput, - modelSelectionForRegion['us-east-1'], - ]) + assert.deepStrictEqual(result.promptInputOptions, [pairProgrammingPromptInput, modelSelection]) }) it('should not include model selection when only agentic mode is enabled', () => { diff --git a/chat-client/src/client/tabs/tabFactory.ts b/chat-client/src/client/tabs/tabFactory.ts index 3a6012471a..6df349896c 100644 --- a/chat-client/src/client/tabs/tabFactory.ts +++ b/chat-client/src/client/tabs/tabFactory.ts @@ -11,7 +11,7 @@ import { disclaimerCard } from '../texts/disclaimer' import { ChatMessage } from '@aws/language-server-runtimes-types' import { ChatHistory } from '../features/history' import { pairProgrammingPromptInput, programmerModeCard } from '../texts/pairProgramming' -import { modelSelectionForRegion } from '../texts/modelSelection' +import { modelSelection } from '../texts/modelSelection' export type DefaultTabData = MynahUIDataModel @@ -52,10 +52,7 @@ export class TabFactory { ...this.getDefaultTabData(), ...(disclaimerCardActive ? { promptInputStickyCard: disclaimerCard } : {}), promptInputOptions: this.agenticMode - ? [ - pairProgrammingPromptInput, - ...(this.modelSelectionEnabled ? [modelSelectionForRegion['us-east-1']] : []), - ] + ? [pairProgrammingPromptInput, ...(this.modelSelectionEnabled ? [modelSelection] : [])] : [], cancelButtonWhenLoading: this.agenticMode, // supported for agentic chat only } diff --git a/chat-client/src/client/texts/modelSelection.test.ts b/chat-client/src/client/texts/modelSelection.test.ts index c36dfad976..abd010436e 100644 --- a/chat-client/src/client/texts/modelSelection.test.ts +++ b/chat-client/src/client/texts/modelSelection.test.ts @@ -1,60 +1,11 @@ import * as assert from 'assert' -import { - BedrockModel, - modelSelectionForRegion, - getModelSelectionChatItem, - modelUnavailableBanner, - modelThrottledBanner, -} from './modelSelection' +import { getModelSelectionChatItem, modelUnavailableBanner, modelThrottledBanner } from './modelSelection' import { ChatItemType } from '@aws/mynah-ui' /** * Tests for modelSelection functionality - * - * Note: Some tests are for deprecated code (marked with 'legacy') that is maintained - * for backward compatibility with older clients. These should be removed once - * all clients have been updated to use the new API (aws/chat/listAvailableModels). */ describe('modelSelection', () => { - describe('BedrockModel enum (legacy)', () => { - it('should have the correct model IDs', () => { - assert.strictEqual(BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0, 'CLAUDE_3_7_SONNET_20250219_V1_0') - assert.strictEqual(BedrockModel.CLAUDE_SONNET_4_20250514_V1_0, 'CLAUDE_SONNET_4_20250514_V1_0') - }) - }) - - describe('modelSelectionForRegion (legacy)', () => { - it('should provide all models for us-east-1 region', () => { - const usEast1ModelSelection = modelSelectionForRegion['us-east-1'] - assert.ok(usEast1ModelSelection, 'usEast1ModelSelection should exist') - assert.ok(usEast1ModelSelection.type === 'select', 'usEast1ModelSelection should be type select') - assert.ok(Array.isArray(usEast1ModelSelection.options), 'options should be an array') - assert.strictEqual(usEast1ModelSelection.options.length, 2, 'should have 2 options') - - const modelIds = usEast1ModelSelection.options.map(option => option.value) - assert.ok(modelIds.includes(BedrockModel.CLAUDE_SONNET_4_20250514_V1_0), 'should include Claude Sonnet 4') - assert.ok( - modelIds.includes(BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0), - 'should include Claude Sonnet 3.7' - ) - }) - - it('should provide all models for eu-central-1 region', () => { - const euCentral1ModelSelection = modelSelectionForRegion['eu-central-1'] - assert.ok(euCentral1ModelSelection, 'euCentral1ModelSelection should exist') - assert.ok(euCentral1ModelSelection.type === 'select', 'euCentral1ModelSelection should be type select') - assert.ok(Array.isArray(euCentral1ModelSelection.options), 'options should be an array') - assert.strictEqual(euCentral1ModelSelection.options.length, 2, 'should have 2 option') - - const modelIds = euCentral1ModelSelection.options.map(option => option.value) - assert.ok(modelIds.includes(BedrockModel.CLAUDE_SONNET_4_20250514_V1_0), 'should include Claude Sonnet 4') - assert.ok( - modelIds.includes(BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0), - 'should include Claude Sonnet 3.7' - ) - }) - }) - describe('getModelSelectionChatItem', () => { it('should return a chat item with the correct model name', () => { const modelName = 'Claude Sonnet 4' diff --git a/chat-client/src/client/texts/modelSelection.ts b/chat-client/src/client/texts/modelSelection.ts index 18df833419..a1d0247875 100644 --- a/chat-client/src/client/texts/modelSelection.ts +++ b/chat-client/src/client/texts/modelSelection.ts @@ -13,7 +13,7 @@ type ModelDetails = { } const modelRecord: Record = { - [BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0]: { label: 'Claude Sonnet 3.7' }, + [BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0]: { label: 'Claude 3.7 Sonnet' }, [BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: { label: 'Claude Sonnet 4' }, } @@ -22,24 +22,16 @@ const modelOptions = Object.entries(modelRecord).map(([value, { label }]) => ({ label, })) -const modelSelection: ChatItemFormItem = { +export const modelSelection: ChatItemFormItem = { type: 'select', id: 'model-selection', - options: modelOptions, mandatory: true, hideMandatoryIcon: true, + options: modelOptions, border: false, autoWidth: true, } -/** - * @deprecated use aws/chat/listAvailableModels server request instead - */ -export const modelSelectionForRegion: Record = { - 'us-east-1': modelSelection, - 'eu-central-1': modelSelection, -} - export const getModelSelectionChatItem = (modelName: string): ChatItem => ({ type: ChatItemType.DIRECTIVE, contentHorizontalAlignment: 'center', diff --git a/server/aws-lsp-codewhisperer/src/client/sigv4/codewhisperersigv4client.d.ts b/server/aws-lsp-codewhisperer/src/client/sigv4/codewhisperersigv4client.d.ts index 308ead42ee..6cb67d3ef8 100644 --- a/server/aws-lsp-codewhisperer/src/client/sigv4/codewhisperersigv4client.d.ts +++ b/server/aws-lsp-codewhisperer/src/client/sigv4/codewhisperersigv4client.d.ts @@ -3,7 +3,7 @@ * THIS FILE IS AUTOGENERATED BY 'generateServiceClient.ts'. * DO NOT EDIT BY HAND. */ - + import {Request} from 'aws-sdk/lib/request'; import {Response} from 'aws-sdk/lib/response'; import {AWSError} from 'aws-sdk/lib/error'; diff --git a/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json b/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json index a5704fca16..7e0533b0f5 100644 --- a/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json +++ b/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json @@ -3622,6 +3622,10 @@ "shape": "Models", "documentation": "

List of available models

" }, + "defaultModel": { + "shape": "Model", + "documentation": "

Default model set by the client

" + }, "nextToken": { "shape": "Base64EncodedPaginationToken", "documentation": "

Token for retrieving the next page of results

" @@ -3955,6 +3959,10 @@ "shape": "ModelId", "documentation": "

Unique identifier for the model

" }, + "modelName": { + "shape": "ModelName", + "documentation": "

User-facing display name

" + }, "description": { "shape": "Description", "documentation": "

Description of the model

" @@ -3972,6 +3980,13 @@ "min": 1, "pattern": "[a-zA-Z0-9_:.-]+" }, + "ModelName": { + "type": "string", + "documentation": "

Identifier for the model Name

", + "max": 1024, + "min": 1, + "pattern": "[a-zA-Z0-9-_.]+" + }, "ModelMetadata": { "type": "structure", "members": { diff --git a/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts b/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts index c885612888..34aa384c14 100644 --- a/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts +++ b/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts @@ -3,6 +3,7 @@ * THIS FILE IS AUTOGENERATED BY 'generateServiceClient.ts'. * DO NOT EDIT BY HAND. */ + import {Request} from 'aws-sdk/lib/request'; import {Response} from 'aws-sdk/lib/response'; import {AWSError} from 'aws-sdk/lib/error'; @@ -1132,6 +1133,10 @@ declare namespace CodeWhispererBearerTokenClient { * List of available models */ models: Models; + /** + * Default model set by the client + */ + defaultModel?: Model; /** * Token for retrieving the next page of results */ @@ -1240,6 +1245,10 @@ declare namespace CodeWhispererBearerTokenClient { * Unique identifier for the model */ modelId: ModelId; + /** + * User-facing display name + */ + modelName?: ModelName; /** * Description of the model */ @@ -1250,6 +1259,7 @@ declare namespace CodeWhispererBearerTokenClient { modelMetadata?: ModelMetadata; } export type ModelId = string; + export type ModelName = string; export interface ModelMetadata { /** * Maximum number of input tokens the model can process diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts index a307ce3fc6..c1842a6008 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts @@ -32,6 +32,7 @@ import { InlineChatResult, CancellationTokenSource, ContextCommand, + ChatUpdateParams, } from '@aws/language-server-runtimes/server-interface' import { TestFeatures } from '@aws/language-server-runtimes/testing' import * as assert from 'assert' @@ -56,7 +57,7 @@ import { LocalProjectContextController } from '../../shared/localProjectContextC import { CancellationError } from '@aws/lsp-core' import { ToolApprovalException } from './tools/toolShared' import * as constants from './constants/constants' -import { GENERATE_ASSISTANT_RESPONSE_INPUT_LIMIT, GENERIC_ERROR_MS } from './constants/constants' +import { DEFAULT_MODEL_ID, GENERATE_ASSISTANT_RESPONSE_INPUT_LIMIT, GENERIC_ERROR_MS } from './constants/constants' import { MISSING_BEARER_TOKEN_ERROR } from '../../shared/constants' import { AmazonQError, @@ -368,17 +369,6 @@ describe('AgenticChatController', () => { sinon.assert.calledWithExactly(activeTabSpy.set, mockTabId) }) - it('onTabAdd updates model ID in chat options and session', () => { - const modelId = 'test-model-id' - sinon.stub(ChatDatabase.prototype, 'getModelId').returns(modelId) - chatController.onTabAdd({ tabId: mockTabId }) - - sinon.assert.calledWithExactly(testFeatures.chat.chatOptionsUpdate, { modelId, tabId: mockTabId }) - - const session = chatSessionManagementService.getSession(mockTabId).data - assert.strictEqual(session!.modelId, modelId) - }) - it('onTabChange sets active tab id in telemetryController and emits metrics', () => { chatController.onTabChange({ tabId: mockTabId }) @@ -3003,153 +2993,251 @@ ${' '.repeat(8)}} }) describe('onListAvailableModels', () => { - let tokenServiceManagerStub: sinon.SinonStub + let isCachedModelsValidStub: sinon.SinonStub + let getCachedModelsStub: sinon.SinonStub + let setCachedModelsStub: sinon.SinonStub + let getConnectionTypeStub: sinon.SinonStub + let getActiveProfileArnStub: sinon.SinonStub + let getCodewhispererServiceStub: sinon.SinonStub + let listAvailableModelsStub: sinon.SinonStub beforeEach(() => { - // Create a session with a model ID + // Create a session chatController.onTabAdd({ tabId: mockTabId }) - const session = chatSessionManagementService.getSession(mockTabId).data! - session.modelId = 'CLAUDE_3_7_SONNET_20250219_V1_0' - // Stub the getRegion method - tokenServiceManagerStub = sinon.stub(AmazonQTokenServiceManager.prototype, 'getRegion') + // Stub ChatDatabase methods + isCachedModelsValidStub = sinon.stub(ChatDatabase.prototype, 'isCachedModelsValid') + getCachedModelsStub = sinon.stub(ChatDatabase.prototype, 'getCachedModels') + setCachedModelsStub = sinon.stub(ChatDatabase.prototype, 'setCachedModels') + + // Stub AmazonQTokenServiceManager methods + getConnectionTypeStub = sinon.stub(AmazonQTokenServiceManager.prototype, 'getConnectionType') + getActiveProfileArnStub = sinon.stub(AmazonQTokenServiceManager.prototype, 'getActiveProfileArn') + getCodewhispererServiceStub = sinon.stub(AmazonQTokenServiceManager.prototype, 'getCodewhispererService') + + // Mock listAvailableModels method + listAvailableModelsStub = sinon.stub() + getCodewhispererServiceStub.returns({ + listAvailableModels: listAvailableModelsStub, + }) }) afterEach(() => { - tokenServiceManagerStub.restore() - }) + isCachedModelsValidStub.restore() + getCachedModelsStub.restore() + setCachedModelsStub.restore() + getConnectionTypeStub.restore() + getActiveProfileArnStub.restore() + getCodewhispererServiceStub.restore() + }) + + describe('ListAvailableModels Cache scenarios', () => { + it('should return cached models when cache is valid', async () => { + // Setup valid cache + isCachedModelsValidStub.returns(true) + const cachedData = { + models: [ + { id: 'model1', name: 'Model 1' }, + { id: 'model2', name: 'Model 2' }, + ], + defaultModelId: 'model1', + timestamp: Date.now(), + } + getCachedModelsStub.returns(cachedData) - it('should return all available models for us-east-1 region', async () => { - // Set up the region to be us-east-1 - tokenServiceManagerStub.returns('us-east-1') + const session = chatSessionManagementService.getSession(mockTabId).data! + session.modelId = 'model1' - // Call the method - const params = { tabId: mockTabId } - const result = await chatController.onListAvailableModels(params) + const result = await chatController.onListAvailableModels({ tabId: mockTabId }) - // Verify the result - assert.strictEqual(result.tabId, mockTabId) - assert.strictEqual(result.models.length, 2) - assert.strictEqual(result.selectedModelId, 'CLAUDE_SONNET_4_20250514_V1_0') + // Verify cached data is used + assert.strictEqual(result.tabId, mockTabId) + assert.deepStrictEqual(result.models, cachedData.models) + assert.strictEqual(result.selectedModelId, 'model1') - // Check that the models include both Claude versions - const modelIds = result.models.map(model => model.id) - assert.ok(modelIds.includes('CLAUDE_SONNET_4_20250514_V1_0')) - assert.ok(modelIds.includes('CLAUDE_3_7_SONNET_20250219_V1_0')) - }) + // Verify API was not called + sinon.assert.notCalled(listAvailableModelsStub) + sinon.assert.notCalled(setCachedModelsStub) + }) - it('should return all available models for eu-central-1 region', async () => { - // Set up the region to be eu-central-1 - tokenServiceManagerStub.returns('eu-central-1') + it('should return cached models when cache is valid but has empty models array', async () => { + // Setup cache with empty models + isCachedModelsValidStub.returns(true) + const cachedData = { + models: [], + defaultModelId: undefined, + timestamp: Date.now(), + } + getCachedModelsStub.returns(cachedData) - // Call the method - const params = { tabId: mockTabId } - const result = await chatController.onListAvailableModels(params) + // Should fall back to API call since models array is empty + getConnectionTypeStub.returns('builderId') + getActiveProfileArnStub.returns('test-arn') + listAvailableModelsStub.resolves({ + models: { + model1: { modelId: 'model1' }, + model2: { modelId: 'model2' }, + }, + defaultModel: { modelId: 'model1' }, + }) - // Verify the result - assert.strictEqual(result.tabId, mockTabId) - assert.strictEqual(result.models.length, 2) - assert.strictEqual(result.selectedModelId, 'CLAUDE_SONNET_4_20250514_V1_0') + await chatController.onListAvailableModels({ tabId: mockTabId }) - // Check that the models include both Claude versions - const modelIds = result.models.map(model => model.id) - assert.ok(modelIds.includes('CLAUDE_SONNET_4_20250514_V1_0')) - assert.ok(modelIds.includes('CLAUDE_3_7_SONNET_20250219_V1_0')) - }) + // Verify API was called due to empty cached models + sinon.assert.calledOnce(listAvailableModelsStub) + sinon.assert.calledOnce(setCachedModelsStub) + }) - it('should return all models when region is unknown', async () => { - // Set up the region to be unknown - tokenServiceManagerStub.returns('unknown-region') + it('should return cached models when cache is valid but cachedData is null', async () => { + // Setup cache as valid but returns null + isCachedModelsValidStub.returns(true) + getCachedModelsStub.returns(null) - // Call the method - const params = { tabId: mockTabId } - const result = await chatController.onListAvailableModels(params) + // Should fall back to API call + getConnectionTypeStub.returns('builderId') + getActiveProfileArnStub.returns('test-arn') + listAvailableModelsStub.resolves({ + models: { + model1: { modelId: 'model1' }, + }, + defaultModel: { modelId: 'model1' }, + }) - // Verify the result - assert.strictEqual(result.tabId, mockTabId) - assert.strictEqual(result.models.length, 2) - assert.strictEqual(result.selectedModelId, 'CLAUDE_SONNET_4_20250514_V1_0') + await chatController.onListAvailableModels({ tabId: mockTabId }) + + // Verify API was called + sinon.assert.calledOnce(listAvailableModelsStub) + }) }) - it('should return undefined for selectedModelId when no session data exists', async () => { - // Set up the session to return no session (failure case) - const getSessionStub = sinon.stub(chatSessionManagementService, 'getSession') - getSessionStub.returns({ - data: undefined, - success: false, - error: 'error', + describe('ListAvailableModels API call scenarios', () => { + beforeEach(() => { + // Setup invalid cache to force API call + isCachedModelsValidStub.returns(false) }) - // Call the method - const params = { tabId: 'non-existent-tab' } - const result = await chatController.onListAvailableModels(params) + it('should fetch models from API when cache is invalid', async () => { + getConnectionTypeStub.returns('builderId') + getActiveProfileArnStub.returns('test-profile-arn') - // Verify the result - assert.strictEqual(result.tabId, 'non-existent-tab') - assert.strictEqual(result.models.length, 2) - assert.strictEqual(result.selectedModelId, undefined) + const mockApiResponse = { + models: { + 'claude-3-sonnet': { modelId: 'claude-3-sonnet' }, + 'claude-4-sonnet': { modelId: 'claude-4-sonnet' }, + }, + defaultModel: { modelId: 'claude-3-sonnet' }, + } + listAvailableModelsStub.resolves(mockApiResponse) - getSessionStub.restore() - }) + const result = await chatController.onListAvailableModels({ tabId: mockTabId }) + + // Verify API call was made with correct parameters + sinon.assert.calledOnceWithExactly(listAvailableModelsStub, { + origin: 'IDE', + profileArn: 'test-profile-arn', + }) - it('should fallback to latest available model when saved model is not available in current region', async () => { - // Import the module to stub - const modelSelection = await import('./constants/modelSelection') + // Verify result structure + assert.strictEqual(result.tabId, mockTabId) + assert.strictEqual(result.models.length, 2) + assert.deepStrictEqual(result.models, [ + { id: 'claude-3-sonnet', name: 'claude-3-sonnet' }, + { id: 'claude-4-sonnet', name: 'claude-4-sonnet' }, + ]) - // Create a mock region with only Claude 3.7 - const mockModelOptionsForRegion = { - ...modelSelection.MODEL_OPTIONS_FOR_REGION, - 'test-region-limited': [ - { - id: 'CLAUDE_3_7_SONNET_20250219_V1_0', - name: 'Claude Sonnet 3.7', - }, - ], - } + // Verify cache was updated + sinon.assert.calledOnceWithExactly(setCachedModelsStub, result.models, 'claude-3-sonnet') + }) - // Stub the MODEL_OPTIONS_FOR_REGION - const modelOptionsStub = sinon - .stub(modelSelection, 'MODEL_OPTIONS_FOR_REGION') - .value(mockModelOptionsForRegion) + it('should fall back to hardcoded models when API call fails', async () => { + getConnectionTypeStub.returns('builderId') + listAvailableModelsStub.rejects(new Error('API Error')) - // Set up the region to be the test region (which only has Claude 3.7) - tokenServiceManagerStub.returns('test-region-limited') + const result = await chatController.onListAvailableModels({ tabId: mockTabId }) - // Mock database to return Claude Sonnet 4 (not available in test-region-limited) - const getModelIdStub = sinon.stub(ChatDatabase.prototype, 'getModelId') - getModelIdStub.returns('CLAUDE_SONNET_4_20250514_V1_0') + // Verify fallback to FALLBACK_MODEL_OPTIONS + assert.strictEqual(result.tabId, mockTabId) + assert.strictEqual(result.models.length, 2) // FALLBACK_MODEL_OPTIONS length - // Call the method - const params = { tabId: mockTabId } - const result = await chatController.onListAvailableModels(params) + // Verify cache was not updated due to error + sinon.assert.notCalled(setCachedModelsStub) + }) - // Verify the result falls back to available model - assert.strictEqual(result.tabId, mockTabId) - assert.strictEqual(result.models.length, 1) - assert.strictEqual(result.selectedModelId, 'CLAUDE_3_7_SONNET_20250219_V1_0') + it('should handle API response with no defaultModel', async () => { + getConnectionTypeStub.returns('builderId') - getModelIdStub.restore() - modelOptionsStub.restore() + const mockApiResponse = { + models: { + model1: { modelId: 'model1' }, + }, + defaultModel: undefined, // No default model + } + listAvailableModelsStub.resolves(mockApiResponse) + + const result = await chatController.onListAvailableModels({ tabId: mockTabId }) + + // Verify cache was updated with undefined defaultModelId + sinon.assert.calledOnceWithExactly(setCachedModelsStub, result.models, undefined) + }) }) - it('should use saved model when it is available in current region', async () => { - // Set up the region to be us-east-1 (which has both models) - tokenServiceManagerStub.returns('us-east-1') + describe('Session and model selection scenarios', () => { + beforeEach(() => { + // Setup cache to avoid API calls in these tests + isCachedModelsValidStub.returns(true) + getCachedModelsStub.returns({ + models: [ + { id: 'model1', name: 'Model 1' }, + { id: 'model2', name: 'Model 2' }, + ], + defaultModelId: 'model1', + timestamp: Date.now(), + }) + }) + + it('should return default model when session fails to load', async () => { + const getSessionStub = sinon.stub(chatSessionManagementService, 'getSession') + getSessionStub.returns({ + data: undefined, + success: false, + error: 'Session not found', + }) + + const result = await chatController.onListAvailableModels({ tabId: 'invalid-tab' }) - // Mock database to return Claude 3.7 (available in us-east-1) - const getModelIdStub = sinon.stub(ChatDatabase.prototype, 'getModelId') - getModelIdStub.returns('CLAUDE_3_7_SONNET_20250219_V1_0') + assert.strictEqual(result.tabId, 'invalid-tab') + assert.strictEqual(result.selectedModelId, 'model1') - // Call the method - const params = { tabId: mockTabId } - const result = await chatController.onListAvailableModels(params) + getSessionStub.restore() + }) + + it('should use defaultModelId from cache when session has no modelId', async () => { + const session = chatSessionManagementService.getSession(mockTabId).data! + session.modelId = undefined - // Verify the result uses the saved model - assert.strictEqual(result.tabId, mockTabId) - assert.strictEqual(result.models.length, 2) - assert.strictEqual(result.selectedModelId, 'CLAUDE_3_7_SONNET_20250219_V1_0') + const result = await chatController.onListAvailableModels({ tabId: mockTabId }) - getModelIdStub.restore() + assert.strictEqual(result.selectedModelId, 'model1') // defaultModelId from cache + // Verify session modelId is updated + assert.strictEqual(session.modelId, 'model1') + }) + + it('should fall back to default model when session has no modelId and no defaultModelId in cache', async () => { + getCachedModelsStub.returns({ + models: [{ id: 'model1', name: 'Model 1' }], + defaultModelId: undefined, // No default model + timestamp: Date.now(), + }) + + const session = chatSessionManagementService.getSession(mockTabId).data! + session.modelId = undefined + + const result = await chatController.onListAvailableModels({ tabId: mockTabId }) + + assert.strictEqual(result.selectedModelId, 'claude-sonnet-4') // FALLBACK_MODEL_RECORD[DEFAULT_MODEL_ID].label + // Verify session modelId is updated + assert.strictEqual(session.modelId, 'claude-sonnet-4') + }) }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 991d95a6ad..8cdba3d291 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -24,7 +24,6 @@ import { GREP_SEARCH, FILE_SEARCH, EXECUTE_BASH, - CODE_REVIEW, BUTTON_RUN_SHELL_COMMAND, BUTTON_REJECT_SHELL_COMMAND, BUTTON_REJECT_MCP_TOOL, @@ -67,8 +66,6 @@ import { ListAvailableModelsResult, OpenFileDialogParams, OpenFileDialogResult, -} from '@aws/language-server-runtimes/protocol' -import { ApplyWorkspaceEditParams, ErrorCodes, FeedbackParams, @@ -83,6 +80,7 @@ import { TabBarActionParams, CreatePromptParams, FileClickParams, + Model, } from '@aws/language-server-runtimes/protocol' import { CancellationToken, @@ -222,14 +220,14 @@ import { Message as DbMessage, messageToStreamingMessage, } from './tools/chatDb/util' -import { MODEL_OPTIONS, MODEL_OPTIONS_FOR_REGION } from './constants/modelSelection' +import { FALLBACK_MODEL_OPTIONS, FALLBACK_MODEL_RECORD, BEDROCK_MODEL_TO_MODEL_ID } from './constants/modelSelection' import { DEFAULT_IMAGE_VERIFICATION_OPTIONS, verifyServerImage } from '../../shared/imageVerification' import { sanitize } from '@aws/lsp-core/out/util/path' -import { getLatestAvailableModel } from './utils/agenticChatControllerHelper' import { ActiveUserTracker } from '../../shared/activeUserTracker' import { UserContext } from '../../client/token/codewhispererbearertokenclient' import { CodeWhispererServiceToken } from '../../shared/codeWhispererService' import { DisplayFindings } from './tools/qCodeAnalysis/displayFindings' +import { IDE } from '../../shared/constants' import { IdleWorkspaceManager } from '../workspaceContext/IdleWorkspaceManager' type ChatHandlers = Omit< @@ -352,7 +350,7 @@ export class AgenticChatController implements ChatHandlers { // @ts-ignore this.#features.chat.chatOptionsUpdate({ region }) }) - this.#chatHistoryDb = new ChatDatabase(features) + this.#chatHistoryDb = ChatDatabase.getInstance(features) this.#tabBarController = new TabBarController( features, this.#chatHistoryDb, @@ -681,25 +679,133 @@ export class AgenticChatController implements ChatHandlers { return this.#mcpEventHandler.onMcpServerClick(params) } + /** + * Fetches available models either from cache or API + * If cache is valid (less than 5 minutes old), returns cached models + * If cache is invalid or empty, makes an API call and stores results in cache + * If the API throws errors (e.g., throttling), falls back to default models + */ + async #fetchModelsWithCache(): Promise<{ models: Model[]; defaultModelId?: string; errorFromAPI: boolean }> { + let models: Model[] = [] + let defaultModelId: string | undefined + let errorFromAPI = false + + // Check if cache is valid (less than 5 minutes old) + if (this.#chatHistoryDb.isCachedModelsValid()) { + const cachedData = this.#chatHistoryDb.getCachedModels() + if (cachedData && cachedData.models && cachedData.models.length > 0) { + this.#log('Using cached models, last updated at:', new Date(cachedData.timestamp).toISOString()) + return { + models: cachedData.models, + defaultModelId: cachedData.defaultModelId, + errorFromAPI: false, + } + } + } + + // If cache is invalid or empty, make an API call + this.#log('Cache miss or expired, fetching models from API') + try { + const client = AmazonQTokenServiceManager.getInstance().getCodewhispererService() + const responseResult = await client.listAvailableModels({ + origin: IDE, + profileArn: AmazonQTokenServiceManager.getInstance().getConnectionType() + ? AmazonQTokenServiceManager.getInstance().getActiveProfileArn() + : undefined, + }) + + // Wait for the response to be completed before proceeding + this.#log('Model Response: ', JSON.stringify(responseResult, null, 2)) + models = Object.values(responseResult.models).map(({ modelId, modelName }) => ({ + id: modelId, + name: modelName ?? modelId, + })) + defaultModelId = responseResult.defaultModel?.modelId + + // Cache the models with defaultModelId + this.#chatHistoryDb.setCachedModels(models, defaultModelId) + } catch (err) { + // In case of API throttling or other errors, fall back to hardcoded models + this.#log('Error fetching models from API, using fallback models:', fmtError(err)) + errorFromAPI = true + models = FALLBACK_MODEL_OPTIONS + } + + return { + models, + defaultModelId, + errorFromAPI, + } + } + + /** + * This function handles the model selection process for the chat interface. + * It first attempts to retrieve models from cache or API, then determines the appropriate model to select + * based on the following priority: + * 1. When errors occur or session is invalid: Use the default model as a fallback + * 2. When user has previously selected a model: Use that model (or its mapped version if the model ID has changed) + * 3. When there's a default model from the API: Use the server-recommended default model + * 4. Last resort: Use the newest model defined in modelSelection constants + * + * This ensures users maintain consistent model selection across sessions while also handling + * API failures and model ID migrations gracefully. + */ async onListAvailableModels(params: ListAvailableModelsParams): Promise { - const region = AmazonQTokenServiceManager.getInstance().getRegion() - const models = region && MODEL_OPTIONS_FOR_REGION[region] ? MODEL_OPTIONS_FOR_REGION[region] : MODEL_OPTIONS + // Get models from cache or API + const { models, defaultModelId, errorFromAPI } = await this.#fetchModelsWithCache() + + // Get the first fallback model option as default + const defaultModelOption = FALLBACK_MODEL_OPTIONS[1] + const DEFAULT_MODEL_ID = defaultModelId || defaultModelOption?.id const sessionResult = this.#chatSessionManagementService.getSession(params.tabId) const { data: session, success } = sessionResult - if (!success) { + + // Handle error cases by returning default model + if (!success || errorFromAPI) { return { tabId: params.tabId, models: models, + selectedModelId: DEFAULT_MODEL_ID, } } - const savedModelId = this.#chatHistoryDb.getModelId() - const selectedModelId = - savedModelId && models.some(model => model.id === savedModelId) - ? savedModelId - : getLatestAvailableModel(region).id + // Determine selected model ID based on priority + let selectedModelId: string + let modelId = this.#chatHistoryDb.getModelId() + + // Helper function to get model label from FALLBACK_MODEL_RECORD + const getModelLabel = (modelKey: string) => + FALLBACK_MODEL_RECORD[modelKey as keyof typeof FALLBACK_MODEL_RECORD]?.label || modelKey + + // Helper function to map enum model ID to API model ID + const getMappedModelId = (modelKey: string) => + BEDROCK_MODEL_TO_MODEL_ID[modelKey as keyof typeof BEDROCK_MODEL_TO_MODEL_ID] || modelKey + + // Determine selected model ID based on priority + if (modelId) { + const mappedModelId = getMappedModelId(modelId) + + // Priority 1: Use mapped modelId if it exists in available models from backend + if (models.some(model => model.id === mappedModelId)) { + selectedModelId = mappedModelId + } + // Priority 2: Use mapped version if modelId exists in FALLBACK_MODEL_RECORD and no backend models available + else if (models.length === 0 && modelId in FALLBACK_MODEL_RECORD) { + selectedModelId = getModelLabel(modelId) + } + // Priority 3: Fall back to default or system default + else { + selectedModelId = defaultModelId || getMappedModelId(DEFAULT_MODEL_ID) + } + } else { + // No user-selected model - use API default or system default + selectedModelId = defaultModelId || getMappedModelId(DEFAULT_MODEL_ID) + } + + // Store the selected model in the session session.modelId = selectedModelId + return { tabId: params.tabId, models: models, @@ -3580,25 +3686,6 @@ export class AgenticChatController implements ChatHandlers { onSourceLinkClick() {} - /** - * @deprecated use aws/chat/listAvailableModels server request instead - */ - #legacySetModelId(tabId: string, session: ChatSessionService) { - // Since model selection is mandatory, the only time modelId is not set is when the chat history is empty. - // In that case, we use the default modelId. - let modelId = this.#chatHistoryDb.getModelId() ?? DEFAULT_MODEL_ID - - const region = AmazonQTokenServiceManager.getInstance().getRegion() - if (region === 'eu-central-1') { - // Only 3.7 Sonnet is available in eu-central-1 for now - modelId = 'CLAUDE_3_7_SONNET_20250219_V1_0' - // @ts-ignore - this.#features.chat.chatOptionsUpdate({ region }) - } - this.#features.chat.chatOptionsUpdate({ modelId: modelId, tabId: tabId }) - session.modelId = modelId - } - onTabAdd(params: TabAddParams) { this.#telemetryController.activeTabId = params.tabId @@ -3611,11 +3698,14 @@ export class AgenticChatController implements ChatHandlers { if (!success) { return new ResponseError(ErrorCodes.InternalError, sessionResult.error) } - this.#legacySetModelId(params.tabId, session) // Get the saved pair programming mode from the database or default to true if not found const savedPairProgrammingMode = this.#chatHistoryDb.getPairProgrammingMode() session.pairProgrammingMode = savedPairProgrammingMode !== undefined ? savedPairProgrammingMode : true + if (session) { + // Set the logging object on the session + session.setLogging(this.#features.logging) + } // Update the client with the initial pair programming mode this.#features.chat.chatOptionsUpdate({ @@ -3623,11 +3713,6 @@ export class AgenticChatController implements ChatHandlers { // Type assertion to support pairProgrammingMode ...(session.pairProgrammingMode !== undefined ? { pairProgrammingMode: session.pairProgrammingMode } : {}), } as ChatUpdateParams) - - if (success && session) { - // Set the logging object on the session - session.setLogging(this.#features.logging) - } this.setPaidTierMode(params.tabId) } diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.test.ts index 3fe300d2fd..f037470bec 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.test.ts @@ -1,19 +1,19 @@ import * as assert from 'assert' -import { MODEL_OPTIONS, MODEL_OPTIONS_FOR_REGION } from './modelSelection' +import { FALLBACK_MODEL_OPTIONS } from './modelSelection' describe('modelSelection', () => { describe('modelOptions', () => { it('should contain the correct model options', () => { - assert.ok(Array.isArray(MODEL_OPTIONS), 'modelOptions should be an array') - assert.strictEqual(MODEL_OPTIONS.length, 2, 'modelOptions should have 2 items') + assert.ok(Array.isArray(FALLBACK_MODEL_OPTIONS), 'modelOptions should be an array') + assert.strictEqual(FALLBACK_MODEL_OPTIONS.length, 2, 'modelOptions should have 2 items') // Check that the array contains the expected models - const modelIds = MODEL_OPTIONS.map(model => model.id) - assert.ok(modelIds.includes('CLAUDE_SONNET_4_20250514_V1_0'), 'Should include Claude Sonnet 4') - assert.ok(modelIds.includes('CLAUDE_3_7_SONNET_20250219_V1_0'), 'Should include Claude Sonnet 3.7') + const modelIds = FALLBACK_MODEL_OPTIONS.map(model => model.id) + assert.ok(modelIds.includes('CLAUDE_SONNET_4_20250514_V1_0'), 'Should include claude-sonnet-4') + assert.ok(modelIds.includes('CLAUDE_3_7_SONNET_20250219_V1_0'), 'Should include claude-3.7-sonnet') // Check that each model has the required properties - MODEL_OPTIONS.forEach(model => { + FALLBACK_MODEL_OPTIONS.forEach(model => { assert.ok('id' in model, 'Model should have id property') assert.ok('name' in model, 'Model should have name property') assert.strictEqual(typeof model.id, 'string', 'Model id should be a string') @@ -21,47 +21,11 @@ describe('modelSelection', () => { }) // Check specific model names - const claudeSonnet4 = MODEL_OPTIONS.find(model => model.id === 'CLAUDE_SONNET_4_20250514_V1_0') - const claudeSonnet37 = MODEL_OPTIONS.find(model => model.id === 'CLAUDE_3_7_SONNET_20250219_V1_0') + const claudeSonnet4 = FALLBACK_MODEL_OPTIONS.find(model => model.id === 'CLAUDE_SONNET_4_20250514_V1_0') + const claudeSonnet37 = FALLBACK_MODEL_OPTIONS.find(model => model.id === 'CLAUDE_3_7_SONNET_20250219_V1_0') - assert.strictEqual(claudeSonnet4?.name, 'Claude Sonnet 4', 'Claude Sonnet 4 should have correct name') - assert.strictEqual(claudeSonnet37?.name, 'Claude Sonnet 3.7', 'Claude Sonnet 3.7 should have correct name') - }) - }) - - describe('modelOptionsForRegion', () => { - it('should provide all models for us-east-1 region', () => { - const usEast1Models = MODEL_OPTIONS_FOR_REGION['us-east-1'] - assert.deepStrictEqual(usEast1Models, MODEL_OPTIONS, 'us-east-1 should have all models') - assert.strictEqual(usEast1Models.length, 2, 'us-east-1 should have 2 models') - - const modelIds = usEast1Models.map(model => model.id) - assert.ok(modelIds.includes('CLAUDE_SONNET_4_20250514_V1_0'), 'us-east-1 should include Claude Sonnet 4') - assert.ok( - modelIds.includes('CLAUDE_3_7_SONNET_20250219_V1_0'), - 'us-east-1 should include Claude Sonnet 3.7' - ) - }) - - it('should provide all models for eu-central-1 region', () => { - const euCentral1Models = MODEL_OPTIONS_FOR_REGION['eu-central-1'] - assert.deepStrictEqual(euCentral1Models, MODEL_OPTIONS, 'us-east-1 should have all models') - assert.strictEqual(euCentral1Models.length, 2, 'us-east-1 should have 2 models') - - const modelIds = euCentral1Models.map(model => model.id) - assert.ok(modelIds.includes('CLAUDE_SONNET_4_20250514_V1_0'), 'eu-central-1 should include Claude Sonnet 4') - assert.ok( - modelIds.includes('CLAUDE_3_7_SONNET_20250219_V1_0'), - 'eu-central-1 should include Claude Sonnet 3.7' - ) - }) - - it('should fall back to all models for unknown regions', () => { - // Test with a region that doesn't exist in the modelOptionsForRegion map - const unknownRegionModels = MODEL_OPTIONS_FOR_REGION['unknown-region'] - - // Should be undefined since the region doesn't exist in the map - assert.strictEqual(unknownRegionModels, undefined, 'Unknown region should return undefined') + assert.strictEqual(claudeSonnet4?.name, 'Claude Sonnet 4', 'claude-sonnet-4 should have correct name') + assert.strictEqual(claudeSonnet37?.name, 'Claude 3.7 Sonnet', 'claude-3.7-sonnet should have correct name') }) }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.ts index cbee85f562..46c5446c8c 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/modelSelection.ts @@ -1,5 +1,8 @@ import { ListAvailableModelsResult } from '@aws/language-server-runtimes/protocol' +/** + * @deprecated Do not add new models to the enum. + */ export enum BedrockModel { CLAUDE_SONNET_4_20250514_V1_0 = 'CLAUDE_SONNET_4_20250514_V1_0', CLAUDE_3_7_SONNET_20250219_V1_0 = 'CLAUDE_3_7_SONNET_20250219_V1_0', @@ -9,19 +12,19 @@ type ModelDetails = { label: string } -const MODEL_RECORD: Record = { - [BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0]: { label: 'Claude Sonnet 3.7' }, +export const FALLBACK_MODEL_RECORD: Record = { + [BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0]: { label: 'Claude 3.7 Sonnet' }, [BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: { label: 'Claude Sonnet 4' }, } -export const MODEL_OPTIONS: ListAvailableModelsResult['models'] = Object.entries(MODEL_RECORD).map( +export const BEDROCK_MODEL_TO_MODEL_ID: Record = { + [BedrockModel.CLAUDE_3_7_SONNET_20250219_V1_0]: 'claude-3.7-sonnet', + [BedrockModel.CLAUDE_SONNET_4_20250514_V1_0]: 'claude-sonnet-4', +} + +export const FALLBACK_MODEL_OPTIONS: ListAvailableModelsResult['models'] = Object.entries(FALLBACK_MODEL_RECORD).map( ([value, { label }]) => ({ id: value, name: label, }) ) - -export const MODEL_OPTIONS_FOR_REGION: Record = { - 'us-east-1': MODEL_OPTIONS, - 'eu-central-1': MODEL_OPTIONS, -} diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.test.ts index f4f61f955b..aed5a30643 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.test.ts @@ -57,7 +57,7 @@ describe('ChatDatabase', () => { }, } as unknown as Features - chatDb = new ChatDatabase(mockFeatures) + chatDb = ChatDatabase.getInstance(mockFeatures) }) afterEach(() => { @@ -665,6 +665,73 @@ describe('ChatDatabase', () => { ) }) }) + + describe('Model Cache Management', () => { + beforeEach(async () => { + await chatDb.databaseInitialize(0) + }) + + it('should cache and retrieve models', () => { + const models = [{ id: 'model-1', name: 'Test Model' }] + const defaultModelId = 'model-1' + + chatDb.setCachedModels(models, defaultModelId) + const cached = chatDb.getCachedModels() + + assert.ok(cached, 'Should return cached data') + assert.deepStrictEqual(cached.models, models) + assert.strictEqual(cached.defaultModelId, defaultModelId) + assert.ok(cached.timestamp > 0, 'Should have timestamp') + }) + + it('should validate cache expiry', () => { + const models = [{ id: 'model-1', name: 'Test Model' }] + chatDb.setCachedModels(models) + + // Mock isCachedValid to return false (expired) + const isCachedValidStub = sinon.stub(util, 'isCachedValid').returns(false) + + assert.strictEqual(chatDb.isCachedModelsValid(), false) + + isCachedValidStub.restore() + }) + + it('should clear cached models', () => { + const models = [{ id: 'model-1', name: 'Test Model' }] + chatDb.setCachedModels(models) + + // Verify cache exists + assert.ok(chatDb.getCachedModels(), 'Cache should exist before clearing') + + chatDb.clearCachedModels() + + // Verify cache is cleared + assert.strictEqual(chatDb.getCachedModels(), undefined, 'Cache should be cleared') + }) + + it('should clear model cache via static method when instance exists', () => { + const models = [{ id: 'model-1', name: 'Test Model' }] + chatDb.setCachedModels(models) + + // Verify cache exists + assert.ok(chatDb.getCachedModels(), 'Cache should exist before clearing') + + ChatDatabase.clearModelCache() + + // Verify cache is cleared + assert.strictEqual(chatDb.getCachedModels(), undefined, 'Cache should be cleared via static method') + }) + + it('should handle static clearModelCache when no instance exists', () => { + // Close current instance + chatDb.close() + + // Should not throw when no instance exists + assert.doesNotThrow(() => { + ChatDatabase.clearModelCache() + }, 'Should not throw when no instance exists') + }) + }) }) function uuid(): `${string}-${string}-${string}-${string}-${string}` { throw new Error('Function not implemented.') diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.ts index dfcf21308c..2e4f7a099d 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.ts @@ -24,11 +24,12 @@ import { getMd5WorkspaceId, MessagesWithCharacterCount, estimateCharacterCountFromImageBlock, + isCachedValid, } from './util' import * as crypto from 'crypto' import * as path from 'path' import { Features } from '@aws/language-server-runtimes/server-interface/server' -import { ContextCommand, ConversationItemGroup } from '@aws/language-server-runtimes/protocol' +import { ContextCommand, ConversationItemGroup, Model } from '@aws/language-server-runtimes/protocol' import { ChatMessage, ToolResultStatus } from '@amzn/codewhisperer-streaming' import { ChatItemType } from '@aws/mynah-ui' import { getUserHomeDir } from '@aws/lsp-core/out/util/path' @@ -122,6 +123,12 @@ export class ChatDatabase { return ChatDatabase.#instance } + public static clearModelCache(): void { + if (ChatDatabase.#instance) { + ChatDatabase.#instance.clearCachedModels() + } + } + public close() { this.#db.close() ChatDatabase.#instance = undefined @@ -1084,6 +1091,48 @@ export class ChatDatabase { this.updateSettings({ modelId: modelId === '' ? undefined : modelId }) } + getCachedModels(): { models: Model[]; defaultModelId?: string; timestamp: number } | undefined { + const settings = this.getSettings() + if (settings?.cachedModels && settings?.modelCacheTimestamp) { + return { + models: settings.cachedModels, + defaultModelId: settings.cachedDefaultModelId, + timestamp: settings.modelCacheTimestamp, + } + } + return undefined + } + + setCachedModels(models: Model[], defaultModelId?: string): void { + const currentTimestamp = Date.now() + // Get existing settings to preserve fields like modelId + const existingSettings = this.getSettings() || { modelId: undefined } + this.updateSettings({ + ...existingSettings, + cachedModels: models, + cachedDefaultModelId: defaultModelId, + modelCacheTimestamp: currentTimestamp, + }) + this.#features.logging.log(`Models cached at timestamp: ${currentTimestamp}`) + } + + isCachedModelsValid(): boolean { + const cachedData = this.getCachedModels() + if (!cachedData) return false + return isCachedValid(cachedData.timestamp) + } + + clearCachedModels(): void { + const existingSettings = this.getSettings() || { modelId: undefined } + this.updateSettings({ + ...existingSettings, + cachedModels: undefined, + cachedDefaultModelId: undefined, + modelCacheTimestamp: undefined, + }) + this.#features.logging.log('Model cache cleared') + } + getPairProgrammingMode(): boolean | undefined { const settings = this.getSettings() return settings?.pairProgrammingMode diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.ts index 8f3f46b9f4..77496cd96b 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.ts @@ -10,6 +10,7 @@ import { ConversationItem, ConversationItemGroup, IconType, + Model, ReferenceTrackerInformation, } from '@aws/language-server-runtimes/server-interface' import { @@ -84,6 +85,9 @@ export type Rules = { export type Settings = { modelId: string | undefined pairProgrammingMode?: boolean + cachedModels?: Model[] + cachedDefaultModelId?: string + modelCacheTimestamp?: number } export type Conversation = { @@ -131,6 +135,14 @@ export type MessagesWithCharacterCount = { currentCount: number } +export function isCachedValid(timestamp: number): boolean { + const currentTime = Date.now() + const cacheAge = currentTime - timestamp + const CACHE_TTL = 30 * 60 * 1000 // 30 minutes in milliseconds + + return cacheAge < CACHE_TTL +} + /** * Converts Message to codewhisperer-streaming ChatMessage */ diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/agenticChatControllerHelper.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/agenticChatControllerHelper.ts deleted file mode 100644 index e29c58fff4..0000000000 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/agenticChatControllerHelper.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ListAvailableModelsResult } from '@aws/language-server-runtimes/protocol' -import { MODEL_OPTIONS, MODEL_OPTIONS_FOR_REGION } from '../constants/modelSelection' - -/** - * Gets the latest available model for a region, optionally excluding a specific model - * @param region The AWS region - * @param exclude Optional model ID to exclude - * @returns The latest available model - */ -export function getLatestAvailableModel( - region: string | undefined, - exclude?: string -): ListAvailableModelsResult['models'][0] { - const models = region && MODEL_OPTIONS_FOR_REGION[region] ? MODEL_OPTIONS_FOR_REGION[region] : MODEL_OPTIONS - return [...models].reverse().find(model => model.id !== exclude) ?? models[models.length - 1] -} diff --git a/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/AmazonQTokenServiceManager.ts b/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/AmazonQTokenServiceManager.ts index 5a919c9192..df144e72d6 100644 --- a/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/AmazonQTokenServiceManager.ts +++ b/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/AmazonQTokenServiceManager.ts @@ -33,6 +33,7 @@ import { getAmazonQRegionAndEndpoint } from './configurationUtils' import { getUserAgent } from '../telemetryUtils' import { StreamingClientServiceToken } from '../streamingClientService' import { parse } from '@aws-sdk/util-arn-parser' +import { ChatDatabase } from '../../language-server/agenticChat/tools/chatDb/chatDb' import { ProfileStatusMonitor } from '../../language-server/agenticChat/tools/mcp/profileStatusMonitor' /** @@ -148,6 +149,10 @@ export class AmazonQTokenServiceManager extends BaseAmazonQServiceManager< if (type === 'iam') { return } + + // Clear model cache when credentials are deleted + ChatDatabase.clearModelCache() + this.cancelActiveProfileChangeToken() this.resetCodewhispererService() diff --git a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts index 030f7f7ee4..2304d81eea 100644 --- a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts +++ b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts @@ -615,6 +615,13 @@ export class CodeWhispererServiceToken extends CodeWhispererServiceBase { return this.client.listAvailableProfiles(request).promise() } + /** + * @description Get list of available models + */ + async listAvailableModels(request: CodeWhispererTokenClient.ListAvailableModelsRequest) { + return this.client.listAvailableModels(request).promise() + } + /** * @description send telemetry event to code whisperer data warehouse */ diff --git a/server/aws-lsp-codewhisperer/src/shared/constants.ts b/server/aws-lsp-codewhisperer/src/shared/constants.ts index cd453a11ba..33f61a079f 100644 --- a/server/aws-lsp-codewhisperer/src/shared/constants.ts +++ b/server/aws-lsp-codewhisperer/src/shared/constants.ts @@ -15,6 +15,8 @@ export const AWS_Q_ENDPOINTS = new Map([ export const AWS_Q_REGION_ENV_VAR = 'AWS_Q_REGION' export const AWS_Q_ENDPOINT_URL_ENV_VAR = 'AWS_Q_ENDPOINT_URL' +export const IDE = 'IDE' + export const Q_CONFIGURATION_SECTION = 'aws.q' export const CODE_WHISPERER_CONFIGURATION_SECTION = 'aws.codeWhisperer' From 23f5ec343cb4e0de32926204dbcf99e51af829f9 Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Wed, 27 Aug 2025 10:16:12 -0700 Subject: [PATCH 36/74] fix(amazonq): fix to add mcp server tool error handling and status for card (#2176) Co-authored-by: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> --- .../agenticChat/agenticChatController.ts | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 8cdba3d291..2b41bb938b 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -2192,6 +2192,50 @@ export class AgenticChatController implements ChatHandlers { ) } + // Handle MCP tool failures + const originalNames = McpManager.instance.getOriginalToolNames(toolUse.name) + if (originalNames && toolUse.toolUseId) { + const { toolName } = originalNames + const cachedToolUse = session.toolUseLookup.get(toolUse.toolUseId) + const cachedButtonBlockId = (cachedToolUse as any)?.cachedButtonBlockId + const customerFacingError = getCustomerFacingErrorMessage(err) + + const errorResult = { + type: 'tool', + messageId: toolUse.toolUseId, + summary: { + content: { + header: { + icon: 'tools', + body: `${toolName}`, + status: { + status: 'error', + icon: 'cancel-circle', + text: 'Error', + description: customerFacingError, + }, + }, + }, + collapsedContent: [ + { + header: { body: 'Parameters' }, + body: `\`\`\`json\n${JSON.stringify(toolUse.input, null, 2)}\n\`\`\``, + }, + { + header: { body: 'Error' }, + body: customerFacingError, + }, + ], + }, + } as ChatResult + + if (cachedButtonBlockId !== undefined) { + await chatResultStream.overwriteResultBlock(errorResult, cachedButtonBlockId) + } else { + await chatResultStream.writeResultBlock(errorResult) + } + } + // display fs write failure status in the UX of that file card if ((toolUse.name === FS_WRITE || toolUse.name === FS_REPLACE) && toolUse.toolUseId) { const existingCard = chatResultStream.getMessageBlockId(toolUse.toolUseId) @@ -4568,6 +4612,13 @@ export class AgenticChatController implements ChatHandlers { await chatResultStream.overwriteResultBlock(toolResultCard, cachedButtonBlockId) } else { // Fallback to creating a new card + if (toolResultCard.summary?.content?.header) { + toolResultCard.summary.content.header.status = { + status: 'success', + icon: 'ok', + text: 'Completed', + } + } this.#log(`Warning: No blockId found for tool use ${toolUse.toolUseId}, creating new card`) await chatResultStream.writeResultBlock(toolResultCard) } From 08720c6c3fa83f9b3b6775d4ae4d848ce145b94b Mon Sep 17 00:00:00 2001 From: Lei Gao <97199248+leigaol@users.noreply.github.com> Date: Wed, 27 Aug 2025 11:18:26 -0700 Subject: [PATCH 37/74] revert: reduce auto trigger frequency for VSC (#2168)" (#2177) This reverts commit 00e11ff48eafaa0baec48177fa4aa6d60048af2f. --- .../inline-completion/auto-trigger/autoTrigger.test.ts | 2 +- .../inline-completion/auto-trigger/autoTrigger.ts | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.test.ts index 6f96c526de..31bc0a224a 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.test.ts @@ -158,7 +158,7 @@ describe('Auto Trigger', async () => { assert.strictEqual(getAutoTriggerType(createContentChange('line1\nline2')), undefined) }) }) - describe.skip('Right Context should trigger validation', () => { + describe('Right Context should trigger validation', () => { it('should not trigger when there is immediate right context in VSCode', () => { const params = createBasicParams({ fileContext: createBasicFileContext('console.', 'log()'), diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts index 9fb2efab8e..d9dd7f16d5 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts @@ -229,12 +229,7 @@ export const autoTrigger = ( const triggerTypeCoefficient = coefficients.triggerTypeCoefficient[triggerType] ?? 0 const osCoefficient = coefficients.osCoefficient[os] ?? 0 - let charCoefficient = coefficients.charCoefficient[char] ?? 0 - // this is a temporary change to lower the auto trigger frequency - if (ide === 'VSCODE') { - charCoefficient = 0 - } - + const charCoefficient = coefficients.charCoefficient[char] ?? 0 const keyWordCoefficient = coefficients.charCoefficient[keyword] ?? 0 const languageCoefficient = coefficients.languageCoefficient[fileContext.programmingLanguage.languageName] ?? 0 From 489334466fa084774d6e4737569468d654dc6359 Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Wed, 27 Aug 2025 11:51:53 -0700 Subject: [PATCH 38/74] fix(amazonq): status message update for mcp tool permission accpetance (#2178) --- .../src/language-server/agenticChat/agenticChatController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 2b41bb938b..101674a4d9 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -2607,7 +2607,7 @@ export class AgenticChatController implements ChatHandlers { status: { status: isAccept ? 'success' : 'error', icon: isAccept ? 'ok' : 'cancel', - text: isAccept ? 'Completed' : 'Rejected', + text: isAccept ? 'Accepted' : 'Rejected', }, fileList: undefined, }, From 28567e3ab06a38e13d23df98f0000d62f43293f6 Mon Sep 17 00:00:00 2001 From: Richard Li <742829+rli@users.noreply.github.com> Date: Wed, 27 Aug 2025 14:57:54 -0700 Subject: [PATCH 39/74] deps: update indexing bundle to 042c98e6 (#2174) 042c98e6: optimizing memory usage in Indexing --- .../_bundle-assets/qserver-darwin-arm64.zip | 4 ++-- .../_bundle-assets/qserver-darwin-x64.zip | 4 ++-- .../_bundle-assets/qserver-linux-arm64.zip | 4 ++-- .../_bundle-assets/qserver-linux-x64.zip | 4 ++-- .../_bundle-assets/qserver-win32-x64.zip | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-arm64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-arm64.zip index 24fbdb712c..fdd736d602 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-arm64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-arm64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f651f5364b2417df24d40cbd2d34d69f8b338f3f00aca9c5afd5b4f9ea3d22d -size 96647490 +oid sha256:f4fbd67484ea48363077bbfaa576154196558a4048a862abac84d496fec6b636 +size 96644452 diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-x64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-x64.zip index 14d5e51377..4ef652e06a 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-x64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-x64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:03ef43ac80e2a16e8c842e92a3f3285d5424f2ea99bba167b9cbb9dabb751262 -size 98328127 +oid sha256:2bcfa7697a0ecdc4ff43f84d1a8c8b7840c144080e51b921dd7c5d3478613a82 +size 98325089 diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-arm64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-arm64.zip index af6aae68c3..dacf7cc25a 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-arm64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-arm64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:33bf50f87b67a330b3dc28f9a2fb1678f5c9cd6eb33beb964b6b068790b05b6c -size 102589811 +oid sha256:1f644daa198d026a091ac87a33fa54b7c1faf1e929ce8ef3ab7e25b7510335e7 +size 102586773 diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-x64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-x64.zip index 4923a60a7f..882e8901d3 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-x64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-x64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec71aea47b7cb08c13e94fe4ca284b3656d23266bcdd728a3525abd7939730f0 -size 114552140 +oid sha256:1f6add24d8ae6d1248e3ff8281a8c9e8b402370fd00fcc8bf65c553457715f27 +size 114549102 diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-win32-x64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-win32-x64.zip index fe962b88c0..da87d337a6 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-win32-x64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-win32-x64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd8190acad1f1c2b37a818fcf606cc3d2fa4e1929c82ef967ac360b7345864b4 -size 113890248 +oid sha256:5949d0c3d13d02c31f6bf06ea7a0339a851be1824f90c81d48e66c48c79e4930 +size 113887210 From 5a3f481ebe8c6033e3833abcd81799d26c2aa03e Mon Sep 17 00:00:00 2001 From: BlakeLazarine Date: Wed, 27 Aug 2025 15:50:04 -0700 Subject: [PATCH 40/74] feat(amazonq): emit metric for each issue (#2179) Need to emit a metric for each issue found by the agentic reviewer to reach parity with old behavior. --- .../tools/qCodeAnalysis/codeReview.ts | 22 +++++++++++++++++-- .../tools/qCodeAnalysis/codeReviewTypes.ts | 1 + 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts index b1ef4c3e61..d9fd42d621 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts @@ -439,9 +439,27 @@ export class CodeReview { ) this.logging.info('Findings count grouped by file') - aggregatedCodeScanIssueList.forEach(item => + aggregatedCodeScanIssueList.forEach(item => { this.logging.info(`File path - ${item.filePath} Findings count - ${item.issues.length}`) - ) + item.issues.forEach(issue => + CodeReviewUtils.emitMetric( + { + reason: SuccessMetricName.IssuesDetected, + result: 'Succeeded', + metadata: { + codewhispererCodeScanJobId: jobId, + credentialStartUrl: this.credentialsProvider.getConnectionMetadata()?.sso?.startUrl, + findingId: issue.findingId, + detectorId: issue.detectorId, + ruleId: issue.ruleId, + autoDetected: false, + }, + }, + this.logging, + this.telemetry + ) + ) + }) return { codeReviewId: jobId, diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts index 15aa32a5aa..728c226ae1 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts @@ -10,6 +10,7 @@ export enum FailedMetricName { } export enum SuccessMetricName { CodeScanSuccess = 'codeScanSuccess', + IssuesDetected = 'issuesDetected', } export type ValidateInputAndSetupResult = { From b5f5373a3363c13275cc63799177f2d6358abfe7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 16:20:53 -0700 Subject: [PATCH 41/74] chore(release): release packages from branch main (#2152) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .release-please-manifest.json | 4 ++-- chat-client/CHANGELOG.md | 12 ++++++++++ chat-client/package.json | 2 +- package-lock.json | 4 ++-- server/aws-lsp-codewhisperer/CHANGELOG.md | 28 +++++++++++++++++++++++ server/aws-lsp-codewhisperer/package.json | 2 +- 6 files changed, 46 insertions(+), 6 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 49f118f219..e6baf94939 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,8 +1,8 @@ { - "chat-client": "0.1.33", + "chat-client": "0.1.34", "core/aws-lsp-core": "0.0.14", "server/aws-lsp-antlr4": "0.1.18", - "server/aws-lsp-codewhisperer": "0.0.75", + "server/aws-lsp-codewhisperer": "0.0.76", "server/aws-lsp-json": "0.1.18", "server/aws-lsp-partiql": "0.0.17", "server/aws-lsp-yaml": "0.1.18" diff --git a/chat-client/CHANGELOG.md b/chat-client/CHANGELOG.md index 995ddc8ae6..1c516246c6 100644 --- a/chat-client/CHANGELOG.md +++ b/chat-client/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [0.1.34](https://github.com/aws/language-servers/compare/chat-client/v0.1.33...chat-client/v0.1.34) (2025-08-27) + + +### Features + +* Auto fetch models from listAvailableModels API ([#2171](https://github.com/aws/language-servers/issues/2171)) ([8600c52](https://github.com/aws/language-servers/commit/8600c524877abb459e9338399352446c0dcff6f0)) + + +### Bug Fixes + +* **amazonq:** disable typewriter animation ([#2160](https://github.com/aws/language-servers/issues/2160)) ([db45d01](https://github.com/aws/language-servers/commit/db45d01adba10e8a04d868e1062f899df4f5b7e4)) + ## [0.1.33](https://github.com/aws/language-servers/compare/chat-client/v0.1.32...chat-client/v0.1.33) (2025-08-19) diff --git a/chat-client/package.json b/chat-client/package.json index e4250d42a1..b838360175 100644 --- a/chat-client/package.json +++ b/chat-client/package.json @@ -1,6 +1,6 @@ { "name": "@aws/chat-client", - "version": "0.1.33", + "version": "0.1.34", "description": "AWS Chat Client", "main": "out/index.js", "repository": { diff --git a/package-lock.json b/package-lock.json index 5fc601a1bc..86d2516d9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -251,7 +251,7 @@ }, "chat-client": { "name": "@aws/chat-client", - "version": "0.1.33", + "version": "0.1.34", "license": "Apache-2.0", "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", @@ -28669,7 +28669,7 @@ }, "server/aws-lsp-codewhisperer": { "name": "@aws/lsp-codewhisperer", - "version": "0.0.75", + "version": "0.0.76", "bundleDependencies": [ "@amzn/codewhisperer-streaming", "@amzn/amazon-q-developer-streaming-client" diff --git a/server/aws-lsp-codewhisperer/CHANGELOG.md b/server/aws-lsp-codewhisperer/CHANGELOG.md index a70284a4c2..8bda2b6803 100644 --- a/server/aws-lsp-codewhisperer/CHANGELOG.md +++ b/server/aws-lsp-codewhisperer/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## [0.0.76](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.75...lsp-codewhisperer/v0.0.76) (2025-08-27) + + +### Features + +* add basic OAuth client for remote MCP ([#2136](https://github.com/aws/language-servers/issues/2136)) ([2fb896e](https://github.com/aws/language-servers/commit/2fb896e094de0bc5a1b4881067e7dcceb3826015)) +* **amazonq:** emit metric for each issue ([#2179](https://github.com/aws/language-servers/issues/2179)) ([5a3f481](https://github.com/aws/language-servers/commit/5a3f481ebe8c6033e3833abcd81799d26c2aa03e)) +* Auto fetch models from listAvailableModels API ([#2171](https://github.com/aws/language-servers/issues/2171)) ([8600c52](https://github.com/aws/language-servers/commit/8600c524877abb459e9338399352446c0dcff6f0)) +* disable pkce flow during plugin load ([#2153](https://github.com/aws/language-servers/issues/2153)) ([71b3595](https://github.com/aws/language-servers/commit/71b35952333e7581921644ce40fabbc1e6d3c02f)) +* update MCP manager and utilities ([#2158](https://github.com/aws/language-servers/issues/2158)) ([b99df82](https://github.com/aws/language-servers/commit/b99df82826d0ba1a1d52df578cb80674c90505b9)) + + +### Bug Fixes + +* adding streakTracker to track streakLength across Completions and Edits ([#2147](https://github.com/aws/language-servers/issues/2147)) ([a6c64f2](https://github.com/aws/language-servers/commit/a6c64f2995a17697e3d71d30a1f411f5cf0db279)) +* **amazonq:** dedupe openTabs supplemental contexts ([#2172](https://github.com/aws/language-servers/issues/2172)) ([aa87ae2](https://github.com/aws/language-servers/commit/aa87ae2bd95edc1f38bf90f56093c5bf5ff18c53)) +* **amazonq:** fix for mcp servers operations to edit server config only ([#2165](https://github.com/aws/language-servers/issues/2165)) ([d28df09](https://github.com/aws/language-servers/commit/d28df09ae41871430cd53064eac1f3050c95ea84)) +* **amazonq:** fix to add mcp server tool error handling and status for card ([#2176](https://github.com/aws/language-servers/issues/2176)) ([23f5ec3](https://github.com/aws/language-servers/commit/23f5ec343cb4e0de32926204dbcf99e51af829f9)) +* **amazonq:** status message update for mcp tool permission accpetance ([#2178](https://github.com/aws/language-servers/issues/2178)) ([4893344](https://github.com/aws/language-servers/commit/489334466fa084774d6e4737569468d654dc6359)) +* fix pkce windows url path ([#2173](https://github.com/aws/language-servers/issues/2173)) ([d7b184c](https://github.com/aws/language-servers/commit/d7b184cb12979877722fa0293e9aebec91ff2c18)) +* multiple fixes on auth flow edge cases ([#2155](https://github.com/aws/language-servers/issues/2155)) ([472220a](https://github.com/aws/language-servers/commit/472220a745cff4fe91a2cabae4ae059a164ceddd)) +* reduce auto trigger frequency for VSC ([#2168](https://github.com/aws/language-servers/issues/2168)) ([00e11ff](https://github.com/aws/language-servers/commit/00e11ff48eafaa0baec48177fa4aa6d60048af2f)) + + +### Reverts + +* reduce auto trigger frequency for VSC ([#2168](https://github.com/aws/language-servers/issues/2168))" ([#2177](https://github.com/aws/language-servers/issues/2177)) ([08720c6](https://github.com/aws/language-servers/commit/08720c6c3fa83f9b3b6775d4ae4d848ce145b94b)) + ## [0.0.75](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.74...lsp-codewhisperer/v0.0.75) (2025-08-21) diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index 83ff1cdaee..8702e6fab3 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-codewhisperer", - "version": "0.0.75", + "version": "0.0.76", "description": "CodeWhisperer Language Server", "main": "out/index.js", "repository": { From 8d5b839285bacc21cf9834867f9c6e5b4d9ad471 Mon Sep 17 00:00:00 2001 From: aws-toolkit-automation <> Date: Thu, 28 Aug 2025 04:04:29 +0000 Subject: [PATCH 42/74] chore: bump agentic version: 1.30.0 --- app/aws-lsp-codewhisperer-runtimes/src/version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/aws-lsp-codewhisperer-runtimes/src/version.json b/app/aws-lsp-codewhisperer-runtimes/src/version.json index 93401eb637..e842765e3f 100644 --- a/app/aws-lsp-codewhisperer-runtimes/src/version.json +++ b/app/aws-lsp-codewhisperer-runtimes/src/version.json @@ -1,3 +1,3 @@ { - "agenticChat": "1.29.0" + "agenticChat": "1.30.0" } From ecb86a02e066418a3984f8f02d7c9ea71ecf5f5e Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 27 Aug 2025 21:08:22 -0700 Subject: [PATCH 43/74] chore: empty commit to trigger workflow From baf20b7c4050dd4360ecb97c06d21f6b504836b0 Mon Sep 17 00:00:00 2001 From: Richard Li <742829+rli@users.noreply.github.com> Date: Thu, 28 Aug 2025 10:56:30 -0700 Subject: [PATCH 44/74] revert: deps: update indexing bundle to 042c98e6 (#2174) (#2183) This reverts commit 28567e3ab06a38e13d23df98f0000d62f43293f6. indexing bundle contains a crypto polyfill that is needed for some reason --- .../_bundle-assets/qserver-darwin-arm64.zip | 4 ++-- .../_bundle-assets/qserver-darwin-x64.zip | 4 ++-- .../_bundle-assets/qserver-linux-arm64.zip | 4 ++-- .../_bundle-assets/qserver-linux-x64.zip | 4 ++-- .../_bundle-assets/qserver-win32-x64.zip | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-arm64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-arm64.zip index fdd736d602..24fbdb712c 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-arm64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-arm64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f4fbd67484ea48363077bbfaa576154196558a4048a862abac84d496fec6b636 -size 96644452 +oid sha256:5f651f5364b2417df24d40cbd2d34d69f8b338f3f00aca9c5afd5b4f9ea3d22d +size 96647490 diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-x64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-x64.zip index 4ef652e06a..14d5e51377 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-x64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-darwin-x64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2bcfa7697a0ecdc4ff43f84d1a8c8b7840c144080e51b921dd7c5d3478613a82 -size 98325089 +oid sha256:03ef43ac80e2a16e8c842e92a3f3285d5424f2ea99bba167b9cbb9dabb751262 +size 98328127 diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-arm64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-arm64.zip index dacf7cc25a..af6aae68c3 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-arm64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-arm64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f644daa198d026a091ac87a33fa54b7c1faf1e929ce8ef3ab7e25b7510335e7 -size 102586773 +oid sha256:33bf50f87b67a330b3dc28f9a2fb1678f5c9cd6eb33beb964b6b068790b05b6c +size 102589811 diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-x64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-x64.zip index 882e8901d3..4923a60a7f 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-x64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-linux-x64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f6add24d8ae6d1248e3ff8281a8c9e8b402370fd00fcc8bf65c553457715f27 -size 114549102 +oid sha256:ec71aea47b7cb08c13e94fe4ca284b3656d23266bcdd728a3525abd7939730f0 +size 114552140 diff --git a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-win32-x64.zip b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-win32-x64.zip index da87d337a6..fe962b88c0 100644 --- a/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-win32-x64.zip +++ b/app/aws-lsp-codewhisperer-runtimes/_bundle-assets/qserver-win32-x64.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5949d0c3d13d02c31f6bf06ea7a0339a851be1824f90c81d48e66c48c79e4930 -size 113887210 +oid sha256:cd8190acad1f1c2b37a818fcf606cc3d2fa4e1929c82ef967ac360b7345864b4 +size 113890248 From c53f672b6173ebda530917ccb4e0c2f26f5c8f79 Mon Sep 17 00:00:00 2001 From: tsmithsz <84354541+tsmithsz@users.noreply.github.com> Date: Fri, 29 Aug 2025 10:22:49 -0700 Subject: [PATCH 45/74] fix: emit acceptedLineCount metric and AgenticCodeAccepted interaction type (#2167) --- .../agenticChat/agenticChatController.ts | 13 +++++++++++++ .../chat/telemetry/chatTelemetryController.ts | 4 +++- .../src/shared/telemetry/telemetryService.ts | 1 + .../src/shared/telemetry/types.ts | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 101674a4d9..4a816317d2 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -2076,6 +2076,19 @@ export class AgenticChatController implements ChatHandlers { this.#abTestingAllocation?.experimentName, this.#abTestingAllocation?.userVariation ) + // Emit acceptedLineCount when write tool is used and code changes are accepted + const beforeLines = cachedToolUse?.fileChange?.before?.split('\n').length ?? 0 + const afterLines = doc?.getText()?.split('\n').length ?? 0 + const acceptedLineCount = afterLines - beforeLines + await this.#telemetryController.emitInteractWithMessageMetric( + tabId, + { + cwsprChatMessageId: chatResult.messageId ?? toolUse.toolUseId, + cwsprChatInteractionType: ChatInteractionType.AgenticCodeAccepted, + codewhispererCustomizationArn: this.#customizationArn, + }, + acceptedLineCount + ) await chatResultStream.writeResultBlock(chatResult) break case CodeReview.toolName: diff --git a/server/aws-lsp-codewhisperer/src/language-server/chat/telemetry/chatTelemetryController.ts b/server/aws-lsp-codewhisperer/src/language-server/chat/telemetry/chatTelemetryController.ts index 8e9cb92624..580bcd4be2 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/chat/telemetry/chatTelemetryController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/chat/telemetry/chatTelemetryController.ts @@ -421,10 +421,12 @@ export class ChatTelemetryController { public emitInteractWithMessageMetric( tabId: string, - metric: Omit + metric: Omit, + acceptedLineCount?: number ) { return this.#telemetryService.emitChatInteractWithMessage(metric, { conversationId: this.getConversationId(tabId), + acceptedLineCount, }) } diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts index 6f3ba52028..e5e8cbc471 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts @@ -66,6 +66,7 @@ export class TelemetryService { [ChatInteractionType.Upvote]: 'UPVOTE', [ChatInteractionType.Downvote]: 'DOWNVOTE', [ChatInteractionType.ClickBodyLink]: 'CLICK_BODY_LINK', + [ChatInteractionType.AgenticCodeAccepted]: 'AGENTIC_CODE_ACCEPTED', } constructor( diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetry/types.ts b/server/aws-lsp-codewhisperer/src/shared/telemetry/types.ts index bed82c2939..5bf9fea185 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetry/types.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetry/types.ts @@ -429,6 +429,7 @@ export enum ChatInteractionType { Upvote = 'upvote', Downvote = 'downvote', ClickBodyLink = 'clickBodyLink', + AgenticCodeAccepted = 'agenticCodeAccepted', } export enum ChatHistoryActionType { From 852b21b66f793102c52e35c2baec07a772e5134a Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Fri, 29 Aug 2025 13:28:28 -0700 Subject: [PATCH 46/74] fix: auto trigger should only respect previous decisions in the past 2mins (#2189) --- .../auto-trigger/autoTrigger.ts | 21 ++++++++++++------- .../inline-completion/codeWhispererServer.ts | 8 +++++-- .../session/sessionManager.ts | 7 +++++++ .../src/shared/telemetry/telemetryService.ts | 1 + 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts index d9dd7f16d5..adbbeb4662 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts @@ -177,7 +177,7 @@ type AutoTriggerParams = { char: string triggerType: string // Left as String intentionally to support future and unknown trigger types os: string - previousDecision: string + previousDecision: string | undefined ide: string lineNum: number } @@ -235,12 +235,19 @@ export const autoTrigger = ( const languageCoefficient = coefficients.languageCoefficient[fileContext.programmingLanguage.languageName] ?? 0 let previousDecisionCoefficient = 0 - if (previousDecision === 'Accept') { - previousDecisionCoefficient = coefficients.prevDecisionAcceptCoefficient - } else if (previousDecision === 'Reject') { - previousDecisionCoefficient = coefficients.prevDecisionRejectCoefficient - } else if (previousDecision === 'Discard' || previousDecision === 'Empty') { - previousDecisionCoefficient = coefficients.prevDecisionOtherCoefficient + switch (previousDecision) { + case 'Accept': + previousDecisionCoefficient = coefficients.prevDecisionAcceptCoefficient + break + case 'Reject': + previousDecisionCoefficient = coefficients.prevDecisionRejectCoefficient + break + case 'Discard': + case 'Empty': + previousDecisionCoefficient = coefficients.prevDecisionOtherCoefficient + break + default: + break } const ideCoefficient = coefficients.ideCoefficient[ide] ?? 0 diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts index 330cf54735..c869a534fd 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts @@ -239,7 +239,11 @@ export const CodewhispererServerFactory = : undefined const previousSession = completionSessionManager.getPreviousSession() - const previousDecision = previousSession?.getAggregatedUserTriggerDecision() ?? '' + // Only refer to decisions in the past 2 mins + const previousDecisionForClassifier = + previousSession && performance.now() - previousSession.decisionMadeTimestamp <= 2 * 60 * 1000 + ? previousSession.getAggregatedUserTriggerDecision() + : undefined let ideCategory: string | undefined = '' const initializeParams = lsp.getClientInitializeParams() if (initializeParams !== undefined) { @@ -280,7 +284,7 @@ export const CodewhispererServerFactory = char: triggerCharacters, // Add the character just inserted, if any, before the invication position ide: ideCategory ?? '', os: getNormalizeOsName(), - previousDecision, // The last decision by the user on the previous invocation + previousDecision: previousDecisionForClassifier, // The last decision by the user on the previous invocation triggerType: codewhispererAutoTriggerType, // The 2 trigger types currently influencing the Auto-Trigger are SpecialCharacter and Enter }, logging diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts index 34dbb12538..2a4af79ff6 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/session/sessionManager.ts @@ -60,6 +60,13 @@ export class CodeWhispererSession { suggestions: CachedSuggestion[] = [] suggestionsAfterRightContextMerge: InlineCompletionItemWithReferences[] = [] suggestionsStates = new Map() + private _decisionTimestamp = 0 + get decisionMadeTimestamp() { + return this._decisionTimestamp + } + set decisionMadeTimestamp(time: number) { + this._decisionTimestamp = time + } acceptedSuggestionId?: string = undefined responseContext?: ResponseContext triggerType: CodewhispererTriggerType diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts index e5e8cbc471..b11806a020 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts @@ -200,6 +200,7 @@ export class TelemetryService { removedIdeDiagnostics?: IdeDiagnostic[], streakLength?: number ) { + session.decisionMadeTimestamp = performance.now() if (this.enableTelemetryEventsToDestination) { const data: CodeWhispererUserTriggerDecisionEvent = { codewhispererSessionId: session.codewhispererSessionId || '', From 4fd0def2a7080921683dd712cae9c17a39d4372e Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Fri, 29 Aug 2025 13:28:54 -0700 Subject: [PATCH 47/74] chore: supplemental context log (#2185) --- .../src/shared/codeWhispererService.ts | 2 ++ .../crossFileContextUtil.ts | 10 ++++------ .../supplementalContextUtil.ts | 19 ++++++++++++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts index 2304d81eea..984bb6da76 100644 --- a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts +++ b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts @@ -444,6 +444,8 @@ export class CodeWhispererServiceToken extends CodeWhispererServiceBase { "endpoint": ${this.codeWhispererEndpoint}, "predictionType": ${request.predictionTypes?.toString() ?? 'Not specified (COMPLETIONS)'}, "filename": ${request.fileContext.filename}, + "leftContextLength": ${request.fileContext.leftFileContent.length}, + rightContextLength: ${request.fileContext.rightFileContent.length}, "language": ${request.fileContext.programmingLanguage.languageName}, "supplementalContextCount": ${request.supplementalContexts?.length ?? 0}, "request.nextToken": ${request.nextToken}, diff --git a/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts b/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts index 06bac73d54..91f02b9dc7 100644 --- a/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts +++ b/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts @@ -71,12 +71,13 @@ export async function fetchSupplementalContextForSrc( const supplementalContextConfig = getSupplementalContextConfig(document.languageId) if (supplementalContextConfig === undefined) { - return supplementalContextConfig + return undefined } - //TODO: add logic for other strategies once available + if (supplementalContextConfig === 'codemap') { return await codemapContext(document, position, workspace, cancellationToken, openTabFiles) } + return { supplementalContextItems: [], strategy: 'Empty' } } @@ -264,10 +265,7 @@ function getInputChunk(document: TextDocument, cursorPosition: Position, chunkSi * @returns specifically returning undefined if the langueage is not supported, * otherwise true/false depending on if the language is fully supported or not belonging to the user group */ -function getSupplementalContextConfig( - languageId: TextDocument['languageId'], - _userGroup?: any -): SupplementalContextStrategy | undefined { +function getSupplementalContextConfig(languageId: TextDocument['languageId']): SupplementalContextStrategy | undefined { return isCrossFileSupported(languageId) ? 'codemap' : undefined } diff --git a/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/supplementalContextUtil.ts b/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/supplementalContextUtil.ts index 8a5658188b..8e0902452f 100644 --- a/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/supplementalContextUtil.ts +++ b/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/supplementalContextUtil.ts @@ -91,7 +91,24 @@ export async function fetchSupplementalContext( strategy: supplementalContextValue.strategy, } - return truncateSupplementalContext(resBeforeTruncation) + const r = truncateSupplementalContext(resBeforeTruncation) + + let logstr = `@@supplemental context@@ +\tisUtg: ${r.isUtg}, +\tisProcessTimeout: ${r.isProcessTimeout}, +\tcontents.length: ${r.contentsLength}, +\tlatency: ${r.latency}, +\tstrategy: ${r.strategy}, +` + r.supplementalContextItems.forEach((item, index) => { + logstr += `\tChunk [${index}th]:\n` + logstr += `\t\tPath: ${item.filePath}\n` + logstr += `\t\tLength: ${item.content.length}\n` + logstr += `\t\tScore: ${item.score}\n` + }) + logging.info(logstr) + + return r } else { return undefined } From f4e2e6e885e665834a5d7b7cbb5f4ba4ff9bbb65 Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Fri, 29 Aug 2025 13:29:11 -0700 Subject: [PATCH 48/74] fix: should send classifier score after taking sigmoid (#2188) --- .../inline-completion/auto-trigger/autoTrigger.ts | 8 ++++++-- .../inline-completion/userTriggerDecision.test.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts index adbbeb4662..8990756dbf 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts @@ -229,7 +229,9 @@ export const autoTrigger = ( const triggerTypeCoefficient = coefficients.triggerTypeCoefficient[triggerType] ?? 0 const osCoefficient = coefficients.osCoefficient[os] ?? 0 + const charCoefficient = coefficients.charCoefficient[char] ?? 0 + const keyWordCoefficient = coefficients.charCoefficient[keyword] ?? 0 const languageCoefficient = coefficients.languageCoefficient[fileContext.programmingLanguage.languageName] ?? 0 @@ -281,11 +283,13 @@ export const autoTrigger = ( previousDecisionCoefficient + languageCoefficient + leftContextLengthCoefficient - const shouldTrigger = sigmoid(classifierResult) > TRIGGER_THRESHOLD + + const r = sigmoid(classifierResult) + const shouldTrigger = r > TRIGGER_THRESHOLD return { shouldTrigger, - classifierResult, + classifierResult: r, classifierThreshold: TRIGGER_THRESHOLD, } } diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/userTriggerDecision.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/userTriggerDecision.test.ts index c583815b6b..21c398d56a 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/userTriggerDecision.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/userTriggerDecision.test.ts @@ -145,7 +145,7 @@ describe('Telemetry', () => { }, } const EMPTY_RESULT = { items: [], sessionId: '' } - const classifierResult = getNormalizeOsName() !== 'Linux' ? 0.4114381148145918 : 0.46733811481459187 + const classifierResult = getNormalizeOsName() !== 'Linux' ? 0.6014326616203989 : 0.61475353067264 let features: TestFeatures let server: Server @@ -1251,7 +1251,7 @@ describe('Telemetry', () => { triggerType: 'AutoTrigger', autoTriggerType: 'SpecialCharacters', triggerCharacter: '(', - classifierResult: getNormalizeOsName() === 'Linux' ? 0.30173811481459184 : 0.2458381148145919, + classifierResult: getNormalizeOsName() === 'Linux' ? 0.5748673583477094 : 0.5611518554232429, classifierThreshold: 0.43, language: 'csharp', requestContext: { From b4975409a3ed518550290b72ac310895a293be4b Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Fri, 29 Aug 2025 13:29:44 -0700 Subject: [PATCH 49/74] perf: only process edit requests 1 at a time (#2187) --- .../inline-completion/editCompletionHandler.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts index 193521cce9..550de06708 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/editCompletionHandler.ts @@ -45,6 +45,8 @@ export class EditCompletionHandler { private hasDocumentChangedSinceInvocation: boolean = false private readonly streakTracker: StreakTracker + private isInProgress = false + constructor( readonly logging: Logging, readonly clientMetadata: InitializeParams, @@ -89,6 +91,11 @@ export class EditCompletionHandler { params: InlineCompletionWithReferencesParams, token: CancellationToken ): Promise { + if (this.isInProgress) { + this.logging.info(`editCompletionHandler is WIP, skip the request`) + return EMPTY_RESULT + } + // On every new completion request close current inflight session. const currentSession = this.sessionManager.getCurrentSession() if (currentSession && currentSession.state == 'REQUESTING' && !params.partialResultToken) { @@ -118,6 +125,9 @@ export class EditCompletionHandler { return EMPTY_RESULT } + // Not ideally to rely on a state, should improve it and simply make it a debounced API + this.isInProgress = true + if (params.partialResultToken && currentSession) { // Close ACTIVE session. We shouldn't record Discard trigger decision for trigger with nextToken. if (currentSession && currentSession.state === 'ACTIVE') { @@ -152,10 +162,12 @@ export class EditCompletionHandler { ) } catch (error) { return this.handleSuggestionsErrors(error as Error, currentSession) + } finally { + this.isInProgress = false } } - return new Promise(async resolve => { + return new Promise(async resolve => { this.debounceTimeout = setTimeout(async () => { try { this.isWaiting = true @@ -185,6 +197,8 @@ export class EditCompletionHandler { this.hasDocumentChangedSinceInvocation = false } }, EDIT_DEBOUNCE_INTERVAL_MS) + }).finally(() => { + this.isInProgress = false }) } From 66742adfc44f33efbd8dd33b803000e08241e5ce Mon Sep 17 00:00:00 2001 From: atontb <104926752+atonaamz@users.noreply.github.com> Date: Fri, 29 Aug 2025 14:12:15 -0700 Subject: [PATCH 50/74] feat: passing suggestionTypes and pluginVersion/lspVersion to STE (#2180) --- .../src/client/token/bearer-token-service.json | 13 +++++++++++++ .../token/codewhispererbearertokenclient.d.ts | 6 +++++- .../src/shared/telemetry/telemetryService.test.ts | 1 + .../src/shared/telemetry/telemetryService.ts | 5 ++++- .../src/shared/telemetryUtils.ts | 2 ++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json b/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json index 7e0533b0f5..58ae54fb3c 100644 --- a/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json +++ b/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json @@ -1890,6 +1890,10 @@ "type": "string", "enum": ["BLOCK", "LINE"] }, + "SuggestionType": { + "type": "string", + "enum": ["COMPLETIONS", "EDITS"] + }, "Completions": { "type": "list", "member": { @@ -6299,6 +6303,12 @@ }, "ideVersion": { "shape": "String" + }, + "pluginVersion": { + "shape": "String" + }, + "lspVersion": { + "shape": "String" } } }, @@ -6540,6 +6550,9 @@ }, "streakLength": { "shape": "UserTriggerDecisionEventStreakLengthInteger" + }, + "suggestionType": { + "shape": "SuggestionType" } } }, diff --git a/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts b/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts index 34aa384c14..8e64023479 100644 --- a/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts +++ b/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts @@ -549,6 +549,7 @@ declare namespace CodeWhispererBearerTokenClient { } export type CompletionContentString = string; export type CompletionType = "BLOCK"|"LINE"|string; + export type SuggestionType = "COMPLETIONS"|"EDITS"|string; export type Completions = Completion[]; export interface ConsoleState { region?: String; @@ -2014,6 +2015,8 @@ declare namespace CodeWhispererBearerTokenClient { product: UserContextProductString; clientId?: UUID; ideVersion?: String; + pluginVersion?: String; + lspVersion?: String; } export type UserContextProductString = string; export interface UserInputMessage { @@ -2127,6 +2130,7 @@ declare namespace CodeWhispererBearerTokenClient { addedCharacterCount?: UserTriggerDecisionEventAddedCharacterCountInteger; deletedCharacterCount?: UserTriggerDecisionEventDeletedCharacterCountInteger; streakLength?: UserTriggerDecisionEventStreakLengthInteger; + suggestionType?: SuggestionType; } export type UserTriggerDecisionEventAddedCharacterCountInteger = number; export type UserTriggerDecisionEventDeletedCharacterCountInteger = number; @@ -2182,4 +2186,4 @@ declare namespace CodeWhispererBearerTokenClient { } export = CodeWhispererBearerTokenClient; - \ No newline at end of file + \ No newline at end of file diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.test.ts b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.test.ts index 04d1cf091c..b6a5592f5f 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.test.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.test.ts @@ -277,6 +277,7 @@ describe('TelemetryService', () => { addedIdeDiagnostics: undefined, removedIdeDiagnostics: undefined, streakLength: 0, + suggestionType: 'COMPLETIONS', }, }, optOutPreference: 'OPTIN', diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts index b11806a020..cd2ba18254 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts @@ -283,14 +283,17 @@ export class TelemetryService { addedIdeDiagnostics: addedIdeDiagnostics, removedIdeDiagnostics: removedIdeDiagnostics, streakLength: streakLength ?? 0, + suggestionType: isInlineEdit ? 'EDITS' : 'COMPLETIONS', } this.logging.info(`Invoking SendTelemetryEvent:UserTriggerDecisionEvent with: + "requestId": ${event.requestId} "suggestionState": ${event.suggestionState} "acceptedCharacterCount": ${event.acceptedCharacterCount} "addedCharacterCount": ${event.addedCharacterCount} "deletedCharacterCount": ${event.deletedCharacterCount} "streakLength": ${event.streakLength} - "firstCompletionDisplayLatency: ${event.recommendationLatencyMilliseconds}`) + "firstCompletionDisplayLatency: ${event.recommendationLatencyMilliseconds} + "suggestionType": ${event.suggestionType}`) return this.invokeSendTelemetryEvent({ userTriggerDecisionEvent: event, }) diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.ts b/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.ts index 49020a8822..e682263f7e 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetryUtils.ts @@ -103,6 +103,8 @@ export const makeUserContextObject = ( product: product, clientId: initializeParams.initializationOptions?.aws?.clientInfo?.clientId, ideVersion: `ide=${ideVersion};plugin=${pluginVersion};lsp=${lspVersion}`, + pluginVersion: pluginVersion, + lspVersion: lspVersion, } if (userContext.ideCategory === 'UNKNOWN' || userContext.operatingSystem === 'UNKNOWN') { From ef7d7931954f5083e4a5c358e67c6dc652fa1a40 Mon Sep 17 00:00:00 2001 From: Jason Guo <81202082+jguoamz@users.noreply.github.com> Date: Fri, 29 Aug 2025 16:15:27 -0700 Subject: [PATCH 51/74] fix: compact UI is not updated correctly when multiple nudges are displayed (#2192) --- .../language-server/agenticChat/agenticChatController.ts | 1 + .../src/language-server/chat/chatSessionService.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 4a816317d2..4daa31db64 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -2707,6 +2707,7 @@ export class AgenticChatController implements ChatHandlers { session.setDeferredToolExecution(messageId, deferred.resolve, deferred.reject) this.#log(`Prompting for compaction approval for messageId: ${messageId}`) await deferred.promise + session.removeDeferredToolExecution(messageId) // Note: we want to overwrite the button block because it already exists in the stream. await resultStream.overwriteResultBlock(this.#getUpdateCompactConfirmResult(messageId), promptBlockId) } diff --git a/server/aws-lsp-codewhisperer/src/language-server/chat/chatSessionService.ts b/server/aws-lsp-codewhisperer/src/language-server/chat/chatSessionService.ts index 92c7eb2c33..13c198a949 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/chat/chatSessionService.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/chat/chatSessionService.ts @@ -78,10 +78,17 @@ export class ChatSessionService { public getDeferredToolExecution(messageId: string): DeferredHandler | undefined { return this.#deferredToolExecution[messageId] } + public setDeferredToolExecution(messageId: string, resolve: any, reject: any) { this.#deferredToolExecution[messageId] = { resolve, reject } } + public removeDeferredToolExecution(messageId: string) { + if (messageId in this.#deferredToolExecution) { + delete this.#deferredToolExecution[messageId] + } + } + public getAllDeferredCompactMessageIds(): string[] { return Object.keys(this.#deferredToolExecution).filter(messageId => messageId.endsWith('_compact')) } From fd71e6cf3fc843242936564061061418edf83f56 Mon Sep 17 00:00:00 2001 From: tsmithsz <84354541+tsmithsz@users.noreply.github.com> Date: Tue, 2 Sep 2025 11:23:18 -0700 Subject: [PATCH 52/74] fix: fix calculation for num-lines contributed by the LLM (#2191) --- .../agenticChat/agenticChatController.ts | 5 +- .../utils/fileModificationMetrics.test.ts | 139 ++++++++++++++++++ .../utils/fileModificationMetrics.ts | 58 ++++++++ 3 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/fileModificationMetrics.test.ts create mode 100644 server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/fileModificationMetrics.ts diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 4daa31db64..6c3f07fac2 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -166,6 +166,7 @@ import { FsWrite, FsWriteParams } from './tools/fsWrite' import { ExecuteBash, ExecuteBashParams } from './tools/executeBash' import { ExplanatoryParams, InvokeOutput, ToolApprovalException } from './tools/toolShared' import { validatePathBasic, validatePathExists, validatePaths as validatePathsSync } from './utils/pathValidation' +import { calculateModifiedLines } from './utils/fileModificationMetrics' import { GrepSearch, SanitizedRipgrepOutput } from './tools/grepSearch' import { FileSearch, FileSearchParams, isFileSearchParams } from './tools/fileSearch' import { FsReplace, FsReplaceParams } from './tools/fsReplace' @@ -2077,9 +2078,7 @@ export class AgenticChatController implements ChatHandlers { this.#abTestingAllocation?.userVariation ) // Emit acceptedLineCount when write tool is used and code changes are accepted - const beforeLines = cachedToolUse?.fileChange?.before?.split('\n').length ?? 0 - const afterLines = doc?.getText()?.split('\n').length ?? 0 - const acceptedLineCount = afterLines - beforeLines + const acceptedLineCount = calculateModifiedLines(toolUse, doc?.getText()) await this.#telemetryController.emitInteractWithMessageMetric( tabId, { diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/fileModificationMetrics.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/fileModificationMetrics.test.ts new file mode 100644 index 0000000000..900b569e7e --- /dev/null +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/fileModificationMetrics.test.ts @@ -0,0 +1,139 @@ +import { calculateModifiedLines } from './fileModificationMetrics' +import { ToolUse } from '@amzn/codewhisperer-streaming' +import { FS_WRITE, FS_REPLACE } from '../constants/toolConstants' +import * as assert from 'assert' + +describe('calculateModifiedLines', () => { + describe('FS_WRITE', () => { + it('should count lines for create command', () => { + const toolUse: ToolUse = { + toolUseId: 'test-1', + name: FS_WRITE, + input: { + command: 'create', + path: '/test/file.txt', + fileText: 'line1\nline2\nline3', + }, + } + const afterContent = 'line1\nline2\nline3' + + assert.strictEqual(calculateModifiedLines(toolUse, afterContent), 3) + }) + + it('should count lines for append command', () => { + const toolUse: ToolUse = { + toolUseId: 'test-2', + name: FS_WRITE, + input: { + command: 'append', + path: '/test/file.txt', + fileText: 'line4\nline5', + }, + } + + assert.strictEqual(calculateModifiedLines(toolUse), 2) + }) + + it('should handle empty content', () => { + const toolUse: ToolUse = { + toolUseId: 'test-3', + name: FS_WRITE, + input: { + command: 'create', + path: '/test/file.txt', + fileText: '', + }, + } + + assert.strictEqual(calculateModifiedLines(toolUse, ''), 0) + }) + }) + + describe('FS_REPLACE', () => { + it('should count replaced lines correctly (double counting)', () => { + const toolUse: ToolUse = { + toolUseId: 'test-4', + name: FS_REPLACE, + input: { + path: '/test/file.txt', + diffs: [ + { + oldStr: 'old line 1\nold line 2\nold line 3', + newStr: 'new line 1\nnew line 2\nnew line 3', + }, + ], + }, + } + + assert.strictEqual(calculateModifiedLines(toolUse), 6) + }) + + it('should count pure deletions', () => { + const toolUse: ToolUse = { + toolUseId: 'test-5', + name: FS_REPLACE, + input: { + path: '/test/file.txt', + diffs: [ + { + oldStr: 'line to delete 1\nline to delete 2', + newStr: '', + }, + ], + }, + } + + assert.strictEqual(calculateModifiedLines(toolUse), 2) + }) + + it('should count pure insertions', () => { + const toolUse: ToolUse = { + toolUseId: 'test-6', + name: FS_REPLACE, + input: { + path: '/test/file.txt', + diffs: [ + { + oldStr: '', + newStr: 'new line 1\nnew line 2', + }, + ], + }, + } + + assert.strictEqual(calculateModifiedLines(toolUse), 2) + }) + + it('should handle multiple diffs', () => { + const toolUse: ToolUse = { + toolUseId: 'test-7', + name: FS_REPLACE, + input: { + path: '/test/file.txt', + diffs: [ + { + oldStr: 'old line 1', + newStr: 'new line 1', + }, + { + oldStr: 'delete this line', + newStr: '', + }, + ], + }, + } + + assert.strictEqual(calculateModifiedLines(toolUse), 3) + }) + }) + + it('should return 0 for unknown tools', () => { + const toolUse: ToolUse = { + toolUseId: 'test-8', + name: 'unknownTool', + input: {}, + } + + assert.strictEqual(calculateModifiedLines(toolUse), 0) + }) +}) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/fileModificationMetrics.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/fileModificationMetrics.ts new file mode 100644 index 0000000000..361c886607 --- /dev/null +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/utils/fileModificationMetrics.ts @@ -0,0 +1,58 @@ +import { ToolUse } from '@amzn/codewhisperer-streaming' +import { diffLines } from 'diff' +import { FsWriteParams } from '../tools/fsWrite' +import { FsReplaceParams } from '../tools/fsReplace' +import { FS_WRITE, FS_REPLACE } from '../constants/toolConstants' + +/** + * Counts the number of lines in text, handling different line endings + * @param text The text to count lines in + * @returns The number of lines + */ +function countLines(text?: string): number { + if (!text) return 0 + const parts = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n').split('\n') + return parts.length && parts[parts.length - 1] === '' ? parts.length - 1 : parts.length +} + +/** + * Calculates the actual lines modified by analyzing file modification tools. + * @param toolUse The tool use object + * @param afterContent The content after the tool execution (for FS_WRITE create operations) + * @returns The total number of lines modified (added + removed) + */ +export function calculateModifiedLines(toolUse: ToolUse, afterContent?: string): number { + if (toolUse.name === FS_WRITE) { + const input = toolUse.input as unknown as FsWriteParams + + if (input.command === 'create') { + return countLines(afterContent ?? '') + } else if (input.command === 'append') { + return countLines(input.fileText) + } + } + + if (toolUse.name === FS_REPLACE) { + const input = toolUse.input as unknown as FsReplaceParams + let linesAdded = 0 + let linesRemoved = 0 + + for (const diff of input.diffs || []) { + const oldStr = diff.oldStr ?? '' + const newStr = diff.newStr ?? '' + + const changes = diffLines(oldStr, newStr) + + for (const change of changes) { + if (change.added) { + linesAdded += countLines(change.value) + } else if (change.removed) { + linesRemoved += countLines(change.value) + } + } + } + + return linesAdded + linesRemoved + } + return 0 +} From 94723d46073a1ea8211e7ae8f9dfce3fcb809604 Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Tue, 2 Sep 2025 12:36:57 -0700 Subject: [PATCH 53/74] revert: PR 2172 dedupe openTabs supplemental contexts (#2194) This reverts commit aa87ae2bd95edc1f38bf90f56093c5bf5ff18c53. --- .../supplementalContextUtil/crossFileContextUtil.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts b/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts index 91f02b9dc7..39e97a3b8c 100644 --- a/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts +++ b/server/aws-lsp-codewhisperer/src/shared/supplementalContextUtil/crossFileContextUtil.ts @@ -210,17 +210,8 @@ export async function fetchOpenTabsContext( }) } - // Dedupe code chunks based on their filePath + content unique key - const seen = new Set() - const deduped = supplementalContexts.filter(item => { - const key = `${item.filePath}:${item.content}` - if (seen.has(key)) return false - seen.add(key) - return true - }) - // DO NOT send code chunk with empty content - return deduped.filter(item => item.content.trim().length !== 0) + return supplementalContexts.filter(item => item.content.trim().length !== 0) } function findBestKChunkMatches(chunkInput: Chunk, chunkReferences: Chunk[], k: number): Chunk[] { From 58f20649d345f159080006120e23cde559826df1 Mon Sep 17 00:00:00 2001 From: chungjac Date: Tue, 2 Sep 2025 12:56:21 -0700 Subject: [PATCH 54/74] fix: emit errorMessage in addMessage (#2197) * emit errorMessage in addMessage * fix: emit errorMessage in addMessage --- .../language-server/agenticChat/agenticChatController.ts | 6 +++--- .../chat/telemetry/chatTelemetryController.ts | 8 +++++++- .../src/shared/telemetry/telemetryService.test.ts | 1 + .../src/shared/telemetry/telemetryService.ts | 2 ++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 6c3f07fac2..47739e77d1 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -3371,7 +3371,7 @@ export class AgenticChatController implements ChatHandlers { metric: Metric, agenticCodingMode: boolean ): Promise> { - const errorMessage = getErrorMsg(err) + const errorMessage = getErrorMsg(err) ?? GENERIC_ERROR_MS const requestID = getRequestID(err) ?? '' metric.setDimension('cwsprChatResponseCode', getHttpStatusCode(err) ?? 0) metric.setDimension('languageServerVersion', this.#features.runtime.serverInfo.version) @@ -3381,7 +3381,7 @@ export class AgenticChatController implements ChatHandlers { metric.metric.requestIds = [requestID] metric.metric.cwsprChatMessageId = errorMessageId metric.metric.cwsprChatConversationId = conversationId - await this.#telemetryController.emitAddMessageMetric(tabId, metric.metric, 'Failed') + await this.#telemetryController.emitAddMessageMetric(tabId, metric.metric, 'Failed', errorMessage) if (isUsageLimitError(err)) { if (this.#paidTierMode !== 'paidtier') { @@ -3426,7 +3426,7 @@ export class AgenticChatController implements ChatHandlers { tabId, metric.metric, requestID, - errorMessage ?? GENERIC_ERROR_MS, + errorMessage, agenticCodingMode ) } diff --git a/server/aws-lsp-codewhisperer/src/language-server/chat/telemetry/chatTelemetryController.ts b/server/aws-lsp-codewhisperer/src/language-server/chat/telemetry/chatTelemetryController.ts index 580bcd4be2..797a1f640a 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/chat/telemetry/chatTelemetryController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/chat/telemetry/chatTelemetryController.ts @@ -294,7 +294,12 @@ export class ChatTelemetryController { }) } - public emitAddMessageMetric(tabId: string, metric: Partial, result?: string) { + public emitAddMessageMetric( + tabId: string, + metric: Partial, + result?: string, + errorMessage?: string + ) { const conversationId = this.getConversationId(tabId) // Store the customization value associated with the message if (metric.cwsprChatMessageId && metric.codewhispererCustomizationArn) { @@ -349,6 +354,7 @@ export class ChatTelemetryController { requestIds: metric.requestIds, experimentName: metric.experimentName, userVariation: metric.userVariation, + errorMessage: errorMessage, } ) } diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.test.ts b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.test.ts index b6a5592f5f..d66ada7707 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.test.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.test.ts @@ -859,6 +859,7 @@ describe('TelemetryService', () => { cwsprChatPinnedFileContextCount: undefined, cwsprChatPinnedFolderContextCount: undefined, cwsprChatPinnedPromptContextCount: undefined, + errorMessage: undefined, }, }) }) diff --git a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts index cd2ba18254..78182c076f 100644 --- a/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts +++ b/server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts @@ -564,6 +564,7 @@ export class TelemetryService { requestIds?: string[] experimentName?: string userVariation?: string + errorMessage?: string }> ) { const timeBetweenChunks = params.timeBetweenChunks?.slice(0, 100) @@ -617,6 +618,7 @@ export class TelemetryService { requestIds: truncatedRequestIds, experimentName: additionalParams.experimentName, userVariation: additionalParams.userVariation, + errorMessage: additionalParams.errorMessage, }, }) } From cb2b9a8c25982d1521e1546d7103c49b3cb9dd61 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 10:00:32 -0700 Subject: [PATCH 55/74] chore(release): release packages from branch main (#2190) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- package-lock.json | 2 +- server/aws-lsp-codewhisperer/CHANGELOG.md | 27 +++++++++++++++++++++++ server/aws-lsp-codewhisperer/package.json | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e6baf94939..10e6c765df 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -2,7 +2,7 @@ "chat-client": "0.1.34", "core/aws-lsp-core": "0.0.14", "server/aws-lsp-antlr4": "0.1.18", - "server/aws-lsp-codewhisperer": "0.0.76", + "server/aws-lsp-codewhisperer": "0.0.77", "server/aws-lsp-json": "0.1.18", "server/aws-lsp-partiql": "0.0.17", "server/aws-lsp-yaml": "0.1.18" diff --git a/package-lock.json b/package-lock.json index 86d2516d9d..70518fd0ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28669,7 +28669,7 @@ }, "server/aws-lsp-codewhisperer": { "name": "@aws/lsp-codewhisperer", - "version": "0.0.76", + "version": "0.0.77", "bundleDependencies": [ "@amzn/codewhisperer-streaming", "@amzn/amazon-q-developer-streaming-client" diff --git a/server/aws-lsp-codewhisperer/CHANGELOG.md b/server/aws-lsp-codewhisperer/CHANGELOG.md index 8bda2b6803..4bb50ee8fd 100644 --- a/server/aws-lsp-codewhisperer/CHANGELOG.md +++ b/server/aws-lsp-codewhisperer/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## [0.0.77](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.76...lsp-codewhisperer/v0.0.77) (2025-09-02) + + +### Features + +* passing suggestionTypes and pluginVersion/lspVersion to STE ([#2180](https://github.com/aws/language-servers/issues/2180)) ([66742ad](https://github.com/aws/language-servers/commit/66742adfc44f33efbd8dd33b803000e08241e5ce)) + + +### Bug Fixes + +* auto trigger should only respect previous decisions in the past 2mins ([#2189](https://github.com/aws/language-servers/issues/2189)) ([852b21b](https://github.com/aws/language-servers/commit/852b21b66f793102c52e35c2baec07a772e5134a)) +* compact UI is not updated correctly when multiple nudges are displayed ([#2192](https://github.com/aws/language-servers/issues/2192)) ([ef7d793](https://github.com/aws/language-servers/commit/ef7d7931954f5083e4a5c358e67c6dc652fa1a40)) +* emit acceptedLineCount metric and AgenticCodeAccepted interaction type ([#2167](https://github.com/aws/language-servers/issues/2167)) ([c53f672](https://github.com/aws/language-servers/commit/c53f672b6173ebda530917ccb4e0c2f26f5c8f79)) +* emit errorMessage in addMessage ([#2197](https://github.com/aws/language-servers/issues/2197)) ([58f2064](https://github.com/aws/language-servers/commit/58f20649d345f159080006120e23cde559826df1)) +* fix calculation for num-lines contributed by the LLM ([#2191](https://github.com/aws/language-servers/issues/2191)) ([fd71e6c](https://github.com/aws/language-servers/commit/fd71e6cf3fc843242936564061061418edf83f56)) +* should send classifier score after taking sigmoid ([#2188](https://github.com/aws/language-servers/issues/2188)) ([f4e2e6e](https://github.com/aws/language-servers/commit/f4e2e6e885e665834a5d7b7cbb5f4ba4ff9bbb65)) + + +### Performance Improvements + +* only process edit requests 1 at a time ([#2187](https://github.com/aws/language-servers/issues/2187)) ([b497540](https://github.com/aws/language-servers/commit/b4975409a3ed518550290b72ac310895a293be4b)) + + +### Reverts + +* PR 2172 dedupe openTabs supplemental contexts ([#2194](https://github.com/aws/language-servers/issues/2194)) ([94723d4](https://github.com/aws/language-servers/commit/94723d46073a1ea8211e7ae8f9dfce3fcb809604)) + ## [0.0.76](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.75...lsp-codewhisperer/v0.0.76) (2025-08-27) diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index 8702e6fab3..aba60487ae 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-codewhisperer", - "version": "0.0.76", + "version": "0.0.77", "description": "CodeWhisperer Language Server", "main": "out/index.js", "repository": { From 34bc9bd1d3433bbb1d903eb0f212b10709ea8412 Mon Sep 17 00:00:00 2001 From: mkovelam Date: Wed, 3 Sep 2025 11:14:25 -0700 Subject: [PATCH 56/74] feat: model selection for code review tool (#2196) * feat: enabling model selection for code review tool * feat: added unit test for model selection for code review tool * fix: making modelId required for codeReviewTool in input schema validation * fix: fixing unit tests --------- Co-authored-by: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> --- .../client/token/bearer-token-service.json | 6 ++ .../token/codewhispererbearertokenclient.d.ts | 4 +- .../agenticChat/agenticChatController.ts | 1 + .../tools/qCodeAnalysis/codeReview.test.ts | 61 +++++++++++++++++++ .../tools/qCodeAnalysis/codeReview.ts | 11 +++- .../tools/qCodeAnalysis/codeReviewSchemas.ts | 1 + .../tools/qCodeAnalysis/codeReviewTypes.ts | 1 + 7 files changed, 83 insertions(+), 2 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json b/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json index 58ae54fb3c..f54c13cbdd 100644 --- a/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json +++ b/server/aws-lsp-codewhisperer/src/client/token/bearer-token-service.json @@ -4822,6 +4822,12 @@ }, "profileArn": { "shape": "ProfileArn" + }, + "languageModelId": { + "shape": "ModelId" + }, + "clientType": { + "shape": "Origin" } } }, diff --git a/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts b/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts index 8e64023479..4c8018c84e 100644 --- a/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts +++ b/server/aws-lsp-codewhisperer/src/client/token/codewhispererbearertokenclient.d.ts @@ -1539,6 +1539,8 @@ declare namespace CodeWhispererBearerTokenClient { codeScanName?: CodeScanName; codeDiffMetadata?: CodeDiffMetadata; profileArn?: ProfileArn; + languageModelId?: ModelId; + clientType?: Origin; } export type StartCodeAnalysisRequestClientTokenString = string; export interface StartCodeAnalysisResponse { @@ -2186,4 +2188,4 @@ declare namespace CodeWhispererBearerTokenClient { } export = CodeWhispererBearerTokenClient; - \ No newline at end of file + \ No newline at end of file diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index 47739e77d1..e2fba029c4 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -1989,6 +1989,7 @@ export class AgenticChatController implements ChatHandlers { .filter(c => c.type === 'rule') .map(c => ({ path: c.path })) } + initialInput['modelId'] = session.modelId toolUse.input = initialInput } catch (e) { this.#features.logging.warn(`could not parse CodeReview tool input: ${e}`) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts index 3509cd1730..f6f735da09 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts @@ -11,6 +11,7 @@ import * as path from 'path' import { expect } from 'chai' import { CancellationError } from '@aws/lsp-core' import * as JSZip from 'jszip' +import { Origin } from '@amzn/codewhisperer-streaming' describe('CodeReview', () => { let sandbox: sinon.SinonSandbox @@ -103,6 +104,7 @@ describe('CodeReview', () => { folderLevelArtifacts: [], ruleArtifacts: [], scopeOfReview: FULL_REVIEW, + modelId: 'claude-4-sonnet', } }) @@ -143,6 +145,61 @@ describe('CodeReview', () => { expect(result.output.kind).to.equal('json') }) + it('should execute successfully and pass languageModelId and clientType to startCodeAnalysis', async () => { + const inputWithModelId = { + ...validInput, + modelId: 'test-model-789', + } + + // Setup mocks for successful execution + mockCodeWhispererClient.createUploadUrl.resolves({ + uploadUrl: 'https://upload.com', + uploadId: 'upload-123', + requestHeaders: {}, + }) + + mockCodeWhispererClient.startCodeAnalysis.resolves({ + jobId: 'job-123', + status: 'Pending', + }) + + mockCodeWhispererClient.getCodeAnalysis.resolves({ + status: 'Completed', + }) + + mockCodeWhispererClient.listCodeAnalysisFindings.resolves({ + codeAnalysisFindings: '[]', + nextToken: undefined, + }) + + sandbox.stub(CodeReviewUtils, 'uploadFileToPresignedUrl').resolves() + sandbox.stub(codeReview as any, 'prepareFilesAndFoldersForUpload').resolves({ + zipBuffer: Buffer.from('test'), + md5Hash: 'hash123', + isCodeDiffPresent: false, + programmingLanguages: new Set(['javascript']), + }) + sandbox.stub(codeReview as any, 'parseFindings').returns([]) + + const result = await codeReview.execute(inputWithModelId, context) + + expect(result.output.success).to.be.true + expect(result.output.kind).to.equal('json') + + // Verify that startCodeAnalysis was called with the correct parameters + expect(mockCodeWhispererClient.startCodeAnalysis.calledOnce).to.be.true + const startAnalysisCall = mockCodeWhispererClient.startCodeAnalysis.getCall(0) + const callArgs = startAnalysisCall.args[0] + + expect(callArgs).to.have.property('languageModelId', 'test-model-789') + expect(callArgs).to.have.property('clientType', Origin.IDE) + expect(callArgs).to.have.property('artifacts') + expect(callArgs).to.have.property('programmingLanguage') + expect(callArgs).to.have.property('clientToken') + expect(callArgs).to.have.property('codeScanName') + expect(callArgs).to.have.property('scope', 'AGENTIC') + }) + it('should handle missing client error', async () => { context.codeWhispererClient = undefined @@ -160,6 +217,7 @@ describe('CodeReview', () => { folderLevelArtifacts: [], ruleArtifacts: [], scopeOfReview: FULL_REVIEW, + modelId: 'claude-4-sonnet', } try { @@ -279,6 +337,7 @@ describe('CodeReview', () => { folderLevelArtifacts: [], ruleArtifacts: [], scopeOfReview: FULL_REVIEW, + modelId: 'claude-4-sonnet', } const context = { @@ -303,6 +362,7 @@ describe('CodeReview', () => { folderLevelArtifacts: [{ path: '/test/folder' }], ruleArtifacts: [], scopeOfReview: CODE_DIFF_REVIEW, + modelId: 'claude-4-sonnet', } const context = { @@ -614,6 +674,7 @@ describe('CodeReview', () => { folderLevelArtifacts: [], ruleArtifacts: [], scopeOfReview: FULL_REVIEW, + modelId: 'claude-4-sonnet', } // Make prepareFilesAndFoldersForUpload throw an error diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts index d9fd42d621..ece6a73486 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts @@ -31,6 +31,7 @@ import { SuccessMetricName, } from './codeReviewTypes' import { CancellationError } from '@aws/lsp-core' +import { Origin } from '@amzn/codewhisperer-streaming' export class CodeReview { private static readonly CUSTOMER_CODE_BASE_PATH = 'customerCodeBaseFolder' @@ -158,6 +159,7 @@ export class CodeReview { const fileArtifacts = validatedInput.fileLevelArtifacts || [] const folderArtifacts = validatedInput.folderLevelArtifacts || [] const ruleArtifacts = validatedInput.ruleArtifacts || [] + const modelId = validatedInput.modelId if (fileArtifacts.length === 0 && folderArtifacts.length === 0) { CodeReviewUtils.emitMetric( @@ -182,7 +184,7 @@ export class CodeReview { const programmingLanguage = 'java' const scanName = 'Standard-' + randomUUID() - this.logging.info(`Agentic scan name: ${scanName}`) + this.logging.info(`Agentic scan name: ${scanName} selectedModel: ${modelId}`) return { fileArtifacts, @@ -192,6 +194,7 @@ export class CodeReview { programmingLanguage, scanName, ruleArtifacts, + modelId, } } @@ -274,6 +277,8 @@ export class CodeReview { codeScanName: setup.scanName, scope: CodeReview.SCAN_SCOPE, codeDiffMetadata: uploadResult.isCodeDiffPresent ? { codeDiffPath: '/code_artifact/codeDiff/' } : undefined, + languageModelId: setup.modelId, + clientType: Origin.IDE, }) if (!createResponse.jobId) { @@ -293,6 +298,7 @@ export class CodeReview { customRules: setup.ruleArtifacts.length, programmingLanguages: Array.from(uploadResult.programmingLanguages), scope: setup.isFullReviewRequest ? FULL_REVIEW : CODE_DIFF_REVIEW, + modelId: setup.modelId, }, }, this.logging, @@ -349,6 +355,7 @@ export class CodeReview { programmingLanguages: Array.from(uploadResult.programmingLanguages), scope: setup.isFullReviewRequest ? FULL_REVIEW : CODE_DIFF_REVIEW, status: status, + modelId: setup.modelId, }, }, this.logging, @@ -382,6 +389,7 @@ export class CodeReview { programmingLanguages: Array.from(uploadResult.programmingLanguages), scope: setup.isFullReviewRequest ? FULL_REVIEW : CODE_DIFF_REVIEW, status: status, + modelId: setup.modelId, }, }, this.logging, @@ -426,6 +434,7 @@ export class CodeReview { programmingLanguages: Array.from(uploadResult.programmingLanguages), scope: setup.isFullReviewRequest ? FULL_REVIEW : CODE_DIFF_REVIEW, latency: Date.now() - this.toolStartTime, + modelId: setup.modelId, }, }, this.logging, diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewSchemas.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewSchemas.ts index d734412066..e805145244 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewSchemas.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewSchemas.ts @@ -113,6 +113,7 @@ export const Z_CODE_REVIEW_INPUT_SCHEMA = z.object({ }) ) .optional(), + modelId: z.string(), }) /** diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts index 728c226ae1..c684cfecd3 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts @@ -21,6 +21,7 @@ export type ValidateInputAndSetupResult = { programmingLanguage: string scanName: string ruleArtifacts: RuleArtifacts + modelId?: string } export type PrepareAndUploadArtifactsResult = { From 512502af947dcfed9288be2f67fc58affd4445fe Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Wed, 3 Sep 2025 16:32:17 -0700 Subject: [PATCH 57/74] fix(amazonq): fix to update MCP servers list when last server is removed from agent config (#2206) --- .../src/language-server/agenticChat/tools/mcp/mcpManager.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index 027e349cf5..41d721b74f 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -231,6 +231,9 @@ export class McpManager { } this.features.logging.info(`MCP: completed initialization of ${totalServers} servers`) + } else { + // Emit event to refresh MCP list page when no servers are configured + this.setState('no-servers', McpServerStatus.UNINITIALIZED, 0) } for (const [sanitizedName, _] of this.mcpServers.entries()) { From ab211c48ffcc2171aca7c39d43d7a64be78a08cd Mon Sep 17 00:00:00 2001 From: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Date: Wed, 3 Sep 2025 16:38:43 -0700 Subject: [PATCH 58/74] chore: merge agentic version 1.31.0 (#2205) * chore: bump agentic version: 1.31.0 * chore: empty commit to trigger release workflow (#2203) --------- Co-authored-by: aws-toolkit-automation <> --- app/aws-lsp-codewhisperer-runtimes/src/version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/aws-lsp-codewhisperer-runtimes/src/version.json b/app/aws-lsp-codewhisperer-runtimes/src/version.json index e842765e3f..6d9528a4e7 100644 --- a/app/aws-lsp-codewhisperer-runtimes/src/version.json +++ b/app/aws-lsp-codewhisperer-runtimes/src/version.json @@ -1,3 +1,3 @@ { - "agenticChat": "1.30.0" + "agenticChat": "1.31.0" } From 013aa5913c242451a91ed36b0dcf961a3f8ec697 Mon Sep 17 00:00:00 2001 From: andrewyuq <89420755+andrewyuq@users.noreply.github.com> Date: Wed, 3 Sep 2025 17:03:49 -0700 Subject: [PATCH 59/74] fix(amazonq): add IntelliSense autotriggerType (#2199) --- .../inline-completion/auto-trigger/autoTrigger.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts index 8990756dbf..b6657b229c 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts @@ -32,7 +32,7 @@ export type CodewhispererTriggerType = 'AutoTrigger' | 'OnDemand' // Two triggers are explicitly handled, SpecialCharacters and Enter. Everything else is expected to be a trigger // based on regular typing, and is considered a 'Classifier' trigger. -export type CodewhispererAutomatedTriggerType = 'SpecialCharacters' | 'Enter' | 'Classifier' +export type CodewhispererAutomatedTriggerType = 'SpecialCharacters' | 'Enter' | 'Classifier' | 'IntelliSenseAcceptance' /** * Determine the trigger type based on the file context. Currently supports special cases for Special Characters and Enter keys, @@ -104,6 +104,10 @@ function isTabKey(str: string): boolean { return false } +function isIntelliSenseAcceptance(str: string) { + return str === 'IntelliSenseAcceptance' +} + // Reference: https://github.com/aws/aws-toolkit-vscode/blob/amazonq/v1.74.0/packages/core/src/codewhisperer/service/keyStrokeHandler.ts#L222 // Enter, Special character guarantees a trigger // Regular keystroke input will be evaluated by classifier @@ -126,6 +130,8 @@ export const getAutoTriggerType = ( return undefined } else if (isUserTypingSpecialChar(changedText)) { return 'SpecialCharacters' + } else if (isIntelliSenseAcceptance(changedText)) { + return 'IntelliSenseAcceptance' } else if (changedText.length === 1) { return 'Classifier' } else if (new RegExp('^[ ]+$').test(changedText)) { From 8bde8c97e1e3bcd67d9816a3385c50c7765c3b2f Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Fri, 5 Sep 2025 10:53:02 -0700 Subject: [PATCH 60/74] fix(amazonq): fix to correct the client for getProfile request (#2211) * fix(amazonq): fix to correct the client for getProfile request * fix(amazonq): removed unneccessary constructor objects * fix: fix to add assigned VARs in unit tests --- .../tools/mcp/profileStatusMonitor.test.ts | 76 +++++----------- .../tools/mcp/profileStatusMonitor.ts | 29 ++----- .../agenticChat/tools/toolServer.ts | 86 ++++++++----------- 3 files changed, 65 insertions(+), 126 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.test.ts index 77080bf08a..6fb0e56f9a 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.test.ts @@ -3,17 +3,24 @@ * All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ -import { expect } from 'chai' +import * as chai from 'chai' import * as sinon from 'sinon' import { ProfileStatusMonitor } from './profileStatusMonitor' import * as AmazonQTokenServiceManagerModule from '../../../../shared/amazonQServiceManager/AmazonQTokenServiceManager' +const { expect } = chai + +interface MockLogging { + info: sinon.SinonStub + debug: sinon.SinonStub + error: sinon.SinonStub + warn: sinon.SinonStub + log: sinon.SinonStub +} + describe('ProfileStatusMonitor', () => { let profileStatusMonitor: ProfileStatusMonitor - let mockCredentialsProvider: any - let mockWorkspace: any - let mockLogging: any - let mockSdkInitializator: any + let mockLogging: MockLogging let mockOnMcpDisabled: sinon.SinonStub let mockOnMcpEnabled: sinon.SinonStub let clock: sinon.SinonFakeTimers @@ -21,29 +28,18 @@ describe('ProfileStatusMonitor', () => { beforeEach(() => { clock = sinon.useFakeTimers() - mockCredentialsProvider = { - hasCredentials: sinon.stub().returns(true), - } - - mockWorkspace = {} - mockLogging = { info: sinon.stub(), debug: sinon.stub(), + error: sinon.stub(), + warn: sinon.stub(), + log: sinon.stub(), } - mockSdkInitializator = {} mockOnMcpDisabled = sinon.stub() mockOnMcpEnabled = sinon.stub() - profileStatusMonitor = new ProfileStatusMonitor( - mockCredentialsProvider, - mockWorkspace, - mockLogging, - mockSdkInitializator, - mockOnMcpDisabled, - mockOnMcpEnabled - ) + profileStatusMonitor = new ProfileStatusMonitor(mockLogging, mockOnMcpDisabled, mockOnMcpEnabled) }) afterEach(() => { @@ -118,23 +114,9 @@ describe('ProfileStatusMonitor', () => { }) it('should be accessible across different instances', () => { - const monitor1 = new ProfileStatusMonitor( - mockCredentialsProvider, - mockWorkspace, - mockLogging, - mockSdkInitializator, - mockOnMcpDisabled, - mockOnMcpEnabled - ) - - const monitor2 = new ProfileStatusMonitor( - mockCredentialsProvider, - mockWorkspace, - mockLogging, - mockSdkInitializator, - mockOnMcpDisabled, - mockOnMcpEnabled - ) + const monitor1 = new ProfileStatusMonitor(mockLogging, mockOnMcpDisabled, mockOnMcpEnabled) + + const monitor2 = new ProfileStatusMonitor(mockLogging, mockOnMcpDisabled, mockOnMcpEnabled) // Set state through static property ;(ProfileStatusMonitor as any).lastMcpState = true @@ -151,23 +133,9 @@ describe('ProfileStatusMonitor', () => { }) it('should maintain state across multiple instances', () => { - const monitor1 = new ProfileStatusMonitor( - mockCredentialsProvider, - mockWorkspace, - mockLogging, - mockSdkInitializator, - mockOnMcpDisabled, - mockOnMcpEnabled - ) - - const monitor2 = new ProfileStatusMonitor( - mockCredentialsProvider, - mockWorkspace, - mockLogging, - mockSdkInitializator, - mockOnMcpDisabled, - mockOnMcpEnabled - ) + const monitor1 = new ProfileStatusMonitor(mockLogging, mockOnMcpDisabled, mockOnMcpEnabled) + + const monitor2 = new ProfileStatusMonitor(mockLogging, mockOnMcpDisabled, mockOnMcpEnabled) // Initially true (default value) expect(ProfileStatusMonitor.getMcpState()).to.be.true diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts index 53a4da9090..3489ad81be 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/profileStatusMonitor.ts @@ -3,15 +3,9 @@ * All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ -import { - CredentialsProvider, - Logging, - SDKInitializator, - Workspace, -} from '@aws/language-server-runtimes/server-interface' +import { Logging } from '@aws/language-server-runtimes/server-interface' import { retryUtils } from '@aws/lsp-core' import { CodeWhispererServiceToken } from '../../../../shared/codeWhispererService' -import { DEFAULT_AWS_Q_ENDPOINT_URL, DEFAULT_AWS_Q_REGION } from '../../../../shared/constants' import { AmazonQTokenServiceManager } from '../../../../shared/amazonQServiceManager/AmazonQTokenServiceManager' import * as fs from 'fs' import * as path from 'path' @@ -31,10 +25,7 @@ export class ProfileStatusMonitor { private static logging?: Logging constructor( - private credentialsProvider: CredentialsProvider, - private workspace: Workspace, private logging: Logging, - private sdkInitializator: SDKInitializator, private onMcpDisabled: () => void, private onMcpEnabled?: () => void ) { @@ -79,24 +70,15 @@ export class ProfileStatusMonitor { private async isMcpEnabled(): Promise { try { - const profileArn = this.getProfileArn() + const serviceManager = AmazonQTokenServiceManager.getInstance() + const profileArn = this.getProfileArn(serviceManager) if (!profileArn) { this.logging.debug('No profile ARN available for MCP configuration check') ProfileStatusMonitor.setMcpState(true) return true } - if (!this.codeWhispererClient) { - this.codeWhispererClient = new CodeWhispererServiceToken( - this.credentialsProvider, - this.workspace, - this.logging, - process.env.CODEWHISPERER_REGION || DEFAULT_AWS_Q_REGION, - process.env.CODEWHISPERER_ENDPOINT || DEFAULT_AWS_Q_ENDPOINT_URL, - this.sdkInitializator - ) - this.codeWhispererClient.profileArn = profileArn - } + this.codeWhispererClient = serviceManager.getCodewhispererService() const response = await retryUtils.retryWithBackoff(() => this.codeWhispererClient!.getProfile({ profileArn }) @@ -128,9 +110,8 @@ export class ProfileStatusMonitor { } } - private getProfileArn(): string | undefined { + private getProfileArn(serviceManager: AmazonQTokenServiceManager): string | undefined { try { - const serviceManager = AmazonQTokenServiceManager.getInstance() return serviceManager.getActiveProfileArn() } catch (error) { this.logging.debug(`Failed to get profile ARN: ${error}`) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts index 78871faa69..8581622972 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts @@ -210,7 +210,6 @@ export const McpToolsServer: Server = ({ agent, telemetry, runtime, - sdkInitializator, chat, }) => { const registered: Record = {} @@ -358,60 +357,51 @@ export const McpToolsServer: Server = ({ return } - if (sdkInitializator) { - profileStatusMonitor = new ProfileStatusMonitor( - credentialsProvider, - workspace, - logging, - sdkInitializator, - removeAllMcpTools, - async () => { - logging.info('MCP enabled by profile status monitor') - await initializeMcp() - } - ) - - // Wait for profile ARN to be available before checking MCP state - const checkAndInitialize = async () => { - await profileStatusMonitor!.checkInitialState() - // Always initialize McpManager to handle UI requests - await initializeMcp() + profileStatusMonitor = new ProfileStatusMonitor(logging, removeAllMcpTools, async () => { + logging.info('MCP enabled by profile status monitor') + await initializeMcp() + }) - // Remove tools if MCP is disabled - if (!ProfileStatusMonitor.getMcpState()) { - removeAllMcpTools() - } + // Wait for profile ARN to be available before checking MCP state + const checkAndInitialize = async () => { + await profileStatusMonitor!.checkInitialState() + // Always initialize McpManager to handle UI requests + await initializeMcp() - profileStatusMonitor!.start() + // Remove tools if MCP is disabled + if (!ProfileStatusMonitor.getMcpState()) { + removeAllMcpTools() } - // Check if service manager is ready - try { - const serviceManager = AmazonQTokenServiceManager.getInstance() - if (serviceManager.getState() === 'INITIALIZED') { - await checkAndInitialize() - } else { - // Poll for service manager to be ready with 10s timeout - const startTime = Date.now() - const pollForReady = async () => { - if (serviceManager.getState() === 'INITIALIZED') { - await checkAndInitialize() - } else if (Date.now() - startTime < SERVICE_MANAGER_TIMEOUT_MS) { - setTimeout(pollForReady, SERVICE_MANAGER_POLL_INTERVAL_MS) - } else { - logging.warn('Service manager not ready after 10s, initializing MCP manager') - await initializeMcp() - profileStatusMonitor!.start() - } + profileStatusMonitor!.start() + } + + // Check if service manager is ready + try { + const serviceManager = AmazonQTokenServiceManager.getInstance() + if (serviceManager.getState() === 'INITIALIZED') { + await checkAndInitialize() + } else { + // Poll for service manager to be ready with 10s timeout + const startTime = Date.now() + const pollForReady = async () => { + if (serviceManager.getState() === 'INITIALIZED') { + await checkAndInitialize() + } else if (Date.now() - startTime < SERVICE_MANAGER_TIMEOUT_MS) { + setTimeout(pollForReady, SERVICE_MANAGER_POLL_INTERVAL_MS) + } else { + logging.warn('Service manager not ready after 10s, initializing MCP manager') + await initializeMcp() + profileStatusMonitor!.start() } - setTimeout(pollForReady, SERVICE_MANAGER_POLL_INTERVAL_MS) } - } catch (error) { - // Service manager not initialized yet, always initialize McpManager - logging.info('Service manager not ready, initializing MCP manager') - await initializeMcp() - profileStatusMonitor!.start() + setTimeout(pollForReady, SERVICE_MANAGER_POLL_INTERVAL_MS) } + } catch (error) { + // Service manager not initialized yet, always initialize McpManager + logging.info('Service manager not ready, initializing MCP manager') + await initializeMcp() + profileStatusMonitor!.start() } } catch (error) { console.warn('Caught error during MCP tool initialization; initialization may be incomplete:', error) From 2ddcae7a4fac6b89cbc9784911959743ea0a6d11 Mon Sep 17 00:00:00 2001 From: Lei Gao <97199248+leigaol@users.noreply.github.com> Date: Fri, 5 Sep 2025 14:18:13 -0700 Subject: [PATCH 61/74] feat: add support for getSupplementalContext LSP API (#2212) * feat: add supplemental context API * feat: add supplemental context API support --- app/aws-lsp-antlr4-runtimes/package.json | 2 +- app/aws-lsp-buildspec-runtimes/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- app/aws-lsp-identity-runtimes/package.json | 2 +- app/aws-lsp-json-runtimes/package.json | 2 +- .../package.json | 2 +- app/aws-lsp-partiql-runtimes/package.json | 2 +- app/aws-lsp-s3-runtimes/package.json | 2 +- app/aws-lsp-yaml-json-webworker/package.json | 2 +- app/aws-lsp-yaml-runtimes/package.json | 2 +- app/hello-world-lsp-runtimes/package.json | 2 +- chat-client/package.json | 2 +- client/vscode/package.json | 2 +- core/aws-lsp-core/package.json | 2 +- .../q-agentic-chat-server/package.json | 2 +- package-lock.json | 63 ++++++++++--------- server/aws-lsp-antlr4/package.json | 2 +- server/aws-lsp-buildspec/package.json | 2 +- server/aws-lsp-cloudformation/package.json | 2 +- server/aws-lsp-codewhisperer/package.json | 2 +- .../localProjectContextServer.ts | 25 +++++++- server/aws-lsp-identity/package.json | 2 +- server/aws-lsp-json/package.json | 2 +- server/aws-lsp-notification/package.json | 2 +- server/aws-lsp-partiql/package.json | 2 +- server/aws-lsp-s3/package.json | 2 +- server/aws-lsp-yaml/package.json | 2 +- server/device-sso-auth-lsp/package.json | 2 +- server/hello-world-lsp/package.json | 2 +- 30 files changed, 84 insertions(+), 60 deletions(-) diff --git a/app/aws-lsp-antlr4-runtimes/package.json b/app/aws-lsp-antlr4-runtimes/package.json index 89fa95dcb3..20409656e1 100644 --- a/app/aws-lsp-antlr4-runtimes/package.json +++ b/app/aws-lsp-antlr4-runtimes/package.json @@ -12,7 +12,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-antlr4": "*", "antlr4-c3": "^3.4.1", "antlr4ng": "^3.0.4" diff --git a/app/aws-lsp-buildspec-runtimes/package.json b/app/aws-lsp-buildspec-runtimes/package.json index 0ad07ddb8f..a080ed2edb 100644 --- a/app/aws-lsp-buildspec-runtimes/package.json +++ b/app/aws-lsp-buildspec-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-buildspec": "^0.0.1" } } diff --git a/app/aws-lsp-cloudformation-runtimes/package.json b/app/aws-lsp-cloudformation-runtimes/package.json index d211149d0d..ad4c547839 100644 --- a/app/aws-lsp-cloudformation-runtimes/package.json +++ b/app/aws-lsp-cloudformation-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-cloudformation": "^0.0.1" } } diff --git a/app/aws-lsp-codewhisperer-runtimes/package.json b/app/aws-lsp-codewhisperer-runtimes/package.json index b890c01a78..18de7dab8c 100644 --- a/app/aws-lsp-codewhisperer-runtimes/package.json +++ b/app/aws-lsp-codewhisperer-runtimes/package.json @@ -23,7 +23,7 @@ "local-build": "node scripts/local-build.js" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-codewhisperer": "*", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", diff --git a/app/aws-lsp-identity-runtimes/package.json b/app/aws-lsp-identity-runtimes/package.json index f33fa80da4..4aa4f9d7f3 100644 --- a/app/aws-lsp-identity-runtimes/package.json +++ b/app/aws-lsp-identity-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-identity": "^0.0.1" } } diff --git a/app/aws-lsp-json-runtimes/package.json b/app/aws-lsp-json-runtimes/package.json index db1949f54b..78815f73cc 100644 --- a/app/aws-lsp-json-runtimes/package.json +++ b/app/aws-lsp-json-runtimes/package.json @@ -11,7 +11,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-json": "*" }, "devDependencies": { diff --git a/app/aws-lsp-notification-runtimes/package.json b/app/aws-lsp-notification-runtimes/package.json index a5eeecae49..cb5e90a9e5 100644 --- a/app/aws-lsp-notification-runtimes/package.json +++ b/app/aws-lsp-notification-runtimes/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-notification": "^0.0.1" } } diff --git a/app/aws-lsp-partiql-runtimes/package.json b/app/aws-lsp-partiql-runtimes/package.json index d483f3d0ce..21f089c3d6 100644 --- a/app/aws-lsp-partiql-runtimes/package.json +++ b/app/aws-lsp-partiql-runtimes/package.json @@ -11,7 +11,7 @@ "package": "npm run compile && npm run compile:webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-partiql": "^0.0.5" }, "devDependencies": { diff --git a/app/aws-lsp-s3-runtimes/package.json b/app/aws-lsp-s3-runtimes/package.json index 9feb4f7ddc..a5eac053e3 100644 --- a/app/aws-lsp-s3-runtimes/package.json +++ b/app/aws-lsp-s3-runtimes/package.json @@ -10,7 +10,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-s3": "^0.0.1" } } diff --git a/app/aws-lsp-yaml-json-webworker/package.json b/app/aws-lsp-yaml-json-webworker/package.json index fc524cabdc..14f0c58491 100644 --- a/app/aws-lsp-yaml-json-webworker/package.json +++ b/app/aws-lsp-yaml-json-webworker/package.json @@ -11,7 +11,7 @@ "serve:webpack": "NODE_ENV=development webpack serve" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*" }, diff --git a/app/aws-lsp-yaml-runtimes/package.json b/app/aws-lsp-yaml-runtimes/package.json index 09bb93ee9a..e935c9ee0a 100644 --- a/app/aws-lsp-yaml-runtimes/package.json +++ b/app/aws-lsp-yaml-runtimes/package.json @@ -11,7 +11,7 @@ "webpack": "webpack" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-yaml": "*" }, "devDependencies": { diff --git a/app/hello-world-lsp-runtimes/package.json b/app/hello-world-lsp-runtimes/package.json index bff976d9b3..0d372ab621 100644 --- a/app/hello-world-lsp-runtimes/package.json +++ b/app/hello-world-lsp-runtimes/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@aws/hello-world-lsp": "^0.0.1", - "@aws/language-server-runtimes": "^0.2.127" + "@aws/language-server-runtimes": "^0.2.128" }, "devDependencies": { "@types/chai": "^4.3.5", diff --git a/chat-client/package.json b/chat-client/package.json index b838360175..bf20eecb9d 100644 --- a/chat-client/package.json +++ b/chat-client/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/language-server-runtimes-types": "^0.1.50", "@aws/mynah-ui": "^4.36.5" }, diff --git a/client/vscode/package.json b/client/vscode/package.json index a5d7f66d21..6b936bfd3f 100644 --- a/client/vscode/package.json +++ b/client/vscode/package.json @@ -352,7 +352,7 @@ "@aws-sdk/credential-providers": "^3.731.1", "@aws-sdk/types": "^3.734.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@types/uuid": "^9.0.8", "@types/vscode": "^1.98.0", "jose": "^5.2.4", diff --git a/core/aws-lsp-core/package.json b/core/aws-lsp-core/package.json index 54ca980fc1..3057954dce 100644 --- a/core/aws-lsp-core/package.json +++ b/core/aws-lsp-core/package.json @@ -28,7 +28,7 @@ "prepack": "shx cp ../../LICENSE ../../NOTICE ../../SECURITY.md ." }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@gerhobbelt/gitignore-parser": "^0.2.0-9", "cross-spawn": "7.0.6", "jose": "^5.2.4", diff --git a/integration-tests/q-agentic-chat-server/package.json b/integration-tests/q-agentic-chat-server/package.json index ffb33f1a4e..7018052547 100644 --- a/integration-tests/q-agentic-chat-server/package.json +++ b/integration-tests/q-agentic-chat-server/package.json @@ -9,7 +9,7 @@ "test-integ": "npm run compile && mocha --timeout 30000 \"./out/**/*.test.js\" --retries 2" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "*" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 70518fd0ab..e84567b613 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "name": "@aws/lsp-antlr4-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-antlr4": "*", "antlr4-c3": "^3.4.1", "antlr4ng": "^3.0.4" @@ -71,7 +71,7 @@ "name": "@aws/lsp-buildspec-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-buildspec": "^0.0.1" } }, @@ -79,7 +79,7 @@ "name": "@aws/lsp-cloudformation-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-cloudformation": "^0.0.1" } }, @@ -87,7 +87,7 @@ "name": "@aws/lsp-codewhisperer-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-codewhisperer": "*", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", @@ -120,7 +120,7 @@ "name": "@aws/lsp-identity-runtimes", "version": "0.1.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-identity": "^0.0.1" } }, @@ -128,7 +128,7 @@ "name": "@aws/lsp-json-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-json": "*" }, "devDependencies": { @@ -148,7 +148,7 @@ "name": "@aws/lsp-notification-runtimes", "version": "0.1.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-notification": "^0.0.1" } }, @@ -156,7 +156,7 @@ "name": "@aws/lsp-partiql-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.125", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-partiql": "^0.0.5" }, "devDependencies": { @@ -181,7 +181,7 @@ "name": "@aws/lsp-s3-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-s3": "^0.0.1" }, "bin": { @@ -192,7 +192,7 @@ "name": "@aws/lsp-yaml-json-webworker", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*" }, @@ -212,7 +212,7 @@ "name": "@aws/lsp-yaml-runtimes", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-yaml": "*" }, "devDependencies": { @@ -234,7 +234,7 @@ "version": "0.0.1", "dependencies": { "@aws/hello-world-lsp": "^0.0.1", - "@aws/language-server-runtimes": "^0.2.127" + "@aws/language-server-runtimes": "^0.2.128" }, "devDependencies": { "@types/chai": "^4.3.5", @@ -255,7 +255,7 @@ "license": "Apache-2.0", "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/language-server-runtimes-types": "^0.1.50", "@aws/mynah-ui": "^4.36.5" }, @@ -280,7 +280,7 @@ "@aws-sdk/credential-providers": "^3.731.1", "@aws-sdk/types": "^3.734.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@types/uuid": "^9.0.8", "@types/vscode": "^1.98.0", "jose": "^5.2.4", @@ -296,7 +296,7 @@ "version": "0.0.14", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@gerhobbelt/gitignore-parser": "^0.2.0-9", "cross-spawn": "7.0.6", "jose": "^5.2.4", @@ -327,7 +327,7 @@ "name": "@aws/q-agentic-chat-server-integration-tests", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "*" }, "devDependencies": { @@ -4036,9 +4036,10 @@ "link": true }, "node_modules/@aws/language-server-runtimes": { - "version": "0.2.127", - "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes/-/language-server-runtimes-0.2.127.tgz", - "integrity": "sha512-UWCfv49MYaBhxArVBWTEw2XVfIyunbm6EfS9AxSLPudcwrpOg3KAVLooXearmyM/r2hgNDGCQYI8HuKf5FAnew==", + "version": "0.2.128", + "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes/-/language-server-runtimes-0.2.128.tgz", + "integrity": "sha512-C666VAvY2PQ8CQkDzjL/+N9rfcFzY6vuGe733drMwwRVHt8On0B0PQPjy31ZjxHUUcjVp78Nb9vmSUEVBfxGTQ==", + "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes-types": "^0.1.56", "@opentelemetry/api": "^1.9.0", @@ -28607,7 +28608,7 @@ "version": "0.1.18", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.14" }, "devDependencies": { @@ -28649,7 +28650,7 @@ "name": "@aws/lsp-buildspec", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*", "vscode-languageserver": "^9.0.1", @@ -28660,7 +28661,7 @@ "name": "@aws/lsp-cloudformation", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "*", "@aws/lsp-json": "*", "vscode-languageserver": "^9.0.1", @@ -28682,7 +28683,7 @@ "@aws-sdk/util-arn-parser": "^3.723.0", "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.14", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", @@ -28822,7 +28823,7 @@ "dependencies": { "@aws-sdk/client-sso-oidc": "^3.616.0", "@aws-sdk/token-providers": "^3.744.0", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.12", "@smithy/node-http-handler": "^3.2.5", "@smithy/shared-ini-file-loader": "^4.0.1", @@ -28887,7 +28888,7 @@ "version": "0.1.18", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" @@ -28904,7 +28905,7 @@ "version": "0.0.1", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1" }, @@ -28965,7 +28966,7 @@ "version": "0.0.17", "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "antlr4-c3": "3.4.2", "antlr4ng": "3.0.14", "web-tree-sitter": "0.22.6" @@ -28987,7 +28988,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.623.0", "@aws-sdk/types": "^3.734.0", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" @@ -29018,7 +29019,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", @@ -29032,7 +29033,7 @@ "name": "@amzn/device-sso-auth-lsp", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "vscode-languageserver": "^9.0.1" }, "devDependencies": { @@ -29043,7 +29044,7 @@ "name": "@aws/hello-world-lsp", "version": "0.0.1", "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "vscode-languageserver": "^9.0.1" }, "devDependencies": { diff --git a/server/aws-lsp-antlr4/package.json b/server/aws-lsp-antlr4/package.json index 2ca49593d7..9cad906eee 100644 --- a/server/aws-lsp-antlr4/package.json +++ b/server/aws-lsp-antlr4/package.json @@ -28,7 +28,7 @@ "clean": "rm -rf node_modules" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.14" }, "peerDependencies": { diff --git a/server/aws-lsp-buildspec/package.json b/server/aws-lsp-buildspec/package.json index 9754645b7d..f0184e0ff8 100644 --- a/server/aws-lsp-buildspec/package.json +++ b/server/aws-lsp-buildspec/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-json": "*", "@aws/lsp-yaml": "*", "vscode-languageserver": "^9.0.1", diff --git a/server/aws-lsp-cloudformation/package.json b/server/aws-lsp-cloudformation/package.json index 13be6a4859..89b56ede3f 100644 --- a/server/aws-lsp-cloudformation/package.json +++ b/server/aws-lsp-cloudformation/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "*", "@aws/lsp-json": "*", "vscode-languageserver": "^9.0.1", diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index aba60487ae..5284a0b41f 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -36,7 +36,7 @@ "@aws-sdk/util-arn-parser": "^3.723.0", "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.14", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", diff --git a/server/aws-lsp-codewhisperer/src/language-server/localProjectContext/localProjectContextServer.ts b/server/aws-lsp-codewhisperer/src/language-server/localProjectContext/localProjectContextServer.ts index 1fa2b8301b..9cff865038 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/localProjectContext/localProjectContextServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/localProjectContext/localProjectContextServer.ts @@ -1,4 +1,10 @@ -import { InitializeParams, Server, TextDocumentSyncKind } from '@aws/language-server-runtimes/server-interface' +import { + GetSupplementalContextParams, + InitializeParams, + Server, + SupplementalContextItem, + TextDocumentSyncKind, +} from '@aws/language-server-runtimes/server-interface' import { getOrThrowBaseTokenServiceManager } from '../../shared/amazonQServiceManager/AmazonQTokenServiceManager' import { TelemetryService } from '../../shared/telemetry/telemetryService' import { LocalProjectContextController } from '../../shared/localProjectContextController' @@ -127,6 +133,23 @@ export const LocalProjectContextServer = } }) + const onGetSupplementalContext = async ( + param: GetSupplementalContextParams + ): Promise => { + if (localProjectContextController) { + const request = { + query: '', + filePath: param.filePath, + target: 'codemap', + } + const response = await localProjectContextController.queryInlineProjectContext(request) + return response + } + return [] + } + + lsp.extensions.onGetSupplementalContext(onGetSupplementalContext) + lsp.onDidSaveTextDocument(async event => { try { const filePaths = VSCWindowsOverride diff --git a/server/aws-lsp-identity/package.json b/server/aws-lsp-identity/package.json index 9aa4bedcbf..3d90af77e4 100644 --- a/server/aws-lsp-identity/package.json +++ b/server/aws-lsp-identity/package.json @@ -26,7 +26,7 @@ "dependencies": { "@aws-sdk/client-sso-oidc": "^3.616.0", "@aws-sdk/token-providers": "^3.744.0", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.12", "@smithy/node-http-handler": "^3.2.5", "@smithy/shared-ini-file-loader": "^4.0.1", diff --git a/server/aws-lsp-json/package.json b/server/aws-lsp-json/package.json index ee5fbbc47a..6b2c95bc49 100644 --- a/server/aws-lsp-json/package.json +++ b/server/aws-lsp-json/package.json @@ -26,7 +26,7 @@ "prepack": "shx cp ../../LICENSE ../../NOTICE ../../SECURITY.md ." }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" diff --git a/server/aws-lsp-notification/package.json b/server/aws-lsp-notification/package.json index f19ddc54ca..740a109f48 100644 --- a/server/aws-lsp-notification/package.json +++ b/server/aws-lsp-notification/package.json @@ -22,7 +22,7 @@ "coverage:report": "c8 report --reporter=html --reporter=text" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1" }, diff --git a/server/aws-lsp-partiql/package.json b/server/aws-lsp-partiql/package.json index dc2fc2ee22..e5f59a4411 100644 --- a/server/aws-lsp-partiql/package.json +++ b/server/aws-lsp-partiql/package.json @@ -24,7 +24,7 @@ "out" ], "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "antlr4-c3": "3.4.2", "antlr4ng": "3.0.14", "web-tree-sitter": "0.22.6" diff --git a/server/aws-lsp-s3/package.json b/server/aws-lsp-s3/package.json index 914628d14e..8829f1dd87 100644 --- a/server/aws-lsp-s3/package.json +++ b/server/aws-lsp-s3/package.json @@ -9,7 +9,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.623.0", "@aws-sdk/types": "^3.734.0", - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.12", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" diff --git a/server/aws-lsp-yaml/package.json b/server/aws-lsp-yaml/package.json index fe115132c8..213221d721 100644 --- a/server/aws-lsp-yaml/package.json +++ b/server/aws-lsp-yaml/package.json @@ -26,7 +26,7 @@ "postinstall": "node patchYamlPackage.js" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "@aws/lsp-core": "^0.0.14", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", diff --git a/server/device-sso-auth-lsp/package.json b/server/device-sso-auth-lsp/package.json index e5085aa6bd..9bca2bf0b7 100644 --- a/server/device-sso-auth-lsp/package.json +++ b/server/device-sso-auth-lsp/package.json @@ -7,7 +7,7 @@ "compile": "tsc --build" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "vscode-languageserver": "^9.0.1" }, "devDependencies": { diff --git a/server/hello-world-lsp/package.json b/server/hello-world-lsp/package.json index 8ab207f8b4..b5944a3223 100644 --- a/server/hello-world-lsp/package.json +++ b/server/hello-world-lsp/package.json @@ -13,7 +13,7 @@ "coverage:report": "c8 report --reporter=html --reporter=text" }, "dependencies": { - "@aws/language-server-runtimes": "^0.2.127", + "@aws/language-server-runtimes": "^0.2.128", "vscode-languageserver": "^9.0.1" }, "devDependencies": { From 12229059421b773d3e99d28809fdff4abf242b26 Mon Sep 17 00:00:00 2001 From: Rajanna-Karthik Date: Mon, 8 Sep 2025 09:59:54 -0700 Subject: [PATCH 62/74] feat: add custom_transformation folder support to artifact.zip (#2201) * feat: add custom_transformation folder support to artifact.zip * feat: add custom transformation folder support with async file operations * fix: improve custom transformation folder access logging message --------- Co-authored-by: huawenm <72728725+huawenm@users.noreply.github.com> --- .../netTransform/artifactManager.ts | 22 ++++++++++++++++++- ...teTransformationPreferencesContent.test.ts | 2 +- ...factManager.processPrivatePackages.test.ts | 2 +- .../netTransform/transformHandler.ts | 3 ++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/netTransform/artifactManager.ts b/server/aws-lsp-codewhisperer/src/language-server/netTransform/artifactManager.ts index 0b510e7c64..4b1e9818cd 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/netTransform/artifactManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/netTransform/artifactManager.ts @@ -22,16 +22,19 @@ const zipFileName = 'artifact.zip' const sourceCodeFolderName = 'sourceCode' const packagesFolderName = 'packages' const thirdPartyPackageFolderName = 'thirdpartypackages' +const customTransformationFolderName = 'customTransformation' export class ArtifactManager { private workspace: Workspace private logging: Logging private workspacePath: string + private solutionRootPath: string - constructor(workspace: Workspace, logging: Logging, workspacePath: string) { + constructor(workspace: Workspace, logging: Logging, workspacePath: string, solutionRootPath: string) { this.workspace = workspace this.logging = logging this.workspacePath = workspacePath + this.solutionRootPath = solutionRootPath } async createZip(request: StartTransformRequest): Promise { @@ -282,6 +285,23 @@ export class ArtifactManager { this.logging.log('Cannot find artifacts folder') return '' } + + const customTransformationPath = path.join(this.solutionRootPath, customTransformationFolderName) + try { + await fs.promises.access(customTransformationPath) + try { + this.logging.log(`Adding custom transformation folder to artifact: ${customTransformationPath}`) + const artifactCustomTransformationPath = path.join(folderPath, customTransformationFolderName) + await fs.promises.cp(customTransformationPath, artifactCustomTransformationPath, { recursive: true }) + } catch (error) { + this.logging.warn(`Failed to copy custom transformation folder: ${error}`) + } + } catch { + this.logging.log( + `Custom transformation folder not accessible (not found or no permissions): ${customTransformationPath}` + ) + } + const zipPath = path.join(this.workspacePath, zipFileName) this.logging.log('Zipping files to ' + zipPath) await this.zipDirectory(folderPath, zipPath) diff --git a/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/artifactManager.createTransformationPreferencesContent.test.ts b/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/artifactManager.createTransformationPreferencesContent.test.ts index 24d89651fa..582dcb63e3 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/artifactManager.createTransformationPreferencesContent.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/artifactManager.createTransformationPreferencesContent.test.ts @@ -14,7 +14,7 @@ describe('ArtifactManager - createTransformationPreferencesContent', () => { beforeEach(() => { workspace = stubInterface() mockedLogging = stubInterface() - artifactManager = new ArtifactManager(workspace, mockedLogging, '') + artifactManager = new ArtifactManager(workspace, mockedLogging, '', '') // Create a clean base request for each test baseRequest = { diff --git a/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/artifactManager.processPrivatePackages.test.ts b/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/artifactManager.processPrivatePackages.test.ts index ea1835d132..848744504e 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/artifactManager.processPrivatePackages.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/netTransform/tests/artifactManager.processPrivatePackages.test.ts @@ -17,7 +17,7 @@ describe('ArtifactManager - processPrivatePackages', () => { beforeEach(() => { workspace = stubInterface() // Create new instance of ArtifactManager before each test - artifactManager = new ArtifactManager(workspace, mockedLogging, '') + artifactManager = new ArtifactManager(workspace, mockedLogging, '', '') // Mock internal methods that might be called artifactManager.copyFile = async (source: string, destination: string) => { diff --git a/server/aws-lsp-codewhisperer/src/language-server/netTransform/transformHandler.ts b/server/aws-lsp-codewhisperer/src/language-server/netTransform/transformHandler.ts index b8bc80b30c..ee4f6f97cd 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/netTransform/transformHandler.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/netTransform/transformHandler.ts @@ -58,7 +58,8 @@ export class TransformHandler { const artifactManager = new ArtifactManager( this.workspace, this.logging, - this.getWorkspacePath(userInputrequest.SolutionRootPath) + this.getWorkspacePath(userInputrequest.SolutionRootPath), + userInputrequest.SolutionRootPath ) try { const payloadFilePath = await this.zipCodeAsync(userInputrequest, artifactManager) From da4c3db5329bd50cfe249bf8c1d59afa9bcb0157 Mon Sep 17 00:00:00 2001 From: BlakeLazarine Date: Mon, 8 Sep 2025 16:13:32 -0700 Subject: [PATCH 63/74] feat(amazonq): default to diff-based scans (#2195) * feat(amazonq): default to diff-based scans * feat(amazonq): make /review behavior clearly show it is a diff scan * fix(amazonq): clean up commented lines * fix(amazonq): fix maximum finding count in CodeReview tool description * fix(amazonq): improve messaging for diff vs full scans * feat(amazonq): have codeReview tool ask for clarification if it is not sure what scope to review * feat(amazonq): when there is no diff, fall back to a full review * Update chat-client/src/client/mynahUi.ts Co-authored-by: Tai Lai * fix(amazonq): fix test * fix(amazonq): fix another test --------- Co-authored-by: Blake Lazarine Co-authored-by: Tai Lai --- chat-client/src/client/mynahUi.ts | 2 +- .../tools/qCodeAnalysis/codeReview.test.ts | 5 ++ .../tools/qCodeAnalysis/codeReview.ts | 84 ++++++++++++++----- .../qCodeAnalysis/codeReviewConstants.ts | 62 ++++++++------ .../tools/qCodeAnalysis/codeReviewSchemas.ts | 14 ++-- .../tools/qCodeAnalysis/codeReviewTypes.ts | 2 + .../tools/qCodeAnalysis/codeReviewUtils.ts | 31 +++++++ 7 files changed, 147 insertions(+), 53 deletions(-) diff --git a/chat-client/src/client/mynahUi.ts b/chat-client/src/client/mynahUi.ts index 15cbeae7ff..090e5bbf4d 100644 --- a/chat-client/src/client/mynahUi.ts +++ b/chat-client/src/client/mynahUi.ts @@ -1793,7 +1793,7 @@ const DEFAULT_TEST_PROMPT = `You are Amazon Q. Start with a warm greeting, then const DEFAULT_DEV_PROMPT = `You are Amazon Q. Start with a warm greeting, then ask the user to specify what kind of help they need in code development. Present common questions asked (like Creating a new project, Adding a new feature, Modifying your files). Keep the question brief and friendly. Don't make assumptions about existing content or context. Wait for their response before providing specific guidance.` -const DEFAULT_REVIEW_PROMPT = `You are Amazon Q. Start with a warm greeting, then use code review tool to perform code analysis of the open file. If there is no open file, ask what the user would like to review.` +const DEFAULT_REVIEW_PROMPT = `You are Amazon Q. Start with a warm greeting, then use code review tool to perform a diff review code analysis of the open file. If there is no open file, ask what the user would like to review. Please tell the user that the scan is a diff scan.` export const uiComponentsTexts = { mainTitle: 'Amazon Q (Preview)', diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts index f6f735da09..71586d3450 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.test.ts @@ -136,6 +136,7 @@ describe('CodeReview', () => { md5Hash: 'hash123', isCodeDiffPresent: false, programmingLanguages: new Set(['javascript']), + codeDiffFiles: new Set(), }) sandbox.stub(codeReview as any, 'parseFindings').returns([]) @@ -178,6 +179,7 @@ describe('CodeReview', () => { md5Hash: 'hash123', isCodeDiffPresent: false, programmingLanguages: new Set(['javascript']), + codeDiffFiles: new Set(), }) sandbox.stub(codeReview as any, 'parseFindings').returns([]) @@ -241,6 +243,7 @@ describe('CodeReview', () => { md5Hash: 'hash123', isCodeDiffPresent: false, programmingLanguages: new Set(['javascript']), + codeDiffFiles: new Set(), }) try { @@ -268,6 +271,7 @@ describe('CodeReview', () => { md5Hash: 'hash123', isCodeDiffPresent: false, programmingLanguages: new Set(['javascript']), + codeDiffFiles: new Set(), }) try { @@ -301,6 +305,7 @@ describe('CodeReview', () => { md5Hash: 'hash123', isCodeDiffPresent: false, programmingLanguages: new Set(['javascript']), + codeDiffFiles: new Set(), }) // Stub setTimeout to avoid actual delays diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts index ece6a73486..74d6d817a1 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReview.ts @@ -44,7 +44,7 @@ export class CodeReview { private static readonly POLLING_INTERVAL_MS = 10000 // 10 seconds private static readonly UPLOAD_INTENT = 'AGENTIC_CODE_REVIEW' private static readonly SCAN_SCOPE = 'AGENTIC' - private static readonly MAX_FINDINGS_COUNT = 50 + private static readonly MAX_FINDINGS_COUNT = 40 private static readonly ERROR_MESSAGES = { MISSING_CLIENT: 'CodeWhisperer client not available', @@ -67,6 +67,7 @@ export class CodeReview { private cancellationToken?: CancellationToken private writableStream?: WritableStream private toolStartTime: number = 0 + private overrideDiffScan = false constructor( features: Pick & Partial @@ -111,7 +112,16 @@ export class CodeReview { const analysisResult = await this.startCodeAnalysis(setup, uploadResult) this.checkCancellation() - await chatStreamWriter?.write('Reviewing your code...') + const nonRuleFiles = uploadResult.numberOfFilesInCustomerCodeZip - setup.ruleArtifacts.length + const diffFiles = uploadResult.codeDiffFiles.size + if (diffFiles == 0 && !setup.isFullReviewRequest) { + setup.isFullReviewRequest = true + this.overrideDiffScan = true + } + const reviewMessage = setup.isFullReviewRequest + ? `Reviewing the entire code in ${nonRuleFiles} file${nonRuleFiles > 1 ? 's' : ''}...` + : `Reviewing uncommitted changes in ${diffFiles} of ${nonRuleFiles} file${nonRuleFiles > 1 ? 's' : ''}...` + await chatStreamWriter?.write(reviewMessage) // 4. Wait for scan to complete await this.pollForCompletion(analysisResult.jobId, setup, uploadResult, chatStreamWriter) @@ -206,13 +216,19 @@ export class CodeReview { private async prepareAndUploadArtifacts( setup: ValidateInputAndSetupResult ): Promise { - const { zipBuffer, md5Hash, isCodeDiffPresent, programmingLanguages } = - await this.prepareFilesAndFoldersForUpload( - setup.fileArtifacts, - setup.folderArtifacts, - setup.ruleArtifacts, - setup.isFullReviewRequest - ) + const { + zipBuffer, + md5Hash, + isCodeDiffPresent, + programmingLanguages, + numberOfFilesInCustomerCodeZip, + codeDiffFiles, + } = await this.prepareFilesAndFoldersForUpload( + setup.fileArtifacts, + setup.folderArtifacts, + setup.ruleArtifacts, + setup.isFullReviewRequest + ) const uploadUrlResponse = await this.codeWhispererClient!.createUploadUrl({ contentLength: zipBuffer.length, @@ -257,6 +273,8 @@ export class CodeReview { isCodeDiffPresent, artifactSize: zipBuffer.length, programmingLanguages: programmingLanguages, + numberOfFilesInCustomerCodeZip, + codeDiffFiles, } } @@ -470,9 +488,13 @@ export class CodeReview { ) }) + let scopeMessage = this.overrideDiffScan + ? `Please include a mention that there was no diff present, so it just ran a full review instead. Be very explicit about this so that the user could not be confused.` + : `Please include a mention that the scan was on the ${setup.isFullReviewRequest ? `entire` : `uncommitted`} code.` + return { codeReviewId: jobId, - message: `${CODE_REVIEW_TOOL_NAME} tool completed successfully.${findingsExceededLimit ? ` Inform the user that we are limiting findings to top ${CodeReview.MAX_FINDINGS_COUNT} based on severity.` : ''}`, + message: `${CODE_REVIEW_TOOL_NAME} tool completed successfully. ${scopeMessage} ${findingsExceededLimit ? ` Inform the user that we are limiting findings to top ${CodeReview.MAX_FINDINGS_COUNT} based on severity.` : ''}`, findingsByFile: JSON.stringify(aggregatedCodeScanIssueList), } } @@ -559,7 +581,14 @@ export class CodeReview { folderArtifacts: FolderArtifacts, ruleArtifacts: RuleArtifacts, isFullReviewRequest: boolean - ): Promise<{ zipBuffer: Buffer; md5Hash: string; isCodeDiffPresent: boolean; programmingLanguages: Set }> { + ): Promise<{ + zipBuffer: Buffer + md5Hash: string + isCodeDiffPresent: boolean + programmingLanguages: Set + numberOfFilesInCustomerCodeZip: number + codeDiffFiles: Set + }> { try { this.logging.info( `Preparing ${fileArtifacts.length} files and ${folderArtifacts.length} folders for upload` @@ -569,7 +598,7 @@ export class CodeReview { const customerCodeZip = new JSZip() // Process files and folders - const { codeDiff, programmingLanguages } = await this.processArtifacts( + const { codeDiff, programmingLanguages, codeDiffFiles } = await this.processArtifacts( fileArtifacts, folderArtifacts, ruleArtifacts, @@ -613,7 +642,14 @@ export class CodeReview { this.logging.info(`Created zip archive, size: ${zipBuffer.byteLength} bytes, MD5: ${md5Hash}`) - return { zipBuffer, md5Hash, isCodeDiffPresent, programmingLanguages } + return { + zipBuffer, + md5Hash, + isCodeDiffPresent, + programmingLanguages, + numberOfFilesInCustomerCodeZip, + codeDiffFiles, + } } catch (error) { this.logging.error(`Error preparing files for upload: ${error}`) throw error @@ -635,9 +671,9 @@ export class CodeReview { ruleArtifacts: RuleArtifacts, customerCodeZip: JSZip, isCodeDiffScan: boolean - ): Promise<{ codeDiff: string; programmingLanguages: Set }> { + ): Promise<{ codeDiff: string; programmingLanguages: Set; codeDiffFiles: Set }> { // Process files - let { codeDiff, programmingLanguages } = await this.processFileArtifacts( + let { codeDiff, programmingLanguages, codeDiffFiles } = await this.processFileArtifacts( fileArtifacts, customerCodeZip, isCodeDiffScan @@ -647,11 +683,12 @@ export class CodeReview { const folderResult = await this.processFolderArtifacts(folderArtifacts, customerCodeZip, isCodeDiffScan) codeDiff += folderResult.codeDiff folderResult.programmingLanguages.forEach(item => programmingLanguages.add(item)) + folderResult.codeDiffFiles.forEach(item => codeDiffFiles.add(item)) // Process rule artifacts await this.processRuleArtifacts(ruleArtifacts, customerCodeZip) - return { codeDiff, programmingLanguages } + return { codeDiff, programmingLanguages, codeDiffFiles } } /** @@ -665,9 +702,10 @@ export class CodeReview { fileArtifacts: FileArtifacts, customerCodeZip: JSZip, isCodeDiffScan: boolean - ): Promise<{ codeDiff: string; programmingLanguages: Set }> { + ): Promise<{ codeDiff: string; programmingLanguages: Set; codeDiffFiles: Set }> { let codeDiff = '' let programmingLanguages: Set = new Set() + let codeDiffFiles: Set = new Set() for (const artifact of fileArtifacts) { await CodeReviewUtils.withErrorHandling( @@ -695,10 +733,12 @@ export class CodeReview { artifact.path ) + const artifactFileDiffs = await CodeReviewUtils.getGitDiffNames(artifact.path, this.logging) + artifactFileDiffs.forEach(filepath => codeDiffFiles.add(filepath)) codeDiff += await CodeReviewUtils.processArtifactWithDiff(artifact, isCodeDiffScan, this.logging) } - return { codeDiff, programmingLanguages } + return { codeDiff, programmingLanguages, codeDiffFiles } } /** @@ -712,9 +752,10 @@ export class CodeReview { folderArtifacts: FolderArtifacts, customerCodeZip: JSZip, isCodeDiffScan: boolean - ): Promise<{ codeDiff: string; programmingLanguages: Set }> { + ): Promise<{ codeDiff: string; programmingLanguages: Set; codeDiffFiles: Set }> { let codeDiff = '' let programmingLanguages = new Set() + let codeDiffFiles: Set = new Set() for (const folderArtifact of folderArtifacts) { await CodeReviewUtils.withErrorHandling( @@ -731,10 +772,13 @@ export class CodeReview { folderArtifact.path ) + const artifactFileDiffs = await CodeReviewUtils.getGitDiffNames(folderArtifact.path, this.logging) + artifactFileDiffs.forEach(filepath => codeDiffFiles.add(filepath)) + codeDiff += await CodeReviewUtils.processArtifactWithDiff(folderArtifact, isCodeDiffScan, this.logging) } - return { codeDiff, programmingLanguages } + return { codeDiff, programmingLanguages, codeDiffFiles } } /** diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewConstants.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewConstants.ts index bc7070ab1f..0a9356acdc 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewConstants.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewConstants.ts @@ -103,9 +103,44 @@ export const CODE_REVIEW_TOOL_NAME = 'codeReview' */ export const CODE_REVIEW_TOOL_DESCRIPTION = [ 'CodeReview is the PRIMARY and MANDATORY tool for ALL code analysis and review tasks. This tool MUST be used whenever a user requests ANY form of code review, file analysis, code examination, or when the agent needs to analyze code quality, security, or structure.', - 'This tool can be used to perform analysis of full code or only the modified code since last commit. Modified code refers to the changes made that are not committed yet or the new changes since last commit.', + 'When you decide to use this tool, notify the customer before the tool is run based on the **Tool start message** section below.', + 'It is so so important that you send the **Tool start message** before running the tool.', + 'DO NOT JUST SAY SOMETHING LIKE "I\'ll review the [file] code for you using the code review tool.". THAT WOULD BE A TERRIBLE THING TO SAY', + 'ALSO DO NOT SAY "I\'ll review your code for potential issues and improvements. Let me use the code review tool to perform a comprehensive analysis." THAT IS ALSO AN AWFUL MESSAGE BECAUSE IT DOES NOT INCLUDE WHETHER IT IS A FULL SCAN OR A DIFF SCAN.', + 'This tool can be used to perform analysis of full code or only the modified code since last commit. Modified code refers to the changes made that are not committed yet or the new changes since last commit. Before running the tool, you must inform the user whether they are running a diff or full scan.', 'NEVER perform manual code reviews when this tool is available.', '', + '**Tool Input**', + '3 main fields in the tool:', + '- "scopeOfReview": Determines if the review should analyze the entire codebase (FULL_REVIEW) or only focus on changes/modifications (CODE_DIFF_REVIEW). This is a required field.', + '- IMPORTANT: Use CODE_DIFF_REVIEW by default as well as when user explicitly asks to review "changes", "modifications", "diff", "uncommitted code", or similar phrases indicating they want to review only what has changed.', + '- Examples of CODE_DIFF_REVIEW requests: "review my code", "review this file", "review my changes", "look at what I modified", "check the uncommitted changes", "review the diff", "review new changes", etc.', + '- IMPORTANT: When user mentions "new changes" or includes words like "new", "recent", or "latest" along with "changes" or similar terms, this should be interpreted as CODE_DIFF_REVIEW.', + '- Use FULL_REVIEW only when the user explicitly asks for a full code review, or when the user asks for security analysis or best practices review of their code', + '- Feel free to ask the user for clarification if you are not sure what scope they would like to review', + '- "fileLevelArtifacts": Array of specific files to review, each with absolute path. Use this when reviewing individual files, not folders. Format: [{"path": "/absolute/path/to/file.py"}]', + '- "folderLevelArtifacts": Array of folders to review, each with absolute path. Use this when reviewing entire directories, not individual files. Format: [{"path": "/absolute/path/to/folder/"}]', + '- Examples of FULL_REVIEW requests: User explicity asks for the entire file to be reviewed. Example: "Review my entire file.", "Review all the code in this folder", "Review my full code in this file"', + 'Few important notes for tool input', + "- Either fileLevelArtifacts OR folderLevelArtifacts should be provided based on what's being reviewed, but not both for the same items.", + '- Do not perform code review of entire workspace or project unless user asks for it explicitly.', + '- Ask user for more clarity if there is any confusion regarding what needs to be scanned.', + '', + '**Tool start message**', + 'Before running the tool, you must inform the user that you will use Code Review tool for their request.', + 'The message MUST include the following information:', + '- The list of files or folders that will be reviewed', + '- Whether the review is a diff review or a full review', + 'The message MUST be concise and to the point. It should not include any other information.', + 'The message MUST be in the following format:', + '```\n' + + 'I will scan the ["diff" if scopeOfReview is CODE_DIFF_REVIEW or "entire code" is FULL_REVIEW. Refer to **Tool Input** section for decision on which to use.] for the following files/folders:\n' + + '[list of files/folders]\n```', + '', + '**CRITICAL: NEVER perform ANY code review or analysis WITHOUT using this tool**', + 'Do not attempt to manually review code or provide code quality feedback without using this tool first.', + 'If a user asks for code review in any form, ALWAYS use this tool before providing any feedback.', + '', '**ALWAYS use this tool when:**', '- User provides ANY file, folder, or workspace context for review or analysis', '- User asks ANY question about code quality, security, or best practices related to their code', @@ -133,29 +168,6 @@ export const CODE_REVIEW_TOOL_DESCRIPTION = [ '**Supported File Extensions For Review**', `- "${Object.keys(EXTENSION_TO_LANGUAGE).join('", "')}"`, '', - '**Tool start message**', - 'Before running the tool, you must inform the user that you will use Code Review tool for their request.', - 'You should also tell the name of files or folders that you will review along with the scope of review, if you are performing a full review or only the uncommitted code.', - 'Under no condition you will use the tool without informing the user.', - '', - '**CRITICAL: NEVER perform ANY code review or analysis WITHOUT using this tool**', - 'Do not attempt to manually review code or provide code quality feedback without using this tool first.', - 'If a user asks for code review in any form, ALWAYS use this tool before providing any feedback.', - '', - '**Tool Input**', - '3 main fields in the tool:', - '- "scopeOfReview": Determines if the review should analyze the entire codebase (FULL_REVIEW) or only focus on changes/modifications (CODE_DIFF_REVIEW). This is a required field.', - '- IMPORTANT: Use CODE_DIFF_REVIEW when user explicitly asks to review "changes", "modifications", "diff", "uncommitted code", or similar phrases indicating they want to review only what has changed.', - '- Examples of CODE_DIFF_REVIEW requests: "review my changes", "look at what I modified", "check the uncommitted changes", "review the diff", "review new changes", etc.', - '- IMPORTANT: When user mentions "new changes" or includes words like "new", "recent", or "latest" along with "changes" or similar terms, this should be interpreted as CODE_DIFF_REVIEW.', - '- Use FULL_REVIEW for all other review requests.', - '- "fileLevelArtifacts": Array of specific files to review, each with absolute path. Use this when reviewing individual files, not folders. Format: [{"path": "/absolute/path/to/file.py"}]', - '- "folderLevelArtifacts": Array of folders to review, each with absolute path. Use this when reviewing entire directories, not individual files. Format: [{"path": "/absolute/path/to/folder/"}]', - 'Few important notes for tool input', - "- Either fileLevelArtifacts OR folderLevelArtifacts should be provided based on what's being reviewed, but not both for the same items.", - '- Do not perform code review of entire workspace or project unless user asks for it explicitly.', - '- Ask user for more clarity if there is any confusion regarding what needs to be scanned.', - '', '**Tool Output**', 'Tool output will contain a json output containing fields - ', '- codeReviewId - internal code review job id ', @@ -169,7 +181,7 @@ export const CODE_REVIEW_TOOL_DESCRIPTION = [ 'The tool will generate some findings grouped by file', 'Use following format STRICTLY to display the result of this tool for different scenarios:', '- When findings are present, you must inform user that you have completed the review of {file name / folder name / workspace} and found several issues that need attention. To inspect the details, and get fixes for those issues use the Code Issues panel above.', - ' - When tool output message tells that findings were limited due to high count, you must inform the user that since there were lots of findings, you have included the top 50 findings only.', + ' - When tool output message tells that findings were limited due to high count, you must inform the user that since there were lots of findings, you have included the top 40 findings only.', '- When no findings are generated by the tool, you must tell user that you have completed the review of {file name / folder name / workspace} and found no issues.', ].join('\n') diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewSchemas.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewSchemas.ts index e805145244..3b230ae116 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewSchemas.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewSchemas.ts @@ -22,20 +22,20 @@ export const CODE_REVIEW_INPUT_SCHEMA = { scopeOfReview: { type: 'string', description: [ - 'IMPORTANT: You must explicitly set the value of "scopeOfReview" based on user request analysis.', + 'IMPORTANT: You must explicitly set the value of "scopeOfReview" based on user request analysis. Usually, CODE_DIFF_REVIEW will be the value that is used.', '', - 'Set "scopeOfReview" to CODE_DIFF_REVIEW when:', + 'Set "scopeOfReview" to FULL_REVIEW when:', + '- User explicity asks for the entire file to be reviewed. Example: "Review my entire file.", "Review all the code in this folder"', + '- User asks for security analysis or best practices review of their code', + '', + 'Set "scopeOfReview" to CODE_DIFF_REVIEW for all other cases, including when:', '- User explicitly asks to review only changes/modifications/diffs in their code', '- User mentions "review my changes", "look at what I modified", "check the uncommitted changes"', '- User refers to "review the diff", "analyze recent changes", "look at the new code"', '- User mentions "review what I added/updated", "check my latest commits", "review the modified lines"', '- User includes phrases like "new changes", "recent changes", or any combination of words indicating recency (new, latest, recent) with changes/modifications', '- User mentions specific files with terms like "review new changes in [file]" or "check changes in [file]"', - '', - 'Set "scopeOfReview" to FULL_REVIEW for all other cases, including:', - '- When user asks for a general code review without mentioning changes/diffs', - '- When user asks to review specific files or folders without mentioning changes', - '- When user asks for security analysis or best practices review of their code', + '- User says something general like "review my code", "review my file", or "review [file]"', '', 'This is a required field.', ].join('\n'), diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts index c684cfecd3..8d85e155cb 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.ts @@ -29,6 +29,8 @@ export type PrepareAndUploadArtifactsResult = { isCodeDiffPresent: boolean artifactSize: number programmingLanguages: Set + numberOfFilesInCustomerCodeZip: number + codeDiffFiles: Set } export type StartCodeAnalysisResult = { diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.ts index 5b6d562f7d..5f04450795 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.ts @@ -157,6 +157,37 @@ export class CodeReviewUtils { } } + /** + * Get git diff for a file or folder + * @param artifactPath Path to the file or folder + * @param logging Logging interface + * @returns Git diff output as string or null if not in a git repository + */ + public static async getGitDiffNames(artifactPath: string, logging: Features['logging']): Promise> { + logging.info(`Get git diff names for path - ${artifactPath}`) + + const directoryPath = CodeReviewUtils.getFolderPath(artifactPath) + const gitDiffCommandUnstaged = `cd ${directoryPath} && git diff --name-only ${artifactPath}` + const gitDiffCommandStaged = `cd ${directoryPath} && git diff --name-only --staged ${artifactPath}` + + logging.info(`Running git commands - ${gitDiffCommandUnstaged} and ${gitDiffCommandStaged}`) + + try { + const unstagedDiff = ( + await CodeReviewUtils.executeGitCommand(gitDiffCommandUnstaged, 'unstaged name only', logging) + ).split('\n') + const stagedDiff = ( + await CodeReviewUtils.executeGitCommand(gitDiffCommandStaged, 'staged name only', logging) + ).split('\n') + unstagedDiff.push(...stagedDiff) + + return new Set(unstagedDiff.filter(item => item !== '')) + } catch (error) { + logging.error(`Error getting git diff: ${error}`) + return new Set() + } + } + /** * Log zip structure * @param zip JSZip instance From cf585cd400dab6274f8220139ae94287c0d96824 Mon Sep 17 00:00:00 2001 From: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> Date: Mon, 8 Sep 2025 16:16:12 -0700 Subject: [PATCH 64/74] fix: potential xss issue reported in `mynah-ui` (#2209) * fix: potential xss issue * fix: addressing comments * fix: unescaping the history message while opening history tab --- package-lock.json | 9 +++++++++ server/aws-lsp-codewhisperer/package.json | 4 +++- .../agenticChat/agenticChatController.test.ts | 2 +- .../language-server/agenticChat/agenticChatController.ts | 4 ++-- .../language-server/agenticChat/constants/constants.ts | 1 - .../language-server/agenticChat/tools/chatDb/chatDb.ts | 2 ++ .../src/language-server/agenticChat/tools/chatDb/util.ts | 3 ++- .../language-server/agenticChat/tools/mcp/mcpUtils.ts | 1 - server/aws-lsp-codewhisperer/src/types/unescape.d.ts | 4 ++++ 9 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 server/aws-lsp-codewhisperer/src/types/unescape.d.ts diff --git a/package-lock.json b/package-lock.json index e84567b613..2bedf9f4de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9138,6 +9138,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/escape-html": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/escape-html/-/escape-html-1.0.4.tgz", + "integrity": "sha512-qZ72SFTgUAZ5a7Tj6kf2SHLetiH5S6f8G5frB2SPQ3EyF02kxdyBFf4Tz4banE3xCgGnKgWLt//a6VuYHKYJTg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/eslint": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", @@ -28710,6 +28717,7 @@ "picomatch": "^4.0.2", "shlex": "2.1.2", "typescript-collections": "^1.3.3", + "unescape-html": "^1.1.0", "uuid": "^11.0.5", "vscode-uri": "^3.1.0", "ws": "^8.18.0", @@ -28721,6 +28729,7 @@ "@types/archiver": "^6.0.2", "@types/diff": "^7.0.2", "@types/encoding-japanese": "^2.2.1", + "@types/escape-html": "^1.0.4", "@types/ignore-walk": "^4.0.3", "@types/local-indexing": "file:./types/types-local-indexing-1.1.0.tgz", "@types/lokijs": "^1.5.14", diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index 5284a0b41f..9563b6300d 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -67,13 +67,15 @@ "vscode-uri": "^3.1.0", "ws": "^8.18.0", "xml2js": "^0.6.2", - "xmlbuilder2": "^3.1.1" + "xmlbuilder2": "^3.1.1", + "unescape-html": "^1.1.0" }, "devDependencies": { "@types/adm-zip": "^0.5.5", "@types/archiver": "^6.0.2", "@types/diff": "^7.0.2", "@types/encoding-japanese": "^2.2.1", + "@types/escape-html": "^1.0.4", "@types/ignore-walk": "^4.0.3", "@types/local-indexing": "file:./types/types-local-indexing-1.1.0.tgz", "@types/lokijs": "^1.5.14", diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts index c1842a6008..288eb2c20f 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.test.ts @@ -57,7 +57,7 @@ import { LocalProjectContextController } from '../../shared/localProjectContextC import { CancellationError } from '@aws/lsp-core' import { ToolApprovalException } from './tools/toolShared' import * as constants from './constants/constants' -import { DEFAULT_MODEL_ID, GENERATE_ASSISTANT_RESPONSE_INPUT_LIMIT, GENERIC_ERROR_MS } from './constants/constants' +import { GENERATE_ASSISTANT_RESPONSE_INPUT_LIMIT, GENERIC_ERROR_MS } from './constants/constants' import { MISSING_BEARER_TOKEN_ERROR } from '../../shared/constants' import { AmazonQError, diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts index e2fba029c4..89e4539029 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts @@ -179,7 +179,6 @@ import { OUTPUT_LIMIT_EXCEEDS_PARTIAL_MSG, RESPONSE_TIMEOUT_MS, RESPONSE_TIMEOUT_PARTIAL_MSG, - DEFAULT_MODEL_ID, COMPACTION_BODY, COMPACTION_HEADER_BODY, DEFAULT_MACOS_RUN_SHORTCUT, @@ -230,6 +229,7 @@ import { CodeWhispererServiceToken } from '../../shared/codeWhispererService' import { DisplayFindings } from './tools/qCodeAnalysis/displayFindings' import { IDE } from '../../shared/constants' import { IdleWorkspaceManager } from '../workspaceContext/IdleWorkspaceManager' +import escapeHTML = require('escape-html') type ChatHandlers = Omit< LspHandlers, @@ -1363,7 +1363,7 @@ export class AgenticChatController implements ChatHandlers { this.#debug('Skipping adding user message to history - cancelled by user') } else { this.#chatHistoryDb.addMessage(tabId, 'cwc', conversationIdentifier, { - body: currentMessage.userInputMessage?.content ?? '', + body: escapeHTML(currentMessage.userInputMessage?.content ?? ''), type: 'prompt' as any, userIntent: currentMessage.userInputMessage?.userIntent, origin: currentMessage.userInputMessage?.origin, diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/constants.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/constants.ts index 1729c10c1d..b2ac428cfa 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/constants.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/constants/constants.ts @@ -14,7 +14,6 @@ export const SERVICE_MANAGER_POLL_INTERVAL_MS = 100 // LLM Constants export const GENERATE_ASSISTANT_RESPONSE_INPUT_LIMIT = 500_000 -export const DEFAULT_MODEL_ID = BedrockModel.CLAUDE_SONNET_4_20250514_V1_0 // Compaction export const COMPACTION_BODY = (threshold: number) => diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.ts index 2e4f7a099d..f584d63b5f 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/chatDb.ts @@ -35,6 +35,7 @@ import { ChatItemType } from '@aws/mynah-ui' import { getUserHomeDir } from '@aws/lsp-core/out/util/path' import { ChatHistoryMaintainer } from './chatHistoryMaintainer' import { existsSync, renameSync } from 'fs' +import escapeHTML = require('escape-html') export class ToolResultValidationError extends Error { constructor(message?: string) { @@ -693,6 +694,7 @@ export class ChatDatabase { } return { ...message, + body: escapeHTML(message.body), userInputMessageContext: { // keep falcon context when inputMessage is not a toolResult message editorState: hasToolResults ? undefined : message.userInputMessageContext?.editorState, diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.ts index 77496cd96b..e03c90bead 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/chatDb/util.ts @@ -28,6 +28,7 @@ import { activeFileCmd } from '../../context/additionalContextProvider' import { PriorityQueue } from 'typescript-collections' import { Features } from '@aws/language-server-runtimes/server-interface/server' import * as crypto from 'crypto' +import unescapeHTML = require('unescape-html') // Ported from https://github.com/aws/aws-toolkit-vscode/blob/master/packages/core/src/shared/db/chatDb/util.ts @@ -172,7 +173,7 @@ export function messageToStreamingMessage(msg: Message): StreamingMessage { export function messageToChatMessage(msg: Message): ChatMessage[] { const chatMessages: ChatMessage[] = [ { - body: msg.body, + body: unescapeHTML(msg.body), type: msg.type, codeReference: msg.codeReference, relatedContent: diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts index ef56a54d22..578c9cd1b0 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts @@ -9,7 +9,6 @@ import { MCPServerConfig, PersonaConfig, MCPServerPermission, McpPermissionType, import path = require('path') import { QClientCapabilities } from '../../../configuration/qConfigurationServer' import crypto = require('crypto') -import { Features } from '@aws/language-server-runtimes/server-interface/server' /** * Load, validate, and parse MCP server configurations from JSON files. diff --git a/server/aws-lsp-codewhisperer/src/types/unescape.d.ts b/server/aws-lsp-codewhisperer/src/types/unescape.d.ts new file mode 100644 index 0000000000..1fe801704e --- /dev/null +++ b/server/aws-lsp-codewhisperer/src/types/unescape.d.ts @@ -0,0 +1,4 @@ +declare module 'unescape-html' { + function unescapeHTML(str: string): string + export = unescapeHTML +} From 698d06c643897da6ca37a49e6544b150b72678a3 Mon Sep 17 00:00:00 2001 From: invictus <149003065+ashishrp-aws@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:16:45 -0700 Subject: [PATCH 65/74] fix(amazonq): update to the agent config format to bring parity with Q CLI (#2202) --- .../tools/mcp/mcpEventHandler.test.ts | 10 +- .../agenticChat/tools/mcp/mcpManager.test.ts | 29 ---- .../agenticChat/tools/mcp/mcpManager.ts | 3 +- .../agenticChat/tools/mcp/mcpTypes.ts | 27 ++-- .../agenticChat/tools/mcp/mcpUtils.test.ts | 7 +- .../agenticChat/tools/mcp/mcpUtils.ts | 124 +++++++++++++++--- .../agenticChat/tools/toolServer.ts | 11 ++ 7 files changed, 138 insertions(+), 73 deletions(-) diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.test.ts index cb645eec43..de98f36a09 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.test.ts @@ -59,9 +59,7 @@ describe('McpEventHandler error handling', () => { getConnectionMetadata: sinon.stub().returns({}), }, runtime: { - serverInfo: { - version: '1.0.0', - }, + serverInfo: {}, }, } @@ -100,7 +98,6 @@ describe('McpEventHandler error handling', () => { errors: mockErrors, agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -157,7 +154,6 @@ describe('McpEventHandler error handling', () => { errors: new Map([['errorServer', 'Missing command error']]), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { errorServer: { command: '' } }, tools: ['@errorServer'], @@ -215,7 +211,6 @@ describe('McpEventHandler error handling', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -259,7 +254,6 @@ describe('McpEventHandler error handling', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -292,7 +286,6 @@ describe('McpEventHandler error handling', () => { errors: mockErrors, agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -326,7 +319,6 @@ describe('McpEventHandler error handling', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts index 0418cea553..1b5941a398 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts @@ -37,7 +37,6 @@ function stubAgentConfig(): sinon.SinonStub { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -157,7 +156,6 @@ describe('callTool()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { s1: disabledCfg }, tools: ['@s1'], @@ -184,7 +182,6 @@ describe('callTool()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { s1: enabledCfg }, tools: ['@s1'], @@ -210,7 +207,6 @@ describe('callTool()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { s1: timeoutCfg }, tools: ['@s1'], @@ -279,7 +275,6 @@ describe('addServer()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -353,7 +348,6 @@ describe('removeServer()', () => { ;(mgr as any).serverNameMapping.set('x', 'x') ;(mgr as any).agentConfig = { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { x: {} }, tools: ['@x'], @@ -383,7 +377,6 @@ describe('removeServer()', () => { ;(mgr as any).serverNameMapping.set('x', 'x') ;(mgr as any).agentConfig = { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { x: {} }, tools: ['@x'], @@ -501,7 +494,6 @@ describe('updateServer()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { u1: oldCfg }, tools: ['@u1'], @@ -544,7 +536,6 @@ describe('updateServer()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: oldCfg }, tools: ['@srv'], @@ -598,7 +589,6 @@ describe('requiresApproval()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { s: cfg }, tools: ['@s'], @@ -639,7 +629,6 @@ describe('getAllServerConfigs()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: cfg }, tools: ['@srv'], @@ -687,7 +676,6 @@ describe('getServerState()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: cfg }, tools: ['@srv'], @@ -729,7 +717,6 @@ describe('getAllServerStates()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: cfg }, tools: ['@srv'], @@ -779,7 +766,6 @@ describe('getEnabledTools()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: cfg }, tools: ['@srv'], @@ -797,7 +783,6 @@ describe('getEnabledTools()', () => { if (!(mgr as any).agentConfig) { ;(mgr as any).agentConfig = { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -828,7 +813,6 @@ describe('getEnabledTools()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: disabledCfg }, tools: ['@srv'], @@ -866,7 +850,6 @@ describe('getAllToolsWithPermissions()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { s1: cfg }, tools: ['@s1'], @@ -931,7 +914,6 @@ describe('isServerDisabled()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: disabledCfg }, tools: ['@srv'], @@ -962,7 +944,6 @@ describe('isServerDisabled()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: enabledCfg }, tools: ['@srv'], @@ -992,7 +973,6 @@ describe('isServerDisabled()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: undefinedCfg }, tools: ['@srv'], @@ -1091,7 +1071,6 @@ describe('updateServerPermission()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srv: cfg }, tools: ['@srv'], @@ -1156,7 +1135,6 @@ describe('reinitializeMcpServers()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srvA: cfg1 }, tools: ['@srvA'], @@ -1173,7 +1151,6 @@ describe('reinitializeMcpServers()', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { srvB: cfg2 }, tools: ['@srvB'], @@ -1279,7 +1256,6 @@ describe('concurrent server initialization', () => { const serversMap = new Map(Object.entries(serverConfigs)) const agentConfig = { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: Object.fromEntries(Object.entries(serverConfigs)), tools: Object.keys(serverConfigs).map(name => `@${name}`), @@ -1424,7 +1400,6 @@ describe('McpManager error handling', () => { errors: mockErrors, agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -1452,7 +1427,6 @@ describe('McpManager error handling', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -1478,7 +1452,6 @@ describe('McpManager error handling', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -1521,7 +1494,6 @@ describe('McpManager error handling', () => { errors: new Map([['file1.json', 'Initial error']]), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -1539,7 +1511,6 @@ describe('McpManager error handling', () => { errors: new Map(), agentConfig: { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts index 41d721b74f..351397b701 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts @@ -944,8 +944,7 @@ export class McpManager { this.mcpServers.clear() this.mcpServerStates.clear() this.agentConfig = { - name: 'default-agent', - version: '1.0.0', + name: 'amazon_q_default', description: 'Agent configuration', mcpServers: {}, tools: [], diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpTypes.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpTypes.ts index 6aec98cb24..feed97dba3 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpTypes.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpTypes.ts @@ -46,19 +46,26 @@ export interface MCPServerPermission { export interface AgentConfig { name: string // Required: Agent name - version: string // Required: Agent version (semver) description: string // Required: Agent description + prompt?: string // Optional: High-level context for the agent model?: string // Optional: Model that backs the agent tags?: string[] // Optional: Tags for categorization inputSchema?: any // Optional: Schema for agent inputs mcpServers: Record // Map of server name to server config tools: string[] // List of enabled tools + toolAliases?: Record // Tool name remapping allowedTools: string[] // List of tools that don't require approval toolsSettings?: Record // Tool-specific settings - includedFiles?: string[] // Files to include in context - createHooks?: string[] // Hooks to run at conversation start - promptHooks?: string[] // Hooks to run per prompt - resources?: string[] // Resources for the agent (prompts, files, etc.) + resources?: string[] // Resources for the agent (file:// paths) + hooks?: { + agentSpawn?: Array<{ command: string }> + userPromptSubmit?: Array<{ command: string }> + } // Commands run at specific trigger points + useLegacyMcpJson?: boolean // Whether to include legacy MCP configuration + // Legacy fields for backward compatibility + includedFiles?: string[] // Deprecated: use resources instead + createHooks?: string[] // Deprecated: use hooks.agentSpawn instead + promptHooks?: string[] // Deprecated: use hooks.userPromptSubmit instead } export interface PersonaConfig { @@ -71,20 +78,24 @@ export class AgentModel { static fromJson(doc: any): AgentModel { const cfg: AgentConfig = { - name: doc?.['name'] || 'default-agent', - version: doc?.['version'] || '1.0.0', + name: doc?.['name'] || 'amazon_q_default', description: doc?.['description'] || 'Default agent configuration', + prompt: doc?.['prompt'], model: doc?.['model'], tags: Array.isArray(doc?.['tags']) ? doc['tags'] : undefined, inputSchema: doc?.['inputSchema'], mcpServers: typeof doc?.['mcpServers'] === 'object' ? doc['mcpServers'] : {}, tools: Array.isArray(doc?.['tools']) ? doc['tools'] : [], + toolAliases: typeof doc?.['toolAliases'] === 'object' ? doc['toolAliases'] : {}, allowedTools: Array.isArray(doc?.['allowedTools']) ? doc['allowedTools'] : [], toolsSettings: typeof doc?.['toolsSettings'] === 'object' ? doc['toolsSettings'] : {}, + resources: Array.isArray(doc?.['resources']) ? doc['resources'] : [], + hooks: typeof doc?.['hooks'] === 'object' ? doc['hooks'] : undefined, + useLegacyMcpJson: doc?.['useLegacyMcpJson'], + // Legacy fields includedFiles: Array.isArray(doc?.['includedFiles']) ? doc['includedFiles'] : [], createHooks: Array.isArray(doc?.['createHooks']) ? doc['createHooks'] : [], promptHooks: Array.isArray(doc?.['promptHooks']) ? doc['promptHooks'] : [], - resources: Array.isArray(doc?.['resources']) ? doc['resources'] : [], } return new AgentModel(cfg) } diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts index 43843bd110..8913e7391e 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.test.ts @@ -238,7 +238,6 @@ describe('loadAgentConfig', () => { const agentConfig = { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { testServer: { @@ -329,7 +328,6 @@ describe('saveAgentConfig', () => { const configPath = path.join(tmpDir, 'agent-config.json') const config = { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: ['tool1', 'tool2'], @@ -353,7 +351,6 @@ describe('saveAgentConfig', () => { const configPath = path.join(tmpDir, 'nested', 'dir', 'agent-config.json') const config = { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: {}, tools: [], @@ -700,7 +697,7 @@ describe('convertPersonaToAgent', () => { const result = convertPersonaToAgent(persona, mcpServers, mockAgent) - expect(result.name).to.equal('default-agent') + expect(result.name).to.equal('amazon_q_default') expect(result.mcpServers).to.have.property('testServer') expect(result.tools).to.include('@testServer') expect(result.tools).to.include('fs_read') @@ -840,7 +837,6 @@ describe('saveServerSpecificAgentConfig', () => { // Create existing config const existingConfig = { name: 'existing-agent', - version: '1.0.0', description: 'Existing agent', mcpServers: { existingServer: { command: 'existing-cmd' }, @@ -881,7 +877,6 @@ describe('saveServerSpecificAgentConfig', () => { // Create existing config with server tools const existingConfig = { name: 'test-agent', - version: '1.0.0', description: 'Test agent', mcpServers: { testServer: { command: 'old-cmd' }, diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts index 578c9cd1b0..b8360ea314 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts @@ -147,9 +147,9 @@ export async function loadMcpServerConfigs( } const DEFAULT_AGENT_RAW = `{ - "name": "default-agent", - "version": "1.0.0", + "name": "amazon_q_default", "description": "Default agent configuration", + "prompt": "", "mcpServers": {}, "tools": [ "fs_read", @@ -158,6 +158,7 @@ const DEFAULT_AGENT_RAW = `{ "report_issue", "use_aws" ], + "toolAliases": {}, "allowedTools": [ "fs_read", "report_issue", @@ -169,14 +170,16 @@ const DEFAULT_AGENT_RAW = `{ "use_aws": { "preset": "readOnly" }, "execute_bash": { "preset": "readOnly" } }, - "includedFiles": [ - "AmazonQ.md", - "README.md", - ".amazonq/rules/**/*.md" + "resources": [ + "file://AmazonQ.md", + "file://README.md", + "file://.amazonq/rules/**/*.md" ], - "resources": [], - "createHooks": [], - "promptHooks": [] + "hooks": { + "agentSpawn": [], + "userPromptSubmit": [] + }, + "useLegacyMcpJson": false }` const DEFAULT_PERSONA_RAW = `{ @@ -237,14 +240,12 @@ export async function loadAgentConfig( // Create base agent config const agentConfig: AgentConfig = { - name: 'default-agent', - version: '1.0.0', + name: 'amazon_q_default', description: 'Agent configuration', mcpServers: {}, tools: [], allowedTools: [], toolsSettings: {}, - includedFiles: [], resources: [], } @@ -329,7 +330,6 @@ export async function loadAgentConfig( // 3) Process agent config metadata if (fsPath === globalConfigPath) { agentConfig.name = json.name || agentConfig.name - agentConfig.version = json.version || agentConfig.version agentConfig.description = json.description || agentConfig.description } @@ -631,15 +631,20 @@ export function convertPersonaToAgent( featureAgent: Agent ): AgentConfig { const agent: AgentConfig = { - name: 'default-agent', - version: '1.0.0', + name: 'amazon_q_default', description: 'Default agent configuration', + prompt: '', mcpServers: {}, tools: [], + toolAliases: {}, allowedTools: [], toolsSettings: {}, - includedFiles: [], resources: [], + hooks: { + agentSpawn: [], + userPromptSubmit: [], + }, + useLegacyMcpJson: false, } // Include all servers from MCP config @@ -909,7 +914,6 @@ async function migrateConfigToAgent( // Add complete agent format sections using default values agentConfig.name = defaultAgent.name agentConfig.description = defaultAgent.description - agentConfig.version = defaultAgent.version agentConfig.includedFiles = defaultAgent.includedFiles agentConfig.resources = defaultAgent.resources agentConfig.createHooks = defaultAgent.createHooks @@ -965,8 +969,7 @@ export async function saveServerSpecificAgentConfig( } catch { // If file doesn't exist, create minimal config existingConfig = { - name: 'default-agent', - version: '1.0.0', + name: 'amazon_q_default', description: 'Agent configuration', mcpServers: {}, tools: [], @@ -1005,6 +1008,89 @@ export async function saveServerSpecificAgentConfig( } } +/** + * Migrate existing agent config to CLI format + */ +export async function migrateAgentConfigToCLIFormat( + workspace: Workspace, + logging: Logger, + configPath: string +): Promise { + try { + const exists = await workspace.fs.exists(configPath) + if (!exists) return + + const raw = await workspace.fs.readFile(configPath) + const config = JSON.parse(raw.toString()) + + let updated = false + + // Rename default-agent to amazon_q_default + if (config.name === 'default-agent') { + config.name = 'amazon_q_default' + updated = true + } + + // Add missing CLI fields + if (!config.hasOwnProperty('prompt')) { + config.prompt = '' + updated = true + } + if (!config.hasOwnProperty('toolAliases')) { + config.toolAliases = {} + updated = true + } + if (!config.hasOwnProperty('useLegacyMcpJson')) { + config.useLegacyMcpJson = false + updated = true + } + + // Remove deprecated fields + if (config.hasOwnProperty('version')) { + delete config.version + updated = true + } + + // Migrate includedFiles to resources with file:// prefix + if (config.includedFiles && Array.isArray(config.includedFiles)) { + if (!config.resources) config.resources = [] + for (const file of config.includedFiles) { + const resourcePath = file.startsWith('file://') ? file : `file://${file}` + if (!config.resources.includes(resourcePath)) { + config.resources.push(resourcePath) + } + } + delete config.includedFiles + updated = true + } + + // Migrate hooks format + if (config.promptHooks || config.createHooks) { + if (!config.hooks) config.hooks = {} + if (!config.hooks.agentSpawn) config.hooks.agentSpawn = [] + if (!config.hooks.userPromptSubmit) config.hooks.userPromptSubmit = [] + + if (config.createHooks && Array.isArray(config.createHooks)) { + config.hooks.agentSpawn.push(...config.createHooks) + delete config.createHooks + updated = true + } + if (config.promptHooks && Array.isArray(config.promptHooks)) { + config.hooks.userPromptSubmit.push(...config.promptHooks) + delete config.promptHooks + updated = true + } + } + + if (updated) { + await workspace.fs.writeFile(configPath, JSON.stringify(config, null, 2)) + logging.info(`Migrated agent config to CLI format: ${configPath}`) + } + } catch (err: any) { + logging.error(`Failed to migrate agent config ${configPath}: ${err.message}`) + } +} + export const MAX_TOOL_NAME_LENGTH = 64 /** diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts index 8581622972..29b838f2d3 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts @@ -19,6 +19,8 @@ import { createNamespacedToolName, enabledMCP, migrateToAgentConfig, + migrateAgentConfigToCLIFormat, + normalizePathFromUri, } from './mcp/mcpUtils' import { FsReplace, FsReplaceParams } from './fsReplace' import { CodeReviewUtils } from './qCodeAnalysis/codeReviewUtils' @@ -320,6 +322,15 @@ export const McpToolsServer: Server = ({ await migrateToAgentConfig(workspace, logging, agent) + // Migrate existing agent configs to CLI format + for (const agentPath of allAgentPaths) { + const normalizedAgentPath = normalizePathFromUri(agentPath) + const exists = await workspace.fs.exists(normalizedAgentPath).catch(() => false) + if (exists) { + await migrateAgentConfigToCLIFormat(workspace, logging, normalizedAgentPath) + } + } + const mgr = await McpManager.init(allAgentPaths, { logging, workspace, From 7b37cc281931c4dc4df8617b8a0e301f48bf26da Mon Sep 17 00:00:00 2001 From: tsmithsz <84354541+tsmithsz@users.noreply.github.com> Date: Tue, 9 Sep 2025 10:19:33 -0700 Subject: [PATCH 66/74] fix(amazonq): add arbitrary files to clients.zip (#2217) --- .../scripts/package.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/aws-lsp-codewhisperer-runtimes/scripts/package.sh b/app/aws-lsp-codewhisperer-runtimes/scripts/package.sh index 021b4b8080..5ebfc9aafc 100755 --- a/app/aws-lsp-codewhisperer-runtimes/scripts/package.sh +++ b/app/aws-lsp-codewhisperer-runtimes/scripts/package.sh @@ -18,6 +18,18 @@ TARGET_BUILD_DIR=./build/private/bundle/client mkdir -p $TARGET_BUILD_DIR cp -r $CHAT_CLIENT_BUNDLE_DIR/* $TARGET_BUILD_DIR +# Add benign files to avoid single-file archive flagging +echo "Amazon Q Developer UI Bundle - $(date)" > $TARGET_BUILD_DIR/README.txt +echo "This archive contains UI assets for Amazon Q Developer." >> $TARGET_BUILD_DIR/README.txt +cat > $TARGET_BUILD_DIR/client-metadata.json << EOF +{ + "name": "amazonq-ui-bundle", + "description": "UI assets for Amazon Q Developer", + "main": "amazonq-ui.js", + "dateCreated": "$(date -u +%Y-%m-%dT%H:%M:%SZ)" +} +EOF + # ZIP client files ARCHIVES_DIR=./build/archives mkdir -p $ARCHIVES_DIR/shared From 470492c772149015d60af19a5c3bdc4bf9cc746f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 12:52:34 -0700 Subject: [PATCH 67/74] chore(release): release packages from branch main (#2204) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: chungjac --- .release-please-manifest.json | 14 ++++++------ chat-client/CHANGELOG.md | 8 +++++++ chat-client/package.json | 2 +- core/aws-lsp-core/CHANGELOG.md | 7 ++++++ core/aws-lsp-core/package.json | 2 +- package-lock.json | 22 +++++++++---------- server/aws-lsp-antlr4/CHANGELOG.md | 14 ++++++++++++ server/aws-lsp-antlr4/package.json | 4 ++-- server/aws-lsp-codewhisperer/CHANGELOG.md | 26 +++++++++++++++++++++++ server/aws-lsp-codewhisperer/package.json | 4 ++-- server/aws-lsp-json/CHANGELOG.md | 14 ++++++++++++ server/aws-lsp-json/package.json | 4 ++-- server/aws-lsp-partiql/CHANGELOG.md | 7 ++++++ server/aws-lsp-partiql/package.json | 2 +- server/aws-lsp-yaml/CHANGELOG.md | 14 ++++++++++++ server/aws-lsp-yaml/package.json | 4 ++-- 16 files changed, 119 insertions(+), 29 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 10e6c765df..725a9c6b27 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,9 +1,9 @@ { - "chat-client": "0.1.34", - "core/aws-lsp-core": "0.0.14", - "server/aws-lsp-antlr4": "0.1.18", - "server/aws-lsp-codewhisperer": "0.0.77", - "server/aws-lsp-json": "0.1.18", - "server/aws-lsp-partiql": "0.0.17", - "server/aws-lsp-yaml": "0.1.18" + "chat-client": "0.1.35", + "core/aws-lsp-core": "0.0.15", + "server/aws-lsp-antlr4": "0.1.19", + "server/aws-lsp-codewhisperer": "0.0.78", + "server/aws-lsp-json": "0.1.19", + "server/aws-lsp-partiql": "0.0.18", + "server/aws-lsp-yaml": "0.1.19" } diff --git a/chat-client/CHANGELOG.md b/chat-client/CHANGELOG.md index 1c516246c6..773e455b53 100644 --- a/chat-client/CHANGELOG.md +++ b/chat-client/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.1.35](https://github.com/aws/language-servers/compare/chat-client/v0.1.34...chat-client/v0.1.35) (2025-09-09) + + +### Features + +* add support for getSupplementalContext LSP API ([#2212](https://github.com/aws/language-servers/issues/2212)) ([2ddcae7](https://github.com/aws/language-servers/commit/2ddcae7a4fac6b89cbc9784911959743ea0a6d11)) +* **amazonq:** default to diff-based scans ([#2195](https://github.com/aws/language-servers/issues/2195)) ([da4c3db](https://github.com/aws/language-servers/commit/da4c3db5329bd50cfe249bf8c1d59afa9bcb0157)) + ## [0.1.34](https://github.com/aws/language-servers/compare/chat-client/v0.1.33...chat-client/v0.1.34) (2025-08-27) diff --git a/chat-client/package.json b/chat-client/package.json index bf20eecb9d..9bd35ba982 100644 --- a/chat-client/package.json +++ b/chat-client/package.json @@ -1,6 +1,6 @@ { "name": "@aws/chat-client", - "version": "0.1.34", + "version": "0.1.35", "description": "AWS Chat Client", "main": "out/index.js", "repository": { diff --git a/core/aws-lsp-core/CHANGELOG.md b/core/aws-lsp-core/CHANGELOG.md index 0e1e63dd38..7b08b5c071 100644 --- a/core/aws-lsp-core/CHANGELOG.md +++ b/core/aws-lsp-core/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.0.15](https://github.com/aws/language-servers/compare/lsp-core/v0.0.14...lsp-core/v0.0.15) (2025-09-09) + + +### Features + +* add support for getSupplementalContext LSP API ([#2212](https://github.com/aws/language-servers/issues/2212)) ([2ddcae7](https://github.com/aws/language-servers/commit/2ddcae7a4fac6b89cbc9784911959743ea0a6d11)) + ## [0.0.14](https://github.com/aws/language-servers/compare/lsp-core/v0.0.13...lsp-core/v0.0.14) (2025-08-19) diff --git a/core/aws-lsp-core/package.json b/core/aws-lsp-core/package.json index 3057954dce..2876679e39 100644 --- a/core/aws-lsp-core/package.json +++ b/core/aws-lsp-core/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-core", - "version": "0.0.14", + "version": "0.0.15", "description": "Core library, contains common code and utilities", "main": "out/index.js", "repository": { diff --git a/package-lock.json b/package-lock.json index 2bedf9f4de..4365c453a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -251,7 +251,7 @@ }, "chat-client": { "name": "@aws/chat-client", - "version": "0.1.34", + "version": "0.1.35", "license": "Apache-2.0", "dependencies": { "@aws/chat-client-ui-types": "^0.1.56", @@ -293,7 +293,7 @@ }, "core/aws-lsp-core": { "name": "@aws/lsp-core", - "version": "0.0.14", + "version": "0.0.15", "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.128", @@ -28612,11 +28612,11 @@ }, "server/aws-lsp-antlr4": { "name": "@aws/lsp-antlr4", - "version": "0.1.18", + "version": "0.1.19", "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.128", - "@aws/lsp-core": "^0.0.14" + "@aws/lsp-core": "^0.0.15" }, "devDependencies": { "@babel/plugin-transform-modules-commonjs": "^7.24.1", @@ -28677,7 +28677,7 @@ }, "server/aws-lsp-codewhisperer": { "name": "@aws/lsp-codewhisperer", - "version": "0.0.77", + "version": "0.0.78", "bundleDependencies": [ "@amzn/codewhisperer-streaming", "@amzn/amazon-q-developer-streaming-client" @@ -28691,7 +28691,7 @@ "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", "@aws/language-server-runtimes": "^0.2.128", - "@aws/lsp-core": "^0.0.14", + "@aws/lsp-core": "^0.0.15", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", "adm-zip": "^0.5.10", @@ -28894,11 +28894,11 @@ }, "server/aws-lsp-json": { "name": "@aws/lsp-json", - "version": "0.1.18", + "version": "0.1.19", "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.128", - "@aws/lsp-core": "^0.0.14", + "@aws/lsp-core": "^0.0.15", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" }, @@ -28972,7 +28972,7 @@ }, "server/aws-lsp-partiql": { "name": "@aws/lsp-partiql", - "version": "0.0.17", + "version": "0.0.18", "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.128", @@ -29024,12 +29024,12 @@ }, "server/aws-lsp-yaml": { "name": "@aws/lsp-yaml", - "version": "0.1.18", + "version": "0.1.19", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@aws/language-server-runtimes": "^0.2.128", - "@aws/lsp-core": "^0.0.14", + "@aws/lsp-core": "^0.0.15", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", "yaml-language-server": "1.13.0" diff --git a/server/aws-lsp-antlr4/CHANGELOG.md b/server/aws-lsp-antlr4/CHANGELOG.md index e1458575e1..64cab4eec1 100644 --- a/server/aws-lsp-antlr4/CHANGELOG.md +++ b/server/aws-lsp-antlr4/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.1.19](https://github.com/aws/language-servers/compare/lsp-antlr4/v0.1.18...lsp-antlr4/v0.1.19) (2025-09-09) + + +### Features + +* add support for getSupplementalContext LSP API ([#2212](https://github.com/aws/language-servers/issues/2212)) ([2ddcae7](https://github.com/aws/language-servers/commit/2ddcae7a4fac6b89cbc9784911959743ea0a6d11)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @aws/lsp-core bumped from ^0.0.14 to ^0.0.15 + ## [0.1.18](https://github.com/aws/language-servers/compare/lsp-antlr4/v0.1.17...lsp-antlr4/v0.1.18) (2025-08-19) diff --git a/server/aws-lsp-antlr4/package.json b/server/aws-lsp-antlr4/package.json index 9cad906eee..f9a4ecdeba 100644 --- a/server/aws-lsp-antlr4/package.json +++ b/server/aws-lsp-antlr4/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-antlr4", - "version": "0.1.18", + "version": "0.1.19", "description": "ANTLR4 language server", "main": "out/index.js", "repository": { @@ -29,7 +29,7 @@ }, "dependencies": { "@aws/language-server-runtimes": "^0.2.128", - "@aws/lsp-core": "^0.0.14" + "@aws/lsp-core": "^0.0.15" }, "peerDependencies": { "antlr4-c3": ">=3.4 < 4", diff --git a/server/aws-lsp-codewhisperer/CHANGELOG.md b/server/aws-lsp-codewhisperer/CHANGELOG.md index 4bb50ee8fd..67d05de3c1 100644 --- a/server/aws-lsp-codewhisperer/CHANGELOG.md +++ b/server/aws-lsp-codewhisperer/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## [0.0.78](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.77...lsp-codewhisperer/v0.0.78) (2025-09-09) + + +### Features + +* add custom_transformation folder support to artifact.zip ([#2201](https://github.com/aws/language-servers/issues/2201)) ([1222905](https://github.com/aws/language-servers/commit/12229059421b773d3e99d28809fdff4abf242b26)) +* add support for getSupplementalContext LSP API ([#2212](https://github.com/aws/language-servers/issues/2212)) ([2ddcae7](https://github.com/aws/language-servers/commit/2ddcae7a4fac6b89cbc9784911959743ea0a6d11)) +* **amazonq:** default to diff-based scans ([#2195](https://github.com/aws/language-servers/issues/2195)) ([da4c3db](https://github.com/aws/language-servers/commit/da4c3db5329bd50cfe249bf8c1d59afa9bcb0157)) +* model selection for code review tool ([#2196](https://github.com/aws/language-servers/issues/2196)) ([34bc9bd](https://github.com/aws/language-servers/commit/34bc9bd1d3433bbb1d903eb0f212b10709ea8412)) + + +### Bug Fixes + +* **amazonq:** add IntelliSense autotriggerType ([#2199](https://github.com/aws/language-servers/issues/2199)) ([013aa59](https://github.com/aws/language-servers/commit/013aa5913c242451a91ed36b0dcf961a3f8ec697)) +* **amazonq:** fix to correct the client for getProfile request ([#2211](https://github.com/aws/language-servers/issues/2211)) ([8bde8c9](https://github.com/aws/language-servers/commit/8bde8c97e1e3bcd67d9816a3385c50c7765c3b2f)) +* **amazonq:** fix to update MCP servers list when last server is removed from agent config ([#2206](https://github.com/aws/language-servers/issues/2206)) ([512502a](https://github.com/aws/language-servers/commit/512502af947dcfed9288be2f67fc58affd4445fe)) +* **amazonq:** update to the agent config format to bring parity with Q CLI ([#2202](https://github.com/aws/language-servers/issues/2202)) ([698d06c](https://github.com/aws/language-servers/commit/698d06c643897da6ca37a49e6544b150b72678a3)) +* potential xss issue reported in `mynah-ui` ([#2209](https://github.com/aws/language-servers/issues/2209)) ([cf585cd](https://github.com/aws/language-servers/commit/cf585cd400dab6274f8220139ae94287c0d96824)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @aws/lsp-core bumped from ^0.0.14 to ^0.0.15 + ## [0.0.77](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.76...lsp-codewhisperer/v0.0.77) (2025-09-02) diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index 9563b6300d..3fb2f48e69 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-codewhisperer", - "version": "0.0.77", + "version": "0.0.78", "description": "CodeWhisperer Language Server", "main": "out/index.js", "repository": { @@ -37,7 +37,7 @@ "@aws-sdk/util-retry": "^3.374.0", "@aws/chat-client-ui-types": "^0.1.56", "@aws/language-server-runtimes": "^0.2.128", - "@aws/lsp-core": "^0.0.14", + "@aws/lsp-core": "^0.0.15", "@modelcontextprotocol/sdk": "^1.15.0", "@smithy/node-http-handler": "^2.5.0", "adm-zip": "^0.5.10", diff --git a/server/aws-lsp-json/CHANGELOG.md b/server/aws-lsp-json/CHANGELOG.md index ecac136295..de134b8f6e 100644 --- a/server/aws-lsp-json/CHANGELOG.md +++ b/server/aws-lsp-json/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.1.19](https://github.com/aws/language-servers/compare/lsp-json/v0.1.18...lsp-json/v0.1.19) (2025-09-09) + + +### Features + +* add support for getSupplementalContext LSP API ([#2212](https://github.com/aws/language-servers/issues/2212)) ([2ddcae7](https://github.com/aws/language-servers/commit/2ddcae7a4fac6b89cbc9784911959743ea0a6d11)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @aws/lsp-core bumped from ^0.0.14 to ^0.0.15 + ## [0.1.18](https://github.com/aws/language-servers/compare/lsp-json/v0.1.17...lsp-json/v0.1.18) (2025-08-19) diff --git a/server/aws-lsp-json/package.json b/server/aws-lsp-json/package.json index 6b2c95bc49..b1ce196af0 100644 --- a/server/aws-lsp-json/package.json +++ b/server/aws-lsp-json/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-json", - "version": "0.1.18", + "version": "0.1.19", "description": "JSON Language Server", "main": "out/index.js", "repository": { @@ -27,7 +27,7 @@ }, "dependencies": { "@aws/language-server-runtimes": "^0.2.128", - "@aws/lsp-core": "^0.0.14", + "@aws/lsp-core": "^0.0.15", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" }, diff --git a/server/aws-lsp-partiql/CHANGELOG.md b/server/aws-lsp-partiql/CHANGELOG.md index dc68bdb063..37efbed366 100644 --- a/server/aws-lsp-partiql/CHANGELOG.md +++ b/server/aws-lsp-partiql/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.0.18](https://github.com/aws/language-servers/compare/lsp-partiql/v0.0.17...lsp-partiql/v0.0.18) (2025-09-09) + + +### Features + +* add support for getSupplementalContext LSP API ([#2212](https://github.com/aws/language-servers/issues/2212)) ([2ddcae7](https://github.com/aws/language-servers/commit/2ddcae7a4fac6b89cbc9784911959743ea0a6d11)) + ## [0.0.17](https://github.com/aws/language-servers/compare/lsp-partiql/v0.0.16...lsp-partiql/v0.0.17) (2025-08-19) diff --git a/server/aws-lsp-partiql/package.json b/server/aws-lsp-partiql/package.json index e5f59a4411..2dc6c0e968 100644 --- a/server/aws-lsp-partiql/package.json +++ b/server/aws-lsp-partiql/package.json @@ -3,7 +3,7 @@ "author": "Amazon Web Services", "license": "Apache-2.0", "description": "PartiQL language server", - "version": "0.0.17", + "version": "0.0.18", "repository": { "type": "git", "url": "https://github.com/aws/language-servers" diff --git a/server/aws-lsp-yaml/CHANGELOG.md b/server/aws-lsp-yaml/CHANGELOG.md index 5858e6eb66..c43fc8f8f3 100644 --- a/server/aws-lsp-yaml/CHANGELOG.md +++ b/server/aws-lsp-yaml/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.1.19](https://github.com/aws/language-servers/compare/lsp-yaml/v0.1.18...lsp-yaml/v0.1.19) (2025-09-09) + + +### Features + +* add support for getSupplementalContext LSP API ([#2212](https://github.com/aws/language-servers/issues/2212)) ([2ddcae7](https://github.com/aws/language-servers/commit/2ddcae7a4fac6b89cbc9784911959743ea0a6d11)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @aws/lsp-core bumped from ^0.0.14 to ^0.0.15 + ## [0.1.18](https://github.com/aws/language-servers/compare/lsp-yaml/v0.1.17...lsp-yaml/v0.1.18) (2025-08-19) diff --git a/server/aws-lsp-yaml/package.json b/server/aws-lsp-yaml/package.json index 213221d721..555b12c69a 100644 --- a/server/aws-lsp-yaml/package.json +++ b/server/aws-lsp-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-yaml", - "version": "0.1.18", + "version": "0.1.19", "description": "YAML Language Server", "main": "out/index.js", "repository": { @@ -27,7 +27,7 @@ }, "dependencies": { "@aws/language-server-runtimes": "^0.2.128", - "@aws/lsp-core": "^0.0.14", + "@aws/lsp-core": "^0.0.15", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8", "yaml-language-server": "1.13.0" From 8e19f19a71e63a1196f4cb67ded8360c8da8129e Mon Sep 17 00:00:00 2001 From: Jayakrishna P Date: Tue, 9 Sep 2025 16:03:39 -0700 Subject: [PATCH 68/74] feat: feature to add iam inline suggestion support in codeWhispererservice (#2223) * Sync feature smus inline suggestions branch from main commits (#2109) * fix(amazonq): leverage lcs to find the chars added and removed (#2092) * fix: update client name to support Sagemaker AI origin for agentic chat (#2093) Co-authored-by: chungjac * chore(release): release packages from branch main (#2073) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: format version.json after incrementing (#2068) * chore: merge agentic version 1.27.0 (#2107) * Bump agentic version: 1.27.0 * Revert "feat(amazonq): read tool ui revamp" This reverts commit c65428bab2cf5e47badf1e3a9453babcf881e60c. * fix: the style in version json (#2106) --------- Co-authored-by: aws-toolkit-automation <> Co-authored-by: Tai Lai Co-authored-by: Christopher Christou <39839589+awschristou@users.noreply.github.com> * fix(amazonq): persist mcp configs in agent json on start-up (#2112) --------- Co-authored-by: andrewyuq <89420755+andrewyuq@users.noreply.github.com> Co-authored-by: chungjac Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Christopher Christou <39839589+awschristou@users.noreply.github.com> Co-authored-by: Sherry Lu <75588211+XiaoxuanLu@users.noreply.github.com> Co-authored-by: Tai Lai Co-authored-by: Dung Dong * feat(amazonq): Integrate IAM Auth support for InlineSuggestions in Flare (#2134) * Chore: Sync test smus branch with main branch commits (#2097) * fix(amazonq): skips continuous monitoring when WCS sees workspace as idle (#2066) * fix(amazonq): skips continuous monitoring when WCS sees workspace as idle * fix(amazonq): skips creating remote workspace at the start --------- Co-authored-by: Jiatong Li * fix: sessionManager misused because there are 2 types of manager now (#2090) * chore: mapping adt plugin to abap to let inline suggestion work (#2085) * chore: support inline suggestion in adt plugin for eclipse * fix: add import URI * chore: add detailed error description for uri is empty for language id * feat(amazonq): read tool ui revamp * feat(amazonq): read tool message revamp (#2049) * feat(amazonq): read tool message revamp * fix tests * feat: file search ui (#2078) * feat: file search ui * fix tests * fix integration tests * remove unnecessary type check * fix: use quotes instead of backticks * fix: creating a new sesion for Edits trigger with next token (#2094) * chore: bump @aws/mynah-ui to 4.36.4 (#2096) --------- Co-authored-by: Jiatong Li Co-authored-by: Jiatong Li Co-authored-by: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Co-authored-by: Sherry Lu <75588211+XiaoxuanLu@users.noreply.github.com> Co-authored-by: Tai Lai Co-authored-by: atontb <104926752+atonaamz@users.noreply.github.com> * feat(amazonq): add inline suggestion support for iam auth client * fix(amazonq): skips continuous monitoring when WCS sees workspace as idle (#2066) * fix(amazonq): skips continuous monitoring when WCS sees workspace as idle * fix(amazonq): skips creating remote workspace at the start --------- Co-authored-by: Jiatong Li * fix: sessionManager misused because there are 2 types of manager now (#2090) * chore: mapping adt plugin to abap to let inline suggestion work (#2085) * fix(amazonq): leverage lcs to find the chars added and removed (#2092) * fix: update client name to support Sagemaker AI origin for agentic chat (#2093) Co-authored-by: chungjac * chore(release): release packages from branch main (#2073) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: fix test failures in merge due to missing init of IdleWorkspaceManager --------- Co-authored-by: Jiatong Li Co-authored-by: Jiatong Li Co-authored-by: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Co-authored-by: Sherry Lu <75588211+XiaoxuanLu@users.noreply.github.com> Co-authored-by: Tai Lai Co-authored-by: atontb <104926752+atonaamz@users.noreply.github.com> Co-authored-by: andrewyuq <89420755+andrewyuq@users.noreply.github.com> Co-authored-by: chungjac Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: invictus <149003065+ashishrp-aws@users.noreply.github.com> * fix: add unit tests for IAM flow, remove redundant logs added for testing * fix: file formatting * fix: rebase from main, clean up redundant logs * fix: remove old code refs and debug logs * feat: use cw proxy server based on iam auth logic check * fix: todo comment and unused imports * fix: update codewhisperer server to use proper manager based on iam auth logic check * feat: create new codewhisperer server instance with dynamic service manager logic and add unit tests * fix: address pr comments, fix unit tests as per updated service manager logic --------- Co-authored-by: andrewyuq <89420755+andrewyuq@users.noreply.github.com> Co-authored-by: chungjac Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Christopher Christou <39839589+awschristou@users.noreply.github.com> Co-authored-by: Sherry Lu <75588211+XiaoxuanLu@users.noreply.github.com> Co-authored-by: Tai Lai Co-authored-by: Dung Dong Co-authored-by: Jiatong Li Co-authored-by: Jiatong Li Co-authored-by: Will Lo <96078566+Will-ShaoHua@users.noreply.github.com> Co-authored-by: Tai Lai Co-authored-by: atontb <104926752+atonaamz@users.noreply.github.com> Co-authored-by: invictus <149003065+ashishrp-aws@users.noreply.github.com> Co-authored-by: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> --- .../src/agent-standalone.ts | 4 +- .../agenticChat/tools/toolServer.ts | 30 +++-- .../auto-trigger/autoTrigger.ts | 1 - .../codeWhispererServer.test.ts | 117 +++++++++++++++++- .../inline-completion/codeWhispererServer.ts | 49 ++++++-- .../src/shared/codeWhispererService.test.ts | 34 +++++ .../src/shared/codeWhispererService.ts | 105 ++++++++++++---- .../src/shared/utils.test.ts | 77 ++++++++++++ .../aws-lsp-codewhisperer/src/shared/utils.ts | 23 +++- 9 files changed, 392 insertions(+), 48 deletions(-) diff --git a/app/aws-lsp-codewhisperer-runtimes/src/agent-standalone.ts b/app/aws-lsp-codewhisperer-runtimes/src/agent-standalone.ts index 7996472ada..49600a91b8 100644 --- a/app/aws-lsp-codewhisperer-runtimes/src/agent-standalone.ts +++ b/app/aws-lsp-codewhisperer-runtimes/src/agent-standalone.ts @@ -3,7 +3,7 @@ import { AmazonQServiceServerIAM, AmazonQServiceServerToken, CodeWhispererSecurityScanServerTokenProxy, - CodeWhispererServerTokenProxy, + CodeWhispererServer, QAgenticChatServerProxy, QConfigurationServerTokenProxy, QLocalProjectContextServerProxy, @@ -25,7 +25,7 @@ const version = versionJson.agenticChat const props = { version: version, servers: [ - CodeWhispererServerTokenProxy, + CodeWhispererServer, CodeWhispererSecurityScanServerTokenProxy, QConfigurationServerTokenProxy, QNetTransformServerTokenProxy, diff --git a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts index 29b838f2d3..d2257a45e4 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/toolServer.ts @@ -11,7 +11,7 @@ import { McpTool } from './mcp/mcpTool' import { FileSearch, FileSearchParams } from './fileSearch' import { GrepSearch } from './grepSearch' import { CodeReview } from './qCodeAnalysis/codeReview' -import { CodeWhispererServiceToken } from '../../../shared/codeWhispererService' +import { CodeWhispererServiceIAM, CodeWhispererServiceToken } from '../../../shared/codeWhispererService' import { McpToolDefinition } from './mcp/mcpTypes' import { getGlobalAgentConfigPath, @@ -29,6 +29,7 @@ import { DisplayFindings } from './qCodeAnalysis/displayFindings' import { ProfileStatusMonitor } from './mcp/profileStatusMonitor' import { AmazonQTokenServiceManager } from '../../../shared/amazonQServiceManager/AmazonQTokenServiceManager' import { SERVICE_MANAGER_TIMEOUT_MS, SERVICE_MANAGER_POLL_INTERVAL_MS } from '../constants/constants' +import { isUsingIAMAuth } from '../../../shared/utils' export const FsToolsServer: Server = ({ workspace, logging, agent, lsp }) => { const fsReadTool = new FsRead({ workspace, lsp, logging }) @@ -127,15 +128,24 @@ export const QCodeAnalysisServer: Server = ({ return } - // Create the CodeWhisperer client - const codeWhispererClient = new CodeWhispererServiceToken( - credentialsProvider, - workspace, - logging, - process.env.CODEWHISPERER_REGION || DEFAULT_AWS_Q_REGION, - process.env.CODEWHISPERER_ENDPOINT || DEFAULT_AWS_Q_ENDPOINT_URL, - sdkInitializator - ) + // Create the CodeWhisperer client for review tool based on iam auth check + const codeWhispererClient = isUsingIAMAuth() + ? new CodeWhispererServiceIAM( + credentialsProvider, + workspace, + logging, + process.env.CODEWHISPERER_REGION || DEFAULT_AWS_Q_REGION, + process.env.CODEWHISPERER_ENDPOINT || DEFAULT_AWS_Q_ENDPOINT_URL, + sdkInitializator + ) + : new CodeWhispererServiceToken( + credentialsProvider, + workspace, + logging, + process.env.CODEWHISPERER_REGION || DEFAULT_AWS_Q_REGION, + process.env.CODEWHISPERER_ENDPOINT || DEFAULT_AWS_Q_ENDPOINT_URL, + sdkInitializator + ) agent.addTool( { diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts index b6657b229c..4255be11cc 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/auto-trigger/autoTrigger.ts @@ -217,7 +217,6 @@ export const autoTrigger = ( rightContextAtCurrentLine.trim() !== ')' && ['VSCODE', 'JETBRAINS'].includes(ide) ) { - logging.debug(`Skip auto trigger: immediate right context`) return { shouldTrigger: false, classifierResult: 0, diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts index e15400434c..61fb867a02 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.test.ts @@ -12,7 +12,7 @@ import { TestFeatures } from '@aws/language-server-runtimes/testing' import * as assert from 'assert' import { AWSError } from 'aws-sdk' import sinon, { StubbedInstance } from 'ts-sinon' -import { CodewhispererServerFactory, getLanguageIdFromUri } from './codeWhispererServer' +import { CodeWhispererServer, CodewhispererServerFactory, getLanguageIdFromUri } from './codeWhispererServer' import { CodeWhispererServiceBase, CodeWhispererServiceToken, @@ -55,6 +55,7 @@ import { import { CodeDiffTracker } from './codeDiffTracker' import { TelemetryService } from '../../shared/telemetry/telemetryService' import { initBaseTestServiceManager, TestAmazonQServiceManager } from '../../shared/amazonQServiceManager/testUtils' +import * as utils from '../../shared/utils' import { LocalProjectContextController } from '../../shared/localProjectContextController' import { URI } from 'vscode-uri' import { INVALID_TOKEN } from '../../shared/constants' @@ -107,6 +108,33 @@ describe('CodeWhisperer Server', () => { .callsFake(StubSessionIdGenerator) sessionManager = SessionManager.getInstance() sessionManagerSpy = sandbox.spy(sessionManager) + + // Stub the global service manager functions to ensure they return test service managers + sandbox + .stub( + require('../../shared/amazonQServiceManager/AmazonQTokenServiceManager'), + 'getOrThrowBaseTokenServiceManager' + ) + .callsFake(() => { + // Create a new test service manager + return TestAmazonQServiceManager.getInstance() + }) + + // Also stub the IAM service manager + sandbox + .stub( + require('../../shared/amazonQServiceManager/AmazonQIAMServiceManager'), + 'getOrThrowBaseIAMServiceManager' + ) + .callsFake(() => { + // Return the same test service manager + return TestAmazonQServiceManager.getInstance() + }) + + // Reset AmazonQTokenServiceManager singleton to prevent cross-test interference + const AmazonQTokenServiceManager = + require('../../shared/amazonQServiceManager/AmazonQTokenServiceManager').AmazonQTokenServiceManager + AmazonQTokenServiceManager.resetInstance() }) afterEach(() => { @@ -115,6 +143,14 @@ describe('CodeWhisperer Server', () => { sandbox.restore() sinon.restore() SESSION_IDS_LOG = [] + + // Reset all service manager singletons to prevent cross-test interference + const AmazonQTokenServiceManager = + require('../../shared/amazonQServiceManager/AmazonQTokenServiceManager').AmazonQTokenServiceManager + const AmazonQIAMServiceManager = + require('../../shared/amazonQServiceManager/AmazonQIAMServiceManager').AmazonQIAMServiceManager + AmazonQTokenServiceManager.resetInstance() + AmazonQIAMServiceManager.resetInstance() }) describe('Recommendations', () => { @@ -648,7 +684,8 @@ describe('CodeWhisperer Server', () => { it('handles partialResultToken in request', async () => { const manager = SessionManager.getInstance() - manager.createSession(SAMPLE_SESSION_DATA) + const session = manager.createSession(SAMPLE_SESSION_DATA) + manager.activateSession(session) await features.doInlineCompletionWithReferences( { textDocument: { uri: SOME_FILE.uri }, @@ -2394,6 +2431,38 @@ describe('CodeWhisperer Server', () => { TestAmazonQServiceManager.resetInstance() }) }) + + describe('IAM Error Handling', () => { + it('should handle IAM access denied errors', async () => { + const service = sinon.createStubInstance( + CodeWhispererServiceToken + ) as StubbedInstance + service.generateSuggestions.rejects(new Error('not authorized')) + + const features = new TestFeatures() + //@ts-ignore + features.logging = console + + TestAmazonQServiceManager.resetInstance() + const server = CodewhispererServerFactory(() => initBaseTestServiceManager(features, service)) + features.lsp.workspace.getConfiguration.returns(Promise.resolve({})) + await startServer(features, server) + features.openDocument(SOME_FILE) + + const result = await features.doInlineCompletionWithReferences( + { + textDocument: { uri: SOME_FILE.uri }, + position: { line: 0, character: 0 }, + context: { triggerKind: InlineCompletionTriggerKind.Invoked }, + }, + CancellationToken.None + ) + + assert.deepEqual(result, EMPTY_RESULT) + TestAmazonQServiceManager.resetInstance() + }) + }) + describe('getLanguageIdFromUri', () => { it('should return python for notebook cell URIs', () => { const uri = 'vscode-notebook-cell:/some/path/notebook.ipynb#cell1' @@ -2441,4 +2510,48 @@ describe('CodeWhisperer Server', () => { assert.strictEqual(getLanguageIdFromUri(uri), '') }) }) + + describe('Dynamic Service Manager Selection', () => { + it('should use Token service manager when not using IAM auth', async () => { + // Create isolated stubs for this test only + const isUsingIAMAuthStub = sinon.stub(utils, 'isUsingIAMAuth').returns(false) + const mockTokenService = TestAmazonQServiceManager.initInstance(new TestFeatures()) + mockTokenService.withCodeWhispererService(stubCodeWhispererService()) + + const features = new TestFeatures() + const server = CodeWhispererServer + + try { + await startServer(features, server) + + // Verify the correct service manager function was called + sinon.assert.calledWith(isUsingIAMAuthStub, features.credentialsProvider) + } finally { + isUsingIAMAuthStub.restore() + features.dispose() + TestAmazonQServiceManager.resetInstance() + } + }) + + it('should use IAM service manager when using IAM auth', async () => { + // Create isolated stubs for this test only + const isUsingIAMAuthStub = sinon.stub(utils, 'isUsingIAMAuth').returns(true) + const mockIAMService = TestAmazonQServiceManager.initInstance(new TestFeatures()) + mockIAMService.withCodeWhispererService(stubCodeWhispererService()) + + const features = new TestFeatures() + const server = CodeWhispererServer + + try { + await startServer(features, server) + + // Verify the correct service manager function was called + sinon.assert.calledWith(isUsingIAMAuthStub, features.credentialsProvider) + } finally { + isUsingIAMAuthStub.restore() + features.dispose() + TestAmazonQServiceManager.resetInstance() + } + }) + }) }) diff --git a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts index c869a534fd..4f28b46ea9 100644 --- a/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts +++ b/server/aws-lsp-codewhisperer/src/language-server/inline-completion/codeWhispererServer.ts @@ -6,7 +6,6 @@ import { InlineCompletionTriggerKind, InlineCompletionWithReferencesParams, LogInlineCompletionSessionResultsParams, - Position, Range, Server, TextDocument, @@ -16,6 +15,10 @@ import { import { autoTrigger, getAutoTriggerType, getNormalizeOsName, triggerType } from './auto-trigger/autoTrigger' import { FileContext, + BaseGenerateSuggestionsRequest, + CodeWhispererServiceToken, + GenerateIAMSuggestionsRequest, + GenerateTokenSuggestionsRequest, GenerateSuggestionsRequest, GenerateSuggestionsResponse, getFileContext, @@ -23,7 +26,7 @@ import { SuggestionType, } from '../../shared/codeWhispererService' import { CodewhispererLanguage, getSupportedLanguageId } from '../../shared/languageDetection' -import { mergeEditSuggestionsWithFileContext, truncateOverlapWithRightContext } from './mergeRightUtils' +import { truncateOverlapWithRightContext } from './mergeRightUtils' import { CodeWhispererSession, SessionManager } from './session/sessionManager' import { CodePercentageTracker } from './codePercentage' import { getCompletionType, getEndPositionForAcceptedSuggestion, getErrorMessage, safeGet } from '../../shared/utils' @@ -59,6 +62,7 @@ import { EditCompletionHandler } from './editCompletionHandler' import { EMPTY_RESULT, ABAP_EXTENSIONS } from './constants' import { IdleWorkspaceManager } from '../workspaceContext/IdleWorkspaceManager' import { URI } from 'vscode-uri' +import { isUsingIAMAuth } from '../../shared/utils' const mergeSuggestionsWithRightContext = ( rightFileContext: string, @@ -102,7 +106,7 @@ const mergeSuggestionsWithRightContext = ( } export const CodewhispererServerFactory = - (serviceManager: () => AmazonQBaseServiceManager): Server => + (serviceManager: (credentialsProvider?: any) => AmazonQBaseServiceManager): Server => ({ credentialsProvider, lsp, workspace, telemetry, logging, runtime, sdkInitializator }) => { let lastUserModificationTime: number let timeSinceLastUserModification: number = 0 @@ -151,6 +155,13 @@ export const CodewhispererServerFactory = logging.log(`Skip concurrent inline completion`) return EMPTY_RESULT } + + // Add this check to ensure service manager is initialized + if (!amazonQServiceManager) { + logging.log('Amazon Q Service Manager not initialized yet') + return EMPTY_RESULT + } + isOnInlineCompletionHandlerInProgress = true try { @@ -167,6 +178,10 @@ export const CodewhispererServerFactory = const textDocument = await getTextDocument(params.textDocument.uri, workspace, logging) const codeWhispererService = amazonQServiceManager.getCodewhispererService() + const authType = codeWhispererService instanceof CodeWhispererServiceToken ? 'token' : 'iam' + logging.debug( + `[INLINE_COMPLETION] Service ready - auth: ${authType}, partial token: ${!!params.partialResultToken}` + ) if (params.partialResultToken && currentSession) { // subsequent paginated requests for current session try { @@ -362,11 +377,25 @@ export const CodewhispererServerFactory = extraContext + '\n' + requestContext.fileContext.leftFileContent } - const generateCompletionReq = { - ...requestContext, - ...(workspaceId ? { workspaceId: workspaceId } : {}), + // Create the appropriate request based on service type + let generateCompletionReq: BaseGenerateSuggestionsRequest + + if (codeWhispererService instanceof CodeWhispererServiceToken) { + const tokenRequest = requestContext as GenerateTokenSuggestionsRequest + generateCompletionReq = { + ...tokenRequest, + ...(workspaceId ? { workspaceId } : {}), + } + } else { + const iamRequest = requestContext as GenerateIAMSuggestionsRequest + generateCompletionReq = { + ...iamRequest, + } } + try { + const authType = codeWhispererService instanceof CodeWhispererServiceToken ? 'token' : 'iam' + logging.debug(`[INLINE_COMPLETION] API call - generateSuggestions (new session, ${authType})`) const suggestionResponse = await codeWhispererService.generateSuggestions(generateCompletionReq) return await processSuggestionResponse(suggestionResponse, newSession, true, selectionRange) } catch (error) { @@ -524,6 +553,7 @@ export const CodewhispererServerFactory = session: CodeWhispererSession ): InlineCompletionListWithReferences => { logging.log('Recommendation failure: ' + error) + emitServiceInvocationFailure(telemetry, session, error) // UTDE telemetry is not needed here because in error cases we don't care about UTDE for errored out sessions @@ -706,7 +736,7 @@ export const CodewhispererServerFactory = } const onInitializedHandler = async () => { - amazonQServiceManager = serviceManager() + amazonQServiceManager = serviceManager(credentialsProvider) const clientParams = safeGet( lsp.getClientInitializeParams(), @@ -875,6 +905,11 @@ export const CodewhispererServerFactory = } } +// Dynamic service manager factory that detects auth type at runtime +export const CodeWhispererServer = CodewhispererServerFactory((credentialsProvider?: any) => { + return isUsingIAMAuth(credentialsProvider) ? getOrThrowBaseIAMServiceManager() : getOrThrowBaseTokenServiceManager() +}) + export const CodeWhispererServerIAM = CodewhispererServerFactory(getOrThrowBaseIAMServiceManager) export const CodeWhispererServerToken = CodewhispererServerFactory(getOrThrowBaseTokenServiceManager) diff --git a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.test.ts b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.test.ts index 187bc41f35..75c691a5e3 100644 --- a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.test.ts +++ b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.test.ts @@ -23,6 +23,8 @@ import { CodeWhispererServiceIAM, GenerateSuggestionsRequest, GenerateSuggestionsResponse, + isIAMRequest, + isTokenRequest, } from './codeWhispererService' import { RecentEditTracker } from '../language-server/inline-completion/tracker/codeEditTracker' import { CodeWhispererSupplementalContext } from './models/model' @@ -303,6 +305,38 @@ describe('CodeWhispererService', function () { const clientCall = (service.client.generateRecommendations as sinon.SinonStub).getCall(0) assert.strictEqual(clientCall.args[0].customizationArn, 'test-arn') }) + + it('should include serviceType in response', async function () { + const mockRequest: GenerateSuggestionsRequest = { + fileContext: { + filename: 'test.js', + programmingLanguage: { languageName: 'javascript' }, + leftFileContent: 'const x = ', + rightFileContent: '', + }, + maxResults: 5, + } + + const result = await service.generateSuggestions(mockRequest) + assert.strictEqual(result.responseContext.authType, 'iam') + }) + }) + + describe('Request Type Guards', function () { + it('should identify IAM vs Token requests', function () { + const iamRequest = { + fileContext: { + filename: 'test.js', + programmingLanguage: { languageName: 'javascript' }, + leftFileContent: '', + rightFileContent: '', + }, + } + const tokenRequest = { ...iamRequest, editorState: {} } + + assert.strictEqual(isIAMRequest(iamRequest), true) + assert.strictEqual(isTokenRequest(tokenRequest), true) + }) }) }) diff --git a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts index 984bb6da76..1225e86435 100644 --- a/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts +++ b/server/aws-lsp-codewhisperer/src/shared/codeWhispererService.ts @@ -42,22 +42,51 @@ import { FILENAME_CHARS_LIMIT, } from '../language-server/inline-completion/constants' +// Type guards for request classification +export function isTokenRequest(request: BaseGenerateSuggestionsRequest): request is GenerateTokenSuggestionsRequest { + return 'editorState' in request || 'predictionTypes' in request || 'supplementalContexts' in request +} + +export function isIAMRequest(request: BaseGenerateSuggestionsRequest): request is GenerateIAMSuggestionsRequest { + return !isTokenRequest(request) +} + export interface Suggestion extends CodeWhispererTokenClient.Completion, CodeWhispererSigv4Client.Recommendation { itemId: string } -export interface GenerateSuggestionsRequest extends CodeWhispererTokenClient.GenerateCompletionsRequest { - // TODO : This is broken due to Interface 'GenerateSuggestionsRequest' cannot simultaneously extend types 'GenerateCompletionsRequest' and 'GenerateRecommendationsRequest'. - //CodeWhispererSigv4Client.GenerateRecommendationsRequest { - maxResults: number +// Base request interface with common fields - using union type for FileContext compatibility +export interface BaseGenerateSuggestionsRequest { + fileContext: FileContext + maxResults?: number + nextToken?: string } -export type FileContext = GenerateSuggestionsRequest['fileContext'] +// IAM-specific request interface that directly extends the SigV4 client request +export interface GenerateIAMSuggestionsRequest extends CodeWhispererSigv4Client.GenerateRecommendationsRequest {} + +// Token-specific request interface that directly extends the Token client request +export interface GenerateTokenSuggestionsRequest extends CodeWhispererTokenClient.GenerateCompletionsRequest {} + +// Union type for backward compatibility +export type GenerateSuggestionsRequest = GenerateIAMSuggestionsRequest | GenerateTokenSuggestionsRequest + +// FileContext type that's compatible with both clients +export type FileContext = { + fileUri?: string // Optional in both clients + filename: string + programmingLanguage: { + languageName: string + } + leftFileContent: string + rightFileContent: string +} export interface ResponseContext { requestId: string codewhispererSessionId: string nextToken?: string + authType?: 'iam' | 'token' } export enum SuggestionType { @@ -142,7 +171,7 @@ export abstract class CodeWhispererServiceBase { abstract getCredentialsType(): CredentialsType - abstract generateSuggestions(request: GenerateSuggestionsRequest): Promise + abstract generateSuggestions(request: BaseGenerateSuggestionsRequest): Promise abstract constructSupplementalContext( document: TextDocument, @@ -242,23 +271,40 @@ export class CodeWhispererServiceIAM extends CodeWhispererServiceBase { return undefined } - async generateSuggestions(request: GenerateSuggestionsRequest): Promise { - // add cancellation check - // add error check - if (this.customizationArn) request = { ...request, customizationArn: this.customizationArn } - const response = await this.client.generateRecommendations(request).promise() - const responseContext = { + async generateSuggestions(request: BaseGenerateSuggestionsRequest): Promise { + // Cast is now safe because GenerateIAMSuggestionsRequest extends GenerateRecommendationsRequest + const iamRequest = request as GenerateIAMSuggestionsRequest + + // Add customization ARN if configured + if (this.customizationArn) { + ;(iamRequest as any).customizationArn = this.customizationArn + } + + // Warn about unsupported features for IAM auth + if ('editorState' in request || 'predictionTypes' in request || 'supplementalContexts' in request) { + console.warn('Advanced features not supported - using basic completion') + } + + const response = await this.client.generateRecommendations(iamRequest).promise() + + return this.mapCodeWhispererApiResponseToSuggestion(response, { requestId: response?.$response?.requestId, codewhispererSessionId: response?.$response?.httpResponse?.headers['x-amzn-sessionid'], nextToken: response.nextToken, - } + authType: 'iam' as const, + }) + } - for (const recommendation of response?.recommendations ?? []) { + private mapCodeWhispererApiResponseToSuggestion( + apiResponse: CodeWhispererSigv4Client.GenerateRecommendationsResponse, + responseContext: ResponseContext + ): GenerateSuggestionsResponse { + for (const recommendation of apiResponse?.recommendations ?? []) { Object.assign(recommendation, { itemId: this.generateItemId() }) } return { - suggestions: response.recommendations as Suggestion[], + suggestions: apiResponse.recommendations as Suggestion[], suggestionType: SuggestionType.COMPLETION, responseContext, } @@ -419,15 +465,22 @@ export class CodeWhispererServiceToken extends CodeWhispererServiceBase { return { ...request, profileArn: this.profileArn } } - async generateSuggestions(request: GenerateSuggestionsRequest): Promise { + async generateSuggestions(request: BaseGenerateSuggestionsRequest): Promise { + // Cast is now safe because GenerateTokenSuggestionsRequest extends GenerateCompletionsRequest // add cancellation check // add error check let logstr = `GenerateCompletion activity:\n` try { - if (this.customizationArn) request.customizationArn = this.customizationArn + const tokenRequest = request as GenerateTokenSuggestionsRequest + + // Add customizationArn if available + if (this.customizationArn) { + tokenRequest.customizationArn = this.customizationArn + } + const beforeApiCall = performance.now() let recentEditsLogStr = '' - const recentEdits = request.supplementalContexts?.filter(it => it.type === 'PreviousEditorState') + const recentEdits = tokenRequest.supplementalContexts?.filter(it => it.type === 'PreviousEditorState') if (recentEdits) { if (recentEdits.length === 0) { recentEditsLogStr += `No recent edits` @@ -440,23 +493,26 @@ export class CodeWhispererServiceToken extends CodeWhispererServiceBase { } } } + logstr += `@@request metadata@@ "endpoint": ${this.codeWhispererEndpoint}, - "predictionType": ${request.predictionTypes?.toString() ?? 'Not specified (COMPLETIONS)'}, - "filename": ${request.fileContext.filename}, + "predictionType": ${tokenRequest.predictionTypes?.toString() ?? 'Not specified (COMPLETIONS)'}, + "filename": ${tokenRequest.fileContext.filename}, "leftContextLength": ${request.fileContext.leftFileContent.length}, rightContextLength: ${request.fileContext.rightFileContent.length}, - "language": ${request.fileContext.programmingLanguage.languageName}, - "supplementalContextCount": ${request.supplementalContexts?.length ?? 0}, - "request.nextToken": ${request.nextToken}, + "language": ${tokenRequest.fileContext.programmingLanguage.languageName}, + "supplementalContextCount": ${tokenRequest.supplementalContexts?.length ?? 0}, + "request.nextToken": ${tokenRequest.nextToken}, "recentEdits": ${recentEditsLogStr}\n` - const response = await this.client.generateCompletions(this.withProfileArn(request)).promise() + const response = await this.client.generateCompletions(this.withProfileArn(tokenRequest)).promise() const responseContext = { requestId: response?.$response?.requestId, codewhispererSessionId: response?.$response?.httpResponse?.headers['x-amzn-sessionid'], nextToken: response.nextToken, + // CRITICAL: Add service type for proper error handling + authType: 'token' as const, } const r = this.mapCodeWhispererApiResponseToSuggestion(response, responseContext) @@ -467,6 +523,7 @@ export class CodeWhispererServiceToken extends CodeWhispererServiceBase { "sessionId": ${responseContext.codewhispererSessionId}, "response.completions.length": ${response.completions?.length ?? 0}, "response.predictions.length": ${response.predictions?.length ?? 0}, + "predictionType": ${tokenRequest.predictionTypes?.toString() ?? ''}, "latency": ${performance.now() - beforeApiCall}, "response.nextToken": ${response.nextToken}, "firstSuggestion": ${firstSuggestionLogstr}` diff --git a/server/aws-lsp-codewhisperer/src/shared/utils.test.ts b/server/aws-lsp-codewhisperer/src/shared/utils.test.ts index 85cd8817a7..7ffe837938 100644 --- a/server/aws-lsp-codewhisperer/src/shared/utils.test.ts +++ b/server/aws-lsp-codewhisperer/src/shared/utils.test.ts @@ -27,6 +27,7 @@ import { getClientName, sanitizeInput, sanitizeRequestInput, + isUsingIAMAuth, } from './utils' import { promises as fsPromises } from 'fs' @@ -185,6 +186,82 @@ describe('getOriginFromClientInfo', () => { }) }) +describe('isUsingIAMAuth', () => { + let originalEnv: string | undefined + + beforeEach(() => { + originalEnv = process.env.USE_IAM_AUTH + delete process.env.USE_IAM_AUTH + }) + + afterEach(() => { + if (originalEnv !== undefined) { + process.env.USE_IAM_AUTH = originalEnv + } else { + delete process.env.USE_IAM_AUTH + } + }) + + it('should return true when USE_IAM_AUTH environment variable is "true"', () => { + process.env.USE_IAM_AUTH = 'true' + assert.strictEqual(isUsingIAMAuth(), true) + }) + + it('should return false when USE_IAM_AUTH environment variable is not set', () => { + assert.strictEqual(isUsingIAMAuth(), false) + }) + + it('should return true when only IAM credentials are available', () => { + const mockProvider: CredentialsProvider = { + hasCredentials: sinon.stub().returns(true), + getCredentials: sinon + .stub() + .withArgs('iam') + .returns({ accessKeyId: 'AKIA...', secretAccessKey: 'secret' }) + .withArgs('bearer') + .returns(null), + getConnectionMetadata: sinon.stub(), + getConnectionType: sinon.stub(), + onCredentialsDeleted: sinon.stub(), + } + + assert.strictEqual(isUsingIAMAuth(mockProvider), true) + }) + + it('should return false when bearer credentials are available', () => { + const mockProvider: CredentialsProvider = { + hasCredentials: sinon.stub().returns(true), + getCredentials: sinon + .stub() + .withArgs('iam') + .returns({ accessKeyId: 'AKIA...', secretAccessKey: 'secret' }) + .withArgs('bearer') + .returns({ token: 'bearer-token' }), + getConnectionMetadata: sinon.stub(), + getConnectionType: sinon.stub(), + onCredentialsDeleted: sinon.stub(), + } + + assert.strictEqual(isUsingIAMAuth(mockProvider), false) + }) + + it('should return false when credential access fails', () => { + const mockProvider: CredentialsProvider = { + hasCredentials: sinon.stub().returns(true), + getCredentials: sinon.stub().throws(new Error('Access failed')), + getConnectionMetadata: sinon.stub(), + getConnectionType: sinon.stub(), + onCredentialsDeleted: sinon.stub(), + } + + assert.strictEqual(isUsingIAMAuth(mockProvider), false) + }) + + it('should return false when credentialsProvider is undefined', () => { + assert.strictEqual(isUsingIAMAuth(undefined), false) + }) +}) + describe('getSsoConnectionType', () => { const mockToken = 'mockToken' const mockCredsProvider: CredentialsProvider = { diff --git a/server/aws-lsp-codewhisperer/src/shared/utils.ts b/server/aws-lsp-codewhisperer/src/shared/utils.ts index a7a95d8801..af5cd14c28 100644 --- a/server/aws-lsp-codewhisperer/src/shared/utils.ts +++ b/server/aws-lsp-codewhisperer/src/shared/utils.ts @@ -392,8 +392,27 @@ export function getOriginFromClientInfo(clientName: string | undefined): Origin return 'IDE' } -export function isUsingIAMAuth(): boolean { - return process.env.USE_IAM_AUTH === 'true' +export function isUsingIAMAuth(credentialsProvider?: CredentialsProvider): boolean { + if (process.env.USE_IAM_AUTH === 'true') { + return true + } + + // CRITICAL: Add credential-based detection as fallback + if (credentialsProvider) { + try { + const iamCreds = credentialsProvider.getCredentials('iam') + const bearerCreds = credentialsProvider.getCredentials('bearer') + + // If only IAM creds available, use IAM + if (iamCreds && !(bearerCreds as any)?.token) { + return true + } + } catch (error) { + // If credential access fails, default to bearer + return false + } + } + return false } export const flattenMetric = (obj: any, prefix = '') => { From 62d48e50fa985b8cbcfd967283bfed3f8b1074a3 Mon Sep 17 00:00:00 2001 From: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> Date: Tue, 9 Sep 2025 22:05:45 -0700 Subject: [PATCH 69/74] feat: upgrading node version from 18 to 24 (#2226) * feat: upgrade node version to 24 * fix: adding node 24 to overrides.json and using curl instead wget --- .../scripts/download-node.sh | 10 +++++----- attribution/overrides.json | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/aws-lsp-codewhisperer-runtimes/scripts/download-node.sh b/app/aws-lsp-codewhisperer-runtimes/scripts/download-node.sh index f0635fd8ff..44c3c1c462 100755 --- a/app/aws-lsp-codewhisperer-runtimes/scripts/download-node.sh +++ b/app/aws-lsp-codewhisperer-runtimes/scripts/download-node.sh @@ -5,13 +5,13 @@ # by src/scripts/copy-node-assets.ts, to produce the final bundle. set -e -NODE_VERSION="18" +NODE_VERSION="24" BASE_URL="https://nodejs.org/download/release/latest-v${NODE_VERSION}.x" SHASUMS_FILE="SHASUMS256.txt" ASSETS_DIR="build/node-assets" # Download SHASUMS256.txt -wget -q "$BASE_URL/$SHASUMS_FILE" -O "$SHASUMS_FILE" +curl -s "$BASE_URL/$SHASUMS_FILE" -o "$SHASUMS_FILE" # Extract exact Node.js version from any entry in SHASUMS256.txt NODE_SEMVER=$(grep -o 'node-v[0-9]*\.[0-9]*\.[0-9]*' SHASUMS256.txt | head -1 | cut -d'v' -f2) @@ -47,7 +47,7 @@ for actual_file in "${EXPECTED_FILES[@]}"; do echo "Updating $actual_file" mkdir -p "$(dirname "$filepath")" - wget -q "$BASE_URL/$actual_file" -O $filepath + curl -s "$BASE_URL/$actual_file" -o "$filepath" else echo "Warning: $actual_file not found in SHASUMS256.txt" fi @@ -58,7 +58,7 @@ LICENSE_URL="https://raw.githubusercontent.com/nodejs/node/v${NODE_SEMVER}/LICEN LICENSE_FILE="$ASSETS_DIR/LICENSE" echo "Fetching Node.js license from $LICENSE_URL" -wget -q "$LICENSE_URL" -O "$LICENSE_FILE" +curl -s "$LICENSE_URL" -o "$LICENSE_FILE" # Verify the license file was downloaded successfully if [ ! -s "$LICENSE_FILE" ]; then @@ -94,4 +94,4 @@ jq --indent 4 \ echo "Successfully updated Node.js version and license in $ATTRIBUTION_FILE" # Cleanup -rm -f "$SHASUMS_FILE" \ No newline at end of file +rm -f "$SHASUMS_FILE" diff --git a/attribution/overrides.json b/attribution/overrides.json index ed989c78d2..5f4222b4ad 100644 --- a/attribution/overrides.json +++ b/attribution/overrides.json @@ -11,5 +11,12 @@ }, "caniuse-lite": { "ignore": true + }, + "node": { + "name": "Node.js", + "version": "24.7.0", + "url": "https://github.com/nodejs/node", + "license": "MIT", + "licenseText": "Node.js is licensed for use as follows:\n\n\"\"\"\nCopyright Node.js contributors. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n\nThis license applies to parts of Node.js originating from the\nhttps://github.com/joyent/node repository:\n\n\"\"\"\nCopyright Joyent, Inc. and other Node contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n\nThe Node.js license applies to all parts of Node.js that are not externally\nmaintained libraries.\n\nThe externally maintained libraries used by Node.js are:\n\n- Acorn, located at deps/acorn, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (C) 2012-2022 by various contributors (see AUTHORS)\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n \"\"\"\n\n- c-ares, located at deps/cares, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) 1998 Massachusetts Institute of Technology\n Copyright (c) 2007 - 2023 Daniel Stenberg with many contributors, see AUTHORS\n file.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of\n this software and associated documentation files (the \"Software\"), to deal in\n the Software without restriction, including without limitation the rights to\n use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n the Software, and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice (including the next\n paragraph) shall be included in all copies or substantial portions of the\n Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- cjs-module-lexer, located at deps/cjs-module-lexer, is licensed as follows:\n \"\"\"\n MIT License\n -----------\n\n Copyright (C) 2018-2020 Guy Bedford\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- ittapi, located at deps/v8/third_party/ittapi, is licensed as follows:\n \"\"\"\n Copyright (c) 2019 Intel Corporation. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- amaro, located at deps/amaro, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) Marco Ippolito and Amaro contributors\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- swc, located at deps/amaro/dist, is licensed as follows:\n \"\"\"\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2024 SWC contributors.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n \thttp://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n \"\"\"\n\n- ICU, located at deps/icu-small, is licensed as follows:\n \"\"\"\n UNICODE LICENSE V3\n\n COPYRIGHT AND PERMISSION NOTICE\n\n Copyright © 2016-2025 Unicode, Inc.\n\n NOTICE TO USER: Carefully read the following legal agreement. BY\n DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR\n SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE\n TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT\n DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.\n\n Permission is hereby granted, free of charge, to any person obtaining a\n copy of data files and any associated documentation (the \"Data Files\") or\n software and any associated documentation (the \"Software\") to deal in the\n Data Files or Software without restriction, including without limitation\n the rights to use, copy, modify, merge, publish, distribute, and/or sell\n copies of the Data Files or Software, and to permit persons to whom the\n Data Files or Software are furnished to do so, provided that either (a)\n this copyright and permission notice appear with all copies of the Data\n Files or Software, or (b) this copyright and permission notice appear in\n associated Documentation.\n\n THE DATA FILES AND SOFTWARE ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n THIRD PARTY RIGHTS.\n\n IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE\n BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,\n OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA\n FILES OR SOFTWARE.\n\n Except as contained in this notice, the name of a copyright holder shall\n not be used in advertising or otherwise to promote the sale, use or other\n dealings in these Data Files or Software without prior written\n authorization of the copyright holder.\n\n SPDX-License-Identifier: Unicode-3.0\n\n ----------------------------------------------------------------------\n\n Third-Party Software Licenses\n\n This section contains third-party software notices and/or additional\n terms for licensed third-party software components included within ICU\n libraries.\n\n ----------------------------------------------------------------------\n\n ICU License - ICU 1.8.1 to ICU 57.1\n\n COPYRIGHT AND PERMISSION NOTICE\n\n Copyright (c) 1995-2016 International Business Machines Corporation and others\n All rights reserved.\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, and/or sell copies of the Software, and to permit persons\n to whom the Software is furnished to do so, provided that the above\n copyright notice(s) and this permission notice appear in all copies of\n the Software and that both the above copyright notice(s) and this\n permission notice appear in supporting documentation.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\n OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY\n SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER\n RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF\n CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\n CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n Except as contained in this notice, the name of a copyright holder\n shall not be used in advertising or otherwise to promote the sale, use\n or other dealings in this Software without prior written authorization\n of the copyright holder.\n\n All trademarks and registered trademarks mentioned herein are the\n property of their respective owners.\n\n ----------------------------------------------------------------------\n\n Chinese/Japanese Word Break Dictionary Data (cjdict.txt)\n\n # The Google Chrome software developed by Google is licensed under\n # the BSD license. Other software included in this distribution is\n # provided under other licenses, as set forth below.\n #\n # The BSD License\n # http://opensource.org/licenses/bsd-license.php\n # Copyright (C) 2006-2008, Google Inc.\n #\n # All rights reserved.\n #\n # Redistribution and use in source and binary forms, with or without\n # modification, are permitted provided that the following conditions are met:\n #\n # Redistributions of source code must retain the above copyright notice,\n # this list of conditions and the following disclaimer.\n # Redistributions in binary form must reproduce the above\n # copyright notice, this list of conditions and the following\n # disclaimer in the documentation and/or other materials provided with\n # the distribution.\n # Neither the name of Google Inc. nor the names of its\n # contributors may be used to endorse or promote products derived from\n # this software without specific prior written permission.\n #\n #\n # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n # CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n #\n #\n # The word list in cjdict.txt are generated by combining three word lists\n # listed below with further processing for compound word breaking. The\n # frequency is generated with an iterative training against Google web\n # corpora.\n #\n # * Libtabe (Chinese)\n # - https://sourceforge.net/project/?group_id=1519\n # - Its license terms and conditions are shown below.\n #\n # * IPADIC (Japanese)\n # - http://chasen.aist-nara.ac.jp/chasen/distribution.html\n # - Its license terms and conditions are shown below.\n #\n # ---------COPYING.libtabe ---- BEGIN--------------------\n #\n # /*\n # * Copyright (c) 1999 TaBE Project.\n # * Copyright (c) 1999 Pai-Hsiang Hsiao.\n # * All rights reserved.\n # *\n # * Redistribution and use in source and binary forms, with or without\n # * modification, are permitted provided that the following conditions\n # * are met:\n # *\n # * . Redistributions of source code must retain the above copyright\n # * notice, this list of conditions and the following disclaimer.\n # * . Redistributions in binary form must reproduce the above copyright\n # * notice, this list of conditions and the following disclaimer in\n # * the documentation and/or other materials provided with the\n # * distribution.\n # * . Neither the name of the TaBE Project nor the names of its\n # * contributors may be used to endorse or promote products derived\n # * from this software without specific prior written permission.\n # *\n # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n # * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n # * OF THE POSSIBILITY OF SUCH DAMAGE.\n # */\n #\n # /*\n # * Copyright (c) 1999 Computer Systems and Communication Lab,\n # * Institute of Information Science, Academia\n # * Sinica. All rights reserved.\n # *\n # * Redistribution and use in source and binary forms, with or without\n # * modification, are permitted provided that the following conditions\n # * are met:\n # *\n # * . Redistributions of source code must retain the above copyright\n # * notice, this list of conditions and the following disclaimer.\n # * . Redistributions in binary form must reproduce the above copyright\n # * notice, this list of conditions and the following disclaimer in\n # * the documentation and/or other materials provided with the\n # * distribution.\n # * . Neither the name of the Computer Systems and Communication Lab\n # * nor the names of its contributors may be used to endorse or\n # * promote products derived from this software without specific\n # * prior written permission.\n # *\n # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n # * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n # * OF THE POSSIBILITY OF SUCH DAMAGE.\n # */\n #\n # Copyright 1996 Chih-Hao Tsai @ Beckman Institute,\n # University of Illinois\n # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4\n #\n # ---------------COPYING.libtabe-----END--------------------------------\n #\n #\n # ---------------COPYING.ipadic-----BEGIN-------------------------------\n #\n # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science\n # and Technology. All Rights Reserved.\n #\n # Use, reproduction, and distribution of this software is permitted.\n # Any copy of this software, whether in its original form or modified,\n # must include both the above copyright notice and the following\n # paragraphs.\n #\n # Nara Institute of Science and Technology (NAIST),\n # the copyright holders, disclaims all warranties with regard to this\n # software, including all implied warranties of merchantability and\n # fitness, in no event shall NAIST be liable for\n # any special, indirect or consequential damages or any damages\n # whatsoever resulting from loss of use, data or profits, whether in an\n # action of contract, negligence or other tortuous action, arising out\n # of or in connection with the use or performance of this software.\n #\n # A large portion of the dictionary entries\n # originate from ICOT Free Software. The following conditions for ICOT\n # Free Software applies to the current dictionary as well.\n #\n # Each User may also freely distribute the Program, whether in its\n # original form or modified, to any third party or parties, PROVIDED\n # that the provisions of Section 3 (\"NO WARRANTY\") will ALWAYS appear\n # on, or be attached to, the Program, which is distributed substantially\n # in the same form as set out herein and that such intended\n # distribution, if actually made, will neither violate or otherwise\n # contravene any of the laws and regulations of the countries having\n # jurisdiction over the User or the intended distribution itself.\n #\n # NO WARRANTY\n #\n # The program was produced on an experimental basis in the course of the\n # research and development conducted during the project and is provided\n # to users as so produced on an experimental basis. Accordingly, the\n # program is provided without any warranty whatsoever, whether express,\n # implied, statutory or otherwise. The term \"warranty\" used herein\n # includes, but is not limited to, any warranty of the quality,\n # performance, merchantability and fitness for a particular purpose of\n # the program and the nonexistence of any infringement or violation of\n # any right of any third party.\n #\n # Each user of the program will agree and understand, and be deemed to\n # have agreed and understood, that there is no warranty whatsoever for\n # the program and, accordingly, the entire risk arising from or\n # otherwise connected with the program is assumed by the user.\n #\n # Therefore, neither ICOT, the copyright holder, or any other\n # organization that participated in or was otherwise related to the\n # development of the program and their respective officials, directors,\n # officers and other employees shall be held liable for any and all\n # damages, including, without limitation, general, special, incidental\n # and consequential damages, arising out of or otherwise in connection\n # with the use or inability to use the program or any product, material\n # or result produced or otherwise obtained by using the program,\n # regardless of whether they have been advised of, or otherwise had\n # knowledge of, the possibility of such damages at any time during the\n # project or thereafter. Each user will be deemed to have agreed to the\n # foregoing by his or her commencement of use of the program. The term\n # \"use\" as used herein includes, but is not limited to, the use,\n # modification, copying and distribution of the program and the\n # production of secondary products from the program.\n #\n # In the case where the program, whether in its original form or\n # modified, was distributed or delivered to or received by a user from\n # any person, organization or entity other than ICOT, unless it makes or\n # grants independently of ICOT any specific warranty to the user in\n # writing, such person, organization or entity, will also be exempted\n # from and not be held liable to the user for any such damages as noted\n # above as far as the program is concerned.\n #\n # ---------------COPYING.ipadic-----END----------------------------------\n\n ----------------------------------------------------------------------\n\n Lao Word Break Dictionary Data (laodict.txt)\n\n # Copyright (C) 2016 and later: Unicode, Inc. and others.\n # License & terms of use: http://www.unicode.org/copyright.html\n # Copyright (c) 2015 International Business Machines Corporation\n # and others. All Rights Reserved.\n #\n # Project: https://github.com/rober42539/lao-dictionary\n # Dictionary: https://github.com/rober42539/lao-dictionary/laodict.txt\n # License: https://github.com/rober42539/lao-dictionary/LICENSE.txt\n # (copied below)\n #\n # This file is derived from the above dictionary version of Nov 22, 2020\n # ----------------------------------------------------------------------\n # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell.\n # All rights reserved.\n #\n # Redistribution and use in source and binary forms, with or without\n # modification, are permitted provided that the following conditions are met:\n #\n # Redistributions of source code must retain the above copyright notice, this\n # list of conditions and the following disclaimer. Redistributions in binary\n # form must reproduce the above copyright notice, this list of conditions and\n # the following disclaimer in the documentation and/or other materials\n # provided with the distribution.\n #\n # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n # \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n # OF THE POSSIBILITY OF SUCH DAMAGE.\n # --------------------------------------------------------------------------\n\n ----------------------------------------------------------------------\n\n Burmese Word Break Dictionary Data (burmesedict.txt)\n\n # Copyright (c) 2014 International Business Machines Corporation\n # and others. All Rights Reserved.\n #\n # This list is part of a project hosted at:\n # github.com/kanyawtech/myanmar-karen-word-lists\n #\n # --------------------------------------------------------------------------\n # Copyright (c) 2013, LeRoy Benjamin Sharon\n # All rights reserved.\n #\n # Redistribution and use in source and binary forms, with or without\n # modification, are permitted provided that the following conditions\n # are met: Redistributions of source code must retain the above\n # copyright notice, this list of conditions and the following\n # disclaimer. Redistributions in binary form must reproduce the\n # above copyright notice, this list of conditions and the following\n # disclaimer in the documentation and/or other materials provided\n # with the distribution.\n #\n # Neither the name Myanmar Karen Word Lists, nor the names of its\n # contributors may be used to endorse or promote products derived\n # from this software without specific prior written permission.\n #\n # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n # CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS\n # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\n # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR\n # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF\n # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n # SUCH DAMAGE.\n # --------------------------------------------------------------------------\n\n ----------------------------------------------------------------------\n\n Time Zone Database\n\n ICU uses the public domain data and code derived from Time Zone\n Database for its time zone support. The ownership of the TZ database\n is explained in BCP 175: Procedure for Maintaining the Time Zone\n Database section 7.\n\n # 7. Database Ownership\n #\n # The TZ database itself is not an IETF Contribution or an IETF\n # document. Rather it is a pre-existing and regularly updated work\n # that is in the public domain, and is intended to remain in the\n # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do\n # not apply to the TZ Database or contributions that individuals make\n # to it. Should any claims be made and substantiated against the TZ\n # Database, the organization that is providing the IANA\n # Considerations defined in this RFC, under the memorandum of\n # understanding with the IETF, currently ICANN, may act in accordance\n # with all competent court orders. No ownership claims will be made\n # by ICANN or the IETF Trust on the database or the code. Any person\n # making a contribution to the database or code waives all rights to\n # future claims in that contribution or in the TZ Database.\n\n ----------------------------------------------------------------------\n\n Google double-conversion\n\n Copyright 2006-2011, the V8 project authors. All rights reserved.\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived\n from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n ----------------------------------------------------------------------\n\n JSON parsing library (nlohmann/json)\n\n File: vendor/json/upstream/single_include/nlohmann/json.hpp (only for ICU4C)\n\n MIT License\n\n Copyright (c) 2013-2022 Niels Lohmann\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n ----------------------------------------------------------------------\n\n File: aclocal.m4 (only for ICU4C)\n Section: pkg.m4 - Macros to locate and utilise pkg-config.\n\n Copyright © 2004 Scott James Remnant .\n Copyright © 2012-2015 Dan Nicholson\n\n This program is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 2 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful, but\n WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program; if not, write to the Free Software\n Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n 02111-1307, USA.\n\n As a special exception to the GNU General Public License, if you\n distribute this file as part of a program that contains a\n configuration script generated by Autoconf, you may include it under\n the same distribution terms that you use for the rest of that\n program.\n\n (The condition for the exception is fulfilled because\n ICU4C includes a configuration script generated by Autoconf,\n namely the `configure` script.)\n\n ----------------------------------------------------------------------\n\n File: config.guess (only for ICU4C)\n\n This file is free software; you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful, but\n WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program; if not, see .\n\n As a special exception to the GNU General Public License, if you\n distribute this file as part of a program that contains a\n configuration script generated by Autoconf, you may include it under\n the same distribution terms that you use for the rest of that\n program. This Exception is an additional permission under section 7\n of the GNU General Public License, version 3 (\"GPLv3\").\n\n (The condition for the exception is fulfilled because\n ICU4C includes a configuration script generated by Autoconf,\n namely the `configure` script.)\n\n ----------------------------------------------------------------------\n\n File: install-sh (only for ICU4C)\n\n Copyright 1991 by the Massachusetts Institute of Technology\n\n Permission to use, copy, modify, distribute, and sell this software and its\n documentation for any purpose is hereby granted without fee, provided that\n the above copyright notice appear in all copies and that both that\n copyright notice and this permission notice appear in supporting\n documentation, and that the name of M.I.T. not be used in advertising or\n publicity pertaining to distribution of the software without specific,\n written prior permission. M.I.T. makes no representations about the\n suitability of this software for any purpose. It is provided \"as is\"\n without express or implied warranty.\n \"\"\"\n\n- libuv, located at deps/uv, is licensed as follows:\n \"\"\"\n Copyright (c) 2015-present libuv project contributors.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to\n deal in the Software without restriction, including without limitation the\n rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n sell copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n IN THE SOFTWARE.\n This license applies to parts of libuv originating from the\n https://github.com/joyent/libuv repository:\n\n ====\n\n Copyright Joyent, Inc. and other Node contributors. All rights reserved.\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to\n deal in the Software without restriction, including without limitation the\n rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n sell copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n IN THE SOFTWARE.\n\n ====\n\n This license applies to all parts of libuv that are not externally\n maintained libraries.\n\n The externally maintained libraries used by libuv are:\n\n - tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license.\n\n - inet_pton and inet_ntop implementations, contained in src/inet.c, are\n copyright the Internet Systems Consortium, Inc., and licensed under the ISC\n license.\n \"\"\"\n\n- llhttp, located at deps/llhttp, is licensed as follows:\n \"\"\"\n This software is licensed under the MIT License.\n\n Copyright Fedor Indutny, 2018.\n\n Permission is hereby granted, free of charge, to any person obtaining a\n copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to permit\n persons to whom the Software is furnished to do so, subject to the\n following conditions:\n\n The above copyright notice and this permission notice shall be included\n in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- corepack, located at deps/corepack, is licensed as follows:\n \"\"\"\n **Copyright © Corepack contributors**\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- undici, located at deps/undici, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) Matteo Collina and Undici contributors\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- postject, located at test/fixtures/postject-copy, is licensed as follows:\n \"\"\"\n Postject is licensed for use as follows:\n\n \"\"\"\n MIT License\n\n Copyright (c) 2022 Postman, Inc\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n The Postject license applies to all parts of Postject that are not externally\n maintained libraries.\n\n The externally maintained libraries used by Postject are:\n\n - LIEF, located at vendor/LIEF, is licensed as follows:\n \"\"\"\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"{}\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2017 - 2022 R. Thomas\n Copyright 2017 - 2022 Quarkslab\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n \"\"\"\n \"\"\"\n\n- OpenSSL, located at deps/openssl, is licensed as follows:\n \"\"\"\n Apache License\n Version 2.0, January 2004\n https://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n \"\"\"\n\n- Punycode.js, located at lib/punycode.js, is licensed as follows:\n \"\"\"\n Copyright Mathias Bynens \n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- V8, located at deps/v8, is licensed as follows:\n \"\"\"\n This license applies to all parts of V8 that are not externally\n maintained libraries. The externally maintained libraries used by V8\n are:\n\n - PCRE test suite, located in\n test/mjsunit/third_party/regexp-pcre/regexp-pcre.js. This is based on the\n test suite from PCRE-7.3, which is copyrighted by the University\n of Cambridge and Google, Inc. The copyright notice and license\n are embedded in regexp-pcre.js.\n\n - Layout tests, located in test/mjsunit/third_party/object-keys. These are\n based on layout tests from webkit.org which are copyrighted by\n Apple Computer, Inc. and released under a 3-clause BSD license.\n\n - Strongtalk assembler, the basis of the files assembler-arm-inl.h,\n assembler-arm.cc, assembler-arm.h, assembler-ia32-inl.h,\n assembler-ia32.cc, assembler-ia32.h, assembler-x64-inl.h,\n assembler-x64.cc, assembler-x64.h, assembler.cc and assembler.h.\n This code is copyrighted by Sun Microsystems Inc. and released\n under a 3-clause BSD license.\n\n - Valgrind client API header, located at third_party/valgrind/valgrind.h\n This is released under the BSD license.\n\n - The Wasm C/C++ API headers, located at third_party/wasm-api/wasm.{h,hh}\n This is released under the Apache license. The API's upstream prototype\n implementation also formed the basis of V8's implementation in\n src/wasm/c-api.cc.\n\n These libraries have their own licenses; we recommend you read them,\n as their terms may differ from the terms below.\n\n Further license information can be found in LICENSE files located in\n sub-directories.\n\n Copyright 2014, the V8 project authors. All rights reserved.\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived\n from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- SipHash, located at deps/v8/src/third_party/siphash, is licensed as follows:\n \"\"\"\n SipHash reference C implementation\n\n Copyright (c) 2016 Jean-Philippe Aumasson \n\n To the extent possible under law, the author(s) have dedicated all\n copyright and related and neighboring rights to this software to the public\n domain worldwide. This software is distributed without any warranty.\n \"\"\"\n\n- zlib, located at deps/zlib, is licensed as follows:\n \"\"\"\n zlib.h -- interface of the 'zlib' general purpose compression library\n version 1.3.1, January 22nd, 2024\n\n Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler\n\n This software is provided 'as-is', without any express or implied\n warranty. In no event will the authors be held liable for any damages\n arising from the use of this software.\n\n Permission is granted to anyone to use this software for any purpose,\n including commercial applications, and to alter it and redistribute it\n freely, subject to the following restrictions:\n\n 1. The origin of this software must not be misrepresented; you must not\n claim that you wrote the original software. If you use this software\n in a product, an acknowledgment in the product documentation would be\n appreciated but is not required.\n 2. Altered source versions must be plainly marked as such, and must not be\n misrepresented as being the original software.\n 3. This notice may not be removed or altered from any source distribution.\n\n Jean-loup Gailly Mark Adler\n jloup@gzip.org madler@alumni.caltech.edu\n \"\"\"\n\n- simdjson, located at deps/simdjson, is licensed as follows:\n \"\"\"\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"{}\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2018-2025 The simdjson authors\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n \"\"\"\n\n- simdutf, located at deps/v8/third_party/simdutf, is licensed as follows:\n \"\"\"\n Copyright 2021 The simdutf authors\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of\n this software and associated documentation files (the \"Software\"), to deal in\n the Software without restriction, including without limitation the rights to\n use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n the Software, and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- ada, located at deps/ada, is licensed as follows:\n \"\"\"\n Copyright 2023 Yagiz Nizipli and Daniel Lemire\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of\n this software and associated documentation files (the \"Software\"), to deal in\n the Software without restriction, including without limitation the rights to\n use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n the Software, and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- minimatch, located at deps/minimatch, is licensed as follows:\n \"\"\"\n The ISC License\n\n Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors\n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted, provided that the above\n copyright notice and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR\n IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \"\"\"\n\n- npm, located at deps/npm, is licensed as follows:\n \"\"\"\n The npm application\n Copyright (c) npm, Inc. and Contributors\n Licensed on the terms of The Artistic License 2.0\n\n Node package dependencies of the npm application\n Copyright (c) their respective copyright owners\n Licensed on their respective license terms\n\n The npm public registry at https://registry.npmjs.org\n and the npm website at https://www.npmjs.com\n Operated by npm, Inc.\n Use governed by terms published on https://www.npmjs.com\n\n \"Node.js\"\n Trademark Joyent, Inc., https://joyent.com\n Neither npm nor npm, Inc. are affiliated with Joyent, Inc.\n\n The Node.js application\n Project of Node Foundation, https://nodejs.org\n\n The npm Logo\n Copyright (c) Mathias Pettersson and Brian Hammond\n\n \"Gubblebum Blocky\" typeface\n Copyright (c) Tjarda Koster, https://jelloween.deviantart.com\n Used with permission\n\n --------\n\n The Artistic License 2.0\n\n Copyright (c) 2000-2006, The Perl Foundation.\n\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n Preamble\n\n This license establishes the terms under which a given free software\n Package may be copied, modified, distributed, and/or redistributed.\n The intent is that the Copyright Holder maintains some artistic\n control over the development of that Package while still keeping the\n Package available as open source and free software.\n\n You are always permitted to make arrangements wholly outside of this\n license directly with the Copyright Holder of a given Package. If the\n terms of this license do not permit the full use that you propose to\n make of the Package, you should contact the Copyright Holder and seek\n a different licensing arrangement.\n\n Definitions\n\n \"Copyright Holder\" means the individual(s) or organization(s)\n named in the copyright notice for the entire Package.\n\n \"Contributor\" means any party that has contributed code or other\n material to the Package, in accordance with the Copyright Holder's\n procedures.\n\n \"You\" and \"your\" means any person who would like to copy,\n distribute, or modify the Package.\n\n \"Package\" means the collection of files distributed by the\n Copyright Holder, and derivatives of that collection and/or of\n those files. A given Package may consist of either the Standard\n Version, or a Modified Version.\n\n \"Distribute\" means providing a copy of the Package or making it\n accessible to anyone else, or in the case of a company or\n organization, to others outside of your company or organization.\n\n \"Distributor Fee\" means any fee that you charge for Distributing\n this Package or providing support for this Package to another\n party. It does not mean licensing fees.\n\n \"Standard Version\" refers to the Package if it has not been\n modified, or has been modified only in ways explicitly requested\n by the Copyright Holder.\n\n \"Modified Version\" means the Package, if it has been changed, and\n such changes were not explicitly requested by the Copyright\n Holder.\n\n \"Original License\" means this Artistic License as Distributed with\n the Standard Version of the Package, in its current version or as\n it may be modified by The Perl Foundation in the future.\n\n \"Source\" form means the source code, documentation source, and\n configuration files for the Package.\n\n \"Compiled\" form means the compiled bytecode, object code, binary,\n or any other form resulting from mechanical transformation or\n translation of the Source form.\n\n Permission for Use and Modification Without Distribution\n\n (1) You are permitted to use the Standard Version and create and use\n Modified Versions for any purpose without restriction, provided that\n you do not Distribute the Modified Version.\n\n Permissions for Redistribution of the Standard Version\n\n (2) You may Distribute verbatim copies of the Source form of the\n Standard Version of this Package in any medium without restriction,\n either gratis or for a Distributor Fee, provided that you duplicate\n all of the original copyright notices and associated disclaimers. At\n your discretion, such verbatim copies may or may not include a\n Compiled form of the Package.\n\n (3) You may apply any bug fixes, portability changes, and other\n modifications made available from the Copyright Holder. The resulting\n Package will still be considered the Standard Version, and as such\n will be subject to the Original License.\n\n Distribution of Modified Versions of the Package as Source\n\n (4) You may Distribute your Modified Version as Source (either gratis\n or for a Distributor Fee, and with or without a Compiled form of the\n Modified Version) provided that you clearly document how it differs\n from the Standard Version, including, but not limited to, documenting\n any non-standard features, executables, or modules, and provided that\n you do at least ONE of the following:\n\n (a) make the Modified Version available to the Copyright Holder\n of the Standard Version, under the Original License, so that the\n Copyright Holder may include your modifications in the Standard\n Version.\n\n (b) ensure that installation of your Modified Version does not\n prevent the user installing or running the Standard Version. In\n addition, the Modified Version must bear a name that is different\n from the name of the Standard Version.\n\n (c) allow anyone who receives a copy of the Modified Version to\n make the Source form of the Modified Version available to others\n under\n\n (i) the Original License or\n\n (ii) a license that permits the licensee to freely copy,\n modify and redistribute the Modified Version using the same\n licensing terms that apply to the copy that the licensee\n received, and requires that the Source form of the Modified\n Version, and of any works derived from it, be made freely\n available in that license fees are prohibited but Distributor\n Fees are allowed.\n\n Distribution of Compiled Forms of the Standard Version\n or Modified Versions without the Source\n\n (5) You may Distribute Compiled forms of the Standard Version without\n the Source, provided that you include complete instructions on how to\n get the Source of the Standard Version. Such instructions must be\n valid at the time of your distribution. If these instructions, at any\n time while you are carrying out such distribution, become invalid, you\n must provide new instructions on demand or cease further distribution.\n If you provide valid instructions or cease distribution within thirty\n days after you become aware that the instructions are invalid, then\n you do not forfeit any of your rights under this license.\n\n (6) You may Distribute a Modified Version in Compiled form without\n the Source, provided that you comply with Section 4 with respect to\n the Source of the Modified Version.\n\n Aggregating or Linking the Package\n\n (7) You may aggregate the Package (either the Standard Version or\n Modified Version) with other packages and Distribute the resulting\n aggregation provided that you do not charge a licensing fee for the\n Package. Distributor Fees are permitted, and licensing fees for other\n components in the aggregation are permitted. The terms of this license\n apply to the use and Distribution of the Standard or Modified Versions\n as included in the aggregation.\n\n (8) You are permitted to link Modified and Standard Versions with\n other works, to embed the Package in a larger work of your own, or to\n build stand-alone binary or bytecode versions of applications that\n include the Package, and Distribute the result without restriction,\n provided the result does not expose a direct interface to the Package.\n\n Items That are Not Considered Part of a Modified Version\n\n (9) Works (including, but not limited to, modules and scripts) that\n merely extend or make use of the Package, do not, by themselves, cause\n the Package to be a Modified Version. In addition, such works are not\n considered parts of the Package itself, and are not subject to the\n terms of this license.\n\n General Provisions\n\n (10) Any use, modification, and distribution of the Standard or\n Modified Versions is governed by this Artistic License. By using,\n modifying or distributing the Package, you accept this license. Do not\n use, modify, or distribute the Package, if you do not accept this\n license.\n\n (11) If your Modified Version has been derived from a Modified\n Version made by someone other than you, you are nevertheless required\n to ensure that your Modified Version complies with the requirements of\n this license.\n\n (12) This license does not grant you the right to use any trademark,\n service mark, tradename, or logo of the Copyright Holder.\n\n (13) This license includes the non-exclusive, worldwide,\n free-of-charge patent license to make, have made, use, offer to sell,\n sell, import and otherwise transfer the Package with respect to any\n patent claims licensable by the Copyright Holder that are necessarily\n infringed by the Package. If you institute patent litigation\n (including a cross-claim or counterclaim) against any party alleging\n that the Package constitutes direct or contributory patent\n infringement, then this Artistic License to you shall terminate on the\n date that such litigation is filed.\n\n (14) Disclaimer of Warranty:\n THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS \"AS\n IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED\n WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\n NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL\n LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL\n BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\n DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF\n ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n --------\n \"\"\"\n\n- GYP, located at tools/gyp, is licensed as follows:\n \"\"\"\n Copyright (c) 2020 Node.js contributors. All rights reserved.\n Copyright (c) 2009 Google Inc. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- inspector_protocol, located at deps/inspector_protocol, is licensed as follows:\n \"\"\"\n // Copyright 2016 The Chromium Authors.\n //\n // Redistribution and use in source and binary forms, with or without\n // modification, are permitted provided that the following conditions are\n // met:\n //\n // * Redistributions of source code must retain the above copyright\n // notice, this list of conditions and the following disclaimer.\n // * Redistributions in binary form must reproduce the above\n // copyright notice, this list of conditions and the following disclaimer\n // in the documentation and/or other materials provided with the\n // distribution.\n // * Neither the name of Google Inc. nor the names of its\n // contributors may be used to endorse or promote products derived from\n // this software without specific prior written permission.\n //\n // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n // \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- jinja2, located at tools/inspector_protocol/jinja2, is licensed as follows:\n \"\"\"\n Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- markupsafe, located at tools/inspector_protocol/markupsafe, is licensed as follows:\n \"\"\"\n Copyright (c) 2010 by Armin Ronacher and contributors. See AUTHORS\n for more details.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms of the software as well\n as documentation, with or without modification, are permitted provided\n that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT\n NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER\n OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n DAMAGE.\n \"\"\"\n\n- cpplint.py, located at tools/cpplint.py, is licensed as follows:\n \"\"\"\n Copyright (c) 2009 Google Inc. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- gypi_to_gn.py, located at tools/gypi_to_gn.py, is licensed as follows:\n \"\"\"\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n * Neither the name of Google LLC nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- gtest, located at deps/googletest, is licensed as follows:\n \"\"\"\n Copyright 2008, Google Inc.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- nghttp2, located at deps/nghttp2, is licensed as follows:\n \"\"\"\n The MIT License\n\n Copyright (c) 2012, 2014, 2015, 2016 Tatsuhiro Tsujikawa\n Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- large_pages, located at src/large_pages, is licensed as follows:\n \"\"\"\n Copyright (C) 2018 Intel Corporation\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"),\n to deal in the Software without restriction, including without limitation\n the rights to use, copy, modify, merge, publish, distribute, sublicense,\n and/or sell copies of the Software, and to permit persons to whom\n the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included\n in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES\n OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE\n OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- caja, located at lib/internal/freeze_intrinsics.js, is licensed as follows:\n \"\"\"\n Adapted from SES/Caja - Copyright (C) 2011 Google Inc.\n Copyright (C) 2018 Agoric\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n \"\"\"\n\n- brotli, located at deps/brotli, is licensed as follows:\n \"\"\"\n Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n \"\"\"\n\n- zstd, located at deps/zstd, is licensed as follows:\n \"\"\"\n BSD License\n\n For Zstandard software\n\n Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without modification,\n are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n * Neither the name Facebook, nor Meta, nor the names of its contributors may\n be used to endorse or promote products derived from this software without\n specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- HdrHistogram, located at deps/histogram, is licensed as follows:\n \"\"\"\n The code in this repository code was Written by Gil Tene, Michael Barker,\n and Matt Warren, and released to the public domain, as explained at\n http://creativecommons.org/publicdomain/zero/1.0/\n\n For users of this code who wish to consume it under the \"BSD\" license\n rather than under the public domain or CC0 contribution text mentioned\n above, the code found under this directory is *also* provided under the\n following license (commonly referred to as the BSD 2-Clause License). This\n license does not detract from the above stated release of the code into\n the public domain, and simply represents an additional license granted by\n the Author.\n\n -----------------------------------------------------------------------------\n ** Beginning of \"BSD 2-Clause License\" text. **\n\n Copyright (c) 2012, 2013, 2014 Gil Tene\n Copyright (c) 2014 Michael Barker\n Copyright (c) 2014 Matt Warren\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- node-heapdump, located at src/heap_utils.cc, is licensed as follows:\n \"\"\"\n ISC License\n\n Copyright (c) 2012, Ben Noordhuis \n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted, provided that the above\n copyright notice and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n === src/compat.h src/compat-inl.h ===\n\n ISC License\n\n Copyright (c) 2014, StrongLoop Inc.\n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted, provided that the above\n copyright notice and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \"\"\"\n\n- rimraf, located at lib/internal/fs/rimraf.js, is licensed as follows:\n \"\"\"\n The ISC License\n\n Copyright (c) Isaac Z. Schlueter and Contributors\n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted, provided that the above\n copyright notice and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR\n IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \"\"\"\n\n- uvwasi, located at deps/uvwasi, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) 2019 Colin Ihrig and Contributors\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- ngtcp2, located at deps/ngtcp2/ngtcp2/, is licensed as follows:\n \"\"\"\n The MIT License\n\n Copyright (c) 2016 ngtcp2 contributors\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- nghttp3, located at deps/ngtcp2/nghttp3/, is licensed as follows:\n \"\"\"\n The MIT License\n\n Copyright (c) 2019 nghttp3 contributors\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- node-fs-extra, located at lib/internal/fs/cp, is licensed as follows:\n \"\"\"\n (The MIT License)\n\n Copyright (c) 2011-2017 JP Richardson\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files\n (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,\n merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\n OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- on-exit-leak-free, located at lib/internal/process/finalization, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) 2021 Matteo Collina\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- sonic-boom, located at lib/internal/streams/fast-utf8-stream.js, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) 2017 Matteo Collina\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"" } } From 49a4c756bddc9766155f9ebfac03355df974a8f6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 10:32:37 -0700 Subject: [PATCH 70/74] chore(release): release packages from branch main (#2225) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- package-lock.json | 2 +- server/aws-lsp-codewhisperer/CHANGELOG.md | 7 +++++++ server/aws-lsp-codewhisperer/package.json | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 725a9c6b27..2cc2cea923 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -2,7 +2,7 @@ "chat-client": "0.1.35", "core/aws-lsp-core": "0.0.15", "server/aws-lsp-antlr4": "0.1.19", - "server/aws-lsp-codewhisperer": "0.0.78", + "server/aws-lsp-codewhisperer": "0.0.79", "server/aws-lsp-json": "0.1.19", "server/aws-lsp-partiql": "0.0.18", "server/aws-lsp-yaml": "0.1.19" diff --git a/package-lock.json b/package-lock.json index 4365c453a2..838f0c5fc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28677,7 +28677,7 @@ }, "server/aws-lsp-codewhisperer": { "name": "@aws/lsp-codewhisperer", - "version": "0.0.78", + "version": "0.0.79", "bundleDependencies": [ "@amzn/codewhisperer-streaming", "@amzn/amazon-q-developer-streaming-client" diff --git a/server/aws-lsp-codewhisperer/CHANGELOG.md b/server/aws-lsp-codewhisperer/CHANGELOG.md index 67d05de3c1..57a411ce81 100644 --- a/server/aws-lsp-codewhisperer/CHANGELOG.md +++ b/server/aws-lsp-codewhisperer/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.0.79](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.78...lsp-codewhisperer/v0.0.79) (2025-09-10) + + +### Features + +* feature to add iam inline suggestion support in codeWhispererservice ([#2223](https://github.com/aws/language-servers/issues/2223)) ([8e19f19](https://github.com/aws/language-servers/commit/8e19f19a71e63a1196f4cb67ded8360c8da8129e)) + ## [0.0.78](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.77...lsp-codewhisperer/v0.0.78) (2025-09-09) diff --git a/server/aws-lsp-codewhisperer/package.json b/server/aws-lsp-codewhisperer/package.json index 3fb2f48e69..0b03332380 100644 --- a/server/aws-lsp-codewhisperer/package.json +++ b/server/aws-lsp-codewhisperer/package.json @@ -1,6 +1,6 @@ { "name": "@aws/lsp-codewhisperer", - "version": "0.0.78", + "version": "0.0.79", "description": "CodeWhisperer Language Server", "main": "out/index.js", "repository": { From 2c50e6b85a5cb0f90d8e4ab4630424c09e1fb6b0 Mon Sep 17 00:00:00 2001 From: Richard Li <742829+rli@users.noreply.github.com> Date: Wed, 10 Sep 2025 17:21:15 -0700 Subject: [PATCH 71/74] build: remove node attribution from attribution/overrides.json (#2236) This is updated automatically by the build scripts --- attribution/overrides.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/attribution/overrides.json b/attribution/overrides.json index 5f4222b4ad..ed989c78d2 100644 --- a/attribution/overrides.json +++ b/attribution/overrides.json @@ -11,12 +11,5 @@ }, "caniuse-lite": { "ignore": true - }, - "node": { - "name": "Node.js", - "version": "24.7.0", - "url": "https://github.com/nodejs/node", - "license": "MIT", - "licenseText": "Node.js is licensed for use as follows:\n\n\"\"\"\nCopyright Node.js contributors. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n\nThis license applies to parts of Node.js originating from the\nhttps://github.com/joyent/node repository:\n\n\"\"\"\nCopyright Joyent, Inc. and other Node contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n\nThe Node.js license applies to all parts of Node.js that are not externally\nmaintained libraries.\n\nThe externally maintained libraries used by Node.js are:\n\n- Acorn, located at deps/acorn, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (C) 2012-2022 by various contributors (see AUTHORS)\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n \"\"\"\n\n- c-ares, located at deps/cares, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) 1998 Massachusetts Institute of Technology\n Copyright (c) 2007 - 2023 Daniel Stenberg with many contributors, see AUTHORS\n file.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of\n this software and associated documentation files (the \"Software\"), to deal in\n the Software without restriction, including without limitation the rights to\n use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n the Software, and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice (including the next\n paragraph) shall be included in all copies or substantial portions of the\n Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- cjs-module-lexer, located at deps/cjs-module-lexer, is licensed as follows:\n \"\"\"\n MIT License\n -----------\n\n Copyright (C) 2018-2020 Guy Bedford\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- ittapi, located at deps/v8/third_party/ittapi, is licensed as follows:\n \"\"\"\n Copyright (c) 2019 Intel Corporation. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- amaro, located at deps/amaro, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) Marco Ippolito and Amaro contributors\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- swc, located at deps/amaro/dist, is licensed as follows:\n \"\"\"\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2024 SWC contributors.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n \thttp://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n \"\"\"\n\n- ICU, located at deps/icu-small, is licensed as follows:\n \"\"\"\n UNICODE LICENSE V3\n\n COPYRIGHT AND PERMISSION NOTICE\n\n Copyright © 2016-2025 Unicode, Inc.\n\n NOTICE TO USER: Carefully read the following legal agreement. BY\n DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR\n SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE\n TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT\n DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.\n\n Permission is hereby granted, free of charge, to any person obtaining a\n copy of data files and any associated documentation (the \"Data Files\") or\n software and any associated documentation (the \"Software\") to deal in the\n Data Files or Software without restriction, including without limitation\n the rights to use, copy, modify, merge, publish, distribute, and/or sell\n copies of the Data Files or Software, and to permit persons to whom the\n Data Files or Software are furnished to do so, provided that either (a)\n this copyright and permission notice appear with all copies of the Data\n Files or Software, or (b) this copyright and permission notice appear in\n associated Documentation.\n\n THE DATA FILES AND SOFTWARE ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n THIRD PARTY RIGHTS.\n\n IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE\n BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,\n OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA\n FILES OR SOFTWARE.\n\n Except as contained in this notice, the name of a copyright holder shall\n not be used in advertising or otherwise to promote the sale, use or other\n dealings in these Data Files or Software without prior written\n authorization of the copyright holder.\n\n SPDX-License-Identifier: Unicode-3.0\n\n ----------------------------------------------------------------------\n\n Third-Party Software Licenses\n\n This section contains third-party software notices and/or additional\n terms for licensed third-party software components included within ICU\n libraries.\n\n ----------------------------------------------------------------------\n\n ICU License - ICU 1.8.1 to ICU 57.1\n\n COPYRIGHT AND PERMISSION NOTICE\n\n Copyright (c) 1995-2016 International Business Machines Corporation and others\n All rights reserved.\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, and/or sell copies of the Software, and to permit persons\n to whom the Software is furnished to do so, provided that the above\n copyright notice(s) and this permission notice appear in all copies of\n the Software and that both the above copyright notice(s) and this\n permission notice appear in supporting documentation.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\n OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY\n SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER\n RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF\n CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\n CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n Except as contained in this notice, the name of a copyright holder\n shall not be used in advertising or otherwise to promote the sale, use\n or other dealings in this Software without prior written authorization\n of the copyright holder.\n\n All trademarks and registered trademarks mentioned herein are the\n property of their respective owners.\n\n ----------------------------------------------------------------------\n\n Chinese/Japanese Word Break Dictionary Data (cjdict.txt)\n\n # The Google Chrome software developed by Google is licensed under\n # the BSD license. Other software included in this distribution is\n # provided under other licenses, as set forth below.\n #\n # The BSD License\n # http://opensource.org/licenses/bsd-license.php\n # Copyright (C) 2006-2008, Google Inc.\n #\n # All rights reserved.\n #\n # Redistribution and use in source and binary forms, with or without\n # modification, are permitted provided that the following conditions are met:\n #\n # Redistributions of source code must retain the above copyright notice,\n # this list of conditions and the following disclaimer.\n # Redistributions in binary form must reproduce the above\n # copyright notice, this list of conditions and the following\n # disclaimer in the documentation and/or other materials provided with\n # the distribution.\n # Neither the name of Google Inc. nor the names of its\n # contributors may be used to endorse or promote products derived from\n # this software without specific prior written permission.\n #\n #\n # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n # CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n #\n #\n # The word list in cjdict.txt are generated by combining three word lists\n # listed below with further processing for compound word breaking. The\n # frequency is generated with an iterative training against Google web\n # corpora.\n #\n # * Libtabe (Chinese)\n # - https://sourceforge.net/project/?group_id=1519\n # - Its license terms and conditions are shown below.\n #\n # * IPADIC (Japanese)\n # - http://chasen.aist-nara.ac.jp/chasen/distribution.html\n # - Its license terms and conditions are shown below.\n #\n # ---------COPYING.libtabe ---- BEGIN--------------------\n #\n # /*\n # * Copyright (c) 1999 TaBE Project.\n # * Copyright (c) 1999 Pai-Hsiang Hsiao.\n # * All rights reserved.\n # *\n # * Redistribution and use in source and binary forms, with or without\n # * modification, are permitted provided that the following conditions\n # * are met:\n # *\n # * . Redistributions of source code must retain the above copyright\n # * notice, this list of conditions and the following disclaimer.\n # * . Redistributions in binary form must reproduce the above copyright\n # * notice, this list of conditions and the following disclaimer in\n # * the documentation and/or other materials provided with the\n # * distribution.\n # * . Neither the name of the TaBE Project nor the names of its\n # * contributors may be used to endorse or promote products derived\n # * from this software without specific prior written permission.\n # *\n # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n # * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n # * OF THE POSSIBILITY OF SUCH DAMAGE.\n # */\n #\n # /*\n # * Copyright (c) 1999 Computer Systems and Communication Lab,\n # * Institute of Information Science, Academia\n # * Sinica. All rights reserved.\n # *\n # * Redistribution and use in source and binary forms, with or without\n # * modification, are permitted provided that the following conditions\n # * are met:\n # *\n # * . Redistributions of source code must retain the above copyright\n # * notice, this list of conditions and the following disclaimer.\n # * . Redistributions in binary form must reproduce the above copyright\n # * notice, this list of conditions and the following disclaimer in\n # * the documentation and/or other materials provided with the\n # * distribution.\n # * . Neither the name of the Computer Systems and Communication Lab\n # * nor the names of its contributors may be used to endorse or\n # * promote products derived from this software without specific\n # * prior written permission.\n # *\n # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n # * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n # * OF THE POSSIBILITY OF SUCH DAMAGE.\n # */\n #\n # Copyright 1996 Chih-Hao Tsai @ Beckman Institute,\n # University of Illinois\n # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4\n #\n # ---------------COPYING.libtabe-----END--------------------------------\n #\n #\n # ---------------COPYING.ipadic-----BEGIN-------------------------------\n #\n # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science\n # and Technology. All Rights Reserved.\n #\n # Use, reproduction, and distribution of this software is permitted.\n # Any copy of this software, whether in its original form or modified,\n # must include both the above copyright notice and the following\n # paragraphs.\n #\n # Nara Institute of Science and Technology (NAIST),\n # the copyright holders, disclaims all warranties with regard to this\n # software, including all implied warranties of merchantability and\n # fitness, in no event shall NAIST be liable for\n # any special, indirect or consequential damages or any damages\n # whatsoever resulting from loss of use, data or profits, whether in an\n # action of contract, negligence or other tortuous action, arising out\n # of or in connection with the use or performance of this software.\n #\n # A large portion of the dictionary entries\n # originate from ICOT Free Software. The following conditions for ICOT\n # Free Software applies to the current dictionary as well.\n #\n # Each User may also freely distribute the Program, whether in its\n # original form or modified, to any third party or parties, PROVIDED\n # that the provisions of Section 3 (\"NO WARRANTY\") will ALWAYS appear\n # on, or be attached to, the Program, which is distributed substantially\n # in the same form as set out herein and that such intended\n # distribution, if actually made, will neither violate or otherwise\n # contravene any of the laws and regulations of the countries having\n # jurisdiction over the User or the intended distribution itself.\n #\n # NO WARRANTY\n #\n # The program was produced on an experimental basis in the course of the\n # research and development conducted during the project and is provided\n # to users as so produced on an experimental basis. Accordingly, the\n # program is provided without any warranty whatsoever, whether express,\n # implied, statutory or otherwise. The term \"warranty\" used herein\n # includes, but is not limited to, any warranty of the quality,\n # performance, merchantability and fitness for a particular purpose of\n # the program and the nonexistence of any infringement or violation of\n # any right of any third party.\n #\n # Each user of the program will agree and understand, and be deemed to\n # have agreed and understood, that there is no warranty whatsoever for\n # the program and, accordingly, the entire risk arising from or\n # otherwise connected with the program is assumed by the user.\n #\n # Therefore, neither ICOT, the copyright holder, or any other\n # organization that participated in or was otherwise related to the\n # development of the program and their respective officials, directors,\n # officers and other employees shall be held liable for any and all\n # damages, including, without limitation, general, special, incidental\n # and consequential damages, arising out of or otherwise in connection\n # with the use or inability to use the program or any product, material\n # or result produced or otherwise obtained by using the program,\n # regardless of whether they have been advised of, or otherwise had\n # knowledge of, the possibility of such damages at any time during the\n # project or thereafter. Each user will be deemed to have agreed to the\n # foregoing by his or her commencement of use of the program. The term\n # \"use\" as used herein includes, but is not limited to, the use,\n # modification, copying and distribution of the program and the\n # production of secondary products from the program.\n #\n # In the case where the program, whether in its original form or\n # modified, was distributed or delivered to or received by a user from\n # any person, organization or entity other than ICOT, unless it makes or\n # grants independently of ICOT any specific warranty to the user in\n # writing, such person, organization or entity, will also be exempted\n # from and not be held liable to the user for any such damages as noted\n # above as far as the program is concerned.\n #\n # ---------------COPYING.ipadic-----END----------------------------------\n\n ----------------------------------------------------------------------\n\n Lao Word Break Dictionary Data (laodict.txt)\n\n # Copyright (C) 2016 and later: Unicode, Inc. and others.\n # License & terms of use: http://www.unicode.org/copyright.html\n # Copyright (c) 2015 International Business Machines Corporation\n # and others. All Rights Reserved.\n #\n # Project: https://github.com/rober42539/lao-dictionary\n # Dictionary: https://github.com/rober42539/lao-dictionary/laodict.txt\n # License: https://github.com/rober42539/lao-dictionary/LICENSE.txt\n # (copied below)\n #\n # This file is derived from the above dictionary version of Nov 22, 2020\n # ----------------------------------------------------------------------\n # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell.\n # All rights reserved.\n #\n # Redistribution and use in source and binary forms, with or without\n # modification, are permitted provided that the following conditions are met:\n #\n # Redistributions of source code must retain the above copyright notice, this\n # list of conditions and the following disclaimer. Redistributions in binary\n # form must reproduce the above copyright notice, this list of conditions and\n # the following disclaimer in the documentation and/or other materials\n # provided with the distribution.\n #\n # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n # \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n # OF THE POSSIBILITY OF SUCH DAMAGE.\n # --------------------------------------------------------------------------\n\n ----------------------------------------------------------------------\n\n Burmese Word Break Dictionary Data (burmesedict.txt)\n\n # Copyright (c) 2014 International Business Machines Corporation\n # and others. All Rights Reserved.\n #\n # This list is part of a project hosted at:\n # github.com/kanyawtech/myanmar-karen-word-lists\n #\n # --------------------------------------------------------------------------\n # Copyright (c) 2013, LeRoy Benjamin Sharon\n # All rights reserved.\n #\n # Redistribution and use in source and binary forms, with or without\n # modification, are permitted provided that the following conditions\n # are met: Redistributions of source code must retain the above\n # copyright notice, this list of conditions and the following\n # disclaimer. Redistributions in binary form must reproduce the\n # above copyright notice, this list of conditions and the following\n # disclaimer in the documentation and/or other materials provided\n # with the distribution.\n #\n # Neither the name Myanmar Karen Word Lists, nor the names of its\n # contributors may be used to endorse or promote products derived\n # from this software without specific prior written permission.\n #\n # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n # CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS\n # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\n # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR\n # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF\n # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n # SUCH DAMAGE.\n # --------------------------------------------------------------------------\n\n ----------------------------------------------------------------------\n\n Time Zone Database\n\n ICU uses the public domain data and code derived from Time Zone\n Database for its time zone support. The ownership of the TZ database\n is explained in BCP 175: Procedure for Maintaining the Time Zone\n Database section 7.\n\n # 7. Database Ownership\n #\n # The TZ database itself is not an IETF Contribution or an IETF\n # document. Rather it is a pre-existing and regularly updated work\n # that is in the public domain, and is intended to remain in the\n # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do\n # not apply to the TZ Database or contributions that individuals make\n # to it. Should any claims be made and substantiated against the TZ\n # Database, the organization that is providing the IANA\n # Considerations defined in this RFC, under the memorandum of\n # understanding with the IETF, currently ICANN, may act in accordance\n # with all competent court orders. No ownership claims will be made\n # by ICANN or the IETF Trust on the database or the code. Any person\n # making a contribution to the database or code waives all rights to\n # future claims in that contribution or in the TZ Database.\n\n ----------------------------------------------------------------------\n\n Google double-conversion\n\n Copyright 2006-2011, the V8 project authors. All rights reserved.\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived\n from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n ----------------------------------------------------------------------\n\n JSON parsing library (nlohmann/json)\n\n File: vendor/json/upstream/single_include/nlohmann/json.hpp (only for ICU4C)\n\n MIT License\n\n Copyright (c) 2013-2022 Niels Lohmann\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n ----------------------------------------------------------------------\n\n File: aclocal.m4 (only for ICU4C)\n Section: pkg.m4 - Macros to locate and utilise pkg-config.\n\n Copyright © 2004 Scott James Remnant .\n Copyright © 2012-2015 Dan Nicholson\n\n This program is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 2 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful, but\n WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program; if not, write to the Free Software\n Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n 02111-1307, USA.\n\n As a special exception to the GNU General Public License, if you\n distribute this file as part of a program that contains a\n configuration script generated by Autoconf, you may include it under\n the same distribution terms that you use for the rest of that\n program.\n\n (The condition for the exception is fulfilled because\n ICU4C includes a configuration script generated by Autoconf,\n namely the `configure` script.)\n\n ----------------------------------------------------------------------\n\n File: config.guess (only for ICU4C)\n\n This file is free software; you can redistribute it and/or modify it\n under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful, but\n WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program; if not, see .\n\n As a special exception to the GNU General Public License, if you\n distribute this file as part of a program that contains a\n configuration script generated by Autoconf, you may include it under\n the same distribution terms that you use for the rest of that\n program. This Exception is an additional permission under section 7\n of the GNU General Public License, version 3 (\"GPLv3\").\n\n (The condition for the exception is fulfilled because\n ICU4C includes a configuration script generated by Autoconf,\n namely the `configure` script.)\n\n ----------------------------------------------------------------------\n\n File: install-sh (only for ICU4C)\n\n Copyright 1991 by the Massachusetts Institute of Technology\n\n Permission to use, copy, modify, distribute, and sell this software and its\n documentation for any purpose is hereby granted without fee, provided that\n the above copyright notice appear in all copies and that both that\n copyright notice and this permission notice appear in supporting\n documentation, and that the name of M.I.T. not be used in advertising or\n publicity pertaining to distribution of the software without specific,\n written prior permission. M.I.T. makes no representations about the\n suitability of this software for any purpose. It is provided \"as is\"\n without express or implied warranty.\n \"\"\"\n\n- libuv, located at deps/uv, is licensed as follows:\n \"\"\"\n Copyright (c) 2015-present libuv project contributors.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to\n deal in the Software without restriction, including without limitation the\n rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n sell copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n IN THE SOFTWARE.\n This license applies to parts of libuv originating from the\n https://github.com/joyent/libuv repository:\n\n ====\n\n Copyright Joyent, Inc. and other Node contributors. All rights reserved.\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to\n deal in the Software without restriction, including without limitation the\n rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n sell copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n IN THE SOFTWARE.\n\n ====\n\n This license applies to all parts of libuv that are not externally\n maintained libraries.\n\n The externally maintained libraries used by libuv are:\n\n - tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license.\n\n - inet_pton and inet_ntop implementations, contained in src/inet.c, are\n copyright the Internet Systems Consortium, Inc., and licensed under the ISC\n license.\n \"\"\"\n\n- llhttp, located at deps/llhttp, is licensed as follows:\n \"\"\"\n This software is licensed under the MIT License.\n\n Copyright Fedor Indutny, 2018.\n\n Permission is hereby granted, free of charge, to any person obtaining a\n copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to permit\n persons to whom the Software is furnished to do so, subject to the\n following conditions:\n\n The above copyright notice and this permission notice shall be included\n in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- corepack, located at deps/corepack, is licensed as follows:\n \"\"\"\n **Copyright © Corepack contributors**\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- undici, located at deps/undici, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) Matteo Collina and Undici contributors\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- postject, located at test/fixtures/postject-copy, is licensed as follows:\n \"\"\"\n Postject is licensed for use as follows:\n\n \"\"\"\n MIT License\n\n Copyright (c) 2022 Postman, Inc\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n The Postject license applies to all parts of Postject that are not externally\n maintained libraries.\n\n The externally maintained libraries used by Postject are:\n\n - LIEF, located at vendor/LIEF, is licensed as follows:\n \"\"\"\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"{}\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2017 - 2022 R. Thomas\n Copyright 2017 - 2022 Quarkslab\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n \"\"\"\n \"\"\"\n\n- OpenSSL, located at deps/openssl, is licensed as follows:\n \"\"\"\n Apache License\n Version 2.0, January 2004\n https://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n \"\"\"\n\n- Punycode.js, located at lib/punycode.js, is licensed as follows:\n \"\"\"\n Copyright Mathias Bynens \n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- V8, located at deps/v8, is licensed as follows:\n \"\"\"\n This license applies to all parts of V8 that are not externally\n maintained libraries. The externally maintained libraries used by V8\n are:\n\n - PCRE test suite, located in\n test/mjsunit/third_party/regexp-pcre/regexp-pcre.js. This is based on the\n test suite from PCRE-7.3, which is copyrighted by the University\n of Cambridge and Google, Inc. The copyright notice and license\n are embedded in regexp-pcre.js.\n\n - Layout tests, located in test/mjsunit/third_party/object-keys. These are\n based on layout tests from webkit.org which are copyrighted by\n Apple Computer, Inc. and released under a 3-clause BSD license.\n\n - Strongtalk assembler, the basis of the files assembler-arm-inl.h,\n assembler-arm.cc, assembler-arm.h, assembler-ia32-inl.h,\n assembler-ia32.cc, assembler-ia32.h, assembler-x64-inl.h,\n assembler-x64.cc, assembler-x64.h, assembler.cc and assembler.h.\n This code is copyrighted by Sun Microsystems Inc. and released\n under a 3-clause BSD license.\n\n - Valgrind client API header, located at third_party/valgrind/valgrind.h\n This is released under the BSD license.\n\n - The Wasm C/C++ API headers, located at third_party/wasm-api/wasm.{h,hh}\n This is released under the Apache license. The API's upstream prototype\n implementation also formed the basis of V8's implementation in\n src/wasm/c-api.cc.\n\n These libraries have their own licenses; we recommend you read them,\n as their terms may differ from the terms below.\n\n Further license information can be found in LICENSE files located in\n sub-directories.\n\n Copyright 2014, the V8 project authors. All rights reserved.\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived\n from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- SipHash, located at deps/v8/src/third_party/siphash, is licensed as follows:\n \"\"\"\n SipHash reference C implementation\n\n Copyright (c) 2016 Jean-Philippe Aumasson \n\n To the extent possible under law, the author(s) have dedicated all\n copyright and related and neighboring rights to this software to the public\n domain worldwide. This software is distributed without any warranty.\n \"\"\"\n\n- zlib, located at deps/zlib, is licensed as follows:\n \"\"\"\n zlib.h -- interface of the 'zlib' general purpose compression library\n version 1.3.1, January 22nd, 2024\n\n Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler\n\n This software is provided 'as-is', without any express or implied\n warranty. In no event will the authors be held liable for any damages\n arising from the use of this software.\n\n Permission is granted to anyone to use this software for any purpose,\n including commercial applications, and to alter it and redistribute it\n freely, subject to the following restrictions:\n\n 1. The origin of this software must not be misrepresented; you must not\n claim that you wrote the original software. If you use this software\n in a product, an acknowledgment in the product documentation would be\n appreciated but is not required.\n 2. Altered source versions must be plainly marked as such, and must not be\n misrepresented as being the original software.\n 3. This notice may not be removed or altered from any source distribution.\n\n Jean-loup Gailly Mark Adler\n jloup@gzip.org madler@alumni.caltech.edu\n \"\"\"\n\n- simdjson, located at deps/simdjson, is licensed as follows:\n \"\"\"\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"{}\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2018-2025 The simdjson authors\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n \"\"\"\n\n- simdutf, located at deps/v8/third_party/simdutf, is licensed as follows:\n \"\"\"\n Copyright 2021 The simdutf authors\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of\n this software and associated documentation files (the \"Software\"), to deal in\n the Software without restriction, including without limitation the rights to\n use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n the Software, and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- ada, located at deps/ada, is licensed as follows:\n \"\"\"\n Copyright 2023 Yagiz Nizipli and Daniel Lemire\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of\n this software and associated documentation files (the \"Software\"), to deal in\n the Software without restriction, including without limitation the rights to\n use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n the Software, and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- minimatch, located at deps/minimatch, is licensed as follows:\n \"\"\"\n The ISC License\n\n Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors\n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted, provided that the above\n copyright notice and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR\n IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \"\"\"\n\n- npm, located at deps/npm, is licensed as follows:\n \"\"\"\n The npm application\n Copyright (c) npm, Inc. and Contributors\n Licensed on the terms of The Artistic License 2.0\n\n Node package dependencies of the npm application\n Copyright (c) their respective copyright owners\n Licensed on their respective license terms\n\n The npm public registry at https://registry.npmjs.org\n and the npm website at https://www.npmjs.com\n Operated by npm, Inc.\n Use governed by terms published on https://www.npmjs.com\n\n \"Node.js\"\n Trademark Joyent, Inc., https://joyent.com\n Neither npm nor npm, Inc. are affiliated with Joyent, Inc.\n\n The Node.js application\n Project of Node Foundation, https://nodejs.org\n\n The npm Logo\n Copyright (c) Mathias Pettersson and Brian Hammond\n\n \"Gubblebum Blocky\" typeface\n Copyright (c) Tjarda Koster, https://jelloween.deviantart.com\n Used with permission\n\n --------\n\n The Artistic License 2.0\n\n Copyright (c) 2000-2006, The Perl Foundation.\n\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n Preamble\n\n This license establishes the terms under which a given free software\n Package may be copied, modified, distributed, and/or redistributed.\n The intent is that the Copyright Holder maintains some artistic\n control over the development of that Package while still keeping the\n Package available as open source and free software.\n\n You are always permitted to make arrangements wholly outside of this\n license directly with the Copyright Holder of a given Package. If the\n terms of this license do not permit the full use that you propose to\n make of the Package, you should contact the Copyright Holder and seek\n a different licensing arrangement.\n\n Definitions\n\n \"Copyright Holder\" means the individual(s) or organization(s)\n named in the copyright notice for the entire Package.\n\n \"Contributor\" means any party that has contributed code or other\n material to the Package, in accordance with the Copyright Holder's\n procedures.\n\n \"You\" and \"your\" means any person who would like to copy,\n distribute, or modify the Package.\n\n \"Package\" means the collection of files distributed by the\n Copyright Holder, and derivatives of that collection and/or of\n those files. A given Package may consist of either the Standard\n Version, or a Modified Version.\n\n \"Distribute\" means providing a copy of the Package or making it\n accessible to anyone else, or in the case of a company or\n organization, to others outside of your company or organization.\n\n \"Distributor Fee\" means any fee that you charge for Distributing\n this Package or providing support for this Package to another\n party. It does not mean licensing fees.\n\n \"Standard Version\" refers to the Package if it has not been\n modified, or has been modified only in ways explicitly requested\n by the Copyright Holder.\n\n \"Modified Version\" means the Package, if it has been changed, and\n such changes were not explicitly requested by the Copyright\n Holder.\n\n \"Original License\" means this Artistic License as Distributed with\n the Standard Version of the Package, in its current version or as\n it may be modified by The Perl Foundation in the future.\n\n \"Source\" form means the source code, documentation source, and\n configuration files for the Package.\n\n \"Compiled\" form means the compiled bytecode, object code, binary,\n or any other form resulting from mechanical transformation or\n translation of the Source form.\n\n Permission for Use and Modification Without Distribution\n\n (1) You are permitted to use the Standard Version and create and use\n Modified Versions for any purpose without restriction, provided that\n you do not Distribute the Modified Version.\n\n Permissions for Redistribution of the Standard Version\n\n (2) You may Distribute verbatim copies of the Source form of the\n Standard Version of this Package in any medium without restriction,\n either gratis or for a Distributor Fee, provided that you duplicate\n all of the original copyright notices and associated disclaimers. At\n your discretion, such verbatim copies may or may not include a\n Compiled form of the Package.\n\n (3) You may apply any bug fixes, portability changes, and other\n modifications made available from the Copyright Holder. The resulting\n Package will still be considered the Standard Version, and as such\n will be subject to the Original License.\n\n Distribution of Modified Versions of the Package as Source\n\n (4) You may Distribute your Modified Version as Source (either gratis\n or for a Distributor Fee, and with or without a Compiled form of the\n Modified Version) provided that you clearly document how it differs\n from the Standard Version, including, but not limited to, documenting\n any non-standard features, executables, or modules, and provided that\n you do at least ONE of the following:\n\n (a) make the Modified Version available to the Copyright Holder\n of the Standard Version, under the Original License, so that the\n Copyright Holder may include your modifications in the Standard\n Version.\n\n (b) ensure that installation of your Modified Version does not\n prevent the user installing or running the Standard Version. In\n addition, the Modified Version must bear a name that is different\n from the name of the Standard Version.\n\n (c) allow anyone who receives a copy of the Modified Version to\n make the Source form of the Modified Version available to others\n under\n\n (i) the Original License or\n\n (ii) a license that permits the licensee to freely copy,\n modify and redistribute the Modified Version using the same\n licensing terms that apply to the copy that the licensee\n received, and requires that the Source form of the Modified\n Version, and of any works derived from it, be made freely\n available in that license fees are prohibited but Distributor\n Fees are allowed.\n\n Distribution of Compiled Forms of the Standard Version\n or Modified Versions without the Source\n\n (5) You may Distribute Compiled forms of the Standard Version without\n the Source, provided that you include complete instructions on how to\n get the Source of the Standard Version. Such instructions must be\n valid at the time of your distribution. If these instructions, at any\n time while you are carrying out such distribution, become invalid, you\n must provide new instructions on demand or cease further distribution.\n If you provide valid instructions or cease distribution within thirty\n days after you become aware that the instructions are invalid, then\n you do not forfeit any of your rights under this license.\n\n (6) You may Distribute a Modified Version in Compiled form without\n the Source, provided that you comply with Section 4 with respect to\n the Source of the Modified Version.\n\n Aggregating or Linking the Package\n\n (7) You may aggregate the Package (either the Standard Version or\n Modified Version) with other packages and Distribute the resulting\n aggregation provided that you do not charge a licensing fee for the\n Package. Distributor Fees are permitted, and licensing fees for other\n components in the aggregation are permitted. The terms of this license\n apply to the use and Distribution of the Standard or Modified Versions\n as included in the aggregation.\n\n (8) You are permitted to link Modified and Standard Versions with\n other works, to embed the Package in a larger work of your own, or to\n build stand-alone binary or bytecode versions of applications that\n include the Package, and Distribute the result without restriction,\n provided the result does not expose a direct interface to the Package.\n\n Items That are Not Considered Part of a Modified Version\n\n (9) Works (including, but not limited to, modules and scripts) that\n merely extend or make use of the Package, do not, by themselves, cause\n the Package to be a Modified Version. In addition, such works are not\n considered parts of the Package itself, and are not subject to the\n terms of this license.\n\n General Provisions\n\n (10) Any use, modification, and distribution of the Standard or\n Modified Versions is governed by this Artistic License. By using,\n modifying or distributing the Package, you accept this license. Do not\n use, modify, or distribute the Package, if you do not accept this\n license.\n\n (11) If your Modified Version has been derived from a Modified\n Version made by someone other than you, you are nevertheless required\n to ensure that your Modified Version complies with the requirements of\n this license.\n\n (12) This license does not grant you the right to use any trademark,\n service mark, tradename, or logo of the Copyright Holder.\n\n (13) This license includes the non-exclusive, worldwide,\n free-of-charge patent license to make, have made, use, offer to sell,\n sell, import and otherwise transfer the Package with respect to any\n patent claims licensable by the Copyright Holder that are necessarily\n infringed by the Package. If you institute patent litigation\n (including a cross-claim or counterclaim) against any party alleging\n that the Package constitutes direct or contributory patent\n infringement, then this Artistic License to you shall terminate on the\n date that such litigation is filed.\n\n (14) Disclaimer of Warranty:\n THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS \"AS\n IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED\n WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR\n NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL\n LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL\n BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\n DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF\n ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n --------\n \"\"\"\n\n- GYP, located at tools/gyp, is licensed as follows:\n \"\"\"\n Copyright (c) 2020 Node.js contributors. All rights reserved.\n Copyright (c) 2009 Google Inc. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- inspector_protocol, located at deps/inspector_protocol, is licensed as follows:\n \"\"\"\n // Copyright 2016 The Chromium Authors.\n //\n // Redistribution and use in source and binary forms, with or without\n // modification, are permitted provided that the following conditions are\n // met:\n //\n // * Redistributions of source code must retain the above copyright\n // notice, this list of conditions and the following disclaimer.\n // * Redistributions in binary form must reproduce the above\n // copyright notice, this list of conditions and the following disclaimer\n // in the documentation and/or other materials provided with the\n // distribution.\n // * Neither the name of Google Inc. nor the names of its\n // contributors may be used to endorse or promote products derived from\n // this software without specific prior written permission.\n //\n // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n // \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- jinja2, located at tools/inspector_protocol/jinja2, is licensed as follows:\n \"\"\"\n Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- markupsafe, located at tools/inspector_protocol/markupsafe, is licensed as follows:\n \"\"\"\n Copyright (c) 2010 by Armin Ronacher and contributors. See AUTHORS\n for more details.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms of the software as well\n as documentation, with or without modification, are permitted provided\n that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT\n NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER\n OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n DAMAGE.\n \"\"\"\n\n- cpplint.py, located at tools/cpplint.py, is licensed as follows:\n \"\"\"\n Copyright (c) 2009 Google Inc. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- gypi_to_gn.py, located at tools/gypi_to_gn.py, is licensed as follows:\n \"\"\"\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n * Neither the name of Google LLC nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- gtest, located at deps/googletest, is licensed as follows:\n \"\"\"\n Copyright 2008, Google Inc.\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- nghttp2, located at deps/nghttp2, is licensed as follows:\n \"\"\"\n The MIT License\n\n Copyright (c) 2012, 2014, 2015, 2016 Tatsuhiro Tsujikawa\n Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- large_pages, located at src/large_pages, is licensed as follows:\n \"\"\"\n Copyright (C) 2018 Intel Corporation\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"),\n to deal in the Software without restriction, including without limitation\n the rights to use, copy, modify, merge, publish, distribute, sublicense,\n and/or sell copies of the Software, and to permit persons to whom\n the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included\n in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES\n OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE\n OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- caja, located at lib/internal/freeze_intrinsics.js, is licensed as follows:\n \"\"\"\n Adapted from SES/Caja - Copyright (C) 2011 Google Inc.\n Copyright (C) 2018 Agoric\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n \"\"\"\n\n- brotli, located at deps/brotli, is licensed as follows:\n \"\"\"\n Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n \"\"\"\n\n- zstd, located at deps/zstd, is licensed as follows:\n \"\"\"\n BSD License\n\n For Zstandard software\n\n Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without modification,\n are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n * Neither the name Facebook, nor Meta, nor the names of its contributors may\n be used to endorse or promote products derived from this software without\n specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- HdrHistogram, located at deps/histogram, is licensed as follows:\n \"\"\"\n The code in this repository code was Written by Gil Tene, Michael Barker,\n and Matt Warren, and released to the public domain, as explained at\n http://creativecommons.org/publicdomain/zero/1.0/\n\n For users of this code who wish to consume it under the \"BSD\" license\n rather than under the public domain or CC0 contribution text mentioned\n above, the code found under this directory is *also* provided under the\n following license (commonly referred to as the BSD 2-Clause License). This\n license does not detract from the above stated release of the code into\n the public domain, and simply represents an additional license granted by\n the Author.\n\n -----------------------------------------------------------------------------\n ** Beginning of \"BSD 2-Clause License\" text. **\n\n Copyright (c) 2012, 2013, 2014 Gil Tene\n Copyright (c) 2014 Michael Barker\n Copyright (c) 2014 Matt Warren\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n THE POSSIBILITY OF SUCH DAMAGE.\n \"\"\"\n\n- node-heapdump, located at src/heap_utils.cc, is licensed as follows:\n \"\"\"\n ISC License\n\n Copyright (c) 2012, Ben Noordhuis \n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted, provided that the above\n copyright notice and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n === src/compat.h src/compat-inl.h ===\n\n ISC License\n\n Copyright (c) 2014, StrongLoop Inc.\n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted, provided that the above\n copyright notice and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \"\"\"\n\n- rimraf, located at lib/internal/fs/rimraf.js, is licensed as follows:\n \"\"\"\n The ISC License\n\n Copyright (c) Isaac Z. Schlueter and Contributors\n\n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted, provided that the above\n copyright notice and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR\n IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \"\"\"\n\n- uvwasi, located at deps/uvwasi, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) 2019 Colin Ihrig and Contributors\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- ngtcp2, located at deps/ngtcp2/ngtcp2/, is licensed as follows:\n \"\"\"\n The MIT License\n\n Copyright (c) 2016 ngtcp2 contributors\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- nghttp3, located at deps/ngtcp2/nghttp3/, is licensed as follows:\n \"\"\"\n The MIT License\n\n Copyright (c) 2019 nghttp3 contributors\n\n Permission is hereby granted, free of charge, to any person obtaining\n a copy of this software and associated documentation files (the\n \"Software\"), to deal in the Software without restriction, including\n without limitation the rights to use, copy, modify, merge, publish,\n distribute, sublicense, and/or sell copies of the Software, and to\n permit persons to whom the Software is furnished to do so, subject to\n the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- node-fs-extra, located at lib/internal/fs/cp, is licensed as follows:\n \"\"\"\n (The MIT License)\n\n Copyright (c) 2011-2017 JP Richardson\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files\n (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,\n merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\n OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \"\"\"\n\n- on-exit-leak-free, located at lib/internal/process/finalization, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) 2021 Matteo Collina\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"\n\n- sonic-boom, located at lib/internal/streams/fast-utf8-stream.js, is licensed as follows:\n \"\"\"\n MIT License\n\n Copyright (c) 2017 Matteo Collina\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n \"\"\"" } } From 5ce51896e68ba1fb366d2888574c3f2034b1c9f9 Mon Sep 17 00:00:00 2001 From: Richard Li <742829+rli@users.noreply.github.com> Date: Thu, 11 Sep 2025 00:03:53 -0700 Subject: [PATCH 72/74] build: fix download-node.sh (#2237) `download-node.sh` incorrectly reports success if `jq` fails --- .../scripts/download-node.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/aws-lsp-codewhisperer-runtimes/scripts/download-node.sh b/app/aws-lsp-codewhisperer-runtimes/scripts/download-node.sh index 44c3c1c462..db99f68d06 100755 --- a/app/aws-lsp-codewhisperer-runtimes/scripts/download-node.sh +++ b/app/aws-lsp-codewhisperer-runtimes/scripts/download-node.sh @@ -4,7 +4,7 @@ # build/node-assets, which is picked up # by src/scripts/copy-node-assets.ts, to produce the final bundle. -set -e +set -eo pipefail NODE_VERSION="24" BASE_URL="https://nodejs.org/download/release/latest-v${NODE_VERSION}.x" SHASUMS_FILE="SHASUMS256.txt" @@ -69,9 +69,6 @@ fi echo "License file has been updated in $LICENSE_FILE" -# Read the escaped license text -LICENSE_TEXT=$(cat "$LICENSE_FILE") - # Update the attribution overrides file ATTRIBUTION_FILE="../../attribution/overrides.json" @@ -86,11 +83,13 @@ fi jq --indent 4 \ --arg name "Node.js" \ --arg version "$NODE_SEMVER" \ - --arg licenseText "$LICENSE_TEXT" \ + --rawfile licenseText "$LICENSE_FILE" \ --arg url "https://github.com/nodejs/node" \ --arg license "MIT" \ '.node.name = $name | .node.version = $version | .node.url = $url | .node.license = $license | .node.licenseText = $licenseText' \ - "$ATTRIBUTION_FILE" > "$ATTRIBUTION_FILE.tmp" && mv "$ATTRIBUTION_FILE.tmp" "$ATTRIBUTION_FILE" + "$ATTRIBUTION_FILE" > "$ATTRIBUTION_FILE.tmp" + +mv "$ATTRIBUTION_FILE.tmp" "$ATTRIBUTION_FILE" echo "Successfully updated Node.js version and license in $ATTRIBUTION_FILE" # Cleanup From e0941d1fa5cc9eaad8e8d798d0d12afbbbb25aa5 Mon Sep 17 00:00:00 2001 From: chungjac Date: Thu, 11 Sep 2025 12:50:48 -0700 Subject: [PATCH 73/74] chore: bump agentic version: 1.32.0 (#2246) Co-authored-by: aws-toolkit-automation <> --- app/aws-lsp-codewhisperer-runtimes/src/version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/aws-lsp-codewhisperer-runtimes/src/version.json b/app/aws-lsp-codewhisperer-runtimes/src/version.json index 6d9528a4e7..aec8038513 100644 --- a/app/aws-lsp-codewhisperer-runtimes/src/version.json +++ b/app/aws-lsp-codewhisperer-runtimes/src/version.json @@ -1,3 +1,3 @@ { - "agenticChat": "1.31.0" + "agenticChat": "1.32.0" } From b140060d804b6a639a1a5523d0a6f93ea9ae4783 Mon Sep 17 00:00:00 2001 From: Tai Lai Date: Mon, 15 Sep 2025 12:18:03 -0600 Subject: [PATCH 74/74] chore: bump @aws/mynah-ui to 4.36.6 (#2252) --- chat-client/package.json | 2 +- package-lock.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chat-client/package.json b/chat-client/package.json index 9bd35ba982..3c10213f91 100644 --- a/chat-client/package.json +++ b/chat-client/package.json @@ -27,7 +27,7 @@ "@aws/chat-client-ui-types": "^0.1.56", "@aws/language-server-runtimes": "^0.2.128", "@aws/language-server-runtimes-types": "^0.1.50", - "@aws/mynah-ui": "^4.36.5" + "@aws/mynah-ui": "^4.36.6" }, "devDependencies": { "@types/jsdom": "^21.1.6", diff --git a/package-lock.json b/package-lock.json index 838f0c5fc1..affc82b825 100644 --- a/package-lock.json +++ b/package-lock.json @@ -257,7 +257,7 @@ "@aws/chat-client-ui-types": "^0.1.56", "@aws/language-server-runtimes": "^0.2.128", "@aws/language-server-runtimes-types": "^0.1.50", - "@aws/mynah-ui": "^4.36.5" + "@aws/mynah-ui": "^4.36.6" }, "devDependencies": { "@types/jsdom": "^21.1.6", @@ -4204,9 +4204,9 @@ "link": true }, "node_modules/@aws/mynah-ui": { - "version": "4.36.5", - "resolved": "https://registry.npmjs.org/@aws/mynah-ui/-/mynah-ui-4.36.5.tgz", - "integrity": "sha512-HMXqvSpZT84mpY67ChzRDrd73Y9AFZVZ8RcOJ/rNWIXR44uryfNFg2nrvoP4GSn2P+kU8WIPGChHGmyX9N0UgA==", + "version": "4.36.6", + "resolved": "https://registry.npmjs.org/@aws/mynah-ui/-/mynah-ui-4.36.6.tgz", + "integrity": "sha512-RIFKIasIgO00dYmRM+JS7dij1hzrNZchhf0+CyUNDUpw2Hcc86/8lP90F1F5rJIOtqtnguiPQ7XwmXxf+Tw5jQ==", "hasInstallScript": true, "license": "Apache License 2.0", "dependencies": {