@jupyterlite/ai 0.17.0 → 0.19.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.
Files changed (114) hide show
  1. package/lib/chat-commands/clear.d.ts +1 -0
  2. package/lib/chat-commands/index.d.ts +1 -0
  3. package/lib/chat-commands/skills.d.ts +2 -1
  4. package/lib/chat-model-handler.d.ts +4 -3
  5. package/lib/chat-model-handler.js +2 -1
  6. package/lib/chat-model.d.ts +148 -8
  7. package/lib/chat-model.js +368 -79
  8. package/lib/completion/completion-provider.d.ts +3 -1
  9. package/lib/completion/completion-provider.js +1 -2
  10. package/lib/completion/index.d.ts +1 -0
  11. package/lib/components/clear-button.d.ts +1 -0
  12. package/lib/components/clear-button.js +3 -4
  13. package/lib/components/completion-status.d.ts +1 -0
  14. package/lib/components/completion-status.js +5 -4
  15. package/lib/components/index.d.ts +1 -0
  16. package/lib/components/model-select.d.ts +1 -0
  17. package/lib/components/model-select.js +62 -67
  18. package/lib/components/save-button.d.ts +3 -2
  19. package/lib/components/save-button.js +4 -5
  20. package/lib/components/stop-button.d.ts +1 -0
  21. package/lib/components/stop-button.js +3 -4
  22. package/lib/components/tool-select.d.ts +3 -1
  23. package/lib/components/tool-select.js +47 -60
  24. package/lib/components/usage-display.d.ts +4 -2
  25. package/lib/components/usage-display.js +50 -61
  26. package/lib/diff-manager.d.ts +3 -1
  27. package/lib/index.d.ts +3 -2
  28. package/lib/index.js +50 -59
  29. package/lib/models/settings-model.d.ts +3 -1
  30. package/lib/models/settings-model.js +1 -0
  31. package/lib/rendered-message-outputarea.d.ts +1 -0
  32. package/lib/tokens.d.ts +48 -597
  33. package/lib/tokens.js +2 -31
  34. package/lib/widgets/ai-settings.d.ts +3 -1
  35. package/lib/widgets/ai-settings.js +185 -344
  36. package/lib/widgets/main-area-chat.d.ts +3 -3
  37. package/lib/widgets/main-area-chat.js +2 -4
  38. package/lib/widgets/provider-config-dialog.d.ts +2 -1
  39. package/lib/widgets/provider-config-dialog.js +102 -167
  40. package/package.json +111 -258
  41. package/schema/settings-model.json +6 -0
  42. package/src/chat-commands/skills.ts +2 -2
  43. package/src/chat-model-handler.ts +10 -6
  44. package/src/chat-model.ts +488 -96
  45. package/src/completion/completion-provider.ts +6 -6
  46. package/src/components/clear-button.tsx +0 -2
  47. package/src/components/completion-status.tsx +2 -2
  48. package/src/components/model-select.tsx +1 -1
  49. package/src/components/save-button.tsx +3 -3
  50. package/src/components/stop-button.tsx +0 -2
  51. package/src/components/tool-select.tsx +10 -9
  52. package/src/components/usage-display.tsx +4 -2
  53. package/src/diff-manager.ts +4 -3
  54. package/src/index.ts +103 -107
  55. package/src/models/settings-model.ts +7 -6
  56. package/src/tokens.ts +54 -744
  57. package/src/widgets/ai-settings.tsx +40 -11
  58. package/src/widgets/main-area-chat.ts +5 -8
  59. package/src/widgets/provider-config-dialog.tsx +8 -8
  60. package/LICENSE +0 -30
  61. package/README.md +0 -49
  62. package/lib/agent.d.ts +0 -277
  63. package/lib/agent.js +0 -1116
  64. package/lib/icons.d.ts +0 -3
  65. package/lib/icons.js +0 -8
  66. package/lib/providers/built-in-providers.d.ts +0 -21
  67. package/lib/providers/built-in-providers.js +0 -233
  68. package/lib/providers/generated-context-windows.d.ts +0 -8
  69. package/lib/providers/generated-context-windows.js +0 -96
  70. package/lib/providers/model-info.d.ts +0 -3
  71. package/lib/providers/model-info.js +0 -58
  72. package/lib/providers/models.d.ts +0 -37
  73. package/lib/providers/models.js +0 -28
  74. package/lib/providers/provider-registry.d.ts +0 -49
  75. package/lib/providers/provider-registry.js +0 -72
  76. package/lib/providers/provider-tools.d.ts +0 -36
  77. package/lib/providers/provider-tools.js +0 -93
  78. package/lib/skills/index.d.ts +0 -4
  79. package/lib/skills/index.js +0 -7
  80. package/lib/skills/parse-skill.d.ts +0 -25
  81. package/lib/skills/parse-skill.js +0 -69
  82. package/lib/skills/skill-loader.d.ts +0 -25
  83. package/lib/skills/skill-loader.js +0 -133
  84. package/lib/skills/skill-registry.d.ts +0 -31
  85. package/lib/skills/skill-registry.js +0 -100
  86. package/lib/skills/types.d.ts +0 -29
  87. package/lib/skills/types.js +0 -5
  88. package/lib/tools/commands.d.ts +0 -11
  89. package/lib/tools/commands.js +0 -154
  90. package/lib/tools/skills.d.ts +0 -9
  91. package/lib/tools/skills.js +0 -73
  92. package/lib/tools/tool-registry.d.ts +0 -35
  93. package/lib/tools/tool-registry.js +0 -55
  94. package/lib/tools/web.d.ts +0 -8
  95. package/lib/tools/web.js +0 -196
  96. package/src/agent.ts +0 -1441
  97. package/src/icons.ts +0 -11
  98. package/src/providers/built-in-providers.ts +0 -241
  99. package/src/providers/generated-context-windows.ts +0 -102
  100. package/src/providers/model-info.ts +0 -88
  101. package/src/providers/models.ts +0 -76
  102. package/src/providers/provider-registry.ts +0 -88
  103. package/src/providers/provider-tools.ts +0 -179
  104. package/src/skills/index.ts +0 -14
  105. package/src/skills/parse-skill.ts +0 -91
  106. package/src/skills/skill-loader.ts +0 -175
  107. package/src/skills/skill-registry.ts +0 -137
  108. package/src/skills/types.ts +0 -37
  109. package/src/tools/commands.ts +0 -210
  110. package/src/tools/skills.ts +0 -84
  111. package/src/tools/tool-registry.ts +0 -63
  112. package/src/tools/web.ts +0 -238
  113. package/src/types.d.ts +0 -4
  114. package/style/icons/jupyternaut-lite.svg +0 -7
@@ -1,6 +1,7 @@
1
+ import { IProviderRegistry } from '@jupyternaut/agent';
1
2
  import { CompletionHandler, IInlineCompletionContext, IInlineCompletionList, IInlineCompletionProvider } from '@jupyterlab/completer';
2
3
  import { ISecretsManager } from 'jupyter-secrets-manager';
3
- import { type IAISettingsModel, type IProviderRegistry } from '../tokens';
4
+ import type { IAISettingsModel } from '../tokens';
4
5
  /**
5
6
  * Configuration interface for provider-specific completion behavior
6
7
  */
@@ -82,3 +83,4 @@ export declare namespace AICompletionProvider {
82
83
  token: symbol | null;
83
84
  }
84
85
  }
86
+ //# sourceMappingURL=completion-provider.d.ts.map
@@ -1,7 +1,6 @@
1
+ import { createCompletionModel, SECRETS_NAMESPACE } from '@jupyternaut/agent';
1
2
  import { NotebookPanel } from '@jupyterlab/notebook';
2
3
  import { generateText } from 'ai';
3
- import { createCompletionModel } from '../providers/models';
4
- import { SECRETS_NAMESPACE } from '../tokens';
5
4
  /**
6
5
  * Default temperature for code completion (lower than chat for more deterministic results)
7
6
  */
@@ -1 +1,2 @@
1
1
  export * from './completion-provider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -21,3 +21,4 @@ export declare function ClearButton(props: IClearButtonProps): JSX.Element;
21
21
  * Factory returning the clear button toolbar item.
22
22
  */
23
23
  export declare function clearItem(translator: TranslationBundle): InputToolbarRegistry.IToolbarItem;
24
+ //# sourceMappingURL=clear-button.d.ts.map
@@ -1,18 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { TooltippedButton } from '@jupyter/chat';
2
3
  import ClearIcon from '@mui/icons-material/Clear';
3
- import React from 'react';
4
4
  /**
5
5
  * The clear button component.
6
6
  */
7
7
  export function ClearButton(props) {
8
8
  const { translator: trans } = props;
9
9
  const tooltip = trans.__('Clear chat');
10
- return (React.createElement(TooltippedButton, { onClick: props.clearMessages, tooltip: tooltip, buttonProps: {
10
+ return (_jsx(TooltippedButton, { onClick: props.clearMessages, tooltip: tooltip, buttonProps: {
11
11
  title: tooltip,
12
12
  variant: 'outlined',
13
13
  color: 'secondary'
14
- } },
15
- React.createElement(ClearIcon, null)));
14
+ }, children: _jsx(ClearIcon, {}) }));
16
15
  }
17
16
  /**
18
17
  * Factory returning the clear button toolbar item.
@@ -23,3 +23,4 @@ export declare class CompletionStatusWidget extends ReactWidget {
23
23
  private _props;
24
24
  }
25
25
  export {};
26
+ //# sourceMappingURL=completion-status.d.ts.map
@@ -1,6 +1,7 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
2
3
  import { ReactWidget } from '@jupyterlab/ui-components';
3
- import { jupyternautIcon } from '../icons';
4
+ import { jupyternautIcon } from '@jupyternaut/agent';
4
5
  const COMPLETION_STATUS_CLASS = 'jp-ai-completion-status';
5
6
  const COMPLETION_DISABLED_CLASS = 'jp-ai-completion-disabled';
6
7
  /**
@@ -34,7 +35,7 @@ function CompletionStatus(props) {
34
35
  props.settingsModel.stateChanged.disconnect(stateChanged);
35
36
  };
36
37
  }, [props.settingsModel, trans]);
37
- return (React.createElement(jupyternautIcon.react, { className: disabled ? COMPLETION_DISABLED_CLASS : '', top: '2px', width: '16px', stylesheet: 'statusBar', title: title }));
38
+ return (_jsx(jupyternautIcon.react, { className: disabled ? COMPLETION_DISABLED_CLASS : '', top: '2px', width: '16px', stylesheet: 'statusBar', title: title }));
38
39
  }
39
40
  /**
40
41
  * The completion status widget that will be added to the status bar.
@@ -46,7 +47,7 @@ export class CompletionStatusWidget extends ReactWidget {
46
47
  this._props = options;
47
48
  }
48
49
  render() {
49
- return React.createElement(CompletionStatus, { ...this._props });
50
+ return _jsx(CompletionStatus, { ...this._props });
50
51
  }
51
52
  _props;
52
53
  }
@@ -4,3 +4,4 @@ export * from './model-select';
4
4
  export * from './stop-button';
5
5
  export * from './usage-display';
6
6
  export * from './tool-select';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -22,3 +22,4 @@ export declare function ModelSelect(props: IModelSelectProps): JSX.Element;
22
22
  * Factory function returning the toolbar item for model selection.
23
23
  */
24
24
  export declare function createModelSelectItem(settingsModel: IAISettingsModel, translator: TranslationBundle): InputToolbarRegistry.IToolbarItem;
25
+ //# sourceMappingURL=model-select.d.ts.map
@@ -1,7 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
2
  import { TooltippedButton } from '@jupyter/chat';
2
3
  import CheckIcon from '@mui/icons-material/Check';
3
4
  import { Menu, MenuItem, Typography } from '@mui/material';
4
- import React, { useCallback, useEffect, useState } from 'react';
5
+ import { useCallback, useEffect, useState } from 'react';
5
6
  /**
6
7
  * The model select component for choosing AI models.
7
8
  */
@@ -60,7 +61,7 @@ export function ModelSelect(props) {
60
61
  }));
61
62
  // Show a message if no providers are configured
62
63
  if (availableModels.length === 0) {
63
- return (React.createElement(TooltippedButton, { onClick: () => { }, tooltip: trans.__('No providers configured. Please go to AI Settings to add a provider.'), buttonProps: {
64
+ return (_jsx(TooltippedButton, { onClick: () => { }, tooltip: trans.__('No providers configured. Please go to AI Settings to add a provider.'), buttonProps: {
64
65
  variant: 'outlined',
65
66
  color: 'warning',
66
67
  disabled: true,
@@ -70,72 +71,66 @@ export function ModelSelect(props) {
70
71
  width: 'unset',
71
72
  display: 'flex',
72
73
  alignItems: 'center'
73
- } },
74
- React.createElement(Typography, { variant: "caption", sx: { fontSize: '0.7rem', fontWeight: 500 } }, trans.__('No Providers'))));
74
+ }, children: _jsx(Typography, { variant: "caption", sx: { fontSize: '0.7rem', fontWeight: 500 }, children: trans.__('No Providers') }) }));
75
75
  }
76
- return (React.createElement(React.Fragment, null,
77
- React.createElement(TooltippedButton, { onClick: e => {
78
- openMenu(e.currentTarget);
79
- }, tooltip: trans.__('Current Model: %1 - %2', currentProviderLabel, currentModel), buttonProps: {
80
- title: trans.__('Select AI Model'),
81
- onKeyDown: e => {
82
- if (e.key !== 'Enter' && e.key !== ' ') {
83
- return;
84
- }
76
+ return (_jsxs(_Fragment, { children: [_jsx(TooltippedButton, { onClick: e => {
85
77
  openMenu(e.currentTarget);
86
- // Stop propagation to prevent sending message
87
- e.stopPropagation();
88
- }
89
- }, sx: {
90
- minWidth: 'auto',
91
- width: 'unset',
92
- display: 'flex',
93
- alignItems: 'center'
94
- } },
95
- React.createElement(Typography, { variant: "caption", sx: { fontSize: '0.7rem', fontWeight: 500, textTransform: 'none' } }, currentProviderLabel)),
96
- React.createElement(Menu, { open: menuOpen, onClose: closeMenu, anchorEl: menuAnchorEl, anchorOrigin: {
97
- vertical: 'top',
98
- horizontal: 'right'
99
- }, transformOrigin: {
100
- vertical: 'bottom',
101
- horizontal: 'right'
102
- }, sx: {
103
- '& .MuiPaper-root': {
104
- maxHeight: '300px',
105
- overflowY: 'auto'
106
- },
107
- '& .MuiMenuItem-root': {
108
- padding: '0.5em',
109
- paddingRight: '2em',
110
- minWidth: '200px'
111
- }
112
- } }, availableModels.map(({ provider, providerLabel, isSelected }) => (React.createElement(MenuItem, { key: provider, onClick: async (e) => {
113
- await selectModel(provider);
114
- // Prevent sending message on model selection
115
- e.stopPropagation();
116
- }, sx: {
117
- backgroundColor: isSelected
118
- ? 'var(--mui-palette-primary-main)'
119
- : 'transparent',
120
- '&:hover': {
121
- backgroundColor: isSelected
122
- ? 'var(--mui-palette-primary-main)'
123
- : 'var(--jp-layout-color1)'
124
- },
125
- display: 'flex',
126
- alignItems: 'center',
127
- gap: '8px'
128
- } },
129
- isSelected ? (React.createElement(CheckIcon, { sx: {
130
- color: 'var(--jp-ui-inverse-font-color1)',
131
- fontSize: 16
132
- } })) : (React.createElement("div", { style: { width: '16px' } })),
133
- React.createElement(Typography, { variant: "body2", component: "div", sx: {
134
- fontWeight: isSelected ? 600 : 400,
135
- color: isSelected
136
- ? 'var(--jp-ui-inverse-font-color1)'
137
- : 'inherit'
138
- } }, providerLabel)))))));
78
+ }, tooltip: trans.__('Current Model: %1 - %2', currentProviderLabel, currentModel), buttonProps: {
79
+ title: trans.__('Select AI Model'),
80
+ onKeyDown: e => {
81
+ if (e.key !== 'Enter' && e.key !== ' ') {
82
+ return;
83
+ }
84
+ openMenu(e.currentTarget);
85
+ // Stop propagation to prevent sending message
86
+ e.stopPropagation();
87
+ }
88
+ }, sx: {
89
+ minWidth: 'auto',
90
+ width: 'unset',
91
+ display: 'flex',
92
+ alignItems: 'center'
93
+ }, children: _jsx(Typography, { variant: "caption", sx: { fontSize: '0.7rem', fontWeight: 500, textTransform: 'none' }, children: currentProviderLabel }) }), _jsx(Menu, { open: menuOpen, onClose: closeMenu, anchorEl: menuAnchorEl, anchorOrigin: {
94
+ vertical: 'top',
95
+ horizontal: 'right'
96
+ }, transformOrigin: {
97
+ vertical: 'bottom',
98
+ horizontal: 'right'
99
+ }, sx: {
100
+ '& .MuiPaper-root': {
101
+ maxHeight: '300px',
102
+ overflowY: 'auto'
103
+ },
104
+ '& .MuiMenuItem-root': {
105
+ padding: '0.5em',
106
+ paddingRight: '2em',
107
+ minWidth: '200px'
108
+ }
109
+ }, children: availableModels.map(({ provider, providerLabel, isSelected }) => (_jsxs(MenuItem, { onClick: async (e) => {
110
+ await selectModel(provider);
111
+ // Prevent sending message on model selection
112
+ e.stopPropagation();
113
+ }, sx: {
114
+ backgroundColor: isSelected
115
+ ? 'var(--mui-palette-primary-main)'
116
+ : 'transparent',
117
+ '&:hover': {
118
+ backgroundColor: isSelected
119
+ ? 'var(--mui-palette-primary-main)'
120
+ : 'var(--jp-layout-color1)'
121
+ },
122
+ display: 'flex',
123
+ alignItems: 'center',
124
+ gap: '8px'
125
+ }, children: [isSelected ? (_jsx(CheckIcon, { sx: {
126
+ color: 'var(--jp-ui-inverse-font-color1)',
127
+ fontSize: 16
128
+ } })) : (_jsx("div", { style: { width: '16px' } })), _jsx(Typography, { variant: "body2", component: "div", sx: {
129
+ fontWeight: isSelected ? 600 : 400,
130
+ color: isSelected
131
+ ? 'var(--jp-ui-inverse-font-color1)'
132
+ : 'inherit'
133
+ }, children: providerLabel })] }, provider))) })] }));
139
134
  }
140
135
  /**
141
136
  * Factory function returning the toolbar item for model selection.
@@ -152,7 +147,7 @@ export function createModelSelectItem(settingsModel, translator) {
152
147
  settingsModel,
153
148
  translator
154
149
  };
155
- return React.createElement(ModelSelect, { ...modelSelectProps });
150
+ return _jsx(ModelSelect, { ...modelSelectProps });
156
151
  },
157
152
  position: 0.5
158
153
  };
@@ -1,7 +1,7 @@
1
1
  import { ReactWidget } from '@jupyterlab/ui-components';
2
2
  import type { TranslationBundle } from '@jupyterlab/translation';
3
3
  import React from 'react';
4
- import { AIChatModel } from '../chat-model';
4
+ import { IAIChatModel } from '../tokens';
5
5
  /**
6
6
  * Properties for the SaveButton component.
7
7
  */
@@ -9,7 +9,7 @@ export interface ISaveButtonProps {
9
9
  /**
10
10
  * The chat model, used to listen for message changes for auto-save.
11
11
  */
12
- model: AIChatModel;
12
+ model: IAIChatModel;
13
13
  /**
14
14
  * The application language translator.
15
15
  */
@@ -29,3 +29,4 @@ export declare class SaveComponentWidget extends ReactWidget {
29
29
  protected render(): React.ReactElement;
30
30
  private _options;
31
31
  }
32
+ //# sourceMappingURL=save-button.d.ts.map
@@ -1,5 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import { historyIcon, ReactWidget, saveIcon, ToolbarButtonComponent } from '@jupyterlab/ui-components';
2
- import React, { useEffect, useState } from 'react';
3
+ import { useEffect, useState } from 'react';
3
4
  const COMPONENT_CLASS = 'jp-ai-SaveButton';
4
5
  const AUTOSAVE_BUTTON_CLASS = 'jp-ai-AutoSaveButton';
5
6
  /**
@@ -22,9 +23,7 @@ export function SaveComponent(props) {
22
23
  model.autosaveChanged.disconnect(updateAutosave);
23
24
  };
24
25
  }, [model]);
25
- return (React.createElement("div", { className: `${COMPONENT_CLASS}${autosave ? ' lm-mod-toggled' : ''}` },
26
- React.createElement(ToolbarButtonComponent, { icon: saveIcon, onClick: () => model.save(), tooltip: trans.__('Save chat') }),
27
- React.createElement(ToolbarButtonComponent, { className: AUTOSAVE_BUTTON_CLASS, icon: historyIcon, onClick: () => (model.autosave = !model.autosave), tooltip: trans.__('Auto-save') })));
26
+ return (_jsxs("div", { className: `${COMPONENT_CLASS}${autosave ? ' lm-mod-toggled' : ''}`, children: [_jsx(ToolbarButtonComponent, { icon: saveIcon, onClick: () => model.save(), tooltip: trans.__('Save chat') }), _jsx(ToolbarButtonComponent, { className: AUTOSAVE_BUTTON_CLASS, icon: historyIcon, onClick: () => (model.autosave = !model.autosave), tooltip: trans.__('Auto-save') })] }));
28
27
  }
29
28
  /**
30
29
  * A Lumino widget wrapping the SaveButton React component.
@@ -35,7 +34,7 @@ export class SaveComponentWidget extends ReactWidget {
35
34
  this._options = options;
36
35
  }
37
36
  render() {
38
- return React.createElement(SaveComponent, { ...this._options });
37
+ return _jsx(SaveComponent, { ...this._options });
39
38
  }
40
39
  _options;
41
40
  }
@@ -21,3 +21,4 @@ export declare function StopButton(props: IStopButtonProps): JSX.Element;
21
21
  * Factory returning the stop button toolbar item.
22
22
  */
23
23
  export declare function stopItem(translator: TranslationBundle): InputToolbarRegistry.IToolbarItem;
24
+ //# sourceMappingURL=stop-button.d.ts.map
@@ -1,18 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { TooltippedIconButton } from '@jupyter/chat';
2
3
  import StopIcon from '@mui/icons-material/Stop';
3
- import React from 'react';
4
4
  /**
5
5
  * The stop button component.
6
6
  */
7
7
  export function StopButton(props) {
8
8
  const { translator: trans } = props;
9
9
  const tooltip = trans.__('Stop streaming');
10
- return (React.createElement(TooltippedIconButton, { onClick: props.stopStreaming, tooltip: tooltip, buttonProps: {
10
+ return (_jsx(TooltippedIconButton, { onClick: props.stopStreaming, tooltip: tooltip, buttonProps: {
11
11
  title: tooltip
12
12
  }, sx: {
13
13
  backgroundColor: 'var(--mui-palette-error-main, #d32f2f);'
14
- } },
15
- React.createElement(StopIcon, null)));
14
+ }, children: _jsx(StopIcon, {}) }));
16
15
  }
17
16
  /**
18
17
  * Factory returning the stop button toolbar item.
@@ -1,6 +1,7 @@
1
+ import type { IProviderRegistry, IToolRegistry } from '@jupyternaut/agent';
1
2
  import { InputToolbarRegistry } from '@jupyter/chat';
2
3
  import type { TranslationBundle } from '@jupyterlab/translation';
3
- import type { IAISettingsModel, IProviderRegistry, IToolRegistry } from '../tokens';
4
+ import type { IAISettingsModel } from '../tokens';
4
5
  /**
5
6
  * Properties for the tool select component.
6
7
  */
@@ -38,3 +39,4 @@ export declare function ToolSelect(props: IToolSelectProps): JSX.Element;
38
39
  * Factory function returning the toolbar item for tool selection.
39
40
  */
40
41
  export declare function createToolSelectItem(toolRegistry: IToolRegistry, settingsModel: IAISettingsModel, providerRegistry: IProviderRegistry, toolsEnabled: boolean | undefined, translator: TranslationBundle): InputToolbarRegistry.IToolbarItem;
42
+ //# sourceMappingURL=tool-select.d.ts.map
@@ -1,9 +1,10 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createProviderTools } from '@jupyternaut/agent';
1
3
  import { TooltippedButton } from '@jupyter/chat';
2
4
  import BuildIcon from '@mui/icons-material/Build';
3
5
  import CheckIcon from '@mui/icons-material/Check';
4
6
  import { Divider, Menu, MenuItem, Tooltip, Typography } from '@mui/material';
5
- import React, { useCallback, useEffect, useState } from 'react';
6
- import { createProviderTools } from '../providers/provider-tools';
7
+ import { useCallback, useEffect, useState } from 'react';
7
8
  const SELECT_ITEM_CLASS = 'jp-AIToolSelect-item';
8
9
  /**
9
10
  * The tool select component for choosing AI tools.
@@ -97,68 +98,54 @@ export function ToolSelect(props) {
97
98
  }, [tools, selectedToolNames.length, onToolSelectionChange]);
98
99
  // Don't render if tools are disabled or no tools available
99
100
  if (!toolsEnabled || (tools.length === 0 && providerToolNames.length === 0)) {
100
- return React.createElement(React.Fragment, null);
101
+ return _jsx(_Fragment, {});
101
102
  }
102
103
  const selectedCount = selectedToolNames.length + providerToolNames.length;
103
104
  const totalCount = tools.length + providerToolNames.length;
104
- return (React.createElement(React.Fragment, null,
105
- React.createElement(TooltippedButton, { onClick: e => {
106
- openMenu(e.currentTarget);
107
- }, tooltip: trans.__('Tools (%1/%2 selected)', selectedCount.toString(), totalCount.toString()), buttonProps: {
108
- ...(selectedCount === 0 && {
109
- variant: 'outlined'
110
- }),
111
- title: trans.__('Select AI Tools'),
112
- onKeyDown: e => {
113
- if (e.key !== 'Enter' && e.key !== ' ') {
114
- return;
115
- }
105
+ return (_jsxs(_Fragment, { children: [_jsx(TooltippedButton, { onClick: e => {
116
106
  openMenu(e.currentTarget);
117
- // Stop propagation to prevent sending message
118
- e.stopPropagation();
119
- }
120
- }, sx: selectedCount === 0
121
- ? { backgroundColor: 'var(--jp-layout-color3)' }
122
- : {} },
123
- React.createElement(BuildIcon, { sx: { fontSize: 'small' } })),
124
- React.createElement(Menu, { open: menuOpen, onClose: closeMenu, anchorEl: menuAnchorEl, anchorOrigin: {
125
- vertical: 'top',
126
- horizontal: 'right'
127
- }, transformOrigin: {
128
- vertical: 'bottom',
129
- horizontal: 'right'
130
- }, sx: {
131
- '& .MuiMenuItem-root': {
132
- padding: '0.5em',
133
- paddingRight: '2em'
134
- }
135
- } },
136
- tools.map(namedTool => (React.createElement(Tooltip, { key: namedTool.name, title: namedTool.tool.description || namedTool.name, placement: "left" },
137
- React.createElement(MenuItem, { className: SELECT_ITEM_CLASS, onClick: e => {
138
- toggleTool(namedTool.name);
139
- // Prevent sending message on tool selection
107
+ }, tooltip: trans.__('Tools (%1/%2 selected)', selectedCount.toString(), totalCount.toString()), buttonProps: {
108
+ ...(selectedCount === 0 && {
109
+ variant: 'outlined'
110
+ }),
111
+ title: trans.__('Select AI Tools'),
112
+ onKeyDown: e => {
113
+ if (e.key !== 'Enter' && e.key !== ' ') {
114
+ return;
115
+ }
116
+ openMenu(e.currentTarget);
117
+ // Stop propagation to prevent sending message
140
118
  e.stopPropagation();
141
- } },
142
- selectedToolNames.includes(namedTool.name) ? (React.createElement(CheckIcon, { sx: {
143
- marginRight: '8px',
144
- color: 'var(--jp-brand-color1, #2196F3)'
145
- } })) : (React.createElement("div", { style: { width: '24px', marginRight: '8px' } })),
146
- React.createElement(Typography, { variant: "body2" }, namedTool.name))))),
147
- providerToolNames.length > 0 && tools.length > 0 && React.createElement(Divider, null),
148
- providerToolNames.length > 0 && (React.createElement(MenuItem, { disabled: true },
149
- React.createElement(Typography, { variant: "caption" }, trans.__('Provider Tools')))),
150
- providerToolNames.map(toolName => {
151
- return (React.createElement(Tooltip, { key: toolName, title: trans.__('Enabled via provider settings.'), placement: "left" },
152
- React.createElement(MenuItem, { className: SELECT_ITEM_CLASS, onClick: e => {
153
- // Keep provider-managed tools read-only from this menu.
154
- e.stopPropagation();
155
- } },
156
- React.createElement(CheckIcon, { sx: {
157
- marginRight: '8px',
158
- color: 'text.disabled'
159
- } }),
160
- React.createElement(Typography, { variant: "body2" }, toolName))));
161
- }))));
119
+ }
120
+ }, sx: selectedCount === 0
121
+ ? { backgroundColor: 'var(--jp-layout-color3)' }
122
+ : {}, children: _jsx(BuildIcon, { sx: { fontSize: 'small' } }) }), _jsxs(Menu, { open: menuOpen, onClose: closeMenu, anchorEl: menuAnchorEl, anchorOrigin: {
123
+ vertical: 'top',
124
+ horizontal: 'right'
125
+ }, transformOrigin: {
126
+ vertical: 'bottom',
127
+ horizontal: 'right'
128
+ }, sx: {
129
+ '& .MuiMenuItem-root': {
130
+ padding: '0.5em',
131
+ paddingRight: '2em'
132
+ }
133
+ }, children: [tools.map(namedTool => (_jsx(Tooltip, { title: namedTool.tool.description || namedTool.name, placement: "left", children: _jsxs(MenuItem, { className: SELECT_ITEM_CLASS, onClick: e => {
134
+ toggleTool(namedTool.name);
135
+ // Prevent sending message on tool selection
136
+ e.stopPropagation();
137
+ }, children: [selectedToolNames.includes(namedTool.name) ? (_jsx(CheckIcon, { sx: {
138
+ marginRight: '8px',
139
+ color: 'var(--jp-brand-color1, #2196F3)'
140
+ } })) : (_jsx("div", { style: { width: '24px', marginRight: '8px' } })), _jsx(Typography, { variant: "body2", children: namedTool.name })] }) }, namedTool.name))), providerToolNames.length > 0 && tools.length > 0 && _jsx(Divider, {}), providerToolNames.length > 0 && (_jsx(MenuItem, { disabled: true, children: _jsx(Typography, { variant: "caption", children: trans.__('Provider Tools') }) })), providerToolNames.map(toolName => {
141
+ return (_jsx(Tooltip, { title: trans.__('Enabled via provider settings.'), placement: "left", children: _jsxs(MenuItem, { className: SELECT_ITEM_CLASS, onClick: e => {
142
+ // Keep provider-managed tools read-only from this menu.
143
+ e.stopPropagation();
144
+ }, children: [_jsx(CheckIcon, { sx: {
145
+ marginRight: '8px',
146
+ color: 'text.disabled'
147
+ } }), _jsx(Typography, { variant: "body2", children: toolName })] }) }, toolName));
148
+ })] })] }));
162
149
  }
163
150
  /**
164
151
  * Factory function returning the toolbar item for tool selection.
@@ -183,7 +170,7 @@ export function createToolSelectItem(toolRegistry, settingsModel, providerRegist
183
170
  toolsEnabled,
184
171
  translator
185
172
  };
186
- return React.createElement(ToolSelect, { ...toolSelectProps });
173
+ return _jsx(ToolSelect, { ...toolSelectProps });
187
174
  },
188
175
  position: 1
189
176
  };
@@ -1,8 +1,9 @@
1
+ import type { ITokenUsage } from '@jupyternaut/agent';
1
2
  import { ReactWidget } from '@jupyterlab/ui-components';
2
3
  import type { TranslationBundle } from '@jupyterlab/translation';
3
- import React from 'react';
4
4
  import { ISignal } from '@lumino/signaling';
5
- import type { IAISettingsModel, ITokenUsage } from '../tokens';
5
+ import React from 'react';
6
+ import type { IAISettingsModel } from '../tokens';
6
7
  /**
7
8
  * Props for the UsageDisplay component.
8
9
  */
@@ -47,3 +48,4 @@ export declare class UsageWidget extends ReactWidget {
47
48
  protected render(): React.ReactElement;
48
49
  private _options;
49
50
  }
51
+ //# sourceMappingURL=usage-display.d.ts.map