@jupyter-ai/persona-manager 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, Project Jupyter
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,249 @@
1
+ # jupyter_ai_persona_manager
2
+
3
+ [![Github Actions Status](https://github.com/jupyter-ai-contrib/jupyter-ai-persona-manager/workflows/Build/badge.svg)](https://github.com/jupyter-ai-contrib/jupyter-ai-persona-manager/actions/workflows/build.yml)
4
+
5
+ The core manager & registry for AI personas in Jupyter AI.
6
+
7
+ This package provides the foundational infrastructure for managing AI personas in Jupyter AI chat environments. It includes:
8
+
9
+ - **BasePersona**: Abstract base class for creating custom AI personas
10
+ - **PersonaManager**: Registry and lifecycle management for personas
11
+ - **PersonaAwareness**: Awareness integration for multi-user chat environments
12
+ - **Entry Point Support**: Automatic discovery of personas via Python entry points
13
+
14
+ AI personas are analogous to "bots" in other chat applications, allowing different AI assistants to coexist in the same chat environment. Each persona can have unique behavior, models, and capabilities.
15
+
16
+ ## Adding a New Persona via Entry Points
17
+
18
+ To create and register a custom AI persona:
19
+
20
+ ### 1. Create Your Persona Class
21
+
22
+ ```python
23
+ from jupyter_ai_persona_manager import BasePersona, PersonaDefaults
24
+ from jupyterlab_chat.models import Message
25
+
26
+ class MyCustomPersona(BasePersona):
27
+ @property
28
+ def defaults(self):
29
+ return PersonaDefaults(
30
+ name="MyPersona",
31
+ description="A helpful custom assistant",
32
+ avatar_path="/api/ai/static/custom-avatar.svg",
33
+ system_prompt="You are a helpful assistant specialized in...",
34
+ )
35
+
36
+ async def process_message(self, message: Message):
37
+ # Your custom logic here
38
+ response = f"Hello! You said: {message.body}"
39
+ self.send_message(response)
40
+ ```
41
+
42
+ ### 2. Register via Entry Points
43
+
44
+ Add to your package's `pyproject.toml`:
45
+
46
+ ```toml
47
+ [project.entry-points."jupyter_ai.personas"]
48
+ my-custom-persona = "my_package.personas:MyCustomPersona"
49
+ ```
50
+
51
+ ### 3. Install and Restart
52
+
53
+ ```bash
54
+ pip install your-package
55
+ # Restart JupyterLab to load the new persona
56
+ ```
57
+
58
+ Your persona will automatically appear in Jupyter AI chats and can be @-mentioned by name.
59
+
60
+ ## Loading Personas from .jupyter Directory
61
+
62
+ For development and local customization, personas can be loaded from the `.jupyter/personas/` directory:
63
+
64
+ ### Directory Structure
65
+
66
+ ```
67
+ .jupyter/
68
+ └── personas/
69
+ ├── my_custom_persona.py
70
+ ├── research_assistant.py
71
+ └── debug_helper.py
72
+ ```
73
+
74
+ ### File Requirements
75
+
76
+ - Place Python files in `.jupyter/personas/` (not directly in `.jupyter/`)
77
+ - Filename must contain "persona" (case-insensitive)
78
+ - Cannot start with `_` or `.` (treated as private/hidden)
79
+ - Must contain a class inheriting from `BasePersona`
80
+
81
+ ### Example Local Persona
82
+
83
+ **File: `.jupyter/personas/my_persona.py`**
84
+
85
+ ```python
86
+ from jupyter_ai_persona_manager import BasePersona, PersonaDefaults
87
+ from jupyterlab_chat.models import Message
88
+
89
+ class MyLocalPersona(BasePersona):
90
+ @property
91
+ def defaults(self):
92
+ return PersonaDefaults(
93
+ name="Local Dev Assistant",
94
+ description="A persona for local development",
95
+ avatar_path="/api/ai/static/jupyternaut.svg",
96
+ system_prompt="You help with local development tasks.",
97
+ )
98
+
99
+ async def process_message(self, message: Message):
100
+ self.send_message(f"Local persona received: {message.body}")
101
+ ```
102
+
103
+ ### Refreshing Personas
104
+
105
+ Use the `/refresh-personas` slash command in any chat to reload personas without restarting JupyterLab:
106
+
107
+ ```
108
+ /refresh-personas
109
+ ```
110
+
111
+ This allows for iterative development - modify your local persona files and refresh to see changes immediately.
112
+
113
+ Development install:
114
+
115
+ ```
116
+ micromamba install uv jupyterlab nodejs=22
117
+ jlpm
118
+ jlpm dev:install
119
+ ```
120
+
121
+ ## Requirements
122
+
123
+ - JupyterLab >= 4.0.0
124
+
125
+ ## Install
126
+
127
+ To install the extension, execute:
128
+
129
+ ```bash
130
+ pip install jupyter_ai_persona_manager
131
+ ```
132
+
133
+ ## Uninstall
134
+
135
+ To remove the extension, execute:
136
+
137
+ ```bash
138
+ pip uninstall jupyter_ai_persona_manager
139
+ ```
140
+
141
+ ## Troubleshoot
142
+
143
+ If you are seeing the frontend extension, but it is not working, check
144
+ that the server extension is enabled:
145
+
146
+ ```bash
147
+ jupyter server extension list
148
+ ```
149
+
150
+ If the server extension is installed and enabled, but you are not seeing
151
+ the frontend extension, check the frontend extension is installed:
152
+
153
+ ```bash
154
+ jupyter labextension list
155
+ ```
156
+
157
+ ## Contributing
158
+
159
+ ### Development install
160
+
161
+ Note: You will need NodeJS to build the extension package.
162
+
163
+ The `jlpm` command is JupyterLab's pinned version of
164
+ [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
165
+ `yarn` or `npm` in lieu of `jlpm` below.
166
+
167
+ ```bash
168
+ # Clone the repo to your local environment
169
+ # Change directory to the jupyter_ai_persona_manager directory
170
+ # Install package in development mode
171
+ pip install -e ".[test]"
172
+ # Link your development version of the extension with JupyterLab
173
+ jupyter labextension develop . --overwrite
174
+ # Server extension must be manually installed in develop mode
175
+ jupyter server extension enable jupyter_ai_persona_manager
176
+ # Rebuild extension Typescript source after making changes
177
+ jlpm build
178
+ ```
179
+
180
+ You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
181
+
182
+ ```bash
183
+ # Watch the source directory in one terminal, automatically rebuilding when needed
184
+ jlpm watch
185
+ # Run JupyterLab in another terminal
186
+ jupyter lab
187
+ ```
188
+
189
+ With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
190
+
191
+ By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
192
+
193
+ ```bash
194
+ jupyter lab build --minimize=False
195
+ ```
196
+
197
+ ### Development uninstall
198
+
199
+ ```bash
200
+ # Server extension must be manually disabled in develop mode
201
+ jupyter server extension disable jupyter_ai_persona_manager
202
+ pip uninstall jupyter_ai_persona_manager
203
+ ```
204
+
205
+ In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
206
+ command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
207
+ folder is located. Then you can remove the symlink named `@jupyter-ai/persona-manager` within that folder.
208
+
209
+ ### Testing the extension
210
+
211
+ #### Server tests
212
+
213
+ This extension is using [Pytest](https://docs.pytest.org/) for Python code testing.
214
+
215
+ Install test dependencies (needed only once):
216
+
217
+ ```sh
218
+ pip install -e ".[test]"
219
+ # Each time you install the Python package, you need to restore the front-end extension link
220
+ jupyter labextension develop . --overwrite
221
+ ```
222
+
223
+ To execute them, run:
224
+
225
+ ```sh
226
+ pytest -vv -r ap --cov jupyter_ai_persona_manager
227
+ ```
228
+
229
+ #### Frontend tests
230
+
231
+ This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
232
+
233
+ To execute them, execute:
234
+
235
+ ```sh
236
+ jlpm
237
+ jlpm test
238
+ ```
239
+
240
+ #### Integration tests
241
+
242
+ This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
243
+ More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
244
+
245
+ More information are provided within the [ui-tests](./ui-tests/README.md) README.
246
+
247
+ ### Packaging the extension
248
+
249
+ See [RELEASE](RELEASE.md)
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Call the API extension
3
+ *
4
+ * @param endPoint API REST end point for the extension
5
+ * @param init Initial values for the request
6
+ * @returns The response body interpreted as JSON
7
+ */
8
+ export declare function requestAPI<T>(endPoint?: string, init?: RequestInit): Promise<T>;
package/lib/handler.js ADDED
@@ -0,0 +1,35 @@
1
+ import { URLExt } from '@jupyterlab/coreutils';
2
+ import { ServerConnection } from '@jupyterlab/services';
3
+ /**
4
+ * Call the API extension
5
+ *
6
+ * @param endPoint API REST end point for the extension
7
+ * @param init Initial values for the request
8
+ * @returns The response body interpreted as JSON
9
+ */
10
+ export async function requestAPI(endPoint = '', init = {}) {
11
+ // Make request to Jupyter API
12
+ const settings = ServerConnection.makeSettings();
13
+ const requestUrl = URLExt.join(settings.baseUrl, 'jupyter-ai-persona-manager', // API Namespace
14
+ endPoint);
15
+ let response;
16
+ try {
17
+ response = await ServerConnection.makeRequest(requestUrl, init, settings);
18
+ }
19
+ catch (error) {
20
+ throw new ServerConnection.NetworkError(error);
21
+ }
22
+ let data = await response.text();
23
+ if (data.length > 0) {
24
+ try {
25
+ data = JSON.parse(data);
26
+ }
27
+ catch (error) {
28
+ console.log('Not a JSON response body.', response);
29
+ }
30
+ }
31
+ if (!response.ok) {
32
+ throw new ServerConnection.ResponseError(response, data.message || data);
33
+ }
34
+ return data;
35
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
+ /**
3
+ * Initialization data for the @jupyter-ai/persona-manager extension.
4
+ */
5
+ declare const plugin: JupyterFrontEndPlugin<void>;
6
+ export default plugin;
package/lib/index.js ADDED
@@ -0,0 +1,20 @@
1
+ import { requestAPI } from './handler';
2
+ /**
3
+ * Initialization data for the @jupyter-ai/persona-manager extension.
4
+ */
5
+ const plugin = {
6
+ id: '@jupyter-ai/persona-manager:plugin',
7
+ description: 'The core manager & registry for AI personas in Jupyter AI',
8
+ autoStart: true,
9
+ activate: (app) => {
10
+ console.log('JupyterLab extension @jupyter-ai/persona-manager is activated!');
11
+ requestAPI('health')
12
+ .then(data => {
13
+ console.log(data);
14
+ })
15
+ .catch(reason => {
16
+ console.error(`The jupyter_ai_persona_manager server extension appears to be missing.\n${reason}`);
17
+ });
18
+ }
19
+ };
20
+ export default plugin;
package/package.json ADDED
@@ -0,0 +1,209 @@
1
+ {
2
+ "name": "@jupyter-ai/persona-manager",
3
+ "version": "0.0.2",
4
+ "description": "The core manager & registry for AI personas in Jupyter AI",
5
+ "keywords": [
6
+ "jupyter",
7
+ "jupyterlab",
8
+ "jupyterlab-extension"
9
+ ],
10
+ "homepage": "https://github.com/jupyter-ai-contrib/jupyter-ai-persona-manager",
11
+ "bugs": {
12
+ "url": "https://github.com/jupyter-ai-contrib/jupyter-ai-persona-manager/issues"
13
+ },
14
+ "license": "BSD-3-Clause",
15
+ "author": {
16
+ "name": "Project Jupyter",
17
+ "email": "jupyter@googlegroups.com"
18
+ },
19
+ "files": [
20
+ "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
21
+ "style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
22
+ "src/**/*.{ts,tsx}"
23
+ ],
24
+ "main": "lib/index.js",
25
+ "types": "lib/index.d.ts",
26
+ "style": "style/index.css",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/jupyter-ai-contrib/jupyter-ai-persona-manager.git"
30
+ },
31
+ "scripts": {
32
+ "build": "jlpm build:lib && jlpm build:labextension:dev",
33
+ "build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
34
+ "build:labextension": "jupyter labextension build .",
35
+ "build:labextension:dev": "jupyter labextension build --development True .",
36
+ "build:lib": "tsc --sourceMap",
37
+ "build:lib:prod": "tsc",
38
+ "clean": "jlpm clean:lib",
39
+ "clean:lib": "rimraf lib tsconfig.tsbuildinfo",
40
+ "clean:lintcache": "rimraf .eslintcache .stylelintcache",
41
+ "clean:labextension": "rimraf jupyter_ai_persona_manager/labextension jupyter_ai_persona_manager/_version.py",
42
+ "clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
43
+ "dev:install": "jlpm && jlpm build && uv pip install -e '.[test]' && jupyter labextension develop . --overwrite && jupyter server extension enable jupyter_ai_persona_manager",
44
+ "dev:uninstall": "jupyter server extension disable jupyter_ai_persona_manager && pip uninstall jupyter_ai_persona_manager -y",
45
+ "eslint": "jlpm eslint:check --fix",
46
+ "eslint:check": "eslint . --cache --ext .ts,.tsx",
47
+ "install:extension": "jlpm build",
48
+ "lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
49
+ "lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
50
+ "prettier": "jlpm prettier:base --write --list-different",
51
+ "prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
52
+ "prettier:check": "jlpm prettier:base --check",
53
+ "stylelint": "jlpm stylelint:check --fix",
54
+ "stylelint:check": "stylelint --cache \"style/**/*.css\"",
55
+ "test": "jest --coverage",
56
+ "watch": "run-p watch:src watch:labextension",
57
+ "watch:src": "tsc -w --sourceMap",
58
+ "watch:labextension": "jupyter labextension watch ."
59
+ },
60
+ "dependencies": {
61
+ "@jupyterlab/application": "^4.0.0",
62
+ "@jupyterlab/coreutils": "^6.0.0",
63
+ "@jupyterlab/services": "^7.0.0"
64
+ },
65
+ "devDependencies": {
66
+ "@jupyterlab/builder": "^4.0.0",
67
+ "@jupyterlab/testutils": "^4.0.0",
68
+ "@types/jest": "^29.2.0",
69
+ "@types/json-schema": "^7.0.11",
70
+ "@types/react": "^18.0.26",
71
+ "@types/react-addons-linked-state-mixin": "^0.14.22",
72
+ "@typescript-eslint/eslint-plugin": "^6.1.0",
73
+ "@typescript-eslint/parser": "^6.1.0",
74
+ "css-loader": "^6.7.1",
75
+ "eslint": "^8.36.0",
76
+ "eslint-config-prettier": "^8.8.0",
77
+ "eslint-plugin-prettier": "^5.0.0",
78
+ "jest": "^29.2.0",
79
+ "mkdirp": "^1.0.3",
80
+ "npm-run-all2": "^7.0.1",
81
+ "prettier": "^3.0.0",
82
+ "rimraf": "^5.0.1",
83
+ "source-map-loader": "^1.0.2",
84
+ "style-loader": "^3.3.1",
85
+ "stylelint": "^15.10.1",
86
+ "stylelint-config-recommended": "^13.0.0",
87
+ "stylelint-config-standard": "^34.0.0",
88
+ "stylelint-csstree-validator": "^3.0.0",
89
+ "stylelint-prettier": "^4.0.0",
90
+ "typescript": "~5.8.0",
91
+ "yjs": "^13.5.0"
92
+ },
93
+ "sideEffects": [
94
+ "style/*.css",
95
+ "style/index.js"
96
+ ],
97
+ "styleModule": "style/index.js",
98
+ "publishConfig": {
99
+ "access": "public"
100
+ },
101
+ "jupyterlab": {
102
+ "discovery": {
103
+ "server": {
104
+ "managers": [
105
+ "pip"
106
+ ],
107
+ "base": {
108
+ "name": "jupyter_ai_persona_manager"
109
+ }
110
+ }
111
+ },
112
+ "extension": true,
113
+ "outputDir": "jupyter_ai_persona_manager/labextension"
114
+ },
115
+ "eslintIgnore": [
116
+ "node_modules",
117
+ "dist",
118
+ "coverage",
119
+ "**/*.d.ts",
120
+ "tests",
121
+ "**/__tests__",
122
+ "ui-tests"
123
+ ],
124
+ "eslintConfig": {
125
+ "extends": [
126
+ "eslint:recommended",
127
+ "plugin:@typescript-eslint/eslint-recommended",
128
+ "plugin:@typescript-eslint/recommended",
129
+ "plugin:prettier/recommended"
130
+ ],
131
+ "parser": "@typescript-eslint/parser",
132
+ "parserOptions": {
133
+ "project": "tsconfig.json",
134
+ "sourceType": "module"
135
+ },
136
+ "plugins": [
137
+ "@typescript-eslint"
138
+ ],
139
+ "rules": {
140
+ "@typescript-eslint/naming-convention": [
141
+ "error",
142
+ {
143
+ "selector": "interface",
144
+ "format": [
145
+ "PascalCase"
146
+ ],
147
+ "custom": {
148
+ "regex": "^I[A-Z]",
149
+ "match": true
150
+ }
151
+ }
152
+ ],
153
+ "@typescript-eslint/no-unused-vars": [
154
+ "warn",
155
+ {
156
+ "args": "none"
157
+ }
158
+ ],
159
+ "@typescript-eslint/no-explicit-any": "off",
160
+ "@typescript-eslint/no-namespace": "off",
161
+ "@typescript-eslint/no-use-before-define": "off",
162
+ "@typescript-eslint/quotes": [
163
+ "error",
164
+ "single",
165
+ {
166
+ "avoidEscape": true,
167
+ "allowTemplateLiterals": false
168
+ }
169
+ ],
170
+ "curly": [
171
+ "error",
172
+ "all"
173
+ ],
174
+ "eqeqeq": "error",
175
+ "prefer-arrow-callback": "error"
176
+ }
177
+ },
178
+ "prettier": {
179
+ "singleQuote": true,
180
+ "trailingComma": "none",
181
+ "arrowParens": "avoid",
182
+ "endOfLine": "auto",
183
+ "overrides": [
184
+ {
185
+ "files": "package.json",
186
+ "options": {
187
+ "tabWidth": 4
188
+ }
189
+ }
190
+ ]
191
+ },
192
+ "stylelint": {
193
+ "extends": [
194
+ "stylelint-config-recommended",
195
+ "stylelint-config-standard",
196
+ "stylelint-prettier/recommended"
197
+ ],
198
+ "plugins": [
199
+ "stylelint-csstree-validator"
200
+ ],
201
+ "rules": {
202
+ "csstree/validator": true,
203
+ "property-no-vendor-prefix": null,
204
+ "selector-class-pattern": "^([a-z][A-z\\d]*)(-[A-z\\d]+)*$",
205
+ "selector-no-vendor-prefix": null,
206
+ "value-no-vendor-prefix": null
207
+ }
208
+ }
209
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Example of [Jest](https://jestjs.io/docs/getting-started) unit tests
3
+ */
4
+
5
+ describe('@jupyter-ai/persona-manager', () => {
6
+ it('should be tested', () => {
7
+ expect(1 + 1).toEqual(2);
8
+ });
9
+ });
package/src/handler.ts ADDED
@@ -0,0 +1,46 @@
1
+ import { URLExt } from '@jupyterlab/coreutils';
2
+
3
+ import { ServerConnection } from '@jupyterlab/services';
4
+
5
+ /**
6
+ * Call the API extension
7
+ *
8
+ * @param endPoint API REST end point for the extension
9
+ * @param init Initial values for the request
10
+ * @returns The response body interpreted as JSON
11
+ */
12
+ export async function requestAPI<T>(
13
+ endPoint = '',
14
+ init: RequestInit = {}
15
+ ): Promise<T> {
16
+ // Make request to Jupyter API
17
+ const settings = ServerConnection.makeSettings();
18
+ const requestUrl = URLExt.join(
19
+ settings.baseUrl,
20
+ 'jupyter-ai-persona-manager', // API Namespace
21
+ endPoint
22
+ );
23
+
24
+ let response: Response;
25
+ try {
26
+ response = await ServerConnection.makeRequest(requestUrl, init, settings);
27
+ } catch (error) {
28
+ throw new ServerConnection.NetworkError(error as any);
29
+ }
30
+
31
+ let data: any = await response.text();
32
+
33
+ if (data.length > 0) {
34
+ try {
35
+ data = JSON.parse(data);
36
+ } catch (error) {
37
+ console.log('Not a JSON response body.', response);
38
+ }
39
+ }
40
+
41
+ if (!response.ok) {
42
+ throw new ServerConnection.ResponseError(response, data.message || data);
43
+ }
44
+
45
+ return data;
46
+ }
package/src/index.ts ADDED
@@ -0,0 +1,32 @@
1
+ import {
2
+ JupyterFrontEnd,
3
+ JupyterFrontEndPlugin
4
+ } from '@jupyterlab/application';
5
+
6
+ import { requestAPI } from './handler';
7
+
8
+ /**
9
+ * Initialization data for the @jupyter-ai/persona-manager extension.
10
+ */
11
+ const plugin: JupyterFrontEndPlugin<void> = {
12
+ id: '@jupyter-ai/persona-manager:plugin',
13
+ description: 'The core manager & registry for AI personas in Jupyter AI',
14
+ autoStart: true,
15
+ activate: (app: JupyterFrontEnd) => {
16
+ console.log(
17
+ 'JupyterLab extension @jupyter-ai/persona-manager is activated!'
18
+ );
19
+
20
+ requestAPI<any>('health')
21
+ .then(data => {
22
+ console.log(data);
23
+ })
24
+ .catch(reason => {
25
+ console.error(
26
+ `The jupyter_ai_persona_manager server extension appears to be missing.\n${reason}`
27
+ );
28
+ });
29
+ }
30
+ };
31
+
32
+ export default plugin;
package/style/base.css ADDED
@@ -0,0 +1,5 @@
1
+ /*
2
+ See the JupyterLab Developer Guide for useful CSS Patterns:
3
+
4
+ https://jupyterlab.readthedocs.io/en/stable/developer/css.html
5
+ */
@@ -0,0 +1 @@
1
+ @import url('base.css');
package/style/index.js ADDED
@@ -0,0 +1 @@
1
+ import './base.css';