@datalayer/agent-runtimes 1.0.2 → 1.0.3
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 +1 -1
- 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 +24 -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 +1287 -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 +319 -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 +169 -0
- package/lib/client/AgentsMixin.js +279 -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 +152 -0
- package/lib/components/OutputCard.d.ts +8 -0
- package/lib/components/OutputCard.js +80 -0
- package/lib/components/ToolApprovalCard.d.ts +33 -0
- package/lib/components/ToolApprovalCard.js +60 -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 +506 -0
- package/lib/examples/AgentCodemodeExample.d.ts +14 -0
- package/lib/examples/AgentCodemodeExample.js +262 -0
- package/lib/examples/AgentEvalsExample.d.ts +14 -0
- package/lib/examples/AgentEvalsExample.js +216 -0
- package/lib/examples/AgentGuardrailsExample.d.ts +14 -0
- package/lib/examples/AgentGuardrailsExample.js +218 -0
- package/lib/examples/AgentMemoryExample.d.ts +14 -0
- package/lib/examples/AgentMemoryExample.js +234 -0
- package/lib/examples/AgentMonitoringExample.d.ts +13 -0
- package/lib/examples/AgentMonitoringExample.js +311 -0
- package/lib/examples/AgentNotificationsExample.d.ts +14 -0
- package/lib/examples/AgentNotificationsExample.js +273 -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 +211 -0
- package/lib/examples/AgentSandboxExample.d.ts +17 -0
- package/lib/examples/AgentSandboxExample.js +496 -0
- package/lib/examples/AgentSkillsExample.d.ts +3 -0
- package/lib/examples/AgentSkillsExample.js +290 -0
- package/lib/examples/AgentToolApprovalsExample.d.ts +3 -0
- package/lib/examples/AgentToolApprovalsExample.js +672 -0
- package/lib/examples/AgentTriggersExample.d.ts +14 -0
- package/lib/examples/AgentTriggersExample.js +523 -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} +4 -4
- 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/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 +1 -0
- package/lib/examples/components/index.js +1 -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 +6 -0
- package/lib/examples/main.js +20 -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 +31 -7
- package/lib/protocols/VercelAIAdapter.js +682 -0
- package/lib/{components/chat/protocols → protocols}/index.d.ts +1 -2
- package/lib/{components/chat/protocols → protocols}/index.js +1 -1
- package/lib/specs/agents/agents.d.ts +54 -0
- package/lib/specs/agents/{mocks/agents.js → agents.js} +1144 -799
- package/lib/specs/agents/index.js +14 -9
- package/lib/specs/envvars.d.ts +11 -19
- package/lib/specs/envvars.js +42 -21
- package/lib/specs/evals.d.ts +20 -0
- package/lib/specs/evals.js +133 -0
- package/lib/specs/events.d.ts +18 -0
- package/lib/specs/events.js +182 -0
- package/lib/specs/frontendTools.d.ts +14 -0
- package/lib/specs/frontendTools.js +53 -0
- package/lib/specs/guardrails.d.ts +22 -0
- package/lib/specs/guardrails.js +391 -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 +82 -28
- package/lib/specs/memory.d.ts +34 -0
- package/lib/specs/memory.js +99 -0
- package/lib/specs/models.d.ts +21 -34
- package/lib/specs/models.js +61 -41
- package/lib/specs/notifications.d.ts +17 -0
- package/lib/specs/notifications.js +187 -0
- package/lib/specs/outputs.d.ts +19 -0
- package/lib/specs/outputs.js +112 -0
- package/lib/specs/skills.d.ts +7 -16
- package/lib/specs/skills.js +89 -12
- package/lib/specs/teams/index.d.ts +17 -0
- package/lib/specs/teams/index.js +37 -0
- package/lib/specs/teams/teams.d.ts +27 -0
- package/lib/specs/teams/teams.js +1120 -0
- package/lib/specs/tools.d.ts +15 -0
- package/lib/specs/tools.js +83 -0
- package/lib/specs/triggers.d.ts +15 -0
- package/lib/specs/triggers.js +117 -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} +59 -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__/generate_agents.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_envvars.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_evals.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_guardrails.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_mcp_servers.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_memory.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_models.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_notifications.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_outputs.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_skills.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_teams.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_tools.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_triggers.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- package/scripts/codegen/generate_agents.py +373 -60
- package/scripts/codegen/generate_envvars.py +36 -35
- package/scripts/codegen/generate_evals.py +279 -0
- package/scripts/codegen/generate_events.py +312 -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 +326 -0
- package/scripts/codegen/generate_triggers.py +295 -0
- package/scripts/codegen/versioning.py +53 -0
- 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/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"
|
|
@@ -169,6 +193,7 @@ from agent_runtimes.types import AgentSpec
|
|
|
169
193
|
# Clean description for Python (single line)
|
|
170
194
|
description = (
|
|
171
195
|
spec["description"].replace("\n", " ").replace(" ", " ").strip()
|
|
196
|
+
.replace('"', '\\"')
|
|
172
197
|
)
|
|
173
198
|
|
|
174
199
|
# Use triple quotes for multiline system prompts
|
|
@@ -209,17 +234,21 @@ from agent_runtimes.types import AgentSpec
|
|
|
209
234
|
auth_policy = spec.get("authorization_policy")
|
|
210
235
|
auth_policy_str = f'"{auth_policy}"' if auth_policy is not None else "None"
|
|
211
236
|
notifs = spec.get("notifications")
|
|
212
|
-
|
|
237
|
+
memory_val = spec.get("memory")
|
|
238
|
+
memory_str = f'"{memory_val}"' if memory_val else "None"
|
|
213
239
|
|
|
214
240
|
code += f'''{const_name} = AgentSpec(
|
|
215
241
|
id="{full_agent_id}",
|
|
242
|
+
version="{version}",
|
|
216
243
|
name="{spec["name"]}",
|
|
217
244
|
description="{description}",
|
|
218
245
|
tags={_fmt_list(spec.get("tags", []))},
|
|
219
246
|
enabled={spec.get("enabled", True)},
|
|
220
247
|
model={model_str},
|
|
221
248
|
mcp_servers=[{mcp_servers_str}],
|
|
222
|
-
skills={_fmt_list(
|
|
249
|
+
skills={_fmt_list(skill_refs)},
|
|
250
|
+
tools={_fmt_list(tool_refs)},
|
|
251
|
+
frontend_tools={_fmt_list(frontend_tool_refs)},
|
|
223
252
|
environment_name="{spec.get("environment_name", "ai-agents-env")}",
|
|
224
253
|
icon={icon},
|
|
225
254
|
emoji={emoji},
|
|
@@ -244,7 +273,7 @@ from agent_runtimes.types import AgentSpec
|
|
|
244
273
|
advanced={_fmt_py_literal(advanced_val)},
|
|
245
274
|
authorization_policy={auth_policy_str},
|
|
246
275
|
notifications={_fmt_py_literal(notifs)},
|
|
247
|
-
|
|
276
|
+
memory={memory_str},
|
|
248
277
|
)
|
|
249
278
|
|
|
250
279
|
'''
|
|
@@ -273,7 +302,7 @@ AGENT_SPECS: Dict[str, AgentSpec] = {
|
|
|
273
302
|
|
|
274
303
|
def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
275
304
|
\"\"\"
|
|
276
|
-
Get an agent specification by ID.
|
|
305
|
+
Get an agent specification by ID (accepts both bare and versioned refs).
|
|
277
306
|
|
|
278
307
|
Args:
|
|
279
308
|
agent_id: The unique identifier of the agent.
|
|
@@ -281,7 +310,13 @@ def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
|
281
310
|
Returns:
|
|
282
311
|
The AgentSpec configuration, or None if not found.
|
|
283
312
|
\"\"\"
|
|
284
|
-
|
|
313
|
+
spec = AGENT_SPECS.get(agent_id)
|
|
314
|
+
if spec is not None:
|
|
315
|
+
return spec
|
|
316
|
+
base, _, ver = agent_id.rpartition(':')
|
|
317
|
+
if base and '.' in ver:
|
|
318
|
+
return AGENT_SPECS.get(base)
|
|
319
|
+
return None
|
|
285
320
|
|
|
286
321
|
|
|
287
322
|
def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
@@ -304,7 +339,10 @@ def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
|
304
339
|
|
|
305
340
|
|
|
306
341
|
def generate_typescript_code(
|
|
307
|
-
specs: List[tuple[str, Dict[str, Any]]],
|
|
342
|
+
specs: List[tuple[str, Dict[str, Any]]],
|
|
343
|
+
mcp_specs_dir: str,
|
|
344
|
+
skills_specs_dir: str,
|
|
345
|
+
tools_specs_dir: str,
|
|
308
346
|
) -> str:
|
|
309
347
|
"""Generate TypeScript code from agent specifications."""
|
|
310
348
|
# Load available MCP servers from specs
|
|
@@ -312,46 +350,138 @@ def generate_typescript_code(
|
|
|
312
350
|
import os
|
|
313
351
|
|
|
314
352
|
mcp_server_files = glob.glob(os.path.join(mcp_specs_dir, "*.yaml"))
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
353
|
+
mcp_specs = []
|
|
354
|
+
for fpath in mcp_server_files:
|
|
355
|
+
with open(fpath, "r") as f:
|
|
356
|
+
spec = yaml.safe_load(f)
|
|
357
|
+
ensure_spec_version(spec)
|
|
358
|
+
mcp_specs.append(spec)
|
|
359
|
+
mcp_specs.sort(key=lambda s: s["id"])
|
|
319
360
|
|
|
320
361
|
# Load available skills from specs
|
|
321
362
|
skill_files = glob.glob(os.path.join(skills_specs_dir, "*.yaml"))
|
|
322
|
-
|
|
323
|
-
|
|
363
|
+
skill_specs = []
|
|
364
|
+
for fpath in skill_files:
|
|
365
|
+
with open(fpath, "r") as f:
|
|
366
|
+
spec = yaml.safe_load(f)
|
|
367
|
+
ensure_spec_version(spec)
|
|
368
|
+
skill_specs.append(spec)
|
|
369
|
+
skill_specs.sort(key=lambda s: s["id"])
|
|
370
|
+
|
|
371
|
+
# Load available tools from specs
|
|
372
|
+
tool_files = glob.glob(os.path.join(tools_specs_dir, "*.yaml"))
|
|
373
|
+
tool_specs = []
|
|
374
|
+
for fpath in tool_files:
|
|
375
|
+
with open(fpath, "r") as f:
|
|
376
|
+
spec = yaml.safe_load(f)
|
|
377
|
+
ensure_spec_version(spec)
|
|
378
|
+
tool_specs.append(spec)
|
|
379
|
+
tool_specs.sort(key=lambda s: s["id"])
|
|
324
380
|
|
|
325
381
|
# Determine which MCP servers and skills are actually used in these specs
|
|
326
382
|
used_mcp_servers = set()
|
|
327
383
|
used_skills = set()
|
|
384
|
+
used_tools = set()
|
|
385
|
+
used_frontend_tools = set()
|
|
328
386
|
for _, spec in specs:
|
|
329
387
|
for server in spec.get("mcp_servers", []):
|
|
330
|
-
used_mcp_servers.add(server)
|
|
388
|
+
used_mcp_servers.add(versioned_ref(*split_spec_ref(server)))
|
|
331
389
|
for skill in spec.get("skills", []):
|
|
332
|
-
used_skills.add(skill)
|
|
390
|
+
used_skills.add(versioned_ref(*split_spec_ref(skill)))
|
|
391
|
+
for tool in spec.get("tools", []):
|
|
392
|
+
used_tools.add(versioned_ref(*split_spec_ref(tool)))
|
|
393
|
+
for ft in spec.get("frontend_tools", []):
|
|
394
|
+
used_frontend_tools.add(versioned_ref(*split_spec_ref(ft)))
|
|
333
395
|
|
|
334
396
|
# Only import what's actually used
|
|
335
397
|
mcp_imports = []
|
|
336
398
|
mcp_map_entries = []
|
|
337
|
-
for
|
|
338
|
-
|
|
339
|
-
|
|
399
|
+
for spec in mcp_specs:
|
|
400
|
+
server_id = spec["id"]
|
|
401
|
+
server_ref = versioned_ref(server_id, spec["version"])
|
|
402
|
+
if server_ref in used_mcp_servers:
|
|
403
|
+
const_name = (
|
|
404
|
+
server_id.upper().replace("-", "_")
|
|
405
|
+
+ "_MCP_SERVER"
|
|
406
|
+
+ version_suffix(spec["version"])
|
|
407
|
+
)
|
|
340
408
|
mcp_imports.append(const_name)
|
|
409
|
+
mcp_map_entries.append(f" '{server_ref}': {const_name},")
|
|
341
410
|
mcp_map_entries.append(f" '{server_id}': {const_name},")
|
|
342
411
|
|
|
343
412
|
# Generate skill import names and map entries
|
|
344
413
|
skill_imports = []
|
|
345
414
|
skill_map_entries = []
|
|
346
|
-
for
|
|
347
|
-
|
|
348
|
-
|
|
415
|
+
for spec in skill_specs:
|
|
416
|
+
sid = spec["id"]
|
|
417
|
+
sref = versioned_ref(sid, spec["version"])
|
|
418
|
+
if sref in used_skills:
|
|
419
|
+
const_name = (
|
|
420
|
+
sid.upper().replace("-", "_")
|
|
421
|
+
+ "_SKILL_SPEC"
|
|
422
|
+
+ version_suffix(spec["version"])
|
|
423
|
+
)
|
|
349
424
|
skill_imports.append(const_name)
|
|
425
|
+
skill_map_entries.append(f" '{sref}': {const_name},")
|
|
350
426
|
skill_map_entries.append(f" '{sid}': {const_name},")
|
|
351
427
|
|
|
428
|
+
# Generate tool import names and map entries
|
|
429
|
+
tool_imports = []
|
|
430
|
+
tool_map_entries = []
|
|
431
|
+
for spec in tool_specs:
|
|
432
|
+
tid = spec["id"]
|
|
433
|
+
tref = versioned_ref(tid, spec["version"])
|
|
434
|
+
if tref in used_tools:
|
|
435
|
+
const_name = (
|
|
436
|
+
tid.upper().replace("-", "_")
|
|
437
|
+
+ "_TOOL_SPEC"
|
|
438
|
+
+ version_suffix(spec["version"])
|
|
439
|
+
)
|
|
440
|
+
tool_imports.append(const_name)
|
|
441
|
+
tool_map_entries.append(f" '{tref}': {const_name},")
|
|
442
|
+
tool_map_entries.append(f" '{tid}': {const_name},")
|
|
443
|
+
|
|
444
|
+
# Generate frontend tool import names and map entries
|
|
445
|
+
frontend_tool_imports = []
|
|
446
|
+
frontend_tool_map_entries = []
|
|
447
|
+
frontend_tools_specs_dir = Path(tools_specs_dir).parent / "frontend-tools"
|
|
448
|
+
frontend_tool_specs = []
|
|
449
|
+
if frontend_tools_specs_dir.exists():
|
|
450
|
+
frontend_tool_files = sorted(frontend_tools_specs_dir.glob("*.yaml"))
|
|
451
|
+
for fpath in frontend_tool_files:
|
|
452
|
+
with open(fpath, "r") as f:
|
|
453
|
+
ft_spec = yaml.safe_load(f)
|
|
454
|
+
ensure_spec_version(ft_spec)
|
|
455
|
+
frontend_tool_specs.append(ft_spec)
|
|
456
|
+
for ft_spec in frontend_tool_specs:
|
|
457
|
+
ftid = ft_spec["id"]
|
|
458
|
+
ftref = versioned_ref(ftid, ft_spec["version"])
|
|
459
|
+
if ftref in used_frontend_tools:
|
|
460
|
+
const_name = (
|
|
461
|
+
ftid.upper().replace("-", "_")
|
|
462
|
+
+ "_FRONTEND_TOOL_SPEC"
|
|
463
|
+
+ version_suffix(ft_spec["version"])
|
|
464
|
+
)
|
|
465
|
+
frontend_tool_imports.append(const_name)
|
|
466
|
+
frontend_tool_map_entries.append(f" '{ftref}': {const_name},")
|
|
467
|
+
frontend_tool_map_entries.append(f" '{ftid}': {const_name},")
|
|
468
|
+
|
|
352
469
|
# Determine if we need any helper code
|
|
353
470
|
has_mcp = len(mcp_imports) > 0
|
|
354
471
|
has_skills = len(skill_imports) > 0
|
|
472
|
+
has_tools = len(tool_imports) > 0
|
|
473
|
+
has_frontend_tools = len(frontend_tool_imports) > 0
|
|
474
|
+
|
|
475
|
+
# Root-level specs produce src/specs/agents/agents.ts, while nested specs
|
|
476
|
+
# produce src/specs/agents/<folder>/agents.ts. Import paths differ.
|
|
477
|
+
is_root_layout = all(folder == "" for folder, _ in specs)
|
|
478
|
+
types_import_path = "../../types" if is_root_layout else "../../../types"
|
|
479
|
+
mcp_import_path = "../mcpServers" if is_root_layout else "../../mcpServers"
|
|
480
|
+
skills_import_path = "../skills" if is_root_layout else "../../skills"
|
|
481
|
+
tools_import_path = "../tools" if is_root_layout else "../../tools"
|
|
482
|
+
frontend_tools_import_path = (
|
|
483
|
+
"../frontendTools" if is_root_layout else "../../frontendTools"
|
|
484
|
+
)
|
|
355
485
|
|
|
356
486
|
# Header
|
|
357
487
|
code = """/*
|
|
@@ -367,21 +497,45 @@ def generate_typescript_code(
|
|
|
367
497
|
* Generated from YAML specifications in specs/agents/
|
|
368
498
|
*/
|
|
369
499
|
|
|
370
|
-
import type { AgentSpec } from '
|
|
500
|
+
import type { AgentSpec } from '"""
|
|
501
|
+
code += types_import_path
|
|
502
|
+
code += """';
|
|
371
503
|
"""
|
|
372
504
|
|
|
373
505
|
# Only add MCP server imports if needed
|
|
374
506
|
if has_mcp:
|
|
375
507
|
code += "import {\n"
|
|
376
508
|
code += " " + ",\n ".join(mcp_imports) + ",\n"
|
|
377
|
-
code += "} from '
|
|
509
|
+
code += "} from '"
|
|
510
|
+
code += mcp_import_path
|
|
511
|
+
code += "';\n"
|
|
378
512
|
|
|
379
513
|
# Only add skill imports if needed
|
|
380
514
|
if has_skills:
|
|
381
515
|
code += "import {\n"
|
|
382
516
|
code += " " + ",\n ".join(skill_imports) + ",\n"
|
|
383
|
-
code += "} from '
|
|
384
|
-
code +=
|
|
517
|
+
code += "} from '"
|
|
518
|
+
code += skills_import_path
|
|
519
|
+
code += "';\n"
|
|
520
|
+
code += "import type { SkillSpec } from '"
|
|
521
|
+
code += types_import_path
|
|
522
|
+
code += "';\n"
|
|
523
|
+
|
|
524
|
+
# Only add tool imports if needed
|
|
525
|
+
if has_tools:
|
|
526
|
+
code += "import {\n"
|
|
527
|
+
code += " " + ",\n ".join(tool_imports) + ",\n"
|
|
528
|
+
code += "} from '"
|
|
529
|
+
code += tools_import_path
|
|
530
|
+
code += "';\n"
|
|
531
|
+
|
|
532
|
+
# Only add frontend tool imports if needed
|
|
533
|
+
if has_frontend_tools:
|
|
534
|
+
code += "import {\n"
|
|
535
|
+
code += " " + ",\n ".join(frontend_tool_imports) + ",\n"
|
|
536
|
+
code += "} from '"
|
|
537
|
+
code += frontend_tools_import_path
|
|
538
|
+
code += "';\n"
|
|
385
539
|
|
|
386
540
|
# Only add MCP server lookup if used
|
|
387
541
|
if has_mcp:
|
|
@@ -411,7 +565,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
411
565
|
id: skill.id,
|
|
412
566
|
name: skill.name,
|
|
413
567
|
description: skill.description,
|
|
414
|
-
|
|
568
|
+
version: skill.version ?? '0.0.1',
|
|
415
569
|
tags: skill.tags,
|
|
416
570
|
enabled: skill.enabled,
|
|
417
571
|
requiredEnvVars: skill.requiredEnvVars,
|
|
@@ -419,6 +573,28 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
419
573
|
}
|
|
420
574
|
"""
|
|
421
575
|
|
|
576
|
+
# Only add tool lookup if used
|
|
577
|
+
if has_tools:
|
|
578
|
+
code += """
|
|
579
|
+
/**
|
|
580
|
+
* Map tool IDs to ToolSpec objects.
|
|
581
|
+
*/
|
|
582
|
+
const TOOL_MAP: Record<string, any> = {
|
|
583
|
+
"""
|
|
584
|
+
code += "\n".join(tool_map_entries) + "\n"
|
|
585
|
+
code += "};\n"
|
|
586
|
+
|
|
587
|
+
# Only add frontend tool lookup if used
|
|
588
|
+
if has_frontend_tools:
|
|
589
|
+
code += """
|
|
590
|
+
/**
|
|
591
|
+
* Map frontend tool IDs to FrontendToolSpec objects.
|
|
592
|
+
*/
|
|
593
|
+
const FRONTEND_TOOL_MAP: Record<string, any> = {
|
|
594
|
+
"""
|
|
595
|
+
code += "\n".join(frontend_tool_map_entries) + "\n"
|
|
596
|
+
code += "};\n"
|
|
597
|
+
|
|
422
598
|
code += """
|
|
423
599
|
// ============================================================================
|
|
424
600
|
// Agent Specs
|
|
@@ -451,6 +627,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
451
627
|
|
|
452
628
|
for spec in folder_specs:
|
|
453
629
|
agent_id = spec["id"]
|
|
630
|
+
version = spec["version"]
|
|
454
631
|
# Prefix agent ID with folder name for uniqueness
|
|
455
632
|
full_agent_id = f"{folder}/{agent_id}" if folder else agent_id
|
|
456
633
|
# Create constant name: e.g., "data-acquisition" -> "DATA_ACQUISITION_AGENT_SPEC"
|
|
@@ -462,10 +639,14 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
462
639
|
const_name = base_name + "_SPEC"
|
|
463
640
|
else:
|
|
464
641
|
const_name = base_name + "_AGENT_SPEC"
|
|
642
|
+
const_name += version_suffix(version)
|
|
465
643
|
agent_ids.append((full_agent_id, const_name, folder))
|
|
466
644
|
|
|
467
645
|
# Get MCP servers
|
|
468
|
-
mcp_server_ids =
|
|
646
|
+
mcp_server_ids = [
|
|
647
|
+
versioned_ref(*split_spec_ref(sid))
|
|
648
|
+
for sid in spec.get("mcp_servers", [])
|
|
649
|
+
]
|
|
469
650
|
if has_mcp and mcp_server_ids:
|
|
470
651
|
mcp_servers_str = ", ".join(
|
|
471
652
|
f"MCP_SERVER_MAP['{sid}']" for sid in mcp_server_ids
|
|
@@ -474,7 +655,9 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
474
655
|
mcp_servers_str = ""
|
|
475
656
|
|
|
476
657
|
# Get skills - resolve to AgentSkillSpec via toAgentSkillSpec
|
|
477
|
-
skill_ids_list =
|
|
658
|
+
skill_ids_list = [
|
|
659
|
+
versioned_ref(*split_spec_ref(sid)) for sid in spec.get("skills", [])
|
|
660
|
+
]
|
|
478
661
|
if has_skills and skill_ids_list:
|
|
479
662
|
skills_str = ", ".join(
|
|
480
663
|
f"toAgentSkillSpec(SKILL_MAP['{sid}'])" for sid in skill_ids_list
|
|
@@ -482,6 +665,27 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
482
665
|
else:
|
|
483
666
|
skills_str = ""
|
|
484
667
|
|
|
668
|
+
# Get tools - resolve to ToolSpec via TOOL_MAP
|
|
669
|
+
tool_ids_list = [
|
|
670
|
+
versioned_ref(*split_spec_ref(sid)) for sid in spec.get("tools", [])
|
|
671
|
+
]
|
|
672
|
+
if has_tools and tool_ids_list:
|
|
673
|
+
tools_str = ", ".join(f"TOOL_MAP['{tid}']" for tid in tool_ids_list)
|
|
674
|
+
else:
|
|
675
|
+
tools_str = ""
|
|
676
|
+
|
|
677
|
+
# Get frontend tools - resolve to FrontendToolSpec via FRONTEND_TOOL_MAP
|
|
678
|
+
frontend_tool_ids_list = [
|
|
679
|
+
versioned_ref(*split_spec_ref(sid))
|
|
680
|
+
for sid in spec.get("frontend_tools", [])
|
|
681
|
+
]
|
|
682
|
+
if has_frontend_tools and frontend_tool_ids_list:
|
|
683
|
+
frontend_tools_str = ", ".join(
|
|
684
|
+
f"FRONTEND_TOOL_MAP['{ftid}']" for ftid in frontend_tool_ids_list
|
|
685
|
+
)
|
|
686
|
+
else:
|
|
687
|
+
frontend_tools_str = ""
|
|
688
|
+
|
|
485
689
|
# Format tags and suggestions as arrays
|
|
486
690
|
tags = spec.get("tags", [])
|
|
487
691
|
tags_str = "[" + ", ".join(f"'{t}'" for t in tags) + "]"
|
|
@@ -512,6 +716,10 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
512
716
|
"`", "\\`"
|
|
513
717
|
)
|
|
514
718
|
|
|
719
|
+
welcome_message = spec.get("welcome_message")
|
|
720
|
+
welcome_notebook = spec.get("welcome_notebook")
|
|
721
|
+
welcome_document = spec.get("welcome_document")
|
|
722
|
+
|
|
515
723
|
# Clean description for TypeScript (multi-line template literal)
|
|
516
724
|
description = (
|
|
517
725
|
spec["description"].replace("\n", " ").replace(" ", " ").strip()
|
|
@@ -551,10 +759,12 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
551
759
|
f"'{auth_policy}'" if auth_policy is not None else "undefined"
|
|
552
760
|
)
|
|
553
761
|
notifs = spec.get("notifications")
|
|
554
|
-
|
|
762
|
+
memory_val = spec.get("memory")
|
|
763
|
+
memory_ts = f"'{memory_val}'" if memory_val else "undefined"
|
|
555
764
|
|
|
556
765
|
code += f"""export const {const_name}: AgentSpec = {{
|
|
557
766
|
id: '{full_agent_id}',
|
|
767
|
+
version: '{version}',
|
|
558
768
|
name: '{spec["name"]}',
|
|
559
769
|
description: `{description}`,
|
|
560
770
|
tags: {tags_str},
|
|
@@ -562,11 +772,16 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
562
772
|
model: {model_ts},
|
|
563
773
|
mcpServers: [{mcp_servers_str}],
|
|
564
774
|
skills: [{skills_str}],
|
|
775
|
+
tools: [{tools_str}],
|
|
776
|
+
frontendTools: [{frontend_tools_str}],
|
|
565
777
|
environmentName: '{spec.get("environment_name", "ai-agents-env")}',
|
|
566
778
|
icon: {icon},
|
|
567
779
|
emoji: {emoji},
|
|
568
780
|
color: {color},
|
|
569
781
|
suggestions: {suggestions_str},
|
|
782
|
+
welcomeMessage: {_fmt_ts_literal(welcome_message)},
|
|
783
|
+
welcomeNotebook: {_fmt_ts_literal(welcome_notebook)},
|
|
784
|
+
welcomeDocument: {_fmt_ts_literal(welcome_document)},
|
|
570
785
|
sandboxVariant: {sandbox_variant_ts},
|
|
571
786
|
systemPrompt: {f"`{system_prompt}`" if system_prompt else "undefined"},
|
|
572
787
|
systemPromptCodemodeAddons: {f"`{system_prompt_codemode_addons}`" if system_prompt_codemode_addons else "undefined"},
|
|
@@ -583,7 +798,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
583
798
|
advanced: {_fmt_ts_literal(advanced_val)},
|
|
584
799
|
authorizationPolicy: {auth_policy_ts},
|
|
585
800
|
notifications: {_fmt_ts_literal(notifs)},
|
|
586
|
-
|
|
801
|
+
memory: {memory_ts},
|
|
587
802
|
}};
|
|
588
803
|
|
|
589
804
|
"""
|
|
@@ -608,11 +823,21 @@ export const AGENT_SPECS: Record<string, AgentSpec> = {
|
|
|
608
823
|
|
|
609
824
|
code += """};
|
|
610
825
|
|
|
826
|
+
function resolveAgentId(agentId: string): string {
|
|
827
|
+
if (agentId in AGENT_SPECS) return agentId;
|
|
828
|
+
const idx = agentId.lastIndexOf(':');
|
|
829
|
+
if (idx > 0) {
|
|
830
|
+
const base = agentId.slice(0, idx);
|
|
831
|
+
if (base in AGENT_SPECS) return base;
|
|
832
|
+
}
|
|
833
|
+
return agentId;
|
|
834
|
+
}
|
|
835
|
+
|
|
611
836
|
/**
|
|
612
837
|
* Get an agent specification by ID.
|
|
613
838
|
*/
|
|
614
839
|
export function getAgentSpecs(agentId: string): AgentSpec | undefined {
|
|
615
|
-
return AGENT_SPECS[agentId];
|
|
840
|
+
return AGENT_SPECS[resolveAgentId(agentId)];
|
|
616
841
|
}
|
|
617
842
|
|
|
618
843
|
/**
|
|
@@ -633,14 +858,15 @@ export function listAgentSpecs(prefix?: string): AgentSpec[] {
|
|
|
633
858
|
*/
|
|
634
859
|
export function getAgentSpecRequiredEnvVars(spec: AgentSpec): string[] {
|
|
635
860
|
const vars = new Set<string>();
|
|
861
|
+
const baseEnvVar = (v: string): string => v.split(':')[0] ?? v;
|
|
636
862
|
for (const server of spec.mcpServers) {
|
|
637
863
|
for (const v of server.requiredEnvVars ?? []) {
|
|
638
|
-
|
|
864
|
+
vars.add(baseEnvVar(v));
|
|
639
865
|
}
|
|
640
866
|
}
|
|
641
867
|
for (const skill of spec.skills) {
|
|
642
868
|
for (const v of skill.requiredEnvVars ?? []) {
|
|
643
|
-
|
|
869
|
+
vars.add(baseEnvVar(v));
|
|
644
870
|
}
|
|
645
871
|
}
|
|
646
872
|
return Array.from(vars);
|
|
@@ -711,10 +937,13 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
711
937
|
# Get MCP and skills specs directories
|
|
712
938
|
mcp_specs_dir = args.specs_dir.parent / "mcp-servers"
|
|
713
939
|
skills_specs_dir = args.specs_dir.parent / "skills"
|
|
940
|
+
tools_specs_dir = args.specs_dir.parent / "tools"
|
|
714
941
|
|
|
715
942
|
# Determine base directories
|
|
716
943
|
python_base = args.python_output.parent / "agents"
|
|
717
944
|
typescript_base = args.typescript_output.parent / "agents"
|
|
945
|
+
python_base.mkdir(parents=True, exist_ok=True)
|
|
946
|
+
typescript_base.mkdir(parents=True, exist_ok=True)
|
|
718
947
|
|
|
719
948
|
print(f"Generating subfolder structure in {python_base} and {typescript_base}...")
|
|
720
949
|
|
|
@@ -723,18 +952,22 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
723
952
|
all_typescript_imports = []
|
|
724
953
|
|
|
725
954
|
for folder, folder_specs in sorted(specs_by_folder.items()):
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
955
|
+
is_root = not folder
|
|
956
|
+
if is_root:
|
|
957
|
+
print(" Generating agents for root level")
|
|
958
|
+
else:
|
|
959
|
+
print(f" Generating agents for subfolder: {folder}")
|
|
730
960
|
|
|
731
961
|
# Convert folder name to valid Python module name (replace hyphens with underscores)
|
|
732
|
-
folder_python_name = folder.replace("-", "_")
|
|
962
|
+
folder_python_name = folder.replace("-", "_") if folder else "agents"
|
|
733
963
|
|
|
734
|
-
# Create Python
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
964
|
+
# Create Python output file
|
|
965
|
+
if is_root:
|
|
966
|
+
python_file = python_base / "agents.py"
|
|
967
|
+
else:
|
|
968
|
+
python_folder_dir = python_base / folder_python_name
|
|
969
|
+
python_folder_dir.mkdir(parents=True, exist_ok=True)
|
|
970
|
+
python_file = python_folder_dir / "agents.py"
|
|
738
971
|
|
|
739
972
|
# Generate Python code for this folder
|
|
740
973
|
python_code = generate_python_code([(folder, spec) for spec in folder_specs])
|
|
@@ -742,9 +975,10 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
742
975
|
f.write(python_code)
|
|
743
976
|
|
|
744
977
|
# Create __init__.py for Python subfolder
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
978
|
+
if not is_root:
|
|
979
|
+
python_init = python_folder_dir / "__init__.py"
|
|
980
|
+
with open(python_init, "w") as f:
|
|
981
|
+
f.write("""# Copyright (c) 2025-2026 Datalayer, Inc.
|
|
748
982
|
# Distributed under the terms of the Modified BSD License.
|
|
749
983
|
|
|
750
984
|
from .agents import *
|
|
@@ -753,28 +987,36 @@ __all__ = ["AGENT_SPECS", "get_agent_spec", "list_agent_specs"]
|
|
|
753
987
|
""")
|
|
754
988
|
|
|
755
989
|
# Collect imports for main index
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
990
|
+
if is_root:
|
|
991
|
+
all_python_imports.append("from .agents import AGENT_SPECS as ROOT_AGENTS")
|
|
992
|
+
else:
|
|
993
|
+
all_python_imports.append(
|
|
994
|
+
f"from .{folder_python_name} import AGENT_SPECS as {folder_python_name.upper()}_AGENTS"
|
|
995
|
+
)
|
|
759
996
|
|
|
760
|
-
# Create TypeScript
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
997
|
+
# Create TypeScript output file
|
|
998
|
+
if is_root:
|
|
999
|
+
typescript_file = typescript_base / "agents.ts"
|
|
1000
|
+
else:
|
|
1001
|
+
typescript_folder_dir = typescript_base / folder
|
|
1002
|
+
typescript_folder_dir.mkdir(parents=True, exist_ok=True)
|
|
1003
|
+
typescript_file = typescript_folder_dir / "agents.ts"
|
|
764
1004
|
|
|
765
1005
|
# Generate TypeScript code for this folder
|
|
766
1006
|
typescript_code = generate_typescript_code(
|
|
767
1007
|
[(folder, spec) for spec in folder_specs],
|
|
768
1008
|
str(mcp_specs_dir),
|
|
769
1009
|
str(skills_specs_dir),
|
|
1010
|
+
str(tools_specs_dir),
|
|
770
1011
|
)
|
|
771
1012
|
with open(typescript_file, "w") as f:
|
|
772
1013
|
f.write(typescript_code)
|
|
773
1014
|
|
|
774
1015
|
# Create index.ts for TypeScript subfolder
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
1016
|
+
if not is_root:
|
|
1017
|
+
typescript_index = typescript_folder_dir / "index.ts"
|
|
1018
|
+
with open(typescript_index, "w") as f:
|
|
1019
|
+
f.write("""/*
|
|
778
1020
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
779
1021
|
* Distributed under the terms of the Modified BSD License.
|
|
780
1022
|
*/
|
|
@@ -783,7 +1025,10 @@ export * from './agents';
|
|
|
783
1025
|
""")
|
|
784
1026
|
|
|
785
1027
|
# Collect imports for main index
|
|
786
|
-
|
|
1028
|
+
if is_root:
|
|
1029
|
+
all_typescript_imports.append("export * from './agents';")
|
|
1030
|
+
else:
|
|
1031
|
+
all_typescript_imports.append(f"export * from './{folder}';")
|
|
787
1032
|
|
|
788
1033
|
# Create main Python index file
|
|
789
1034
|
python_index = python_base / "__init__.py"
|
|
@@ -817,12 +1062,20 @@ AGENT_SPECS: Dict[str, AgentSpec] = {}
|
|
|
817
1062
|
python_index_content += (
|
|
818
1063
|
f"AGENT_SPECS.update({folder_python_name.upper()}_AGENTS)\n"
|
|
819
1064
|
)
|
|
1065
|
+
else:
|
|
1066
|
+
python_index_content += "AGENT_SPECS.update(ROOT_AGENTS)\n"
|
|
820
1067
|
|
|
821
1068
|
python_index_content += """
|
|
822
1069
|
|
|
823
1070
|
def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
824
1071
|
\"\"\"Get an agent specification by ID.\"\"\"
|
|
825
|
-
|
|
1072
|
+
spec = AGENT_SPECS.get(agent_id)
|
|
1073
|
+
if spec is not None:
|
|
1074
|
+
return spec
|
|
1075
|
+
base, _, ver = agent_id.rpartition(':')
|
|
1076
|
+
if base and '.' in ver:
|
|
1077
|
+
return AGENT_SPECS.get(base)
|
|
1078
|
+
return None
|
|
826
1079
|
|
|
827
1080
|
|
|
828
1081
|
def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
@@ -864,6 +1117,10 @@ import type { AgentSpec } from '../../types';
|
|
|
864
1117
|
if folder:
|
|
865
1118
|
folder_const = folder.replace("-", "_").upper()
|
|
866
1119
|
typescript_index_content += f"import {{ AGENT_SPECS as {folder_const}_AGENTS }} from './{folder}';\n"
|
|
1120
|
+
else:
|
|
1121
|
+
typescript_index_content += (
|
|
1122
|
+
"import { AGENT_SPECS as ROOT_AGENTS } from './agents';\n"
|
|
1123
|
+
)
|
|
867
1124
|
|
|
868
1125
|
typescript_index_content += """
|
|
869
1126
|
// Merge all agent specs from subfolders
|
|
@@ -874,14 +1131,26 @@ export const AGENT_SPECS: Record<string, AgentSpec> = {
|
|
|
874
1131
|
if folder:
|
|
875
1132
|
folder_const = folder.replace("-", "_").upper()
|
|
876
1133
|
typescript_index_content += f" ...{folder_const}_AGENTS,\n"
|
|
1134
|
+
else:
|
|
1135
|
+
typescript_index_content += " ...ROOT_AGENTS,\n"
|
|
877
1136
|
|
|
878
1137
|
typescript_index_content += """};
|
|
879
1138
|
|
|
1139
|
+
function resolveAgentId(agentId: string): string {
|
|
1140
|
+
if (agentId in AGENT_SPECS) return agentId;
|
|
1141
|
+
const idx = agentId.lastIndexOf(':');
|
|
1142
|
+
if (idx > 0) {
|
|
1143
|
+
const base = agentId.slice(0, idx);
|
|
1144
|
+
if (base in AGENT_SPECS) return base;
|
|
1145
|
+
}
|
|
1146
|
+
return agentId;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
880
1149
|
/**
|
|
881
1150
|
* Get an agent specification by ID.
|
|
882
1151
|
*/
|
|
883
1152
|
export function getAgentSpecs(agentId: string): AgentSpec | undefined {
|
|
884
|
-
return AGENT_SPECS[agentId];
|
|
1153
|
+
return AGENT_SPECS[resolveAgentId(agentId)];
|
|
885
1154
|
}
|
|
886
1155
|
|
|
887
1156
|
/**
|
|
@@ -919,6 +1188,43 @@ export function getAgentSpecRequiredEnvVars(spec: AgentSpec): string[] {
|
|
|
919
1188
|
print(f"✓ Generated {len(specs_by_folder)} subfolder(s)")
|
|
920
1189
|
|
|
921
1190
|
|
|
1191
|
+
def ensure_specs_barrel(specs_dir: Path) -> None:
|
|
1192
|
+
"""Ensure top-level TypeScript specs barrel file exists.
|
|
1193
|
+
|
|
1194
|
+
This keeps imports like ``from './specs'`` valid even when regenerating
|
|
1195
|
+
from an empty ``src/specs`` tree.
|
|
1196
|
+
"""
|
|
1197
|
+
specs_dir.mkdir(parents=True, exist_ok=True)
|
|
1198
|
+
index_path = specs_dir / "index.ts"
|
|
1199
|
+
index_path.write_text(
|
|
1200
|
+
"""/*
|
|
1201
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
1202
|
+
* Distributed under the terms of the Modified BSD License.
|
|
1203
|
+
*/
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* Specs exports.
|
|
1207
|
+
*
|
|
1208
|
+
* This file is AUTO-GENERATED. DO NOT EDIT MANUALLY.
|
|
1209
|
+
*/
|
|
1210
|
+
|
|
1211
|
+
export * from './agents';
|
|
1212
|
+
export * from './teams';
|
|
1213
|
+
export * from './envvars';
|
|
1214
|
+
export * from './evals';
|
|
1215
|
+
export * from './guardrails';
|
|
1216
|
+
export * from './mcpServers';
|
|
1217
|
+
export * from './memory';
|
|
1218
|
+
export * from './models';
|
|
1219
|
+
export * from './notifications';
|
|
1220
|
+
export * from './outputs';
|
|
1221
|
+
export * from './skills';
|
|
1222
|
+
export * from './tools';
|
|
1223
|
+
export * from './triggers';
|
|
1224
|
+
"""
|
|
1225
|
+
)
|
|
1226
|
+
|
|
1227
|
+
|
|
922
1228
|
def main():
|
|
923
1229
|
"""Main entry point."""
|
|
924
1230
|
parser = argparse.ArgumentParser(
|
|
@@ -963,6 +1269,7 @@ def main():
|
|
|
963
1269
|
if args.subfolder_structure:
|
|
964
1270
|
# Generate separate files per subfolder
|
|
965
1271
|
generate_subfolder_structure(specs, args)
|
|
1272
|
+
ensure_specs_barrel(args.typescript_output.parent)
|
|
966
1273
|
else:
|
|
967
1274
|
# Generate Python code (single file)
|
|
968
1275
|
print(f"Generating Python code to {args.python_output}...")
|
|
@@ -976,13 +1283,19 @@ def main():
|
|
|
976
1283
|
# Get MCP and skills specs directories (siblings to agents directory)
|
|
977
1284
|
mcp_specs_dir = args.specs_dir.parent / "mcp-servers"
|
|
978
1285
|
skills_specs_dir = args.specs_dir.parent / "skills"
|
|
1286
|
+
tools_specs_dir = args.specs_dir.parent / "tools"
|
|
979
1287
|
typescript_code = generate_typescript_code(
|
|
980
|
-
specs,
|
|
1288
|
+
specs,
|
|
1289
|
+
str(mcp_specs_dir),
|
|
1290
|
+
str(skills_specs_dir),
|
|
1291
|
+
str(tools_specs_dir),
|
|
981
1292
|
)
|
|
982
1293
|
args.typescript_output.parent.mkdir(parents=True, exist_ok=True)
|
|
983
1294
|
with open(args.typescript_output, "w") as f:
|
|
984
1295
|
f.write(typescript_code)
|
|
985
1296
|
|
|
1297
|
+
ensure_specs_barrel(args.typescript_output.parent)
|
|
1298
|
+
|
|
986
1299
|
# Update __init__.py with new agent spec constants
|
|
987
1300
|
init_file_path = args.python_output.parent / "__init__.py"
|
|
988
1301
|
if init_file_path.exists():
|