@datalayer/agent-runtimes 1.0.1 → 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 +25 -16
- 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 +37 -12
- package/lib/hooks/index.js +37 -12
- 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/useAgentsCatalog.d.ts +25 -0
- package/lib/hooks/useAgentsCatalog.js +28 -0
- 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 +2 -3
- package/lib/{components → mcp}/McpServerManager.js +1 -1
- 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/agents.js +2638 -0
- package/lib/specs/agents/index.js +14 -7
- 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 -10
- package/lib/specs/mcpServers.js +95 -25
- package/lib/specs/memory.d.ts +34 -0
- package/lib/specs/memory.js +99 -0
- package/lib/specs/models.d.ts +22 -35
- package/lib/specs/models.js +64 -44
- 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 +2 -2
- package/lib/{components/chat/store → stores}/conversationStore.js +3 -3
- 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} +60 -100
- 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 +464 -58
- 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 -2240
- 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/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 -151
- 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 -308
- 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 -282
- package/lib/specs/agents/datalayer-ai/index.d.ts +0 -1
- package/lib/specs/agents/datalayer-ai/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 -189
- /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/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
|
@@ -9,11 +9,18 @@ Generates Python and TypeScript code from YAML agent specifications.
|
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
import argparse
|
|
12
|
+
import json
|
|
12
13
|
import sys
|
|
13
14
|
from pathlib import Path
|
|
14
15
|
from typing import Any, Dict, List
|
|
15
16
|
|
|
16
17
|
import yaml
|
|
18
|
+
from versioning import (
|
|
19
|
+
ensure_spec_version,
|
|
20
|
+
split_spec_ref,
|
|
21
|
+
version_suffix,
|
|
22
|
+
versioned_ref,
|
|
23
|
+
)
|
|
17
24
|
|
|
18
25
|
|
|
19
26
|
def _fmt_list(items: list[str]) -> str:
|
|
@@ -23,6 +30,20 @@ def _fmt_list(items: list[str]) -> str:
|
|
|
23
30
|
return "[" + ", ".join(f'"{item}"' for item in items) + "]"
|
|
24
31
|
|
|
25
32
|
|
|
33
|
+
def _fmt_py_literal(value: Any) -> str:
|
|
34
|
+
"""Format a value as a Python literal for code generation."""
|
|
35
|
+
if value is None:
|
|
36
|
+
return "None"
|
|
37
|
+
return repr(value)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _fmt_ts_literal(value: Any) -> str:
|
|
41
|
+
"""Format a value as a TypeScript/JSON literal for code generation."""
|
|
42
|
+
if value is None:
|
|
43
|
+
return "undefined"
|
|
44
|
+
return json.dumps(value, ensure_ascii=False)
|
|
45
|
+
|
|
46
|
+
|
|
26
47
|
def load_yaml_specs(specs_dir: Path) -> List[tuple[str, Dict[str, Any]]]:
|
|
27
48
|
"""
|
|
28
49
|
Load all YAML agent specifications from directory and subdirectories.
|
|
@@ -37,6 +58,7 @@ def load_yaml_specs(specs_dir: Path) -> List[tuple[str, Dict[str, Any]]]:
|
|
|
37
58
|
with open(yaml_file, "r") as f:
|
|
38
59
|
spec = yaml.safe_load(f)
|
|
39
60
|
if spec: # Skip empty files
|
|
61
|
+
ensure_spec_version(spec)
|
|
40
62
|
specs.append(("", spec))
|
|
41
63
|
|
|
42
64
|
# Then, load specs from subdirectories (one level deep)
|
|
@@ -46,6 +68,7 @@ def load_yaml_specs(specs_dir: Path) -> List[tuple[str, Dict[str, Any]]]:
|
|
|
46
68
|
with open(yaml_file, "r") as f:
|
|
47
69
|
spec = yaml.safe_load(f)
|
|
48
70
|
if spec: # Skip empty files
|
|
71
|
+
ensure_spec_version(spec)
|
|
49
72
|
specs.append((subdir.name, spec))
|
|
50
73
|
|
|
51
74
|
return specs
|
|
@@ -60,7 +83,7 @@ def generate_python_code(specs: List[tuple[str, Dict[str, Any]]]) -> str:
|
|
|
60
83
|
"""
|
|
61
84
|
Agent Library.
|
|
62
85
|
|
|
63
|
-
Predefined agent specifications that can be instantiated as
|
|
86
|
+
Predefined agent specifications that can be instantiated as Agent Runtimes.
|
|
64
87
|
THIS FILE IS AUTO-GENERATED. DO NOT EDIT MANUALLY.
|
|
65
88
|
Generated from YAML specifications in specs/agents/
|
|
66
89
|
"""
|
|
@@ -101,6 +124,7 @@ from agent_runtimes.types import AgentSpec
|
|
|
101
124
|
|
|
102
125
|
for spec in folder_specs:
|
|
103
126
|
agent_id = spec["id"]
|
|
127
|
+
version = spec["version"]
|
|
104
128
|
# Prefix agent ID with folder name for uniqueness
|
|
105
129
|
full_agent_id = f"{folder}/{agent_id}" if folder else agent_id
|
|
106
130
|
# Create constant name: e.g., "data-acquisition" -> "DATA_ACQUISITION_AGENT_SPEC"
|
|
@@ -112,14 +136,29 @@ from agent_runtimes.types import AgentSpec
|
|
|
112
136
|
const_name = base_name + "_SPEC"
|
|
113
137
|
else:
|
|
114
138
|
const_name = base_name + "_AGENT_SPEC"
|
|
139
|
+
const_name += version_suffix(version)
|
|
115
140
|
agent_ids.append((full_agent_id, const_name, folder))
|
|
116
141
|
|
|
117
142
|
# Get MCP servers
|
|
118
|
-
|
|
143
|
+
mcp_server_refs = [
|
|
144
|
+
split_spec_ref(sid)[0] for sid in spec.get("mcp_servers", [])
|
|
145
|
+
]
|
|
119
146
|
mcp_servers_str = ", ".join(
|
|
120
|
-
f'MCP_SERVER_CATALOG["{sid}"]' for sid in
|
|
147
|
+
f'MCP_SERVER_CATALOG["{sid}"]' for sid in mcp_server_refs
|
|
121
148
|
)
|
|
122
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
|
+
|
|
123
162
|
# Format optional fields
|
|
124
163
|
icon = f'"{spec.get("icon")}"' if spec.get("icon") else "None"
|
|
125
164
|
emoji = f'"{spec.get("emoji")}"' if spec.get("emoji") else "None"
|
|
@@ -154,6 +193,7 @@ from agent_runtimes.types import AgentSpec
|
|
|
154
193
|
# Clean description for Python (single line)
|
|
155
194
|
description = (
|
|
156
195
|
spec["description"].replace("\n", " ").replace(" ", " ").strip()
|
|
196
|
+
.replace('"', '\\"')
|
|
157
197
|
)
|
|
158
198
|
|
|
159
199
|
# Use triple quotes for multiline system prompts
|
|
@@ -172,15 +212,43 @@ from agent_runtimes.types import AgentSpec
|
|
|
172
212
|
sandbox_variant = spec.get("sandbox_variant")
|
|
173
213
|
sandbox_variant_str = f'"{sandbox_variant}"' if sandbox_variant else "None"
|
|
174
214
|
|
|
215
|
+
# New flow-level fields
|
|
216
|
+
goal_raw = spec.get("goal")
|
|
217
|
+
goal_str = (
|
|
218
|
+
f'"{goal_raw.replace(chr(10), " ").replace(" ", " ").strip()}"'
|
|
219
|
+
if goal_raw
|
|
220
|
+
else "None"
|
|
221
|
+
)
|
|
222
|
+
protocol_val = spec.get("protocol")
|
|
223
|
+
protocol_str = f'"{protocol_val}"' if protocol_val else "None"
|
|
224
|
+
ui_ext = spec.get("ui_extension")
|
|
225
|
+
ui_ext_str = f'"{ui_ext}"' if ui_ext else "None"
|
|
226
|
+
trigger_val = spec.get("trigger")
|
|
227
|
+
model_cfg = spec.get("model_config")
|
|
228
|
+
mcp_srv_tools = spec.get("mcp_server_tools")
|
|
229
|
+
guardrails_val = spec.get("guardrails")
|
|
230
|
+
evals_val = spec.get("evals")
|
|
231
|
+
codemode_val = spec.get("codemode")
|
|
232
|
+
output_val = spec.get("output")
|
|
233
|
+
advanced_val = spec.get("advanced")
|
|
234
|
+
auth_policy = spec.get("authorization_policy")
|
|
235
|
+
auth_policy_str = f'"{auth_policy}"' if auth_policy is not None else "None"
|
|
236
|
+
notifs = spec.get("notifications")
|
|
237
|
+
memory_val = spec.get("memory")
|
|
238
|
+
memory_str = f'"{memory_val}"' if memory_val else "None"
|
|
239
|
+
|
|
175
240
|
code += f'''{const_name} = AgentSpec(
|
|
176
241
|
id="{full_agent_id}",
|
|
242
|
+
version="{version}",
|
|
177
243
|
name="{spec["name"]}",
|
|
178
244
|
description="{description}",
|
|
179
245
|
tags={_fmt_list(spec.get("tags", []))},
|
|
180
246
|
enabled={spec.get("enabled", True)},
|
|
181
247
|
model={model_str},
|
|
182
248
|
mcp_servers=[{mcp_servers_str}],
|
|
183
|
-
skills={_fmt_list(
|
|
249
|
+
skills={_fmt_list(skill_refs)},
|
|
250
|
+
tools={_fmt_list(tool_refs)},
|
|
251
|
+
frontend_tools={_fmt_list(frontend_tool_refs)},
|
|
184
252
|
environment_name="{spec.get("environment_name", "ai-agents-env")}",
|
|
185
253
|
icon={icon},
|
|
186
254
|
emoji={emoji},
|
|
@@ -192,6 +260,20 @@ from agent_runtimes.types import AgentSpec
|
|
|
192
260
|
sandbox_variant={sandbox_variant_str},
|
|
193
261
|
system_prompt={system_prompt_str},
|
|
194
262
|
system_prompt_codemode_addons={system_prompt_codemode_addons_str},
|
|
263
|
+
goal={goal_str},
|
|
264
|
+
protocol={protocol_str},
|
|
265
|
+
ui_extension={ui_ext_str},
|
|
266
|
+
trigger={_fmt_py_literal(trigger_val)},
|
|
267
|
+
model_configuration={_fmt_py_literal(model_cfg)},
|
|
268
|
+
mcp_server_tools={_fmt_py_literal(mcp_srv_tools)},
|
|
269
|
+
guardrails={_fmt_py_literal(guardrails_val)},
|
|
270
|
+
evals={_fmt_py_literal(evals_val)},
|
|
271
|
+
codemode={_fmt_py_literal(codemode_val)},
|
|
272
|
+
output={_fmt_py_literal(output_val)},
|
|
273
|
+
advanced={_fmt_py_literal(advanced_val)},
|
|
274
|
+
authorization_policy={auth_policy_str},
|
|
275
|
+
notifications={_fmt_py_literal(notifs)},
|
|
276
|
+
memory={memory_str},
|
|
195
277
|
)
|
|
196
278
|
|
|
197
279
|
'''
|
|
@@ -220,7 +302,7 @@ AGENT_SPECS: Dict[str, AgentSpec] = {
|
|
|
220
302
|
|
|
221
303
|
def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
222
304
|
\"\"\"
|
|
223
|
-
Get an agent specification by ID.
|
|
305
|
+
Get an agent specification by ID (accepts both bare and versioned refs).
|
|
224
306
|
|
|
225
307
|
Args:
|
|
226
308
|
agent_id: The unique identifier of the agent.
|
|
@@ -228,7 +310,13 @@ def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
|
228
310
|
Returns:
|
|
229
311
|
The AgentSpec configuration, or None if not found.
|
|
230
312
|
\"\"\"
|
|
231
|
-
|
|
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
|
|
232
320
|
|
|
233
321
|
|
|
234
322
|
def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
@@ -251,7 +339,10 @@ def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
|
251
339
|
|
|
252
340
|
|
|
253
341
|
def generate_typescript_code(
|
|
254
|
-
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,
|
|
255
346
|
) -> str:
|
|
256
347
|
"""Generate TypeScript code from agent specifications."""
|
|
257
348
|
# Load available MCP servers from specs
|
|
@@ -259,46 +350,138 @@ def generate_typescript_code(
|
|
|
259
350
|
import os
|
|
260
351
|
|
|
261
352
|
mcp_server_files = glob.glob(os.path.join(mcp_specs_dir, "*.yaml"))
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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"])
|
|
266
360
|
|
|
267
361
|
# Load available skills from specs
|
|
268
362
|
skill_files = glob.glob(os.path.join(skills_specs_dir, "*.yaml"))
|
|
269
|
-
|
|
270
|
-
|
|
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"])
|
|
271
380
|
|
|
272
381
|
# Determine which MCP servers and skills are actually used in these specs
|
|
273
382
|
used_mcp_servers = set()
|
|
274
383
|
used_skills = set()
|
|
384
|
+
used_tools = set()
|
|
385
|
+
used_frontend_tools = set()
|
|
275
386
|
for _, spec in specs:
|
|
276
387
|
for server in spec.get("mcp_servers", []):
|
|
277
|
-
used_mcp_servers.add(server)
|
|
388
|
+
used_mcp_servers.add(versioned_ref(*split_spec_ref(server)))
|
|
278
389
|
for skill in spec.get("skills", []):
|
|
279
|
-
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)))
|
|
280
395
|
|
|
281
396
|
# Only import what's actually used
|
|
282
397
|
mcp_imports = []
|
|
283
398
|
mcp_map_entries = []
|
|
284
|
-
for
|
|
285
|
-
|
|
286
|
-
|
|
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
|
+
)
|
|
287
408
|
mcp_imports.append(const_name)
|
|
409
|
+
mcp_map_entries.append(f" '{server_ref}': {const_name},")
|
|
288
410
|
mcp_map_entries.append(f" '{server_id}': {const_name},")
|
|
289
411
|
|
|
290
412
|
# Generate skill import names and map entries
|
|
291
413
|
skill_imports = []
|
|
292
414
|
skill_map_entries = []
|
|
293
|
-
for
|
|
294
|
-
|
|
295
|
-
|
|
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
|
+
)
|
|
296
424
|
skill_imports.append(const_name)
|
|
425
|
+
skill_map_entries.append(f" '{sref}': {const_name},")
|
|
297
426
|
skill_map_entries.append(f" '{sid}': {const_name},")
|
|
298
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
|
+
|
|
299
469
|
# Determine if we need any helper code
|
|
300
470
|
has_mcp = len(mcp_imports) > 0
|
|
301
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
|
+
)
|
|
302
485
|
|
|
303
486
|
# Header
|
|
304
487
|
code = """/*
|
|
@@ -309,26 +492,50 @@ def generate_typescript_code(
|
|
|
309
492
|
/**
|
|
310
493
|
* Agent Library.
|
|
311
494
|
*
|
|
312
|
-
* Predefined agent specifications that can be instantiated as
|
|
495
|
+
* Predefined agent specifications that can be instantiated as Agent Runtimes.
|
|
313
496
|
* THIS FILE IS AUTO-GENERATED. DO NOT EDIT MANUALLY.
|
|
314
497
|
* Generated from YAML specifications in specs/agents/
|
|
315
498
|
*/
|
|
316
499
|
|
|
317
|
-
import type { AgentSpec } from '
|
|
500
|
+
import type { AgentSpec } from '"""
|
|
501
|
+
code += types_import_path
|
|
502
|
+
code += """';
|
|
318
503
|
"""
|
|
319
504
|
|
|
320
505
|
# Only add MCP server imports if needed
|
|
321
506
|
if has_mcp:
|
|
322
507
|
code += "import {\n"
|
|
323
508
|
code += " " + ",\n ".join(mcp_imports) + ",\n"
|
|
324
|
-
code += "} from '
|
|
509
|
+
code += "} from '"
|
|
510
|
+
code += mcp_import_path
|
|
511
|
+
code += "';\n"
|
|
325
512
|
|
|
326
513
|
# Only add skill imports if needed
|
|
327
514
|
if has_skills:
|
|
328
515
|
code += "import {\n"
|
|
329
516
|
code += " " + ",\n ".join(skill_imports) + ",\n"
|
|
330
|
-
code += "} from '
|
|
331
|
-
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"
|
|
332
539
|
|
|
333
540
|
# Only add MCP server lookup if used
|
|
334
541
|
if has_mcp:
|
|
@@ -358,7 +565,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
358
565
|
id: skill.id,
|
|
359
566
|
name: skill.name,
|
|
360
567
|
description: skill.description,
|
|
361
|
-
|
|
568
|
+
version: skill.version ?? '0.0.1',
|
|
362
569
|
tags: skill.tags,
|
|
363
570
|
enabled: skill.enabled,
|
|
364
571
|
requiredEnvVars: skill.requiredEnvVars,
|
|
@@ -366,6 +573,28 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
366
573
|
}
|
|
367
574
|
"""
|
|
368
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
|
+
|
|
369
598
|
code += """
|
|
370
599
|
// ============================================================================
|
|
371
600
|
// Agent Specs
|
|
@@ -398,6 +627,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
398
627
|
|
|
399
628
|
for spec in folder_specs:
|
|
400
629
|
agent_id = spec["id"]
|
|
630
|
+
version = spec["version"]
|
|
401
631
|
# Prefix agent ID with folder name for uniqueness
|
|
402
632
|
full_agent_id = f"{folder}/{agent_id}" if folder else agent_id
|
|
403
633
|
# Create constant name: e.g., "data-acquisition" -> "DATA_ACQUISITION_AGENT_SPEC"
|
|
@@ -409,10 +639,14 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
409
639
|
const_name = base_name + "_SPEC"
|
|
410
640
|
else:
|
|
411
641
|
const_name = base_name + "_AGENT_SPEC"
|
|
642
|
+
const_name += version_suffix(version)
|
|
412
643
|
agent_ids.append((full_agent_id, const_name, folder))
|
|
413
644
|
|
|
414
645
|
# Get MCP servers
|
|
415
|
-
mcp_server_ids =
|
|
646
|
+
mcp_server_ids = [
|
|
647
|
+
versioned_ref(*split_spec_ref(sid))
|
|
648
|
+
for sid in spec.get("mcp_servers", [])
|
|
649
|
+
]
|
|
416
650
|
if has_mcp and mcp_server_ids:
|
|
417
651
|
mcp_servers_str = ", ".join(
|
|
418
652
|
f"MCP_SERVER_MAP['{sid}']" for sid in mcp_server_ids
|
|
@@ -421,7 +655,9 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
421
655
|
mcp_servers_str = ""
|
|
422
656
|
|
|
423
657
|
# Get skills - resolve to AgentSkillSpec via toAgentSkillSpec
|
|
424
|
-
skill_ids_list =
|
|
658
|
+
skill_ids_list = [
|
|
659
|
+
versioned_ref(*split_spec_ref(sid)) for sid in spec.get("skills", [])
|
|
660
|
+
]
|
|
425
661
|
if has_skills and skill_ids_list:
|
|
426
662
|
skills_str = ", ".join(
|
|
427
663
|
f"toAgentSkillSpec(SKILL_MAP['{sid}'])" for sid in skill_ids_list
|
|
@@ -429,6 +665,27 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
429
665
|
else:
|
|
430
666
|
skills_str = ""
|
|
431
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
|
+
|
|
432
689
|
# Format tags and suggestions as arrays
|
|
433
690
|
tags = spec.get("tags", [])
|
|
434
691
|
tags_str = "[" + ", ".join(f"'{t}'" for t in tags) + "]"
|
|
@@ -459,6 +716,10 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
459
716
|
"`", "\\`"
|
|
460
717
|
)
|
|
461
718
|
|
|
719
|
+
welcome_message = spec.get("welcome_message")
|
|
720
|
+
welcome_notebook = spec.get("welcome_notebook")
|
|
721
|
+
welcome_document = spec.get("welcome_document")
|
|
722
|
+
|
|
462
723
|
# Clean description for TypeScript (multi-line template literal)
|
|
463
724
|
description = (
|
|
464
725
|
spec["description"].replace("\n", " ").replace(" ", " ").strip()
|
|
@@ -474,8 +735,36 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
474
735
|
f"'{sandbox_variant}'" if sandbox_variant else "undefined"
|
|
475
736
|
)
|
|
476
737
|
|
|
738
|
+
# New flow-level fields
|
|
739
|
+
goal_raw = spec.get("goal")
|
|
740
|
+
goal_ts = (
|
|
741
|
+
f"`{goal_raw.replace(chr(10), ' ').replace(' ', ' ').strip().replace('`', chr(92) + '`')}`"
|
|
742
|
+
if goal_raw
|
|
743
|
+
else "undefined"
|
|
744
|
+
)
|
|
745
|
+
protocol_val = spec.get("protocol")
|
|
746
|
+
protocol_ts = f"'{protocol_val}'" if protocol_val else "undefined"
|
|
747
|
+
ui_ext = spec.get("ui_extension")
|
|
748
|
+
ui_ext_ts = f"'{ui_ext}'" if ui_ext else "undefined"
|
|
749
|
+
trigger_val = spec.get("trigger")
|
|
750
|
+
model_cfg = spec.get("model_config")
|
|
751
|
+
mcp_srv_tools = spec.get("mcp_server_tools")
|
|
752
|
+
guardrails_val = spec.get("guardrails")
|
|
753
|
+
evals_val = spec.get("evals")
|
|
754
|
+
codemode_val = spec.get("codemode")
|
|
755
|
+
output_val = spec.get("output")
|
|
756
|
+
advanced_val = spec.get("advanced")
|
|
757
|
+
auth_policy = spec.get("authorization_policy")
|
|
758
|
+
auth_policy_ts = (
|
|
759
|
+
f"'{auth_policy}'" if auth_policy is not None else "undefined"
|
|
760
|
+
)
|
|
761
|
+
notifs = spec.get("notifications")
|
|
762
|
+
memory_val = spec.get("memory")
|
|
763
|
+
memory_ts = f"'{memory_val}'" if memory_val else "undefined"
|
|
764
|
+
|
|
477
765
|
code += f"""export const {const_name}: AgentSpec = {{
|
|
478
766
|
id: '{full_agent_id}',
|
|
767
|
+
version: '{version}',
|
|
479
768
|
name: '{spec["name"]}',
|
|
480
769
|
description: `{description}`,
|
|
481
770
|
tags: {tags_str},
|
|
@@ -483,14 +772,33 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
483
772
|
model: {model_ts},
|
|
484
773
|
mcpServers: [{mcp_servers_str}],
|
|
485
774
|
skills: [{skills_str}],
|
|
775
|
+
tools: [{tools_str}],
|
|
776
|
+
frontendTools: [{frontend_tools_str}],
|
|
486
777
|
environmentName: '{spec.get("environment_name", "ai-agents-env")}',
|
|
487
778
|
icon: {icon},
|
|
488
779
|
emoji: {emoji},
|
|
489
780
|
color: {color},
|
|
490
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)},
|
|
491
785
|
sandboxVariant: {sandbox_variant_ts},
|
|
492
786
|
systemPrompt: {f"`{system_prompt}`" if system_prompt else "undefined"},
|
|
493
787
|
systemPromptCodemodeAddons: {f"`{system_prompt_codemode_addons}`" if system_prompt_codemode_addons else "undefined"},
|
|
788
|
+
goal: {goal_ts},
|
|
789
|
+
protocol: {protocol_ts},
|
|
790
|
+
uiExtension: {ui_ext_ts},
|
|
791
|
+
trigger: {_fmt_ts_literal(trigger_val)},
|
|
792
|
+
modelConfig: {_fmt_ts_literal(model_cfg)},
|
|
793
|
+
mcpServerTools: {_fmt_ts_literal(mcp_srv_tools)},
|
|
794
|
+
guardrails: {_fmt_ts_literal(guardrails_val)},
|
|
795
|
+
evals: {_fmt_ts_literal(evals_val)},
|
|
796
|
+
codemode: {_fmt_ts_literal(codemode_val)},
|
|
797
|
+
output: {_fmt_ts_literal(output_val)},
|
|
798
|
+
advanced: {_fmt_ts_literal(advanced_val)},
|
|
799
|
+
authorizationPolicy: {auth_policy_ts},
|
|
800
|
+
notifications: {_fmt_ts_literal(notifs)},
|
|
801
|
+
memory: {memory_ts},
|
|
494
802
|
}};
|
|
495
803
|
|
|
496
804
|
"""
|
|
@@ -515,11 +823,21 @@ export const AGENT_SPECS: Record<string, AgentSpec> = {
|
|
|
515
823
|
|
|
516
824
|
code += """};
|
|
517
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
|
+
|
|
518
836
|
/**
|
|
519
837
|
* Get an agent specification by ID.
|
|
520
838
|
*/
|
|
521
839
|
export function getAgentSpecs(agentId: string): AgentSpec | undefined {
|
|
522
|
-
return AGENT_SPECS[agentId];
|
|
840
|
+
return AGENT_SPECS[resolveAgentId(agentId)];
|
|
523
841
|
}
|
|
524
842
|
|
|
525
843
|
/**
|
|
@@ -540,14 +858,15 @@ export function listAgentSpecs(prefix?: string): AgentSpec[] {
|
|
|
540
858
|
*/
|
|
541
859
|
export function getAgentSpecRequiredEnvVars(spec: AgentSpec): string[] {
|
|
542
860
|
const vars = new Set<string>();
|
|
861
|
+
const baseEnvVar = (v: string): string => v.split(':')[0] ?? v;
|
|
543
862
|
for (const server of spec.mcpServers) {
|
|
544
863
|
for (const v of server.requiredEnvVars ?? []) {
|
|
545
|
-
|
|
864
|
+
vars.add(baseEnvVar(v));
|
|
546
865
|
}
|
|
547
866
|
}
|
|
548
867
|
for (const skill of spec.skills) {
|
|
549
868
|
for (const v of skill.requiredEnvVars ?? []) {
|
|
550
|
-
|
|
869
|
+
vars.add(baseEnvVar(v));
|
|
551
870
|
}
|
|
552
871
|
}
|
|
553
872
|
return Array.from(vars);
|
|
@@ -618,10 +937,13 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
618
937
|
# Get MCP and skills specs directories
|
|
619
938
|
mcp_specs_dir = args.specs_dir.parent / "mcp-servers"
|
|
620
939
|
skills_specs_dir = args.specs_dir.parent / "skills"
|
|
940
|
+
tools_specs_dir = args.specs_dir.parent / "tools"
|
|
621
941
|
|
|
622
942
|
# Determine base directories
|
|
623
943
|
python_base = args.python_output.parent / "agents"
|
|
624
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)
|
|
625
947
|
|
|
626
948
|
print(f"Generating subfolder structure in {python_base} and {typescript_base}...")
|
|
627
949
|
|
|
@@ -630,18 +952,22 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
630
952
|
all_typescript_imports = []
|
|
631
953
|
|
|
632
954
|
for folder, folder_specs in sorted(specs_by_folder.items()):
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
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}")
|
|
637
960
|
|
|
638
961
|
# Convert folder name to valid Python module name (replace hyphens with underscores)
|
|
639
|
-
folder_python_name = folder.replace("-", "_")
|
|
962
|
+
folder_python_name = folder.replace("-", "_") if folder else "agents"
|
|
640
963
|
|
|
641
|
-
# Create Python
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
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"
|
|
645
971
|
|
|
646
972
|
# Generate Python code for this folder
|
|
647
973
|
python_code = generate_python_code([(folder, spec) for spec in folder_specs])
|
|
@@ -649,9 +975,10 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
649
975
|
f.write(python_code)
|
|
650
976
|
|
|
651
977
|
# Create __init__.py for Python subfolder
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
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.
|
|
655
982
|
# Distributed under the terms of the Modified BSD License.
|
|
656
983
|
|
|
657
984
|
from .agents import *
|
|
@@ -660,28 +987,36 @@ __all__ = ["AGENT_SPECS", "get_agent_spec", "list_agent_specs"]
|
|
|
660
987
|
""")
|
|
661
988
|
|
|
662
989
|
# Collect imports for main index
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
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
|
+
)
|
|
666
996
|
|
|
667
|
-
# Create TypeScript
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
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"
|
|
671
1004
|
|
|
672
1005
|
# Generate TypeScript code for this folder
|
|
673
1006
|
typescript_code = generate_typescript_code(
|
|
674
1007
|
[(folder, spec) for spec in folder_specs],
|
|
675
1008
|
str(mcp_specs_dir),
|
|
676
1009
|
str(skills_specs_dir),
|
|
1010
|
+
str(tools_specs_dir),
|
|
677
1011
|
)
|
|
678
1012
|
with open(typescript_file, "w") as f:
|
|
679
1013
|
f.write(typescript_code)
|
|
680
1014
|
|
|
681
1015
|
# Create index.ts for TypeScript subfolder
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
1016
|
+
if not is_root:
|
|
1017
|
+
typescript_index = typescript_folder_dir / "index.ts"
|
|
1018
|
+
with open(typescript_index, "w") as f:
|
|
1019
|
+
f.write("""/*
|
|
685
1020
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
686
1021
|
* Distributed under the terms of the Modified BSD License.
|
|
687
1022
|
*/
|
|
@@ -690,7 +1025,10 @@ export * from './agents';
|
|
|
690
1025
|
""")
|
|
691
1026
|
|
|
692
1027
|
# Collect imports for main index
|
|
693
|
-
|
|
1028
|
+
if is_root:
|
|
1029
|
+
all_typescript_imports.append("export * from './agents';")
|
|
1030
|
+
else:
|
|
1031
|
+
all_typescript_imports.append(f"export * from './{folder}';")
|
|
694
1032
|
|
|
695
1033
|
# Create main Python index file
|
|
696
1034
|
python_index = python_base / "__init__.py"
|
|
@@ -724,12 +1062,20 @@ AGENT_SPECS: Dict[str, AgentSpec] = {}
|
|
|
724
1062
|
python_index_content += (
|
|
725
1063
|
f"AGENT_SPECS.update({folder_python_name.upper()}_AGENTS)\n"
|
|
726
1064
|
)
|
|
1065
|
+
else:
|
|
1066
|
+
python_index_content += "AGENT_SPECS.update(ROOT_AGENTS)\n"
|
|
727
1067
|
|
|
728
1068
|
python_index_content += """
|
|
729
1069
|
|
|
730
1070
|
def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
731
1071
|
\"\"\"Get an agent specification by ID.\"\"\"
|
|
732
|
-
|
|
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
|
|
733
1079
|
|
|
734
1080
|
|
|
735
1081
|
def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
@@ -771,6 +1117,10 @@ import type { AgentSpec } from '../../types';
|
|
|
771
1117
|
if folder:
|
|
772
1118
|
folder_const = folder.replace("-", "_").upper()
|
|
773
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
|
+
)
|
|
774
1124
|
|
|
775
1125
|
typescript_index_content += """
|
|
776
1126
|
// Merge all agent specs from subfolders
|
|
@@ -781,14 +1131,26 @@ export const AGENT_SPECS: Record<string, AgentSpec> = {
|
|
|
781
1131
|
if folder:
|
|
782
1132
|
folder_const = folder.replace("-", "_").upper()
|
|
783
1133
|
typescript_index_content += f" ...{folder_const}_AGENTS,\n"
|
|
1134
|
+
else:
|
|
1135
|
+
typescript_index_content += " ...ROOT_AGENTS,\n"
|
|
784
1136
|
|
|
785
1137
|
typescript_index_content += """};
|
|
786
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
|
+
|
|
787
1149
|
/**
|
|
788
1150
|
* Get an agent specification by ID.
|
|
789
1151
|
*/
|
|
790
1152
|
export function getAgentSpecs(agentId: string): AgentSpec | undefined {
|
|
791
|
-
return AGENT_SPECS[agentId];
|
|
1153
|
+
return AGENT_SPECS[resolveAgentId(agentId)];
|
|
792
1154
|
}
|
|
793
1155
|
|
|
794
1156
|
/**
|
|
@@ -826,6 +1188,43 @@ export function getAgentSpecRequiredEnvVars(spec: AgentSpec): string[] {
|
|
|
826
1188
|
print(f"✓ Generated {len(specs_by_folder)} subfolder(s)")
|
|
827
1189
|
|
|
828
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
|
+
|
|
829
1228
|
def main():
|
|
830
1229
|
"""Main entry point."""
|
|
831
1230
|
parser = argparse.ArgumentParser(
|
|
@@ -870,6 +1269,7 @@ def main():
|
|
|
870
1269
|
if args.subfolder_structure:
|
|
871
1270
|
# Generate separate files per subfolder
|
|
872
1271
|
generate_subfolder_structure(specs, args)
|
|
1272
|
+
ensure_specs_barrel(args.typescript_output.parent)
|
|
873
1273
|
else:
|
|
874
1274
|
# Generate Python code (single file)
|
|
875
1275
|
print(f"Generating Python code to {args.python_output}...")
|
|
@@ -883,13 +1283,19 @@ def main():
|
|
|
883
1283
|
# Get MCP and skills specs directories (siblings to agents directory)
|
|
884
1284
|
mcp_specs_dir = args.specs_dir.parent / "mcp-servers"
|
|
885
1285
|
skills_specs_dir = args.specs_dir.parent / "skills"
|
|
1286
|
+
tools_specs_dir = args.specs_dir.parent / "tools"
|
|
886
1287
|
typescript_code = generate_typescript_code(
|
|
887
|
-
specs,
|
|
1288
|
+
specs,
|
|
1289
|
+
str(mcp_specs_dir),
|
|
1290
|
+
str(skills_specs_dir),
|
|
1291
|
+
str(tools_specs_dir),
|
|
888
1292
|
)
|
|
889
1293
|
args.typescript_output.parent.mkdir(parents=True, exist_ok=True)
|
|
890
1294
|
with open(args.typescript_output, "w") as f:
|
|
891
1295
|
f.write(typescript_code)
|
|
892
1296
|
|
|
1297
|
+
ensure_specs_barrel(args.typescript_output.parent)
|
|
1298
|
+
|
|
893
1299
|
# Update __init__.py with new agent spec constants
|
|
894
1300
|
init_file_path = args.python_output.parent / "__init__.py"
|
|
895
1301
|
if init_file_path.exists():
|