@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.
- 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 +4 -3
- package/lib/chat-model-handler.js +2 -1
- package/lib/chat-model.d.ts +148 -8
- package/lib/chat-model.js +368 -79
- 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 +3 -2
- 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 +50 -59
- package/lib/models/settings-model.d.ts +3 -1
- package/lib/models/settings-model.js +1 -0
- package/lib/rendered-message-outputarea.d.ts +1 -0
- package/lib/tokens.d.ts +48 -597
- package/lib/tokens.js +2 -31
- package/lib/widgets/ai-settings.d.ts +3 -1
- package/lib/widgets/ai-settings.js +185 -344
- package/lib/widgets/main-area-chat.d.ts +3 -3
- package/lib/widgets/main-area-chat.js +2 -4
- 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/schema/settings-model.json +6 -0
- package/src/chat-commands/skills.ts +2 -2
- package/src/chat-model-handler.ts +10 -6
- package/src/chat-model.ts +488 -96
- 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/save-button.tsx +3 -3
- 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 +103 -107
- package/src/models/settings-model.ts +7 -6
- package/src/tokens.ts +54 -744
- package/src/widgets/ai-settings.tsx +40 -11
- package/src/widgets/main-area-chat.ts +5 -8
- package/src/widgets/provider-config-dialog.tsx +8 -8
- package/LICENSE +0 -30
- package/README.md +0 -49
- package/lib/agent.d.ts +0 -277
- package/lib/agent.js +0 -1116
- 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-context-windows.d.ts +0 -8
- package/lib/providers/generated-context-windows.js +0 -96
- package/lib/providers/model-info.d.ts +0 -3
- package/lib/providers/model-info.js +0 -58
- 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 -1441
- package/src/icons.ts +0 -11
- package/src/providers/built-in-providers.ts +0 -241
- package/src/providers/generated-context-windows.ts +0 -102
- package/src/providers/model-info.ts +0 -88
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { ISkillRegistry } from '@jupyternaut/agent';
|
|
1
2
|
import { ChatCommand, IChatCommandProvider, IInputModel } from '@jupyter/chat';
|
|
2
3
|
import { CommandRegistry } from '@lumino/commands';
|
|
3
|
-
import { ISkillRegistry } from '../tokens';
|
|
4
4
|
export declare class SkillsCommandProvider implements IChatCommandProvider {
|
|
5
5
|
constructor(options: SkillsCommandProvider.IOptions);
|
|
6
6
|
id: string;
|
|
@@ -17,3 +17,4 @@ export declare namespace SkillsCommandProvider {
|
|
|
17
17
|
commands: CommandRegistry;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import type { IAgentManagerFactory, IProviderRegistry, IToolRegistry } from '@jupyternaut/agent';
|
|
1
2
|
import { ActiveCellManager } from '@jupyter/chat';
|
|
2
3
|
import { IDocumentManager } from '@jupyterlab/docmanager';
|
|
3
4
|
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
4
5
|
import { Contents } from '@jupyterlab/services';
|
|
5
|
-
import {
|
|
6
|
-
import type { IAgentManagerFactory, IAISettingsModel, IChatModelHandler, ICreateChatOptions, IProviderRegistry, IToolRegistry } from './tokens';
|
|
6
|
+
import type { IAIChatModel, IAISettingsModel, IChatModelHandler, ICreateChatOptions } from './tokens';
|
|
7
7
|
/**
|
|
8
8
|
* The chat model handler.
|
|
9
9
|
*/
|
|
10
10
|
export declare class ChatModelHandler implements IChatModelHandler {
|
|
11
11
|
constructor(options: ChatModelHandler.IOptions);
|
|
12
|
-
createModel(options: ICreateChatOptions):
|
|
12
|
+
createModel(options: ICreateChatOptions): IAIChatModel;
|
|
13
13
|
/**
|
|
14
14
|
* Getter/setter for the active cell manager.
|
|
15
15
|
*/
|
|
@@ -60,3 +60,4 @@ export declare namespace ChatModelHandler {
|
|
|
60
60
|
contentsManager?: Contents.IManager;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
//# sourceMappingURL=chat-model-handler.d.ts.map
|
|
@@ -31,7 +31,8 @@ export class ChatModelHandler {
|
|
|
31
31
|
agentManager,
|
|
32
32
|
activeCellManager: this._activeCellManager,
|
|
33
33
|
documentManager: this._docManager,
|
|
34
|
-
contentsManager: this._contentsManager
|
|
34
|
+
contentsManager: this._contentsManager,
|
|
35
|
+
providerRegistry: this._providerRegistry
|
|
35
36
|
});
|
|
36
37
|
messages?.forEach(message => {
|
|
37
38
|
model.messageAdded({ ...message.content });
|
package/lib/chat-model.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { AbstractChatModel, IActiveCellManager, IAttachment, IChatContext, IMessageContent, INewMessage, IUser } from '@jupyter/chat';
|
|
1
|
+
import { AbstractChatModel, IActiveCellManager, IAttachment, IChatContext, IMessageContent, IMimeModelBody, INewMessage, IUser } from '@jupyter/chat';
|
|
2
2
|
import { IDocumentManager } from '@jupyterlab/docmanager';
|
|
3
|
+
import * as nbformat from '@jupyterlab/nbformat';
|
|
3
4
|
import { Contents } from '@jupyterlab/services';
|
|
5
|
+
import type { IAgentManager, IProviderRegistry, ITokenUsage } from '@jupyternaut/agent';
|
|
4
6
|
import { ISignal } from '@lumino/signaling';
|
|
5
|
-
import type {
|
|
7
|
+
import type { UserContent } from 'ai';
|
|
8
|
+
import type { IAIChatModel, IAISettingsModel } from './tokens';
|
|
6
9
|
/**
|
|
7
10
|
* AI Chat Model implementation that provides chat functionality tool integration,
|
|
8
11
|
* and MCP server support.
|
|
9
12
|
*/
|
|
10
|
-
export declare class AIChatModel extends AbstractChatModel {
|
|
13
|
+
export declare class AIChatModel extends AbstractChatModel implements IAIChatModel {
|
|
11
14
|
/**
|
|
12
15
|
* Constructs a new AIChatModel instance.
|
|
13
16
|
* @param options Configuration options for the chat model
|
|
@@ -21,7 +24,7 @@ export declare class AIChatModel extends AbstractChatModel {
|
|
|
21
24
|
/**
|
|
22
25
|
* A signal emitting when the chat name has changed.
|
|
23
26
|
*/
|
|
24
|
-
get nameChanged(): ISignal<
|
|
27
|
+
get nameChanged(): ISignal<IAIChatModel, string>;
|
|
25
28
|
/**
|
|
26
29
|
* The title of the chat.
|
|
27
30
|
*/
|
|
@@ -30,7 +33,7 @@ export declare class AIChatModel extends AbstractChatModel {
|
|
|
30
33
|
/**
|
|
31
34
|
* A signal emitting when the chat title has changed.
|
|
32
35
|
*/
|
|
33
|
-
get titleChanged(): ISignal<
|
|
36
|
+
get titleChanged(): ISignal<IAIChatModel, string | null>;
|
|
34
37
|
/**
|
|
35
38
|
* Whether to save the chat automatically.
|
|
36
39
|
*/
|
|
@@ -39,7 +42,7 @@ export declare class AIChatModel extends AbstractChatModel {
|
|
|
39
42
|
/**
|
|
40
43
|
* A signal emitting when the autosave flag changed.
|
|
41
44
|
*/
|
|
42
|
-
get autosaveChanged(): ISignal<
|
|
45
|
+
get autosaveChanged(): ISignal<IAIChatModel, boolean>;
|
|
43
46
|
/**
|
|
44
47
|
* Gets the current user information.
|
|
45
48
|
*/
|
|
@@ -49,7 +52,7 @@ export declare class AIChatModel extends AbstractChatModel {
|
|
|
49
52
|
*/
|
|
50
53
|
get tokenUsageChanged(): ISignal<IAgentManager, ITokenUsage>;
|
|
51
54
|
/**
|
|
52
|
-
*
|
|
55
|
+
* The agent manager used in the model.
|
|
53
56
|
*/
|
|
54
57
|
get agentManager(): IAgentManager;
|
|
55
58
|
/**
|
|
@@ -72,15 +75,51 @@ export declare class AIChatModel extends AbstractChatModel {
|
|
|
72
75
|
* Clears all messages from the chat and resets conversation state.
|
|
73
76
|
*/
|
|
74
77
|
clearMessages: () => Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Overrides messageAdded to ensure queued messages stay at the bottom.
|
|
80
|
+
*/
|
|
81
|
+
messageAdded(message: IMessageContent): void;
|
|
75
82
|
/**
|
|
76
83
|
* Adds a non-user message to the chat (used by chat commands).
|
|
77
84
|
*/
|
|
78
|
-
|
|
85
|
+
private _addSystemMessage;
|
|
79
86
|
/**
|
|
80
87
|
* Sends a message to the AI and generates a response.
|
|
81
88
|
* @param message The user message to send
|
|
82
89
|
*/
|
|
83
90
|
sendMessage(message: INewMessage): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Internal method to process attachments and send the message to the agent.
|
|
93
|
+
*/
|
|
94
|
+
private _processMessage;
|
|
95
|
+
/**
|
|
96
|
+
* Removes the message-queue chat component.
|
|
97
|
+
*/
|
|
98
|
+
private _removeQueueUI;
|
|
99
|
+
/**
|
|
100
|
+
* Creates or updates the message-queue chat component.
|
|
101
|
+
*/
|
|
102
|
+
private _updateQueueUI;
|
|
103
|
+
/**
|
|
104
|
+
* Processes the next message in the queue, or marks the agent as idle.
|
|
105
|
+
*/
|
|
106
|
+
private _drainQueue;
|
|
107
|
+
/**
|
|
108
|
+
* Removes a queued message by its ID.
|
|
109
|
+
* @param messageId The ID of the queued message to remove
|
|
110
|
+
*/
|
|
111
|
+
removeQueuedMessage(messageId: string): void;
|
|
112
|
+
/**
|
|
113
|
+
* Reorders queued messages by their IDs.
|
|
114
|
+
* @param messageIds Array of message IDs in the desired order
|
|
115
|
+
*/
|
|
116
|
+
reorderQueuedMessages(messageIds: string[]): void;
|
|
117
|
+
/**
|
|
118
|
+
* Edits a queued message by its ID.
|
|
119
|
+
* @param messageId The ID of the queued message to edit
|
|
120
|
+
* @param newBody The new body of the message
|
|
121
|
+
*/
|
|
122
|
+
editQueuedMessage(messageId: string, newBody: string): void;
|
|
84
123
|
/**
|
|
85
124
|
* Save the chat as json file.
|
|
86
125
|
*/
|
|
@@ -108,6 +147,16 @@ export declare class AIChatModel extends AbstractChatModel {
|
|
|
108
147
|
* Handles settings changes and updates chat configuration accordingly.
|
|
109
148
|
*/
|
|
110
149
|
private _onSettingsChanged;
|
|
150
|
+
/**
|
|
151
|
+
* Rebuild history when the active model changes.
|
|
152
|
+
*/
|
|
153
|
+
private _onModelChanged;
|
|
154
|
+
/**
|
|
155
|
+
* Rebuilds the agent history from the current messages.
|
|
156
|
+
* For vision-capable models, re-reads binary attachments from disk.
|
|
157
|
+
* For text-only models, uses message text only.
|
|
158
|
+
*/
|
|
159
|
+
private _rebuildHistory;
|
|
111
160
|
/**
|
|
112
161
|
* Handles events emitted by the agent manager.
|
|
113
162
|
* @param event The event data containing type and payload
|
|
@@ -168,19 +217,92 @@ export declare class AIChatModel extends AbstractChatModel {
|
|
|
168
217
|
* Updates a tool call's UI with new status and optional output.
|
|
169
218
|
*/
|
|
170
219
|
private _updateToolCallUI;
|
|
220
|
+
/**
|
|
221
|
+
* The current message queue
|
|
222
|
+
*/
|
|
223
|
+
get messageQueue(): Private.IQueuedItem[];
|
|
224
|
+
set messageQueue(value: Private.IQueuedItem[]);
|
|
225
|
+
/**
|
|
226
|
+
* Whether the chat is busy
|
|
227
|
+
*/
|
|
228
|
+
get isBusy(): boolean;
|
|
229
|
+
set isBusy(value: boolean);
|
|
171
230
|
private _settingsModel;
|
|
172
231
|
private _user;
|
|
173
232
|
private _toolContexts;
|
|
174
233
|
private _agentManager;
|
|
234
|
+
private _providerRegistry?;
|
|
235
|
+
private _currentModelKey;
|
|
175
236
|
private _currentStreamingMessage;
|
|
176
237
|
private _nameChanged;
|
|
177
238
|
private _contentsManager?;
|
|
178
239
|
private _autosave;
|
|
179
240
|
private _autosaveChanged;
|
|
180
241
|
private _autosaveDebouncer;
|
|
242
|
+
private _messageQueue;
|
|
243
|
+
private _isBusy;
|
|
244
|
+
private _queueMessageId;
|
|
181
245
|
private _title;
|
|
182
246
|
private _titleChanged;
|
|
183
247
|
}
|
|
248
|
+
declare namespace Private {
|
|
249
|
+
export interface IQueuedItem {
|
|
250
|
+
id: string;
|
|
251
|
+
body: string;
|
|
252
|
+
_originalMsg: IMessageContent;
|
|
253
|
+
}
|
|
254
|
+
type IDisplayOutput = nbformat.IDisplayData | nbformat.IDisplayUpdate | nbformat.IExecuteResult;
|
|
255
|
+
export const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
256
|
+
export const isDisplayOutput: (value: unknown) => value is IDisplayOutput;
|
|
257
|
+
export const toMimeBundle: (value: IDisplayOutput, trustedMimeTypes: ReadonlySet<string>) => IMimeModelBody | null;
|
|
258
|
+
/**
|
|
259
|
+
* Normalize arbitrary tool payloads into canonical display outputs.
|
|
260
|
+
*
|
|
261
|
+
* Tool outputs are not guaranteed to be raw Jupyter IOPub messages; they are
|
|
262
|
+
* often wrapped objects (for example `{ success, result: { outputs: [...] } }`).
|
|
263
|
+
*/
|
|
264
|
+
export const toDisplayOutputs: (value: unknown) => IDisplayOutput[];
|
|
265
|
+
/**
|
|
266
|
+
* Extract rendermime-ready mime bundles from arbitrary tool results.
|
|
267
|
+
*/
|
|
268
|
+
export function extractMimeBundlesFromUnknown(content: unknown, options?: {
|
|
269
|
+
trustedMimeTypes?: ReadonlyArray<string>;
|
|
270
|
+
}): IMimeModelBody[];
|
|
271
|
+
export function formatToolOutput(outputData: unknown): string;
|
|
272
|
+
/**
|
|
273
|
+
* Processes file attachments and returns the message content with the attachments.
|
|
274
|
+
* @param attachments Array of file attachments to process
|
|
275
|
+
* @param documentManager Optional document manager for file operations
|
|
276
|
+
* @param body The message body
|
|
277
|
+
* @param supportsImages Whether the model supports images
|
|
278
|
+
* @param supportsPdf Whether the model supports pdfs
|
|
279
|
+
* @param supportsAudio Whether the model supports audio
|
|
280
|
+
* @returns Enhanced message content
|
|
281
|
+
*/
|
|
282
|
+
export function processAttachments(attachments: IAttachment[], documentManager: IDocumentManager | null | undefined, body: string, supportsImages: boolean, supportsPdf: boolean, supportsAudio: boolean): Promise<UserContent>;
|
|
283
|
+
/**
|
|
284
|
+
* Reads a binary attachment and returns its base64-encoded content.
|
|
285
|
+
* @param attachment The attachment to read
|
|
286
|
+
* @param documentManager Optional document manager for file operations
|
|
287
|
+
* @returns Base64 string or null if unable to read
|
|
288
|
+
*/
|
|
289
|
+
export function readBinaryAttachment(attachment: IAttachment, documentManager: IDocumentManager | null | undefined): Promise<string | null>;
|
|
290
|
+
/**
|
|
291
|
+
* Reads the content of a notebook cell.
|
|
292
|
+
* @param attachment The notebook attachment to read
|
|
293
|
+
* @param documentManager Optional document manager for file operations
|
|
294
|
+
* @returns Cell content as string or null if unable to read
|
|
295
|
+
*/
|
|
296
|
+
export function readNotebookCells(attachment: IAttachment, documentManager: IDocumentManager | null | undefined): Promise<string | null>;
|
|
297
|
+
/**
|
|
298
|
+
* Reads the content of a file attachment.
|
|
299
|
+
* @param attachment The file attachment to read
|
|
300
|
+
* @param documentManager Optional document manager for file operations
|
|
301
|
+
* @returns File content as string or null if unable to read
|
|
302
|
+
*/
|
|
303
|
+
export function readFileAttachment(attachment: IAttachment, documentManager: IDocumentManager | null | undefined): Promise<string | null>;
|
|
304
|
+
export {};
|
|
305
|
+
}
|
|
184
306
|
/**
|
|
185
307
|
* Namespace containing types and interfaces for AIChatModel.
|
|
186
308
|
*/
|
|
@@ -213,6 +335,10 @@ export declare namespace AIChatModel {
|
|
|
213
335
|
* The contents manager.
|
|
214
336
|
*/
|
|
215
337
|
contentsManager?: Contents.IManager;
|
|
338
|
+
/**
|
|
339
|
+
* Optional provider registry for model capability lookups.
|
|
340
|
+
*/
|
|
341
|
+
providerRegistry?: IProviderRegistry;
|
|
216
342
|
/**
|
|
217
343
|
* Whether to restore or not the message (default to true)
|
|
218
344
|
*/
|
|
@@ -238,6 +364,18 @@ export declare namespace AIChatModel {
|
|
|
238
364
|
* The agent manager of the chat.
|
|
239
365
|
*/
|
|
240
366
|
agentManager: IAgentManager;
|
|
367
|
+
/**
|
|
368
|
+
* Removes a queued message by its ID.
|
|
369
|
+
*/
|
|
370
|
+
removeQueuedMessage: (id: string) => void;
|
|
371
|
+
/**
|
|
372
|
+
* Reorders queued messages by their IDs.
|
|
373
|
+
*/
|
|
374
|
+
reorderQueuedMessages: (ids: string[]) => void;
|
|
375
|
+
/**
|
|
376
|
+
* Edits a queued message by its ID.
|
|
377
|
+
*/
|
|
378
|
+
editQueuedMessage: (id: string, body: string) => void;
|
|
241
379
|
}
|
|
242
380
|
/**
|
|
243
381
|
* The exported chat format.
|
|
@@ -278,3 +416,5 @@ export declare namespace AIChatModel {
|
|
|
278
416
|
};
|
|
279
417
|
};
|
|
280
418
|
}
|
|
419
|
+
export {};
|
|
420
|
+
//# sourceMappingURL=chat-model.d.ts.map
|