@jupyterlite/ai 0.9.0-a2 → 0.9.0-a4

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 (70) hide show
  1. package/README.md +213 -37
  2. package/lib/agent.d.ts +81 -29
  3. package/lib/agent.js +211 -116
  4. package/lib/{widgets/chat-wrapper.d.ts → approval-buttons.d.ts} +11 -43
  5. package/lib/{widgets/chat-wrapper.js → approval-buttons.js} +34 -92
  6. package/lib/chat-model-registry.d.ts +52 -0
  7. package/lib/chat-model-registry.js +74 -0
  8. package/lib/chat-model.d.ts +26 -1
  9. package/lib/chat-model.js +88 -18
  10. package/lib/completion/completion-provider.d.ts +5 -13
  11. package/lib/completion/completion-provider.js +33 -33
  12. package/lib/components/index.d.ts +2 -0
  13. package/lib/components/index.js +2 -0
  14. package/lib/components/model-select.js +21 -13
  15. package/lib/components/token-usage-display.d.ts +6 -6
  16. package/lib/components/token-usage-display.js +5 -7
  17. package/lib/diff-manager.d.ts +25 -0
  18. package/lib/diff-manager.js +60 -0
  19. package/lib/icons.d.ts +0 -1
  20. package/lib/icons.js +2 -6
  21. package/lib/index.d.ts +4 -3
  22. package/lib/index.js +420 -144
  23. package/lib/mcp/browser.js +7 -1
  24. package/lib/models/settings-model.d.ts +15 -6
  25. package/lib/models/settings-model.js +31 -20
  26. package/lib/providers/built-in-providers.d.ts +21 -5
  27. package/lib/providers/built-in-providers.js +225 -254
  28. package/lib/providers/models.d.ts +4 -4
  29. package/lib/providers/models.js +2 -2
  30. package/lib/providers/provider-registry.d.ts +13 -57
  31. package/lib/providers/provider-registry.js +16 -96
  32. package/lib/tokens.d.ts +109 -76
  33. package/lib/tokens.js +21 -6
  34. package/lib/tools/commands.js +36 -35
  35. package/lib/tools/file.d.ts +10 -1
  36. package/lib/tools/file.js +235 -146
  37. package/lib/tools/notebook.d.ts +2 -3
  38. package/lib/tools/notebook.js +11 -11
  39. package/lib/widgets/ai-settings.d.ts +6 -6
  40. package/lib/widgets/ai-settings.js +143 -66
  41. package/lib/widgets/main-area-chat.d.ts +23 -0
  42. package/lib/widgets/main-area-chat.js +47 -0
  43. package/lib/widgets/provider-config-dialog.d.ts +2 -2
  44. package/lib/widgets/provider-config-dialog.js +81 -16
  45. package/package.json +13 -10
  46. package/schema/settings-model.json +61 -26
  47. package/src/agent.ts +283 -140
  48. package/src/{widgets/chat-wrapper.tsx → approval-buttons.ts} +48 -130
  49. package/src/chat-model-registry.ts +129 -0
  50. package/src/chat-model.ts +118 -23
  51. package/src/completion/completion-provider.ts +43 -54
  52. package/src/components/index.ts +2 -0
  53. package/src/components/model-select.tsx +25 -14
  54. package/src/components/token-usage-display.tsx +12 -16
  55. package/src/diff-manager.ts +81 -0
  56. package/src/icons.ts +2 -7
  57. package/src/index.ts +577 -187
  58. package/src/mcp/browser.ts +8 -1
  59. package/src/models/settings-model.ts +47 -26
  60. package/src/providers/built-in-providers.ts +226 -274
  61. package/src/providers/models.ts +7 -10
  62. package/src/providers/provider-registry.ts +27 -124
  63. package/src/tokens.ts +137 -97
  64. package/src/tools/commands.ts +45 -40
  65. package/src/tools/file.ts +295 -164
  66. package/src/tools/notebook.ts +13 -14
  67. package/src/widgets/ai-settings.tsx +336 -176
  68. package/src/widgets/main-area-chat.ts +69 -0
  69. package/src/widgets/provider-config-dialog.tsx +209 -52
  70. 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/jupyterlite/ai/assets/591645/855c4e3e-3a63-4868-8052-5c9909922c21)
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 (jupyterlab, jupyterlite and notebook), there is an optional dependencies argument:
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
- # Usage
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, if they are not covered in the sections below.
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
- ## Using MistralAI
46
+ ### Using a provider with an API key (e.g. Anthropic, MistralAI, OpenAI)
48
47
 
49
- > [!WARNING]
50
- > This extension is still very much experimental. It is not an official MistralAI extension.
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
+ ![screenshot showing the dialog to add a new provider](https://github.com/user-attachments/assets/823c71c6-5807-44c8-80b6-2e59379a65d5)
51
54
 
52
- 1. Go to https://console.mistral.ai/api-keys/ and create an API key.
55
+ ### Using Ollama
53
56
 
54
- ![Screenshot showing how to create an API key](./img/1-api-key.png)
57
+ [Ollama](https://ollama.com/) allows you to run open-weight LLMs locally on your machine.
55
58
 
56
- 2. Open the JupyterLab settings and go to the **Ai providers** section to select the `MistralAI`
57
- provider and the API key (required).
59
+ #### Setting up Ollama
58
60
 
59
- ![Screenshot showing how to add the API key to the settings](./img/2-jupyterlab-settings.png)
61
+ 1. Install Ollama following the instructions at https://ollama.com/download
62
+ 2. Pull a model, for example:
60
63
 
61
- 3. Open the chat, or use the inline completer
64
+ ```bash
65
+ ollama pull llama3.2
66
+ ```
62
67
 
63
- ![Screenshot showing how to use the chat](./img/3-usage.png)
68
+ 3. Start the Ollama server (it typically runs on `http://localhost:11434`)
64
69
 
65
- ## Using ChromeAI
70
+ #### Configuring `jupyterlite-ai` to use Ollama
66
71
 
67
- > [!WARNING]
68
- > Support for ChromeAI is still experimental and only available in Google Chrome.
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
- You can test ChromeAI is enabled in your browser by going to the following URL: https://chromeai.org/
78
+ ### Using a generic OpenAI-compatible provider
71
79
 
72
- Enable the proper flags in Google Chrome.
80
+ The Generic provider allows you to connect to any OpenAI-compatible API endpoint.
73
81
 
74
- - chrome://flags/#prompt-api-for-gemini-nano
75
- - Select: `Enabled`
76
- - chrome://flags/#optimization-guide-on-device-model
77
- - Select: `Enabled BypassPrefRequirement`
78
- - chrome://components
79
- - Click `Check for Update` on Optimization Guide On Device Model to download the model
80
- - [Optional] chrome://flags/#text-safety-classifier
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
- ![a screenshot showing how to enable the ChromeAI flag in Google Chrome](https://github.com/user-attachments/assets/d48f46cc-52ee-4ce5-9eaf-c763cdbee04c)
90
+ ### Using LiteLLM Proxy
83
91
 
84
- Then restart Chrome for these changes to take effect.
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
- > [!WARNING]
87
- > On first use, Chrome will download the on-device model, which can be as large as 22GB (according to their docs and at the time of writing).
88
- > During the download, ChromeAI may not be available via the extension.
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 Chrome Built-in AI: https://developer.chrome.com/docs/ai/get-started
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 { IChatProviderRegistry } from './tokens';
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
  */
@@ -22,18 +73,18 @@ export interface IAgentEventTypeMap {
22
73
  tool_call_start: {
23
74
  callId: string;
24
75
  toolName: string;
25
- input: any;
76
+ input: string;
26
77
  };
27
78
  tool_call_complete: {
28
79
  callId: string;
29
80
  toolName: string;
30
- output: any;
81
+ output: string;
31
82
  isError: boolean;
32
83
  };
33
84
  tool_approval_required: {
34
85
  interruptionId: string;
35
86
  toolName: string;
36
- toolInput: any;
87
+ toolInput: string;
37
88
  callId?: string;
38
89
  };
39
90
  grouped_approval_required: {
@@ -41,7 +92,7 @@ export interface IAgentEventTypeMap {
41
92
  approvals: Array<{
42
93
  interruptionId: string;
43
94
  toolName: string;
44
- toolInput: any;
95
+ toolInput: string;
45
96
  }>;
46
97
  };
47
98
  error: {
@@ -68,17 +119,21 @@ export interface IAgentManagerOptions {
68
119
  */
69
120
  toolRegistry?: IToolRegistry;
70
121
  /**
71
- * Optional chat provider registry for model creation
122
+ * Optional provider registry for model creation
72
123
  */
73
- chatProviderRegistry?: IChatProviderRegistry;
124
+ providerRegistry?: IProviderRegistry;
74
125
  /**
75
126
  * The secrets manager.
76
127
  */
77
128
  secretsManager?: ISecretsManager;
78
129
  /**
79
- * The token used to request the secrets manager.
130
+ * The active provider to use with this agent.
80
131
  */
81
- token: symbol;
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 MCP connection status changes
155
+ * Signal emitted when the active provider has changed.
101
156
  */
102
- get mcpConnectionChanged(): ISignal<this, boolean>;
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,26 +221,23 @@ 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
- private _initializeAgent;
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.
187
232
  * @param result The async iterable result from agent execution
188
233
  */
189
234
  private _processRunResult;
235
+ /**
236
+ * Formats tool input for display by pretty-printing JSON strings.
237
+ * @param input The tool input string to format
238
+ * @returns Pretty-printed JSON string
239
+ */
240
+ private _formatToolInput;
190
241
  /**
191
242
  * Handles the start of a tool call from the model event.
192
243
  * @param modelEvent The model event containing tool call information
@@ -225,7 +276,7 @@ export declare class AgentManager {
225
276
  private _getEnhancedSystemPrompt;
226
277
  private _settingsModel;
227
278
  private _toolRegistry?;
228
- private _chatProviderRegistry?;
279
+ private _providerRegistry?;
229
280
  private _secretsManager?;
230
281
  private _selectedToolNames;
231
282
  private _agent;
@@ -237,7 +288,8 @@ export declare class AgentManager {
237
288
  private _pendingApprovals;
238
289
  private _interruptedState;
239
290
  private _agentEvent;
240
- private _mcpConnectionChanged;
241
291
  private _tokenUsage;
242
292
  private _tokenUsageChanged;
293
+ private _activeProvider;
294
+ private _activeProviderChanged;
243
295
  }