Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat(pam): AI session insights via Anthropic app connection
bernie-gd0eb4dbe72d8
diff --git a/backend/package-lock.json b/backend/package-lock.jsonindex 7131aff53e..e6a03d773b 100644--- a/backend/package-lock.json+++ b/backend/package-lock.json@@ -9,6 +9,7 @@"version": "1.0.0","license": "ISC","dependencies": {+ "@ai-sdk/anthropic": "^3.0.68","@aws-sdk/client-acm-pca": "^3.992.0","@aws-sdk/client-elasticache": "^3.637.0","@aws-sdk/client-iam": "^3.525.0",@@ -70,6 +71,7 @@"@types/node-forge": "^1.3.14","@ucast/mongo2js": "^1.3.4","acme-client": "^5.4.0",+ "ai": "^6.0.154","ajv": "^8.12.0","argon2": "^0.31.2","asn1js": "^3.0.6",@@ -223,6 +225,68 @@"node": ">=0.10.0"}},+ "node_modules/@ai-sdk/anthropic": {+ "version": "3.0.68",+ "resolved": "https://registry.npmjs.org/@ai-sdk/anthropic/-/anthropic-3.0.68.tgz",+ "integrity": "sha512-BAd+fmgYoJMmGw0/uV+jRlXX60PyGxelA6Clp4cK/NI0dsyv9jOOwzQmKNaz2nwb+Jz7HqI7I70KK4XtU5EcXQ==",+ "license": "Apache-2.0",+ "dependencies": {+ "@ai-sdk/provider": "3.0.8",+ "@ai-sdk/provider-utils": "4.0.23"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "zod": "^3.25.76 || ^4.1.8"+ }+ },+ "node_modules/@ai-sdk/gateway": {+ "version": "3.0.94",+ "resolved": "https://registry.npmjs.org/@ai-sdk/gateway/-/gateway-3.0.94.tgz",+ "integrity": "sha512-uDDwLZhCkvC89crVS3S90D5L7AcVN8WriGuYVNYgVAaVcvy3Mthy3R9ICfzG75BObhz6pm2FWnhxDfNRK+t69Q==",+ "license": "Apache-2.0",+ "dependencies": {+ "@ai-sdk/provider": "3.0.8",+ "@ai-sdk/provider-utils": "4.0.23",+ "@vercel/oidc": "3.1.0"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "zod": "^3.25.76 || ^4.1.8"+ }+ },+ "node_modules/@ai-sdk/provider": {+ "version": "3.0.8",+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-3.0.8.tgz",+ "integrity": "sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ==",+ "license": "Apache-2.0",+ "dependencies": {+ "json-schema": "^0.4.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@ai-sdk/provider-utils": {+ "version": "4.0.23",+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-4.0.23.tgz",+ "integrity": "sha512-z8GlDaCmRSDlqkMF2f4/RFgWxdarvIbyuk+m6WXT1LYgsnGiXRJGTD2Z1+SDl3LqtFuRtGX1aghYvQLoHL/9pg==",+ "license": "Apache-2.0",+ "dependencies": {+ "@ai-sdk/provider": "3.0.8",+ "@standard-schema/spec": "^1.1.0",+ "eventsource-parser": "^3.0.6"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "zod": "^3.25.76 || ^4.1.8"+ }+ },"node_modules/@ampproject/remapping": {"version": "2.3.0","resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",@@ -2212,7 +2276,6 @@"integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@ampproject/remapping": "^2.2.0","@babel/code-frame": "^7.26.2",@@ -4271,7 +4334,6 @@"url": "https://opencollective.com/csstools"}],- "peer": true,"engines": {"node": ">=18"},@@ -4293,7 +4355,6 @@"url": "https://opencollective.com/csstools"}],- "peer": true,"engines": {"node": ">=18"}@@ -6217,6 +6278,9 @@"win32"]},+ "node_modules/@infisical/quic/node_modules/@infisical/quic-linux-arm": {+ "optional": true+ },"node_modules/@ioredis/commands": {"version": "1.5.0","resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.5.0.tgz",@@ -6940,7 +7004,6 @@"resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz","integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==","license": "MIT",- "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}@@ -7861,7 +7924,6 @@"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz","integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==","license": "MIT",- "peer": true,"dependencies": {"@octokit/auth-token": "^4.0.0","@octokit/graphql": "^7.1.0",@@ -8357,7 +8419,6 @@"version": "1.9.0","resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz","integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",- "peer": true,"engines": {"node": ">=8.0.0"}@@ -9021,7 +9082,6 @@"resolved": "https://registry.npmjs.org/@react-email/body/-/body-0.2.0.tgz","integrity": "sha512-9GCWmVmKUAoRfloboCd+RKm6X17xn7eGL7HnpAZUnjBXBilWCxsKnLMTC/ixSHDKS/A/057M1Tx6ZUXd89sVBw==","license": "MIT",- "peer": true,"peerDependencies": {"react": "^18.0 || ^19.0 || ^19.0.0-rc"}@@ -9031,7 +9091,6 @@"resolved": "https://registry.npmjs.org/@react-email/button/-/button-0.2.0.tgz","integrity": "sha512-8i+v6cMxr2emz4ihCrRiYJPp2/sdYsNNsBzXStlcA+/B9Umpm5Jj3WJKYpgTPM+aeyiqlG/MMI1AucnBm4f1oQ==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -9044,7 +9103,6 @@"resolved": "https://registry.npmjs.org/@react-email/code-block/-/code-block-0.2.0.tgz","integrity": "sha512-eIrPW9PIFgDopQU0e/OPpwCW2QWQDtNZDSsiN4sJO8KdMnWWnXJicnRfzrit5rHwFo+Y98i+w/Y5ScnBAFr1dQ==","license": "MIT",- "peer": true,"dependencies": {"prismjs": "^1.30.0"},@@ -9060,7 +9118,6 @@"resolved": "https://registry.npmjs.org/@react-email/code-inline/-/code-inline-0.0.5.tgz","integrity": "sha512-MmAsOzdJpzsnY2cZoPHFPk6uDO/Ncpb4Kh1hAt9UZc1xOW3fIzpe1Pi9y9p6wwUmpaeeDalJxAxH6/fnTquinA==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -9136,7 +9193,6 @@"resolved": "https://registry.npmjs.org/@react-email/container/-/container-0.0.15.tgz","integrity": "sha512-Qo2IQo0ru2kZq47REmHW3iXjAQaKu4tpeq/M8m1zHIVwKduL2vYOBQWbC2oDnMtWPmkBjej6XxgtZByxM6cCFg==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -9170,7 +9226,6 @@"resolved": "https://registry.npmjs.org/@react-email/heading/-/heading-0.0.15.tgz","integrity": "sha512-xF2GqsvBrp/HbRHWEfOgSfRFX+Q8I5KBEIG5+Lv3Vb2R/NYr0s8A5JhHHGf2pWBMJdbP4B2WHgj/VUrhy8dkIg==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -9183,7 +9238,6 @@"resolved": "https://registry.npmjs.org/@react-email/hr/-/hr-0.0.11.tgz","integrity": "sha512-S1gZHVhwOsd1Iad5IFhpfICwNPMGPJidG/Uysy1AwmspyoAP5a4Iw3OWEpINFdgh9MHladbxcLKO2AJO+cA9Lw==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -9208,7 +9262,6 @@"resolved": "https://registry.npmjs.org/@react-email/img/-/img-0.0.11.tgz","integrity": "sha512-aGc8Y6U5C3igoMaqAJKsCpkbm1XjguQ09Acd+YcTKwjnC2+0w3yGUJkjWB2vTx4tN8dCqQCXO8FmdJpMfOA9EQ==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -9221,7 +9274,6 @@"resolved": "https://registry.npmjs.org/@react-email/link/-/link-0.0.12.tgz","integrity": "sha512-vF+xxQk2fGS1CN7UPQDbzvcBGfffr+GjTPNiWM38fhBfsLv6A/YUfaqxWlmL7zLzVmo0K2cvvV9wxlSyNba1aQ==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -9249,7 +9301,6 @@"resolved": "https://registry.npmjs.org/@react-email/preview/-/preview-0.0.13.tgz","integrity": "sha512-F7j9FJ0JN/A4d7yr+aw28p4uX7VLWs7hTHtLo7WRyw4G+Lit6Zucq4UWKRxJC8lpsUdzVmG7aBJnKOT+urqs/w==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -9822,7 +9873,6 @@"resolved": "https://registry.npmjs.org/@react-email/text/-/text-0.1.5.tgz","integrity": "sha512-o5PNHFSE085VMXayxH+SJ1LSOtGsTv+RpNKnTiJDrJUwoBu77G3PlKOsZZQHCNyD28WsQpl9v2WcJLbQudqwPg==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -11141,6 +11191,12 @@"dev": true,"license": "MIT"},+ "node_modules/@standard-schema/spec": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",+ "license": "MIT"+ },"node_modules/@swc/helpers": {"version": "0.5.15","resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz",@@ -11486,7 +11542,6 @@"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.23.tgz","integrity": "sha512-yIdlVVVHXpmqRhtyovZAcSy0MiPcYWGkoO4CGe/+jpP0hmNuihm4XhHbADpK++MsiLHP5MVlv+bcgdF99kSiFQ==","license": "MIT",- "peer": true,"dependencies": {"undici-types": "~6.21.0"}@@ -11980,7 +12035,6 @@"integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==","dev": true,"license": "BSD-2-Clause",- "peer": true,"dependencies": {"@typescript-eslint/scope-manager": "6.21.0","@typescript-eslint/types": "6.21.0",@@ -12259,6 +12313,15 @@"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==","dev": true},+ "node_modules/@vercel/oidc": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/@vercel/oidc/-/oidc-3.1.0.tgz",+ "integrity": "sha512-Fw28YZpRnA3cAHHDlkt7xQHiJ0fcL+NRcIqsocZQUSmbzeIKRpwttJjik5ZGanXP+vlA4SbTg+AbA3bP363l+w==",+ "license": "Apache-2.0",+ "engines": {+ "node": ">= 20"+ }+ },"node_modules/@vitest/expect": {"version": "3.2.4","resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz",@@ -12437,7 +12500,6 @@"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz","integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==","license": "MIT",- "peer": true,"bin": {"acorn": "bin/acorn"},@@ -12529,6 +12591,24 @@"node": ">=8"}},+ "node_modules/ai": {+ "version": "6.0.154",+ "resolved": "https://registry.npmjs.org/ai/-/ai-6.0.154.tgz",+ "integrity": "sha512-HfKJKCTJsDZxqrIUDSVnBQ7DpQlx5WI4ExqtLd7Bl70epLmvkpc/HYMzU1hP9W+g9VEAcvZo4fbMqc3v5D+9gQ==",+ "license": "Apache-2.0",+ "dependencies": {+ "@ai-sdk/gateway": "3.0.94",+ "@ai-sdk/provider": "3.0.8",+ "@ai-sdk/provider-utils": "4.0.23",+ "@opentelemetry/api": "1.9.0"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "zod": "^3.25.76 || ^4.1.8"+ }+ },"node_modules/ajv": {"version": "8.18.0","resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",@@ -12918,7 +12998,6 @@"resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz","integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==","license": "MIT",- "peer": true,"dependencies": {"bn.js": "^4.0.0","inherits": "^2.0.1",@@ -13131,7 +13210,6 @@"resolved": "https://registry.npmjs.org/axios/-/axios-1.14.0.tgz","integrity": "sha512-3Y8yrqLSwjuzpXuZ0oIYZ/XGgLwUIBU3uLvbcpb0pidD9ctpShJd43KSlEEkVQg6DS0G9NKyzOvBfUtDKEyHvQ==","license": "MIT",- "peer": true,"dependencies": {"follow-redirects": "^1.15.11","form-data": "^4.0.5",@@ -13763,7 +13841,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"baseline-browser-mapping": "^2.8.9","caniuse-lite": "^1.0.30001746",@@ -15195,7 +15272,6 @@"version": "16.4.1","resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.1.tgz","integrity": "sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ==",- "peer": true,"engines": {"node": ">=12"},@@ -15566,7 +15642,6 @@"dev": true,"hasInstallScript": true,"license": "MIT",- "peer": true,"bin": {"esbuild": "bin/esbuild"},@@ -15649,7 +15724,6 @@"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz","integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==","dev": true,- "peer": true,"dependencies": {"@eslint-community/eslint-utils": "^4.2.0","@eslint-community/regexpp": "^4.6.1",@@ -15748,7 +15822,6 @@"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz","integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==","dev": true,- "peer": true,"bin": {"eslint-config-prettier": "bin/cli.js"},@@ -15837,7 +15910,6 @@"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz","integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==","dev": true,- "peer": true,"dependencies": {"array-includes": "^3.1.7","array.prototype.findlastindex": "^1.2.3",@@ -16250,7 +16322,6 @@"resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz","integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==","license": "MIT",- "peer": true,"dependencies": {"accepts": "~1.3.8","array-flatten": "1.1.1",@@ -16324,6 +16395,7 @@"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.19.0.tgz","integrity": "sha512-0csaMkGq+vaiZTmSMMGkfdCOabYv192VbytFypcvI0MANrp+4i/7yEkJ0sbAEhycQjntaKGzYfjfXQyVb7BHMA==","license": "MIT",+ "peer": true,"dependencies": {"cookie": "~0.7.2","cookie-signature": "~1.0.7",@@ -16345,12 +16417,14 @@"node_modules/express-session/node_modules/cookie-signature": {"version": "1.0.7","resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",- "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA=="+ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",+ "peer": true},"node_modules/express-session/node_modules/debug": {"version": "2.6.9","resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz","integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",+ "peer": true,"dependencies": {"ms": "2.0.0"}@@ -16358,7 +16432,8 @@"node_modules/express-session/node_modules/ms": {"version": "2.0.0","resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",+ "peer": true},"node_modules/express/node_modules/cookie-signature": {"version": "1.0.6",@@ -17812,7 +17887,6 @@"resolved": "https://registry.npmjs.org/hono/-/hono-4.12.9.tgz","integrity": "sha512-wy3T8Zm2bsEvxKZM5w21VdHDDcwVS1yUFFY6i8UobSsKfFceT7TOwhbhfKsDyx7tYQlmRM5FLpIuYvNFyjctiA==","license": "MIT",- "peer": true,"engines": {"node": ">=16.9.0"}@@ -21290,6 +21364,7 @@"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz","integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==","license": "MIT",+ "peer": true,"engines": {"node": ">= 0.8"}@@ -21976,7 +22051,6 @@"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.2.tgz","integrity": "sha512-cfDHL6LStTEKlNilboNtobT/kEa30PtAf2Q1OgszfrG/rpVl1xaFWT9ktfkS306GmHgmnad1Sw4wabhlvFtsTw==","license": "MIT",- "peer": true,"engines": {"node": ">=10"},@@ -22319,7 +22393,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"nanoid": "^3.3.11","picocolors": "^1.1.1",@@ -22417,7 +22490,6 @@"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz","integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==","license": "MIT",- "peer": true,"bin": {"prettier": "bin/prettier.cjs"},@@ -22834,6 +22906,7 @@"version": "1.0.0","resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz","integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==",+ "peer": true,"engines": {"node": ">= 0.8"}@@ -22937,7 +23010,6 @@"resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz","integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==","license": "MIT",- "peer": true,"engines": {"node": ">=0.10.0"}@@ -22947,7 +23019,6 @@"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz","integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==","license": "MIT",- "peer": true,"dependencies": {"scheduler": "^0.26.0"},@@ -24697,7 +24768,6 @@"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.4.tgz","integrity": "sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==","license": "MIT",- "peer": true,"dependencies": {"ip-address": "^9.0.5","smart-buffer": "^4.2.0"@@ -26040,7 +26110,6 @@"integrity": "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"esbuild": "~0.25.0","get-tsconfig": "^4.7.5"@@ -26209,7 +26278,6 @@"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz","integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==","dev": true,- "peer": true,"bin": {"tsc": "bin/tsc","tsserver": "bin/tsserver"@@ -26250,6 +26318,7 @@"version": "2.1.5","resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz","integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",+ "peer": true,"dependencies": {"random-bytes": "~1.0.0"},@@ -26812,7 +26881,6 @@"integrity": "sha512-ZWyE8YXEXqJrrSLvYgrRP7p62OziLW7xI5HYGWFzOvupfAlrLvURSzv/FyGyy0eidogEM3ujU+kUG1zuHgb6Ug==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"esbuild": "^0.25.0","fdir": "^6.5.0",@@ -27465,11 +27533,10 @@}},"node_modules/zod": {- "version": "3.24.3",- "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz",- "integrity": "sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==",+ "version": "3.25.76",+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",+ "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==","license": "MIT",- "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}diff --git a/backend/package.json b/backend/package.jsonindex d80bec8466..9d59897203 100644--- a/backend/package.json+++ b/backend/package.json@@ -131,6 +131,7 @@"vitest": "^3.0.6"},"dependencies": {+ "@ai-sdk/anthropic": "^3.0.68","@aws-sdk/client-acm-pca": "^3.992.0","@aws-sdk/client-elasticache": "^3.637.0","@aws-sdk/client-iam": "^3.525.0",@@ -158,6 +159,7 @@"@fastify/websocket": "^10.0.1","@gitbeaker/rest": "^42.5.0","@google-cloud/kms": "^4.5.0",+ "@infisical/ldapjs": "3.0.11","@infisical/pg-view-generator": "^1.1.0","@infisical/quic": "^1.0.8","@modelcontextprotocol/sdk": "^1.24.3",@@ -191,6 +193,7 @@"@types/node-forge": "^1.3.14","@ucast/mongo2js": "^1.3.4","acme-client": "^5.4.0",+ "ai": "^6.0.154","ajv": "^8.12.0","argon2": "^0.31.2","asn1js": "^3.0.6",@@ -222,7 +225,6 @@"jsrp": "^0.2.4","jwks-rsa": "^3.1.0","knex": "^3.0.1",- "@infisical/ldapjs": "3.0.11","ldif": "0.5.1","libsodium-wrappers": "^0.7.13","lodash.isequal": "^4.5.0",diff --git a/backend/src/db/migrations/20260408120000_pam-session-summary.ts b/backend/src/db/migrations/20260408120000_pam-session-summary.tsnew file mode 100644index 0000000000..97afda4540--- /dev/null+++ b/backend/src/db/migrations/20260408120000_pam-session-summary.ts@@ -0,0 +1,61 @@+import { Knex } from "knex";++import { TableName } from "../schemas";++export async function up(knex: Knex): Promise<void> {+ if (await knex.schema.hasTable(TableName.PamSession)) {+ const hasResourceId = await knex.schema.hasColumn(TableName.PamSession, "resourceId");+ const hasEncryptedAiInsights = await knex.schema.hasColumn(TableName.PamSession, "encryptedAiInsights");+ const hasAiInsightsStatus = await knex.schema.hasColumn(TableName.PamSession, "aiInsightsStatus");+ const hasAiInsightsError = await knex.schema.hasColumn(TableName.PamSession, "aiInsightsError");++ await knex.schema.alterTable(TableName.PamSession, (t) => {+ if (!hasResourceId) {+ t.uuid("resourceId").nullable();+ t.foreign("resourceId").references("id").inTable(TableName.PamResource).onDelete("SET NULL");+ }+ if (!hasEncryptedAiInsights) t.binary("encryptedAiInsights").nullable();+ if (!hasAiInsightsStatus) t.string("aiInsightsStatus").nullable();+ if (!hasAiInsightsError) t.text("aiInsightsError").nullable();+ });++ // Back-fill resourceId from the account → resource relation for existing sessions+ await knex.raw(`+ UPDATE ${TableName.PamSession} s+ SET "resourceId" = a."resourceId"+ FROM ${TableName.PamAccount} a+ WHERE s."accountId" = a.id+ AND s."resourceId" IS NULL+ `);+ }++ if (await knex.schema.hasTable(TableName.PamResource)) {+ const hasEncryptedSessionSummaryConfig = await knex.schema.hasColumn(+ TableName.PamResource,+ "encryptedSessionSummaryConfig"+ );+ if (!hasEncryptedSessionSummaryConfig) {+ await knex.schema.alterTable(TableName.PamResource, (t) => {+ t.binary("encryptedSessionSummaryConfig").nullable();+ });+ }+ }+}++export async function down(knex: Knex): Promise<void> {+ if (await knex.schema.hasTable(TableName.PamSession)) {+ await knex.schema.alterTable(TableName.PamSession, (t) => {+ t.dropForeign(["resourceId"]);+ t.dropColumn("resourceId");+ t.dropColumn("encryptedAiInsights");+ t.dropColumn("aiInsightsStatus");+ t.dropColumn("aiInsightsError");+ });+ }++ if (await knex.schema.hasTable(TableName.PamResource)) {+ await knex.schema.alterTable(TableName.PamResource, (t) => {+ t.dropColumn("encryptedSessionSummaryConfig");+ });+ }+}diff --git a/backend/src/db/schemas/pam-resources.ts b/backend/src/db/schemas/pam-resources.tsindex b77d17eda0..78a7c16027 100644--- a/backend/src/db/schemas/pam-resources.ts+++ b/backend/src/db/schemas/pam-resources.ts@@ -21,7 +21,8 @@ export const PamResourcesSchema = z.object({encryptedRotationAccountCredentials: zodBuffer.nullable().optional(),encryptedResourceMetadata: zodBuffer.nullable().optional(),adServerResourceId: z.string().uuid().nullable().optional(),- discoveryFingerprint: z.string().nullable().optional()+ discoveryFingerprint: z.string().nullable().optional(),+ encryptedSessionSummaryConfig: zodBuffer.nullable().optional()});export type TPamResources = z.infer<typeof PamResourcesSchema>;diff --git a/backend/src/db/schemas/pam-sessions.ts b/backend/src/db/schemas/pam-sessions.tsindex 4ddea2140a..d9ebb96d78 100644--- a/backend/src/db/schemas/pam-sessions.ts+++ b/backend/src/db/schemas/pam-sessions.ts@@ -13,6 +13,7 @@ export const PamSessionsSchema = z.object({id: z.string().uuid(),projectId: z.string(),accountId: z.string().uuid().nullable().optional(),+ resourceId: z.string().uuid().nullable().optional(),resourceType: z.string(),resourceName: z.string(),accountName: z.string(),@@ -23,6 +24,9 @@ export const PamSessionsSchema = z.object({actorUserAgent: z.string(),status: z.string(),encryptedLogsBlob: zodBuffer.nullable().optional(),+ encryptedAiInsights: zodBuffer.nullable().optional(),+ aiInsightsStatus: z.string().nullable().optional(),+ aiInsightsError: z.string().nullable().optional(),expiresAt: z.date(),startedAt: z.date().nullable().optional(),endedAt: z.date().nullable().optional(),diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.tsindex 28b8bdcc54..f39f1fecb2 100644--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@ -782,6 +782,7 @@ export const pamAccountServiceFactory = ({resourceType: resource.resourceType,status: PamSessionStatus.Active, // AWS IAM sessions are immediately activeaccountId: account.id,+ resourceId: resource.id,userId: actor.id,expiresAt,startedAt: new Date()@@ -816,6 +817,7 @@ export const pamAccountServiceFactory = ({resourceType: resource.resourceType,status: PamSessionStatus.Starting,accountId: account.id,+ resourceId: resource.id,userId: actor.id,expiresAt: new Date(Date.now() + duration)});diff --git a/backend/src/ee/services/pam-resource/pam-resource-fns.ts b/backend/src/ee/services/pam-resource/pam-resource-fns.tsindex 6a05f52663..057d7db61e 100644--- a/backend/src/ee/services/pam-resource/pam-resource-fns.ts+++ b/backend/src/ee/services/pam-resource/pam-resource-fns.ts@@ -121,6 +121,22 @@ export const decryptResource = async (projectId: string,kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">) => {+ let sessionSummaryConfig: { aiInsightsEnabled: boolean; connectionId: string; model: string } | null = null;++ const { encryptedSessionSummaryConfig } = resource;++ if (encryptedSessionSummaryConfig) {+ const { decryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.SecretManager,+ projectId+ });+ sessionSummaryConfig = JSON.parse(decryptor({ cipherTextBlob: encryptedSessionSummaryConfig }).toString()) as {+ aiInsightsEnabled: boolean;+ connectionId: string;+ model: string;+ };+ }+return {...resource,connectionDetails: await decryptResourceConnectionDetails({@@ -134,6 +150,7 @@ export const decryptResource = async (projectId,kmsService})- : null+ : null,+ sessionSummaryConfig} as TPamResource;};diff --git a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts b/backend/src/ee/services/pam-resource/pam-resource-schemas.tsindex 8e8d7e4ea0..bb1bf713b8 100644--- a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts+++ b/backend/src/ee/services/pam-resource/pam-resource-schemas.ts@@ -17,12 +17,23 @@ export const GatewayAccessResponseSchema = z.object({});// Resources+export const SessionSummaryConfigSchema = z+ .object({+ aiInsightsEnabled: z.boolean(),+ connectionId: z.string(),+ model: z.string()+ })+ .nullable()+ .optional();+export const BasePamResourceSchema = PamResourcesSchema.omit({encryptedConnectionDetails: true,encryptedRotationAccountCredentials: true,+ encryptedSessionSummaryConfig: true,resourceType: true}).extend({- metadata: ResourceMetadataSchema.pick({ id: true, key: true, value: true }).array().optional()+ metadata: ResourceMetadataSchema.pick({ id: true, key: true, value: true }).array().optional(),+ sessionSummaryConfig: SessionSummaryConfigSchema});const CoreCreatePamResourceSchema = z.object({@@ -39,7 +50,8 @@ export const BaseCreatePamResourceSchema = CoreCreatePamResourceSchema;const CoreUpdatePamResourceSchema = z.object({name: slugSchema({ field: "name" }).optional(),- metadata: ResourceMetadataNonEncryptionSchema.optional()+ metadata: ResourceMetadataNonEncryptionSchema.optional(),+ sessionSummaryConfig: SessionSummaryConfigSchema});export const BaseUpdateGatewayPamResourceSchema = CoreUpdatePamResourceSchema.extend({diff --git a/backend/src/ee/services/pam-resource/pam-resource-service.ts b/backend/src/ee/services/pam-resource/pam-resource-service.tsindex 958624ac14..91df1c4f21 100644--- a/backend/src/ee/services/pam-resource/pam-resource-service.ts+++ b/backend/src/ee/services/pam-resource/pam-resource-service.ts@@ -14,6 +14,7 @@ import { DatabaseErrorCode } from "@app/lib/error-codes";import { BadRequestError, DatabaseError, NotFoundError } from "@app/lib/errors";import { OrgServiceActor, TProjectPermission } from "@app/lib/types";import { TKmsServiceFactory } from "@app/services/kms/kms-service";+import { KmsDataKey } from "@app/services/kms/kms-types";import { TResourceMetadataDALFactory } from "@app/services/resource-metadata/resource-metadata-dal";import { TGatewayV2ServiceFactory } from "../gateway-v2/gateway-v2-service";@@ -32,7 +33,7 @@ import {encryptResourceInternalMetadata,listResourceOptions} from "./pam-resource-fns";-import { TCreateResourceDTO, TListResourcesDTO, TUpdateResourceDTO } from "./pam-resource-types";+import { TCreateResourceDTO, TListResourcesDTO, TSessionSummaryConfigDTO, TUpdateResourceDTO } from "./pam-resource-types";import { TSSHResourceInternalMetadata } from "./ssh/ssh-resource-types";import { TWindowsResource } from "./windows-server/windows-server-resource-types";@@ -251,7 +252,8 @@ export const pamResourceServiceFactory = ({rotationAccountCredentials,gatewayId,adServerResourceId,- metadata+ metadata,+ sessionSummaryConfig}: TUpdateResourceDTO,actor: OrgServiceActor) => {@@ -388,8 +390,23 @@ export const pamResourceServiceFactory = ({}}+ if (sessionSummaryConfig !== undefined) {+ if (sessionSummaryConfig === null) {+ updateDoc.encryptedSessionSummaryConfig = null;+ } else {+ const { encryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.SecretManager,+ projectId: resource.projectId+ });+ const { cipherTextBlob } = encryptor({+ plainText: Buffer.from(JSON.stringify(sessionSummaryConfig))+ });+ updateDoc.encryptedSessionSummaryConfig = cipherTextBlob;+ }+ }+// If nothing was updated, return the fetched resource- if (Object.keys(updateDoc).length === 0 && metadata === undefined) {+ if (Object.keys(updateDoc).length === 0 && metadata === undefined && sessionSummaryConfig === undefined) {const existingMeta = await pamResourceDAL.findMetadataByResourceIds([resourceId]);return {...(await decryptResource(resource, resource.projectId, kmsService)),diff --git a/backend/src/ee/services/pam-resource/pam-resource-types.ts b/backend/src/ee/services/pam-resource/pam-resource-types.tsindex dbb356ac72..2298c4ab3d 100644--- a/backend/src/ee/services/pam-resource/pam-resource-types.ts+++ b/backend/src/ee/services/pam-resource/pam-resource-types.ts@@ -132,8 +132,15 @@ export type TCreateResourceDTO = Pick<TPamResource, "name" | "connectionDetails"metadata?: z.input<typeof ResourceMetadataNonEncryptionSchema>;};+export type TSessionSummaryConfigDTO = {+ aiInsightsEnabled: boolean;+ connectionId: string;+ model: string;+} | null;+export type TUpdateResourceDTO = Partial<Omit<TCreateResourceDTO, "resourceType" | "projectId">> & {resourceId: string;+ sessionSummaryConfig?: TSessionSummaryConfigDTO;};export type TListResourcesDTO = {diff --git a/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.ts b/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.tsnew file mode 100644index 0000000000..82d8fe6277--- /dev/null+++ b/backend/src/ee/services/pam-session/pam-session-ai-summary-queue.ts@@ -0,0 +1,246 @@+import { TPamResourceDALFactory } from "@app/ee/services/pam-resource/pam-resource-dal";+import { PamResource } from "@app/ee/services/pam-resource/pam-resource-enums";+import { logger } from "@app/lib/logger";+import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";+import { decryptAppConnectionCredentials } from "@app/services/app-connection/app-connection-fns";+import { TKmsServiceFactory } from "@app/services/kms/kms-service";+import { KmsDataKey } from "@app/services/kms/kms-types";+import { QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue";++import { TPamSessionDALFactory } from "./pam-session-dal";+import { TPamSessionEventBatchDALFactory } from "./pam-session-event-batch-dal";+import { decryptBatches, decryptSessionCommandLogs } from "./pam-session-fns";+import { buildSummaryPrompt, formatLogsForSummary, generateSessionSummary } from "./pam-session-summary-fns";++type TSessionSummaryConfig = {+ aiInsightsEnabled: boolean;+ connectionId: string;+ model: string;+};++type TPamSessionAiSummaryServiceFactoryDep = {+ queueService: TQueueServiceFactory;+ pamSessionDAL: Pick<TPamSessionDALFactory, "findById" | "updateById">;+ pamSessionEventBatchDAL: Pick<TPamSessionEventBatchDALFactory, "findBySessionIdPaginated">;+ pamResourceDAL: Pick<TPamResourceDALFactory, "findById">;+ appConnectionDAL: Pick<TAppConnectionDALFactory, "findById">;+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;+};++export type TPamSessionAiSummaryServiceFactory = ReturnType<typeof pamSessionAiSummaryServiceFactory>;++export const pamSessionAiSummaryServiceFactory = ({+ queueService,+ pamSessionDAL,+ pamSessionEventBatchDAL,+ pamResourceDAL,+ appConnectionDAL,+ kmsService+}: TPamSessionAiSummaryServiceFactoryDep) => {+ const queueAiSummary = async (sessionId: string, projectId: string) => {+ // Check if AI insights is enabled for this session's resource before touching the DB or queue+ const session = await pamSessionDAL.findById(sessionId);+ if (!session) return;++ const { resourceId } = session;+ if (!resourceId) return;++ const resource = await pamResourceDAL.findById(resourceId);+ if (!resource) return;++ const { encryptedSessionSummaryConfig: encryptedConfig } = resource;+ if (!encryptedConfig) return;++ let summaryConfig: TSessionSummaryConfig;+ try {+ const { decryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.SecretManager,+ projectId+ });+ summaryConfig = JSON.parse(decryptor({ cipherTextBlob: encryptedConfig }).toString()) as TSessionSummaryConfig;+ } catch {+ return;+ }++ if (!summaryConfig.aiInsightsEnabled) return;++ // AI is enabled — mark pending and enqueue+ await pamSessionDAL.updateById(sessionId, { aiInsightsStatus: "pending" });+ await queueService.queue(+ QueueName.PamSessionAiSummary,+ QueueJobs.PamSessionAiSummary,+ { sessionId, projectId },+ {+ jobId: `pam-session-ai-summary-${sessionId}`,+ removeOnComplete: { count: 20 },+ removeOnFail: { count: 20 }+ }+ );+ };++ const init = () => {+ queueService.start(QueueName.PamSessionAiSummary, async (job) => {+ const { sessionId, projectId } = job.data;++ logger.info({ sessionId }, `${QueueName.PamSessionAiSummary}: starting AI summary`);++ // 1. Fetch session+ const session = await pamSessionDAL.findById(sessionId);+ if (!session) {+ logger.warn({ sessionId }, `${QueueName.PamSessionAiSummary}: session not found, skipping`);+ return;+ }++ // 2. Skip if no resourceId (resource was deleted)+ const { resourceId } = session;+ if (!resourceId) {+ logger.info(+ { sessionId },+ `${QueueName.PamSessionAiSummary}: no resourceId on session (resource deleted?), skipping`+ );+ await pamSessionDAL.updateById(sessionId, { aiInsightsStatus: null });+ return;+ }++ // 3. Fetch resource and decrypt sessionSummaryConfig+ const resource = await pamResourceDAL.findById(resourceId);+ if (!resource) {+ logger.info({ sessionId, resourceId }, `${QueueName.PamSessionAiSummary}: resource not found, skipping`);+ await pamSessionDAL.updateById(sessionId, { aiInsightsStatus: null });+ return;+ }++ const { encryptedSessionSummaryConfig: encryptedConfig } = resource;++ if (!encryptedConfig) {+ logger.info(+ { sessionId, resourceId },+ `${QueueName.PamSessionAiSummary}: no sessionSummaryConfig on resource, skipping`+ );+ await pamSessionDAL.updateById(sessionId, { aiInsightsStatus: null });+ return;+ }++ let summaryConfig: TSessionSummaryConfig;+ try {+ const { decryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.SecretManager,+ projectId+ });+ summaryConfig = JSON.parse(decryptor({ cipherTextBlob: encryptedConfig }).toString()) as TSessionSummaryConfig;+ } catch (err) {+ logger.error(+ { sessionId, err },+ `${QueueName.PamSessionAiSummary}: failed to decrypt sessionSummaryConfig`+ );+ return;+ }++ if (!summaryConfig.aiInsightsEnabled) {+ logger.info({ sessionId }, `${QueueName.PamSessionAiSummary}: AI insights disabled for resource, skipping`);+ await pamSessionDAL.updateById(sessionId, { aiInsightsStatus: null });+ return;+ }++ // 4. Fetch app connection and decrypt credentials+ const appConnection = await appConnectionDAL.findById(summaryConfig.connectionId);+ if (!appConnection) {+ await pamSessionDAL.updateById(sessionId, {+ aiInsightsStatus: "failed",+ aiInsightsError: "Configured AI app connection not found"+ });+ return;+ }++ let apiKey: string;+ try {+ const credentials = await decryptAppConnectionCredentials({+ orgId: appConnection.orgId,+ encryptedCredentials: appConnection.encryptedCredentials,+ kmsService,+ projectId: appConnection.projectId+ });+ apiKey = (credentials as { apiKey: string }).apiKey;+ } catch (err) {+ logger.error({ sessionId, err }, `${QueueName.PamSessionAiSummary}: failed to decrypt connection credentials`);+ await pamSessionDAL.updateById(sessionId, {+ aiInsightsStatus: "failed",+ aiInsightsError: "Failed to decrypt AI connection credentials"+ });+ return;+ }++ // 5. Decrypt session logs — batch table first (new), fall back to legacy blob+ // Cap at 500 batches (~500 MB max) to prevent OOM if a session has an abnormal number of batches+ const MAX_BATCHES = 500;+ let logs;+ const batches = await pamSessionEventBatchDAL.findBySessionIdPaginated(sessionId, { offset: 0, limit: MAX_BATCHES });+ if (batches.length > 0) {+ logs = await decryptBatches(batches, projectId, kmsService);+ } else if (session.encryptedLogsBlob) {+ logs = await decryptSessionCommandLogs({ projectId, encryptedLogs: session.encryptedLogsBlob, kmsService });+ } else {+ logger.info({ sessionId }, `${QueueName.PamSessionAiSummary}: no session logs, skipping`);+ await pamSessionDAL.updateById(sessionId, { aiInsightsStatus: null });+ return;+ }++ if (logs.length === 0) {+ await pamSessionDAL.updateById(sessionId, { aiInsightsStatus: null });+ return;+ }++ // 6. Format logs and build prompt+ const resourceType = resource.resourceType as PamResource;+ const durationSeconds = session.endedAt+ ? (new Date(session.endedAt).getTime() - new Date(session.createdAt).getTime()) / 1000+ : 0;++ const formattedLogs = formatLogsForSummary(logs, resourceType);+ const { system, user } = buildSummaryPrompt({+ resourceType,+ resourceName: resource.name,+ actorName: session.actorName,+ actorEmail: session.actorEmail,+ durationSeconds,+ formattedLogs+ });++ // 7. Generate summary+ try {+ const { summary, warnings } = await generateSessionSummary(apiKey, summaryConfig.model, system, user);++ const { encryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.SecretManager,+ projectId+ });++ const { cipherTextBlob: encryptedAiInsights } = encryptor({+ plainText: Buffer.from(JSON.stringify({ summary, warnings }))+ });++ await pamSessionDAL.updateById(sessionId, {+ encryptedAiInsights,+ aiInsightsStatus: "completed",+ aiInsightsError: null+ });++ logger.info({ sessionId }, `${QueueName.PamSessionAiSummary}: AI summary completed successfully`);+ } catch (err) {+ const message =+ err instanceof Error && err.message.length < 500+ ? err.message+ : "AI summarization failed. The session logs may be too large for the selected model.";++ logger.error({ sessionId, err }, `${QueueName.PamSessionAiSummary}: AI summarization failed`);++ await pamSessionDAL.updateById(sessionId, {+ aiInsightsStatus: "failed",+ aiInsightsError: message+ });+ }+ });+ };++ return { queueAiSummary, init };+};diff --git a/backend/src/ee/services/pam-session/pam-session-fns.ts b/backend/src/ee/services/pam-session/pam-session-fns.tsindex 80fe78fa90..a636d481bc 100644--- a/backend/src/ee/services/pam-session/pam-session-fns.ts+++ b/backend/src/ee/services/pam-session/pam-session-fns.ts@@ -49,6 +49,20 @@ export const decryptSession = async (projectId: string,kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">) => {+ const { encryptedAiInsights } = session;++ let aiInsights: { summary: string; warnings: { text: string; logIndex?: number }[] } | null = null;+ if (encryptedAiInsights) {+ const { decryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.SecretManager,+ projectId+ });+ aiInsights = JSON.parse(decryptor({ cipherTextBlob: encryptedAiInsights }).toString()) as {+ summary: string;+ warnings: { text: string; logIndex?: number }[];+ };+ }+return {...session,logs: session.encryptedLogsBlob@@ -57,6 +71,7 @@ export const decryptSession = async (encryptedLogs: session.encryptedLogsBlob,kmsService})- : []+ : [],+ aiInsights} as TPamSanitizedSession;};diff --git a/backend/src/ee/services/pam-session/pam-session-schemas.ts b/backend/src/ee/services/pam-session/pam-session-schemas.tsindex 568a9a2fb9..8174aafb7a 100644--- a/backend/src/ee/services/pam-session/pam-session-schemas.ts+++ b/backend/src/ee/services/pam-session/pam-session-schemas.ts@@ -46,11 +46,21 @@ export const HttpResponseEventSchema = HttpBaseEventSchema.extend({export const HttpEventSchema = z.discriminatedUnion("eventType", [HttpRequestEventSchema, HttpResponseEventSchema]);+export const AiInsightsSchema = z+ .object({+ summary: z.string(),+ warnings: z.array(z.object({ text: z.string(), logIndex: z.number().int().optional() }))+ })+ .nullable()+ .optional();+export const SanitizedSessionSchema = PamSessionsSchema.omit({- encryptedLogsBlob: true+ encryptedLogsBlob: true,+ encryptedAiInsights: true}).extend({logs: z.array(z.union([PamSessionCommandLogSchema, HttpEventSchema, TerminalEventSchema])),- gatewayIdentityId: z.string().nullable().optional()+ gatewayIdentityId: z.string().nullable().optional(),+ aiInsights: AiInsightsSchema});export const SessionLogsPageSchema = z.object({diff --git a/backend/src/ee/services/pam-session/pam-session-service.ts b/backend/src/ee/services/pam-session/pam-session-service.tsindex ec5f681b7e..91c48cd2b3 100644--- a/backend/src/ee/services/pam-session/pam-session-service.ts+++ b/backend/src/ee/services/pam-session/pam-session-service.ts@@ -18,6 +18,7 @@ import { TGatewayV2ServiceFactory } from "../gateway-v2/gateway-v2-service";import { PamResource } from "../pam-resource/pam-resource-enums";import { OrgPermissionGatewayActions, OrgPermissionSubjects } from "../permission/org-permission";import { ProjectPermissionPamSessionActions, ProjectPermissionSub } from "../permission/project-permission";+import { TPamSessionAiSummaryServiceFactory } from "./pam-session-ai-summary-queue";import { TPamSessionDALFactory } from "./pam-session-dal";import { PamSessionStatus } from "./pam-session-enums";import { TPamSessionEventBatchDALFactory } from "./pam-session-event-batch-dal";@@ -32,6 +33,7 @@ type TPamSessionServiceFactoryDep = {permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getOrgPermission">;kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPAMConnectionDetails">;+ pamSessionAiSummaryService: Pick<TPamSessionAiSummaryServiceFactory, "queueAiSummary">;};export type TPamSessionServiceFactory = ReturnType<typeof pamSessionServiceFactory>;@@ -43,7 +45,8 @@ export const pamSessionServiceFactory = ({userDAL,permissionService,kmsService,- gatewayV2Service+ gatewayV2Service,+ pamSessionAiSummaryService}: TPamSessionServiceFactoryDep) => {// Helper to check and update expired sessions when viewing session details (redundancy for scheduled job)// Only applies to non-gateway sessions (e.g., AWS IAM) - gateway sessions are managed by the gateway@@ -212,6 +215,15 @@ export const pamSessionServiceFactory = ({return { session, projectId: project.id, alreadyEnded: true };}+ // Fire-and-forget AI summarization+ void (async () => {+ try {+ await pamSessionAiSummaryService.queueAiSummary(sessionId, project.id);+ } catch (err) {+ logger.error({ sessionId, err }, "Failed to queue AI summary for ended session");+ }+ })();+return { session: updatedSession, projectId: project.id, alreadyEnded: false };};@@ -242,6 +254,15 @@ export const pamSessionServiceFactory = ({return { session, projectId: project.id, alreadyEnded: true };}+ // Fire-and-forget AI summarization+ void (async () => {+ try {+ await pamSessionAiSummaryService.queueAiSummary(sessionId, project.id);+ } catch (err) {+ logger.error({ sessionId, err }, "Failed to queue AI summary for terminated session");+ }+ })();+// Fire-and-forget ALPN cancellation for gateway sessionsif (session.gatewayId) {void (async () => {diff --git a/backend/src/ee/services/pam-session/pam-session-summary-fns.ts b/backend/src/ee/services/pam-session/pam-session-summary-fns.tsnew file mode 100644index 0000000000..4a800f6707--- /dev/null+++ b/backend/src/ee/services/pam-session/pam-session-summary-fns.ts@@ -0,0 +1,115 @@+import { createAnthropic } from "@ai-sdk/anthropic";+import { generateObject } from "ai";+import { z } from "zod";++import { PamResource } from "../pam-resource/pam-resource-enums";+import { TPamSessionCommandLog, TTerminalEvent } from "./pam-session-types";++const MAX_LOG_CHARS = 200_000; // rough guard before sending to LLM++export const formatLogsForSummary = (+ logs: (TPamSessionCommandLog | TTerminalEvent)[],+ resourceType: PamResource+): string => {+ if (resourceType === PamResource.Postgres) {+ const sqlLogs = logs as TPamSessionCommandLog[];+ const lines = sqlLogs.map((log, i) => {+ const ts = new Date(log.timestamp).toISOString();+ return `[${i + 1}] [${ts}]\nQuery: ${log.input.trim()}\nResult: ${log.output.trim()}`;+ });+ const joined = lines.join("\n\n");+ return joined.length > MAX_LOG_CHARS ? joined.slice(0, MAX_LOG_CHARS) + "\n...(truncated)" : joined;+ }++ // SSH: extract input events and decode Base64 → printable text+ const terminalLogs = logs as TTerminalEvent[];+ const inputLines: string[] = [];+ for (const event of terminalLogs) {+ if (event.eventType !== "input") continue;+ try {+ const decoded = Buffer.from(event.data, "base64").toString("utf8");+ // Keep only printable ASCII and common whitespace, strip ANSI escape codes+ // eslint-disable-next-line no-control-regex+ const cleaned = decoded.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").replace(/[^\x20-\x7e\t\n\r]/g, "");+ if (cleaned.trim()) inputLines.push(cleaned);+ } catch {+ // skip malformed base64+ }+ }+ const combined = inputLines.join("");+ return combined.length > MAX_LOG_CHARS ? combined.slice(0, MAX_LOG_CHARS) + "\n...(truncated)" : combined;+};++const SYSTEM_PROMPTS: Partial<Record<PamResource, string>> = {+ [PamResource.Postgres]: `You are a security analyst reviewing a privileged access session on a PostgreSQL database.+The session was initiated through a data explorer tool that automatically runs queries to enumerate tables and inspect schema metadata on startup — these auto-generated queries are normal and expected. Do not flag them.++Write a concise summary of what the user actually did. Focus on meaningful actions: DML writes (INSERT/UPDATE/DELETE), DDL changes (CREATE/DROP/ALTER), stored procedure or function modifications, and privilege changes (GRANT/REVOKE).++Only add a warning for actions that are clearly destructive or suspicious — for example: bulk or unconditional DELETE/UPDATE, DROP TABLE/DATABASE, TRUNCATE, privilege escalation, or writes to sensitive system tables. Do NOT warn about SELECT queries, schema inspection, pg_catalog or information_schema reads, or any other read-only operations regardless of their scope.++Populate "summary" with a high-level overview (2-4 sentences) of the user's intent and the overall nature of their activity — not a chronological list of events. Write it as if explaining to a security team what the user was trying to accomplish, grouping related actions together. Populate "warnings" with objects containing "text" (≤ 20 words describing the concern) and "logIndex" (the 1-based index number shown in brackets at the start of the relevant log entry) for clearly destructive or suspicious write/modification actions only; leave it empty if none.`,++ [PamResource.SSH]: `You are a security analyst reviewing a privileged access session on an SSH server.+Only add a warning for actions that are clearly destructive or suspicious — for example: deleting files or directories (rm -rf), killing processes (kill/pkill), privilege escalation (sudo su, passwd), exfiltrating data (curl/wget to external hosts, nc), modifying system files (chmod/chown on sensitive paths), or installing/removing software. Do NOT warn about routine read-only commands (ls, cat, grep, ps, top, df, etc.) or typical developer/admin operations unless they target clearly sensitive paths.++Populate "summary" with a high-level overview (2-4 sentences) of the user's intent and the overall nature of their activity — not a chronological list of events. Write it as if explaining to a security team what the user was trying to accomplish, grouping related actions together. Populate "warnings" with objects containing "text" (≤ 20 words describing the concern) for clearly destructive or suspicious actions only; omit "logIndex" for all warnings; leave warnings empty if none.`+};++export const buildSummaryPrompt = ({+ resourceType,+ resourceName,+ actorName,+ actorEmail,+ durationSeconds,+ formattedLogs+}: {+ resourceType: PamResource;+ resourceName: string;+ actorName: string;+ actorEmail: string;+ durationSeconds: number;+ formattedLogs: string;+}): { system: string; user: string } => {+ const system = SYSTEM_PROMPTS[resourceType];+ if (!system) throw new Error(`No AI summary prompt defined for resource type: ${resourceType}`);++ const user = `Session metadata:+- Resource: ${resourceName} (${resourceType})+- Actor: ${actorName} <${actorEmail}>+- Duration: ${Math.round(durationSeconds)}s++Session logs:+${formattedLogs}`;++ return { system, user };+};++const SessionSummarySchema = z.object({+ summary: z.string(),+ warnings: z.array(+ z.object({+ text: z.string(),+ logIndex: z.number().int().optional()+ })+ )+});++export const generateSessionSummary = async (+ apiKey: string,+ model: string,+ system: string,+ user: string+): Promise<{ summary: string; warnings: string[] }> => {+ const anthropic = createAnthropic({ apiKey });++ const { object } = await generateObject({+ model: anthropic(model),+ schema: SessionSummarySchema,+ system,+ messages: [{ role: "user", content: user }],+ maxTokens: 1024+ });++ return object;+};diff --git a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts b/backend/src/ee/services/pam-web-access/pam-web-access-service.tsindex 8629edb994..2b8d747674 100644--- a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts+++ b/backend/src/ee/services/pam-web-access/pam-web-access-service.ts@@ -475,6 +475,7 @@ export const pamWebAccessServiceFactory = ({resourceName: resource.name,resourceType: resource.resourceType,accountId: account.id,+ resourceId: resource.id,userId});diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex b2737a7e91..77206111c0 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2772,6 +2772,9 @@ export const AppConnections = {OPEN_ROUTER: {apiKey: "The OpenRouter Provisioning API key used to manage API keys."},+ ANTHROPIC: {+ apiKey: "The Anthropic API key used to authenticate with the Anthropic API."+ },VENAFI: {apiKey: "The API key used to authenticate with Venafi TLS Protect Cloud.",region: "The region of your Venafi TLS Protect Cloud instance (e.g., 'us', 'eu')."diff --git a/backend/src/queue/queue-service.ts b/backend/src/queue/queue-service.tsindex 6a1487e467..50eb951dcc 100644--- a/backend/src/queue/queue-service.ts+++ b/backend/src/queue/queue-service.ts@@ -97,6 +97,7 @@ export enum QueueName {CertificateV3AutoRenewal = "certificate-v3-auto-renewal",PamAccountRotation = "pam-account-rotation",PamSessionExpiration = "pam-session-expiration",+ PamSessionAiSummary = "pam-session-ai-summary",PkiAcmeChallengeValidation = "pki-acme-challenge-validation",PkiDiscoveryScan = "pki-discovery-scan",AppConnectionCredentialRotation = "app-connection-credential-rotation",@@ -162,6 +163,7 @@ export enum QueueJobs {CertificateV3DailyAutoRenewal = "certificate-v3-daily-auto-renewal",PamAccountRotation = "pam-account-rotation",PamSessionExpiration = "pam-session-expiration",+ PamSessionAiSummary = "pam-session-ai-summary-job",PkiAcmeChallengeValidation = "pki-acme-challenge-validation",PkiDiscoveryRunScan = "pki-discovery-run-scan",PkiDiscoveryScheduledScan = "pki-discovery-scheduled-scan",@@ -485,6 +487,10 @@ export type TQueueJobTypes = {name: QueueJobs.PamSessionExpiration;payload: { sessionId: string };};+ [QueueName.PamSessionAiSummary]: {+ name: QueueJobs.PamSessionAiSummary;+ payload: { sessionId: string; projectId: string };+ };[QueueName.PkiAcmeChallengeValidation]: {name: QueueJobs.PkiAcmeChallengeValidation;payload: { challengeId: string };diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 7d51408344..56c53789c7 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -99,6 +99,7 @@ import { pamResourceFavoriteDALFactory } from "@app/ee/services/pam-resource/pamimport { pamResourceRotationRulesDALFactory } from "@app/ee/services/pam-resource/pam-resource-rotation-rules-dal";import { pamResourceRotationRulesServiceFactory } from "@app/ee/services/pam-resource/pam-resource-rotation-rules-service";import { pamResourceServiceFactory } from "@app/ee/services/pam-resource/pam-resource-service";+import { pamSessionAiSummaryServiceFactory } from "@app/ee/services/pam-session/pam-session-ai-summary-queue";import { pamSessionDALFactory } from "@app/ee/services/pam-session/pam-session-dal";import { pamSessionEventBatchDALFactory } from "@app/ee/services/pam-session/pam-session-event-batch-dal";import { pamSessionServiceFactory } from "@app/ee/services/pam-session/pam-session-service";@@ -2868,6 +2869,15 @@ export const registerRoutes = async (pamAccountService});+ const pamSessionAiSummaryService = pamSessionAiSummaryServiceFactory({+ queueService,+ pamSessionDAL,+ pamSessionEventBatchDAL,+ pamResourceDAL,+ appConnectionDAL,+ kmsService+ });+const pamSessionService = pamSessionServiceFactory({pamSessionDAL,pamSessionEventBatchDAL,@@ -2875,7 +2885,8 @@ export const registerRoutes = async (userDAL,permissionService,kmsService,- gatewayV2Service+ gatewayV2Service,+ pamSessionAiSummaryService});const pamWebAccessService = pamWebAccessServiceFactory({@@ -3015,6 +3026,7 @@ export const registerRoutes = async (pamDiscoveryQueue.startPamDiscoveryQueue();await pamAccountRotation.init();pamSessionExpirationService.init();+ pamSessionAiSummaryService.init();await dailyReminderQueueService.startDailyRemindersJob();await secretSyncQueue.startDailySecretSyncRetryJob();await dailyReminderQueueService.startSecretReminderMigrationJob();diff --git a/backend/src/server/routes/v1/app-connection-routers/anthropic-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/anthropic-connection-router.tsnew file mode 100644index 0000000000..2624b01bcf--- /dev/null+++ b/backend/src/server/routes/v1/app-connection-routers/anthropic-connection-router.ts@@ -0,0 +1,18 @@+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ CreateAnthropicConnectionSchema,+ SanitizedAnthropicConnectionSchema,+ UpdateAnthropicConnectionSchema+} from "@app/services/app-connection/anthropic";++import { registerAppConnectionEndpoints } from "./app-connection-endpoints";++export const registerAnthropicConnectionRouter = async (server: FastifyZodProvider) => {+ registerAppConnectionEndpoints({+ app: AppConnection.Anthropic,+ server,+ sanitizedResponseSchema: SanitizedAnthropicConnectionSchema,+ createSchema: CreateAnthropicConnectionSchema,+ updateSchema: UpdateAnthropicConnectionSchema+ });+};diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.tsindex 0f944c2c63..0be8fe7219 100644--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts@@ -127,6 +127,10 @@ import {SanitizedOctopusDeployConnectionSchema} from "@app/services/app-connection/octopus-deploy";import { OktaConnectionListItemSchema, SanitizedOktaConnectionSchema } from "@app/services/app-connection/okta";+import {+ AnthropicConnectionListItemSchema,+ SanitizedAnthropicConnectionSchema+} from "@app/services/app-connection/anthropic";import {OpenRouterConnectionListItemSchema,SanitizedOpenRouterConnectionSchema@@ -220,6 +224,7 @@ const SanitizedAppConnectionSchema = z.union([...SanitizedSshConnectionSchema.options,...SanitizedDbtConnectionSchema.options,...SanitizedOpenRouterConnectionSchema.options,+ ...SanitizedAnthropicConnectionSchema.options,...SanitizedAzureEntraIdConnectionSchema.options,...SanitizedVenafiConnectionSchema.options,...SanitizedExternalInfisicalConnectionSchema.options,@@ -281,7 +286,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [AzureEntraIdConnectionListItemSchema,VenafiConnectionListItemSchema,ExternalInfisicalConnectionListItemSchema,- NetScalerConnectionListItemSchema+ NetScalerConnectionListItemSchema,+ AnthropicConnectionListItemSchema]);export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.tsindex 50ef6bbdce..edc0aab7c1 100644--- a/backend/src/server/routes/v1/app-connection-routers/index.ts+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts@@ -3,6 +3,7 @@ import { registerOCIConnectionRouter } from "@app/ee/routes/v1/app-connection-roimport { registerOracleDBConnectionRouter } from "@app/ee/routes/v1/app-connection-routers/oracledb-connection-router";import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import { registerAnthropicConnectionRouter } from "./anthropic-connection-router";import { registerOnePassConnectionRouter } from "./1password-connection-router";import { registerAuth0ConnectionRouter } from "./auth0-connection-router";import { registerAwsConnectionRouter } from "./aws-connection-router";@@ -114,5 +115,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:[AppConnection.AzureEntraId]: registerAzureEntraIdConnectionRouter,[AppConnection.Venafi]: registerVenafiConnectionRouter,[AppConnection.ExternalInfisical]: registerExternalInfisicalConnectionRouter,- [AppConnection.NetScaler]: registerNetScalerConnectionRouter+ [AppConnection.NetScaler]: registerNetScalerConnectionRouter,+ [AppConnection.Anthropic]: registerAnthropicConnectionRouter};diff --git a/backend/src/services/app-connection/anthropic/anthropic-connection-enums.ts b/backend/src/services/app-connection/anthropic/anthropic-connection-enums.tsnew file mode 100644index 0000000000..5668e05150--- /dev/null+++ b/backend/src/services/app-connection/anthropic/anthropic-connection-enums.ts@@ -0,0 +1,3 @@+export enum AnthropicConnectionMethod {+ ApiKey = "api-key"+}diff --git a/backend/src/services/app-connection/anthropic/anthropic-connection-fns.ts b/backend/src/services/app-connection/anthropic/anthropic-connection-fns.tsnew file mode 100644index 0000000000..48691eedf8--- /dev/null+++ b/backend/src/services/app-connection/anthropic/anthropic-connection-fns.ts@@ -0,0 +1,36 @@+import { request } from "@app/lib/config/request";+import { UnauthorizedError } from "@app/lib/errors";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";++import { AnthropicConnectionMethod } from "./anthropic-connection-enums";+import { TAnthropicConnectionConfig } from "./anthropic-connection-types";++export const ANTHROPIC_API_BASE_URL = "https://api.anthropic.com/v1";++export const getAnthropicConnectionListItem = () => {+ return {+ name: "Anthropic" as const,+ app: AppConnection.Anthropic as const,+ methods: Object.values(AnthropicConnectionMethod) as [AnthropicConnectionMethod.ApiKey]+ };+};++export const validateAnthropicConnectionCredentials = async (config: TAnthropicConnectionConfig) => {+ const { apiKey } = config.credentials;++ try {+ await request.get(`${ANTHROPIC_API_BASE_URL}/models`, {+ headers: {+ "x-api-key": apiKey,+ "anthropic-version": "2023-06-01"+ },+ validateStatus: (status) => status === 200+ });+ } catch {+ throw new UnauthorizedError({+ message: "Unable to validate connection: invalid API key"+ });+ }++ return config.credentials;+};diff --git a/backend/src/services/app-connection/anthropic/anthropic-connection-schemas.ts b/backend/src/services/app-connection/anthropic/anthropic-connection-schemas.tsnew file mode 100644index 0000000000..b268d5c54a--- /dev/null+++ b/backend/src/services/app-connection/anthropic/anthropic-connection-schemas.ts@@ -0,0 +1,61 @@+import z from "zod";++import { AppConnections } from "@app/lib/api-docs";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ BaseAppConnectionSchema,+ GenericCreateAppConnectionFieldsSchema,+ GenericUpdateAppConnectionFieldsSchema+} from "@app/services/app-connection/app-connection-schemas";++import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";+import { AnthropicConnectionMethod } from "./anthropic-connection-enums";++export const AnthropicConnectionApiKeyCredentialsSchema = z.object({+ apiKey: z.string().trim().min(1, "API Key required").describe(AppConnections.CREDENTIALS.ANTHROPIC.apiKey)+});++const BaseAnthropicConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.Anthropic) });++export const AnthropicConnectionSchema = BaseAnthropicConnectionSchema.extend({+ method: z.literal(AnthropicConnectionMethod.ApiKey),+ credentials: AnthropicConnectionApiKeyCredentialsSchema+});++export const SanitizedAnthropicConnectionSchema = z.discriminatedUnion("method", [+ BaseAnthropicConnectionSchema.extend({+ method: z.literal(AnthropicConnectionMethod.ApiKey),+ credentials: z.object({})+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.Anthropic]} (API Key)` }))+]);++export const ValidateAnthropicConnectionCredentialsSchema = z.discriminatedUnion("method", [+ z.object({+ method: z+ .literal(AnthropicConnectionMethod.ApiKey)+ .describe(AppConnections.CREATE(AppConnection.Anthropic).method),+ credentials: AnthropicConnectionApiKeyCredentialsSchema.describe(+ AppConnections.CREATE(AppConnection.Anthropic).credentials+ )+ })+]);++export const CreateAnthropicConnectionSchema = ValidateAnthropicConnectionCredentialsSchema.and(+ GenericCreateAppConnectionFieldsSchema(AppConnection.Anthropic)+);++export const UpdateAnthropicConnectionSchema = z+ .object({+ credentials: AnthropicConnectionApiKeyCredentialsSchema.optional().describe(+ AppConnections.UPDATE(AppConnection.Anthropic).credentials+ )+ })+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.Anthropic));++export const AnthropicConnectionListItemSchema = z+ .object({+ name: z.literal("Anthropic"),+ app: z.literal(AppConnection.Anthropic),+ methods: z.nativeEnum(AnthropicConnectionMethod).array()+ })+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.Anthropic] }));diff --git a/backend/src/services/app-connection/anthropic/anthropic-connection-types.ts b/backend/src/services/app-connection/anthropic/anthropic-connection-types.tsnew file mode 100644index 0000000000..53e651a2de--- /dev/null+++ b/backend/src/services/app-connection/anthropic/anthropic-connection-types.ts@@ -0,0 +1,25 @@+import z from "zod";++import { DiscriminativePick } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import {+ AnthropicConnectionSchema,+ CreateAnthropicConnectionSchema,+ ValidateAnthropicConnectionCredentialsSchema+} from "./anthropic-connection-schemas";++export type TAnthropicConnection = z.infer<typeof AnthropicConnectionSchema>;++export type TAnthropicConnectionInput = z.infer<typeof CreateAnthropicConnectionSchema> & {+ app: AppConnection.Anthropic;+};++export type TValidateAnthropicConnectionCredentialsSchema = typeof ValidateAnthropicConnectionCredentialsSchema;++export type TAnthropicConnectionConfig = DiscriminativePick<+ TAnthropicConnectionInput,+ "method" | "app" | "credentials"+> & {+ orgId: string;+};diff --git a/backend/src/services/app-connection/anthropic/index.ts b/backend/src/services/app-connection/anthropic/index.tsnew file mode 100644index 0000000000..35a8c237f2--- /dev/null+++ b/backend/src/services/app-connection/anthropic/index.ts@@ -0,0 +1,4 @@+export * from "./anthropic-connection-enums";+export * from "./anthropic-connection-fns";+export * from "./anthropic-connection-schemas";+export * from "./anthropic-connection-types";diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.tsindex 687990b66b..fe4dcf4d06 100644--- a/backend/src/services/app-connection/app-connection-enums.ts+++ b/backend/src/services/app-connection/app-connection-enums.ts@@ -53,7 +53,8 @@ export enum AppConnection {AzureEntraId = "azure-entra-id",Venafi = "venafi",ExternalInfisical = "external-infisical",- NetScaler = "netscaler"+ NetScaler = "netscaler",+ Anthropic = "anthropic"}export enum AWSRegion {diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.tsindex 12ab066142..849263f4de 100644--- a/backend/src/services/app-connection/app-connection-fns.ts+++ b/backend/src/services/app-connection/app-connection-fns.ts@@ -26,6 +26,11 @@ import { TIdentityUaDALFactory } from "@app/services/identity-ua/identity-ua-dalimport { KmsDataKey } from "@app/services/kms/kms-types";import { SECRET_SYNC_CONNECTION_MAP } from "@app/services/secret-sync/secret-sync-maps";+import {+ AnthropicConnectionMethod,+ getAnthropicConnectionListItem,+ validateAnthropicConnectionCredentials+} from "./anthropic";import {getOnePassConnectionListItem,OnePassConnectionMethod,@@ -282,6 +287,7 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {getDbtConnectionListItem(),getSmbConnectionListItem(),getOpenRouterConnectionListItem(),+ getAnthropicConnectionListItem(),getCircleCIConnectionListItem(),getAzureEntraIdConnectionListItem(),getVenafiConnectionListItem(),@@ -428,6 +434,7 @@ export const validateAppConnectionCredentials = async ([AppConnection.Dbt]: validateDbtConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.SMB]: validateSmbConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.OpenRouter]: validateOpenRouterConnectionCredentials as TAppConnectionCredentialsValidator,+ [AppConnection.Anthropic]: validateAnthropicConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.CircleCI]: validateCircleCIConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.AzureEntraId]: validateAzureEntraIdConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Venafi]: validateVenafiConnectionCredentials as TAppConnectionCredentialsValidator,@@ -521,6 +528,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>case ChecklyConnectionMethod.ApiKey:case OctopusDeployConnectionMethod.ApiKey:case OpenRouterConnectionMethod.ApiKey:+ case AnthropicConnectionMethod.ApiKey:return "API Key";case ChefConnectionMethod.UserKey:return "User Key";@@ -634,6 +642,7 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<[AppConnection.Dbt]: platformManagedCredentialsNotSupported,[AppConnection.SMB]: platformManagedCredentialsNotSupported,[AppConnection.OpenRouter]: platformManagedCredentialsNotSupported,+ [AppConnection.Anthropic]: platformManagedCredentialsNotSupported,[AppConnection.CircleCI]: platformManagedCredentialsNotSupported,[AppConnection.AzureEntraId]: platformManagedCredentialsNotSupported,[AppConnection.Venafi]: platformManagedCredentialsNotSupported,diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.tsindex c948a89be8..b3de1153d2 100644--- a/backend/src/services/app-connection/app-connection-maps.ts+++ b/backend/src/services/app-connection/app-connection-maps.ts@@ -55,7 +55,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {[AppConnection.AzureEntraId]: "Azure Entra ID",[AppConnection.Venafi]: "Venafi TLS Protect Cloud",[AppConnection.ExternalInfisical]: "Infisical",- [AppConnection.NetScaler]: "NetScaler"+ [AppConnection.NetScaler]: "NetScaler",+ [AppConnection.Anthropic]: "Anthropic"};export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {@@ -113,5 +114,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp[AppConnection.AzureEntraId]: AppConnectionPlanType.Regular,[AppConnection.Venafi]: AppConnectionPlanType.Regular,[AppConnection.ExternalInfisical]: AppConnectionPlanType.Regular,- [AppConnection.NetScaler]: AppConnectionPlanType.Regular+ [AppConnection.NetScaler]: AppConnectionPlanType.Regular,+ [AppConnection.Anthropic]: AppConnectionPlanType.Regular};diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex bef7cc6abb..0074eff566 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -122,6 +122,7 @@ import { ValidateOctopusDeployConnectionCredentialsSchema } from "./octopus-deplimport { octopusDeployConnectionService } from "./octopus-deploy/octopus-deploy-connection-service";import { ValidateOktaConnectionCredentialsSchema } from "./okta";import { oktaConnectionService } from "./okta/okta-connection-service";+import { ValidateAnthropicConnectionCredentialsSchema } from "./anthropic";import { ValidateOpenRouterConnectionCredentialsSchema } from "./open-router";import { ValidatePostgresConnectionCredentialsSchema } from "./postgres";import { ValidateRailwayConnectionCredentialsSchema } from "./railway";@@ -217,7 +218,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp[AppConnection.AzureEntraId]: ValidateAzureEntraIdConnectionCredentialsSchema,[AppConnection.Venafi]: ValidateVenafiConnectionCredentialsSchema,[AppConnection.ExternalInfisical]: ValidateExternalInfisicalConnectionCredentialsSchema,- [AppConnection.NetScaler]: ValidateNetScalerConnectionCredentialsSchema+ [AppConnection.NetScaler]: ValidateNetScalerConnectionCredentialsSchema,+ [AppConnection.Anthropic]: ValidateAnthropicConnectionCredentialsSchema};export const appConnectionServiceFactory = ({diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.tsindex dab8be2c84..536e4fbd5a 100644--- a/backend/src/services/app-connection/app-connection-types.ts+++ b/backend/src/services/app-connection/app-connection-types.ts@@ -240,6 +240,12 @@ import {TOktaConnectionInput,TValidateOktaConnectionCredentialsSchema} from "./okta";+import {+ TAnthropicConnection,+ TAnthropicConnectionConfig,+ TAnthropicConnectionInput,+ TValidateAnthropicConnectionCredentialsSchema+} from "./anthropic";import {TOpenRouterConnection,TOpenRouterConnectionConfig,@@ -380,6 +386,7 @@ export type TAppConnection = { id: string } & (| TVenafiConnection| TExternalInfisicalConnection| TNetScalerConnection+ | TAnthropicConnection);export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;@@ -446,6 +453,7 @@ export type TAppConnectionInput = { id: string } & (| TVenafiConnectionInput| TExternalInfisicalConnectionInput| TNetScalerConnectionInput+ | TAnthropicConnectionInput);export type TSqlConnectionInput =@@ -540,7 +548,8 @@ export type TAppConnectionConfig =| TAzureEntraIdConnectionConfig| TVenafiConnectionConfig| TExternalInfisicalConnectionConfig- | TNetScalerConnectionConfig;+ | TNetScalerConnectionConfig+ | TAnthropicConnectionConfig;export type TValidateAppConnectionCredentialsSchema =| TValidateAwsConnectionCredentialsSchema@@ -597,7 +606,8 @@ export type TValidateAppConnectionCredentialsSchema =| TValidateAzureEntraIdConnectionCredentialsSchema| TValidateVenafiConnectionCredentialsSchema| TValidateExternalInfisicalConnectionCredentialsSchema- | TValidateNetScalerConnectionCredentialsSchema;+ | TValidateNetScalerConnectionCredentialsSchema+ | TValidateAnthropicConnectionCredentialsSchema;export type TListAwsConnectionKmsKeys = {connectionId: string;diff --git a/frontend/public/images/integrations/Anthropic.png b/frontend/public/images/integrations/Anthropic.pngnew file mode 100644index 0000000000..8a3551f5abBinary files /dev/null and b/frontend/public/images/integrations/Anthropic.png differdiff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.tsindex c5c0809c0d..5e51329d72 100644--- a/frontend/src/helpers/appConnections.ts+++ b/frontend/src/helpers/appConnections.ts@@ -63,6 +63,7 @@ import { NetlifyConnectionMethod } from "@app/hooks/api/appConnections/types/netimport { NetScalerConnectionMethod } from "@app/hooks/api/appConnections/types/netscaler-connection";import { NorthflankConnectionMethod } from "@app/hooks/api/appConnections/types/northflank-connection";import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-connection";+import { AnthropicConnectionMethod } from "@app/hooks/api/appConnections/types/anthropic-connection";import { OpenRouterConnectionMethod } from "@app/hooks/api/appConnections/types/open-router-connection";import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/railway-connection";import { RenderConnectionMethod } from "@app/hooks/api/appConnections/types/render-connection";@@ -158,7 +159,8 @@ export const APP_CONNECTION_MAP: Record<[AppConnection.AzureEntraId]: { name: "Azure Entra ID", image: "Microsoft Azure.png" },[AppConnection.Venafi]: { name: "Venafi TLS Protect Cloud", image: "Venafi.png" },[AppConnection.ExternalInfisical]: { name: "Infisical", image: "Infisical.png" },- [AppConnection.NetScaler]: { name: "NetScaler", image: "NetScaler.png" }+ [AppConnection.NetScaler]: { name: "NetScaler", image: "NetScaler.png" },+ [AppConnection.Anthropic]: { name: "Anthropic", image: "Anthropic.png" }};export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {@@ -236,6 +238,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])case RenderConnectionMethod.ApiKey:case ChecklyConnectionMethod.ApiKey:case OpenRouterConnectionMethod.ApiKey:+ case AnthropicConnectionMethod.ApiKey:return { name: "API Key", icon: faKey };case ChefConnectionMethod.UserKey:return { name: "User Key", icon: faKey };diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.tsindex 962f527bfd..f57e65e16c 100644--- a/frontend/src/hooks/api/appConnections/enums.ts+++ b/frontend/src/hooks/api/appConnections/enums.ts@@ -53,5 +53,6 @@ export enum AppConnection {AzureEntraId = "azure-entra-id",Venafi = "venafi",ExternalInfisical = "external-infisical",- NetScaler = "netscaler"+ NetScaler = "netscaler",+ Anthropic = "anthropic"}diff --git a/frontend/src/hooks/api/appConnections/types/anthropic-connection.ts b/frontend/src/hooks/api/appConnections/types/anthropic-connection.tsnew file mode 100644index 0000000000..2fe0834d47--- /dev/null+++ b/frontend/src/hooks/api/appConnections/types/anthropic-connection.ts@@ -0,0 +1,13 @@+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";++export enum AnthropicConnectionMethod {+ ApiKey = "api-key"+}++export type TAnthropicConnection = TRootAppConnection & { app: AppConnection.Anthropic } & {+ method: AnthropicConnectionMethod.ApiKey;+ credentials: {+ apiKey: string;+ };+};diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.tsindex ded5b6c66a..6bc479658a 100644--- a/frontend/src/hooks/api/appConnections/types/index.ts+++ b/frontend/src/hooks/api/appConnections/types/index.ts@@ -40,6 +40,7 @@ import { TNorthflankConnection } from "./northflank-connection";import { TOCIConnection } from "./oci-connection";import { TOctopusDeployConnection } from "./octopus-deploy-connection";import { TOktaConnection } from "./okta-connection";+import { TAnthropicConnection } from "./anthropic-connection";import { TOpenRouterConnection } from "./open-router-connection";import { TOracleDBConnection } from "./oracledb-connection";import { TPostgresConnection } from "./postgres-connection";@@ -162,6 +163,7 @@ export type TAppConnection =| TDbtConnection| TSmbConnection| TOpenRouterConnection+ | TAnthropicConnection| TCircleCIConnection| TAzureEntraIdConnection| TVenafiConnectiondiff --git a/frontend/src/hooks/api/pam/types/base-resource.ts b/frontend/src/hooks/api/pam/types/base-resource.tsindex 9c4f664dc5..c6eb0352fc 100644--- a/frontend/src/hooks/api/pam/types/base-resource.ts+++ b/frontend/src/hooks/api/pam/types/base-resource.ts@@ -1,3 +1,9 @@+export type TSessionSummaryConfig = {+ aiInsightsEnabled: boolean;+ connectionId: string;+ model: string;+} | null;+export interface TBasePamResource {id: string;projectId: string;@@ -6,6 +12,7 @@ export interface TBasePamResource {adServerResourceId?: string | null;metadata?: { key: string; value: string }[];isFavorite?: boolean;+ sessionSummaryConfig?: TSessionSummaryConfig;createdAt: string;updatedAt: string;}diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.tsindex d82829aaf1..c03523d56e 100644--- a/frontend/src/hooks/api/pam/types/index.ts+++ b/frontend/src/hooks/api/pam/types/index.ts@@ -17,6 +17,7 @@ import { TPostgresAccount, TPostgresResource } from "./postgres-resource";import { TRedisAccount, TRedisResource } from "./redis-resource";import { TSSHAccount, TSSHResource } from "./ssh-resource";import { TWindowsAccount, TWindowsResource } from "./windows-server-resource";+import { TSessionSummaryConfig } from "./base-resource";export * from "./active-directory-resource";export * from "./aws-iam-resource";@@ -101,10 +102,16 @@ export type THttpEvent = THttpRequestEvent | THttpResponseEvent;export type TPamSessionLog = TPamCommandLog | TTerminalEvent | THttpEvent;+export type TPamSessionAiInsights = {+ summary: string;+ warnings: { text: string; logIndex?: number }[];+};+export type TPamSession = {id: string;projectId: string;accountId?: string | null;+ resourceId?: string | null;resourceType: PamResourceType;resourceName: string;accountName: string;@@ -121,6 +128,9 @@ export type TPamSession = {updatedAt: string;logs: TPamSessionLog[];gatewayIdentityId?: string | null;+ aiInsightsStatus?: string | null;+ aiInsightsError?: string | null;+ aiInsights?: TPamSessionAiInsights | null;};// Resource DTOs@@ -143,6 +153,8 @@ export type TCreatePamResourceDTO = Pick<metadata?: { key: string; value: string }[];};+export type { TSessionSummaryConfig };+export type TUpdatePamResourceDTO = Partial<Pick<TPamResource, "name" | "connectionDetails" | "gatewayId">> & {@@ -151,6 +163,7 @@ export type TUpdatePamResourceDTO = Partial<adServerResourceId?: string | null;metadata?: { key: string; value: string }[];rotationAccountCredentials?: { username: string; password: string } | null;+ sessionSummaryConfig?: TSessionSummaryConfig;};export type TDeletePamResourceDTO = {diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AnthropicConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AnthropicConnectionForm.tsxnew file mode 100644index 0000000000..874b3bea0b--- /dev/null+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AnthropicConnectionForm.tsx@@ -0,0 +1,134 @@+import { Controller, FormProvider, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { z } from "zod";++import {+ Button,+ FormControl,+ ModalClose,+ SecretInput,+ Select,+ SelectItem+} from "@app/components/v2";+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import {+ AnthropicConnectionMethod,+ TAnthropicConnection+} from "@app/hooks/api/appConnections/types/anthropic-connection";++import {+ genericAppConnectionFieldsSchema,+ GenericAppConnectionsFields+} from "./GenericAppConnectionFields";++type Props = {+ appConnection?: TAnthropicConnection;+ onSubmit: (formData: FormData) => void;+};++const rootSchema = genericAppConnectionFieldsSchema.extend({+ app: z.literal(AppConnection.Anthropic)+});++const formSchema = z.discriminatedUnion("method", [+ rootSchema.extend({+ method: z.literal(AnthropicConnectionMethod.ApiKey),+ credentials: z.object({+ apiKey: z.string().trim().min(1, "API Key required")+ })+ })+]);++type FormData = z.infer<typeof formSchema>;++export const AnthropicConnectionForm = ({ appConnection, onSubmit }: Props) => {+ const isUpdate = Boolean(appConnection);++ const form = useForm<FormData>({+ resolver: zodResolver(formSchema),+ defaultValues: appConnection ?? {+ app: AppConnection.Anthropic,+ method: AnthropicConnectionMethod.ApiKey+ }+ });++ const {+ handleSubmit,+ control,+ formState: { isSubmitting, isDirty }+ } = form;++ return (+ <FormProvider {...form}>+ <form onSubmit={handleSubmit(onSubmit)}>+ {!isUpdate && <GenericAppConnectionsFields />}+ <Controller+ name="method"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ tooltipText={`The method you would like to use to connect with ${+ APP_CONNECTION_MAP[AppConnection.Anthropic].name+ }. This field cannot be changed after creation.`}+ errorText={error?.message}+ isError={Boolean(error?.message)}+ label="Method"+ >+ <Select+ isDisabled={isUpdate}+ value={value}+ onValueChange={(val) => onChange(val)}+ className="w-full border border-mineshaft-500"+ position="popper"+ dropdownContainerClassName="max-w-none"+ >+ {Object.values(AnthropicConnectionMethod).map((method) => (+ <SelectItem value={method} key={method}>+ {getAppConnectionMethodDetails(method).name}+ </SelectItem>+ ))}+ </Select>+ </FormControl>+ )}+ />+ <Controller+ name="credentials.apiKey"+ control={control}+ shouldUnregister+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ errorText={error?.message}+ isError={Boolean(error?.message)}+ label="API Key"+ tooltipText="The Anthropic API key used to authenticate with the Anthropic API."+ >+ <SecretInput+ containerClassName="text-gray-400 group-focus-within:border-primary-400/50! border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ />+ </FormControl>+ )}+ />+ <div className="mt-8 flex items-center">+ <Button+ className="mr-4"+ size="sm"+ type="submit"+ colorSchema="secondary"+ isLoading={isSubmitting}+ isDisabled={isSubmitting || !isDirty}+ >+ {isUpdate ? "Update Credentials" : "Connect to Anthropic"}+ </Button>+ <ModalClose asChild>+ <Button colorSchema="secondary" variant="plain">+ Cancel+ </Button>+ </ModalClose>+ </div>+ </form>+ </FormProvider>+ );+};diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsxindex 611d96aadd..3faab41988 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx@@ -54,6 +54,7 @@ import { NorthflankConnectionForm } from "./NorthflankConnectionForm";import { OCIConnectionForm } from "./OCIConnectionForm";import { OctopusDeployConnectionForm } from "./OctopusDeployConnectionForm";import { OktaConnectionForm } from "./OktaConnectionForm";+import { AnthropicConnectionForm } from "./AnthropicConnectionForm";import { OpenRouterConnectionForm } from "./OpenRouterConnectionForm";import { OracleDBConnectionForm } from "./OracleDBConnectionForm";import { PostgresConnectionForm } from "./PostgresConnectionForm";@@ -263,6 +264,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {return <SmbConnectionForm onSubmit={onSubmit} />;case AppConnection.OpenRouter:return <OpenRouterConnectionForm onSubmit={onSubmit} />;+ case AppConnection.Anthropic:+ return <AnthropicConnectionForm onSubmit={onSubmit} />;case AppConnection.CircleCI:return <CircleCIConnectionForm onSubmit={onSubmit} />;case AppConnection.Venafi:@@ -474,6 +477,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {return <SmbConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.OpenRouter:return <OpenRouterConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;+ case AppConnection.Anthropic:+ return <AnthropicConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.CircleCI:return <CircleCIConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.ExternalInfisical:diff --git a/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx b/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsxindex 5793282c39..8749010012 100644--- a/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx+++ b/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx@@ -24,7 +24,8 @@ import {PAM_RESOURCE_TYPE_MAP,PamResourceType,useDeletePamResource,- useGetPamResourceById+ useGetPamResourceById,+ useUpdatePamResource} from "@app/hooks/api/pam";import { PamUpdateResourceModal } from "../PamResourcesPage/components/PamUpdateResourceModal";@@ -36,7 +37,9 @@ import {PamResourceMetadataSection,PamResourceRelatedResourcesSection,PamResourceRotationPolicySection,- PamRotationPolicyModal+ PamResourceSessionRecordingSection,+ PamRotationPolicyModal,+ PamSessionRecordingModal} from "./components";const PageContent = () => {@@ -69,6 +72,7 @@ const PageContent = () => {const [isEditModalOpen, setIsEditModalOpen] = useState(false);const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);const [isRotationPolicyModalOpen, setIsRotationPolicyModalOpen] = useState(false);+ const [isSessionRecordingModalOpen, setIsSessionRecordingModalOpen] = useState(false);const { data: resource, isPending } = useGetPamResourceById(resourceType as PamResourceType,@@ -79,6 +83,7 @@ const PageContent = () => {);const deleteResource = useDeletePamResource();+ const updateResource = useUpdatePamResource();if (isPending) {return <UnstablePageLoader />;@@ -207,6 +212,12 @@ const PageContent = () => {resource={resource}onEdit={() => setIsRotationPolicyModalOpen(true)}/>+ {[PamResourceType.Postgres, PamResourceType.SSH].includes(resource.resourceType) && (+ <PamResourceSessionRecordingSection+ config={resource.sessionSummaryConfig ?? null}+ onEdit={() => setIsSessionRecordingModalOpen(true)}+ />+ )}<PamResourceMetadataSection resource={resource} /></div>@@ -258,6 +269,21 @@ const PageContent = () => {onOpenChange={setIsRotationPolicyModalOpen}resource={resource}/>++ {[PamResourceType.Postgres, PamResourceType.SSH].includes(resource.resourceType) && (+ <PamSessionRecordingModal+ isOpen={isSessionRecordingModalOpen}+ onOpenChange={setIsSessionRecordingModalOpen}+ config={resource.sessionSummaryConfig ?? null}+ onSave={async (config) => {+ await updateResource.mutateAsync({+ resourceId: resource.id,+ resourceType: resource.resourceType,+ sessionSummaryConfig: config+ });+ }}+ />+ )}</div>);};diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceSessionRecordingSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceSessionRecordingSection.tsxnew file mode 100644index 0000000000..101a42bdf3--- /dev/null+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceSessionRecordingSection.tsx@@ -0,0 +1,89 @@+import { PencilIcon, SparklesIcon } from "lucide-react";++import { ProjectPermissionCan } from "@app/components/permissions";+import {+ Badge,+ Detail,+ DetailGroup,+ DetailLabel,+ DetailValue,+ UnstableIconButton+} from "@app/components/v3";+import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";+import { useListAppConnections } from "@app/hooks/api/appConnections/queries";++// SessionRecordingConfig mirrors the backend sessionSummaryConfig shape.+// connectionName is optional and derived client-side from the app connections list.+export type SessionRecordingConfig = {+ aiInsightsEnabled: boolean;+ connectionId: string;+ connectionName?: string;+ model: string;+} | null;++type Props = {+ config: SessionRecordingConfig;+ onEdit: VoidFunction;+};++export const PamResourceSessionRecordingSection = ({ config, onEdit }: Props) => {+ const { data: allConnections = [] } = useListAppConnections(undefined, {+ enabled: Boolean(config?.aiInsightsEnabled && config?.connectionId)+ });++ const connectionName =+ config?.connectionName ||+ allConnections.find((c) => c.id === config?.connectionId)?.name ||+ config?.connectionId ||+ "";++ return (+ <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">+ <div className="flex items-center justify-between border-b border-border pb-2">+ <h3 className="text-lg font-medium">Session Recording</h3>+ <ProjectPermissionCan+ I={ProjectPermissionActions.Edit}+ a={ProjectPermissionSub.PamResources}+ >+ {(isAllowed) => (+ <UnstableIconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>+ <PencilIcon />+ </UnstableIconButton>+ )}+ </ProjectPermissionCan>+ </div>++ <DetailGroup>+ <Detail>+ <DetailLabel>+ <span className="flex items-center gap-1.5">+ <SparklesIcon className="size-3.5 text-purple-400" />+ AI Insights+ </span>+ </DetailLabel>+ <DetailValue>+ {config?.aiInsightsEnabled ? (+ <Badge variant="success">Enabled</Badge>+ ) : (+ <span className="text-muted">Disabled</span>+ )}+ </DetailValue>+ </Detail>+ {config?.aiInsightsEnabled && (+ <>+ <Detail>+ <DetailLabel>App Connection</DetailLabel>+ <DetailValue>{connectionName}</DetailValue>+ </Detail>+ <Detail>+ <DetailLabel>Model</DetailLabel>+ <DetailValue>+ <code className="rounded bg-mineshaft-600 px-2 py-0.5 text-xs">{config.model}</code>+ </DetailValue>+ </Detail>+ </>+ )}+ </DetailGroup>+ </div>+ );+};diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsxnew file mode 100644index 0000000000..cafed4d036--- /dev/null+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamSessionRecordingModal.tsx@@ -0,0 +1,261 @@+import { useEffect } from "react";+import { Controller, useForm, useWatch } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { z } from "zod";++import {+ Button,+ Field,+ FieldContent,+ FieldError,+ FieldLabel,+ Label,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Sheet,+ SheetContent,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ Switch+} from "@app/components/v3";+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { useListAppConnections } from "@app/hooks/api/appConnections/queries";++import { SessionRecordingConfig } from "./PamResourceSessionRecordingSection";++// Extend this array as more LLM providers are added+const LLM_APP_CONNECTIONS = [AppConnection.Anthropic] as const;+type LlmAppConnection = (typeof LLM_APP_CONNECTIONS)[number];++const LLM_MODELS: Record<LlmAppConnection, { id: string; label: string }[]> = {+ [AppConnection.Anthropic]: [+ { id: "claude-opus-4-6", label: "Claude Opus 4.6" },+ { id: "claude-sonnet-4-6", label: "Claude Sonnet 4.6" },+ { id: "claude-haiku-4-5-20251001", label: "Claude Haiku 4.5" }+ ]+};++const DEFAULT_MODEL: Record<LlmAppConnection, string> = {+ [AppConnection.Anthropic]: "claude-sonnet-4-6"+};++const formSchema = z.object({+ aiInsightsEnabled: z.boolean(),+ connectionId: z.string().optional(),+ model: z.string().optional()+});++type FormData = z.infer<typeof formSchema>;++type Props = {+ isOpen: boolean;+ onOpenChange: (open: boolean) => void;+ config: SessionRecordingConfig;+ onSave: (config: SessionRecordingConfig) => void | Promise<void>;+};++export const PamSessionRecordingModal = ({ isOpen, onOpenChange, config, onSave }: Props) => {+ const { data: allConnections = [], isPending } = useListAppConnections(undefined, {+ enabled: isOpen+ });++ const llmConnections = allConnections.filter((c) =>+ (LLM_APP_CONNECTIONS as readonly string[]).includes(c.app)+ );++ const { control, handleSubmit, reset, setValue, formState: { isSubmitting } } = useForm<FormData>({+ resolver: zodResolver(formSchema),+ defaultValues: {+ aiInsightsEnabled: config?.aiInsightsEnabled ?? false,+ connectionId: config?.connectionId ?? "",+ model: config?.model ?? DEFAULT_MODEL[AppConnection.Anthropic]+ }+ });++ useEffect(() => {+ if (isOpen) {+ reset({+ aiInsightsEnabled: config?.aiInsightsEnabled ?? false,+ connectionId: config?.connectionId ?? "",+ model: config?.model ?? DEFAULT_MODEL[AppConnection.Anthropic]+ });+ }+ }, [isOpen, config, reset]);++ const aiInsightsEnabled = useWatch({ control, name: "aiInsightsEnabled" });+ const selectedConnectionId = useWatch({ control, name: "connectionId" });+ const selectedConnection = llmConnections.find((c) => c.id === selectedConnectionId);+ const selectedProvider = selectedConnection?.app as LlmAppConnection | undefined;+ const availableModels = selectedProvider ? LLM_MODELS[selectedProvider] : [];++ useEffect(() => {+ if (selectedProvider) {+ setValue("model", DEFAULT_MODEL[selectedProvider], { shouldDirty: true });+ }+ }, [selectedProvider, setValue]);++ const onSubmit = async (data: FormData) => {+ if (!data.aiInsightsEnabled) {+ await onSave({+ aiInsightsEnabled: false,+ connectionId: "",+ connectionName: "",+ model: ""+ });+ } else {+ await onSave({+ aiInsightsEnabled: true,+ connectionId: data.connectionId ?? "",+ connectionName: selectedConnection?.name ?? data.connectionId ?? "",+ model: data.model ?? DEFAULT_MODEL[AppConnection.Anthropic]+ });+ }+ onOpenChange(false);+ };++ return (+ <Sheet open={isOpen} onOpenChange={onOpenChange}>+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">+ <SheetHeader className="border-b">+ <SheetTitle>Edit Session Recording</SheetTitle>+ <SheetDescription>+ Configure session recording settings for this resource.+ </SheetDescription>+ </SheetHeader>++ <div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4">+ {/* AI Insights section */}+ <div className="flex flex-col gap-3">+ <div className="flex items-center justify-between">+ <div className="flex flex-col gap-1">+ <Label>AI Insights</Label>+ <p className="text-xs text-muted">+ Summarize session activity using an AI connection+ </p>+ </div>+ <Controller+ name="aiInsightsEnabled"+ control={control}+ render={({ field }) => (+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ variant="success"+ />+ )}+ />+ </div>++ {aiInsightsEnabled && (+ <div className="flex flex-col gap-3 rounded-md border border-border p-3">+ <Controller+ name="connectionId"+ control={control}+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>App Connection</FieldLabel>+ <FieldContent>+ <Select+ value={field.value}+ onValueChange={field.onChange}+ disabled={isPending || llmConnections.length === 0}+ >+ <SelectTrigger>+ <SelectValue+ placeholder={+ isPending+ ? "Loading connections..."+ : llmConnections.length === 0+ ? "No AI connections configured"+ : "Select a connection"+ }+ />+ </SelectTrigger>+ <SelectContent>+ {llmConnections.map((conn) => (+ <SelectItem key={conn.id} value={conn.id}>+ {conn.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FieldContent>+ {error && <FieldError>{error.message}</FieldError>}+ </Field>+ )}+ />++ <Controller+ name="model"+ control={control}+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel>Model</FieldLabel>+ <FieldContent>+ <Select+ value={field.value}+ onValueChange={field.onChange}+ disabled={!selectedProvider}+ >+ <SelectTrigger>+ <SelectValue+ placeholder={+ !selectedProvider ? "Select a connection first" : "Select a model"+ }+ />+ </SelectTrigger>+ <SelectContent>+ {availableModels.map((m) => (+ <SelectItem key={m.id} value={m.id}>+ {m.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FieldContent>+ {error && <FieldError>{error.message}</FieldError>}+ </Field>+ )}+ />+ </div>+ )}+ </div>+ </div>++ <SheetFooter className="shrink-0 border-t">+ <Button+ variant="neutral"+ onClick={handleSubmit(onSubmit)}+ isDisabled={isSubmitting || (aiInsightsEnabled && (llmConnections.length === 0 || !selectedProvider))}+ isLoading={isSubmitting}+ >+ Update Details+ </Button>+ <Button+ variant="outline"+ className="mr-auto"+ onClick={() => onOpenChange(false)}+ >+ Cancel+ </Button>+ {config && (+ <Button+ variant="danger"+ onClick={async () => {+ await onSave(null);+ onOpenChange(false);+ }}+ >+ Disable+ </Button>+ )}+ </SheetFooter>+ </SheetContent>+ </Sheet>+ );+};diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts b/frontend/src/pages/pam/PamResourceByIDPage/components/index.tsindex c240ad334e..bc0f833d2f 100644--- a/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts@@ -5,4 +5,7 @@ export { PamResourceDetailsSection } from "./PamResourceDetailsSection";export { PamResourceMetadataSection } from "./PamResourceMetadataSection";export { PamResourceRelatedResourcesSection } from "./PamResourceRelatedResourcesSection";export { PamResourceRotationPolicySection } from "./PamResourceRotationPolicySection";+export { PamResourceSessionRecordingSection } from "./PamResourceSessionRecordingSection";+export type { SessionRecordingConfig } from "./PamResourceSessionRecordingSection";export { PamRotationPolicyModal } from "./PamRotationPolicyModal";+export { PamSessionRecordingModal } from "./PamSessionRecordingModal";diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsxindex e9d2f9ebfa..11753a8baf 100644--- a/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx+++ b/frontend/src/pages/pam/PamSessionsByIDPage/PamSessionByIDPage.tsx@@ -1,3 +1,4 @@+import { useState } from "react";import { Helmet } from "react-helmet";import { faChevronLeft, faEllipsisV } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";@@ -21,6 +22,7 @@ import { PamSessionStatus, useGetPamSessionById } from "@app/hooks/api/pam";import { ProjectType } from "@app/hooks/api/projects/types";import { PamTerminateSessionModal } from "../components/PamTerminateSessionModal";+import { PamSessionAiInsightsSection } from "./components/PamSessionAiInsightsSection";import { PamSessionDetailsSection } from "./components/PamSessionDetailsSection";import { PamSessionLogsSection } from "./components/PamSessionLogsSection";@@ -29,10 +31,13 @@ const Page = () => {from: ROUTE_PATHS.Pam.PamSessionByIDPage.id,select: (el) => el.sessionId});- const { data: session } = useGetPamSessionById(sessionId);+ const { data: session } = useGetPamSessionById(sessionId, {+ refetchInterval: (query) => (query.state.data?.aiInsightsStatus === "pending" ? 3000 : false)+ });const { currentOrg } = useOrganization();const { currentProject } = useProject();const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["terminateSession"] as const);+ const [scrollToLogIndex, setScrollToLogIndex] = useState<number | undefined>();const isActive =session?.status === PamSessionStatus.Active || session?.status === PamSessionStatus.Starting;@@ -90,11 +95,12 @@ const Page = () => {)}</PageHeader><div className="flex">- <div className="mr-4 flex h-fit w-96">+ <div className="mr-4 flex h-fit w-96 shrink-0"><PamSessionDetailsSection session={session} /></div>- <div className="flex w-full min-w-0">- <PamSessionLogsSection session={session} />+ <div className="flex min-w-0 flex-1 flex-col gap-4">+ <PamSessionAiInsightsSection session={session} onWarningClick={setScrollToLogIndex} />+ <PamSessionLogsSection session={session} scrollToLogIndex={scrollToLogIndex} /></div></div>diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsxindex d70754ccf5..88fea46303 100644--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx@@ -1,4 +1,4 @@-import { useMemo, useState } from "react";+import { useEffect, useMemo, useState } from "react";import { faChevronRight, faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { twMerge } from "tailwind-merge";@@ -11,12 +11,24 @@ import { formatLogContent } from "./PamSessionLogsSection.utils";type Props = {logs: TPamCommandLog[];+ scrollToLogIndex?: number;};-export const CommandLogView = ({ logs }: Props) => {+export const CommandLogView = ({ logs, scrollToLogIndex }: Props) => {const [expandedLogTimestamps, setExpandedLogTimestamps] = useState<Set<string>>(new Set());const [search, setSearch] = useState("");+ useEffect(() => {+ if (scrollToLogIndex == null) return;+ const target = logs[scrollToLogIndex - 1];+ if (!target) return;+ setSearch("");+ setExpandedLogTimestamps(new Set([target.timestamp]));+ setTimeout(() => {+ document.getElementById(`log-${scrollToLogIndex}`)?.scrollIntoView({ behavior: "smooth", block: "center" });+ }, 50);+ }, [scrollToLogIndex, logs]);+const toggleExpand = (timestamp: string) => {setExpandedLogTimestamps((prev) => {if (prev.has(timestamp)) {@@ -53,14 +65,16 @@ export const CommandLogView = ({ logs }: Props) => {<div className="flex grow flex-col gap-2 overflow-y-auto text-xs">{filteredLogs.length > 0 ? (- filteredLogs.map((log, index) => {+ filteredLogs.map((log) => {+ const originalIndex = logs.indexOf(log) + 1;const isExpanded = search.length || expandedLogTimestamps.has(log.timestamp);const formattedInput = formatLogContent(log.input);- const logKey = `${log.timestamp}-${index}`;+ const logKey = `${log.timestamp}-${originalIndex}`;return (<buttontype="button"+ id={`log-${originalIndex}`}key={logKey}className={`flex w-full flex-col rounded-md border border-mineshaft-700 p-3 text-left focus:inset-ring-2 focus:inset-ring-mineshaft-400 focus:outline-hidden ${isExpanded ? "bg-mineshaft-700" : "bg-mineshaft-800 hover:bg-mineshaft-700"diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionAiInsightsSection.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionAiInsightsSection.tsxnew file mode 100644index 0000000000..20d1f29316--- /dev/null+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionAiInsightsSection.tsx@@ -0,0 +1,102 @@+import { AlertTriangleIcon, ClockIcon, CornerDownRightIcon, SparklesIcon, XCircleIcon } from "lucide-react";++import { Spinner } from "@app/components/v2";+import { PamSessionStatus, TPamSession } from "@app/hooks/api/pam";++type Props = {+ session: TPamSession;+ onWarningClick?: (logIndex: number) => void;+};++export const PamSessionAiInsightsSection = ({ session, onWarningClick }: Props) => {+ const { aiInsightsStatus, aiInsightsError, aiInsights } = session;++ const isEnded = session.status === PamSessionStatus.Ended || session.status === PamSessionStatus.Terminated;++ // Only show if:+ // 1. Session is ended AND has an aiInsightsStatus, OR+ // 2. Session has completed insights+ if (!isEnded && !aiInsightsStatus) return null;+ if (isEnded && !aiInsightsStatus) return null;++ return (+ <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">+ <div className="flex items-center gap-2 border-b border-mineshaft-400 pb-3">+ <SparklesIcon className="size-4 text-purple-400" />+ <h3 className="text-base font-medium text-mineshaft-100">AI Insights</h3>+ </div>++ <div className="pt-3">+ {aiInsightsStatus === "pending" && (+ <div className="flex items-center gap-2 text-sm text-mineshaft-300">+ <Spinner size="xs" />+ <span>Generating summary...</span>+ </div>+ )}++ {aiInsightsStatus === "failed" && (+ <div className="flex flex-col gap-2">+ <div className="flex items-center gap-2 text-red-400">+ <XCircleIcon className="size-4 shrink-0" />+ <span className="text-sm font-medium">Summarization failed</span>+ </div>+ {aiInsightsError && (+ <p className="text-xs text-mineshaft-400">{aiInsightsError}</p>+ )}+ </div>+ )}++ {aiInsightsStatus === "completed" && aiInsights && (+ <div className="flex flex-col gap-3">+ <p className="text-sm leading-relaxed text-mineshaft-200">{aiInsights.summary}</p>++ {aiInsights.warnings.length > 0 && (+ <div className="flex flex-col gap-2">+ <div className="flex items-center gap-1.5 text-amber-400">+ <AlertTriangleIcon className="size-3.5" />+ <span className="text-xs font-semibold uppercase tracking-wide">Warnings</span>+ </div>+ <ul className="flex list-disc flex-col gap-1 pl-4">+ {aiInsights.warnings.map((warning, i) => (+ // eslint-disable-next-line react/no-array-index-key+ <li key={i} className="text-xs text-amber-300">+ {warning.logIndex != null && onWarningClick ? (+ <button+ type="button"+ className="inline-flex items-center gap-1.5 text-left underline decoration-dotted underline-offset-2 hover:decoration-solid"+ onClick={() => onWarningClick(warning.logIndex!)}+ >+ {warning.text}+ <CornerDownRightIcon className="size-3 shrink-0 opacity-70" />+ </button>+ ) : (+ warning.text+ )}+ </li>+ ))}+ </ul>+ </div>+ )}++ {aiInsights.warnings.length === 0 && (+ <p className="text-xs text-mineshaft-500">No security concerns detected.</p>+ )}+ </div>+ )}++ {aiInsightsStatus === "completed" && !aiInsights && (+ <div className="flex items-center gap-2 text-sm text-mineshaft-400">+ <ClockIcon className="size-4" />+ <span>No summary available</span>+ </div>+ )}+ </div>++ <div className="mt-4 border-t border-mineshaft-600 pt-3">+ <p className="text-center text-xs italic text-mineshaft-400">+ Results are produced by a language model and may not be fully accurate.+ </p>+ </div>+ </div>+ );+};diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsxindex 159eb3b358..64ad9f8a0f 100644--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionLogsSection.tsx@@ -18,9 +18,10 @@ import { TerminalEventView } from "./TerminalEventView";type Props = {session: TPamSession;+ scrollToLogIndex?: number;};-export const PamSessionLogsSection = ({ session }: Props) => {+export const PamSessionLogsSection = ({ session, scrollToLogIndex }: Props) => {const isActive =session.status === PamSessionStatus.Active || session.status === PamSessionStatus.Starting;@@ -52,7 +53,7 @@ export const PamSessionLogsSection = ({ session }: Props) => {)}</div>- {isDatabaseSession && hasLogs && <CommandLogView logs={logs as TPamCommandLog[]} />}+ {isDatabaseSession && hasLogs && <CommandLogView logs={logs as TPamCommandLog[]} scrollToLogIndex={scrollToLogIndex} />}{isSSHSession && hasLogs && <TerminalEventView events={logs as TTerminalEvent[]} />}{isHttpSession && hasLogs && <HttpEventView events={logs as THttpEvent[]} />}{isAwsIamSession && (