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