@jupyterlite/ai 0.14.0 → 0.16.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 (64) hide show
  1. package/lib/agent.d.ts +33 -115
  2. package/lib/agent.js +192 -106
  3. package/lib/chat-model-handler.d.ts +9 -11
  4. package/lib/chat-model-handler.js +9 -4
  5. package/lib/chat-model.d.ts +84 -13
  6. package/lib/chat-model.js +214 -136
  7. package/lib/completion/completion-provider.d.ts +2 -3
  8. package/lib/components/completion-status.d.ts +2 -2
  9. package/lib/components/index.d.ts +1 -1
  10. package/lib/components/index.js +1 -1
  11. package/lib/components/model-select.d.ts +3 -3
  12. package/lib/components/save-button.d.ts +31 -0
  13. package/lib/components/save-button.js +41 -0
  14. package/lib/components/tool-select.d.ts +3 -4
  15. package/lib/components/{token-usage-display.d.ts → usage-display.d.ts} +13 -14
  16. package/lib/components/usage-display.js +109 -0
  17. package/lib/diff-manager.d.ts +2 -3
  18. package/lib/index.d.ts +2 -4
  19. package/lib/index.js +186 -28
  20. package/lib/models/settings-model.d.ts +11 -53
  21. package/lib/models/settings-model.js +38 -22
  22. package/lib/providers/built-in-providers.js +22 -36
  23. package/lib/providers/generated-context-windows.d.ts +8 -0
  24. package/lib/providers/generated-context-windows.js +96 -0
  25. package/lib/providers/model-info.d.ts +3 -0
  26. package/lib/providers/model-info.js +58 -0
  27. package/lib/tokens.d.ts +361 -36
  28. package/lib/tokens.js +18 -13
  29. package/lib/tools/commands.d.ts +2 -3
  30. package/lib/widgets/ai-settings.d.ts +3 -5
  31. package/lib/widgets/ai-settings.js +12 -0
  32. package/lib/widgets/main-area-chat.d.ts +2 -3
  33. package/lib/widgets/main-area-chat.js +12 -12
  34. package/lib/widgets/provider-config-dialog.d.ts +1 -2
  35. package/lib/widgets/provider-config-dialog.js +34 -34
  36. package/package.json +17 -10
  37. package/schema/settings-model.json +18 -1
  38. package/src/agent.ts +275 -248
  39. package/src/chat-model-handler.ts +25 -21
  40. package/src/chat-model.ts +307 -196
  41. package/src/completion/completion-provider.ts +7 -4
  42. package/src/components/completion-status.tsx +3 -3
  43. package/src/components/index.ts +1 -1
  44. package/src/components/model-select.tsx +4 -3
  45. package/src/components/save-button.tsx +84 -0
  46. package/src/components/tool-select.tsx +10 -4
  47. package/src/components/usage-display.tsx +208 -0
  48. package/src/diff-manager.ts +4 -4
  49. package/src/index.ts +250 -58
  50. package/src/models/settings-model.ts +46 -88
  51. package/src/providers/built-in-providers.ts +22 -36
  52. package/src/providers/generated-context-windows.ts +102 -0
  53. package/src/providers/model-info.ts +88 -0
  54. package/src/tokens.ts +438 -58
  55. package/src/tools/commands.ts +2 -3
  56. package/src/widgets/ai-settings.tsx +69 -15
  57. package/src/widgets/main-area-chat.ts +18 -15
  58. package/src/widgets/provider-config-dialog.tsx +96 -61
  59. package/style/base.css +17 -195
  60. package/lib/approval-buttons.d.ts +0 -49
  61. package/lib/approval-buttons.js +0 -79
  62. package/lib/components/token-usage-display.js +0 -72
  63. package/src/approval-buttons.ts +0 -115
  64. package/src/components/token-usage-display.tsx +0 -138
package/src/tokens.ts CHANGED
@@ -1,12 +1,13 @@
1
- import { ActiveCellManager } from '@jupyter/chat';
1
+ import { ActiveCellManager, IMessage, IMessageContent } from '@jupyter/chat';
2
+ import { VDomRenderer } from '@jupyterlab/apputils';
3
+ import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
2
4
  import { Token } from '@lumino/coreutils';
3
5
  import type { IDisposable } from '@lumino/disposable';
4
6
  import { ISignal } from '@lumino/signaling';
5
7
  import type { Tool, LanguageModel } from 'ai';
6
- import { AgentManager } from './agent';
7
- import type { AISettingsModel } from './models/settings-model';
8
+ import { ISecretsManager } from 'jupyter-secrets-manager';
9
+
8
10
  import type { IModelOptions } from './providers/models';
9
- import { AgentManagerFactory } from './agent';
10
11
  import { AIChatModel } from './chat-model';
11
12
  import type {
12
13
  ISkillDefinition,
@@ -31,27 +32,20 @@ export namespace CommandIds {
31
32
  export const openChat = '@jupyterlite/ai:open-chat';
32
33
  export const moveChat = '@jupyterlite/ai:move-chat';
33
34
  export const refreshSkills = '@jupyterlite/ai:refresh-skills';
35
+ export const saveChat = '@jupyterlite/ai:save-chat';
36
+ export const restoreChat = '@jupyterlite/ai:restore-chat';
34
37
  }
35
38
 
39
+ /* THE TOOL REGISTRY */
36
40
  /**
37
41
  * Type definition for a tool
38
42
  */
39
43
  export type ITool = Tool;
40
44
 
41
45
  /**
42
- * Interface for token usage statistics from AI model interactions
46
+ * A map containing tools.
43
47
  */
44
- export interface ITokenUsage {
45
- /**
46
- * Number of input tokens consumed (prompt tokens)
47
- */
48
- inputTokens: number;
49
-
50
- /**
51
- * Number of output tokens generated (completion tokens)
52
- */
53
- outputTokens: number;
54
- }
48
+ export type ToolMap = Record<string, ITool>;
55
49
 
56
50
  /**
57
51
  * Interface for a named tool (tool with a name identifier)
@@ -108,10 +102,12 @@ export interface IToolRegistry {
108
102
  * The tool registry token.
109
103
  */
110
104
  export const IToolRegistry = new Token<IToolRegistry>(
111
- '@jupyterlite/ai:tool-registry',
105
+ '@jupyterlite/ai:IToolRegistry',
112
106
  'Tool registry for AI agent functionality'
113
107
  );
114
108
 
109
+ /* THE SKILL REGISTRY */
110
+
115
111
  /**
116
112
  * Registry for skills available to the AI agent.
117
113
  */
@@ -149,17 +145,11 @@ export interface ISkillRegistry {
149
145
  * The skill registry token.
150
146
  */
151
147
  export const ISkillRegistry = new Token<ISkillRegistry>(
152
- '@jupyterlite/ai:skill-registry',
148
+ '@jupyterlite/ai:ISkillRegistry',
153
149
  'Skill registry for AI agent functionality'
154
150
  );
155
151
 
156
- /**
157
- * Token for the provider registry.
158
- */
159
- export const IProviderRegistry = new Token<IProviderRegistry>(
160
- '@jupyterlite/ai:provider-registry',
161
- 'Registry for AI providers'
162
- );
152
+ /* THE LLM PROVIDER REGISTRY */
163
153
 
164
154
  /**
165
155
  * Interface for a provider factory function that creates language models
@@ -214,6 +204,13 @@ export interface IProviderToolCapabilities {
214
204
  /**
215
205
  * Provider information
216
206
  */
207
+ export interface IProviderModelInfo {
208
+ /**
209
+ * Default context window for the model in tokens.
210
+ */
211
+ contextWindow?: number;
212
+ }
213
+
217
214
  export interface IProviderInfo {
218
215
  /**
219
216
  * Unique identifier for the provider
@@ -238,6 +235,11 @@ export interface IProviderInfo {
238
235
  */
239
236
  defaultModels: string[];
240
237
 
238
+ /**
239
+ * Optional per-model metadata keyed by model ID.
240
+ */
241
+ modelInfo?: Record<string, IProviderModelInfo>;
242
+
241
243
  /**
242
244
  * Whether this provider supports custom base URLs
243
245
  */
@@ -317,75 +319,392 @@ export interface IProviderRegistry {
317
319
  getAvailableProviders(): string[];
318
320
  }
319
321
 
322
+ /**
323
+ * Token for the provider registry.
324
+ */
325
+ export const IProviderRegistry = new Token<IProviderRegistry>(
326
+ '@jupyterlite/ai:IProviderRegistry',
327
+ 'Registry for AI providers'
328
+ );
329
+
330
+ /* THE SETTINGS MODEL */
331
+
332
+ export interface IProviderParameters {
333
+ temperature?: number;
334
+ maxOutputTokens?: number;
335
+ maxTurns?: number;
336
+ contextWindow?: number;
337
+ supportsFillInMiddle?: boolean;
338
+ useFilterText?: boolean;
339
+ }
340
+
341
+ export interface IProviderConfig {
342
+ id: string;
343
+ name: string;
344
+ provider: string;
345
+ model: string;
346
+ apiKey?: string;
347
+ baseURL?: string;
348
+ headers?: Record<string, string>;
349
+ parameters?: IProviderParameters;
350
+ customSettings?: Record<string, any>;
351
+ [key: string]: any; // Index signature for JupyterLab settings compatibility
352
+ }
353
+
354
+ export interface IMCPServerConfig {
355
+ id: string;
356
+ name: string;
357
+ url: string;
358
+ enabled: boolean;
359
+ [key: string]: any; // Index signature for JupyterLab settings compatibility
360
+ }
361
+
362
+ export interface IAIConfig {
363
+ // Whether to use the secrets manager
364
+ useSecretsManager: boolean;
365
+ // List of configured providers
366
+ providers: IProviderConfig[];
367
+ // Active provider IDs for different use cases
368
+ defaultProvider: string; // Default provider for chat
369
+ activeCompleterProvider?: string; // Provider for completions (if different)
370
+ // When true, use the same provider for chat and completions
371
+ useSameProviderForChatAndCompleter: boolean;
372
+ // MCP servers configuration
373
+ mcpServers: IMCPServerConfig[];
374
+ // Global settings
375
+ contextAwareness: boolean;
376
+ codeExecution: boolean;
377
+ systemPrompt: string;
378
+ completionSystemPrompt: string;
379
+ toolsEnabled: boolean;
380
+ // Chat behavior settings
381
+ sendWithShiftEnter: boolean;
382
+ // Token usage display setting
383
+ showTokenUsage: boolean;
384
+ // Context usage display setting
385
+ showContextUsage: boolean;
386
+ // Commands that require approval before execution
387
+ commandsRequiringApproval: string[];
388
+ // Commands whose execute_command outputs may auto-render MIME bundles in chat
389
+ commandsAutoRenderMimeBundles: string[];
390
+ // MIME types that are trusted when auto-rendering execute_command outputs
391
+ trustedMimeTypesForAutoRender: string[];
392
+ // Diff display settings
393
+ showCellDiff: boolean;
394
+ showFileDiff: boolean;
395
+ diffDisplayMode: 'split' | 'unified';
396
+ // Paths to directories containing agent skills
397
+ skillsPaths: string[];
398
+ // Directory where chat backups are saved
399
+ chatBackupDirectory: string;
400
+ }
401
+
402
+ export interface IAISettingsModel extends VDomRenderer.IModel {
403
+ readonly config: IAIConfig;
404
+ updateConfig(updates: Partial<IAIConfig>): Promise<void>;
405
+ readonly providers: IProviderConfig[];
406
+ getProvider(id: string): IProviderConfig | undefined;
407
+ getDefaultProvider(): IProviderConfig | undefined;
408
+ getCompleterProvider(): IProviderConfig | undefined;
409
+ addProvider(providerConfig: Omit<IProviderConfig, 'id'>): Promise<string>;
410
+ removeProvider(id: string): Promise<void>;
411
+ updateProvider(id: string, updates: Partial<IProviderConfig>): Promise<void>;
412
+ setActiveProvider(id: string): Promise<void>;
413
+ setActiveCompleterProvider(id: string | undefined): Promise<void>;
414
+ readonly mcpServers: IMCPServerConfig[];
415
+ getMCPServer(id: string): IMCPServerConfig | undefined;
416
+ addMCPServer(serverConfig: Omit<IMCPServerConfig, 'id'>): Promise<string>;
417
+ removeMCPServer(id: string): Promise<void>;
418
+ updateMCPServer(
419
+ id: string,
420
+ updates: Partial<IMCPServerConfig>
421
+ ): Promise<void>;
422
+ /**
423
+ * Get the API key saved in the settings file for a given provider.
424
+ *
425
+ * @param id - the id of the provider.
426
+ */
427
+ getApiKey(id: string): string;
428
+ }
429
+
320
430
  /**
321
431
  * Token for the AI settings model.
322
432
  */
323
- export const IAISettingsModel = new Token<AISettingsModel>(
433
+ export const IAISettingsModel = new Token<IAISettingsModel>(
324
434
  '@jupyterlite/ai:IAISettingsModel'
325
435
  );
326
436
 
437
+ /* THE AGENT MANAGER */
438
+
327
439
  /**
328
- * Internal interface for AI provider secret access within the shared namespace.
440
+ * A namespace for agent manager.
329
441
  */
330
- export interface IAISecretsAccess {
442
+ export namespace IAgentManager {
443
+ /**
444
+ * Configuration options for the AgentManager
445
+ */
446
+ export interface IOptions {
447
+ /**
448
+ * AI settings model for configuration
449
+ */
450
+ settingsModel: IAISettingsModel;
451
+
452
+ /**
453
+ * Optional tool registry for managing available tools
454
+ */
455
+ toolRegistry?: IToolRegistry;
456
+
457
+ /**
458
+ * Optional provider registry for model creation
459
+ */
460
+ providerRegistry?: IProviderRegistry;
461
+
462
+ /**
463
+ * The skill registry for discovering skills.
464
+ */
465
+ skillRegistry?: ISkillRegistry;
466
+
467
+ /**
468
+ * The secrets manager.
469
+ */
470
+ secretsManager?: ISecretsManager;
471
+
472
+ /**
473
+ * The active provider to use with this agent.
474
+ */
475
+ activeProvider?: string;
476
+
477
+ /**
478
+ * Initial token usage.
479
+ */
480
+ tokenUsage?: ITokenUsage;
481
+
482
+ /**
483
+ * JupyterLab render mime registry for discovering supported MIME types.
484
+ */
485
+ renderMimeRegistry?: IRenderMimeRegistry;
486
+ }
487
+
488
+ /**
489
+ * Event type mapping for type safety with inlined interface definitions
490
+ */
491
+ export interface IAgentEventTypeMap {
492
+ message_start: {
493
+ messageId: string;
494
+ };
495
+ message_chunk: {
496
+ messageId: string;
497
+ chunk: string;
498
+ fullContent: string;
499
+ };
500
+ message_complete: {
501
+ messageId: string;
502
+ content: string;
503
+ };
504
+ tool_call_start: {
505
+ callId: string;
506
+ toolName: string;
507
+ input: string;
508
+ };
509
+ tool_call_complete: {
510
+ callId: string;
511
+ toolName: string;
512
+ outputData: unknown;
513
+ isError: boolean;
514
+ };
515
+ tool_approval_request: {
516
+ approvalId: string;
517
+ toolCallId: string;
518
+ toolName: string;
519
+ args: unknown;
520
+ };
521
+ tool_approval_resolved: {
522
+ approvalId: string;
523
+ approved: boolean;
524
+ };
525
+ error: {
526
+ error: Error;
527
+ };
528
+ }
529
+
530
+ /**
531
+ * Events emitted by the AgentManager
532
+ */
533
+ export type IAgentEvent<
534
+ T extends keyof IAgentEventTypeMap = keyof IAgentEventTypeMap
535
+ > = T extends keyof IAgentEventTypeMap
536
+ ? {
537
+ type: T;
538
+ data: IAgentEventTypeMap[T];
539
+ }
540
+ : never;
541
+ }
542
+
543
+ export interface IAgentManager {
331
544
  /**
332
- * Whether secrets access is currently available.
545
+ * The active provider for this agent.
333
546
  */
334
- readonly isAvailable: boolean;
335
-
547
+ activeProvider: string;
336
548
  /**
337
- * Get a secret value by ID.
549
+ * Signal emitted when agent events occur
338
550
  */
339
- get(id: string): Promise<string | undefined>;
340
-
551
+ readonly agentEvent: ISignal<IAgentManager, IAgentManager.IAgentEvent>;
341
552
  /**
342
- * Set a secret value by ID.
553
+ * Signal emitted when the active provider has changed.
343
554
  */
344
- set(id: string, value: string): Promise<void>;
345
-
555
+ readonly activeProviderChanged: ISignal<IAgentManager, string | undefined>;
346
556
  /**
347
- * Attach an input field to a secret ID.
557
+ * Gets the current token usage statistics.
348
558
  */
349
- attach(
350
- id: string,
351
- input: HTMLInputElement,
352
- callback?: (value: string) => void
353
- ): Promise<void>;
559
+ readonly tokenUsage: ITokenUsage;
560
+ /**
561
+ * Signal emitted when token usage statistics change.
562
+ */
563
+ readonly tokenUsageChanged: ISignal<IAgentManager, ITokenUsage>;
564
+ /**
565
+ * Refresh the skills snapshot and rebuild the agent if resources are ready.
566
+ */
567
+ refreshSkills(): void;
568
+ /**
569
+ * Sets the selected tools by name and reinitializes the agent.
570
+ * @param toolNames Array of tool names to select
571
+ */
572
+ setSelectedTools(toolNames: string[]): void;
573
+ /**
574
+ * Gets the currently selected tools as a record.
575
+ * @returns Record of selected tools
576
+ */
577
+ readonly selectedAgentTools: ToolMap;
578
+ /**
579
+ * Checks if the current configuration is valid for agent operations.
580
+ * Uses the provider registry to determine if an API key is required.
581
+ * @returns True if the configuration is valid, false otherwise
582
+ */
583
+ hasValidConfig(): boolean;
584
+ /**
585
+ * Clears conversation history and resets agent state.
586
+ */
587
+ clearHistory(): void;
588
+ /**
589
+ * Sets the conversation history with a list of messages from the chat.
590
+ * @param messages The chat messages to set as history
591
+ */
592
+ setHistory(messages: IMessageContent[]): void;
593
+ /**
594
+ * Stops the current streaming response by aborting the request.
595
+ */
596
+ stopStreaming(): void;
597
+ /**
598
+ * Approves a pending tool call.
599
+ * @param approvalId The approval ID to approve
600
+ * @param reason Optional reason for approval
601
+ */
602
+ approveToolCall(approvalId: string, reason?: string): void;
603
+ /**
604
+ * Rejects a pending tool call.
605
+ * @param approvalId The approval ID to reject
606
+ * @param reason Optional reason for rejection
607
+ */
608
+ rejectToolCall(approvalId: string, reason?: string): void;
609
+ /**
610
+ * Generates AI response to user message using the agent.
611
+ * Handles the complete execution cycle including tool calls.
612
+ * @param message The user message to respond to (may include processed attachment content)
613
+ */
614
+ generateResponse(message: string): Promise<void>;
615
+ /**
616
+ * Initializes the AI agent with current settings and tools.
617
+ * Sets up the agent with model configuration, tools, and MCP tools.
618
+ */
619
+ initializeAgent(mcpTools?: ToolMap): Promise<void>;
354
620
  }
355
621
 
356
622
  /**
357
623
  * Token for the agent manager.
358
624
  */
359
- export const IAgentManager = new Token<AgentManager>(
360
- '@jupyterlite/ai:agent-manager'
625
+ export const IAgentManager = new Token<IAgentManager>(
626
+ '@jupyterlite/ai:IAgentManager'
361
627
  );
362
628
 
629
+ /* The AGENT MANAGER FACTORY */
363
630
  /**
364
- * The string that replaces a secret key in settings.
631
+ * The interface for a agent manager factory.
365
632
  */
366
- export const SECRETS_NAMESPACE = '@jupyterlite/ai:providers';
367
- export const SECRETS_REPLACEMENT = '***';
633
+ export interface IAgentManagerFactory {
634
+ /**
635
+ * Create a new agent.
636
+ */
637
+ createAgent(options: IAgentManager.IOptions): IAgentManager;
638
+ /**
639
+ * Signal emitted when MCP connection status changes
640
+ */
641
+ readonly mcpConnectionChanged: ISignal<IAgentManagerFactory, boolean>;
642
+ /**
643
+ * Checks whether a specific MCP server is connected.
644
+ * @param serverName The name of the MCP server to check
645
+ * @returns True if the server is connected, false otherwise
646
+ */
647
+ isMCPServerConnected(serverName: string): boolean;
648
+ /**
649
+ * Gets the MCP tools from connected servers
650
+ */
651
+ getMCPTools(): Promise<ToolMap>;
652
+ }
368
653
 
369
654
  /*
370
- * Token for the agent manager registry.
655
+ * Token for the agent manager factory.
371
656
  */
372
- export const IAgentManagerFactory = new Token<AgentManagerFactory>(
373
- '@jupyterlite/ai:agent-manager-factory'
657
+ export const IAgentManagerFactory = new Token<IAgentManagerFactory>(
658
+ '@jupyterlite/ai:IAgentManagerFactory'
374
659
  );
375
660
 
661
+ /* THE CHAT MODELS HANDLER */
662
+
663
+ /**
664
+ * The interface for the chat model handler.
665
+ */
376
666
  export interface IChatModelHandler {
377
- createModel(
378
- name: string,
379
- activeProvider: string,
380
- tokenUsage?: ITokenUsage
381
- ): AIChatModel;
667
+ /**
668
+ * The function to create a new model.
669
+ */
670
+ createModel(options: ICreateChatOptions): AIChatModel;
671
+ /**
672
+ * The active cell manager (to copy code from chat to cell).
673
+ */
382
674
  activeCellManager: ActiveCellManager | undefined;
383
675
  }
384
676
 
677
+ export interface ICreateChatOptions {
678
+ /**
679
+ * The name of the chat.
680
+ */
681
+ name: string;
682
+ /**
683
+ * The id of the active provider of the chat.
684
+ */
685
+ activeProvider: string;
686
+ /**
687
+ * The current token usage in this chat.
688
+ */
689
+ tokenUsage?: ITokenUsage;
690
+ /**
691
+ * The messages to ad by default.
692
+ */
693
+ messages?: IMessage[];
694
+ /**
695
+ * Whether the chat is autosaved or not.
696
+ */
697
+ autosave?: boolean;
698
+ }
699
+ /**
700
+ * Token for the chat model handler.
701
+ */
385
702
  export const IChatModelHandler = new Token<IChatModelHandler>(
386
- '@jupyterlite/ai:chat-model-handler'
703
+ '@jupyterlite/ai:IChatModelHandler'
387
704
  );
388
705
 
706
+ /* THE DIFF MANAGER */
707
+
389
708
  /**
390
709
  * Parameters for showing cell diff
391
710
  */
@@ -456,5 +775,66 @@ export interface IDiffManager {
456
775
  * Token for the diff manager.
457
776
  */
458
777
  export const IDiffManager = new Token<IDiffManager>(
459
- '@jupyterlite/ai:diff-manager'
778
+ '@jupyterlite/ai:IDiffManager'
460
779
  );
780
+
781
+ /**
782
+ * Interface for token usage statistics from AI model interactions
783
+ */
784
+ export interface ITokenUsage {
785
+ /**
786
+ * Number of input tokens consumed (prompt tokens)
787
+ */
788
+ inputTokens: number;
789
+
790
+ /**
791
+ * Number of output tokens generated (completion tokens)
792
+ */
793
+ outputTokens: number;
794
+
795
+ /**
796
+ * Estimated prompt tokens used by the most recent model request.
797
+ * This is based on the final step of the latest request.
798
+ */
799
+ lastRequestInputTokens?: number;
800
+
801
+ /**
802
+ * Configured context window size for the active provider/model.
803
+ */
804
+ contextWindow?: number;
805
+ }
806
+
807
+ /**
808
+ * The string that replaces a secret key in settings.
809
+ */
810
+ export const SECRETS_NAMESPACE = '@jupyterlite/ai:providers';
811
+ export const SECRETS_REPLACEMENT = '***';
812
+
813
+ /**
814
+ * Internal interface for AI provider secret access within the shared namespace.
815
+ */
816
+ export interface IAISecretsAccess {
817
+ /**
818
+ * Whether secrets access is currently available.
819
+ */
820
+ readonly isAvailable: boolean;
821
+
822
+ /**
823
+ * Get a secret value by ID.
824
+ */
825
+ get(id: string): Promise<string | undefined>;
826
+
827
+ /**
828
+ * Set a secret value by ID.
829
+ */
830
+ set(id: string, value: string): Promise<void>;
831
+
832
+ /**
833
+ * Attach an input field to a secret ID.
834
+ */
835
+ attach(
836
+ id: string,
837
+ input: HTMLInputElement,
838
+ callback?: (value: string) => void
839
+ ): Promise<void>;
840
+ }
@@ -2,8 +2,7 @@ import { CommandRegistry } from '@lumino/commands';
2
2
  import { Widget } from '@lumino/widgets';
3
3
  import { tool } from 'ai';
4
4
  import { z } from 'zod';
5
- import { ITool } from '../tokens';
6
- import { AISettingsModel } from '../models/settings-model';
5
+ import type { IAISettingsModel, ITool } from '../tokens';
7
6
 
8
7
  interface ICommandEntry {
9
8
  id: string;
@@ -148,7 +147,7 @@ export function createDiscoverCommandsTool(commands: CommandRegistry): ITool {
148
147
  */
149
148
  export function createExecuteCommandTool(
150
149
  commands: CommandRegistry,
151
- settingsModel: AISettingsModel
150
+ settingsModel: IAISettingsModel
152
151
  ): ITool {
153
152
  return tool({
154
153
  title: 'Execute Command',