@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.
Files changed (108) 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 +3 -1
  5. package/lib/chat-model.d.ts +46 -8
  6. package/lib/chat-model.js +51 -21
  7. package/lib/completion/completion-provider.d.ts +3 -1
  8. package/lib/completion/completion-provider.js +1 -2
  9. package/lib/completion/index.d.ts +1 -0
  10. package/lib/components/clear-button.d.ts +1 -0
  11. package/lib/components/clear-button.js +3 -4
  12. package/lib/components/completion-status.d.ts +1 -0
  13. package/lib/components/completion-status.js +5 -4
  14. package/lib/components/index.d.ts +1 -0
  15. package/lib/components/model-select.d.ts +1 -0
  16. package/lib/components/model-select.js +62 -67
  17. package/lib/components/save-button.d.ts +1 -0
  18. package/lib/components/save-button.js +4 -5
  19. package/lib/components/stop-button.d.ts +1 -0
  20. package/lib/components/stop-button.js +3 -4
  21. package/lib/components/tool-select.d.ts +3 -1
  22. package/lib/components/tool-select.js +47 -60
  23. package/lib/components/usage-display.d.ts +4 -2
  24. package/lib/components/usage-display.js +50 -61
  25. package/lib/diff-manager.d.ts +3 -1
  26. package/lib/index.d.ts +3 -2
  27. package/lib/index.js +28 -17
  28. package/lib/models/settings-model.d.ts +3 -1
  29. package/lib/rendered-message-outputarea.d.ts +1 -0
  30. package/lib/tokens.d.ts +18 -640
  31. package/lib/tokens.js +2 -31
  32. package/lib/widgets/ai-settings.d.ts +3 -1
  33. package/lib/widgets/ai-settings.js +185 -349
  34. package/lib/widgets/main-area-chat.d.ts +1 -0
  35. package/lib/widgets/provider-config-dialog.d.ts +2 -1
  36. package/lib/widgets/provider-config-dialog.js +102 -167
  37. package/package.json +111 -258
  38. package/src/chat-commands/skills.ts +2 -2
  39. package/src/chat-model-handler.ts +6 -4
  40. package/src/chat-model.ts +66 -19
  41. package/src/completion/completion-provider.ts +6 -6
  42. package/src/components/clear-button.tsx +0 -2
  43. package/src/components/completion-status.tsx +2 -2
  44. package/src/components/model-select.tsx +1 -1
  45. package/src/components/stop-button.tsx +0 -2
  46. package/src/components/tool-select.tsx +10 -9
  47. package/src/components/usage-display.tsx +4 -2
  48. package/src/diff-manager.ts +4 -3
  49. package/src/index.ts +62 -44
  50. package/src/models/settings-model.ts +6 -6
  51. package/src/tokens.ts +23 -788
  52. package/src/widgets/ai-settings.tsx +14 -11
  53. package/src/widgets/provider-config-dialog.tsx +8 -8
  54. package/LICENSE +0 -30
  55. package/README.md +0 -49
  56. package/lib/agent.d.ts +0 -280
  57. package/lib/agent.js +0 -1103
  58. package/lib/icons.d.ts +0 -3
  59. package/lib/icons.js +0 -8
  60. package/lib/providers/built-in-providers.d.ts +0 -21
  61. package/lib/providers/built-in-providers.js +0 -233
  62. package/lib/providers/generated-model-info.d.ts +0 -8
  63. package/lib/providers/generated-model-info.js +0 -502
  64. package/lib/providers/model-info.d.ts +0 -6
  65. package/lib/providers/model-info.js +0 -91
  66. package/lib/providers/models.d.ts +0 -37
  67. package/lib/providers/models.js +0 -28
  68. package/lib/providers/provider-registry.d.ts +0 -49
  69. package/lib/providers/provider-registry.js +0 -72
  70. package/lib/providers/provider-tools.d.ts +0 -36
  71. package/lib/providers/provider-tools.js +0 -93
  72. package/lib/skills/index.d.ts +0 -4
  73. package/lib/skills/index.js +0 -7
  74. package/lib/skills/parse-skill.d.ts +0 -25
  75. package/lib/skills/parse-skill.js +0 -69
  76. package/lib/skills/skill-loader.d.ts +0 -25
  77. package/lib/skills/skill-loader.js +0 -133
  78. package/lib/skills/skill-registry.d.ts +0 -31
  79. package/lib/skills/skill-registry.js +0 -100
  80. package/lib/skills/types.d.ts +0 -29
  81. package/lib/skills/types.js +0 -5
  82. package/lib/tools/commands.d.ts +0 -11
  83. package/lib/tools/commands.js +0 -154
  84. package/lib/tools/skills.d.ts +0 -9
  85. package/lib/tools/skills.js +0 -73
  86. package/lib/tools/tool-registry.d.ts +0 -35
  87. package/lib/tools/tool-registry.js +0 -55
  88. package/lib/tools/web.d.ts +0 -8
  89. package/lib/tools/web.js +0 -196
  90. package/src/agent.ts +0 -1431
  91. package/src/icons.ts +0 -11
  92. package/src/providers/built-in-providers.ts +0 -241
  93. package/src/providers/generated-model-info.ts +0 -508
  94. package/src/providers/model-info.ts +0 -145
  95. package/src/providers/models.ts +0 -76
  96. package/src/providers/provider-registry.ts +0 -88
  97. package/src/providers/provider-tools.ts +0 -179
  98. package/src/skills/index.ts +0 -14
  99. package/src/skills/parse-skill.ts +0 -91
  100. package/src/skills/skill-loader.ts +0 -175
  101. package/src/skills/skill-registry.ts +0 -137
  102. package/src/skills/types.ts +0 -37
  103. package/src/tools/commands.ts +0 -210
  104. package/src/tools/skills.ts +0 -84
  105. package/src/tools/tool-registry.ts +0 -63
  106. package/src/tools/web.ts +0 -238
  107. package/src/types.d.ts +0 -4
  108. package/style/icons/jupyternaut-lite.svg +0 -7
@@ -1,3 +1,11 @@
1
+ import { createProviderTools } from '@jupyternaut/agent';
2
+
3
+ import type {
4
+ INamedTool,
5
+ IProviderRegistry,
6
+ IToolRegistry
7
+ } from '@jupyternaut/agent';
8
+
1
9
  import { InputToolbarRegistry, TooltippedButton } from '@jupyter/chat';
2
10
 
3
11
  import type { TranslationBundle } from '@jupyterlab/translation';
@@ -8,18 +16,11 @@ import CheckIcon from '@mui/icons-material/Check';
8
16
 
9
17
  import { Divider, Menu, MenuItem, Tooltip, Typography } from '@mui/material';
10
18
 
11
- import React, { useCallback, useEffect, useState } from 'react';
19
+ import { useCallback, useEffect, useState } from 'react';
12
20
 
13
21
  import { AIChatModel } from '../chat-model';
14
22
 
15
- import { createProviderTools } from '../providers/provider-tools';
16
-
17
- import type {
18
- IAISettingsModel,
19
- INamedTool,
20
- IProviderRegistry,
21
- IToolRegistry
22
- } from '../tokens';
23
+ import type { IAISettingsModel } from '../tokens';
23
24
 
24
25
  const SELECT_ITEM_CLASS = 'jp-AIToolSelect-item';
25
26
 
@@ -1,8 +1,10 @@
1
+ import type { ITokenUsage } from '@jupyternaut/agent';
1
2
  import { ReactWidget, UseSignal } from '@jupyterlab/ui-components';
2
3
  import type { TranslationBundle } from '@jupyterlab/translation';
3
- import React from 'react';
4
4
  import { ISignal } from '@lumino/signaling';
5
- import type { IAISettingsModel, ITokenUsage } from '../tokens';
5
+ import React from 'react';
6
+
7
+ import type { IAISettingsModel } from '../tokens';
6
8
 
7
9
  /**
8
10
  * Props for the UsageDisplay component.
@@ -1,10 +1,11 @@
1
- import { CommandRegistry } from '@lumino/commands';
2
1
  import type {
3
- IAISettingsModel,
4
2
  IDiffManager,
5
3
  IShowCellDiffParams,
6
4
  IShowFileDiffParams
7
- } from './tokens';
5
+ } from '@jupyternaut/agent';
6
+ import { CommandRegistry } from '@lumino/commands';
7
+
8
+ import type { IAISettingsModel } from './tokens';
8
9
 
9
10
  /**
10
11
  * Command IDs for unified cell diffs
package/src/index.ts CHANGED
@@ -1,3 +1,29 @@
1
+ import {
2
+ anthropicProvider,
3
+ createBrowserFetchTool,
4
+ createDiscoverCommandsTool,
5
+ createDiscoverSkillsTool,
6
+ createExecuteCommandTool,
7
+ createLoadSkillTool,
8
+ genericProvider,
9
+ googleProvider,
10
+ loadSkillsFromPaths,
11
+ mistralProvider,
12
+ openaiProvider,
13
+ AgentManagerFactory,
14
+ IAgentManagerFactory,
15
+ IDiffManager,
16
+ IProviderRegistry,
17
+ IToolRegistry,
18
+ ISkillRegistry,
19
+ ProviderRegistry,
20
+ SECRETS_NAMESPACE,
21
+ SkillRegistry,
22
+ ToolRegistry
23
+ } from '@jupyternaut/agent';
24
+
25
+ import type { IAISecretsAccess, IProviderConfig } from '@jupyternaut/agent';
26
+
1
27
  import {
2
28
  ILabShell,
3
29
  ILayoutRestorer,
@@ -68,43 +94,23 @@ import { IComponentsRendererFactory } from 'jupyter-chat-components';
68
94
 
69
95
  import { ISecretsManager, SecretsManager } from 'jupyter-secrets-manager';
70
96
 
71
- import { AgentManagerFactory } from './agent';
72
-
73
97
  import { RenderedMessageOutputAreaCompat } from './rendered-message-outputarea';
74
98
 
75
99
  import { ClearCommandProvider } from './chat-commands/clear';
76
100
 
77
101
  import { SkillsCommandProvider } from './chat-commands/skills';
78
102
 
79
- import { ProviderRegistry } from './providers/provider-registry';
80
-
81
103
  import { SaveComponentWidget } from './components/save-button';
82
104
 
83
105
  import { ChatModelHandler } from './chat-model-handler';
84
106
 
85
107
  import {
86
108
  CommandIds,
87
- IAgentManagerFactory,
88
- type IAISecretsAccess,
89
109
  IAISettingsModel,
90
110
  IChatModelHandler,
91
- IDiffManager,
92
- type IProviderConfig,
93
- IProviderRegistry,
94
- IToolRegistry,
95
- ISkillRegistry,
96
- SECRETS_NAMESPACE,
97
111
  IAIChatModel
98
112
  } from './tokens';
99
113
 
100
- import {
101
- anthropicProvider,
102
- googleProvider,
103
- mistralProvider,
104
- openaiProvider,
105
- genericProvider
106
- } from './providers/built-in-providers';
107
-
108
114
  import { AICompletionProvider } from './completion';
109
115
 
110
116
  import {
@@ -118,21 +124,8 @@ import {
118
124
 
119
125
  import { AISettingsModel } from './models/settings-model';
120
126
 
121
- import { loadSkillsFromPaths, SkillRegistry } from './skills';
122
-
123
127
  import { DiffManager } from './diff-manager';
124
128
 
125
- import { ToolRegistry } from './tools/tool-registry';
126
-
127
- import {
128
- createDiscoverCommandsTool,
129
- createExecuteCommandTool
130
- } from './tools/commands';
131
-
132
- import { createDiscoverSkillsTool, createLoadSkillTool } from './tools/skills';
133
-
134
- import { createBrowserFetchTool } from './tools/web';
135
-
136
129
  import { AISettingsWidget } from './widgets/ai-settings';
137
130
 
138
131
  import { MainAreaChat } from './widgets/main-area-chat';
@@ -679,18 +672,44 @@ const plugin: JupyterFrontEndPlugin<IChatTracker> = {
679
672
  }
680
673
 
681
674
  if (chatComponentsFactory) {
682
- chatComponentsFactory.toolCallPermissionDecision =
683
- toolCallPermissionDecision;
675
+ chatComponentsFactory.groupedToolCallCallbacks = {
676
+ ...chatComponentsFactory.groupedToolCallCallbacks,
677
+ toolCallPermissionDecision
678
+ };
684
679
 
685
- chatComponentsFactory.removeQueuedMessage = (
686
- targetId: string,
687
- messageId: string
688
- ) => {
689
- const model = tracker.find(chat => chat.model.name === targetId)?.model;
690
- if (!model) {
691
- return;
680
+ chatComponentsFactory.queueMessageCallbacks = {
681
+ ...chatComponentsFactory.queueMessageCallbacks,
682
+ removeQueuedMessage: (targetId: string, messageId: string) => {
683
+ const model = tracker.find(
684
+ chat => chat.model.name === targetId
685
+ )?.model;
686
+ if (!model) {
687
+ return;
688
+ }
689
+ (model as IAIChatModel).removeQueuedMessage(messageId);
690
+ },
691
+ reorderQueuedMessages: (targetId: string, messageIds: string[]) => {
692
+ const model = tracker.find(
693
+ chat => chat.model.name === targetId
694
+ )?.model;
695
+ if (!model) {
696
+ return;
697
+ }
698
+ (model as IAIChatModel).reorderQueuedMessages(messageIds);
699
+ },
700
+ editQueuedMessage: (
701
+ targetId: string,
702
+ messageId: string,
703
+ newBody: string
704
+ ) => {
705
+ const model = tracker.find(
706
+ chat => chat.model.name === targetId
707
+ )?.model;
708
+ if (!model) {
709
+ return;
710
+ }
711
+ (model as IAIChatModel).editQueuedMessage(messageId, newBody);
692
712
  }
693
- (model as IAIChatModel).removeQueuedMessage(messageId);
694
713
  };
695
714
  }
696
715
 
@@ -1729,4 +1748,3 @@ export default [
1729
1748
 
1730
1749
  // Export extension points for other extensions to use
1731
1750
  export * from './tokens';
1732
- export * from './icons';
@@ -1,12 +1,12 @@
1
- import { VDomModel } from '@jupyterlab/ui-components';
2
- import { ISettingRegistry } from '@jupyterlab/settingregistry';
3
-
4
- import {
1
+ import type {
5
2
  IAIConfig,
6
- IAISettingsModel,
7
3
  IMCPServerConfig,
8
4
  IProviderConfig
9
- } from '../tokens';
5
+ } from '@jupyternaut/agent';
6
+ import { VDomModel } from '@jupyterlab/ui-components';
7
+ import { ISettingRegistry } from '@jupyterlab/settingregistry';
8
+
9
+ import type { IAISettingsModel } from '../tokens';
10
10
 
11
11
  const PLUGIN_ID = '@jupyterlite/ai:settings-model';
12
12