@jupyterlite/ai 0.18.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.
- package/lib/chat-commands/clear.d.ts +1 -0
- package/lib/chat-commands/index.d.ts +1 -0
- package/lib/chat-commands/skills.d.ts +2 -1
- package/lib/chat-model-handler.d.ts +3 -1
- package/lib/chat-model.d.ts +46 -8
- package/lib/chat-model.js +51 -21
- package/lib/completion/completion-provider.d.ts +3 -1
- package/lib/completion/completion-provider.js +1 -2
- package/lib/completion/index.d.ts +1 -0
- package/lib/components/clear-button.d.ts +1 -0
- package/lib/components/clear-button.js +3 -4
- package/lib/components/completion-status.d.ts +1 -0
- package/lib/components/completion-status.js +5 -4
- package/lib/components/index.d.ts +1 -0
- package/lib/components/model-select.d.ts +1 -0
- package/lib/components/model-select.js +62 -67
- package/lib/components/save-button.d.ts +1 -0
- package/lib/components/save-button.js +4 -5
- package/lib/components/stop-button.d.ts +1 -0
- package/lib/components/stop-button.js +3 -4
- package/lib/components/tool-select.d.ts +3 -1
- package/lib/components/tool-select.js +47 -60
- package/lib/components/usage-display.d.ts +4 -2
- package/lib/components/usage-display.js +50 -61
- package/lib/diff-manager.d.ts +3 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +28 -17
- package/lib/models/settings-model.d.ts +3 -1
- package/lib/rendered-message-outputarea.d.ts +1 -0
- package/lib/tokens.d.ts +18 -640
- package/lib/tokens.js +2 -31
- package/lib/widgets/ai-settings.d.ts +3 -1
- package/lib/widgets/ai-settings.js +185 -349
- package/lib/widgets/main-area-chat.d.ts +1 -0
- package/lib/widgets/provider-config-dialog.d.ts +2 -1
- package/lib/widgets/provider-config-dialog.js +102 -167
- package/package.json +111 -258
- package/src/chat-commands/skills.ts +2 -2
- package/src/chat-model-handler.ts +6 -4
- package/src/chat-model.ts +66 -19
- package/src/completion/completion-provider.ts +6 -6
- package/src/components/clear-button.tsx +0 -2
- package/src/components/completion-status.tsx +2 -2
- package/src/components/model-select.tsx +1 -1
- package/src/components/stop-button.tsx +0 -2
- package/src/components/tool-select.tsx +10 -9
- package/src/components/usage-display.tsx +4 -2
- package/src/diff-manager.ts +4 -3
- package/src/index.ts +62 -44
- package/src/models/settings-model.ts +6 -6
- package/src/tokens.ts +23 -788
- package/src/widgets/ai-settings.tsx +14 -11
- package/src/widgets/provider-config-dialog.tsx +8 -8
- package/LICENSE +0 -30
- package/README.md +0 -49
- package/lib/agent.d.ts +0 -280
- package/lib/agent.js +0 -1103
- package/lib/icons.d.ts +0 -3
- package/lib/icons.js +0 -8
- package/lib/providers/built-in-providers.d.ts +0 -21
- package/lib/providers/built-in-providers.js +0 -233
- package/lib/providers/generated-model-info.d.ts +0 -8
- package/lib/providers/generated-model-info.js +0 -502
- package/lib/providers/model-info.d.ts +0 -6
- package/lib/providers/model-info.js +0 -91
- package/lib/providers/models.d.ts +0 -37
- package/lib/providers/models.js +0 -28
- package/lib/providers/provider-registry.d.ts +0 -49
- package/lib/providers/provider-registry.js +0 -72
- package/lib/providers/provider-tools.d.ts +0 -36
- package/lib/providers/provider-tools.js +0 -93
- package/lib/skills/index.d.ts +0 -4
- package/lib/skills/index.js +0 -7
- package/lib/skills/parse-skill.d.ts +0 -25
- package/lib/skills/parse-skill.js +0 -69
- package/lib/skills/skill-loader.d.ts +0 -25
- package/lib/skills/skill-loader.js +0 -133
- package/lib/skills/skill-registry.d.ts +0 -31
- package/lib/skills/skill-registry.js +0 -100
- package/lib/skills/types.d.ts +0 -29
- package/lib/skills/types.js +0 -5
- package/lib/tools/commands.d.ts +0 -11
- package/lib/tools/commands.js +0 -154
- package/lib/tools/skills.d.ts +0 -9
- package/lib/tools/skills.js +0 -73
- package/lib/tools/tool-registry.d.ts +0 -35
- package/lib/tools/tool-registry.js +0 -55
- package/lib/tools/web.d.ts +0 -8
- package/lib/tools/web.js +0 -196
- package/src/agent.ts +0 -1431
- package/src/icons.ts +0 -11
- package/src/providers/built-in-providers.ts +0 -241
- package/src/providers/generated-model-info.ts +0 -508
- package/src/providers/model-info.ts +0 -145
- package/src/providers/models.ts +0 -76
- package/src/providers/provider-registry.ts +0 -88
- package/src/providers/provider-tools.ts +0 -179
- package/src/skills/index.ts +0 -14
- package/src/skills/parse-skill.ts +0 -91
- package/src/skills/skill-loader.ts +0 -175
- package/src/skills/skill-registry.ts +0 -137
- package/src/skills/types.ts +0 -37
- package/src/tools/commands.ts +0 -210
- package/src/tools/skills.ts +0 -84
- package/src/tools/tool-registry.ts +0 -63
- package/src/tools/web.ts +0 -238
- package/src/types.d.ts +0 -4
- package/style/icons/jupyternaut-lite.svg +0 -7
package/lib/tokens.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
+
import type { IAISettingsModel as IBaseAISettingsModel, IAgentManager, ITokenUsage } from '@jupyternaut/agent';
|
|
1
2
|
import { ActiveCellManager, IChatModel, IMessage } from '@jupyter/chat';
|
|
2
|
-
import { VDomRenderer } from '@jupyterlab/apputils';
|
|
3
|
-
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
4
3
|
import { Token } from '@lumino/coreutils';
|
|
5
|
-
import type { IDisposable } from '@lumino/disposable';
|
|
6
4
|
import { ISignal } from '@lumino/signaling';
|
|
7
|
-
import type { Tool, LanguageModel, UserContent, ModelMessage } from 'ai';
|
|
8
|
-
import { ISecretsManager } from 'jupyter-secrets-manager';
|
|
9
|
-
import type { IModelOptions } from './providers/models';
|
|
10
|
-
import type { ISkillDefinition, ISkillRegistration, ISkillResourceResult, ISkillSummary } from './skills/types';
|
|
11
|
-
export type { ISkillDefinition, ISkillRegistration, ISkillResourceResult, ISkillSummary } from './skills/types';
|
|
12
5
|
/**
|
|
13
6
|
* Command IDs namespace
|
|
14
7
|
*/
|
|
@@ -22,528 +15,6 @@ export declare namespace CommandIds {
|
|
|
22
15
|
const saveChat = "@jupyterlite/ai:save-chat";
|
|
23
16
|
const restoreChat = "@jupyterlite/ai:restore-chat";
|
|
24
17
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Type definition for a tool
|
|
27
|
-
*/
|
|
28
|
-
export type ITool = Tool;
|
|
29
|
-
/**
|
|
30
|
-
* A map containing tools.
|
|
31
|
-
*/
|
|
32
|
-
export type ToolMap = Record<string, ITool>;
|
|
33
|
-
/**
|
|
34
|
-
* Interface for a named tool (tool with a name identifier)
|
|
35
|
-
*/
|
|
36
|
-
export interface INamedTool {
|
|
37
|
-
/**
|
|
38
|
-
* The unique name of the tool
|
|
39
|
-
*/
|
|
40
|
-
name: string;
|
|
41
|
-
/**
|
|
42
|
-
* The tool instance
|
|
43
|
-
*/
|
|
44
|
-
tool: ITool;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* The tool registry interface for managing AI tools
|
|
48
|
-
*/
|
|
49
|
-
export interface IToolRegistry {
|
|
50
|
-
/**
|
|
51
|
-
* The registered tools as a record (name -> tool mapping).
|
|
52
|
-
*/
|
|
53
|
-
readonly tools: Record<string, ITool>;
|
|
54
|
-
/**
|
|
55
|
-
* The registered named tools array.
|
|
56
|
-
*/
|
|
57
|
-
readonly namedTools: INamedTool[];
|
|
58
|
-
/**
|
|
59
|
-
* A signal triggered when the tools have changed.
|
|
60
|
-
*/
|
|
61
|
-
readonly toolsChanged: ISignal<IToolRegistry, void>;
|
|
62
|
-
/**
|
|
63
|
-
* Add a new tool to the registry.
|
|
64
|
-
*/
|
|
65
|
-
add(name: string, tool: ITool): void;
|
|
66
|
-
/**
|
|
67
|
-
* Get a tool for a given name.
|
|
68
|
-
* Return null if the name is not provided or if there is no registered tool with the
|
|
69
|
-
* given name.
|
|
70
|
-
*/
|
|
71
|
-
get(name: string | null): ITool | null;
|
|
72
|
-
/**
|
|
73
|
-
* Remove a tool from the registry by name.
|
|
74
|
-
*/
|
|
75
|
-
remove(name: string): boolean;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* The tool registry token.
|
|
79
|
-
*/
|
|
80
|
-
export declare const IToolRegistry: Token<IToolRegistry>;
|
|
81
|
-
/**
|
|
82
|
-
* Registry for skills available to the AI agent.
|
|
83
|
-
*/
|
|
84
|
-
export interface ISkillRegistry {
|
|
85
|
-
/**
|
|
86
|
-
* Signal emitted when skills change.
|
|
87
|
-
*/
|
|
88
|
-
readonly skillsChanged: ISignal<ISkillRegistry, void>;
|
|
89
|
-
/**
|
|
90
|
-
* Register a single skill.
|
|
91
|
-
*/
|
|
92
|
-
registerSkill(skill: ISkillRegistration): IDisposable;
|
|
93
|
-
/**
|
|
94
|
-
* List all skills with summary info, optionally filtered by a search query.
|
|
95
|
-
*/
|
|
96
|
-
listSkills(query?: string): ISkillSummary[];
|
|
97
|
-
/**
|
|
98
|
-
* Get a full skill definition by name.
|
|
99
|
-
*/
|
|
100
|
-
getSkill(name: string): ISkillDefinition | null;
|
|
101
|
-
/**
|
|
102
|
-
* Load a resource for a skill.
|
|
103
|
-
*/
|
|
104
|
-
getSkillResource(name: string, resource: string): Promise<ISkillResourceResult>;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* The skill registry token.
|
|
108
|
-
*/
|
|
109
|
-
export declare const ISkillRegistry: Token<ISkillRegistry>;
|
|
110
|
-
/**
|
|
111
|
-
* Interface for a provider factory function that creates language models
|
|
112
|
-
*/
|
|
113
|
-
export interface IProviderFactory {
|
|
114
|
-
(options: IModelOptions): LanguageModel;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Built-in web search integration families supported by provider tools.
|
|
118
|
-
*/
|
|
119
|
-
export type IProviderWebSearchImplementation = 'openai' | 'anthropic';
|
|
120
|
-
/**
|
|
121
|
-
* Built-in web fetch integration families supported by provider tools.
|
|
122
|
-
*/
|
|
123
|
-
export type IProviderWebFetchImplementation = 'anthropic';
|
|
124
|
-
/**
|
|
125
|
-
* Capability descriptor for provider-hosted web search.
|
|
126
|
-
*/
|
|
127
|
-
export interface IProviderWebSearchCapability {
|
|
128
|
-
/**
|
|
129
|
-
* Which built-in integration family to use.
|
|
130
|
-
*/
|
|
131
|
-
implementation: IProviderWebSearchImplementation;
|
|
132
|
-
/**
|
|
133
|
-
* If true, skip provider-hosted web search when function tools are enabled.
|
|
134
|
-
*/
|
|
135
|
-
requiresNoFunctionTools?: boolean;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Capability descriptor for provider-hosted web fetch.
|
|
139
|
-
*/
|
|
140
|
-
export interface IProviderWebFetchCapability {
|
|
141
|
-
/**
|
|
142
|
-
* Which built-in integration family to use.
|
|
143
|
-
*/
|
|
144
|
-
implementation: IProviderWebFetchImplementation;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Provider-hosted tool capabilities exposed by a provider.
|
|
148
|
-
*/
|
|
149
|
-
export interface IProviderToolCapabilities {
|
|
150
|
-
webSearch?: IProviderWebSearchCapability;
|
|
151
|
-
webFetch?: IProviderWebFetchCapability;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Provider information
|
|
155
|
-
*/
|
|
156
|
-
export interface IProviderModelInfo {
|
|
157
|
-
/**
|
|
158
|
-
* Default context window for the model in tokens.
|
|
159
|
-
*/
|
|
160
|
-
contextWindow?: number;
|
|
161
|
-
/**
|
|
162
|
-
* Whether the model supports image inputs.
|
|
163
|
-
*/
|
|
164
|
-
supportsImages?: boolean;
|
|
165
|
-
/**
|
|
166
|
-
* Whether the model supports PDF inputs.
|
|
167
|
-
*/
|
|
168
|
-
supportsPdf?: boolean;
|
|
169
|
-
/**
|
|
170
|
-
* Whether the model supports audio inputs.
|
|
171
|
-
*/
|
|
172
|
-
supportsAudio?: boolean;
|
|
173
|
-
}
|
|
174
|
-
export interface IProviderInfo {
|
|
175
|
-
/**
|
|
176
|
-
* Unique identifier for the provider
|
|
177
|
-
*/
|
|
178
|
-
id: string;
|
|
179
|
-
/**
|
|
180
|
-
* Display name for the provider
|
|
181
|
-
*/
|
|
182
|
-
name: string;
|
|
183
|
-
/**
|
|
184
|
-
* API key requirement policy for this provider
|
|
185
|
-
* - 'required': API key is mandatory
|
|
186
|
-
* - 'optional': API key is optional
|
|
187
|
-
* - 'none': API key is not needed and field will be hidden
|
|
188
|
-
*/
|
|
189
|
-
apiKeyRequirement: 'required' | 'optional' | 'none';
|
|
190
|
-
/**
|
|
191
|
-
* Default model names for this provider
|
|
192
|
-
*/
|
|
193
|
-
defaultModels: string[];
|
|
194
|
-
/**
|
|
195
|
-
* Optional per-model metadata keyed by model ID.
|
|
196
|
-
*/
|
|
197
|
-
modelInfo?: Record<string, IProviderModelInfo>;
|
|
198
|
-
/**
|
|
199
|
-
* Whether this provider supports custom base URLs
|
|
200
|
-
*/
|
|
201
|
-
supportsBaseURL?: boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Whether this provider supports custom headers
|
|
204
|
-
*/
|
|
205
|
-
supportsHeaders?: boolean;
|
|
206
|
-
/**
|
|
207
|
-
* Whether this provider supports tool calling
|
|
208
|
-
*/
|
|
209
|
-
supportsToolCalling?: boolean;
|
|
210
|
-
/**
|
|
211
|
-
* Optional description shown in the UI
|
|
212
|
-
*/
|
|
213
|
-
description?: string;
|
|
214
|
-
/**
|
|
215
|
-
* Optional URL suggestions
|
|
216
|
-
*/
|
|
217
|
-
baseUrls?: {
|
|
218
|
-
url: string;
|
|
219
|
-
description?: string;
|
|
220
|
-
}[];
|
|
221
|
-
/**
|
|
222
|
-
* Optional provider-hosted tool capabilities for web retrieval.
|
|
223
|
-
*/
|
|
224
|
-
providerToolCapabilities?: IProviderToolCapabilities;
|
|
225
|
-
/**
|
|
226
|
-
* Factory function for creating language models
|
|
227
|
-
*/
|
|
228
|
-
factory: IProviderFactory;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Registry for AI providers
|
|
232
|
-
*/
|
|
233
|
-
export interface IProviderRegistry {
|
|
234
|
-
/**
|
|
235
|
-
* The registered providers as a record (id -> info mapping).
|
|
236
|
-
*/
|
|
237
|
-
readonly providers: Record<string, IProviderInfo>;
|
|
238
|
-
/**
|
|
239
|
-
* A signal triggered when providers have changed.
|
|
240
|
-
*/
|
|
241
|
-
readonly providersChanged: ISignal<IProviderRegistry, void>;
|
|
242
|
-
/**
|
|
243
|
-
* Register a new provider.
|
|
244
|
-
*/
|
|
245
|
-
registerProvider(info: IProviderInfo): void;
|
|
246
|
-
/**
|
|
247
|
-
* Get provider info by id.
|
|
248
|
-
*/
|
|
249
|
-
getProviderInfo(id: string): IProviderInfo | null;
|
|
250
|
-
/**
|
|
251
|
-
* Create a chat model instance for the given provider.
|
|
252
|
-
*/
|
|
253
|
-
createChatModel(id: string, options: IModelOptions): LanguageModel | null;
|
|
254
|
-
/**
|
|
255
|
-
* Create a completion model instance for the given provider.
|
|
256
|
-
*/
|
|
257
|
-
createCompletionModel(id: string, options: IModelOptions): LanguageModel | null;
|
|
258
|
-
/**
|
|
259
|
-
* Get all available provider IDs.
|
|
260
|
-
*/
|
|
261
|
-
getAvailableProviders(): string[];
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Token for the provider registry.
|
|
265
|
-
*/
|
|
266
|
-
export declare const IProviderRegistry: Token<IProviderRegistry>;
|
|
267
|
-
export interface IProviderParameters {
|
|
268
|
-
temperature?: number;
|
|
269
|
-
maxOutputTokens?: number;
|
|
270
|
-
maxTurns?: number;
|
|
271
|
-
contextWindow?: number;
|
|
272
|
-
supportsFillInMiddle?: boolean;
|
|
273
|
-
useFilterText?: boolean;
|
|
274
|
-
}
|
|
275
|
-
export interface IProviderConfig {
|
|
276
|
-
id: string;
|
|
277
|
-
name: string;
|
|
278
|
-
provider: string;
|
|
279
|
-
model: string;
|
|
280
|
-
apiKey?: string;
|
|
281
|
-
baseURL?: string;
|
|
282
|
-
headers?: Record<string, string>;
|
|
283
|
-
parameters?: IProviderParameters;
|
|
284
|
-
customSettings?: Record<string, any>;
|
|
285
|
-
[key: string]: any;
|
|
286
|
-
}
|
|
287
|
-
export interface IMCPServerConfig {
|
|
288
|
-
id: string;
|
|
289
|
-
name: string;
|
|
290
|
-
url: string;
|
|
291
|
-
enabled: boolean;
|
|
292
|
-
[key: string]: any;
|
|
293
|
-
}
|
|
294
|
-
export interface IAIConfig {
|
|
295
|
-
useSecretsManager: boolean;
|
|
296
|
-
providers: IProviderConfig[];
|
|
297
|
-
defaultProvider: string;
|
|
298
|
-
activeCompleterProvider?: string;
|
|
299
|
-
useSameProviderForChatAndCompleter: boolean;
|
|
300
|
-
mcpServers: IMCPServerConfig[];
|
|
301
|
-
contextAwareness: boolean;
|
|
302
|
-
codeExecution: boolean;
|
|
303
|
-
systemPrompt: string;
|
|
304
|
-
completionSystemPrompt: string;
|
|
305
|
-
toolsEnabled: boolean;
|
|
306
|
-
sendWithShiftEnter: boolean;
|
|
307
|
-
showTokenUsage: boolean;
|
|
308
|
-
showContextUsage: boolean;
|
|
309
|
-
commandsRequiringApproval: string[];
|
|
310
|
-
commandsAutoRenderMimeBundles: string[];
|
|
311
|
-
trustedMimeTypesForAutoRender: string[];
|
|
312
|
-
showCellDiff: boolean;
|
|
313
|
-
showFileDiff: boolean;
|
|
314
|
-
diffDisplayMode: 'split' | 'unified';
|
|
315
|
-
skillsPaths: string[];
|
|
316
|
-
chatBackupDirectory: string;
|
|
317
|
-
autoTitle: boolean;
|
|
318
|
-
}
|
|
319
|
-
export interface IAISettingsModel extends VDomRenderer.IModel {
|
|
320
|
-
readonly config: IAIConfig;
|
|
321
|
-
updateConfig(updates: Partial<IAIConfig>): Promise<void>;
|
|
322
|
-
readonly providers: IProviderConfig[];
|
|
323
|
-
getProvider(id: string): IProviderConfig | undefined;
|
|
324
|
-
getDefaultProvider(): IProviderConfig | undefined;
|
|
325
|
-
getCompleterProvider(): IProviderConfig | undefined;
|
|
326
|
-
addProvider(providerConfig: Omit<IProviderConfig, 'id'>): Promise<string>;
|
|
327
|
-
removeProvider(id: string): Promise<void>;
|
|
328
|
-
updateProvider(id: string, updates: Partial<IProviderConfig>): Promise<void>;
|
|
329
|
-
setActiveProvider(id: string): Promise<void>;
|
|
330
|
-
setActiveCompleterProvider(id: string | undefined): Promise<void>;
|
|
331
|
-
readonly mcpServers: IMCPServerConfig[];
|
|
332
|
-
getMCPServer(id: string): IMCPServerConfig | undefined;
|
|
333
|
-
addMCPServer(serverConfig: Omit<IMCPServerConfig, 'id'>): Promise<string>;
|
|
334
|
-
removeMCPServer(id: string): Promise<void>;
|
|
335
|
-
updateMCPServer(id: string, updates: Partial<IMCPServerConfig>): Promise<void>;
|
|
336
|
-
/**
|
|
337
|
-
* Get the API key saved in the settings file for a given provider.
|
|
338
|
-
*
|
|
339
|
-
* @param id - the id of the provider.
|
|
340
|
-
*/
|
|
341
|
-
getApiKey(id: string): string;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Token for the AI settings model.
|
|
345
|
-
*/
|
|
346
|
-
export declare const IAISettingsModel: Token<IAISettingsModel>;
|
|
347
|
-
/**
|
|
348
|
-
* A namespace for agent manager.
|
|
349
|
-
*/
|
|
350
|
-
export declare namespace IAgentManager {
|
|
351
|
-
/**
|
|
352
|
-
* Configuration options for the AgentManager
|
|
353
|
-
*/
|
|
354
|
-
interface IOptions {
|
|
355
|
-
/**
|
|
356
|
-
* AI settings model for configuration
|
|
357
|
-
*/
|
|
358
|
-
settingsModel: IAISettingsModel;
|
|
359
|
-
/**
|
|
360
|
-
* Optional tool registry for managing available tools
|
|
361
|
-
*/
|
|
362
|
-
toolRegistry?: IToolRegistry;
|
|
363
|
-
/**
|
|
364
|
-
* Optional provider registry for model creation
|
|
365
|
-
*/
|
|
366
|
-
providerRegistry?: IProviderRegistry;
|
|
367
|
-
/**
|
|
368
|
-
* The skill registry for discovering skills.
|
|
369
|
-
*/
|
|
370
|
-
skillRegistry?: ISkillRegistry;
|
|
371
|
-
/**
|
|
372
|
-
* The secrets manager.
|
|
373
|
-
*/
|
|
374
|
-
secretsManager?: ISecretsManager;
|
|
375
|
-
/**
|
|
376
|
-
* The active provider to use with this agent.
|
|
377
|
-
*/
|
|
378
|
-
activeProvider?: string;
|
|
379
|
-
/**
|
|
380
|
-
* Initial token usage.
|
|
381
|
-
*/
|
|
382
|
-
tokenUsage?: ITokenUsage;
|
|
383
|
-
/**
|
|
384
|
-
* JupyterLab render mime registry for discovering supported MIME types.
|
|
385
|
-
*/
|
|
386
|
-
renderMimeRegistry?: IRenderMimeRegistry;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Event type mapping for type safety with inlined interface definitions
|
|
390
|
-
*/
|
|
391
|
-
interface IAgentEventTypeMap {
|
|
392
|
-
message_start: {
|
|
393
|
-
messageId: string;
|
|
394
|
-
};
|
|
395
|
-
message_chunk: {
|
|
396
|
-
messageId: string;
|
|
397
|
-
chunk: string;
|
|
398
|
-
fullContent: string;
|
|
399
|
-
};
|
|
400
|
-
message_complete: {
|
|
401
|
-
messageId: string;
|
|
402
|
-
content: string;
|
|
403
|
-
};
|
|
404
|
-
tool_call_start: {
|
|
405
|
-
callId: string;
|
|
406
|
-
toolName: string;
|
|
407
|
-
input: string;
|
|
408
|
-
};
|
|
409
|
-
tool_call_complete: {
|
|
410
|
-
callId: string;
|
|
411
|
-
toolName: string;
|
|
412
|
-
outputData: unknown;
|
|
413
|
-
isError: boolean;
|
|
414
|
-
};
|
|
415
|
-
tool_approval_request: {
|
|
416
|
-
toolCallId: string;
|
|
417
|
-
toolName: string;
|
|
418
|
-
args: unknown;
|
|
419
|
-
};
|
|
420
|
-
tool_approval_resolved: {
|
|
421
|
-
toolCallId: string;
|
|
422
|
-
approved: boolean;
|
|
423
|
-
};
|
|
424
|
-
error: {
|
|
425
|
-
error: Error;
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Events emitted by the AgentManager
|
|
430
|
-
*/
|
|
431
|
-
type IAgentEvent<T extends keyof IAgentEventTypeMap = keyof IAgentEventTypeMap> = T extends keyof IAgentEventTypeMap ? {
|
|
432
|
-
type: T;
|
|
433
|
-
data: IAgentEventTypeMap[T];
|
|
434
|
-
} : never;
|
|
435
|
-
}
|
|
436
|
-
export interface IAgentManager {
|
|
437
|
-
/**
|
|
438
|
-
* The active provider for this agent.
|
|
439
|
-
*/
|
|
440
|
-
activeProvider: string;
|
|
441
|
-
/**
|
|
442
|
-
* Signal emitted when agent events occur
|
|
443
|
-
*/
|
|
444
|
-
readonly agentEvent: ISignal<IAgentManager, IAgentManager.IAgentEvent>;
|
|
445
|
-
/**
|
|
446
|
-
* Signal emitted when the active provider has changed.
|
|
447
|
-
*/
|
|
448
|
-
readonly activeProviderChanged: ISignal<IAgentManager, string | undefined>;
|
|
449
|
-
/**
|
|
450
|
-
* Gets the current token usage statistics.
|
|
451
|
-
*/
|
|
452
|
-
readonly tokenUsage: ITokenUsage;
|
|
453
|
-
/**
|
|
454
|
-
* Signal emitted when token usage statistics change.
|
|
455
|
-
*/
|
|
456
|
-
readonly tokenUsageChanged: ISignal<IAgentManager, ITokenUsage>;
|
|
457
|
-
/**
|
|
458
|
-
* Refresh the skills snapshot and rebuild the agent if resources are ready.
|
|
459
|
-
*/
|
|
460
|
-
refreshSkills(): void;
|
|
461
|
-
/**
|
|
462
|
-
* Sets the selected tools by name and reinitializes the agent.
|
|
463
|
-
* @param toolNames Array of tool names to select
|
|
464
|
-
*/
|
|
465
|
-
setSelectedTools(toolNames: string[]): void;
|
|
466
|
-
/**
|
|
467
|
-
* Gets the currently selected tools as a record.
|
|
468
|
-
* @returns Record of selected tools
|
|
469
|
-
*/
|
|
470
|
-
readonly selectedAgentTools: ToolMap;
|
|
471
|
-
/**
|
|
472
|
-
* Checks if the current configuration is valid for agent operations.
|
|
473
|
-
* Uses the provider registry to determine if an API key is required.
|
|
474
|
-
* @returns True if the configuration is valid, false otherwise
|
|
475
|
-
*/
|
|
476
|
-
hasValidConfig(): boolean;
|
|
477
|
-
/**
|
|
478
|
-
* Clears conversation history and resets agent state.
|
|
479
|
-
*/
|
|
480
|
-
clearHistory(): Promise<void>;
|
|
481
|
-
/**
|
|
482
|
-
* Sets the history from already-processed model messages.
|
|
483
|
-
* @param messages Pre-built model messages (may include binary content)
|
|
484
|
-
*/
|
|
485
|
-
setHistory(messages: ModelMessage[]): void;
|
|
486
|
-
/**
|
|
487
|
-
* Stops the current streaming response by aborting the request.
|
|
488
|
-
*/
|
|
489
|
-
stopStreaming(): void;
|
|
490
|
-
/**
|
|
491
|
-
* Approves a pending tool call.
|
|
492
|
-
* @param toolCallId The tool call ID to approve
|
|
493
|
-
* @param reason Optional reason for approval
|
|
494
|
-
*/
|
|
495
|
-
approveToolCall(toolCallId: string, reason?: string): void;
|
|
496
|
-
/**
|
|
497
|
-
* Rejects a pending tool call.
|
|
498
|
-
* @param toolCallId The tool call ID to reject
|
|
499
|
-
* @param reason Optional reason for rejection
|
|
500
|
-
*/
|
|
501
|
-
rejectToolCall(toolCallId: string, reason?: string): void;
|
|
502
|
-
/**
|
|
503
|
-
* Generates AI response to user message using the agent.
|
|
504
|
-
* Handles the complete execution cycle including tool calls.
|
|
505
|
-
* @param message The user message to respond to (may include processed attachment content)
|
|
506
|
-
*/
|
|
507
|
-
generateResponse(message: UserContent): Promise<void>;
|
|
508
|
-
/**
|
|
509
|
-
* Create a transient language model to request a text response, which won't be added to history.
|
|
510
|
-
* @param messages - the messages sequence to send to the model.
|
|
511
|
-
*/
|
|
512
|
-
textResponse(messages: ModelMessage[]): Promise<string>;
|
|
513
|
-
/**
|
|
514
|
-
* Initializes the AI agent with current settings and tools.
|
|
515
|
-
* Sets up the agent with model configuration, tools, and MCP tools.
|
|
516
|
-
*/
|
|
517
|
-
initializeAgent(mcpTools?: ToolMap): Promise<void>;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Token for the agent manager.
|
|
521
|
-
*/
|
|
522
|
-
export declare const IAgentManager: Token<IAgentManager>;
|
|
523
|
-
/**
|
|
524
|
-
* The interface for a agent manager factory.
|
|
525
|
-
*/
|
|
526
|
-
export interface IAgentManagerFactory {
|
|
527
|
-
/**
|
|
528
|
-
* Create a new agent.
|
|
529
|
-
*/
|
|
530
|
-
createAgent(options: IAgentManager.IOptions): IAgentManager;
|
|
531
|
-
/**
|
|
532
|
-
* Signal emitted when MCP connection status changes
|
|
533
|
-
*/
|
|
534
|
-
readonly mcpConnectionChanged: ISignal<IAgentManagerFactory, boolean>;
|
|
535
|
-
/**
|
|
536
|
-
* Checks whether a specific MCP server is connected.
|
|
537
|
-
* @param serverName The name of the MCP server to check
|
|
538
|
-
* @returns True if the server is connected, false otherwise
|
|
539
|
-
*/
|
|
540
|
-
isMCPServerConnected(serverName: string): boolean;
|
|
541
|
-
/**
|
|
542
|
-
* Gets the MCP tools from connected servers
|
|
543
|
-
*/
|
|
544
|
-
getMCPTools(): Promise<ToolMap>;
|
|
545
|
-
}
|
|
546
|
-
export declare const IAgentManagerFactory: Token<IAgentManagerFactory>;
|
|
547
18
|
export interface IAIChatModel extends IChatModel {
|
|
548
19
|
/**
|
|
549
20
|
* A signal emitting when the chat name has changed.
|
|
@@ -597,6 +68,17 @@ export interface IAIChatModel extends IChatModel {
|
|
|
597
68
|
* @param messageId The ID of the queued message to remove
|
|
598
69
|
*/
|
|
599
70
|
removeQueuedMessage(messageId: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Reorders queued messages by their IDs.
|
|
73
|
+
* @param messageIds Array of message IDs in the desired order
|
|
74
|
+
*/
|
|
75
|
+
reorderQueuedMessages(messageIds: string[]): void;
|
|
76
|
+
/**
|
|
77
|
+
* Edits a queued message by its ID.
|
|
78
|
+
* @param messageId The ID of the queued message to edit
|
|
79
|
+
* @param newBody The new body of the message
|
|
80
|
+
*/
|
|
81
|
+
editQueuedMessage(messageId: string, newBody: string): void;
|
|
600
82
|
/**
|
|
601
83
|
* The current message queue
|
|
602
84
|
*/
|
|
@@ -650,117 +132,13 @@ export interface ICreateChatOptions {
|
|
|
650
132
|
*/
|
|
651
133
|
export declare const IChatModelHandler: Token<IChatModelHandler>;
|
|
652
134
|
/**
|
|
653
|
-
*
|
|
654
|
-
|
|
655
|
-
export interface IShowCellDiffParams {
|
|
656
|
-
/**
|
|
657
|
-
* Original cell content
|
|
658
|
-
*/
|
|
659
|
-
original: string;
|
|
660
|
-
/**
|
|
661
|
-
* Modified cell content
|
|
662
|
-
*/
|
|
663
|
-
modified: string;
|
|
664
|
-
/**
|
|
665
|
-
* Optional cell ID
|
|
666
|
-
*/
|
|
667
|
-
cellId?: string;
|
|
668
|
-
/**
|
|
669
|
-
* Whether to show action buttons in the diff view
|
|
670
|
-
*/
|
|
671
|
-
showActionButtons?: boolean;
|
|
672
|
-
/**
|
|
673
|
-
* Whether to open the diff view
|
|
674
|
-
*/
|
|
675
|
-
openDiff?: boolean;
|
|
676
|
-
/**
|
|
677
|
-
* Optional path to the notebook
|
|
678
|
-
*/
|
|
679
|
-
notebookPath?: string;
|
|
680
|
-
}
|
|
681
|
-
/**
|
|
682
|
-
* Parameters for showing file diff
|
|
135
|
+
* Interface for the AI settings model with JupyterLab-specific features.
|
|
136
|
+
* Extends the base IAISettingsModel from @jupyternaut/agent which already includes VDomRenderer.IModel.
|
|
683
137
|
*/
|
|
684
|
-
export interface
|
|
685
|
-
/**
|
|
686
|
-
* Original file content
|
|
687
|
-
*/
|
|
688
|
-
original: string;
|
|
689
|
-
/**
|
|
690
|
-
* Modified file content
|
|
691
|
-
*/
|
|
692
|
-
modified: string;
|
|
693
|
-
/**
|
|
694
|
-
* Optional file path
|
|
695
|
-
*/
|
|
696
|
-
filePath?: string;
|
|
697
|
-
/**
|
|
698
|
-
* Whether to show action buttons in the diff view
|
|
699
|
-
*/
|
|
700
|
-
showActionButtons?: boolean;
|
|
138
|
+
export interface IAISettingsModel extends IBaseAISettingsModel {
|
|
701
139
|
}
|
|
702
140
|
/**
|
|
703
|
-
*
|
|
704
|
-
*/
|
|
705
|
-
export interface IDiffManager {
|
|
706
|
-
/**
|
|
707
|
-
* Show diff between original and modified cell content
|
|
708
|
-
*/
|
|
709
|
-
showCellDiff(params: IShowCellDiffParams): Promise<void>;
|
|
710
|
-
/**
|
|
711
|
-
* Show diff between original and modified file content
|
|
712
|
-
*/
|
|
713
|
-
showFileDiff(params: IShowFileDiffParams): Promise<void>;
|
|
714
|
-
}
|
|
715
|
-
/**
|
|
716
|
-
* Token for the diff manager.
|
|
717
|
-
*/
|
|
718
|
-
export declare const IDiffManager: Token<IDiffManager>;
|
|
719
|
-
/**
|
|
720
|
-
* Interface for token usage statistics from AI model interactions
|
|
721
|
-
*/
|
|
722
|
-
export interface ITokenUsage {
|
|
723
|
-
/**
|
|
724
|
-
* Number of input tokens consumed (prompt tokens)
|
|
725
|
-
*/
|
|
726
|
-
inputTokens: number;
|
|
727
|
-
/**
|
|
728
|
-
* Number of output tokens generated (completion tokens)
|
|
729
|
-
*/
|
|
730
|
-
outputTokens: number;
|
|
731
|
-
/**
|
|
732
|
-
* Estimated prompt tokens used by the most recent model request.
|
|
733
|
-
* This is based on the final step of the latest request.
|
|
734
|
-
*/
|
|
735
|
-
lastRequestInputTokens?: number;
|
|
736
|
-
/**
|
|
737
|
-
* Configured context window size for the active provider/model.
|
|
738
|
-
*/
|
|
739
|
-
contextWindow?: number;
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* The string that replaces a secret key in settings.
|
|
743
|
-
*/
|
|
744
|
-
export declare const SECRETS_NAMESPACE = "@jupyterlite/ai:providers";
|
|
745
|
-
export declare const SECRETS_REPLACEMENT = "***";
|
|
746
|
-
/**
|
|
747
|
-
* Internal interface for AI provider secret access within the shared namespace.
|
|
141
|
+
* Token for the AI settings model.
|
|
748
142
|
*/
|
|
749
|
-
export
|
|
750
|
-
|
|
751
|
-
* Whether secrets access is currently available.
|
|
752
|
-
*/
|
|
753
|
-
readonly isAvailable: boolean;
|
|
754
|
-
/**
|
|
755
|
-
* Get a secret value by ID.
|
|
756
|
-
*/
|
|
757
|
-
get(id: string): Promise<string | undefined>;
|
|
758
|
-
/**
|
|
759
|
-
* Set a secret value by ID.
|
|
760
|
-
*/
|
|
761
|
-
set(id: string, value: string): Promise<void>;
|
|
762
|
-
/**
|
|
763
|
-
* Attach an input field to a secret ID.
|
|
764
|
-
*/
|
|
765
|
-
attach(id: string, input: HTMLInputElement, callback?: (value: string) => void): Promise<void>;
|
|
766
|
-
}
|
|
143
|
+
export declare const IAISettingsModel: Token<IAISettingsModel>;
|
|
144
|
+
//# sourceMappingURL=tokens.d.ts.map
|