@datalayer/agent-runtimes 0.0.9 → 0.0.11
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/README.md +2 -1
- package/lib/{examples/components → components}/AgentConfiguration.d.ts +54 -9
- package/lib/components/AgentConfiguration.js +585 -0
- package/lib/{examples/components → components}/FooterMetrics.d.ts +1 -2
- package/lib/{examples/components → components}/Header.d.ts +1 -6
- package/lib/{examples/components → components}/Header.js +5 -39
- package/lib/{examples/components → components}/HeaderControls.d.ts +1 -2
- package/lib/{examples/components → components}/HeaderControls.js +1 -1
- package/lib/{examples/components → components}/LexicalEditor.d.ts +2 -3
- package/lib/{examples/components → components}/LexicalEditor.js +2 -2
- package/lib/components/MainContent.d.ts +34 -0
- package/lib/{examples/components → components}/MainContent.js +18 -9
- package/lib/components/McpServerManager.d.ts +30 -0
- package/lib/components/McpServerManager.js +331 -0
- package/lib/{examples/components → components}/MockFileBrowser.d.ts +1 -2
- package/lib/{examples/components → components}/SessionTabs.d.ts +2 -3
- package/lib/{examples/components → components}/TimeTravel.d.ts +1 -2
- package/lib/components/chat/components/AgentDetails.d.ts +3 -1
- package/lib/components/chat/components/AgentDetails.js +472 -22
- package/lib/components/chat/components/Chat.d.ts +37 -3
- package/lib/components/chat/components/Chat.js +29 -10
- package/lib/components/chat/components/ChatFloating.d.ts +27 -2
- package/lib/components/chat/components/ChatFloating.js +17 -10
- package/lib/components/chat/components/ChatPopupStandalone.js +1 -1
- package/lib/components/chat/components/ChatSidebar.d.ts +1 -1
- package/lib/components/chat/components/ChatStandalone.d.ts +1 -1
- package/lib/components/chat/components/ChatStandalone.js +1 -1
- package/lib/components/chat/components/ContextDistribution.d.ts +70 -6
- package/lib/components/chat/components/ContextDistribution.js +13 -6
- package/lib/components/chat/components/ContextInspector.d.ts +81 -0
- package/lib/components/chat/components/ContextInspector.js +263 -0
- package/lib/components/chat/components/ContextPanel.d.ts +112 -0
- package/lib/components/chat/components/ContextPanel.js +368 -0
- package/lib/components/chat/components/base/ChatBase.d.ts +74 -19
- package/lib/components/chat/components/base/ChatBase.js +296 -37
- package/lib/components/chat/components/index.d.ts +3 -1
- package/lib/components/chat/components/index.js +2 -0
- package/lib/components/chat/extensions/ExtensionRegistry.d.ts +1 -1
- package/lib/components/chat/extensions/index.d.ts +1 -0
- package/lib/components/chat/index.d.ts +3 -3
- package/lib/components/chat/protocols/AGUIAdapter.js +24 -4
- package/lib/components/chat/protocols/VercelAIAdapter.js +35 -1
- package/lib/components/chat/store/chatStore.d.ts +2 -3
- package/lib/components/chat/store/conversationStore.d.ts +83 -0
- package/lib/components/chat/store/conversationStore.js +174 -0
- package/lib/components/chat/store/index.d.ts +2 -1
- package/lib/components/chat/store/index.js +1 -0
- package/lib/components/chat/types/inference.d.ts +17 -0
- package/lib/components/chat/types/protocol.d.ts +10 -0
- package/lib/components/index.d.ts +23 -0
- package/lib/components/index.js +11 -0
- package/lib/config/agents/code-ai/agents.d.ts +25 -0
- package/lib/config/agents/code-ai/agents.js +70 -0
- package/lib/config/agents/code-ai/index.d.ts +1 -0
- package/lib/config/agents/code-ai/index.js +5 -0
- package/lib/config/agents/codemode-paper/agents.d.ts +29 -0
- package/lib/config/agents/codemode-paper/agents.js +288 -0
- package/lib/config/agents/codemode-paper/index.d.ts +1 -0
- package/lib/config/agents/codemode-paper/index.js +5 -0
- package/lib/config/agents/datalayer-ai/agents.d.ts +29 -0
- package/lib/config/agents/datalayer-ai/agents.js +267 -0
- package/lib/config/agents/datalayer-ai/index.d.ts +1 -0
- package/lib/config/agents/datalayer-ai/index.js +5 -0
- package/lib/config/agents/index.d.ts +19 -0
- package/lib/config/agents/index.js +38 -0
- package/lib/config/envvars.d.ts +28 -0
- package/lib/config/envvars.js +115 -0
- package/lib/config/index.d.ts +5 -0
- package/lib/config/index.js +9 -0
- package/lib/config/mcpServers.d.ts +18 -0
- package/lib/config/mcpServers.js +153 -0
- package/lib/config/skills.d.ts +27 -0
- package/lib/config/skills.js +60 -0
- package/lib/{lib → config}/utils.d.ts +1 -1
- package/lib/{lib → config}/utils.js +2 -2
- package/lib/examples/AgentRuntimeLexical2Example.d.ts +1 -0
- package/lib/examples/AgentRuntimeLexical2Example.js +3 -2
- package/lib/examples/AgentRuntimeLexicalExample.d.ts +1 -0
- package/lib/examples/AgentRuntimeLexicalExample.js +5 -3
- package/lib/examples/AgentRuntimeLexicalSidebarExample.d.ts +1 -0
- package/lib/examples/AgentRuntimeLexicalSidebarExample.js +3 -3
- package/lib/examples/AgentRuntimeNotebookExample.js +1 -1
- package/lib/examples/AgentSpaceFormExample.d.ts +2 -2
- package/lib/examples/AgentSpaceFormExample.js +215 -35
- package/lib/examples/CopilotKitLexicalExample.d.ts +1 -0
- package/lib/examples/CopilotKitLexicalExample.js +3 -2
- package/lib/examples/index.d.ts +1 -0
- package/lib/examples/stores/notebooks/NotebookExample2.ipynb.json +43 -43
- package/lib/hooks/useAGUI.d.ts +1 -1
- package/lib/hooks/useAGUI.js +1 -1
- package/lib/identity/types.d.ts +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/runtime/index.d.ts +3 -0
- package/lib/runtime/runtimeStore.d.ts +3 -4
- package/lib/runtime/useAgentConnection.d.ts +2 -3
- package/lib/runtime/useAgentRuntime.d.ts +2 -3
- package/lib/stories/Cell.stories.js +1 -1
- package/lib/tools/adapters/agent-runtimes/notebookHooks.js +1 -0
- package/lib/tools/adapters/copilotkit/notebookHooks.js +1 -0
- package/lib/types.d.ts +158 -0
- package/package.json +5 -6
- package/scripts/apply-patches.sh +1 -1
- package/scripts/codegen/generate_agents.py +863 -0
- package/scripts/codegen/generate_envvars.py +302 -0
- package/scripts/codegen/generate_mcp_servers.py +436 -0
- package/scripts/codegen/generate_skills.py +334 -0
- package/scripts/download-ai-elements.py +35 -20
- package/scripts/sync-jupyter.sh +6 -0
- package/lib/components/ui/accordion.d.ts +0 -7
- package/lib/components/ui/accordion.js +0 -22
- package/lib/components/ui/alert-dialog.d.ts +0 -14
- package/lib/components/ui/alert-dialog.js +0 -43
- package/lib/components/ui/alert.d.ts +0 -9
- package/lib/components/ui/alert.js +0 -24
- package/lib/components/ui/aspect-ratio.d.ts +0 -3
- package/lib/components/ui/aspect-ratio.js +0 -11
- package/lib/components/ui/avatar.d.ts +0 -6
- package/lib/components/ui/avatar.js +0 -18
- package/lib/components/ui/badge.d.ts +0 -9
- package/lib/components/ui/badge.js +0 -22
- package/lib/components/ui/breadcrumb.d.ts +0 -11
- package/lib/components/ui/breadcrumb.js +0 -27
- package/lib/components/ui/button-group.d.ts +0 -11
- package/lib/components/ui/button-group.js +0 -31
- package/lib/components/ui/button.d.ts +0 -13
- package/lib/components/ui/button.js +0 -39
- package/lib/components/ui/calendar.d.ts +0 -8
- package/lib/components/ui/calendar.js +0 -80
- package/lib/components/ui/card.d.ts +0 -9
- package/lib/components/ui/card.js +0 -24
- package/lib/components/ui/carousel.d.ts +0 -19
- package/lib/components/ui/carousel.js +0 -95
- package/lib/components/ui/chart.d.ts +0 -53
- package/lib/components/ui/chart.js +0 -136
- package/lib/components/ui/checkbox.d.ts +0 -4
- package/lib/components/ui/checkbox.js +0 -13
- package/lib/components/ui/collapsible.d.ts +0 -5
- package/lib/components/ui/collapsible.js +0 -17
- package/lib/components/ui/command.d.ts +0 -18
- package/lib/components/ui/command.js +0 -38
- package/lib/components/ui/context-menu.d.ts +0 -25
- package/lib/components/ui/context-menu.js +0 -55
- package/lib/components/ui/dialog.d.ts +0 -15
- package/lib/components/ui/dialog.js +0 -40
- package/lib/components/ui/drawer.d.ts +0 -13
- package/lib/components/ui/drawer.js +0 -39
- package/lib/components/ui/dropdown-menu.d.ts +0 -25
- package/lib/components/ui/dropdown-menu.js +0 -55
- package/lib/components/ui/empty.d.ts +0 -11
- package/lib/components/ui/empty.js +0 -37
- package/lib/components/ui/field.d.ts +0 -24
- package/lib/components/ui/field.js +0 -80
- package/lib/components/ui/form.d.ts +0 -24
- package/lib/components/ui/form.js +0 -63
- package/lib/components/ui/hover-card.d.ts +0 -6
- package/lib/components/ui/hover-card.js +0 -18
- package/lib/components/ui/input-group.d.ts +0 -19
- package/lib/components/ui/input-group.js +0 -69
- package/lib/components/ui/input-otp.d.ts +0 -11
- package/lib/components/ui/input-otp.js +0 -25
- package/lib/components/ui/input.d.ts +0 -3
- package/lib/components/ui/input.js +0 -6
- package/lib/components/ui/item.d.ts +0 -23
- package/lib/components/ui/item.js +0 -66
- package/lib/components/ui/kbd.d.ts +0 -3
- package/lib/components/ui/kbd.js +0 -13
- package/lib/components/ui/label.d.ts +0 -4
- package/lib/components/ui/label.js +0 -12
- package/lib/components/ui/menubar.d.ts +0 -26
- package/lib/components/ui/menubar.js +0 -58
- package/lib/components/ui/navigation-menu.d.ts +0 -14
- package/lib/components/ui/navigation-menu.js +0 -31
- package/lib/components/ui/pagination.d.ts +0 -13
- package/lib/components/ui/pagination.js +0 -29
- package/lib/components/ui/popover.d.ts +0 -7
- package/lib/components/ui/popover.js +0 -21
- package/lib/components/ui/progress.d.ts +0 -4
- package/lib/components/ui/progress.js +0 -12
- package/lib/components/ui/radio-group.d.ts +0 -5
- package/lib/components/ui/radio-group.js +0 -16
- package/lib/components/ui/resizable.d.ts +0 -8
- package/lib/components/ui/resizable.js +0 -19
- package/lib/components/ui/scroll-area.d.ts +0 -5
- package/lib/components/ui/scroll-area.js +0 -17
- package/lib/components/ui/select.d.ts +0 -15
- package/lib/components/ui/select.js +0 -42
- package/lib/components/ui/separator.d.ts +0 -4
- package/lib/components/ui/separator.js +0 -12
- package/lib/components/ui/sheet.d.ts +0 -13
- package/lib/components/ui/sheet.js +0 -44
- package/lib/components/ui/sidebar.d.ts +0 -69
- package/lib/components/ui/sidebar.js +0 -216
- package/lib/components/ui/skeleton.d.ts +0 -2
- package/lib/components/ui/skeleton.js +0 -10
- package/lib/components/ui/slider.d.ts +0 -4
- package/lib/components/ui/slider.js +0 -18
- package/lib/components/ui/sonner.d.ts +0 -3
- package/lib/components/ui/sonner.js +0 -25
- package/lib/components/ui/spinner.d.ts +0 -2
- package/lib/components/ui/spinner.js +0 -11
- package/lib/components/ui/switch.d.ts +0 -4
- package/lib/components/ui/switch.js +0 -12
- package/lib/components/ui/table.d.ts +0 -10
- package/lib/components/ui/table.js +0 -32
- package/lib/components/ui/tabs.d.ts +0 -7
- package/lib/components/ui/tabs.js +0 -21
- package/lib/components/ui/textarea.d.ts +0 -3
- package/lib/components/ui/textarea.js +0 -6
- package/lib/components/ui/toast.d.ts +0 -15
- package/lib/components/ui/toast.js +0 -38
- package/lib/components/ui/toaster.d.ts +0 -1
- package/lib/components/ui/toaster.js +0 -14
- package/lib/components/ui/toggle-group.d.ts +0 -9
- package/lib/components/ui/toggle-group.js +0 -26
- package/lib/components/ui/toggle.d.ts +0 -9
- package/lib/components/ui/toggle.js +0 -30
- package/lib/components/ui/tooltip.d.ts +0 -7
- package/lib/components/ui/tooltip.js +0 -21
- package/lib/components/vercel-ai-elements/artifact.d.ts +0 -23
- package/lib/components/vercel-ai-elements/artifact.js +0 -24
- package/lib/components/vercel-ai-elements/code-block.d.ts +0 -17
- package/lib/components/vercel-ai-elements/code-block.js +0 -94
- package/lib/components/vercel-ai-elements/conversation.d.ts +0 -15
- package/lib/components/vercel-ai-elements/conversation.js +0 -21
- package/lib/components/vercel-ai-elements/loader.d.ts +0 -5
- package/lib/components/vercel-ai-elements/loader.js +0 -8
- package/lib/components/vercel-ai-elements/message.d.ts +0 -46
- package/lib/components/vercel-ai-elements/message.js +0 -109
- package/lib/components/vercel-ai-elements/model-selector.d.ts +0 -35
- package/lib/components/vercel-ai-elements/model-selector.js +0 -22
- package/lib/components/vercel-ai-elements/prompt-input.d.ts +0 -195
- package/lib/components/vercel-ai-elements/prompt-input.js +0 -589
- package/lib/components/vercel-ai-elements/reasoning.d.ts +0 -26
- package/lib/components/vercel-ai-elements/reasoning.js +0 -80
- package/lib/components/vercel-ai-elements/shimmer.d.ts +0 -9
- package/lib/components/vercel-ai-elements/shimmer.js +0 -22
- package/lib/components/vercel-ai-elements/sources.d.ts +0 -12
- package/lib/components/vercel-ai-elements/sources.js +0 -13
- package/lib/components/vercel-ai-elements/suggestion.d.ts +0 -10
- package/lib/components/vercel-ai-elements/suggestion.js +0 -16
- package/lib/components/vercel-ai-elements/tool.d.ts +0 -23
- package/lib/components/vercel-ai-elements/tool.js +0 -52
- package/lib/examples/components/AgentConfiguration.js +0 -382
- package/lib/examples/components/MainContent.d.ts +0 -19
- package/lib/examples/components/index.d.ts +0 -10
- package/lib/examples/components/index.js +0 -13
- package/lib/examples/vercel-ai-elements/VercelAiElementsShowcase.d.ts +0 -12
- package/lib/examples/vercel-ai-elements/VercelAiElementsShowcase.js +0 -69
- package/lib/examples/vercel-ai-elements/components/ArtifactShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ArtifactShowcase.js +0 -85
- package/lib/examples/vercel-ai-elements/components/CodeBlockShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/CodeBlockShowcase.js +0 -62
- package/lib/examples/vercel-ai-elements/components/ConversationShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ConversationShowcase.js +0 -51
- package/lib/examples/vercel-ai-elements/components/LoaderShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/LoaderShowcase.js +0 -9
- package/lib/examples/vercel-ai-elements/components/MessageShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/MessageShowcase.js +0 -56
- package/lib/examples/vercel-ai-elements/components/ModelSelectorShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ModelSelectorShowcase.js +0 -50
- package/lib/examples/vercel-ai-elements/components/PromptInputShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/PromptInputShowcase.js +0 -16
- package/lib/examples/vercel-ai-elements/components/ReasoningShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ReasoningShowcase.js +0 -72
- package/lib/examples/vercel-ai-elements/components/ShimmerShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ShimmerShowcase.js +0 -9
- package/lib/examples/vercel-ai-elements/components/SourcesShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/SourcesShowcase.js +0 -43
- package/lib/examples/vercel-ai-elements/components/SuggestionShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/SuggestionShowcase.js +0 -31
- package/lib/examples/vercel-ai-elements/components/ToolShowcase.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/components/ToolShowcase.js +0 -54
- package/lib/examples/vercel-ai-elements/index.d.ts +0 -13
- package/lib/examples/vercel-ai-elements/index.js +0 -17
- package/lib/examples/vercel-ai-elements/main.d.ts +0 -1
- package/lib/examples/vercel-ai-elements/main.js +0 -9
- package/lib/examples/vercel-ai-elements/showcase.css +0 -128
- package/lib/hooks/useToast.d.ts +0 -44
- package/lib/hooks/useToast.js +0 -128
- package/patches/@datalayer+jupyter-lexical+1.0.8.patch +0 -11628
- package/patches/@datalayer+jupyter-react+2.0.2.patch +0 -5338
- package/style/showcase-vercel-ai.css +0 -137
- /package/lib/{examples/components → components}/FooterMetrics.js +0 -0
- /package/lib/{examples/components → components}/MockFileBrowser.js +0 -0
- /package/lib/{examples/components → components}/SessionTabs.js +0 -0
- /package/lib/{examples/components → components}/TimeTravel.js +0 -0
- /package/lib/{models → types}/AIAgent.d.ts +0 -0
- /package/lib/{models → types}/AIAgent.js +0 -0
- /package/lib/{models → types}/index.d.ts +0 -0
- /package/lib/{models → types}/index.js +0 -0
|
@@ -22,7 +22,13 @@ export class AGUIAdapter extends BaseProtocolAdapter {
|
|
|
22
22
|
lastTools = [];
|
|
23
23
|
constructor(config) {
|
|
24
24
|
super(config);
|
|
25
|
-
|
|
25
|
+
// Ensure baseUrl ends with trailing slash (required for mounted Starlette apps)
|
|
26
|
+
this.aguiConfig = {
|
|
27
|
+
...config,
|
|
28
|
+
baseUrl: config.baseUrl.endsWith('/')
|
|
29
|
+
? config.baseUrl
|
|
30
|
+
: `${config.baseUrl}/`,
|
|
31
|
+
};
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
28
34
|
* Connect to AG-UI endpoint (SSE doesn't require persistent connection)
|
|
@@ -56,7 +62,7 @@ export class AGUIAdapter extends BaseProtocolAdapter {
|
|
|
56
62
|
async terminateAgent(threadId) {
|
|
57
63
|
try {
|
|
58
64
|
// Derive the terminate endpoint from the base URL
|
|
59
|
-
// e.g., http://localhost:8765/api/v1/examples/agentic_chat
|
|
65
|
+
// e.g., http://localhost:8765/api/v1/examples/agentic_chat -> http://localhost:8765/api/v1/ag-ui/terminate
|
|
60
66
|
const baseUrl = new URL(this.aguiConfig.baseUrl);
|
|
61
67
|
const terminateUrl = `${baseUrl.origin}/api/v1/ag-ui/terminate`;
|
|
62
68
|
const response = await fetch(terminateUrl, {
|
|
@@ -521,9 +527,23 @@ export class AGUIAdapter extends BaseProtocolAdapter {
|
|
|
521
527
|
});
|
|
522
528
|
break;
|
|
523
529
|
}
|
|
524
|
-
case 'RUN_FINISHED':
|
|
525
|
-
// Run completed successfully
|
|
530
|
+
case 'RUN_FINISHED': {
|
|
531
|
+
// Run completed successfully — extract usage data if available
|
|
532
|
+
const usage = event.usage;
|
|
533
|
+
if (usage) {
|
|
534
|
+
this.emit({
|
|
535
|
+
type: 'message',
|
|
536
|
+
usage: {
|
|
537
|
+
promptTokens: usage.promptTokens ?? 0,
|
|
538
|
+
completionTokens: usage.completionTokens ?? 0,
|
|
539
|
+
totalTokens: usage.totalTokens ??
|
|
540
|
+
(usage.promptTokens ?? 0) + (usage.completionTokens ?? 0),
|
|
541
|
+
},
|
|
542
|
+
timestamp: new Date(),
|
|
543
|
+
});
|
|
544
|
+
}
|
|
526
545
|
break;
|
|
546
|
+
}
|
|
527
547
|
case 'RUN_ERROR': {
|
|
528
548
|
const errorMessage = event.message;
|
|
529
549
|
this.emit({
|
|
@@ -185,6 +185,16 @@ export class VercelAIAdapter extends BaseProtocolAdapter {
|
|
|
185
185
|
while (true) {
|
|
186
186
|
const { done, value } = await reader.read();
|
|
187
187
|
if (done) {
|
|
188
|
+
// Stream ended - emit final message if we have accumulated text
|
|
189
|
+
if (accumulatedText) {
|
|
190
|
+
const message = createAssistantMessage(accumulatedText);
|
|
191
|
+
message.id = currentMessageId;
|
|
192
|
+
this.emit({
|
|
193
|
+
type: 'message',
|
|
194
|
+
message,
|
|
195
|
+
timestamp: new Date(),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
188
198
|
break;
|
|
189
199
|
}
|
|
190
200
|
buffer += decoder.decode(value, { stream: true });
|
|
@@ -194,6 +204,8 @@ export class VercelAIAdapter extends BaseProtocolAdapter {
|
|
|
194
204
|
if (!line.trim() || line.startsWith(':')) {
|
|
195
205
|
continue;
|
|
196
206
|
}
|
|
207
|
+
// Log raw line for debugging
|
|
208
|
+
console.debug('[VercelAIAdapter] SSE line:', line);
|
|
197
209
|
if (line.startsWith('data: ')) {
|
|
198
210
|
const data = line.slice(6);
|
|
199
211
|
if (data === '[DONE]') {
|
|
@@ -211,6 +223,7 @@ export class VercelAIAdapter extends BaseProtocolAdapter {
|
|
|
211
223
|
}
|
|
212
224
|
try {
|
|
213
225
|
const event = JSON.parse(data);
|
|
226
|
+
console.debug('[VercelAIAdapter] Parsed event:', event);
|
|
214
227
|
// Handle Vercel AI event types
|
|
215
228
|
// Server sends: {"type":"text-delta","delta":"Hello","id":"..."}
|
|
216
229
|
if (event.type === 'text-delta' && event.delta) {
|
|
@@ -239,11 +252,32 @@ export class VercelAIAdapter extends BaseProtocolAdapter {
|
|
|
239
252
|
timestamp: new Date(),
|
|
240
253
|
});
|
|
241
254
|
}
|
|
255
|
+
// Extract and emit usage data from finish events
|
|
256
|
+
if (event.usage) {
|
|
257
|
+
const usage = event.usage;
|
|
258
|
+
this.emit({
|
|
259
|
+
type: 'message',
|
|
260
|
+
usage: {
|
|
261
|
+
promptTokens: usage.promptTokens ?? 0,
|
|
262
|
+
completionTokens: usage.completionTokens ?? 0,
|
|
263
|
+
totalTokens: usage.totalTokens ??
|
|
264
|
+
(usage.promptTokens ?? 0) +
|
|
265
|
+
(usage.completionTokens ?? 0),
|
|
266
|
+
},
|
|
267
|
+
timestamp: new Date(),
|
|
268
|
+
});
|
|
269
|
+
}
|
|
242
270
|
}
|
|
243
271
|
else if (event.type === 'error') {
|
|
272
|
+
const errorMessage = event.error ||
|
|
273
|
+
event.errorText ||
|
|
274
|
+
event.message ||
|
|
275
|
+
event.detail ||
|
|
276
|
+
'Unknown server error';
|
|
277
|
+
console.error('[VercelAIAdapter] Server error event:', event);
|
|
244
278
|
this.emit({
|
|
245
279
|
type: 'error',
|
|
246
|
-
error: new Error(
|
|
280
|
+
error: new Error(errorMessage),
|
|
247
281
|
timestamp: new Date(),
|
|
248
282
|
});
|
|
249
283
|
}
|
|
@@ -51,7 +51,7 @@ export interface ToolCallState {
|
|
|
51
51
|
/**
|
|
52
52
|
* Chat store state
|
|
53
53
|
*/
|
|
54
|
-
interface ChatState {
|
|
54
|
+
export interface ChatState {
|
|
55
55
|
config: ChatConfig;
|
|
56
56
|
ready: boolean;
|
|
57
57
|
inferenceProvider: InferenceProvider | null;
|
|
@@ -76,7 +76,7 @@ interface ChatState {
|
|
|
76
76
|
/**
|
|
77
77
|
* Chat store actions
|
|
78
78
|
*/
|
|
79
|
-
interface ChatActions {
|
|
79
|
+
export interface ChatActions {
|
|
80
80
|
setConfig: (config: Partial<ChatConfig>) => void;
|
|
81
81
|
setReady: (ready: boolean) => void;
|
|
82
82
|
setInferenceProvider: (provider: InferenceProvider | null) => void;
|
|
@@ -155,4 +155,3 @@ export declare const useChatConfig: () => ChatConfig;
|
|
|
155
155
|
export declare const useChatReady: () => boolean;
|
|
156
156
|
export declare const useChatInferenceProvider: () => InferenceProvider | null;
|
|
157
157
|
export declare const useChatExtensionRegistry: () => ExtensionRegistry | null;
|
|
158
|
-
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { ChatMessage } from '../types/message';
|
|
2
|
+
/**
|
|
3
|
+
* Conversation data for a single runtime
|
|
4
|
+
*/
|
|
5
|
+
export interface ConversationData {
|
|
6
|
+
/** Runtime/agent space ID */
|
|
7
|
+
runtimeId: string;
|
|
8
|
+
/** Messages in this conversation */
|
|
9
|
+
messages: ChatMessage[];
|
|
10
|
+
/** When the conversation was last updated */
|
|
11
|
+
updatedAt: number;
|
|
12
|
+
/** Whether messages have been fetched from the server */
|
|
13
|
+
fetchedFromServer: boolean;
|
|
14
|
+
/** Whether a fetch is currently in progress */
|
|
15
|
+
isFetching: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Conversation store state
|
|
19
|
+
*/
|
|
20
|
+
interface ConversationState {
|
|
21
|
+
/** Map of runtime ID to conversation data */
|
|
22
|
+
conversations: Record<string, ConversationData>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Conversation store actions
|
|
26
|
+
*/
|
|
27
|
+
interface ConversationActions {
|
|
28
|
+
/** Get messages for a specific runtime */
|
|
29
|
+
getMessages: (runtimeId: string) => ChatMessage[];
|
|
30
|
+
/** Set messages for a specific runtime */
|
|
31
|
+
setMessages: (runtimeId: string, messages: ChatMessage[]) => void;
|
|
32
|
+
/** Add a message to a specific runtime's conversation */
|
|
33
|
+
addMessage: (runtimeId: string, message: ChatMessage) => void;
|
|
34
|
+
/** Update a message in a specific runtime's conversation */
|
|
35
|
+
updateMessage: (runtimeId: string, messageId: string, updates: Partial<ChatMessage>) => void;
|
|
36
|
+
/** Clear messages for a specific runtime */
|
|
37
|
+
clearMessages: (runtimeId: string) => void;
|
|
38
|
+
/** Clear all conversations */
|
|
39
|
+
clearAll: () => void;
|
|
40
|
+
/** Mark a runtime as fetched from server */
|
|
41
|
+
markFetched: (runtimeId: string) => void;
|
|
42
|
+
/** Mark a runtime as currently fetching */
|
|
43
|
+
setFetching: (runtimeId: string, isFetching: boolean) => void;
|
|
44
|
+
/** Check if a runtime needs to fetch from server */
|
|
45
|
+
needsFetch: (runtimeId: string) => boolean;
|
|
46
|
+
/** Check if a runtime is currently fetching */
|
|
47
|
+
isFetching: (runtimeId: string) => boolean;
|
|
48
|
+
/** Delete a conversation for a specific runtime */
|
|
49
|
+
deleteConversation: (runtimeId: string) => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Combined store type
|
|
53
|
+
*/
|
|
54
|
+
export type ConversationStore = ConversationState & ConversationActions;
|
|
55
|
+
/**
|
|
56
|
+
* Create the conversation store (in-memory only, no browser persistence)
|
|
57
|
+
*/
|
|
58
|
+
export declare const useConversationStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<ConversationStore>, "setState"> & {
|
|
59
|
+
setState<A extends string | {
|
|
60
|
+
type: string;
|
|
61
|
+
}>(partial: ConversationStore | Partial<ConversationStore> | ((state: ConversationStore) => ConversationStore | Partial<ConversationStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
62
|
+
}, "subscribe"> & {
|
|
63
|
+
subscribe: {
|
|
64
|
+
(listener: (selectedState: ConversationStore, previousSelectedState: ConversationStore) => void): () => void;
|
|
65
|
+
<U>(selector: (state: ConversationStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
66
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
67
|
+
fireImmediately?: boolean;
|
|
68
|
+
} | undefined): () => void;
|
|
69
|
+
};
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Hook to get messages for a specific runtime
|
|
73
|
+
*/
|
|
74
|
+
export declare const useConversationMessages: (runtimeId: string | undefined) => ChatMessage[];
|
|
75
|
+
/**
|
|
76
|
+
* Hook to check if a runtime needs to fetch messages from server
|
|
77
|
+
*/
|
|
78
|
+
export declare const useNeedsFetch: (runtimeId: string | undefined) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Hook to check if a runtime is currently fetching
|
|
81
|
+
*/
|
|
82
|
+
export declare const useIsFetching: (runtimeId: string | undefined) => boolean;
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Zustand store for conversation history per runtime/agent space.
|
|
7
|
+
* Stores messages per runtime ID in memory during the session.
|
|
8
|
+
*
|
|
9
|
+
* Key features:
|
|
10
|
+
* - Messages are stored per runtime ID (agent space) in memory
|
|
11
|
+
* - On page reload, messages are fetched from the server API
|
|
12
|
+
* - No browser storage persistence - server is the source of truth
|
|
13
|
+
*
|
|
14
|
+
* @module components/chat/store/conversationStore
|
|
15
|
+
*/
|
|
16
|
+
import { create } from 'zustand';
|
|
17
|
+
import { devtools, subscribeWithSelector } from 'zustand/middleware';
|
|
18
|
+
/**
|
|
19
|
+
* Initial state
|
|
20
|
+
*/
|
|
21
|
+
const initialState = {
|
|
22
|
+
conversations: {},
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Create the conversation store (in-memory only, no browser persistence)
|
|
26
|
+
*/
|
|
27
|
+
export const useConversationStore = create()(devtools(subscribeWithSelector((set, get) => ({
|
|
28
|
+
...initialState,
|
|
29
|
+
getMessages: (runtimeId) => {
|
|
30
|
+
const conversation = get().conversations[runtimeId];
|
|
31
|
+
return conversation?.messages || [];
|
|
32
|
+
},
|
|
33
|
+
setMessages: (runtimeId, messages) => {
|
|
34
|
+
set(state => ({
|
|
35
|
+
conversations: {
|
|
36
|
+
...state.conversations,
|
|
37
|
+
[runtimeId]: {
|
|
38
|
+
runtimeId,
|
|
39
|
+
messages,
|
|
40
|
+
updatedAt: Date.now(),
|
|
41
|
+
fetchedFromServer: state.conversations[runtimeId]?.fetchedFromServer || false,
|
|
42
|
+
isFetching: state.conversations[runtimeId]?.isFetching || false,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}), false, 'setMessages');
|
|
46
|
+
},
|
|
47
|
+
addMessage: (runtimeId, message) => {
|
|
48
|
+
set(state => {
|
|
49
|
+
const existing = state.conversations[runtimeId];
|
|
50
|
+
const currentMessages = existing?.messages || [];
|
|
51
|
+
return {
|
|
52
|
+
conversations: {
|
|
53
|
+
...state.conversations,
|
|
54
|
+
[runtimeId]: {
|
|
55
|
+
runtimeId,
|
|
56
|
+
messages: [...currentMessages, message],
|
|
57
|
+
updatedAt: Date.now(),
|
|
58
|
+
fetchedFromServer: existing?.fetchedFromServer || false,
|
|
59
|
+
isFetching: existing?.isFetching || false,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}, false, 'addMessage');
|
|
64
|
+
},
|
|
65
|
+
updateMessage: (runtimeId, messageId, updates) => {
|
|
66
|
+
set(state => {
|
|
67
|
+
const existing = state.conversations[runtimeId];
|
|
68
|
+
if (!existing)
|
|
69
|
+
return state;
|
|
70
|
+
return {
|
|
71
|
+
conversations: {
|
|
72
|
+
...state.conversations,
|
|
73
|
+
[runtimeId]: {
|
|
74
|
+
...existing,
|
|
75
|
+
messages: existing.messages.map(msg => msg.id === messageId ? { ...msg, ...updates } : msg),
|
|
76
|
+
updatedAt: Date.now(),
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}, false, 'updateMessage');
|
|
81
|
+
},
|
|
82
|
+
clearMessages: (runtimeId) => {
|
|
83
|
+
set(state => {
|
|
84
|
+
const existing = state.conversations[runtimeId];
|
|
85
|
+
if (!existing)
|
|
86
|
+
return state;
|
|
87
|
+
return {
|
|
88
|
+
conversations: {
|
|
89
|
+
...state.conversations,
|
|
90
|
+
[runtimeId]: {
|
|
91
|
+
...existing,
|
|
92
|
+
messages: [],
|
|
93
|
+
updatedAt: Date.now(),
|
|
94
|
+
// Reset fetch state so next mount will fetch fresh
|
|
95
|
+
fetchedFromServer: false,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}, false, 'clearMessages');
|
|
100
|
+
},
|
|
101
|
+
clearAll: () => {
|
|
102
|
+
set({ conversations: {} }, false, 'clearAll');
|
|
103
|
+
},
|
|
104
|
+
markFetched: (runtimeId) => {
|
|
105
|
+
set(state => {
|
|
106
|
+
const existing = state.conversations[runtimeId];
|
|
107
|
+
return {
|
|
108
|
+
conversations: {
|
|
109
|
+
...state.conversations,
|
|
110
|
+
[runtimeId]: existing
|
|
111
|
+
? { ...existing, fetchedFromServer: true, isFetching: false }
|
|
112
|
+
: {
|
|
113
|
+
runtimeId,
|
|
114
|
+
messages: [],
|
|
115
|
+
updatedAt: Date.now(),
|
|
116
|
+
fetchedFromServer: true,
|
|
117
|
+
isFetching: false,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}, false, 'markFetched');
|
|
122
|
+
},
|
|
123
|
+
setFetching: (runtimeId, isFetching) => {
|
|
124
|
+
set(state => {
|
|
125
|
+
const existing = state.conversations[runtimeId];
|
|
126
|
+
return {
|
|
127
|
+
conversations: {
|
|
128
|
+
...state.conversations,
|
|
129
|
+
[runtimeId]: existing
|
|
130
|
+
? { ...existing, isFetching }
|
|
131
|
+
: {
|
|
132
|
+
runtimeId,
|
|
133
|
+
messages: [],
|
|
134
|
+
updatedAt: Date.now(),
|
|
135
|
+
fetchedFromServer: false,
|
|
136
|
+
isFetching,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}, false, 'setFetching');
|
|
141
|
+
},
|
|
142
|
+
needsFetch: (runtimeId) => {
|
|
143
|
+
const conversation = get().conversations[runtimeId];
|
|
144
|
+
// Needs fetch if not yet fetched and not currently fetching
|
|
145
|
+
return !conversation?.fetchedFromServer && !conversation?.isFetching;
|
|
146
|
+
},
|
|
147
|
+
isFetching: (runtimeId) => {
|
|
148
|
+
return get().conversations[runtimeId]?.isFetching || false;
|
|
149
|
+
},
|
|
150
|
+
deleteConversation: (runtimeId) => {
|
|
151
|
+
set(state => {
|
|
152
|
+
const { [runtimeId]: _, ...remainingConversations } = state.conversations;
|
|
153
|
+
return { conversations: remainingConversations };
|
|
154
|
+
}, false, 'deleteConversation');
|
|
155
|
+
},
|
|
156
|
+
})), { name: 'ConversationStore' }));
|
|
157
|
+
/**
|
|
158
|
+
* Hook to get messages for a specific runtime
|
|
159
|
+
*/
|
|
160
|
+
export const useConversationMessages = (runtimeId) => {
|
|
161
|
+
return useConversationStore(state => runtimeId ? state.conversations[runtimeId]?.messages || [] : []);
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Hook to check if a runtime needs to fetch messages from server
|
|
165
|
+
*/
|
|
166
|
+
export const useNeedsFetch = (runtimeId) => {
|
|
167
|
+
return useConversationStore(state => runtimeId ? state.needsFetch(runtimeId) : false);
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Hook to check if a runtime is currently fetching
|
|
171
|
+
*/
|
|
172
|
+
export const useIsFetching = (runtimeId) => {
|
|
173
|
+
return useConversationStore(state => runtimeId ? state.isFetching(runtimeId) : false);
|
|
174
|
+
};
|
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module components/chat/store
|
|
5
5
|
*/
|
|
6
|
-
export { useChatStore, useChatMessages, useChatLoading, useChatStreaming, useChatError, useChatTools, useChatOpen, useChatConfig, useChatReady, useChatInferenceProvider, useChatExtensionRegistry, defaultChatConfig, type ChatStore, type ChatConfig, type ToolCallState, } from './chatStore';
|
|
6
|
+
export { useChatStore, useChatMessages, useChatLoading, useChatStreaming, useChatError, useChatTools, useChatOpen, useChatConfig, useChatReady, useChatInferenceProvider, useChatExtensionRegistry, defaultChatConfig, type ChatStore, type ChatState, type ChatActions, type ChatConfig, type ToolCallState, } from './chatStore';
|
|
7
|
+
export { useConversationStore, useConversationMessages, useNeedsFetch, useIsFetching, type ConversationStore, type ConversationData, } from './conversationStore';
|
|
@@ -8,3 +8,4 @@
|
|
|
8
8
|
* @module components/chat/store
|
|
9
9
|
*/
|
|
10
10
|
export { useChatStore, useChatMessages, useChatLoading, useChatStreaming, useChatError, useChatTools, useChatOpen, useChatConfig, useChatReady, useChatInferenceProvider, useChatExtensionRegistry, defaultChatConfig, } from './chatStore';
|
|
11
|
+
export { useConversationStore, useConversationMessages, useNeedsFetch, useIsFetching, } from './conversationStore';
|
|
@@ -6,6 +6,23 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ChatMessage, ChatMessageDelta } from './message';
|
|
8
8
|
import type { ToolDefinition, ToolCallRequest, ToolExecutionResult } from './tool';
|
|
9
|
+
/**
|
|
10
|
+
* Type alias for MCP server identifier
|
|
11
|
+
*/
|
|
12
|
+
export type McpId = string;
|
|
13
|
+
/**
|
|
14
|
+
* Type alias for MCP server origin
|
|
15
|
+
*/
|
|
16
|
+
export type McpOrigin = 'config' | 'catalog';
|
|
17
|
+
/**
|
|
18
|
+
* MCP Server selection - identifies a specific MCP server by ID and origin
|
|
19
|
+
*/
|
|
20
|
+
export interface McpServerSelection {
|
|
21
|
+
/** Unique identifier of the MCP server */
|
|
22
|
+
id: McpId;
|
|
23
|
+
/** Origin of the server (config from mcp.json, catalog from built-in) */
|
|
24
|
+
origin: McpOrigin;
|
|
25
|
+
}
|
|
9
26
|
/**
|
|
10
27
|
* Inference provider configuration
|
|
11
28
|
*/
|
|
@@ -49,6 +49,14 @@ export interface ProtocolAdapterConfig {
|
|
|
49
49
|
* Protocol event types
|
|
50
50
|
*/
|
|
51
51
|
export type ProtocolEventType = 'connected' | 'disconnected' | 'message' | 'tool-call' | 'tool-result' | 'activity' | 'state-update' | 'error';
|
|
52
|
+
/**
|
|
53
|
+
* Token usage statistics from a protocol event
|
|
54
|
+
*/
|
|
55
|
+
export interface ProtocolUsage {
|
|
56
|
+
promptTokens: number;
|
|
57
|
+
completionTokens: number;
|
|
58
|
+
totalTokens?: number;
|
|
59
|
+
}
|
|
52
60
|
/**
|
|
53
61
|
* Protocol event
|
|
54
62
|
*/
|
|
@@ -62,6 +70,8 @@ export interface ProtocolEvent {
|
|
|
62
70
|
type: string;
|
|
63
71
|
data: unknown;
|
|
64
72
|
};
|
|
73
|
+
/** Token usage for this event (emitted on finish/run-complete events) */
|
|
74
|
+
usage?: ProtocolUsage;
|
|
65
75
|
error?: Error;
|
|
66
76
|
timestamp: Date;
|
|
67
77
|
}
|
|
@@ -1 +1,24 @@
|
|
|
1
1
|
export * from './chat';
|
|
2
|
+
export type { ToolCallStatus } from './chat/types/message';
|
|
3
|
+
export type { ToolCallStatus as DisplayToolCallStatus } from './chat/components/base/ChatBase';
|
|
4
|
+
export { MockFileBrowser } from './MockFileBrowser';
|
|
5
|
+
export type { MockFileBrowserProps } from './MockFileBrowser';
|
|
6
|
+
export { MainContent } from './MainContent';
|
|
7
|
+
export type { MainContentProps } from './MainContent';
|
|
8
|
+
export { SessionTabs } from './SessionTabs';
|
|
9
|
+
export type { SessionTabsProps, Session } from './SessionTabs';
|
|
10
|
+
export { Header } from './Header';
|
|
11
|
+
export type { HeaderProps } from './Header';
|
|
12
|
+
export { HeaderControls } from './HeaderControls';
|
|
13
|
+
export type { HeaderControlsProps } from './HeaderControls';
|
|
14
|
+
export { FooterMetrics } from './FooterMetrics';
|
|
15
|
+
export type { FooterMetricsProps } from './FooterMetrics';
|
|
16
|
+
export { TimeTravel } from './TimeTravel';
|
|
17
|
+
export type { TimeTravelProps } from './TimeTravel';
|
|
18
|
+
export { LexicalEditor } from './LexicalEditor';
|
|
19
|
+
export type { LexicalEditorProps } from './LexicalEditor';
|
|
20
|
+
export { AgentConfiguration, AGENT_LIBRARIES, TRANSPORTS, EXTENSIONS, isSpecSelection, getSpecId, } from './AgentConfiguration';
|
|
21
|
+
export type { AgentLibrary, Transport, Extension, AgentConfigurationProps, SkillOption, MCPServerConfig, MCPServerTool, LibraryAgentSpec, } from './AgentConfiguration';
|
|
22
|
+
export { McpServerManager } from './McpServerManager';
|
|
23
|
+
export type { McpServerSelection, McpServerManagerProps, } from './McpServerManager';
|
|
24
|
+
export type { Agent as ExampleAgent, AgentStatus as ExampleAgentStatus, AgentsState, Transport as ExampleTransport, } from '../examples/stores/examplesStore';
|
package/lib/components/index.js
CHANGED
|
@@ -4,3 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// Primary exports from chat (next-gen chat component)
|
|
6
6
|
export * from './chat';
|
|
7
|
+
// Example/layout components
|
|
8
|
+
export { MockFileBrowser } from './MockFileBrowser';
|
|
9
|
+
export { MainContent } from './MainContent';
|
|
10
|
+
export { SessionTabs } from './SessionTabs';
|
|
11
|
+
export { Header } from './Header';
|
|
12
|
+
export { HeaderControls } from './HeaderControls';
|
|
13
|
+
export { FooterMetrics } from './FooterMetrics';
|
|
14
|
+
export { TimeTravel } from './TimeTravel';
|
|
15
|
+
export { LexicalEditor } from './LexicalEditor';
|
|
16
|
+
export { AgentConfiguration, AGENT_LIBRARIES, TRANSPORTS, EXTENSIONS, isSpecSelection, getSpecId, } from './AgentConfiguration';
|
|
17
|
+
export { McpServerManager } from './McpServerManager';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Library.
|
|
3
|
+
*
|
|
4
|
+
* Predefined agent specifications that can be instantiated as AgentSpaces.
|
|
5
|
+
* THIS FILE IS AUTO-GENERATED. DO NOT EDIT MANUALLY.
|
|
6
|
+
* Generated from YAML specifications in specs/agents/
|
|
7
|
+
*/
|
|
8
|
+
import type { AgentSpec } from '../../../types';
|
|
9
|
+
export declare const SIMPLE_AGENT_SPEC: AgentSpec;
|
|
10
|
+
export declare const AGENT_SPECS: Record<string, AgentSpec>;
|
|
11
|
+
/**
|
|
12
|
+
* Get an agent specification by ID.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAgentSpecs(agentId: string): AgentSpec | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* List all available agent specifications.
|
|
17
|
+
*/
|
|
18
|
+
export declare function listAgentSpecs(): AgentSpec[];
|
|
19
|
+
/**
|
|
20
|
+
* Collect all required environment variables for an agent spec.
|
|
21
|
+
*
|
|
22
|
+
* Iterates over the spec's MCP servers and skills and returns the
|
|
23
|
+
* deduplicated union of their `requiredEnvVars` arrays.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAgentSpecRequiredEnvVars(spec: AgentSpec): string[];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Agent Specs
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Code Ai Agents
|
|
9
|
+
// ============================================================================
|
|
10
|
+
export const SIMPLE_AGENT_SPEC = {
|
|
11
|
+
id: 'code-ai/simple',
|
|
12
|
+
name: 'A Simple Agent',
|
|
13
|
+
description: `A simple conversational agent. No tools, no MCP servers, no skills — just a helpful AI assistant you can chat with.`,
|
|
14
|
+
tags: ['simple', 'chat', 'assistant'],
|
|
15
|
+
enabled: true,
|
|
16
|
+
mcpServers: [],
|
|
17
|
+
skills: [],
|
|
18
|
+
environmentName: 'ai-agents-env',
|
|
19
|
+
icon: 'share-2',
|
|
20
|
+
emoji: '🤖',
|
|
21
|
+
color: '#6366F1',
|
|
22
|
+
suggestions: [
|
|
23
|
+
'Tell me a joke',
|
|
24
|
+
'Explain quantum computing in simple terms',
|
|
25
|
+
'Help me brainstorm ideas for a weekend project',
|
|
26
|
+
'Summarize the key points of a topic I describe',
|
|
27
|
+
],
|
|
28
|
+
systemPrompt: `You are a helpful, friendly AI assistant. You do not have access to any external tools, MCP servers, or skills. Answer questions using your training knowledge, be concise, and let the user know if a question is outside your knowledge.
|
|
29
|
+
`,
|
|
30
|
+
systemPromptCodemodeAddons: undefined,
|
|
31
|
+
};
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Agent Specs Registry
|
|
34
|
+
// ============================================================================
|
|
35
|
+
export const AGENT_SPECS = {
|
|
36
|
+
// Code Ai
|
|
37
|
+
'code-ai/simple': SIMPLE_AGENT_SPEC,
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Get an agent specification by ID.
|
|
41
|
+
*/
|
|
42
|
+
export function getAgentSpecs(agentId) {
|
|
43
|
+
return AGENT_SPECS[agentId];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* List all available agent specifications.
|
|
47
|
+
*/
|
|
48
|
+
export function listAgentSpecs() {
|
|
49
|
+
return Object.values(AGENT_SPECS);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Collect all required environment variables for an agent spec.
|
|
53
|
+
*
|
|
54
|
+
* Iterates over the spec's MCP servers and skills and returns the
|
|
55
|
+
* deduplicated union of their `requiredEnvVars` arrays.
|
|
56
|
+
*/
|
|
57
|
+
export function getAgentSpecRequiredEnvVars(spec) {
|
|
58
|
+
const vars = new Set();
|
|
59
|
+
for (const server of spec.mcpServers) {
|
|
60
|
+
for (const v of server.requiredEnvVars ?? []) {
|
|
61
|
+
vars.add(v);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
for (const skill of spec.skills) {
|
|
65
|
+
for (const v of skill.requiredEnvVars ?? []) {
|
|
66
|
+
vars.add(v);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return Array.from(vars);
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './agents';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Library.
|
|
3
|
+
*
|
|
4
|
+
* Predefined agent specifications that can be instantiated as AgentSpaces.
|
|
5
|
+
* THIS FILE IS AUTO-GENERATED. DO NOT EDIT MANUALLY.
|
|
6
|
+
* Generated from YAML specifications in specs/agents/
|
|
7
|
+
*/
|
|
8
|
+
import type { AgentSpec } from '../../../types';
|
|
9
|
+
export declare const CRAWLER_AGENT_SPEC: AgentSpec;
|
|
10
|
+
export declare const DATA_ACQUISITION_AGENT_SPEC: AgentSpec;
|
|
11
|
+
export declare const FINANCIAL_VIZ_AGENT_SPEC: AgentSpec;
|
|
12
|
+
export declare const GITHUB_AGENT_SPEC: AgentSpec;
|
|
13
|
+
export declare const INFORMATION_ROUTING_AGENT_SPEC: AgentSpec;
|
|
14
|
+
export declare const AGENT_SPECS: Record<string, AgentSpec>;
|
|
15
|
+
/**
|
|
16
|
+
* Get an agent specification by ID.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getAgentSpecs(agentId: string): AgentSpec | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* List all available agent specifications.
|
|
21
|
+
*/
|
|
22
|
+
export declare function listAgentSpecs(): AgentSpec[];
|
|
23
|
+
/**
|
|
24
|
+
* Collect all required environment variables for an agent spec.
|
|
25
|
+
*
|
|
26
|
+
* Iterates over the spec's MCP servers and skills and returns the
|
|
27
|
+
* deduplicated union of their `requiredEnvVars` arrays.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getAgentSpecRequiredEnvVars(spec: AgentSpec): string[];
|