@datalayer/agent-runtimes 1.0.2 → 1.0.4
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 +14 -132
- package/lib/Agent.js +2 -2
- package/lib/AgentLexical.d.ts +1 -12
- package/lib/AgentLexical.js +3 -14
- package/lib/AgentNotebook.js +3 -3
- package/lib/App.js +2 -2
- package/lib/{components/chat/components → agents}/AgentDetails.d.ts +13 -2
- package/lib/{components/chat/components → agents}/AgentDetails.js +6 -12
- package/lib/api/agents.d.ts +47 -0
- package/lib/api/agents.js +106 -0
- package/lib/api/context.d.ts +17 -0
- package/lib/api/context.js +45 -0
- package/lib/api/evals.d.ts +27 -0
- package/lib/api/evals.js +63 -0
- package/lib/api/events.d.ts +17 -0
- package/lib/api/events.js +93 -0
- package/lib/{components/chat → api}/handler.js +1 -1
- package/lib/api/index.d.ts +15 -0
- package/lib/api/index.js +20 -0
- package/lib/api/notifications.d.ts +39 -0
- package/lib/api/notifications.js +103 -0
- package/lib/api/output.d.ts +28 -0
- package/lib/api/output.js +64 -0
- package/lib/api/tool-approvals.d.ts +62 -0
- package/lib/api/tool-approvals.js +145 -0
- package/lib/{components/chat/components → chat}/Chat.d.ts +26 -15
- package/lib/{components/chat/components → chat}/Chat.js +16 -16
- package/lib/{components/chat/components → chat}/ChatFloating.d.ts +17 -9
- package/lib/{components/chat/components → chat}/ChatFloating.js +17 -9
- package/lib/{components/chat/components → chat}/ChatInline.d.ts +2 -2
- package/lib/{components/chat/components → chat}/ChatInline.js +8 -6
- package/lib/{components/chat/components → chat}/ChatPopupStandalone.d.ts +3 -4
- package/lib/{components/chat/components → chat}/ChatPopupStandalone.js +6 -6
- package/lib/{components/chat/components → chat}/ChatSidebar.d.ts +14 -5
- package/lib/{components/chat/components → chat}/ChatSidebar.js +48 -26
- package/lib/{components/chat/components → chat}/ChatStandalone.d.ts +3 -4
- package/lib/{components/chat/components → chat}/ChatStandalone.js +5 -5
- package/lib/chat/base/ChatBase.d.ts +6 -0
- package/lib/chat/base/ChatBase.js +1338 -0
- package/lib/chat/display/EmptyState.d.ts +27 -0
- package/lib/chat/display/EmptyState.js +41 -0
- package/lib/{components/chat/components/elements → chat/display}/FloatingBrandButton.d.ts +1 -1
- package/lib/{components/chat/components/elements → chat/display}/FloatingBrandButton.js +1 -1
- package/lib/{components/chat/components/elements → chat/display}/PoweredByTag.d.ts +1 -1
- package/lib/{components/chat/components/elements → chat/header}/ChatHeader.d.ts +1 -4
- package/lib/{components/chat/components/elements → chat/header}/ChatHeader.js +1 -1
- package/lib/chat/header/ChatHeaderBase.d.ts +38 -0
- package/lib/chat/header/ChatHeaderBase.js +83 -0
- package/lib/chat/index.d.ts +66 -0
- package/lib/chat/index.js +74 -0
- package/lib/chat/indicators/McpStatusIndicator.d.ts +9 -0
- package/lib/chat/indicators/McpStatusIndicator.js +128 -0
- package/lib/chat/indicators/SandboxStatusIndicator.d.ts +10 -0
- package/lib/chat/indicators/SandboxStatusIndicator.js +175 -0
- package/lib/chat/indicators/index.d.ts +17 -0
- package/lib/chat/indicators/index.js +19 -0
- package/lib/chat/messages/ChatMessageList.d.ts +49 -0
- package/lib/chat/messages/ChatMessageList.js +332 -0
- package/lib/{components/chat/components/elements → chat/messages}/ChatMessages.d.ts +2 -2
- package/lib/{components/chat/components/elements → chat/messages}/ChatMessages.js +6 -4
- package/lib/{components/chat/components → chat}/parts/DynamicToolPart.d.ts +1 -1
- package/lib/{components/chat/components/elements → chat/parts}/MessagePart.d.ts +1 -1
- package/lib/{components/chat/components/elements → chat/parts}/MessagePart.js +4 -4
- package/lib/{components/chat/components → chat}/parts/ReasoningPart.js +1 -1
- package/lib/{components/chat/components → chat}/parts/TextPart.d.ts +1 -1
- package/lib/{components/chat/components → chat}/parts/ToolPart.js +1 -1
- package/lib/{components/chat/components → chat}/parts/index.d.ts +2 -1
- package/lib/{components/chat/components → chat}/parts/index.js +2 -1
- package/lib/chat/prompt/InputFooter.d.ts +43 -0
- package/lib/chat/prompt/InputFooter.js +135 -0
- package/lib/chat/prompt/InputPrompt.d.ts +60 -0
- package/lib/chat/prompt/InputPrompt.js +83 -0
- package/lib/chat/prompt/InputPromptFooter.d.ts +25 -0
- package/lib/chat/prompt/InputPromptFooter.js +15 -0
- package/lib/chat/prompt/InputPromptHeader.d.ts +15 -0
- package/lib/chat/prompt/InputPromptHeader.js +15 -0
- package/lib/chat/prompt/InputPromptLexical.d.ts +16 -0
- package/lib/chat/prompt/InputPromptLexical.js +122 -0
- package/lib/chat/prompt/InputPromptText.d.ts +24 -0
- package/lib/chat/prompt/InputPromptText.js +66 -0
- package/lib/chat/prompt/index.d.ts +11 -0
- package/lib/chat/prompt/index.js +15 -0
- package/lib/{components/chat/components → chat}/styles/streamdownStyles.d.ts +1 -1
- package/lib/chat/tools/ToolApprovalBanner.d.ts +31 -0
- package/lib/chat/tools/ToolApprovalBanner.js +62 -0
- package/lib/{components/chat/components/elements → chat/tools}/ToolApprovalDialog.js +1 -1
- package/lib/{components/chat/components/display → chat/tools}/ToolCallDisplay.d.ts +13 -4
- package/lib/{components/chat/components/display → chat/tools}/ToolCallDisplay.js +18 -8
- package/lib/chat/tools/index.d.ts +8 -0
- package/lib/{components/chat/components/display → chat/tools}/index.js +3 -1
- package/lib/chat/usage/TokenUsageBar.d.ts +8 -0
- package/lib/chat/usage/TokenUsageBar.js +213 -0
- package/lib/client/AgentsMixin.d.ts +216 -0
- package/lib/client/AgentsMixin.js +388 -0
- package/lib/client/index.d.ts +6 -0
- package/lib/client/index.js +10 -0
- package/lib/components/NotificationEventCard.d.ts +8 -0
- package/lib/components/NotificationEventCard.js +177 -0
- package/lib/components/OutputCard.d.ts +8 -0
- package/lib/components/OutputCard.js +94 -0
- package/lib/components/ToolApprovalCard.d.ts +33 -0
- package/lib/components/ToolApprovalCard.js +78 -0
- package/lib/components/index.d.ts +3 -7
- package/lib/components/index.js +3 -4
- package/lib/{components → config}/AgentConfiguration.d.ts +43 -21
- package/lib/{components → config}/AgentConfiguration.js +48 -28
- package/lib/config/index.d.ts +2 -0
- package/lib/config/index.js +1 -0
- package/lib/{components/chat/components → context}/ContextInspector.js +38 -8
- package/lib/{components/chat/components → context}/ContextPanel.js +27 -6
- package/lib/context/CostTracker.d.ts +37 -0
- package/lib/context/CostTracker.js +124 -0
- package/lib/context/TokenUsageChart.d.ts +10 -0
- package/lib/context/TokenUsageChart.js +288 -0
- package/lib/examples/A2UiComponentGalleryExample.d.ts +20 -0
- package/lib/examples/A2UiComponentGalleryExample.js +568 -0
- package/lib/examples/A2UiContactCardExample.d.ts +21 -0
- package/lib/examples/A2UiContactCardExample.js +432 -0
- package/lib/examples/A2UiRestaurantExample.d.ts +11 -3
- package/lib/examples/A2UiRestaurantExample.js +63 -98
- package/lib/examples/A2UiViewerExample.d.ts +21 -0
- package/lib/examples/A2UiViewerExample.js +563 -0
- package/lib/examples/AgUiAgenticExample.js +3 -3
- package/lib/examples/AgUiBackendToolRenderingExample.js +3 -3
- package/lib/examples/{AgUiHaikuGenUIExample.d.ts → AgUiHaikuGenUiExample.d.ts} +4 -4
- package/lib/examples/{AgUiHaikuGenUIExample.js → AgUiHaikuGenUiExample.js} +7 -7
- package/lib/examples/AgUiHumanInTheLoopExample.js +3 -3
- package/lib/examples/AgUiSharedStateExample.js +3 -3
- package/lib/examples/{AgUiToolsBasedGenUIExample.d.ts → AgUiToolsBasedGenUiExample.d.ts} +4 -4
- package/lib/examples/{AgUiToolsBasedGenUIExample.js → AgUiToolsBasedGenUiExample.js} +7 -7
- package/lib/examples/AgentCheckpointsExample.d.ts +19 -0
- package/lib/examples/AgentCheckpointsExample.js +500 -0
- package/lib/examples/AgentCodemodeExample.d.ts +14 -0
- package/lib/examples/AgentCodemodeExample.js +256 -0
- package/lib/examples/AgentEvalsExample.d.ts +14 -0
- package/lib/examples/AgentEvalsExample.js +210 -0
- package/lib/examples/AgentGuardrailsExample.d.ts +14 -0
- package/lib/examples/AgentGuardrailsExample.js +212 -0
- package/lib/examples/AgentMemoryExample.d.ts +14 -0
- package/lib/examples/AgentMemoryExample.js +228 -0
- package/lib/examples/AgentMonitoringExample.d.ts +13 -0
- package/lib/examples/AgentMonitoringExample.js +305 -0
- package/lib/examples/AgentNotificationsExample.d.ts +14 -0
- package/lib/examples/AgentNotificationsExample.js +267 -0
- package/lib/examples/AgentOtelExample.d.ts +25 -0
- package/lib/examples/AgentOtelExample.js +281 -0
- package/lib/examples/AgentOutputsExample.d.ts +14 -0
- package/lib/examples/AgentOutputsExample.js +205 -0
- package/lib/examples/AgentSandboxExample.d.ts +17 -0
- package/lib/examples/AgentSandboxExample.js +490 -0
- package/lib/examples/AgentSkillsExample.d.ts +3 -0
- package/lib/examples/AgentSkillsExample.js +284 -0
- package/lib/examples/AgentToolApprovalsExample.d.ts +3 -0
- package/lib/examples/AgentToolApprovalsExample.js +737 -0
- package/lib/examples/AgentTriggersExample.d.ts +14 -0
- package/lib/examples/AgentTriggersExample.js +1090 -0
- package/lib/examples/{AgentRuntimeFormExample.d.ts → AgentspecExample.d.ts} +3 -4
- package/lib/examples/{AgentRuntimeFormExample.js → AgentspecExample.js} +92 -34
- package/lib/examples/{JupyterCellExample.js → CellSimpleExample.js} +1 -1
- package/lib/examples/{AgentRuntimeCustomExample.js → ChatCustomExample.js} +3 -3
- package/lib/examples/{AgentRuntimeChatExample.js → ChatExample.js} +6 -14
- package/lib/examples/{AgentRuntimeStandaloneExample.js → ChatStandaloneExample.js} +2 -2
- package/lib/examples/CopilotKitLexicalExample.d.ts +3 -14
- package/lib/examples/CopilotKitLexicalExample.js +4 -15
- package/lib/examples/CopilotKitNotebookExample.js +4 -6
- package/lib/examples/DatalayerNotebookExample.js +2 -2
- package/lib/examples/{AgentRuntimeLexical2Example.d.ts → Lexical2Example.d.ts} +2 -13
- package/lib/examples/{AgentRuntimeLexical2Example.js → Lexical2Example.js} +8 -17
- package/lib/examples/{AgentRuntimeLexicalExample.d.ts → LexicalExample.d.ts} +1 -12
- package/lib/examples/{AgentRuntimeLexicalExample.js → LexicalExample.js} +28 -27
- package/lib/examples/{AgentRuntimeLexicalSidebarExample.d.ts → LexicalSidebarExample.d.ts} +2 -13
- package/lib/examples/{AgentRuntimeLexicalSidebarExample.js → LexicalSidebarExample.js} +6 -18
- package/lib/examples/{AgentRuntimeNotebookExample.js → NotebookExample.js} +14 -10
- package/lib/examples/{AgentRuntimeNotebookSidebarExample.js → NotebookSidebarExample.js} +5 -8
- package/lib/examples/{JupyterNotebookExample.js → NotebookSimpleExample.js} +2 -2
- package/lib/examples/ag-ui/weather/InlineWeatherCard.js +1 -1
- package/lib/examples/components/ErrorView.d.ts +14 -0
- package/lib/examples/components/ErrorView.js +20 -0
- package/lib/examples/components/ExampleWrapper.d.ts +12 -0
- package/lib/examples/components/ExampleWrapper.js +16 -0
- package/lib/examples/components/Header.d.ts +2 -2
- package/lib/examples/components/HeaderControls.js +1 -1
- package/lib/examples/components/LexicalEditor.d.ts +1 -12
- package/lib/examples/components/LexicalEditor.js +1 -12
- package/lib/examples/components/MainContent.d.ts +4 -11
- package/lib/examples/components/MainContent.js +6 -60
- package/lib/examples/components/index.d.ts +3 -0
- package/lib/examples/components/index.js +2 -0
- package/lib/examples/example-selector.d.ts +1 -1
- package/lib/examples/example-selector.js +35 -22
- package/lib/examples/index.d.ts +26 -13
- package/lib/examples/index.js +26 -12
- package/lib/examples/main.d.ts +7 -0
- package/lib/examples/main.js +21 -43
- package/lib/examples/utils/examplesStore.d.ts +4 -0
- package/lib/examples/{stores → utils}/examplesStore.js +1 -1
- package/lib/examples/utils/notebooks/Empty.ipynb.json +33 -0
- package/lib/examples/utils/notebooks/NotebookExample2.ipynb.json +48 -0
- package/lib/examples/utils/themeStore.d.ts +8 -0
- package/lib/examples/utils/themeStore.js +14 -0
- package/lib/extensions/A2UIExtension.d.ts +65 -0
- package/lib/extensions/A2UIExtension.js +202 -0
- package/lib/{components/chat/extensions → extensions}/ExtensionRegistry.d.ts +2 -3
- package/lib/{components/chat/extensions → extensions}/ExtensionRegistry.js +0 -2
- package/lib/{components/chat/extensions → extensions}/MCPUIExtension.d.ts +2 -2
- package/lib/{components/chat/extensions → extensions}/MCPUIExtension.js +1 -1
- package/lib/extensions/index.d.ts +9 -0
- package/lib/{components/chat/extensions → extensions}/index.js +2 -2
- package/lib/hooks/index.d.ts +33 -16
- package/lib/hooks/index.js +33 -16
- package/lib/hooks/useAIAgentsWebSocket.d.ts +29 -0
- package/lib/hooks/useAIAgentsWebSocket.js +136 -0
- package/lib/hooks/{useAGUI.d.ts → useAgUi.d.ts} +2 -2
- package/lib/hooks/{useAGUI.js → useAgUi.js} +2 -2
- package/lib/hooks/useAgents.d.ts +150 -11
- package/lib/hooks/useAgents.js +623 -61
- package/lib/hooks/{useAgentStore.d.ts → useAgentsCatalog.d.ts} +3 -8
- package/lib/hooks/{useAgentStore.js → useAgentsCatalog.js} +9 -3
- package/lib/hooks/useAgentsRegistry.d.ts +10 -0
- package/lib/hooks/useAgentsRegistry.js +20 -0
- package/lib/hooks/useAgentsService.d.ts +22 -0
- package/lib/hooks/useAgentsService.js +146 -0
- package/lib/hooks/useChat.d.ts +2 -2
- package/lib/hooks/useChat.js +14 -8
- package/lib/hooks/useCheckpoints.d.ts +176 -0
- package/lib/hooks/useCheckpoints.js +466 -0
- package/lib/hooks/useConfig.d.ts +11 -0
- package/lib/hooks/useConfig.js +46 -0
- package/lib/hooks/useContextSnapshot.d.ts +11 -0
- package/lib/hooks/useContextSnapshot.js +44 -0
- package/lib/hooks/useMonitoring.d.ts +24 -0
- package/lib/hooks/useMonitoring.js +111 -0
- package/lib/hooks/useNotifications.d.ts +67 -0
- package/lib/hooks/useNotifications.js +208 -0
- package/lib/hooks/useSandbox.d.ts +12 -0
- package/lib/hooks/useSandbox.js +49 -0
- package/lib/hooks/useSkills.d.ts +13 -0
- package/lib/hooks/useSkills.js +46 -0
- package/lib/hooks/useToolApprovals.d.ts +45 -0
- package/lib/hooks/useToolApprovals.js +126 -0
- package/lib/hooks/useTools.d.ts +4 -4
- package/lib/hooks/useTools.js +2 -2
- package/lib/hooks/{useVercelChat.d.ts → useVercelAI.d.ts} +3 -3
- package/lib/hooks/{useVercelChat.js → useVercelAI.js} +2 -2
- package/lib/{components/chat/components → identity}/AgentIdentity.d.ts +1 -1
- package/lib/{components/chat/components → identity}/AgentIdentity.js +4 -3
- package/lib/identity/index.d.ts +1 -0
- package/lib/identity/index.js +2 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.js +3 -2
- package/lib/{components/chat/inference → inference}/BaseInferenceProvider.d.ts +3 -3
- package/lib/{components/chat/inference → inference}/DatalayerInferenceProvider.d.ts +3 -3
- package/lib/{components/chat/inference → inference}/DatalayerInferenceProvider.js +1 -1
- package/lib/{components/chat/inference → inference}/SelfHostedInferenceProvider.d.ts +2 -2
- package/lib/{components/chat/inference → inference}/SelfHostedInferenceProvider.js +1 -1
- package/lib/{components/chat/inference → inference}/index.d.ts +1 -1
- package/lib/{components/chat/inference → inference}/index.js +1 -1
- package/lib/lexical/ChatInlinePlugin.d.ts +1 -1
- package/lib/lexical/ChatInlinePlugin.js +1 -1
- package/lib/{components → mcp}/McpServerManager.d.ts +1 -2
- package/lib/mcp/index.d.ts +1 -0
- package/lib/{specs/agents/codeai → mcp}/index.js +1 -1
- package/lib/{components/chat/middleware → middleware}/MiddlewarePipeline.d.ts +3 -3
- package/lib/{components/chat/middleware → middleware}/index.d.ts +1 -1
- package/lib/{components/chat/middleware → middleware}/index.js +1 -1
- package/lib/{components/chat/protocols → protocols}/A2AAdapter.d.ts +6 -6
- package/lib/{components/chat/protocols → protocols}/A2AAdapter.js +3 -3
- package/lib/{components/chat/protocols → protocols}/ACPAdapter.d.ts +6 -6
- package/lib/{components/chat/protocols → protocols}/ACPAdapter.js +4 -4
- package/lib/{components/chat/protocols → protocols}/AGUIAdapter.d.ts +14 -6
- package/lib/{components/chat/protocols → protocols}/AGUIAdapter.js +72 -10
- package/lib/{components/chat/protocols → protocols}/BaseProtocolAdapter.d.ts +6 -6
- package/lib/{components/chat/protocols → protocols}/BaseProtocolAdapter.js +1 -1
- package/lib/{components/chat/protocols → protocols}/VercelAIAdapter.d.ts +33 -7
- package/lib/protocols/VercelAIAdapter.js +748 -0
- package/lib/{components/chat/protocols → protocols}/index.d.ts +1 -2
- package/lib/{components/chat/protocols → protocols}/index.js +1 -1
- package/lib/shims/json5.d.ts +4 -0
- package/lib/shims/json5.js +8 -0
- package/lib/specs/agents/agents.d.ts +54 -0
- package/lib/specs/agents/agents.js +1489 -0
- package/lib/specs/agents/index.js +15 -12
- package/lib/specs/envvars.d.ts +11 -19
- package/lib/specs/envvars.js +52 -38
- package/lib/specs/evals.d.ts +20 -0
- package/lib/specs/evals.js +133 -0
- package/lib/specs/events.d.ts +26 -0
- package/lib/specs/events.js +140 -0
- package/lib/specs/frontendTools.d.ts +14 -0
- package/lib/specs/frontendTools.js +53 -0
- package/lib/specs/guardrails.d.ts +29 -0
- package/lib/specs/guardrails.js +310 -0
- package/lib/specs/index.d.ts +15 -2
- package/lib/specs/index.js +15 -2
- package/lib/specs/mcpServers.d.ts +13 -11
- package/lib/specs/mcpServers.js +75 -50
- package/lib/specs/memory.d.ts +36 -0
- package/lib/specs/memory.js +112 -0
- package/lib/specs/models.d.ts +21 -34
- package/lib/specs/models.js +66 -66
- package/lib/specs/notifications.d.ts +17 -0
- package/lib/specs/notifications.js +103 -0
- package/lib/specs/outputs.d.ts +19 -0
- package/lib/specs/outputs.js +106 -0
- package/lib/specs/skills.d.ts +7 -16
- package/lib/specs/skills.js +95 -18
- package/lib/specs/teams/index.d.ts +17 -0
- package/lib/specs/teams/index.js +35 -0
- package/lib/specs/teams/teams.d.ts +27 -0
- package/lib/specs/teams/teams.js +1000 -0
- package/lib/specs/tools.d.ts +15 -0
- package/lib/specs/tools.js +86 -0
- package/lib/specs/triggers.d.ts +15 -0
- package/lib/specs/triggers.js +67 -0
- package/lib/stores/agentsStore.d.ts +123 -0
- package/lib/stores/agentsStore.js +270 -0
- package/lib/{components/chat/store → stores}/chatStore.d.ts +3 -2
- package/lib/{components/chat/store → stores}/chatStore.js +2 -2
- package/lib/{components/chat/store → stores}/conversationStore.d.ts +1 -1
- package/lib/{components/chat/store → stores}/conversationStore.js +1 -1
- package/lib/{components/chat/store → stores}/index.d.ts +3 -2
- package/lib/{components/chat/store → stores}/index.js +3 -2
- package/lib/{components/chat/tools → tools}/ToolExecutor.d.ts +2 -2
- package/lib/{components/chat/tools → tools}/ToolExecutor.js +1 -1
- package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.d.ts +1 -1
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +14 -10
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +31 -21
- package/lib/tools/adapters/agent-runtimes/notebookHooks.d.ts +1 -1
- package/lib/tools/index.d.ts +3 -0
- package/lib/tools/index.js +3 -7
- package/lib/types/a2a.d.ts +39 -0
- package/lib/types/acp.d.ts +21 -0
- package/lib/types/ag-ui.d.ts +25 -0
- package/lib/types/agents-lifecycle.d.ts +36 -0
- package/lib/types/agents.d.ts +80 -0
- package/lib/types/agents.js +22 -0
- package/lib/types/agentspecs.d.ts +90 -0
- package/lib/{components/chat/components/base/ChatBase.d.ts → types/chat.d.ts} +59 -99
- package/lib/types/checkpoints.d.ts +32 -0
- package/lib/types/checkpoints.js +5 -0
- package/lib/types/config.d.ts +67 -0
- package/lib/{runtime/types.js → types/config.js} +2 -2
- package/lib/types/connection.d.ts +31 -0
- package/lib/types/connection.js +5 -0
- package/lib/types/context.d.ts +67 -0
- package/lib/types/context.js +5 -0
- package/lib/types/cost.d.ts +42 -0
- package/lib/types/cost.js +5 -0
- package/lib/types/envvars.d.ts +21 -0
- package/lib/types/envvars.js +5 -0
- package/lib/types/evals.d.ts +66 -0
- package/lib/types/evals.js +5 -0
- package/lib/types/events.d.ts +49 -0
- package/lib/types/events.js +5 -0
- package/lib/types/eventspecs.d.ts +39 -0
- package/lib/types/eventspecs.js +5 -0
- package/lib/types/examples.d.ts +31 -0
- package/lib/types/examples.js +5 -0
- package/lib/{components/chat/types → types}/execution.d.ts +10 -1
- package/lib/{components/chat/types/extension.d.ts → types/extensions.d.ts} +3 -3
- package/lib/types/guardrails.d.ts +106 -0
- package/lib/types/guardrails.js +5 -0
- package/lib/types/index.d.ts +36 -2
- package/lib/types/index.js +35 -2
- package/lib/{components/chat/types → types}/inference.d.ts +3 -3
- package/lib/types/inference.js +5 -0
- package/lib/types/mcp.d.ts +117 -0
- package/lib/types/mcp.js +27 -0
- package/lib/types/memory.d.ts +23 -0
- package/lib/types/memory.js +5 -0
- package/lib/{components/chat/types/message.d.ts → types/messages.d.ts} +20 -1
- package/lib/{components/chat/types → types}/middleware.d.ts +3 -3
- package/lib/types/models.d.ts +63 -0
- package/lib/types/models.js +5 -0
- package/lib/types/notifications.d.ts +85 -0
- package/lib/types/notifications.js +5 -0
- package/lib/types/outputs.d.ts +51 -0
- package/lib/types/outputs.js +5 -0
- package/lib/{components/chat/types → types}/protocol.d.ts +37 -99
- package/lib/types/protocol.js +5 -0
- package/lib/types/sandbox.d.ts +27 -0
- package/lib/types/sandbox.js +24 -0
- package/lib/types/skills.d.ts +74 -0
- package/lib/types/skills.js +5 -0
- package/lib/types/teams.d.ts +133 -0
- package/lib/types/teams.js +5 -0
- package/lib/types/tool-approvals.d.ts +39 -0
- package/lib/types/tool-approvals.js +5 -0
- package/lib/{components/chat/types/tool.d.ts → types/tools.d.ts} +61 -4
- package/lib/types/triggers.d.ts +48 -0
- package/lib/types/triggers.js +5 -0
- package/lib/types/usage.d.ts +36 -0
- package/lib/types/usage.js +5 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +5 -0
- package/lib/utils/utils.d.ts +60 -0
- package/lib/utils/utils.js +205 -0
- package/package.json +13 -14
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- package/scripts/codegen/generate_agents.py +377 -61
- package/scripts/codegen/generate_envvars.py +36 -35
- package/scripts/codegen/generate_evals.py +279 -0
- package/scripts/codegen/generate_events.py +320 -0
- package/scripts/codegen/generate_frontend_tools.py +266 -0
- package/scripts/codegen/generate_guardrails.py +475 -0
- package/scripts/codegen/generate_mcp_servers.py +36 -9
- package/scripts/codegen/generate_memory.py +468 -0
- package/scripts/codegen/generate_models.py +22 -46
- package/scripts/codegen/generate_notifications.py +309 -0
- package/scripts/codegen/generate_outputs.py +267 -0
- package/scripts/codegen/generate_skills.py +108 -51
- package/scripts/codegen/generate_teams.py +922 -0
- package/scripts/codegen/generate_tools.py +346 -0
- package/scripts/codegen/generate_triggers.py +295 -0
- package/scripts/codegen/versioning.py +53 -0
- package/style/primer-primitives.css +1 -6
- package/lib/components/chat/components/base/ChatBase.js +0 -2242
- package/lib/components/chat/components/base/InputPrompt.d.ts +0 -42
- package/lib/components/chat/components/base/InputPrompt.js +0 -131
- package/lib/components/chat/components/display/index.d.ts +0 -6
- package/lib/components/chat/components/index.d.ts +0 -26
- package/lib/components/chat/components/index.js +0 -39
- package/lib/components/chat/extensions/A2UIExtension.d.ts +0 -87
- package/lib/components/chat/extensions/A2UIExtension.js +0 -312
- package/lib/components/chat/extensions/index.d.ts +0 -10
- package/lib/components/chat/index.d.ts +0 -61
- package/lib/components/chat/index.js +0 -76
- package/lib/components/chat/protocols/VercelAIAdapter.js +0 -315
- package/lib/components/chat/tools/index.d.ts +0 -8
- package/lib/components/chat/tools/index.js +0 -11
- package/lib/components/chat/types/index.d.ts +0 -12
- package/lib/components/chat/types/index.js +0 -17
- package/lib/components/sparklines/Sparklines.d.ts +0 -16
- package/lib/components/sparklines/Sparklines.js +0 -65
- package/lib/components/sparklines/SparklinesLine.d.ts +0 -8
- package/lib/components/sparklines/SparklinesLine.js +0 -37
- package/lib/components/sparklines/dataProcessing.d.ts +0 -25
- package/lib/components/sparklines/dataProcessing.js +0 -35
- package/lib/components/sparklines/index.d.ts +0 -4
- package/lib/components/sparklines/index.js +0 -7
- package/lib/components/sparklines/types.d.ts +0 -36
- package/lib/examples/stores/examplesStore.d.ts +0 -5
- package/lib/examples/stores/notebooks/Empty.ipynb.json +0 -33
- package/lib/examples/stores/notebooks/NotebookExample2.ipynb.json +0 -48
- package/lib/examples/stores/themeStore.d.ts +0 -33
- package/lib/examples/stores/themeStore.js +0 -38
- package/lib/hooks/useAgentRuntimes.d.ts +0 -350
- package/lib/hooks/useAgentRuntimes.js +0 -78
- package/lib/hooks/useKeyboardShortcuts.d.ts +0 -47
- package/lib/hooks/useKeyboardShortcuts.js +0 -153
- package/lib/hooks/useMobile.d.ts +0 -1
- package/lib/hooks/useMobile.js +0 -19
- package/lib/hooks/useNotebookAIAgent.d.ts +0 -8
- package/lib/hooks/useNotebookAIAgent.js +0 -73
- package/lib/renderers/a2ui/components/A2UIRenderer.d.ts +0 -7
- package/lib/renderers/a2ui/components/A2UIRenderer.js +0 -102
- package/lib/renderers/a2ui/components/SurfaceRenderer.d.ts +0 -7
- package/lib/renderers/a2ui/components/SurfaceRenderer.js +0 -101
- package/lib/renderers/a2ui/components/content/AudioPlayer.d.ts +0 -9
- package/lib/renderers/a2ui/components/content/AudioPlayer.js +0 -38
- package/lib/renderers/a2ui/components/content/Divider.d.ts +0 -9
- package/lib/renderers/a2ui/components/content/Divider.js +0 -35
- package/lib/renderers/a2ui/components/content/Icon.d.ts +0 -9
- package/lib/renderers/a2ui/components/content/Icon.js +0 -110
- package/lib/renderers/a2ui/components/content/Image.d.ts +0 -9
- package/lib/renderers/a2ui/components/content/Image.js +0 -61
- package/lib/renderers/a2ui/components/content/Text.d.ts +0 -9
- package/lib/renderers/a2ui/components/content/Text.js +0 -64
- package/lib/renderers/a2ui/components/content/Video.d.ts +0 -9
- package/lib/renderers/a2ui/components/content/Video.js +0 -37
- package/lib/renderers/a2ui/components/content/index.d.ts +0 -6
- package/lib/renderers/a2ui/components/content/index.js +0 -25
- package/lib/renderers/a2ui/components/index.d.ts +0 -5
- package/lib/renderers/a2ui/components/index.js +0 -24
- package/lib/renderers/a2ui/components/interactive/Button.d.ts +0 -11
- package/lib/renderers/a2ui/components/interactive/Button.js +0 -71
- package/lib/renderers/a2ui/components/interactive/CheckBox.d.ts +0 -9
- package/lib/renderers/a2ui/components/interactive/CheckBox.js +0 -48
- package/lib/renderers/a2ui/components/interactive/DateTimeInput.d.ts +0 -9
- package/lib/renderers/a2ui/components/interactive/DateTimeInput.js +0 -62
- package/lib/renderers/a2ui/components/interactive/MultipleChoice.d.ts +0 -9
- package/lib/renderers/a2ui/components/interactive/MultipleChoice.js +0 -73
- package/lib/renderers/a2ui/components/interactive/Slider.d.ts +0 -9
- package/lib/renderers/a2ui/components/interactive/Slider.js +0 -53
- package/lib/renderers/a2ui/components/interactive/TextField.d.ts +0 -9
- package/lib/renderers/a2ui/components/interactive/TextField.js +0 -72
- package/lib/renderers/a2ui/components/interactive/index.d.ts +0 -6
- package/lib/renderers/a2ui/components/interactive/index.js +0 -25
- package/lib/renderers/a2ui/components/layout/Card.d.ts +0 -11
- package/lib/renderers/a2ui/components/layout/Card.js +0 -30
- package/lib/renderers/a2ui/components/layout/Column.d.ts +0 -11
- package/lib/renderers/a2ui/components/layout/Column.js +0 -65
- package/lib/renderers/a2ui/components/layout/List.d.ts +0 -11
- package/lib/renderers/a2ui/components/layout/List.js +0 -55
- package/lib/renderers/a2ui/components/layout/Modal.d.ts +0 -11
- package/lib/renderers/a2ui/components/layout/Modal.js +0 -58
- package/lib/renderers/a2ui/components/layout/Row.d.ts +0 -11
- package/lib/renderers/a2ui/components/layout/Row.js +0 -65
- package/lib/renderers/a2ui/components/layout/Tabs.d.ts +0 -11
- package/lib/renderers/a2ui/components/layout/Tabs.js +0 -48
- package/lib/renderers/a2ui/components/layout/index.d.ts +0 -6
- package/lib/renderers/a2ui/components/layout/index.js +0 -25
- package/lib/renderers/a2ui/context/A2UIContext.d.ts +0 -17
- package/lib/renderers/a2ui/context/A2UIContext.js +0 -54
- package/lib/renderers/a2ui/context/ThemeContext.d.ts +0 -20
- package/lib/renderers/a2ui/context/ThemeContext.js +0 -333
- package/lib/renderers/a2ui/hooks/useA2UI.d.ts +0 -36
- package/lib/renderers/a2ui/hooks/useA2UI.js +0 -62
- package/lib/renderers/a2ui/hooks/useDataBinding.d.ts +0 -8
- package/lib/renderers/a2ui/hooks/useDataBinding.js +0 -83
- package/lib/renderers/a2ui/index.d.ts +0 -9
- package/lib/renderers/a2ui/index.js +0 -28
- package/lib/renderers/a2ui/lib/utils.d.ts +0 -11
- package/lib/renderers/a2ui/lib/utils.js +0 -38
- package/lib/renderers/a2ui/types/index.d.ts +0 -17
- package/lib/runtime/index.d.ts +0 -38
- package/lib/runtime/index.js +0 -40
- package/lib/runtime/runtimeStore.d.ts +0 -76
- package/lib/runtime/runtimeStore.js +0 -184
- package/lib/runtime/types.d.ts +0 -84
- package/lib/runtime/useAgentConnection.d.ts +0 -45
- package/lib/runtime/useAgentConnection.js +0 -112
- package/lib/runtime/useAgentRuntime.d.ts +0 -93
- package/lib/runtime/useAgentRuntime.js +0 -125
- package/lib/specs/agents/codeai/agents.d.ts +0 -28
- package/lib/specs/agents/codeai/agents.js +0 -179
- package/lib/specs/agents/codeai/index.d.ts +0 -1
- package/lib/specs/agents/codemode-paper/agents.d.ts +0 -31
- package/lib/specs/agents/codemode-paper/agents.js +0 -378
- package/lib/specs/agents/codemode-paper/index.d.ts +0 -1
- package/lib/specs/agents/codemode-paper/index.js +0 -5
- package/lib/specs/agents/datalayer-ai/agents.d.ts +0 -31
- package/lib/specs/agents/datalayer-ai/agents.js +0 -352
- package/lib/specs/agents/datalayer-ai/index.d.ts +0 -1
- package/lib/specs/agents/datalayer-ai/index.js +0 -5
- package/lib/specs/agents/mocks/agents.d.ts +0 -43
- package/lib/specs/agents/mocks/agents.js +0 -2293
- package/lib/specs/agents/mocks/index.d.ts +0 -1
- package/lib/specs/agents/mocks/index.js +0 -5
- package/lib/state/index.d.ts +0 -1
- package/lib/state/index.js +0 -5
- package/lib/state/substates/AIAgentState.d.ts +0 -80
- package/lib/state/substates/AIAgentState.js +0 -108
- package/lib/state/substates/index.d.ts +0 -1
- package/lib/state/substates/index.js +0 -5
- package/lib/types/AIAgent.d.ts +0 -17
- package/lib/types/Types.d.ts +0 -217
- /package/lib/{components/chat → api}/handler.d.ts +0 -0
- /package/lib/{renderers/index.d.ts → api/utils.d.ts} +0 -0
- /package/lib/{renderers/index.js → api/utils.js} +0 -0
- /package/lib/{components/chat/components/elements → chat/display}/PoweredByTag.js +0 -0
- /package/lib/{components/chat/components → chat}/parts/DynamicToolPart.js +0 -0
- /package/lib/{components/chat/components → chat}/parts/ReasoningPart.d.ts +0 -0
- /package/lib/{components/chat/components → chat}/parts/TextPart.js +0 -0
- /package/lib/{components/chat/components → chat}/parts/ToolPart.d.ts +0 -0
- /package/lib/{components/chat/components → chat}/styles/streamdownStyles.js +0 -0
- /package/lib/{components/chat/components/elements → chat/tools}/ToolApprovalDialog.d.ts +0 -0
- /package/lib/{components/chat/components → context}/ContextDistribution.d.ts +0 -0
- /package/lib/{components/chat/components → context}/ContextDistribution.js +0 -0
- /package/lib/{components/chat/components → context}/ContextInspector.d.ts +0 -0
- /package/lib/{components/chat/components → context}/ContextPanel.d.ts +0 -0
- /package/lib/{components/chat/components → context}/ContextUsage.d.ts +0 -0
- /package/lib/{components/chat/components → context}/ContextUsage.js +0 -0
- /package/lib/examples/{JupyterCellExample.d.ts → CellSimpleExample.d.ts} +0 -0
- /package/lib/examples/{AgentRuntimeCustomExample.d.ts → ChatCustomExample.d.ts} +0 -0
- /package/lib/examples/{AgentRuntimeChatExample.d.ts → ChatExample.d.ts} +0 -0
- /package/lib/examples/{AgentRuntimeStandaloneExample.d.ts → ChatStandaloneExample.d.ts} +0 -0
- /package/lib/examples/{AgentRuntimeNotebookExample.d.ts → NotebookExample.d.ts} +0 -0
- /package/lib/examples/{AgentRuntimeNotebookSidebarExample.d.ts → NotebookSidebarExample.d.ts} +0 -0
- /package/lib/examples/{JupyterNotebookExample.d.ts → NotebookSimpleExample.d.ts} +0 -0
- /package/lib/examples/{stores → utils}/agents/earthquake-detector.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/agents/earthquake-detector.json +0 -0
- /package/lib/examples/{stores → utils}/agents/earthquake-detector.lexical.json +0 -0
- /package/lib/examples/{stores → utils}/agents/sales-forecaster.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/agents/sales-forecaster.json +0 -0
- /package/lib/examples/{stores → utils}/agents/sales-forecaster.lexical.json +0 -0
- /package/lib/examples/{stores → utils}/agents/social-post-generator.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/agents/social-post-generator.json +0 -0
- /package/lib/examples/{stores → utils}/agents/social-post-generator.lexical.json +0 -0
- /package/lib/examples/{stores → utils}/agents/stock-market.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/agents/stock-market.json +0 -0
- /package/lib/examples/{stores → utils}/agents/stock-market.lexical.json +0 -0
- /package/lib/examples/{stores → utils}/notebooks/IPyWidgetsExample.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/notebooks/IPyWidgetsExampleWithState.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/notebooks/Lite.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/notebooks/Matplotlib.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/notebooks/NotebookExample1.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/notebooks/NotebookOutputs.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/notebooks/NotebookToCExample.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/notebooks/OutputIPyWidgetsExample.d.ts +0 -0
- /package/lib/examples/{stores → utils}/notebooks/OutputIPyWidgetsExample.js +0 -0
- /package/lib/examples/{stores → utils}/notebooks/PyGWalker.ipynb.json +0 -0
- /package/lib/examples/{stores → utils}/themedProvider.d.ts +0 -0
- /package/lib/examples/{stores → utils}/themedProvider.js +0 -0
- /package/lib/{components/chat/inference → inference}/BaseInferenceProvider.js +0 -0
- /package/lib/{components → mcp}/McpServerManager.js +0 -0
- /package/lib/{components/chat/middleware → middleware}/MiddlewarePipeline.js +0 -0
- /package/lib/{components/chat/types/inference.js → types/a2a.js} +0 -0
- /package/lib/{components/chat/types/protocol.js → types/acp.js} +0 -0
- /package/lib/{components/sparklines/types.js → types/ag-ui.js} +0 -0
- /package/lib/{renderers/a2ui/types/index.js → types/agents-lifecycle.js} +0 -0
- /package/lib/types/{AIAgent.js → agentspecs.js} +0 -0
- /package/lib/types/{Types.js → chat.js} +0 -0
- /package/lib/{components/chat/types → types}/execution.js +0 -0
- /package/lib/{components/chat/types/extension.js → types/extensions.js} +0 -0
- /package/lib/{components/chat/types/message.js → types/messages.js} +0 -0
- /package/lib/{components/chat/types → types}/middleware.js +0 -0
- /package/lib/{components/chat/types/tool.js → types/tools.js} +0 -0
|
@@ -15,6 +15,12 @@ from pathlib import Path
|
|
|
15
15
|
from typing import Any, Dict, List
|
|
16
16
|
|
|
17
17
|
import yaml
|
|
18
|
+
from versioning import (
|
|
19
|
+
ensure_spec_version,
|
|
20
|
+
split_spec_ref,
|
|
21
|
+
version_suffix,
|
|
22
|
+
versioned_ref,
|
|
23
|
+
)
|
|
18
24
|
|
|
19
25
|
|
|
20
26
|
def _fmt_list(items: list[str]) -> str:
|
|
@@ -52,6 +58,7 @@ def load_yaml_specs(specs_dir: Path) -> List[tuple[str, Dict[str, Any]]]:
|
|
|
52
58
|
with open(yaml_file, "r") as f:
|
|
53
59
|
spec = yaml.safe_load(f)
|
|
54
60
|
if spec: # Skip empty files
|
|
61
|
+
ensure_spec_version(spec)
|
|
55
62
|
specs.append(("", spec))
|
|
56
63
|
|
|
57
64
|
# Then, load specs from subdirectories (one level deep)
|
|
@@ -61,6 +68,7 @@ def load_yaml_specs(specs_dir: Path) -> List[tuple[str, Dict[str, Any]]]:
|
|
|
61
68
|
with open(yaml_file, "r") as f:
|
|
62
69
|
spec = yaml.safe_load(f)
|
|
63
70
|
if spec: # Skip empty files
|
|
71
|
+
ensure_spec_version(spec)
|
|
64
72
|
specs.append((subdir.name, spec))
|
|
65
73
|
|
|
66
74
|
return specs
|
|
@@ -116,6 +124,7 @@ from agent_runtimes.types import AgentSpec
|
|
|
116
124
|
|
|
117
125
|
for spec in folder_specs:
|
|
118
126
|
agent_id = spec["id"]
|
|
127
|
+
version = spec["version"]
|
|
119
128
|
# Prefix agent ID with folder name for uniqueness
|
|
120
129
|
full_agent_id = f"{folder}/{agent_id}" if folder else agent_id
|
|
121
130
|
# Create constant name: e.g., "data-acquisition" -> "DATA_ACQUISITION_AGENT_SPEC"
|
|
@@ -127,14 +136,29 @@ from agent_runtimes.types import AgentSpec
|
|
|
127
136
|
const_name = base_name + "_SPEC"
|
|
128
137
|
else:
|
|
129
138
|
const_name = base_name + "_AGENT_SPEC"
|
|
139
|
+
const_name += version_suffix(version)
|
|
130
140
|
agent_ids.append((full_agent_id, const_name, folder))
|
|
131
141
|
|
|
132
142
|
# Get MCP servers
|
|
133
|
-
|
|
143
|
+
mcp_server_refs = [
|
|
144
|
+
split_spec_ref(sid)[0] for sid in spec.get("mcp_servers", [])
|
|
145
|
+
]
|
|
134
146
|
mcp_servers_str = ", ".join(
|
|
135
|
-
f'MCP_SERVER_CATALOG["{sid}"]' for sid in
|
|
147
|
+
f'MCP_SERVER_CATALOG["{sid}"]' for sid in mcp_server_refs
|
|
136
148
|
)
|
|
137
149
|
|
|
150
|
+
skill_refs = [
|
|
151
|
+
versioned_ref(*split_spec_ref(skill))
|
|
152
|
+
for skill in spec.get("skills", [])
|
|
153
|
+
]
|
|
154
|
+
tool_refs = [
|
|
155
|
+
versioned_ref(*split_spec_ref(tool)) for tool in spec.get("tools", [])
|
|
156
|
+
]
|
|
157
|
+
frontend_tool_refs = [
|
|
158
|
+
versioned_ref(*split_spec_ref(ft))
|
|
159
|
+
for ft in spec.get("frontend_tools", [])
|
|
160
|
+
]
|
|
161
|
+
|
|
138
162
|
# Format optional fields
|
|
139
163
|
icon = f'"{spec.get("icon")}"' if spec.get("icon") else "None"
|
|
140
164
|
emoji = f'"{spec.get("emoji")}"' if spec.get("emoji") else "None"
|
|
@@ -168,7 +192,11 @@ from agent_runtimes.types import AgentSpec
|
|
|
168
192
|
|
|
169
193
|
# Clean description for Python (single line)
|
|
170
194
|
description = (
|
|
171
|
-
spec["description"]
|
|
195
|
+
spec["description"]
|
|
196
|
+
.replace("\n", " ")
|
|
197
|
+
.replace(" ", " ")
|
|
198
|
+
.strip()
|
|
199
|
+
.replace('"', '\\"')
|
|
172
200
|
)
|
|
173
201
|
|
|
174
202
|
# Use triple quotes for multiline system prompts
|
|
@@ -209,17 +237,21 @@ from agent_runtimes.types import AgentSpec
|
|
|
209
237
|
auth_policy = spec.get("authorization_policy")
|
|
210
238
|
auth_policy_str = f'"{auth_policy}"' if auth_policy is not None else "None"
|
|
211
239
|
notifs = spec.get("notifications")
|
|
212
|
-
|
|
240
|
+
memory_val = spec.get("memory")
|
|
241
|
+
memory_str = f'"{memory_val}"' if memory_val else "None"
|
|
213
242
|
|
|
214
243
|
code += f'''{const_name} = AgentSpec(
|
|
215
244
|
id="{full_agent_id}",
|
|
245
|
+
version="{version}",
|
|
216
246
|
name="{spec["name"]}",
|
|
217
247
|
description="{description}",
|
|
218
248
|
tags={_fmt_list(spec.get("tags", []))},
|
|
219
249
|
enabled={spec.get("enabled", True)},
|
|
220
250
|
model={model_str},
|
|
221
251
|
mcp_servers=[{mcp_servers_str}],
|
|
222
|
-
skills={_fmt_list(
|
|
252
|
+
skills={_fmt_list(skill_refs)},
|
|
253
|
+
tools={_fmt_list(tool_refs)},
|
|
254
|
+
frontend_tools={_fmt_list(frontend_tool_refs)},
|
|
223
255
|
environment_name="{spec.get("environment_name", "ai-agents-env")}",
|
|
224
256
|
icon={icon},
|
|
225
257
|
emoji={emoji},
|
|
@@ -244,7 +276,7 @@ from agent_runtimes.types import AgentSpec
|
|
|
244
276
|
advanced={_fmt_py_literal(advanced_val)},
|
|
245
277
|
authorization_policy={auth_policy_str},
|
|
246
278
|
notifications={_fmt_py_literal(notifs)},
|
|
247
|
-
|
|
279
|
+
memory={memory_str},
|
|
248
280
|
)
|
|
249
281
|
|
|
250
282
|
'''
|
|
@@ -273,7 +305,7 @@ AGENT_SPECS: Dict[str, AgentSpec] = {
|
|
|
273
305
|
|
|
274
306
|
def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
275
307
|
\"\"\"
|
|
276
|
-
Get an agent specification by ID.
|
|
308
|
+
Get an agent specification by ID (accepts both bare and versioned refs).
|
|
277
309
|
|
|
278
310
|
Args:
|
|
279
311
|
agent_id: The unique identifier of the agent.
|
|
@@ -281,7 +313,13 @@ def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
|
281
313
|
Returns:
|
|
282
314
|
The AgentSpec configuration, or None if not found.
|
|
283
315
|
\"\"\"
|
|
284
|
-
|
|
316
|
+
spec = AGENT_SPECS.get(agent_id)
|
|
317
|
+
if spec is not None:
|
|
318
|
+
return spec
|
|
319
|
+
base, _, ver = agent_id.rpartition(':')
|
|
320
|
+
if base and '.' in ver:
|
|
321
|
+
return AGENT_SPECS.get(base)
|
|
322
|
+
return None
|
|
285
323
|
|
|
286
324
|
|
|
287
325
|
def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
@@ -304,7 +342,10 @@ def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
|
304
342
|
|
|
305
343
|
|
|
306
344
|
def generate_typescript_code(
|
|
307
|
-
specs: List[tuple[str, Dict[str, Any]]],
|
|
345
|
+
specs: List[tuple[str, Dict[str, Any]]],
|
|
346
|
+
mcp_specs_dir: str,
|
|
347
|
+
skills_specs_dir: str,
|
|
348
|
+
tools_specs_dir: str,
|
|
308
349
|
) -> str:
|
|
309
350
|
"""Generate TypeScript code from agent specifications."""
|
|
310
351
|
# Load available MCP servers from specs
|
|
@@ -312,46 +353,138 @@ def generate_typescript_code(
|
|
|
312
353
|
import os
|
|
313
354
|
|
|
314
355
|
mcp_server_files = glob.glob(os.path.join(mcp_specs_dir, "*.yaml"))
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
356
|
+
mcp_specs = []
|
|
357
|
+
for fpath in mcp_server_files:
|
|
358
|
+
with open(fpath, "r") as f:
|
|
359
|
+
spec = yaml.safe_load(f)
|
|
360
|
+
ensure_spec_version(spec)
|
|
361
|
+
mcp_specs.append(spec)
|
|
362
|
+
mcp_specs.sort(key=lambda s: s["id"])
|
|
319
363
|
|
|
320
364
|
# Load available skills from specs
|
|
321
365
|
skill_files = glob.glob(os.path.join(skills_specs_dir, "*.yaml"))
|
|
322
|
-
|
|
323
|
-
|
|
366
|
+
skill_specs = []
|
|
367
|
+
for fpath in skill_files:
|
|
368
|
+
with open(fpath, "r") as f:
|
|
369
|
+
spec = yaml.safe_load(f)
|
|
370
|
+
ensure_spec_version(spec)
|
|
371
|
+
skill_specs.append(spec)
|
|
372
|
+
skill_specs.sort(key=lambda s: s["id"])
|
|
373
|
+
|
|
374
|
+
# Load available tools from specs
|
|
375
|
+
tool_files = glob.glob(os.path.join(tools_specs_dir, "*.yaml"))
|
|
376
|
+
tool_specs = []
|
|
377
|
+
for fpath in tool_files:
|
|
378
|
+
with open(fpath, "r") as f:
|
|
379
|
+
spec = yaml.safe_load(f)
|
|
380
|
+
ensure_spec_version(spec)
|
|
381
|
+
tool_specs.append(spec)
|
|
382
|
+
tool_specs.sort(key=lambda s: s["id"])
|
|
324
383
|
|
|
325
384
|
# Determine which MCP servers and skills are actually used in these specs
|
|
326
385
|
used_mcp_servers = set()
|
|
327
386
|
used_skills = set()
|
|
387
|
+
used_tools = set()
|
|
388
|
+
used_frontend_tools = set()
|
|
328
389
|
for _, spec in specs:
|
|
329
390
|
for server in spec.get("mcp_servers", []):
|
|
330
|
-
used_mcp_servers.add(server)
|
|
391
|
+
used_mcp_servers.add(versioned_ref(*split_spec_ref(server)))
|
|
331
392
|
for skill in spec.get("skills", []):
|
|
332
|
-
used_skills.add(skill)
|
|
393
|
+
used_skills.add(versioned_ref(*split_spec_ref(skill)))
|
|
394
|
+
for tool in spec.get("tools", []):
|
|
395
|
+
used_tools.add(versioned_ref(*split_spec_ref(tool)))
|
|
396
|
+
for ft in spec.get("frontend_tools", []):
|
|
397
|
+
used_frontend_tools.add(versioned_ref(*split_spec_ref(ft)))
|
|
333
398
|
|
|
334
399
|
# Only import what's actually used
|
|
335
400
|
mcp_imports = []
|
|
336
401
|
mcp_map_entries = []
|
|
337
|
-
for
|
|
338
|
-
|
|
339
|
-
|
|
402
|
+
for spec in mcp_specs:
|
|
403
|
+
server_id = spec["id"]
|
|
404
|
+
server_ref = versioned_ref(server_id, spec["version"])
|
|
405
|
+
if server_ref in used_mcp_servers:
|
|
406
|
+
const_name = (
|
|
407
|
+
server_id.upper().replace("-", "_")
|
|
408
|
+
+ "_MCP_SERVER"
|
|
409
|
+
+ version_suffix(spec["version"])
|
|
410
|
+
)
|
|
340
411
|
mcp_imports.append(const_name)
|
|
412
|
+
mcp_map_entries.append(f" '{server_ref}': {const_name},")
|
|
341
413
|
mcp_map_entries.append(f" '{server_id}': {const_name},")
|
|
342
414
|
|
|
343
415
|
# Generate skill import names and map entries
|
|
344
416
|
skill_imports = []
|
|
345
417
|
skill_map_entries = []
|
|
346
|
-
for
|
|
347
|
-
|
|
348
|
-
|
|
418
|
+
for spec in skill_specs:
|
|
419
|
+
sid = spec["id"]
|
|
420
|
+
sref = versioned_ref(sid, spec["version"])
|
|
421
|
+
if sref in used_skills:
|
|
422
|
+
const_name = (
|
|
423
|
+
sid.upper().replace("-", "_")
|
|
424
|
+
+ "_SKILL_SPEC"
|
|
425
|
+
+ version_suffix(spec["version"])
|
|
426
|
+
)
|
|
349
427
|
skill_imports.append(const_name)
|
|
428
|
+
skill_map_entries.append(f" '{sref}': {const_name},")
|
|
350
429
|
skill_map_entries.append(f" '{sid}': {const_name},")
|
|
351
430
|
|
|
431
|
+
# Generate tool import names and map entries
|
|
432
|
+
tool_imports = []
|
|
433
|
+
tool_map_entries = []
|
|
434
|
+
for spec in tool_specs:
|
|
435
|
+
tid = spec["id"]
|
|
436
|
+
tref = versioned_ref(tid, spec["version"])
|
|
437
|
+
if tref in used_tools:
|
|
438
|
+
const_name = (
|
|
439
|
+
tid.upper().replace("-", "_")
|
|
440
|
+
+ "_TOOL_SPEC"
|
|
441
|
+
+ version_suffix(spec["version"])
|
|
442
|
+
)
|
|
443
|
+
tool_imports.append(const_name)
|
|
444
|
+
tool_map_entries.append(f" '{tref}': {const_name},")
|
|
445
|
+
tool_map_entries.append(f" '{tid}': {const_name},")
|
|
446
|
+
|
|
447
|
+
# Generate frontend tool import names and map entries
|
|
448
|
+
frontend_tool_imports = []
|
|
449
|
+
frontend_tool_map_entries = []
|
|
450
|
+
frontend_tools_specs_dir = Path(tools_specs_dir).parent / "frontend-tools"
|
|
451
|
+
frontend_tool_specs = []
|
|
452
|
+
if frontend_tools_specs_dir.exists():
|
|
453
|
+
frontend_tool_files = sorted(frontend_tools_specs_dir.glob("*.yaml"))
|
|
454
|
+
for fpath in frontend_tool_files:
|
|
455
|
+
with open(fpath, "r") as f:
|
|
456
|
+
ft_spec = yaml.safe_load(f)
|
|
457
|
+
ensure_spec_version(ft_spec)
|
|
458
|
+
frontend_tool_specs.append(ft_spec)
|
|
459
|
+
for ft_spec in frontend_tool_specs:
|
|
460
|
+
ftid = ft_spec["id"]
|
|
461
|
+
ftref = versioned_ref(ftid, ft_spec["version"])
|
|
462
|
+
if ftref in used_frontend_tools:
|
|
463
|
+
const_name = (
|
|
464
|
+
ftid.upper().replace("-", "_")
|
|
465
|
+
+ "_FRONTEND_TOOL_SPEC"
|
|
466
|
+
+ version_suffix(ft_spec["version"])
|
|
467
|
+
)
|
|
468
|
+
frontend_tool_imports.append(const_name)
|
|
469
|
+
frontend_tool_map_entries.append(f" '{ftref}': {const_name},")
|
|
470
|
+
frontend_tool_map_entries.append(f" '{ftid}': {const_name},")
|
|
471
|
+
|
|
352
472
|
# Determine if we need any helper code
|
|
353
473
|
has_mcp = len(mcp_imports) > 0
|
|
354
474
|
has_skills = len(skill_imports) > 0
|
|
475
|
+
has_tools = len(tool_imports) > 0
|
|
476
|
+
has_frontend_tools = len(frontend_tool_imports) > 0
|
|
477
|
+
|
|
478
|
+
# Root-level specs produce src/specs/agents/agents.ts, while nested specs
|
|
479
|
+
# produce src/specs/agents/<folder>/agents.ts. Import paths differ.
|
|
480
|
+
is_root_layout = all(folder == "" for folder, _ in specs)
|
|
481
|
+
types_import_path = "../../types" if is_root_layout else "../../../types"
|
|
482
|
+
mcp_import_path = "../mcpServers" if is_root_layout else "../../mcpServers"
|
|
483
|
+
skills_import_path = "../skills" if is_root_layout else "../../skills"
|
|
484
|
+
tools_import_path = "../tools" if is_root_layout else "../../tools"
|
|
485
|
+
frontend_tools_import_path = (
|
|
486
|
+
"../frontendTools" if is_root_layout else "../../frontendTools"
|
|
487
|
+
)
|
|
355
488
|
|
|
356
489
|
# Header
|
|
357
490
|
code = """/*
|
|
@@ -367,21 +500,45 @@ def generate_typescript_code(
|
|
|
367
500
|
* Generated from YAML specifications in specs/agents/
|
|
368
501
|
*/
|
|
369
502
|
|
|
370
|
-
import type { AgentSpec } from '
|
|
503
|
+
import type { AgentSpec } from '"""
|
|
504
|
+
code += types_import_path
|
|
505
|
+
code += """';
|
|
371
506
|
"""
|
|
372
507
|
|
|
373
508
|
# Only add MCP server imports if needed
|
|
374
509
|
if has_mcp:
|
|
375
510
|
code += "import {\n"
|
|
376
511
|
code += " " + ",\n ".join(mcp_imports) + ",\n"
|
|
377
|
-
code += "} from '
|
|
512
|
+
code += "} from '"
|
|
513
|
+
code += mcp_import_path
|
|
514
|
+
code += "';\n"
|
|
378
515
|
|
|
379
516
|
# Only add skill imports if needed
|
|
380
517
|
if has_skills:
|
|
381
518
|
code += "import {\n"
|
|
382
519
|
code += " " + ",\n ".join(skill_imports) + ",\n"
|
|
383
|
-
code += "} from '
|
|
384
|
-
code +=
|
|
520
|
+
code += "} from '"
|
|
521
|
+
code += skills_import_path
|
|
522
|
+
code += "';\n"
|
|
523
|
+
code += "import type { SkillSpec } from '"
|
|
524
|
+
code += types_import_path
|
|
525
|
+
code += "';\n"
|
|
526
|
+
|
|
527
|
+
# Only add tool imports if needed
|
|
528
|
+
if has_tools:
|
|
529
|
+
code += "import {\n"
|
|
530
|
+
code += " " + ",\n ".join(tool_imports) + ",\n"
|
|
531
|
+
code += "} from '"
|
|
532
|
+
code += tools_import_path
|
|
533
|
+
code += "';\n"
|
|
534
|
+
|
|
535
|
+
# Only add frontend tool imports if needed
|
|
536
|
+
if has_frontend_tools:
|
|
537
|
+
code += "import {\n"
|
|
538
|
+
code += " " + ",\n ".join(frontend_tool_imports) + ",\n"
|
|
539
|
+
code += "} from '"
|
|
540
|
+
code += frontend_tools_import_path
|
|
541
|
+
code += "';\n"
|
|
385
542
|
|
|
386
543
|
# Only add MCP server lookup if used
|
|
387
544
|
if has_mcp:
|
|
@@ -411,7 +568,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
411
568
|
id: skill.id,
|
|
412
569
|
name: skill.name,
|
|
413
570
|
description: skill.description,
|
|
414
|
-
|
|
571
|
+
version: skill.version ?? '0.0.1',
|
|
415
572
|
tags: skill.tags,
|
|
416
573
|
enabled: skill.enabled,
|
|
417
574
|
requiredEnvVars: skill.requiredEnvVars,
|
|
@@ -419,6 +576,28 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
419
576
|
}
|
|
420
577
|
"""
|
|
421
578
|
|
|
579
|
+
# Only add tool lookup if used
|
|
580
|
+
if has_tools:
|
|
581
|
+
code += """
|
|
582
|
+
/**
|
|
583
|
+
* Map tool IDs to ToolSpec objects.
|
|
584
|
+
*/
|
|
585
|
+
const TOOL_MAP: Record<string, any> = {
|
|
586
|
+
"""
|
|
587
|
+
code += "\n".join(tool_map_entries) + "\n"
|
|
588
|
+
code += "};\n"
|
|
589
|
+
|
|
590
|
+
# Only add frontend tool lookup if used
|
|
591
|
+
if has_frontend_tools:
|
|
592
|
+
code += """
|
|
593
|
+
/**
|
|
594
|
+
* Map frontend tool IDs to FrontendToolSpec objects.
|
|
595
|
+
*/
|
|
596
|
+
const FRONTEND_TOOL_MAP: Record<string, any> = {
|
|
597
|
+
"""
|
|
598
|
+
code += "\n".join(frontend_tool_map_entries) + "\n"
|
|
599
|
+
code += "};\n"
|
|
600
|
+
|
|
422
601
|
code += """
|
|
423
602
|
// ============================================================================
|
|
424
603
|
// Agent Specs
|
|
@@ -451,6 +630,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
451
630
|
|
|
452
631
|
for spec in folder_specs:
|
|
453
632
|
agent_id = spec["id"]
|
|
633
|
+
version = spec["version"]
|
|
454
634
|
# Prefix agent ID with folder name for uniqueness
|
|
455
635
|
full_agent_id = f"{folder}/{agent_id}" if folder else agent_id
|
|
456
636
|
# Create constant name: e.g., "data-acquisition" -> "DATA_ACQUISITION_AGENT_SPEC"
|
|
@@ -462,10 +642,14 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
462
642
|
const_name = base_name + "_SPEC"
|
|
463
643
|
else:
|
|
464
644
|
const_name = base_name + "_AGENT_SPEC"
|
|
645
|
+
const_name += version_suffix(version)
|
|
465
646
|
agent_ids.append((full_agent_id, const_name, folder))
|
|
466
647
|
|
|
467
648
|
# Get MCP servers
|
|
468
|
-
mcp_server_ids =
|
|
649
|
+
mcp_server_ids = [
|
|
650
|
+
versioned_ref(*split_spec_ref(sid))
|
|
651
|
+
for sid in spec.get("mcp_servers", [])
|
|
652
|
+
]
|
|
469
653
|
if has_mcp and mcp_server_ids:
|
|
470
654
|
mcp_servers_str = ", ".join(
|
|
471
655
|
f"MCP_SERVER_MAP['{sid}']" for sid in mcp_server_ids
|
|
@@ -474,7 +658,9 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
474
658
|
mcp_servers_str = ""
|
|
475
659
|
|
|
476
660
|
# Get skills - resolve to AgentSkillSpec via toAgentSkillSpec
|
|
477
|
-
skill_ids_list =
|
|
661
|
+
skill_ids_list = [
|
|
662
|
+
versioned_ref(*split_spec_ref(sid)) for sid in spec.get("skills", [])
|
|
663
|
+
]
|
|
478
664
|
if has_skills and skill_ids_list:
|
|
479
665
|
skills_str = ", ".join(
|
|
480
666
|
f"toAgentSkillSpec(SKILL_MAP['{sid}'])" for sid in skill_ids_list
|
|
@@ -482,6 +668,27 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
482
668
|
else:
|
|
483
669
|
skills_str = ""
|
|
484
670
|
|
|
671
|
+
# Get tools - resolve to ToolSpec via TOOL_MAP
|
|
672
|
+
tool_ids_list = [
|
|
673
|
+
versioned_ref(*split_spec_ref(sid)) for sid in spec.get("tools", [])
|
|
674
|
+
]
|
|
675
|
+
if has_tools and tool_ids_list:
|
|
676
|
+
tools_str = ", ".join(f"TOOL_MAP['{tid}']" for tid in tool_ids_list)
|
|
677
|
+
else:
|
|
678
|
+
tools_str = ""
|
|
679
|
+
|
|
680
|
+
# Get frontend tools - resolve to FrontendToolSpec via FRONTEND_TOOL_MAP
|
|
681
|
+
frontend_tool_ids_list = [
|
|
682
|
+
versioned_ref(*split_spec_ref(sid))
|
|
683
|
+
for sid in spec.get("frontend_tools", [])
|
|
684
|
+
]
|
|
685
|
+
if has_frontend_tools and frontend_tool_ids_list:
|
|
686
|
+
frontend_tools_str = ", ".join(
|
|
687
|
+
f"FRONTEND_TOOL_MAP['{ftid}']" for ftid in frontend_tool_ids_list
|
|
688
|
+
)
|
|
689
|
+
else:
|
|
690
|
+
frontend_tools_str = ""
|
|
691
|
+
|
|
485
692
|
# Format tags and suggestions as arrays
|
|
486
693
|
tags = spec.get("tags", [])
|
|
487
694
|
tags_str = "[" + ", ".join(f"'{t}'" for t in tags) + "]"
|
|
@@ -512,6 +719,10 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
512
719
|
"`", "\\`"
|
|
513
720
|
)
|
|
514
721
|
|
|
722
|
+
welcome_message = spec.get("welcome_message")
|
|
723
|
+
welcome_notebook = spec.get("welcome_notebook")
|
|
724
|
+
welcome_document = spec.get("welcome_document")
|
|
725
|
+
|
|
515
726
|
# Clean description for TypeScript (multi-line template literal)
|
|
516
727
|
description = (
|
|
517
728
|
spec["description"].replace("\n", " ").replace(" ", " ").strip()
|
|
@@ -551,10 +762,12 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
551
762
|
f"'{auth_policy}'" if auth_policy is not None else "undefined"
|
|
552
763
|
)
|
|
553
764
|
notifs = spec.get("notifications")
|
|
554
|
-
|
|
765
|
+
memory_val = spec.get("memory")
|
|
766
|
+
memory_ts = f"'{memory_val}'" if memory_val else "undefined"
|
|
555
767
|
|
|
556
768
|
code += f"""export const {const_name}: AgentSpec = {{
|
|
557
769
|
id: '{full_agent_id}',
|
|
770
|
+
version: '{version}',
|
|
558
771
|
name: '{spec["name"]}',
|
|
559
772
|
description: `{description}`,
|
|
560
773
|
tags: {tags_str},
|
|
@@ -562,11 +775,16 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
562
775
|
model: {model_ts},
|
|
563
776
|
mcpServers: [{mcp_servers_str}],
|
|
564
777
|
skills: [{skills_str}],
|
|
778
|
+
tools: [{tools_str}],
|
|
779
|
+
frontendTools: [{frontend_tools_str}],
|
|
565
780
|
environmentName: '{spec.get("environment_name", "ai-agents-env")}',
|
|
566
781
|
icon: {icon},
|
|
567
782
|
emoji: {emoji},
|
|
568
783
|
color: {color},
|
|
569
784
|
suggestions: {suggestions_str},
|
|
785
|
+
welcomeMessage: {_fmt_ts_literal(welcome_message)},
|
|
786
|
+
welcomeNotebook: {_fmt_ts_literal(welcome_notebook)},
|
|
787
|
+
welcomeDocument: {_fmt_ts_literal(welcome_document)},
|
|
570
788
|
sandboxVariant: {sandbox_variant_ts},
|
|
571
789
|
systemPrompt: {f"`{system_prompt}`" if system_prompt else "undefined"},
|
|
572
790
|
systemPromptCodemodeAddons: {f"`{system_prompt_codemode_addons}`" if system_prompt_codemode_addons else "undefined"},
|
|
@@ -583,7 +801,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
583
801
|
advanced: {_fmt_ts_literal(advanced_val)},
|
|
584
802
|
authorizationPolicy: {auth_policy_ts},
|
|
585
803
|
notifications: {_fmt_ts_literal(notifs)},
|
|
586
|
-
|
|
804
|
+
memory: {memory_ts},
|
|
587
805
|
}};
|
|
588
806
|
|
|
589
807
|
"""
|
|
@@ -608,11 +826,21 @@ export const AGENT_SPECS: Record<string, AgentSpec> = {
|
|
|
608
826
|
|
|
609
827
|
code += """};
|
|
610
828
|
|
|
829
|
+
function resolveAgentId(agentId: string): string {
|
|
830
|
+
if (agentId in AGENT_SPECS) return agentId;
|
|
831
|
+
const idx = agentId.lastIndexOf(':');
|
|
832
|
+
if (idx > 0) {
|
|
833
|
+
const base = agentId.slice(0, idx);
|
|
834
|
+
if (base in AGENT_SPECS) return base;
|
|
835
|
+
}
|
|
836
|
+
return agentId;
|
|
837
|
+
}
|
|
838
|
+
|
|
611
839
|
/**
|
|
612
840
|
* Get an agent specification by ID.
|
|
613
841
|
*/
|
|
614
842
|
export function getAgentSpecs(agentId: string): AgentSpec | undefined {
|
|
615
|
-
return AGENT_SPECS[agentId];
|
|
843
|
+
return AGENT_SPECS[resolveAgentId(agentId)];
|
|
616
844
|
}
|
|
617
845
|
|
|
618
846
|
/**
|
|
@@ -633,14 +861,15 @@ export function listAgentSpecs(prefix?: string): AgentSpec[] {
|
|
|
633
861
|
*/
|
|
634
862
|
export function getAgentSpecRequiredEnvVars(spec: AgentSpec): string[] {
|
|
635
863
|
const vars = new Set<string>();
|
|
864
|
+
const baseEnvVar = (v: string): string => v.split(':')[0] ?? v;
|
|
636
865
|
for (const server of spec.mcpServers) {
|
|
637
866
|
for (const v of server.requiredEnvVars ?? []) {
|
|
638
|
-
|
|
867
|
+
vars.add(baseEnvVar(v));
|
|
639
868
|
}
|
|
640
869
|
}
|
|
641
870
|
for (const skill of spec.skills) {
|
|
642
871
|
for (const v of skill.requiredEnvVars ?? []) {
|
|
643
|
-
|
|
872
|
+
vars.add(baseEnvVar(v));
|
|
644
873
|
}
|
|
645
874
|
}
|
|
646
875
|
return Array.from(vars);
|
|
@@ -711,10 +940,13 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
711
940
|
# Get MCP and skills specs directories
|
|
712
941
|
mcp_specs_dir = args.specs_dir.parent / "mcp-servers"
|
|
713
942
|
skills_specs_dir = args.specs_dir.parent / "skills"
|
|
943
|
+
tools_specs_dir = args.specs_dir.parent / "tools"
|
|
714
944
|
|
|
715
945
|
# Determine base directories
|
|
716
946
|
python_base = args.python_output.parent / "agents"
|
|
717
947
|
typescript_base = args.typescript_output.parent / "agents"
|
|
948
|
+
python_base.mkdir(parents=True, exist_ok=True)
|
|
949
|
+
typescript_base.mkdir(parents=True, exist_ok=True)
|
|
718
950
|
|
|
719
951
|
print(f"Generating subfolder structure in {python_base} and {typescript_base}...")
|
|
720
952
|
|
|
@@ -723,18 +955,22 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
723
955
|
all_typescript_imports = []
|
|
724
956
|
|
|
725
957
|
for folder, folder_specs in sorted(specs_by_folder.items()):
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
958
|
+
is_root = not folder
|
|
959
|
+
if is_root:
|
|
960
|
+
print(" Generating agents for root level")
|
|
961
|
+
else:
|
|
962
|
+
print(f" Generating agents for subfolder: {folder}")
|
|
730
963
|
|
|
731
964
|
# Convert folder name to valid Python module name (replace hyphens with underscores)
|
|
732
|
-
folder_python_name = folder.replace("-", "_")
|
|
965
|
+
folder_python_name = folder.replace("-", "_") if folder else "agents"
|
|
733
966
|
|
|
734
|
-
# Create Python
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
967
|
+
# Create Python output file
|
|
968
|
+
if is_root:
|
|
969
|
+
python_file = python_base / "agents.py"
|
|
970
|
+
else:
|
|
971
|
+
python_folder_dir = python_base / folder_python_name
|
|
972
|
+
python_folder_dir.mkdir(parents=True, exist_ok=True)
|
|
973
|
+
python_file = python_folder_dir / "agents.py"
|
|
738
974
|
|
|
739
975
|
# Generate Python code for this folder
|
|
740
976
|
python_code = generate_python_code([(folder, spec) for spec in folder_specs])
|
|
@@ -742,9 +978,10 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
742
978
|
f.write(python_code)
|
|
743
979
|
|
|
744
980
|
# Create __init__.py for Python subfolder
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
981
|
+
if not is_root:
|
|
982
|
+
python_init = python_folder_dir / "__init__.py"
|
|
983
|
+
with open(python_init, "w") as f:
|
|
984
|
+
f.write("""# Copyright (c) 2025-2026 Datalayer, Inc.
|
|
748
985
|
# Distributed under the terms of the Modified BSD License.
|
|
749
986
|
|
|
750
987
|
from .agents import *
|
|
@@ -753,28 +990,36 @@ __all__ = ["AGENT_SPECS", "get_agent_spec", "list_agent_specs"]
|
|
|
753
990
|
""")
|
|
754
991
|
|
|
755
992
|
# Collect imports for main index
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
993
|
+
if is_root:
|
|
994
|
+
all_python_imports.append("from .agents import AGENT_SPECS as ROOT_AGENTS")
|
|
995
|
+
else:
|
|
996
|
+
all_python_imports.append(
|
|
997
|
+
f"from .{folder_python_name} import AGENT_SPECS as {folder_python_name.upper()}_AGENTS"
|
|
998
|
+
)
|
|
759
999
|
|
|
760
|
-
# Create TypeScript
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
1000
|
+
# Create TypeScript output file
|
|
1001
|
+
if is_root:
|
|
1002
|
+
typescript_file = typescript_base / "agents.ts"
|
|
1003
|
+
else:
|
|
1004
|
+
typescript_folder_dir = typescript_base / folder
|
|
1005
|
+
typescript_folder_dir.mkdir(parents=True, exist_ok=True)
|
|
1006
|
+
typescript_file = typescript_folder_dir / "agents.ts"
|
|
764
1007
|
|
|
765
1008
|
# Generate TypeScript code for this folder
|
|
766
1009
|
typescript_code = generate_typescript_code(
|
|
767
1010
|
[(folder, spec) for spec in folder_specs],
|
|
768
1011
|
str(mcp_specs_dir),
|
|
769
1012
|
str(skills_specs_dir),
|
|
1013
|
+
str(tools_specs_dir),
|
|
770
1014
|
)
|
|
771
1015
|
with open(typescript_file, "w") as f:
|
|
772
1016
|
f.write(typescript_code)
|
|
773
1017
|
|
|
774
1018
|
# Create index.ts for TypeScript subfolder
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
1019
|
+
if not is_root:
|
|
1020
|
+
typescript_index = typescript_folder_dir / "index.ts"
|
|
1021
|
+
with open(typescript_index, "w") as f:
|
|
1022
|
+
f.write("""/*
|
|
778
1023
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
779
1024
|
* Distributed under the terms of the Modified BSD License.
|
|
780
1025
|
*/
|
|
@@ -783,7 +1028,10 @@ export * from './agents';
|
|
|
783
1028
|
""")
|
|
784
1029
|
|
|
785
1030
|
# Collect imports for main index
|
|
786
|
-
|
|
1031
|
+
if is_root:
|
|
1032
|
+
all_typescript_imports.append("export * from './agents';")
|
|
1033
|
+
else:
|
|
1034
|
+
all_typescript_imports.append(f"export * from './{folder}';")
|
|
787
1035
|
|
|
788
1036
|
# Create main Python index file
|
|
789
1037
|
python_index = python_base / "__init__.py"
|
|
@@ -817,12 +1065,20 @@ AGENT_SPECS: Dict[str, AgentSpec] = {}
|
|
|
817
1065
|
python_index_content += (
|
|
818
1066
|
f"AGENT_SPECS.update({folder_python_name.upper()}_AGENTS)\n"
|
|
819
1067
|
)
|
|
1068
|
+
else:
|
|
1069
|
+
python_index_content += "AGENT_SPECS.update(ROOT_AGENTS)\n"
|
|
820
1070
|
|
|
821
1071
|
python_index_content += """
|
|
822
1072
|
|
|
823
1073
|
def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
824
1074
|
\"\"\"Get an agent specification by ID.\"\"\"
|
|
825
|
-
|
|
1075
|
+
spec = AGENT_SPECS.get(agent_id)
|
|
1076
|
+
if spec is not None:
|
|
1077
|
+
return spec
|
|
1078
|
+
base, _, ver = agent_id.rpartition(':')
|
|
1079
|
+
if base and '.' in ver:
|
|
1080
|
+
return AGENT_SPECS.get(base)
|
|
1081
|
+
return None
|
|
826
1082
|
|
|
827
1083
|
|
|
828
1084
|
def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
@@ -864,6 +1120,10 @@ import type { AgentSpec } from '../../types';
|
|
|
864
1120
|
if folder:
|
|
865
1121
|
folder_const = folder.replace("-", "_").upper()
|
|
866
1122
|
typescript_index_content += f"import {{ AGENT_SPECS as {folder_const}_AGENTS }} from './{folder}';\n"
|
|
1123
|
+
else:
|
|
1124
|
+
typescript_index_content += (
|
|
1125
|
+
"import { AGENT_SPECS as ROOT_AGENTS } from './agents';\n"
|
|
1126
|
+
)
|
|
867
1127
|
|
|
868
1128
|
typescript_index_content += """
|
|
869
1129
|
// Merge all agent specs from subfolders
|
|
@@ -874,14 +1134,26 @@ export const AGENT_SPECS: Record<string, AgentSpec> = {
|
|
|
874
1134
|
if folder:
|
|
875
1135
|
folder_const = folder.replace("-", "_").upper()
|
|
876
1136
|
typescript_index_content += f" ...{folder_const}_AGENTS,\n"
|
|
1137
|
+
else:
|
|
1138
|
+
typescript_index_content += " ...ROOT_AGENTS,\n"
|
|
877
1139
|
|
|
878
1140
|
typescript_index_content += """};
|
|
879
1141
|
|
|
1142
|
+
function resolveAgentId(agentId: string): string {
|
|
1143
|
+
if (agentId in AGENT_SPECS) return agentId;
|
|
1144
|
+
const idx = agentId.lastIndexOf(':');
|
|
1145
|
+
if (idx > 0) {
|
|
1146
|
+
const base = agentId.slice(0, idx);
|
|
1147
|
+
if (base in AGENT_SPECS) return base;
|
|
1148
|
+
}
|
|
1149
|
+
return agentId;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
880
1152
|
/**
|
|
881
1153
|
* Get an agent specification by ID.
|
|
882
1154
|
*/
|
|
883
1155
|
export function getAgentSpecs(agentId: string): AgentSpec | undefined {
|
|
884
|
-
return AGENT_SPECS[agentId];
|
|
1156
|
+
return AGENT_SPECS[resolveAgentId(agentId)];
|
|
885
1157
|
}
|
|
886
1158
|
|
|
887
1159
|
/**
|
|
@@ -919,6 +1191,43 @@ export function getAgentSpecRequiredEnvVars(spec: AgentSpec): string[] {
|
|
|
919
1191
|
print(f"✓ Generated {len(specs_by_folder)} subfolder(s)")
|
|
920
1192
|
|
|
921
1193
|
|
|
1194
|
+
def ensure_specs_barrel(specs_dir: Path) -> None:
|
|
1195
|
+
"""Ensure top-level TypeScript specs barrel file exists.
|
|
1196
|
+
|
|
1197
|
+
This keeps imports like ``from './specs'`` valid even when regenerating
|
|
1198
|
+
from an empty ``src/specs`` tree.
|
|
1199
|
+
"""
|
|
1200
|
+
specs_dir.mkdir(parents=True, exist_ok=True)
|
|
1201
|
+
index_path = specs_dir / "index.ts"
|
|
1202
|
+
index_path.write_text(
|
|
1203
|
+
"""/*
|
|
1204
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
1205
|
+
* Distributed under the terms of the Modified BSD License.
|
|
1206
|
+
*/
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Specs exports.
|
|
1210
|
+
*
|
|
1211
|
+
* This file is AUTO-GENERATED. DO NOT EDIT MANUALLY.
|
|
1212
|
+
*/
|
|
1213
|
+
|
|
1214
|
+
export * from './agents';
|
|
1215
|
+
export * from './teams';
|
|
1216
|
+
export * from './envvars';
|
|
1217
|
+
export * from './evals';
|
|
1218
|
+
export * from './guardrails';
|
|
1219
|
+
export * from './mcpServers';
|
|
1220
|
+
export * from './memory';
|
|
1221
|
+
export * from './models';
|
|
1222
|
+
export * from './notifications';
|
|
1223
|
+
export * from './outputs';
|
|
1224
|
+
export * from './skills';
|
|
1225
|
+
export * from './tools';
|
|
1226
|
+
export * from './triggers';
|
|
1227
|
+
"""
|
|
1228
|
+
)
|
|
1229
|
+
|
|
1230
|
+
|
|
922
1231
|
def main():
|
|
923
1232
|
"""Main entry point."""
|
|
924
1233
|
parser = argparse.ArgumentParser(
|
|
@@ -963,6 +1272,7 @@ def main():
|
|
|
963
1272
|
if args.subfolder_structure:
|
|
964
1273
|
# Generate separate files per subfolder
|
|
965
1274
|
generate_subfolder_structure(specs, args)
|
|
1275
|
+
ensure_specs_barrel(args.typescript_output.parent)
|
|
966
1276
|
else:
|
|
967
1277
|
# Generate Python code (single file)
|
|
968
1278
|
print(f"Generating Python code to {args.python_output}...")
|
|
@@ -976,13 +1286,19 @@ def main():
|
|
|
976
1286
|
# Get MCP and skills specs directories (siblings to agents directory)
|
|
977
1287
|
mcp_specs_dir = args.specs_dir.parent / "mcp-servers"
|
|
978
1288
|
skills_specs_dir = args.specs_dir.parent / "skills"
|
|
1289
|
+
tools_specs_dir = args.specs_dir.parent / "tools"
|
|
979
1290
|
typescript_code = generate_typescript_code(
|
|
980
|
-
specs,
|
|
1291
|
+
specs,
|
|
1292
|
+
str(mcp_specs_dir),
|
|
1293
|
+
str(skills_specs_dir),
|
|
1294
|
+
str(tools_specs_dir),
|
|
981
1295
|
)
|
|
982
1296
|
args.typescript_output.parent.mkdir(parents=True, exist_ok=True)
|
|
983
1297
|
with open(args.typescript_output, "w") as f:
|
|
984
1298
|
f.write(typescript_code)
|
|
985
1299
|
|
|
1300
|
+
ensure_specs_barrel(args.typescript_output.parent)
|
|
1301
|
+
|
|
986
1302
|
# Update __init__.py with new agent spec constants
|
|
987
1303
|
init_file_path = args.python_output.parent / "__init__.py"
|
|
988
1304
|
if init_file_path.exists():
|