@jupyterlite/ai 0.11.1 → 0.13.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/lib/agent.d.ts +61 -7
- package/lib/agent.js +286 -103
- package/lib/chat-commands/clear.d.ts +8 -0
- package/lib/chat-commands/clear.js +30 -0
- package/lib/chat-commands/index.d.ts +2 -0
- package/lib/chat-commands/index.js +2 -0
- package/lib/chat-commands/skills.d.ts +19 -0
- package/lib/chat-commands/skills.js +57 -0
- package/lib/{chat-model-registry.d.ts → chat-model-handler.d.ts} +12 -11
- package/lib/{chat-model-registry.js → chat-model-handler.js} +6 -40
- package/lib/chat-model.d.ts +16 -0
- package/lib/chat-model.js +191 -11
- package/lib/completion/completion-provider.d.ts +1 -1
- package/lib/completion/completion-provider.js +14 -2
- package/lib/components/model-select.js +4 -4
- package/lib/components/tool-select.d.ts +11 -2
- package/lib/components/tool-select.js +77 -18
- package/lib/index.d.ts +3 -3
- package/lib/index.js +311 -72
- package/lib/models/settings-model.d.ts +3 -0
- package/lib/models/settings-model.js +63 -14
- package/lib/providers/built-in-providers.js +12 -7
- package/lib/providers/provider-tools.d.ts +36 -0
- package/lib/providers/provider-tools.js +93 -0
- package/lib/rendered-message-outputarea.d.ts +24 -0
- package/lib/rendered-message-outputarea.js +48 -0
- package/lib/skills/index.d.ts +4 -0
- package/lib/skills/index.js +7 -0
- package/lib/skills/parse-skill.d.ts +25 -0
- package/lib/skills/parse-skill.js +69 -0
- package/lib/skills/skill-loader.d.ts +25 -0
- package/lib/skills/skill-loader.js +133 -0
- package/lib/skills/skill-registry.d.ts +31 -0
- package/lib/skills/skill-registry.js +100 -0
- package/lib/skills/types.d.ts +29 -0
- package/lib/skills/types.js +5 -0
- package/lib/tokens.d.ts +77 -7
- package/lib/tokens.js +6 -1
- package/lib/tools/commands.js +4 -2
- package/lib/tools/skills.d.ts +9 -0
- package/lib/tools/skills.js +73 -0
- package/lib/tools/web.d.ts +8 -0
- package/lib/tools/web.js +196 -0
- package/lib/widgets/ai-settings.d.ts +1 -1
- package/lib/widgets/ai-settings.js +157 -38
- package/lib/widgets/main-area-chat.d.ts +6 -0
- package/lib/widgets/main-area-chat.js +28 -0
- package/lib/widgets/provider-config-dialog.js +207 -4
- package/package.json +18 -11
- package/schema/settings-model.json +97 -2
- package/src/agent.ts +397 -123
- package/src/chat-commands/clear.ts +46 -0
- package/src/chat-commands/index.ts +2 -0
- package/src/chat-commands/skills.ts +87 -0
- package/src/{chat-model-registry.ts → chat-model-handler.ts} +16 -51
- package/src/chat-model.ts +270 -23
- package/src/completion/completion-provider.ts +26 -12
- package/src/components/model-select.tsx +4 -5
- package/src/components/tool-select.tsx +110 -7
- package/src/index.ts +395 -87
- package/src/models/settings-model.ts +70 -15
- package/src/providers/built-in-providers.ts +12 -7
- package/src/providers/provider-tools.ts +179 -0
- package/src/rendered-message-outputarea.ts +62 -0
- package/src/skills/index.ts +14 -0
- package/src/skills/parse-skill.ts +91 -0
- package/src/skills/skill-loader.ts +175 -0
- package/src/skills/skill-registry.ts +137 -0
- package/src/skills/types.ts +37 -0
- package/src/tokens.ts +109 -9
- package/src/tools/commands.ts +4 -2
- package/src/tools/skills.ts +84 -0
- package/src/tools/web.ts +238 -0
- package/src/widgets/ai-settings.tsx +357 -77
- package/src/widgets/main-area-chat.ts +34 -1
- package/src/widgets/provider-config-dialog.tsx +496 -3
package/lib/agent.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ISignal } from '@lumino/signaling';
|
|
2
2
|
import { type Tool } from 'ai';
|
|
3
3
|
import { ISecretsManager } from 'jupyter-secrets-manager';
|
|
4
|
+
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
4
5
|
import { AISettingsModel } from './models/settings-model';
|
|
5
6
|
import type { IProviderRegistry } from './tokens';
|
|
6
|
-
import { ITool, IToolRegistry, ITokenUsage } from './tokens';
|
|
7
|
+
import { ISkillRegistry, ITool, IToolRegistry, ITokenUsage } from './tokens';
|
|
7
8
|
type ToolMap = Record<string, Tool>;
|
|
8
9
|
export declare namespace AgentManagerFactory {
|
|
9
10
|
interface IOptions {
|
|
@@ -11,6 +12,10 @@ export declare namespace AgentManagerFactory {
|
|
|
11
12
|
* The settings model.
|
|
12
13
|
*/
|
|
13
14
|
settingsModel: AISettingsModel;
|
|
15
|
+
/**
|
|
16
|
+
* The skill registry for discovering skills.
|
|
17
|
+
*/
|
|
18
|
+
skillRegistry?: ISkillRegistry;
|
|
14
19
|
/**
|
|
15
20
|
* The secrets manager.
|
|
16
21
|
*/
|
|
@@ -18,7 +23,7 @@ export declare namespace AgentManagerFactory {
|
|
|
18
23
|
/**
|
|
19
24
|
* The token used to request the secrets manager.
|
|
20
25
|
*/
|
|
21
|
-
token: symbol;
|
|
26
|
+
token: symbol | null;
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
export declare class AgentManagerFactory {
|
|
@@ -52,12 +57,17 @@ export declare class AgentManagerFactory {
|
|
|
52
57
|
* Sets up the agent with model configuration, tools, and MCP servers.
|
|
53
58
|
*/
|
|
54
59
|
private _initializeAgents;
|
|
60
|
+
/**
|
|
61
|
+
* Refresh skill snapshots across all agents.
|
|
62
|
+
*/
|
|
63
|
+
refreshSkillSnapshots(): void;
|
|
55
64
|
private _agentManagers;
|
|
56
65
|
private _settingsModel;
|
|
66
|
+
private _skillRegistry?;
|
|
57
67
|
private _secretsManager?;
|
|
58
68
|
private _mcpClients;
|
|
59
69
|
private _mcpConnectionChanged;
|
|
60
|
-
private
|
|
70
|
+
private _initQueue;
|
|
61
71
|
}
|
|
62
72
|
/**
|
|
63
73
|
* Event type mapping for type safety with inlined interface definitions
|
|
@@ -83,7 +93,7 @@ export interface IAgentEventTypeMap {
|
|
|
83
93
|
tool_call_complete: {
|
|
84
94
|
callId: string;
|
|
85
95
|
toolName: string;
|
|
86
|
-
|
|
96
|
+
outputData: unknown;
|
|
87
97
|
isError: boolean;
|
|
88
98
|
};
|
|
89
99
|
tool_approval_request: {
|
|
@@ -123,6 +133,10 @@ export interface IAgentManagerOptions {
|
|
|
123
133
|
* Optional provider registry for model creation
|
|
124
134
|
*/
|
|
125
135
|
providerRegistry?: IProviderRegistry;
|
|
136
|
+
/**
|
|
137
|
+
* The skill registry for discovering skills.
|
|
138
|
+
*/
|
|
139
|
+
skillRegistry?: ISkillRegistry;
|
|
126
140
|
/**
|
|
127
141
|
* The secrets manager.
|
|
128
142
|
*/
|
|
@@ -135,6 +149,10 @@ export interface IAgentManagerOptions {
|
|
|
135
149
|
* Initial token usage.
|
|
136
150
|
*/
|
|
137
151
|
tokenUsage?: ITokenUsage;
|
|
152
|
+
/**
|
|
153
|
+
* JupyterLab render mime registry for discovering supported MIME types.
|
|
154
|
+
*/
|
|
155
|
+
renderMimeRegistry?: IRenderMimeRegistry;
|
|
138
156
|
}
|
|
139
157
|
/**
|
|
140
158
|
* Manages the AI agent lifecycle and execution loop.
|
|
@@ -164,6 +182,10 @@ export declare class AgentManager {
|
|
|
164
182
|
* Signal emitted when token usage statistics change.
|
|
165
183
|
*/
|
|
166
184
|
get tokenUsageChanged(): ISignal<this, ITokenUsage>;
|
|
185
|
+
/**
|
|
186
|
+
* Refresh the skills snapshot and rebuild the agent if resources are ready.
|
|
187
|
+
*/
|
|
188
|
+
refreshSkills(): void;
|
|
167
189
|
/**
|
|
168
190
|
* The active provider for this agent.
|
|
169
191
|
*/
|
|
@@ -220,6 +242,22 @@ export declare class AgentManager {
|
|
|
220
242
|
* Sets up the agent with model configuration, tools, and MCP tools.
|
|
221
243
|
*/
|
|
222
244
|
initializeAgent: (mcpTools?: ToolMap) => Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Refresh the in-memory skills snapshot from the skill registry.
|
|
247
|
+
*/
|
|
248
|
+
private _refreshSkills;
|
|
249
|
+
/**
|
|
250
|
+
* Prepare model, tools, and settings needed to (re)build the agent.
|
|
251
|
+
*/
|
|
252
|
+
private _prepareAgentConfig;
|
|
253
|
+
/**
|
|
254
|
+
* Build the runtime tool map used by the agent.
|
|
255
|
+
*/
|
|
256
|
+
private _buildRuntimeTools;
|
|
257
|
+
/**
|
|
258
|
+
* Rebuild the agent using cached resources and the current skills snapshot.
|
|
259
|
+
*/
|
|
260
|
+
private _rebuildAgent;
|
|
223
261
|
/**
|
|
224
262
|
* Processes the stream result from agent execution.
|
|
225
263
|
* Handles message streaming, tool calls, and emits appropriate events.
|
|
@@ -235,6 +273,14 @@ export declare class AgentManager {
|
|
|
235
273
|
* Handles tool-result stream parts.
|
|
236
274
|
*/
|
|
237
275
|
private _handleToolResult;
|
|
276
|
+
/**
|
|
277
|
+
* Handles tool-error stream parts.
|
|
278
|
+
*/
|
|
279
|
+
private _handleToolError;
|
|
280
|
+
/**
|
|
281
|
+
* Handles tool-output-denied stream parts.
|
|
282
|
+
*/
|
|
283
|
+
private _handleToolOutputDenied;
|
|
238
284
|
/**
|
|
239
285
|
* Handles tool-approval-request stream parts.
|
|
240
286
|
*/
|
|
@@ -262,26 +308,34 @@ export declare class AgentManager {
|
|
|
262
308
|
*/
|
|
263
309
|
private _createModel;
|
|
264
310
|
/**
|
|
265
|
-
* Enhances the base system prompt with
|
|
311
|
+
* Enhances the base system prompt with dynamic context like skills.
|
|
266
312
|
* @param baseSystemPrompt The base system prompt from settings
|
|
267
|
-
* @returns The enhanced system prompt with
|
|
313
|
+
* @returns The enhanced system prompt with dynamic additions
|
|
268
314
|
*/
|
|
269
315
|
private _getEnhancedSystemPrompt;
|
|
316
|
+
/**
|
|
317
|
+
* Build an instruction line describing MIME types supported by this session.
|
|
318
|
+
*/
|
|
319
|
+
private _getSupportedMimeTypesInstruction;
|
|
270
320
|
private _settingsModel;
|
|
271
321
|
private _toolRegistry?;
|
|
272
322
|
private _providerRegistry?;
|
|
323
|
+
private _skillRegistry?;
|
|
273
324
|
private _secretsManager?;
|
|
274
325
|
private _selectedToolNames;
|
|
275
326
|
private _agent;
|
|
276
327
|
private _history;
|
|
277
328
|
private _mcpTools;
|
|
278
|
-
private _isInitializing;
|
|
279
329
|
private _controller;
|
|
280
330
|
private _agentEvent;
|
|
281
331
|
private _tokenUsage;
|
|
282
332
|
private _tokenUsageChanged;
|
|
283
333
|
private _activeProvider;
|
|
284
334
|
private _activeProviderChanged;
|
|
335
|
+
private _skills;
|
|
336
|
+
private _renderMimeRegistry?;
|
|
337
|
+
private _initQueue;
|
|
338
|
+
private _agentConfig;
|
|
285
339
|
private _pendingApprovals;
|
|
286
340
|
}
|
|
287
341
|
export {};
|