@notebook-intelligence/notebook-intelligence 2.4.1 → 2.5.0

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/src/index.ts CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  import { IDocumentManager } from '@jupyterlab/docmanager';
10
10
  import { DocumentWidget, IDocumentWidget } from '@jupyterlab/docregistry';
11
11
 
12
- import { Dialog, ICommandPalette } from '@jupyterlab/apputils';
12
+ import { Dialog, ICommandPalette, MainAreaWidget } from '@jupyterlab/apputils';
13
13
  import { IMainMenu } from '@jupyterlab/mainmenu';
14
14
 
15
15
  import { IEditorLanguageRegistry } from '@jupyterlab/codemirror';
@@ -44,7 +44,6 @@ import { IStatusBar } from '@jupyterlab/statusbar';
44
44
 
45
45
  import {
46
46
  ChatSidebar,
47
- ConfigurationDialogBody,
48
47
  GitHubCopilotLoginDialogBody,
49
48
  GitHubCopilotStatusBarItem,
50
49
  InlinePromptWidget,
@@ -81,6 +80,7 @@ import {
81
80
  import { UUID } from '@lumino/coreutils';
82
81
 
83
82
  import * as path from 'path';
83
+ import { SettingsPanel } from './components/settings-panel';
84
84
 
85
85
  namespace CommandIDs {
86
86
  export const chatuserInput = 'notebook-intelligence:chat-user-input';
@@ -1229,31 +1229,36 @@ const plugin: JupyterFrontEndPlugin<INotebookIntelligence> = {
1229
1229
  }
1230
1230
  });
1231
1231
 
1232
+ const createNewSettingsWidget = () => {
1233
+ const settingsPanel = new SettingsPanel({
1234
+ onSave: () => {
1235
+ NBIAPI.fetchCapabilities();
1236
+ },
1237
+ onEditMCPConfigClicked: () => {
1238
+ app.commands.execute('notebook-intelligence:open-mcp-config-editor');
1239
+ }
1240
+ });
1241
+
1242
+ const widget = new MainAreaWidget({ content: settingsPanel });
1243
+ widget.id = 'nbi-settings';
1244
+ widget.title.label = 'NBI Settings';
1245
+ widget.title.closable = true;
1246
+
1247
+ return widget;
1248
+ };
1249
+
1250
+ let settingsWidget = createNewSettingsWidget();
1251
+
1232
1252
  app.commands.addCommand(CommandIDs.openConfigurationDialog, {
1233
1253
  label: 'Notebook Intelligence Settings',
1234
1254
  execute: args => {
1235
- let dialog: Dialog<unknown> | null = null;
1236
- const dialogBody = new ConfigurationDialogBody({
1237
- onSave: () => {
1238
- dialog?.dispose();
1239
- NBIAPI.fetchCapabilities();
1240
- },
1241
- onEditMCPConfigClicked: () => {
1242
- dialog?.dispose();
1243
- app.commands.execute(
1244
- 'notebook-intelligence:open-mcp-config-editor'
1245
- );
1246
- }
1247
- });
1248
- dialog = new Dialog({
1249
- title: 'Notebook Intelligence Settings',
1250
- hasClose: true,
1251
- body: dialogBody,
1252
- buttons: []
1253
- });
1254
- dialog.node.classList.add('config-dialog-container');
1255
-
1256
- dialog.launch();
1255
+ if (settingsWidget.isDisposed) {
1256
+ settingsWidget = createNewSettingsWidget();
1257
+ }
1258
+ if (!settingsWidget.isAttached) {
1259
+ app.shell.add(settingsWidget, 'main');
1260
+ }
1261
+ app.shell.activateById(settingsWidget.id);
1257
1262
  }
1258
1263
  });
1259
1264
 
package/src/tokens.ts CHANGED
@@ -32,7 +32,8 @@ export enum BackendMessageType {
32
32
  StreamMessage = 'stream-message',
33
33
  StreamEnd = 'stream-end',
34
34
  RunUICommand = 'run-ui-command',
35
- GitHubCopilotLoginStatusChange = 'github-copilot-login-status-change'
35
+ GitHubCopilotLoginStatusChange = 'github-copilot-login-status-change',
36
+ MCPServerStatusChange = 'mcp-server-status-change'
36
37
  }
37
38
 
38
39
  export enum ResponseStreamDataType {
@@ -52,6 +53,16 @@ export enum ContextType {
52
53
  CurrentFile = 'current-file'
53
54
  }
54
55
 
56
+ export enum MCPServerStatus {
57
+ NotConnected = 'not-connected',
58
+ Connecting = 'connecting',
59
+ Disconnecting = 'disconnecting',
60
+ FailedToConnect = 'failed-to-connect',
61
+ Connected = 'connected',
62
+ UpdatingToolList = 'updating-tool-list',
63
+ UpdatedToolList = 'updated-tool-list'
64
+ }
65
+
55
66
  export interface IContextItem {
56
67
  type: ContextType;
57
68
  content: string;
package/style/base.css CHANGED
@@ -355,7 +355,7 @@ pre:has(.code-block-header) {
355
355
  border: 1px solid var(--jp-border-color1);
356
356
  flex-direction: column;
357
357
  position: absolute;
358
- bottom: 98px;
358
+ bottom: 80px;
359
359
  left: 4px;
360
360
  gap: 2px;
361
361
  /* stylelint-disable */
@@ -602,7 +602,6 @@ body[data-jp-theme-light='false'] .inline-popover {
602
602
  display: flex;
603
603
  flex-direction: column;
604
604
  overflow-y: auto;
605
- padding: 10px 0;
606
605
  gap: 15px;
607
606
  }
608
607
 
@@ -829,3 +828,79 @@ svg.access-token-warning {
829
828
  text-overflow: ellipsis;
830
829
  white-space: nowrap;
831
830
  }
831
+
832
+ .nbi-settings-panel {
833
+ display: flex;
834
+ height: 100%;
835
+ }
836
+
837
+ .nbi-settings-panel-tabs {
838
+ display: flex;
839
+ flex-direction: column;
840
+ gap: 10px;
841
+ padding: 10px;
842
+ width: 150px;
843
+ background-color: var(--jp-layout-color2);
844
+ }
845
+
846
+ .nbi-settings-panel-tab {
847
+ cursor: pointer;
848
+ padding: 10px;
849
+ border-radius: 4px;
850
+ }
851
+
852
+ .nbi-settings-panel-tab:hover {
853
+ background-color: var(--jp-layout-color1);
854
+ }
855
+
856
+ .nbi-settings-panel-tab.active {
857
+ background-color: var(--jp-layout-color1);
858
+ font-weight: bold;
859
+ }
860
+
861
+ .nbi-settings-panel-tab-content {
862
+ flex-grow: 1;
863
+ padding: 20px;
864
+ }
865
+
866
+ .pill-item {
867
+ cursor: pointer;
868
+ background-color: var(--jp-layout-color1);
869
+ display: inline-block;
870
+ padding: 2px 6px;
871
+ margin: 2px 4px;
872
+ border-radius: 4px;
873
+ }
874
+
875
+ .pill-item:hover {
876
+ cursor: pointer;
877
+ background-color: var(--jp-layout-color2);
878
+ }
879
+
880
+ .pill-item.checked {
881
+ background-color: var(--jp-layout-color3);
882
+ }
883
+
884
+ .server-status-indicator {
885
+ width: 10px;
886
+ height: 10px;
887
+ margin: 2px;
888
+ border-radius: 50%;
889
+ background-color: var(--jp-brand-color0);
890
+ }
891
+
892
+ .server-status-indicator.connected,
893
+ .server-status-indicator.updated-tool-list {
894
+ background-color: var(--jp-success-color1);
895
+ }
896
+
897
+ .server-status-indicator.connecting,
898
+ .server-status-indicator.disconnecting,
899
+ .server-status-indicator.updating-tool-list {
900
+ background-color: var(--jp-warn-color1);
901
+ }
902
+
903
+ .server-status-indicator.not-connected,
904
+ .server-status-indicator.failed-to-connect {
905
+ background-color: var(--jp-error-color1);
906
+ }