@jupyterlite/ai 0.9.0-a2 → 0.9.0-a3
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/README.md +213 -37
- package/lib/agent.d.ts +71 -25
- package/lib/agent.js +181 -99
- package/lib/{widgets/chat-wrapper.d.ts → approval-buttons.d.ts} +11 -43
- package/lib/{widgets/chat-wrapper.js → approval-buttons.js} +34 -92
- package/lib/chat-model-registry.d.ts +52 -0
- package/lib/chat-model-registry.js +74 -0
- package/lib/chat-model.d.ts +20 -1
- package/lib/chat-model.js +28 -1
- package/lib/completion/completion-provider.d.ts +5 -13
- package/lib/completion/completion-provider.js +34 -22
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/model-select.js +20 -11
- package/lib/components/token-usage-display.d.ts +6 -6
- package/lib/components/token-usage-display.js +5 -7
- package/lib/index.d.ts +4 -3
- package/lib/index.js +395 -141
- package/lib/mcp/browser.js +7 -1
- package/lib/models/settings-model.d.ts +11 -6
- package/lib/models/settings-model.js +16 -19
- package/lib/providers/built-in-providers.d.ts +21 -5
- package/lib/providers/built-in-providers.js +223 -254
- package/lib/providers/models.d.ts +4 -4
- package/lib/providers/models.js +2 -2
- package/lib/providers/provider-registry.d.ts +13 -57
- package/lib/providers/provider-registry.js +16 -96
- package/lib/tokens.d.ts +47 -81
- package/lib/tokens.js +17 -6
- package/lib/widgets/ai-settings.d.ts +6 -6
- package/lib/widgets/ai-settings.js +69 -56
- package/lib/widgets/main-area-chat.d.ts +23 -0
- package/lib/widgets/main-area-chat.js +47 -0
- package/lib/widgets/provider-config-dialog.d.ts +2 -2
- package/lib/widgets/provider-config-dialog.js +81 -16
- package/package.json +12 -10
- package/schema/settings-model.json +36 -26
- package/src/agent.ts +248 -120
- package/src/{widgets/chat-wrapper.tsx → approval-buttons.ts} +48 -130
- package/src/chat-model-registry.ts +129 -0
- package/src/chat-model.ts +38 -4
- package/src/completion/completion-provider.ts +45 -43
- package/src/components/index.ts +2 -0
- package/src/components/model-select.tsx +25 -11
- package/src/components/token-usage-display.tsx +12 -16
- package/src/index.ts +537 -183
- package/src/mcp/browser.ts +8 -1
- package/src/models/settings-model.ts +27 -25
- package/src/providers/built-in-providers.ts +224 -274
- package/src/providers/models.ts +7 -10
- package/src/providers/provider-registry.ts +27 -124
- package/src/tokens.ts +64 -97
- package/src/widgets/ai-settings.tsx +156 -143
- package/src/widgets/main-area-chat.ts +69 -0
- package/src/widgets/provider-config-dialog.tsx +209 -52
- package/style/base.css +15 -0
package/README.md
CHANGED
|
@@ -5,15 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
AI code completions and chat for JupyterLab, Notebook 7 and JupyterLite ✨
|
|
7
7
|
|
|
8
|
-
[a screencast showing the Jupyterlite AI extension in JupyterLite](https://github.com/
|
|
8
|
+
[a screencast showing the Jupyterlite AI extension in JupyterLite](https://github.com/user-attachments/assets/e33d7d84-53ca-4835-a034-b6757476c98b)
|
|
9
9
|
|
|
10
10
|
## Requirements
|
|
11
11
|
|
|
12
|
-
> [!NOTE]
|
|
13
|
-
> This extension is meant to be used in JupyterLite to enable AI code completions and chat in the browser, with a specific provider.
|
|
14
|
-
> To enable more AI providers in JupyterLab and Jupyter Notebook, we recommend using the [Jupyter AI](https://github.com/jupyterlab/jupyter-ai) extension directly.
|
|
15
|
-
> At the moment Jupyter AI is not compatible with JupyterLite, but might be to some extent in the future.
|
|
16
|
-
|
|
17
12
|
- JupyterLab >= 4.4.0 or Notebook >= 7.4.0
|
|
18
13
|
|
|
19
14
|
## ✨ Try it in your browser ✨
|
|
@@ -32,63 +27,221 @@ To install the extension, execute:
|
|
|
32
27
|
pip install jupyterlite-ai
|
|
33
28
|
```
|
|
34
29
|
|
|
35
|
-
To install requirements (
|
|
30
|
+
To install requirements (JupyterLab, JupyterLite and Notebook):
|
|
36
31
|
|
|
37
32
|
```bash
|
|
38
33
|
pip install jupyterlite-ai[jupyter]
|
|
39
34
|
```
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
> [!NOTE]
|
|
39
|
+
> This documentation applies to the upcoming **0.9.0** release.
|
|
40
|
+
> For the latest stable version, please refer to the [0.8.x branch](https://github.com/jupyterlite/ai/tree/0.8.x).
|
|
42
41
|
|
|
43
42
|
AI providers typically require using an API key to access their models.
|
|
44
43
|
|
|
45
|
-
The process is different for each provider, so you may refer to their documentation to learn how to generate new API keys
|
|
44
|
+
The process is different for each provider, so you may refer to their documentation to learn how to generate new API keys.
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
### Using a provider with an API key (e.g. Anthropic, MistralAI, OpenAI)
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
1. Open the AI settings and
|
|
49
|
+
2. Click on "Add a new provider"
|
|
50
|
+
3. Enter the details for the provider
|
|
51
|
+
4. In the chat, select the new provider
|
|
52
|
+
|
|
53
|
+

|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
### Using Ollama
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
[Ollama](https://ollama.com/) allows you to run open-weight LLMs locally on your machine.
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
provider and the API key (required).
|
|
59
|
+
#### Setting up Ollama
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
1. Install Ollama following the instructions at https://ollama.com/download
|
|
62
|
+
2. Pull a model, for example:
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
```bash
|
|
65
|
+
ollama pull llama3.2
|
|
66
|
+
```
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
3. Start the Ollama server (it typically runs on `http://localhost:11434`)
|
|
64
69
|
|
|
65
|
-
|
|
70
|
+
#### Configuring `jupyterlite-ai` to use Ollama
|
|
66
71
|
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
1. In JupyterLab, open the AI settings panel and go to the **Providers** section
|
|
73
|
+
2. Click on "Add a new provider"
|
|
74
|
+
3. Select the **Ollama** provider
|
|
75
|
+
4. Configure the following settings:
|
|
76
|
+
- **Model**: The model name you pulled (e.g., `llama3.2`)
|
|
69
77
|
|
|
70
|
-
|
|
78
|
+
### Using a generic OpenAI-compatible provider
|
|
71
79
|
|
|
72
|
-
|
|
80
|
+
The Generic provider allows you to connect to any OpenAI-compatible API endpoint.
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
-
|
|
82
|
+
1. In JupyterLab, open the AI settings panel and go to the **Providers** section
|
|
83
|
+
2. Click on "Add a new provider"
|
|
84
|
+
3. Select the **Generic** provider
|
|
85
|
+
4. Configure the following settings:
|
|
86
|
+
- **Base URL**: The base URL of your API endpoint
|
|
87
|
+
- **Model**: The model name to use
|
|
88
|
+
- **API Key**: Your API key (if required by the provider)
|
|
81
89
|
|
|
82
|
-
|
|
90
|
+
### Using LiteLLM Proxy
|
|
83
91
|
|
|
84
|
-
|
|
92
|
+
[LiteLLM Proxy](https://docs.litellm.ai/docs/simple_proxy) is an OpenAI-compatible proxy server that allows you to call 100+ LLMs through a unified interface.
|
|
85
93
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
Using LiteLLM Proxy with jupyterlite-ai provides flexibility to switch between different AI providers (OpenAI, Anthropic, Google, Azure, local models, etc.) without changing your JupyterLite configuration. It's particularly useful for enterprise deployments where the proxy can be hosted within private infrastructure to manage external API calls and keep API keys server-side.
|
|
95
|
+
|
|
96
|
+
#### Setting up LiteLLM Proxy
|
|
97
|
+
|
|
98
|
+
1. Install LiteLLM:
|
|
99
|
+
|
|
100
|
+
Follow the instructions at https://docs.litellm.ai/docs/simple_proxy.
|
|
101
|
+
|
|
102
|
+
2. Create a `litellm_config.yaml` file with your model configuration:
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
model_list:
|
|
106
|
+
- model_name: gpt-5
|
|
107
|
+
litellm_params:
|
|
108
|
+
model: gpt-5
|
|
109
|
+
api_key: os.environ/OPENAI_API_KEY
|
|
110
|
+
|
|
111
|
+
- model_name: claude-sonnet
|
|
112
|
+
litellm_params:
|
|
113
|
+
model: claude-sonnet-4-5-20250929
|
|
114
|
+
api_key: os.environ/ANTHROPIC_API_KEY
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
3. Start the proxy server, for example:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
litellm --config litellm_config.yaml
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The proxy will start on `http://0.0.0.0:4000` by default.
|
|
124
|
+
|
|
125
|
+
#### Configuring `jupyterlite-ai` to use LiteLLM Proxy
|
|
126
|
+
|
|
127
|
+
Configure the [Generic provider (OpenAI-compatible)](#using-a-generic-openai-compatible-provider) with the following settings:
|
|
128
|
+
|
|
129
|
+
- **Base URL**: `http://0.0.0.0:4000` (or your proxy server URL)
|
|
130
|
+
- **Model**: The model name from your `litellm_config.yaml` (e.g., `gpt-5`, `claude-sonnet`)
|
|
131
|
+
- **API Key (optional)**: If the LiteLLM Proxy server requires an API key, provide it here.
|
|
132
|
+
|
|
133
|
+
> [!IMPORTANT]
|
|
134
|
+
> The API key must be configured on the LiteLLM Proxy server (in the `litellm_config.yaml` file). Providing an API key via the AI provider settings UI will not have any effect, as the proxy server handles authentication with the upstream AI providers.
|
|
89
135
|
|
|
90
136
|
> [!NOTE]
|
|
91
|
-
> For more information about
|
|
137
|
+
> For more information about LiteLLM Proxy configuration, see the [LiteLLM documentation](https://docs.litellm.ai/docs/simple_proxy).
|
|
138
|
+
|
|
139
|
+
## Custom Providers
|
|
140
|
+
|
|
141
|
+
`jupyterlite-ai` supports custom AI providers through its provider registry system. Third-party providers can be registered programmatically in a JupyterLab extension.
|
|
142
|
+
|
|
143
|
+
Providers are based on the [Vercel AI SDK](https://sdk.vercel.ai/docs/introduction), which provides a unified interface for working with different AI models.
|
|
144
|
+
|
|
145
|
+
### Registering a Custom Provider
|
|
146
|
+
|
|
147
|
+
**Example: Registering a custom OpenAI-compatible provider**
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import {
|
|
151
|
+
JupyterFrontEnd,
|
|
152
|
+
JupyterFrontEndPlugin
|
|
153
|
+
} from '@jupyterlab/application';
|
|
154
|
+
import { IProviderRegistry } from '@jupyterlite/ai';
|
|
155
|
+
import { createOpenAI } from '@ai-sdk/openai';
|
|
156
|
+
|
|
157
|
+
const plugin: JupyterFrontEndPlugin<void> = {
|
|
158
|
+
id: 'my-extension:custom-provider',
|
|
159
|
+
autoStart: true,
|
|
160
|
+
requires: [IProviderRegistry],
|
|
161
|
+
activate: (app: JupyterFrontEnd, registry: IProviderRegistry) => {
|
|
162
|
+
const providerInfo = {
|
|
163
|
+
id: 'my-custom-provider',
|
|
164
|
+
name: 'My Custom Provider',
|
|
165
|
+
apiKeyRequirement: 'required' as const,
|
|
166
|
+
defaultModels: ['my-model'],
|
|
167
|
+
supportsBaseURL: true,
|
|
168
|
+
factory: (options: {
|
|
169
|
+
apiKey: string;
|
|
170
|
+
baseURL?: string;
|
|
171
|
+
model?: string;
|
|
172
|
+
}) => {
|
|
173
|
+
const provider = createOpenAI({
|
|
174
|
+
apiKey: options.apiKey,
|
|
175
|
+
baseURL: options.baseURL || 'https://api.example.com/v1'
|
|
176
|
+
});
|
|
177
|
+
return provider(options.model || 'my-model');
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
registry.registerProvider(providerInfo);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The provider configuration object requires the following properties:
|
|
187
|
+
|
|
188
|
+
- `id`: Unique identifier for the provider
|
|
189
|
+
- `name`: Display name shown in the settings UI
|
|
190
|
+
- `apiKeyRequirement`: Whether an API key is `'required'`, `'optional'`, or `'none'`
|
|
191
|
+
- `defaultModels`: Array of model names to show in the settings
|
|
192
|
+
- `supportsBaseURL`: Whether the provider supports a custom base URL
|
|
193
|
+
- `factory`: Function that creates and returns a language model (the registry automatically wraps it for chat usage)
|
|
194
|
+
|
|
195
|
+
**Example: Using a custom fetch function**
|
|
196
|
+
|
|
197
|
+
You can provide a custom `fetch` function to the provider, which is useful for adding custom headers, handling authentication, or routing requests through a proxy:
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
factory: (options: { apiKey: string; baseURL?: string; model?: string }) => {
|
|
201
|
+
const provider = createOpenAI({
|
|
202
|
+
apiKey: options.apiKey,
|
|
203
|
+
baseURL: options.baseURL || 'https://api.example.com/v1',
|
|
204
|
+
fetch: async (url, init) => {
|
|
205
|
+
// Custom fetch implementation
|
|
206
|
+
const modifiedInit = {
|
|
207
|
+
...init,
|
|
208
|
+
headers: {
|
|
209
|
+
...init?.headers,
|
|
210
|
+
'X-Custom-Header': 'custom-value'
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
return fetch(url, modifiedInit);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
return provider(options.model || 'my-model');
|
|
217
|
+
};
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## API key management
|
|
221
|
+
|
|
222
|
+
To avoid storing the API keys in the settings, `jupyterlite-ai` uses [jupyter-secrets-manager](https://github.com/jupyterlab-contrib/jupyter-secrets-manager) by default.
|
|
223
|
+
|
|
224
|
+
The secrets manager get the API keys from a connector in a secure way.\
|
|
225
|
+
The default connector of the secrets manager is _in memory_, which means that **the API keys are reset when reloading the page**.
|
|
226
|
+
|
|
227
|
+
To prevent the keys from being reset on reload, there are two options:
|
|
228
|
+
|
|
229
|
+
1. use a connector that fetches the keys on a remote server (using secure rest API, or web socket)
|
|
230
|
+
|
|
231
|
+
This is the recommended method, as it ensures the security of the keys and makes them accessible only to logged-in users. \
|
|
232
|
+
But it requires some frontend and backend deployments:
|
|
233
|
+
|
|
234
|
+
- a server that can store and send the keys on demand
|
|
235
|
+
- a way to get authenticated to the server
|
|
236
|
+
- a frontend extension providing the connector, able to connect to the server side
|
|
237
|
+
|
|
238
|
+
2. disable the use of the secrets manager from the AI settings panel
|
|
239
|
+
|
|
240
|
+
> [!WARNING]
|
|
241
|
+
> The API keys will be stored in plain text using the settings system of Jupyterlab
|
|
242
|
+
>
|
|
243
|
+
> - using Jupyterlab, the settings are stored in a [directory](https://jupyterlab.readthedocs.io/en/stable/user/directories.html#jupyterlab-user-settings-directory) on the server
|
|
244
|
+
> - using Jupyterlite, the settings are stored in the [browser](https://jupyterlite.readthedocs.io/en/latest/howto/configure/storage.html#configure-the-browser-storage)
|
|
92
245
|
|
|
93
246
|
## Uninstall
|
|
94
247
|
|
|
@@ -136,6 +289,29 @@ By default, the `jlpm build` command generates the source maps for this extensio
|
|
|
136
289
|
jupyter lab build --minimize=False
|
|
137
290
|
```
|
|
138
291
|
|
|
292
|
+
### Running UI tests
|
|
293
|
+
|
|
294
|
+
The UI tests use Playwright and can be configured with environment variables:
|
|
295
|
+
|
|
296
|
+
- `PWVIDEO`: Controls video recording during tests (default: `retain-on-failure`)
|
|
297
|
+
- `on`: Record video for all tests
|
|
298
|
+
- `off`: Do not record video
|
|
299
|
+
- `retain-on-failure`: Only keep videos for failed tests
|
|
300
|
+
- `PWSLOWMO`: Adds a delay (in milliseconds) between Playwright actions for debugging (default: `0`)
|
|
301
|
+
|
|
302
|
+
Example usage:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# Record all test videos
|
|
306
|
+
PWVIDEO=on jlpm playwright test
|
|
307
|
+
|
|
308
|
+
# Slow down test execution by 500ms per action
|
|
309
|
+
PWSLOWMO=500 jlpm playwright test
|
|
310
|
+
|
|
311
|
+
# Combine both options
|
|
312
|
+
PWVIDEO=on PWSLOWMO=1000 jlpm playwright test
|
|
313
|
+
```
|
|
314
|
+
|
|
139
315
|
### Development uninstall
|
|
140
316
|
|
|
141
317
|
```bash
|
package/lib/agent.d.ts
CHANGED
|
@@ -1,8 +1,59 @@
|
|
|
1
1
|
import { ISignal } from '@lumino/signaling';
|
|
2
2
|
import { ISecretsManager } from 'jupyter-secrets-manager';
|
|
3
|
+
import { BrowserMCPServerStreamableHttp } from './mcp/browser';
|
|
3
4
|
import { AISettingsModel } from './models/settings-model';
|
|
4
|
-
import type {
|
|
5
|
+
import type { IProviderRegistry } from './tokens';
|
|
5
6
|
import { ITool, IToolRegistry, ITokenUsage } from './tokens';
|
|
7
|
+
export declare namespace AgentManagerFactory {
|
|
8
|
+
interface IOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The settings model.
|
|
11
|
+
*/
|
|
12
|
+
settingsModel: AISettingsModel;
|
|
13
|
+
/**
|
|
14
|
+
* The secrets manager.
|
|
15
|
+
*/
|
|
16
|
+
secretsManager?: ISecretsManager;
|
|
17
|
+
/**
|
|
18
|
+
* The token used to request the secrets manager.
|
|
19
|
+
*/
|
|
20
|
+
token: symbol;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export declare class AgentManagerFactory {
|
|
24
|
+
constructor(options: AgentManagerFactory.IOptions);
|
|
25
|
+
createAgent(options: IAgentManagerOptions): AgentManager;
|
|
26
|
+
/**
|
|
27
|
+
* Signal emitted when MCP connection status changes
|
|
28
|
+
*/
|
|
29
|
+
get mcpConnectionChanged(): ISignal<this, boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a specific MCP server is connected by server name.
|
|
32
|
+
* @param serverName The name of the MCP server to check
|
|
33
|
+
* @returns True if the server is connected, false otherwise
|
|
34
|
+
*/
|
|
35
|
+
isMCPServerConnected(serverName: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Handles settings changes and reinitializes the agent.
|
|
38
|
+
*/
|
|
39
|
+
private _onSettingsChanged;
|
|
40
|
+
/**
|
|
41
|
+
* Initializes MCP (Model Context Protocol) servers based on current settings.
|
|
42
|
+
* Closes existing servers and connects to enabled servers from configuration.
|
|
43
|
+
*/
|
|
44
|
+
private _initializeMCPServers;
|
|
45
|
+
/**
|
|
46
|
+
* Initializes the AI agent with current settings and tools.
|
|
47
|
+
* Sets up the agent with model configuration, tools, and MCP servers.
|
|
48
|
+
*/
|
|
49
|
+
private _initializeAgents;
|
|
50
|
+
private _agentManagers;
|
|
51
|
+
private _settingsModel;
|
|
52
|
+
private _secretsManager?;
|
|
53
|
+
private _mcpServers;
|
|
54
|
+
private _mcpConnectionChanged;
|
|
55
|
+
private _isInitializing;
|
|
56
|
+
}
|
|
6
57
|
/**
|
|
7
58
|
* Event type mapping for type safety with inlined interface definitions
|
|
8
59
|
*/
|
|
@@ -68,17 +119,21 @@ export interface IAgentManagerOptions {
|
|
|
68
119
|
*/
|
|
69
120
|
toolRegistry?: IToolRegistry;
|
|
70
121
|
/**
|
|
71
|
-
* Optional
|
|
122
|
+
* Optional provider registry for model creation
|
|
72
123
|
*/
|
|
73
|
-
|
|
124
|
+
providerRegistry?: IProviderRegistry;
|
|
74
125
|
/**
|
|
75
126
|
* The secrets manager.
|
|
76
127
|
*/
|
|
77
128
|
secretsManager?: ISecretsManager;
|
|
78
129
|
/**
|
|
79
|
-
* The
|
|
130
|
+
* The active provider to use with this agent.
|
|
80
131
|
*/
|
|
81
|
-
|
|
132
|
+
activeProvider?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Initial token usage.
|
|
135
|
+
*/
|
|
136
|
+
tokenUsage?: ITokenUsage;
|
|
82
137
|
}
|
|
83
138
|
/**
|
|
84
139
|
* Manages the AI agent lifecycle and execution loop.
|
|
@@ -97,9 +152,9 @@ export declare class AgentManager {
|
|
|
97
152
|
*/
|
|
98
153
|
get agentEvent(): ISignal<this, IAgentEvent>;
|
|
99
154
|
/**
|
|
100
|
-
* Signal emitted when
|
|
155
|
+
* Signal emitted when the active provider has changed.
|
|
101
156
|
*/
|
|
102
|
-
get
|
|
157
|
+
get activeProviderChanged(): ISignal<this, string | undefined>;
|
|
103
158
|
/**
|
|
104
159
|
* Gets the current token usage statistics.
|
|
105
160
|
*/
|
|
@@ -108,6 +163,11 @@ export declare class AgentManager {
|
|
|
108
163
|
* Signal emitted when token usage statistics change.
|
|
109
164
|
*/
|
|
110
165
|
get tokenUsageChanged(): ISignal<this, ITokenUsage>;
|
|
166
|
+
/**
|
|
167
|
+
* The active provider for this agent.
|
|
168
|
+
*/
|
|
169
|
+
get activeProvider(): string;
|
|
170
|
+
set activeProvider(value: string);
|
|
111
171
|
/**
|
|
112
172
|
* Sets the selected tools by name and reinitializes the agent.
|
|
113
173
|
* @param toolNames Array of tool names to select
|
|
@@ -118,12 +178,6 @@ export declare class AgentManager {
|
|
|
118
178
|
* @returns Array of selected tools formatted for OpenAI agents
|
|
119
179
|
*/
|
|
120
180
|
get selectedAgentTools(): ITool[];
|
|
121
|
-
/**
|
|
122
|
-
* Checks if a specific MCP server is connected by server name.
|
|
123
|
-
* @param serverName The name of the MCP server to check
|
|
124
|
-
* @returns True if the server is connected, false otherwise
|
|
125
|
-
*/
|
|
126
|
-
isMCPServerConnected(serverName: string): boolean;
|
|
127
181
|
/**
|
|
128
182
|
* Checks if the current configuration is valid for agent operations.
|
|
129
183
|
* Uses the provider registry to determine if an API key is required.
|
|
@@ -167,20 +221,11 @@ export declare class AgentManager {
|
|
|
167
221
|
* @param interruptionIds Array of interruption IDs to reject
|
|
168
222
|
*/
|
|
169
223
|
rejectGroupedToolCalls(groupId: string, interruptionIds: string[]): Promise<void>;
|
|
170
|
-
/**
|
|
171
|
-
* Handles settings changes and reinitializes the agent.
|
|
172
|
-
*/
|
|
173
|
-
private _onSettingsChanged;
|
|
174
224
|
/**
|
|
175
225
|
* Initializes the AI agent with current settings and tools.
|
|
176
226
|
* Sets up the agent with model configuration, tools, and MCP servers.
|
|
177
227
|
*/
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Initializes MCP (Model Context Protocol) servers based on current settings.
|
|
181
|
-
* Closes existing servers and connects to enabled servers from configuration.
|
|
182
|
-
*/
|
|
183
|
-
private _initializeMCPServers;
|
|
228
|
+
initializeAgent: (mcpServers?: BrowserMCPServerStreamableHttp[]) => Promise<void>;
|
|
184
229
|
/**
|
|
185
230
|
* Processes the result stream from agent execution.
|
|
186
231
|
* Handles message streaming, tool calls, and emits appropriate events.
|
|
@@ -225,7 +270,7 @@ export declare class AgentManager {
|
|
|
225
270
|
private _getEnhancedSystemPrompt;
|
|
226
271
|
private _settingsModel;
|
|
227
272
|
private _toolRegistry?;
|
|
228
|
-
private
|
|
273
|
+
private _providerRegistry?;
|
|
229
274
|
private _secretsManager?;
|
|
230
275
|
private _selectedToolNames;
|
|
231
276
|
private _agent;
|
|
@@ -237,7 +282,8 @@ export declare class AgentManager {
|
|
|
237
282
|
private _pendingApprovals;
|
|
238
283
|
private _interruptedState;
|
|
239
284
|
private _agentEvent;
|
|
240
|
-
private _mcpConnectionChanged;
|
|
241
285
|
private _tokenUsage;
|
|
242
286
|
private _tokenUsageChanged;
|
|
287
|
+
private _activeProvider;
|
|
288
|
+
private _activeProviderChanged;
|
|
243
289
|
}
|