Skip to content

Commit 349f0c3

Browse files
authored
chore(compass-assistant): add compass AI assistant with placeholders COMPASS-9603 (#7189)
1 parent e918c74 commit 349f0c3

27 files changed

+1489
-30
lines changed

package-lock.json

Lines changed: 469 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/atlas-service/src/atlas-service.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const ATLAS_CONFIG = {
1515
issuer: 'http://example.com/oauth2/default',
1616
},
1717
authPortalUrl: 'http://example.com/account/login',
18+
assistantApiBaseUrl: 'http://example.com/assistant',
1819
};
1920

2021
function getAtlasService(

packages/atlas-service/src/atlas-service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ export class AtlasService {
6767
cloudEndpoint(path?: string): string {
6868
return `${this.config.cloudBaseUrl}${normalizePath(path)}`;
6969
}
70+
assistantApiEndpoint(path?: string): string {
71+
return `${this.config.assistantApiBaseUrl}${normalizePath(path)}`;
72+
}
7073
regionalizedCloudEndpoint(
7174
_atlasMetadata: Pick<AtlasClusterMetadata, 'regionalBaseUrl'>,
7275
path?: string

packages/atlas-service/src/main.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ describe('CompassAuthServiceMain', function () {
5656
clientId: '1234abcd',
5757
},
5858
authPortalUrl: 'http://example.com',
59+
assistantApiBaseUrl: 'http://example.com/assistant',
5960
};
6061

6162
const fetch = CompassAuthService['fetch'];

packages/atlas-service/src/util.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ export type AtlasServiceConfig = {
116116
* Atlas Account Portal UI base url
117117
*/
118118
authPortalUrl: string;
119+
/**
120+
* Assistant API base url
121+
*/
122+
assistantApiBaseUrl: string;
119123
};
120124

121125
/**
@@ -139,6 +143,7 @@ const config = {
139143
issuer: 'https://auth-qa.mongodb.com/oauth2/default',
140144
},
141145
authPortalUrl: 'https://account-dev.mongodb.com/account/login',
146+
assistantApiBaseUrl: 'https://knowledge.staging.corp.mongodb.com/api/v1',
142147
},
143148
'atlas-dev': {
144149
wsBaseUrl: '',
@@ -149,6 +154,7 @@ const config = {
149154
issuer: 'https://auth-qa.mongodb.com/oauth2/default',
150155
},
151156
authPortalUrl: 'https://account-dev.mongodb.com/account/login',
157+
assistantApiBaseUrl: 'https://knowledge.staging.corp.mongodb.com/api/v1',
152158
},
153159
'atlas-qa': {
154160
wsBaseUrl: '',
@@ -159,6 +165,7 @@ const config = {
159165
issuer: 'https://auth-qa.mongodb.com/oauth2/default',
160166
},
161167
authPortalUrl: 'https://account-qa.mongodb.com/account/login',
168+
assistantApiBaseUrl: 'https://knowledge.staging.corp.mongodb.com/api/v1',
162169
},
163170
atlas: {
164171
wsBaseUrl: '',
@@ -169,6 +176,7 @@ const config = {
169176
issuer: 'https://auth.mongodb.com/oauth2/default',
170177
},
171178
authPortalUrl: 'https://account.mongodb.com/account/login',
179+
assistantApiBaseUrl: 'https://knowledge.staging.corp.mongodb.com/api/v1',
172180
},
173181
'web-sandbox-atlas-local': {
174182
wsBaseUrl: '/ccs',
@@ -179,6 +187,7 @@ const config = {
179187
issuer: 'https://auth-qa.mongodb.com/oauth2/default',
180188
},
181189
authPortalUrl: 'https://account-dev.mongodb.com/account/login',
190+
assistantApiBaseUrl: 'https://knowledge.staging.corp.mongodb.com/api/v1',
182191
},
183192
'web-sandbox-atlas-dev': {
184193
wsBaseUrl: '/ccs',
@@ -189,6 +198,7 @@ const config = {
189198
issuer: 'https://auth-qa.mongodb.com/oauth2/default',
190199
},
191200
authPortalUrl: 'https://account-dev.mongodb.com/account/login',
201+
assistantApiBaseUrl: 'https://knowledge.staging.corp.mongodb.com/api/v1',
192202
},
193203
'web-sandbox-atlas-qa': {
194204
wsBaseUrl: '/ccs',
@@ -199,6 +209,7 @@ const config = {
199209
issuer: 'https://auth-qa.mongodb.com/oauth2/default',
200210
},
201211
authPortalUrl: 'https://account-dev.mongodb.com/account/login',
212+
assistantApiBaseUrl: 'https://knowledge.staging.corp.mongodb.com/api/v1',
202213
},
203214
'web-sandbox-atlas': {
204215
wsBaseUrl: '/ccs',
@@ -209,6 +220,7 @@ const config = {
209220
issuer: 'https://auth.mongodb.com/oauth2/default',
210221
},
211222
authPortalUrl: 'https://account.mongodb.com/account/login',
223+
assistantApiBaseUrl: 'https://knowledge.staging.corp.mongodb.com/api/v1',
212224
},
213225
} as const;
214226

@@ -223,6 +235,7 @@ export function getAtlasConfig(
223235
issuer: process.env.COMPASS_OIDC_ISSUER_OVERRIDE,
224236
},
225237
authPortalUrl: process.env.COMPASS_ATLAS_AUTH_PORTAL_URL_OVERRIDE,
238+
assistantApiBaseUrl: process.env.COMPASS_ASSISTANT_BASE_URL_OVERRIDE,
226239
};
227240
return defaultsDeep(
228241
envConfig,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ignores:
2+
- '@mongodb-js/prettier-config-compass'
3+
- '@mongodb-js/tsconfig-compass'
4+
- '@types/chai'
5+
- '@types/sinon-chai'
6+
- 'sinon'
7+
- '@types/chai-dom'
8+
- '@types/react'
9+
- '@types/react-dom'
10+
ignore-patterns:
11+
- 'dist'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.nyc-output
2+
dist
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['@mongodb-js/eslint-config-compass/plugin'],
4+
parserOptions: {
5+
tsconfigRootDir: __dirname,
6+
project: ['./tsconfig-lint.json'],
7+
},
8+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@mongodb-js/mocha-config-compass/compass-plugin');
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"name": "@mongodb-js/compass-assistant",
3+
"description": "Compass plugin for the AI Assistant",
4+
"author": {
5+
"name": "MongoDB Inc",
6+
"email": "[email protected]"
7+
},
8+
"private": true,
9+
"bugs": {
10+
"url": "https://jira.mongodb.org/projects/COMPASS/issues",
11+
"email": "[email protected]"
12+
},
13+
"homepage": "https://github.com/mongodb-js/compass",
14+
"version": "1.0.0",
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/mongodb-js/compass.git"
18+
},
19+
"files": [
20+
"dist"
21+
],
22+
"license": "SSPL",
23+
"main": "dist/index.js",
24+
"compass:main": "src/index.tsx",
25+
"exports": {
26+
"import": "./dist/.esm-wrapper.mjs",
27+
"require": "./dist/index.js"
28+
},
29+
"compass:exports": {
30+
".": "./src/index.tsx"
31+
},
32+
"types": "./dist/index.d.ts",
33+
"scripts": {
34+
"bootstrap": "npm run compile",
35+
"compile": "tsc -p tsconfig.json",
36+
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
37+
"eslint": "eslint-compass",
38+
"prettier": "prettier-compass",
39+
"lint": "npm run eslint . && npm run prettier -- --check .",
40+
"depcheck": "compass-scripts check-peer-deps && depcheck",
41+
"check": "npm run typecheck && npm run lint && npm run depcheck",
42+
"check-ci": "npm run check",
43+
"test": "mocha",
44+
"test-electron": "xvfb-maybe electron-mocha --no-sandbox",
45+
"test-cov": "nyc --compact=false --produce-source-map=false -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",
46+
"test-watch": "npm run test -- --watch",
47+
"test-ci": "npm run test-cov",
48+
"test-ci-electron": "npm run test-electron",
49+
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
50+
},
51+
"dependencies": {
52+
"@ai-sdk/openai": "^2.0.4",
53+
"@mongodb-js/atlas-service": "^0.54.0",
54+
"@mongodb-js/compass-app-registry": "^9.4.18",
55+
"@mongodb-js/compass-components": "^1.30.5",
56+
"ai": "^5.0.5",
57+
"compass-preferences-model": "^2.49.0",
58+
"react": "^17.0.2",
59+
"throttleit": "^2.1.0",
60+
"use-sync-external-store": "^1.5.0"
61+
},
62+
"devDependencies": {
63+
"@mongodb-js/eslint-config-compass": "^1.4.5",
64+
"@mongodb-js/mocha-config-compass": "^1.7.0",
65+
"@mongodb-js/prettier-config-compass": "^1.2.8",
66+
"@mongodb-js/testing-library-compass": "^1.3.8",
67+
"@mongodb-js/tsconfig-compass": "^1.2.9",
68+
"@types/chai": "^4.2.21",
69+
"@types/chai-dom": "^0.0.10",
70+
"@types/mocha": "^9.0.0",
71+
"@types/react": "^17.0.5",
72+
"@types/react-dom": "^17.0.10",
73+
"@types/sinon-chai": "^3.2.5",
74+
"chai": "^4.3.6",
75+
"depcheck": "^1.4.1",
76+
"mocha": "^10.2.0",
77+
"nyc": "^15.1.0",
78+
"sinon": "^17.0.1",
79+
"typescript": "^5.8.3",
80+
"xvfb-maybe": "^0.2.1"
81+
},
82+
"is_compass_plugin": true
83+
}

0 commit comments

Comments
 (0)