@datalayer/agent-runtimes 1.0.10 → 1.0.17
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 +82 -1
- package/lib/{AgentLexical.d.ts → AgentDocument.d.ts} +5 -5
- package/lib/{AgentLexical.js → AgentDocument.js} +156 -26
- package/lib/AgentNode.js +32 -31
- package/lib/AgentNotebook.js +172 -17
- package/lib/AppExamples2.css +47 -0
- package/lib/AppExamples2.d.ts +3 -0
- package/lib/AppExamples2.js +21 -0
- package/lib/{agent-lexical-main.js → agent-document-main.js} +2 -2
- package/lib/agents/AgentRuntimeChat.d.ts +73 -0
- package/lib/agents/AgentRuntimeChat.js +198 -0
- package/lib/api/index.d.ts +12 -0
- package/lib/api/index.js +46 -0
- package/lib/api/runtimes/checkpoints.d.ts +122 -0
- package/lib/api/runtimes/checkpoints.js +118 -0
- package/lib/api/runtimes/environments.d.ts +9 -0
- package/lib/api/runtimes/environments.js +29 -0
- package/lib/api/runtimes/healthz.d.ts +15 -0
- package/lib/api/runtimes/healthz.js +44 -0
- package/lib/api/runtimes/index.d.ts +12 -0
- package/lib/api/runtimes/index.js +16 -0
- package/lib/api/runtimes/runtimes.d.ts +138 -0
- package/lib/api/runtimes/runtimes.js +230 -0
- package/lib/api/runtimes/snapshots.d.ts +38 -0
- package/lib/api/runtimes/snapshots.js +82 -0
- package/lib/api/scheduler/index.d.ts +6 -0
- package/lib/api/scheduler/index.js +10 -0
- package/lib/api/scheduler/schedules.d.ts +85 -0
- package/lib/api/scheduler/schedules.js +78 -0
- package/lib/api/spacer/documents.d.ts +12 -0
- package/lib/api/spacer/documents.js +43 -0
- package/lib/api/spacer/healthz.d.ts +15 -0
- package/lib/api/spacer/healthz.js +44 -0
- package/lib/api/spacer/index.d.ts +15 -0
- package/lib/api/spacer/index.js +19 -0
- package/lib/api/spacer/items.d.ts +25 -0
- package/lib/api/spacer/items.js +55 -0
- package/lib/api/spacer/lexicals.d.ts +34 -0
- package/lib/api/spacer/lexicals.js +89 -0
- package/lib/api/spacer/notebooks.d.ts +34 -0
- package/lib/api/spacer/notebooks.js +89 -0
- package/lib/api/spacer/spaces.d.ts +84 -0
- package/lib/api/spacer/spaces.js +170 -0
- package/lib/api/spacer/users.d.ts +9 -0
- package/lib/api/spacer/users.js +29 -0
- package/lib/chat/Chat.d.ts +1 -1
- package/lib/chat/Chat.js +54 -54
- package/lib/chat/ChatFloating.d.ts +2 -2
- package/lib/chat/ChatFloating.js +136 -25
- package/lib/chat/ChatSidebar.js +20 -22
- package/lib/chat/base/ChatBase.js +429 -39
- package/lib/chat/display/EmptyState.js +21 -21
- package/lib/chat/document/EphemeralDocument.d.ts +23 -0
- package/lib/chat/document/EphemeralDocument.js +270 -0
- package/lib/chat/header/ChatHeaderBase.d.ts +12 -2
- package/lib/chat/header/ChatHeaderBase.js +78 -23
- package/lib/chat/index.d.ts +1 -0
- package/lib/chat/index.js +2 -0
- package/lib/chat/notebook/EphemeralNotebook.d.ts +24 -0
- package/lib/chat/notebook/EphemeralNotebook.js +252 -0
- package/lib/chat/prompt/InputFooter.js +4 -1
- package/lib/client/AgentRuntimesClient.d.ts +127 -0
- package/lib/client/AgentRuntimesClient.js +36 -0
- package/lib/client/AgentsMixin.js +28 -28
- package/lib/client/SdkAgentRuntimesClient.d.ts +1 -1
- package/lib/client/SdkAgentRuntimesClient.js +1 -1
- package/lib/client/mixins/RuntimesMixin.d.ts +93 -0
- package/lib/client/mixins/RuntimesMixin.js +229 -0
- package/lib/client/mixins/SpacerMixin.d.ts +210 -0
- package/lib/client/mixins/SpacerMixin.js +615 -0
- package/lib/client/utils/spacerUtils.d.ts +18 -0
- package/lib/client/utils/spacerUtils.js +32 -0
- package/lib/collaboration/DatalayerCollaboration.d.ts +13 -0
- package/lib/collaboration/DatalayerCollaboration.js +28 -0
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +58 -0
- package/lib/collaboration/DatalayerCollaborationProvider.js +148 -0
- package/lib/collaboration/index.d.ts +2 -0
- package/lib/collaboration/index.js +6 -0
- package/lib/components/AgentSummary.d.ts +19 -0
- package/lib/components/AgentSummary.js +89 -0
- package/lib/components/a2ui/A2uiSurfaceComposed.d.ts +13 -0
- package/lib/components/a2ui/A2uiSurfaceComposed.js +110 -0
- package/lib/components/a2ui/index.d.ts +2 -0
- package/lib/components/a2ui/index.js +6 -0
- package/lib/components/a2ui/styles.d.ts +14 -0
- package/lib/components/a2ui/styles.js +142 -0
- package/lib/components/context/SpaceSelect.d.ts +2 -0
- package/lib/components/context/SpaceSelect.js +42 -0
- package/lib/components/flashes/FlashDisclaimer.d.ts +2 -0
- package/lib/components/flashes/FlashDisclaimer.js +17 -0
- package/lib/components/icons/ArtifactIcon.d.ts +10 -0
- package/lib/components/icons/ArtifactIcon.js +58 -0
- package/lib/components/icons/index.d.ts +1 -0
- package/lib/components/icons/index.js +5 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/index.js +5 -0
- package/lib/components/nbgrader/NbGradesDetails.d.ts +5 -0
- package/lib/components/nbgrader/NbGradesDetails.js +19 -0
- package/lib/components/nbgrader/index.d.ts +1 -0
- package/lib/components/nbgrader/index.js +5 -0
- package/lib/components/progress/CreditsIndicator.d.ts +33 -0
- package/lib/components/progress/CreditsIndicator.js +23 -0
- package/lib/components/progress/index.d.ts +2 -0
- package/lib/components/progress/index.js +6 -0
- package/lib/components/runtimes/RuntimeCellVariables.d.ts +39 -0
- package/lib/components/runtimes/RuntimeCellVariables.js +172 -0
- package/lib/components/runtimes/RuntimeCellVariablesDialog.d.ts +37 -0
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +101 -0
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +57 -0
- package/lib/components/runtimes/RuntimeLauncherDialog.js +275 -0
- package/lib/components/runtimes/RuntimePickerBase.d.ts +69 -0
- package/lib/components/runtimes/RuntimePickerBase.js +122 -0
- package/lib/components/runtimes/RuntimePickerCell.d.ts +34 -0
- package/lib/components/runtimes/RuntimePickerCell.js +104 -0
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +42 -0
- package/lib/components/runtimes/RuntimePickerNotebook.js +232 -0
- package/lib/components/runtimes/RuntimeReservationControl.d.ts +47 -0
- package/lib/components/runtimes/RuntimeReservationControl.js +42 -0
- package/lib/components/runtimes/RuntimeSimplePicker.d.ts +38 -0
- package/lib/components/runtimes/RuntimeSimplePicker.js +155 -0
- package/lib/components/runtimes/RuntimeTransfer.d.ts +16 -0
- package/lib/components/runtimes/RuntimeTransfer.js +5 -0
- package/lib/components/runtimes/RuntimeUtils.d.ts +17 -0
- package/lib/components/runtimes/RuntimeUtils.js +178 -0
- package/lib/components/runtimes/RuntimeVariables.d.ts +38 -0
- package/lib/components/runtimes/RuntimeVariables.js +75 -0
- package/lib/components/runtimes/index.d.ts +11 -0
- package/lib/components/runtimes/index.js +15 -0
- package/lib/components/scheduler/ScheduleMenu.d.ts +54 -0
- package/lib/components/scheduler/ScheduleMenu.js +154 -0
- package/lib/components/scheduler/index.d.ts +1 -0
- package/lib/components/scheduler/index.js +5 -0
- package/lib/components/snapshots/SandboxSnapshotMenu.d.ts +33 -0
- package/lib/components/snapshots/SandboxSnapshotMenu.js +169 -0
- package/lib/components/snapshots/index.d.ts +1 -0
- package/lib/components/snapshots/index.js +5 -0
- package/lib/components/snippets/SnippetDialog.d.ts +42 -0
- package/lib/components/snippets/SnippetDialog.js +42 -0
- package/lib/components/students/StudentItemStatus.d.ts +7 -0
- package/lib/components/students/StudentItemStatus.js +68 -0
- package/lib/components/students/index.d.ts +1 -0
- package/lib/components/students/index.js +5 -0
- package/lib/components/tokens/SpaceVariantToken.d.ts +5 -0
- package/lib/components/tokens/SpaceVariantToken.js +23 -0
- package/lib/components/tokens/index.d.ts +1 -0
- package/lib/components/tokens/index.js +5 -0
- package/lib/components/toolbars/AssignmentEditorToolbar.d.ts +4 -0
- package/lib/components/toolbars/AssignmentEditorToolbar.js +18 -0
- package/lib/components/toolbars/DocumentEditorToolbar.d.ts +2 -0
- package/lib/components/toolbars/DocumentEditorToolbar.js +12 -0
- package/lib/components/toolbars/NotebookEditorToolbar.d.ts +29 -0
- package/lib/components/toolbars/NotebookEditorToolbar.js +30 -0
- package/lib/context/ContextInspector.d.ts +1 -14
- package/lib/context/ContextInspector.js +3 -73
- package/lib/context/CostUsageChart.d.ts +4 -3
- package/lib/context/CostUsageChart.js +236 -35
- package/lib/context/MessageHistory.d.ts +30 -0
- package/lib/context/MessageHistory.js +129 -0
- package/lib/context/TokenUsageChart.d.ts +4 -3
- package/lib/context/TokenUsageChart.js +180 -30
- package/lib/context/TurnGraphChart.d.ts +1 -1
- package/lib/context/TurnGraphChart.js +6 -6
- package/lib/examples/A2UiAgentExample.d.ts +22 -0
- package/lib/examples/A2UiAgentExample.js +442 -0
- package/lib/examples/A2UiComponentsGalleryExample.d.ts +3 -0
- package/lib/examples/A2UiComponentsGalleryExample.js +863 -0
- package/lib/examples/A2UiContactCardExample.js +9 -5
- package/lib/examples/A2UiRestaurantExample.js +23 -8
- package/lib/examples/A2UiViewerExample.js +75 -3
- package/lib/examples/AgUiAgenticExample.d.ts +1 -12
- package/lib/examples/AgUiAgenticExample.js +52 -8
- package/lib/examples/AgUiBackendToolRenderingExample.d.ts +1 -16
- package/lib/examples/AgUiBackendToolRenderingExample.js +32 -17
- package/lib/examples/AgUiHaikuGenUiExample.d.ts +1 -17
- package/lib/examples/AgUiHaikuGenUiExample.js +49 -33
- package/lib/examples/AgUiHumanInTheLoopExample.d.ts +1 -12
- package/lib/examples/AgUiHumanInTheLoopExample.js +21 -6
- package/lib/examples/AgUiSharedStateExample.d.ts +1 -14
- package/lib/examples/AgUiSharedStateExample.js +21 -6
- package/lib/examples/AgUiToolsBasedGenUiExample.d.ts +1 -14
- package/lib/examples/AgUiToolsBasedGenUiExample.js +21 -6
- package/lib/examples/AgentCheckpointsExample.d.ts +1 -1
- package/lib/examples/AgentCheckpointsExample.js +9 -10
- package/lib/examples/AgentCodemodeExample.js +3 -3
- package/lib/examples/AgentEvalsExample.js +5 -5
- package/lib/examples/AgentGuardrailsExample.js +17 -12
- package/lib/examples/AgentHooksExample.js +14 -55
- package/lib/examples/AgentInferenceProviderExample.js +4 -4
- package/lib/examples/AgentLoopExample.d.ts +10 -0
- package/lib/examples/AgentLoopExample.js +304 -0
- package/lib/examples/AgentMCPExample.js +7 -7
- package/lib/examples/AgentMemoryExample.js +4 -4
- package/lib/examples/AgentMonitoringExample.js +114 -44
- package/lib/examples/AgentNotificationsExample.js +4 -4
- package/lib/examples/AgentOtelExample.d.ts +3 -3
- package/lib/examples/AgentOtelExample.js +15 -10
- package/lib/examples/AgentOutputsExample.js +6 -6
- package/lib/examples/AgentParametersExample.js +21 -33
- package/lib/examples/AgentSandboxExample.js +5 -5
- package/lib/examples/AgentSkillsExample.js +7 -7
- package/lib/examples/AgentSubagentsExample.js +4 -4
- package/lib/examples/AgentToolApprovalsExample.js +5 -5
- package/lib/examples/AgentTriggersExample.js +9 -9
- package/lib/examples/AgentspecsExample.js +63 -41
- package/lib/examples/ChatCustomExample.js +23 -77
- package/lib/examples/ChatExample.js +13 -44
- package/lib/examples/LexicalAgentExample.js +43 -91
- package/lib/examples/LexicalAgentSidebarExample.js +45 -73
- package/lib/examples/NotebookAgentExample.js +52 -81
- package/lib/examples/NotebookAgentSidebarExample.js +43 -71
- package/lib/examples/NotebookCollaborationExample.js +11 -9
- package/lib/examples/NotebookExample.js +5 -2
- package/lib/examples/components/AuthRequiredView.js +1 -1
- package/lib/examples/components/ExampleErrorBoundary.d.ts +46 -0
- package/lib/examples/components/ExampleErrorBoundary.js +67 -0
- package/lib/examples/components/haiku/haiku-card.css +11 -0
- package/lib/examples/components/weather/weather-card.css +11 -0
- package/lib/examples/example-selector.js +3 -1
- package/lib/examples/hooks/useExampleAgentRuntime.d.ts +35 -0
- package/lib/examples/hooks/useExampleAgentRuntime.js +82 -0
- package/lib/examples/hooks/useSpecRenderToolResult.d.ts +30 -0
- package/lib/examples/hooks/useSpecRenderToolResult.js +61 -0
- package/lib/examples/index.d.ts +3 -1
- package/lib/examples/index.js +3 -1
- package/lib/examples/main.js +340 -93
- package/lib/examples/utils/a2ui.d.ts +2 -0
- package/lib/examples/utils/a2ui.js +97 -2
- package/lib/examples/utils/agentSummaryStore.d.ts +21 -0
- package/lib/examples/utils/agentSummaryStore.js +23 -0
- package/lib/examples/utils/notebooks/Empty.ipynb.json +30 -30
- package/lib/examples/utils/runtimeTargetStore.d.ts +9 -0
- package/lib/examples/utils/runtimeTargetStore.js +27 -0
- package/lib/examples/utils/teardownAgents.d.ts +13 -0
- package/lib/examples/utils/teardownAgents.js +78 -0
- package/lib/examples/utils/useExampleAgentRuntimesUrl.d.ts +2 -0
- package/lib/examples/utils/useExampleAgentRuntimesUrl.js +26 -7
- package/lib/examples2/CellExample.d.ts +6 -0
- package/lib/examples2/CellExample.js +20 -0
- package/lib/examples2/DatalayerNotebookExample.d.ts +16 -0
- package/lib/examples2/DatalayerNotebookExample.js +109 -0
- package/lib/examples2/NativeNavigationExample.d.ts +8 -0
- package/lib/examples2/NativeNavigationExample.js +97 -0
- package/lib/examples2/NotebookExample.d.ts +6 -0
- package/lib/examples2/NotebookExample.js +19 -0
- package/lib/examples2/NotebookMutationsKernel.d.ts +2 -0
- package/lib/examples2/NotebookMutationsKernel.js +105 -0
- package/lib/examples2/NotebookMutationsServiceManager.d.ts +2 -0
- package/lib/examples2/NotebookMutationsServiceManager.js +109 -0
- package/lib/examples2/ReactRouterExample.d.ts +6 -0
- package/lib/examples2/ReactRouterExample.js +175 -0
- package/lib/examples2/example-selector.d.ts +22 -0
- package/lib/examples2/example-selector.js +45 -0
- package/lib/examples2/index.d.ts +2 -0
- package/lib/examples2/index.js +6 -0
- package/lib/examples2/lexical-theme.css +436 -0
- package/lib/examples2/main.d.ts +2 -0
- package/lib/examples2/main.js +330 -0
- package/lib/examples2/notebooks/IPyWidgetsExample.ipynb.json +101 -0
- package/lib/examples2/notebooks/IPyWidgetsExampleWithState.ipynb.json +112 -0
- package/lib/examples2/notebooks/Lite.ipynb.json +128 -0
- package/lib/examples2/notebooks/Matplotlib.ipynb.json +137 -0
- package/lib/examples2/notebooks/NotebookExample1.ipynb.json +126 -0
- package/lib/examples2/notebooks/NotebookExample2.ipynb.json +48 -0
- package/lib/examples2/notebooks/NotebookOutputs.ipynb.json +49 -0
- package/lib/examples2/notebooks/NotebookToCExample.ipynb.json +102 -0
- package/lib/examples2/notebooks/OutputIPyWidgetsExample.d.ts +145 -0
- package/lib/examples2/notebooks/OutputIPyWidgetsExample.js +153 -0
- package/lib/examples2/notebooks/PyGWalker.ipynb.json +55 -0
- package/lib/hooks/index.d.ts +9 -1
- package/lib/hooks/index.js +13 -1
- package/lib/hooks/useAIAgentsWebSocket.d.ts +1 -1
- package/lib/hooks/useAIAgentsWebSocket.js +39 -3
- package/lib/hooks/useAgentRuntimes.d.ts +15 -3
- package/lib/hooks/useAgentRuntimes.js +186 -27
- package/lib/hooks/useAgentsService.js +5 -5
- package/lib/hooks/useCellOutputshot.d.ts +4 -0
- package/lib/hooks/useCellOutputshot.js +25 -0
- package/lib/hooks/useCheckpoints.d.ts +8 -8
- package/lib/hooks/useCheckpoints.js +36 -26
- package/lib/hooks/useConfig.d.ts +1 -1
- package/lib/hooks/useMonitoring.d.ts +7 -5
- package/lib/hooks/useMonitoring.js +16 -10
- package/lib/hooks/useNotifications.d.ts +11 -11
- package/lib/hooks/useNotifications.js +1 -1
- package/lib/hooks/useProgressStore.d.ts +25 -0
- package/lib/hooks/useProgressStore.js +58 -0
- package/lib/hooks/useProgressTask.d.ts +9 -0
- package/lib/hooks/useProgressTask.js +41 -0
- package/lib/hooks/useProjects.d.ts +628 -0
- package/lib/hooks/useProjects.js +190 -0
- package/lib/hooks/useRuntimes.d.ts +5 -0
- package/lib/hooks/useRuntimes.js +34 -0
- package/lib/hooks/useToolApprovals.d.ts +6 -6
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/jupyter/exec/Python.d.ts +5 -0
- package/lib/jupyter/exec/Python.js +100 -0
- package/lib/jupyter/exec/Snippets.d.ts +105 -0
- package/lib/jupyter/exec/Snippets.js +101 -0
- package/lib/jupyter/exec/index.d.ts +2 -0
- package/lib/jupyter/exec/index.js +6 -0
- package/lib/jupyter/index.d.ts +2 -0
- package/lib/jupyter/index.js +6 -0
- package/lib/jupyter/kernelsHandler.d.ts +8 -0
- package/lib/jupyter/kernelsHandler.js +39 -0
- package/lib/mocks/models/CourseMock.d.ts +6 -0
- package/lib/mocks/models/CourseMock.js +29 -0
- package/lib/mocks/models/SpaceMock.d.ts +6 -0
- package/lib/mocks/models/SpaceMock.js +25 -0
- package/lib/models/Assignment.d.ts +7 -0
- package/lib/models/Assignment.js +5 -0
- package/lib/models/Cell.d.ts +8 -0
- package/lib/models/Cell.js +5 -0
- package/lib/models/CodeBlock.d.ts +10 -0
- package/lib/models/CodeBlock.js +5 -0
- package/lib/models/CodeSandboxSnapshot.d.ts +92 -0
- package/lib/models/CodeSandboxSnapshot.js +13 -0
- package/lib/models/CodeSandboxSnapshotDTO.d.ts +173 -0
- package/lib/models/CodeSandboxSnapshotDTO.js +139 -0
- package/lib/models/CodefeedBlocks.d.ts +7 -0
- package/lib/models/CodefeedBlocks.js +5 -0
- package/lib/models/Content.d.ts +5 -0
- package/lib/models/Content.js +5 -0
- package/lib/models/Course.d.ts +17 -0
- package/lib/models/Course.js +5 -0
- package/lib/models/Dataset.d.ts +16 -0
- package/lib/models/Dataset.js +5 -0
- package/lib/models/Document.d.ts +8 -0
- package/lib/models/Document.js +5 -0
- package/lib/models/Environment.d.ts +86 -0
- package/lib/models/Environment.js +5 -0
- package/lib/models/EnvironmentDTO.d.ts +125 -0
- package/lib/models/EnvironmentDTO.js +88 -0
- package/lib/models/Exercise.d.ts +16 -0
- package/lib/models/Exercise.js +5 -0
- package/lib/models/Item.d.ts +20 -0
- package/lib/models/Item.js +5 -0
- package/lib/models/ItemDTO.d.ts +74 -0
- package/lib/models/ItemDTO.js +186 -0
- package/lib/models/ItemType.d.ts +2 -0
- package/lib/models/ItemType.js +5 -0
- package/lib/models/Lesson.d.ts +5 -0
- package/lib/models/Lesson.js +5 -0
- package/lib/models/LexicalDTO.d.ts +155 -0
- package/lib/models/LexicalDTO.js +157 -0
- package/lib/models/Library.d.ts +10 -0
- package/lib/models/Library.js +5 -0
- package/lib/models/Notebook.d.ts +11 -0
- package/lib/models/Notebook.js +5 -0
- package/lib/models/NotebookDTO.d.ts +96 -0
- package/lib/models/NotebookDTO.js +153 -0
- package/lib/models/Page.d.ts +41 -0
- package/lib/models/Page.js +25 -0
- package/lib/models/PageTag.d.ts +19 -0
- package/lib/models/PageTag.js +94 -0
- package/lib/models/ProjectDTO.d.ts +89 -0
- package/lib/models/ProjectDTO.js +131 -0
- package/lib/models/Runtime.d.ts +160 -0
- package/lib/models/Runtime.js +18 -0
- package/lib/models/RuntimeDTO.d.ts +172 -0
- package/lib/models/RuntimeDTO.js +204 -0
- package/lib/models/Space.d.ts +35 -0
- package/lib/models/Space.js +66 -0
- package/lib/models/SpaceDTO.d.ts +334 -0
- package/lib/models/SpaceDTO.js +244 -0
- package/lib/models/SpaceItem.d.ts +10 -0
- package/lib/models/SpaceItem.js +5 -0
- package/lib/models/SpaceMember.d.ts +6 -0
- package/lib/models/SpaceMember.js +5 -0
- package/lib/models/StudentItem.d.ts +21 -0
- package/lib/models/StudentItem.js +5 -0
- package/lib/models/index.d.ts +32 -0
- package/lib/models/index.js +39 -0
- package/lib/protocols/AGUIAdapter.js +1 -1
- package/lib/runtimes/actions.d.ts +102 -0
- package/lib/runtimes/actions.js +249 -0
- package/lib/runtimes/apis.d.ts +273 -0
- package/lib/runtimes/apis.js +5 -0
- package/lib/runtimes/index.d.ts +5 -0
- package/lib/runtimes/index.js +9 -0
- package/lib/runtimes/settings.d.ts +15 -0
- package/lib/runtimes/settings.js +31 -0
- package/lib/runtimes/snapshots.d.ts +25 -0
- package/lib/runtimes/snapshots.js +150 -0
- package/lib/runtimes/utils.d.ts +7 -0
- package/lib/runtimes/utils.js +14 -0
- package/lib/services/DatalayerServiceManager.d.ts +23 -0
- package/lib/services/DatalayerServiceManager.js +90 -0
- package/lib/services/reconnectToRuntime.d.ts +32 -0
- package/lib/services/reconnectToRuntime.js +59 -0
- package/lib/services/sandboxServiceManagers.d.ts +31 -0
- package/lib/services/sandboxServiceManagers.js +57 -0
- package/lib/specs/agents/agents.d.ts +70 -26
- package/lib/specs/agents/agents.js +3994 -1639
- package/lib/specs/index.d.ts +1 -0
- package/lib/specs/index.js +1 -0
- package/lib/specs/loops.d.ts +34 -0
- package/lib/specs/loops.js +188 -0
- package/lib/specs/mcpServers.d.ts +1 -0
- package/lib/specs/mcpServers.js +17 -0
- package/lib/specs/models.d.ts +4 -0
- package/lib/specs/models.js +30 -0
- package/lib/specs/skills.d.ts +1 -0
- package/lib/specs/skills.js +18 -0
- package/lib/specs/tools.d.ts +15 -0
- package/lib/specs/tools.js +285 -0
- package/lib/state/index.d.ts +4 -0
- package/lib/state/index.js +10 -0
- package/lib/state/substates/CellState.d.ts +12 -0
- package/lib/state/substates/CellState.js +22 -0
- package/lib/state/substates/DocumentState.d.ts +10 -0
- package/lib/state/substates/DocumentState.js +14 -0
- package/lib/state/substates/GradeState.d.ts +10 -0
- package/lib/state/substates/GradeState.js +14 -0
- package/lib/state/substates/JupyterLabState.d.ts +16 -0
- package/lib/state/substates/JupyterLabState.js +17 -0
- package/lib/state/substates/NbformatState.d.ts +13 -0
- package/lib/state/substates/NbformatState.js +16 -0
- package/lib/state/substates/RuntimesState.d.ts +87 -0
- package/lib/state/substates/RuntimesState.js +192 -0
- package/lib/state/substates/SpaceState.d.ts +11 -0
- package/lib/state/substates/SpaceState.js +16 -0
- package/lib/state/substates/index.d.ts +8 -0
- package/lib/state/substates/index.js +14 -0
- package/lib/stores/agentRuntimeStore.d.ts +25 -2
- package/lib/stores/agentRuntimeStore.js +114 -19
- package/lib/stories/Button.stories.d.ts +1 -1
- package/lib/stories/Header.stories.d.ts +3 -3
- package/lib/test-setup.js +10 -0
- package/lib/types/agents-lifecycle.d.ts +5 -5
- package/lib/types/agents.d.ts +3 -3
- package/lib/types/agentspecs.d.ts +3 -1
- package/lib/types/chat.d.ts +135 -3
- package/lib/types/config.d.ts +19 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/loops.d.ts +64 -0
- package/lib/types/loops.js +5 -0
- package/lib/types/tools.d.ts +16 -0
- package/lib/utils/Cells.d.ts +2 -0
- package/lib/utils/Cells.js +28 -0
- package/package.json +24 -18
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- package/scripts/codegen/generate_agents.py +21 -4
- package/scripts/codegen/generate_loops.py +443 -0
- package/lib/examples/A2UiComponentGalleryExample.d.ts +0 -3
- package/lib/examples/A2UiComponentGalleryExample.js +0 -361
- /package/lib/{agent-lexical-main.d.ts → agent-document-main.d.ts} +0 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
# Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Generate Python and TypeScript code from YAML loop specifications.
|
|
7
|
+
|
|
8
|
+
A *loop* describes how an agent progresses from one decision to the next: the
|
|
9
|
+
control cycle (observe/think/act/evaluate), the objective it works toward, the
|
|
10
|
+
constraints and success criteria that bound it, where state lives between
|
|
11
|
+
iterations, how the human participates, and when the loop terminates.
|
|
12
|
+
|
|
13
|
+
Usage:
|
|
14
|
+
python generate_loops.py \\
|
|
15
|
+
--specs-dir agentspecs/agentspecs/loops \\
|
|
16
|
+
--python-output agent_runtimes/specs/loops.py \\
|
|
17
|
+
--typescript-output src/specs/loops.ts
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
import argparse
|
|
21
|
+
import sys
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
from typing import Any
|
|
24
|
+
|
|
25
|
+
import yaml
|
|
26
|
+
from versioning import ensure_spec_version, version_suffix
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _make_const_name(loop_id: str) -> str:
|
|
30
|
+
"""Convert a loop ID to a constant name (e.g., 'ooda' -> 'OODA_LOOP')."""
|
|
31
|
+
return f"{loop_id.upper().replace('-', '_')}_LOOP"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _make_enum_name(loop_id: str) -> str:
|
|
35
|
+
"""Convert a loop ID to an enum member name (e.g., 'data-analysis' -> 'DATA_ANALYSIS')."""
|
|
36
|
+
return loop_id.upper().replace("-", "_")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _clean(text: str) -> str:
|
|
40
|
+
"""Collapse whitespace in a multi-line YAML string."""
|
|
41
|
+
return " ".join(str(text or "").split()).strip()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _py_str(text: str) -> str:
|
|
45
|
+
"""Format a Python double-quoted string literal."""
|
|
46
|
+
return '"' + _clean(text).replace("\\", "\\\\").replace('"', '\\"') + '"'
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _py_list(items: list) -> str:
|
|
50
|
+
"""Format a Python list of strings."""
|
|
51
|
+
if not items:
|
|
52
|
+
return "[]"
|
|
53
|
+
return "[" + ", ".join(_py_str(item) for item in items) + "]"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _ts_str(text: str) -> str:
|
|
57
|
+
"""Format a TypeScript single-quoted string literal."""
|
|
58
|
+
return "'" + _clean(text).replace("\\", "\\\\").replace("'", "\\'") + "'"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _ts_list(items: list) -> str:
|
|
62
|
+
"""Format a TypeScript list of strings."""
|
|
63
|
+
if not items:
|
|
64
|
+
return "[]"
|
|
65
|
+
return "[" + ", ".join(_ts_str(item) for item in items) + "]"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def load_loop_specs(specs_dir: Path) -> list[dict[str, Any]]:
|
|
69
|
+
"""Load all loop YAML specifications from a directory."""
|
|
70
|
+
specs = []
|
|
71
|
+
for yaml_file in sorted(specs_dir.glob("*.yaml")):
|
|
72
|
+
with open(yaml_file) as f:
|
|
73
|
+
spec = yaml.safe_load(f)
|
|
74
|
+
ensure_spec_version(spec)
|
|
75
|
+
specs.append(spec)
|
|
76
|
+
return specs
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def generate_python_code(specs: list[dict[str, Any]]) -> str:
|
|
80
|
+
"""Generate Python code from loop specifications."""
|
|
81
|
+
lines = [
|
|
82
|
+
"# Copyright (c) 2025-2026 Datalayer, Inc.",
|
|
83
|
+
"# Distributed under the terms of the Modified BSD License.",
|
|
84
|
+
'"""',
|
|
85
|
+
"Loop Catalog.",
|
|
86
|
+
"",
|
|
87
|
+
"Predefined agent execution-loop specifications that can be used by agents.",
|
|
88
|
+
"",
|
|
89
|
+
"This file is AUTO-GENERATED from YAML specifications.",
|
|
90
|
+
"DO NOT EDIT MANUALLY - run 'make specs' to regenerate.",
|
|
91
|
+
'"""',
|
|
92
|
+
"",
|
|
93
|
+
"from enum import Enum",
|
|
94
|
+
"from typing import Optional",
|
|
95
|
+
"",
|
|
96
|
+
"from agent_runtimes.types import LoopHuman, LoopSpec, LoopTermination",
|
|
97
|
+
"",
|
|
98
|
+
"",
|
|
99
|
+
"# " + "=" * 76,
|
|
100
|
+
"# Loops Enum",
|
|
101
|
+
"# " + "=" * 76,
|
|
102
|
+
"",
|
|
103
|
+
"",
|
|
104
|
+
"class Loops(str, Enum):",
|
|
105
|
+
' """Enumeration of available agent execution loops."""',
|
|
106
|
+
"",
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
for spec in specs:
|
|
110
|
+
lines.append(f' {_make_enum_name(spec["id"])} = "{spec["id"]}"')
|
|
111
|
+
|
|
112
|
+
lines.extend(
|
|
113
|
+
[
|
|
114
|
+
"",
|
|
115
|
+
"",
|
|
116
|
+
"# " + "=" * 76,
|
|
117
|
+
"# Loop Definitions",
|
|
118
|
+
"# " + "=" * 76,
|
|
119
|
+
"",
|
|
120
|
+
]
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
for spec in specs:
|
|
124
|
+
version = spec["version"]
|
|
125
|
+
const_name = _make_const_name(spec["id"]) + version_suffix(version)
|
|
126
|
+
|
|
127
|
+
lines.append(f"{const_name} = LoopSpec(")
|
|
128
|
+
lines.append(f' id="{spec["id"]}",')
|
|
129
|
+
lines.append(f' version="{version}",')
|
|
130
|
+
lines.append(f' name="{spec["name"]}",')
|
|
131
|
+
lines.append(f" description={_py_str(spec.get('description', ''))},")
|
|
132
|
+
lines.append(f" objective={_py_str(spec.get('objective', ''))},")
|
|
133
|
+
lines.append(
|
|
134
|
+
f" strategy={_py_str(spec.get('strategy', 'observe-think-act-evaluate'))},"
|
|
135
|
+
)
|
|
136
|
+
lines.append(f" phases={_py_list(spec.get('phases', []))},")
|
|
137
|
+
lines.append(f" constraints={_py_list(spec.get('constraints', []))},")
|
|
138
|
+
|
|
139
|
+
term = spec.get("termination")
|
|
140
|
+
if term:
|
|
141
|
+
lines.append(" termination=LoopTermination(")
|
|
142
|
+
lines.append(
|
|
143
|
+
f" max_iterations={int(term.get('max_iterations', 10))},"
|
|
144
|
+
)
|
|
145
|
+
lines.append(
|
|
146
|
+
f" success_criteria={_py_list(term.get('success_criteria', []))},"
|
|
147
|
+
)
|
|
148
|
+
lines.append(
|
|
149
|
+
f" failure_criteria={_py_list(term.get('failure_criteria', []))},"
|
|
150
|
+
)
|
|
151
|
+
lines.append(
|
|
152
|
+
f" on_blocked={_py_str(term.get('on_blocked', 'ask-human'))},"
|
|
153
|
+
)
|
|
154
|
+
lines.append(" ),")
|
|
155
|
+
|
|
156
|
+
human = spec.get("human")
|
|
157
|
+
if human:
|
|
158
|
+
lines.append(" human=LoopHuman(")
|
|
159
|
+
lines.append(f" mode={_py_str(human.get('mode', 'initiate'))},")
|
|
160
|
+
lines.append(
|
|
161
|
+
f" approval_required={bool(human.get('approval_required', False))},"
|
|
162
|
+
)
|
|
163
|
+
lines.append(
|
|
164
|
+
f" approval_for={_py_list(human.get('approval_for', []))},"
|
|
165
|
+
)
|
|
166
|
+
lines.append(
|
|
167
|
+
f" description={_py_str(human.get('description', ''))},"
|
|
168
|
+
)
|
|
169
|
+
lines.append(" ),")
|
|
170
|
+
|
|
171
|
+
lines.append(f" state_backends={_py_list(spec.get('state_backends', []))},")
|
|
172
|
+
lines.append(f" tags={_py_list(spec.get('tags', []))},")
|
|
173
|
+
lines.append(f" icon={_py_str(spec.get('icon', 'sync'))},")
|
|
174
|
+
lines.append(f" emoji={_py_str(spec.get('emoji', '🔄'))},")
|
|
175
|
+
lines.append(")")
|
|
176
|
+
lines.append("")
|
|
177
|
+
|
|
178
|
+
lines.extend(
|
|
179
|
+
[
|
|
180
|
+
"",
|
|
181
|
+
"# " + "=" * 76,
|
|
182
|
+
"# Loop Catalog",
|
|
183
|
+
"# " + "=" * 76,
|
|
184
|
+
"",
|
|
185
|
+
"LOOP_CATALOGUE: dict[str, LoopSpec] = {",
|
|
186
|
+
]
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
for spec in specs:
|
|
190
|
+
const_name = _make_const_name(spec["id"]) + version_suffix(spec["version"])
|
|
191
|
+
lines.append(f' "{spec["id"]}": {const_name},')
|
|
192
|
+
|
|
193
|
+
lines.extend(
|
|
194
|
+
[
|
|
195
|
+
"}",
|
|
196
|
+
"",
|
|
197
|
+
"",
|
|
198
|
+
'DEFAULT_LOOP: str = "data-analysis"',
|
|
199
|
+
"",
|
|
200
|
+
"",
|
|
201
|
+
"def get_loop(loop_id: str) -> Optional[LoopSpec]:",
|
|
202
|
+
' """',
|
|
203
|
+
" Get a loop specification by ID (accepts both bare and versioned refs).",
|
|
204
|
+
"",
|
|
205
|
+
" Args:",
|
|
206
|
+
" loop_id: The unique identifier of the loop.",
|
|
207
|
+
"",
|
|
208
|
+
" Returns:",
|
|
209
|
+
" The LoopSpec, or None if not found.",
|
|
210
|
+
' """',
|
|
211
|
+
" loop = LOOP_CATALOGUE.get(loop_id)",
|
|
212
|
+
" if loop is not None:",
|
|
213
|
+
" return loop",
|
|
214
|
+
" base, _, ver = loop_id.rpartition(':')",
|
|
215
|
+
" if base and '.' in ver:",
|
|
216
|
+
" return LOOP_CATALOGUE.get(base)",
|
|
217
|
+
" return None",
|
|
218
|
+
"",
|
|
219
|
+
"",
|
|
220
|
+
"def get_default_loop() -> Optional[LoopSpec]:",
|
|
221
|
+
' """',
|
|
222
|
+
" Get the default loop.",
|
|
223
|
+
"",
|
|
224
|
+
" Returns:",
|
|
225
|
+
" The default LoopSpec, or None if no default is set.",
|
|
226
|
+
' """',
|
|
227
|
+
" return LOOP_CATALOGUE.get(DEFAULT_LOOP)",
|
|
228
|
+
"",
|
|
229
|
+
"",
|
|
230
|
+
"def list_loops() -> list[LoopSpec]:",
|
|
231
|
+
' """',
|
|
232
|
+
" List all available loops.",
|
|
233
|
+
"",
|
|
234
|
+
" Returns:",
|
|
235
|
+
" List of all LoopSpec specifications.",
|
|
236
|
+
' """',
|
|
237
|
+
" return list(LOOP_CATALOGUE.values())",
|
|
238
|
+
"",
|
|
239
|
+
]
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
return "\n".join(lines)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
|
|
246
|
+
"""Generate TypeScript code from loop specifications."""
|
|
247
|
+
lines = [
|
|
248
|
+
"/*",
|
|
249
|
+
" * Copyright (c) 2025-2026 Datalayer, Inc.",
|
|
250
|
+
" * Distributed under the terms of the Modified BSD License.",
|
|
251
|
+
" */",
|
|
252
|
+
"",
|
|
253
|
+
"/**",
|
|
254
|
+
" * Loop Catalog",
|
|
255
|
+
" *",
|
|
256
|
+
" * Predefined agent execution-loop specifications.",
|
|
257
|
+
" *",
|
|
258
|
+
" * This file is AUTO-GENERATED from YAML specifications.",
|
|
259
|
+
" * DO NOT EDIT MANUALLY - run 'make specs' to regenerate.",
|
|
260
|
+
" */",
|
|
261
|
+
"",
|
|
262
|
+
"import type { LoopSpec } from '../types';",
|
|
263
|
+
"",
|
|
264
|
+
"// " + "=" * 76,
|
|
265
|
+
"// Loops Enum",
|
|
266
|
+
"// " + "=" * 76,
|
|
267
|
+
"",
|
|
268
|
+
"export const Loops = {",
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
for spec in specs:
|
|
272
|
+
lines.append(f" {_make_enum_name(spec['id'])}: '{spec['id']}',")
|
|
273
|
+
|
|
274
|
+
lines.extend(
|
|
275
|
+
[
|
|
276
|
+
"} as const;",
|
|
277
|
+
"",
|
|
278
|
+
"export type LoopId = (typeof Loops)[keyof typeof Loops];",
|
|
279
|
+
"",
|
|
280
|
+
"// " + "=" * 76,
|
|
281
|
+
"// Loop Definitions",
|
|
282
|
+
"// " + "=" * 76,
|
|
283
|
+
"",
|
|
284
|
+
]
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
for spec in specs:
|
|
288
|
+
version = spec["version"]
|
|
289
|
+
const_name = _make_const_name(spec["id"]) + version_suffix(version)
|
|
290
|
+
|
|
291
|
+
lines.append(f"export const {const_name}: LoopSpec = {{")
|
|
292
|
+
lines.append(f" id: '{spec['id']}',")
|
|
293
|
+
lines.append(f" version: '{version}',")
|
|
294
|
+
lines.append(f" name: {_ts_str(spec['name'])},")
|
|
295
|
+
lines.append(f" description: {_ts_str(spec.get('description', ''))},")
|
|
296
|
+
lines.append(f" objective: {_ts_str(spec.get('objective', ''))},")
|
|
297
|
+
lines.append(
|
|
298
|
+
f" strategy: {_ts_str(spec.get('strategy', 'observe-think-act-evaluate'))},"
|
|
299
|
+
)
|
|
300
|
+
lines.append(f" phases: {_ts_list(spec.get('phases', []))},")
|
|
301
|
+
lines.append(f" constraints: {_ts_list(spec.get('constraints', []))},")
|
|
302
|
+
|
|
303
|
+
term = spec.get("termination")
|
|
304
|
+
if term:
|
|
305
|
+
lines.append(" termination: {")
|
|
306
|
+
lines.append(f" maxIterations: {int(term.get('max_iterations', 10))},")
|
|
307
|
+
lines.append(
|
|
308
|
+
f" successCriteria: {_ts_list(term.get('success_criteria', []))},"
|
|
309
|
+
)
|
|
310
|
+
lines.append(
|
|
311
|
+
f" failureCriteria: {_ts_list(term.get('failure_criteria', []))},"
|
|
312
|
+
)
|
|
313
|
+
lines.append(
|
|
314
|
+
f" onBlocked: {_ts_str(term.get('on_blocked', 'ask-human'))},"
|
|
315
|
+
)
|
|
316
|
+
lines.append(" },")
|
|
317
|
+
|
|
318
|
+
human = spec.get("human")
|
|
319
|
+
if human:
|
|
320
|
+
lines.append(" human: {")
|
|
321
|
+
lines.append(f" mode: {_ts_str(human.get('mode', 'initiate'))},")
|
|
322
|
+
lines.append(
|
|
323
|
+
f" approvalRequired: {str(bool(human.get('approval_required', False))).lower()},"
|
|
324
|
+
)
|
|
325
|
+
lines.append(f" approvalFor: {_ts_list(human.get('approval_for', []))},")
|
|
326
|
+
lines.append(f" description: {_ts_str(human.get('description', ''))},")
|
|
327
|
+
lines.append(" },")
|
|
328
|
+
|
|
329
|
+
lines.append(f" stateBackends: {_ts_list(spec.get('state_backends', []))},")
|
|
330
|
+
lines.append(f" tags: {_ts_list(spec.get('tags', []))},")
|
|
331
|
+
lines.append(f" icon: {_ts_str(spec.get('icon', 'sync'))},")
|
|
332
|
+
lines.append(f" emoji: {_ts_str(spec.get('emoji', '🔄'))},")
|
|
333
|
+
lines.append("};")
|
|
334
|
+
lines.append("")
|
|
335
|
+
|
|
336
|
+
lines.extend(
|
|
337
|
+
[
|
|
338
|
+
"// " + "=" * 76,
|
|
339
|
+
"// Loop Catalog",
|
|
340
|
+
"// " + "=" * 76,
|
|
341
|
+
"",
|
|
342
|
+
"export const LOOP_CATALOGUE: Record<string, LoopSpec> = {",
|
|
343
|
+
]
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
for spec in specs:
|
|
347
|
+
const_name = _make_const_name(spec["id"]) + version_suffix(spec["version"])
|
|
348
|
+
lines.append(f" '{spec['id']}': {const_name},")
|
|
349
|
+
|
|
350
|
+
lines.extend(
|
|
351
|
+
[
|
|
352
|
+
"};",
|
|
353
|
+
"",
|
|
354
|
+
"export const DEFAULT_LOOP: LoopId = Loops.DATA_ANALYSIS;",
|
|
355
|
+
"",
|
|
356
|
+
"function resolveLoopId(loopId: string): string {",
|
|
357
|
+
" if (loopId in LOOP_CATALOGUE) return loopId;",
|
|
358
|
+
" const idx = loopId.lastIndexOf(':');",
|
|
359
|
+
" if (idx > 0) {",
|
|
360
|
+
" const base = loopId.slice(0, idx);",
|
|
361
|
+
" if (base in LOOP_CATALOGUE) return base;",
|
|
362
|
+
" }",
|
|
363
|
+
" return loopId;",
|
|
364
|
+
"}",
|
|
365
|
+
"",
|
|
366
|
+
"/**",
|
|
367
|
+
" * Get a loop specification by ID.",
|
|
368
|
+
" */",
|
|
369
|
+
"export function getLoop(loopId: string): LoopSpec | undefined {",
|
|
370
|
+
" return LOOP_CATALOGUE[resolveLoopId(loopId)];",
|
|
371
|
+
"}",
|
|
372
|
+
"",
|
|
373
|
+
"/**",
|
|
374
|
+
" * Get the default loop.",
|
|
375
|
+
" */",
|
|
376
|
+
"export function getDefaultLoop(): LoopSpec | undefined {",
|
|
377
|
+
" return LOOP_CATALOGUE[DEFAULT_LOOP];",
|
|
378
|
+
"}",
|
|
379
|
+
"",
|
|
380
|
+
"/**",
|
|
381
|
+
" * List all available loops.",
|
|
382
|
+
" */",
|
|
383
|
+
"export function listLoops(): LoopSpec[] {",
|
|
384
|
+
" return Object.values(LOOP_CATALOGUE);",
|
|
385
|
+
"}",
|
|
386
|
+
"",
|
|
387
|
+
]
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
return "\n".join(lines)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def main():
|
|
394
|
+
"""Main entry point."""
|
|
395
|
+
parser = argparse.ArgumentParser(
|
|
396
|
+
description="Generate Python and TypeScript code from YAML loop specifications"
|
|
397
|
+
)
|
|
398
|
+
parser.add_argument(
|
|
399
|
+
"--specs-dir",
|
|
400
|
+
type=Path,
|
|
401
|
+
required=True,
|
|
402
|
+
help="Directory containing YAML loop specification files",
|
|
403
|
+
)
|
|
404
|
+
parser.add_argument(
|
|
405
|
+
"--python-output",
|
|
406
|
+
type=Path,
|
|
407
|
+
required=True,
|
|
408
|
+
help="Output path for generated Python file",
|
|
409
|
+
)
|
|
410
|
+
parser.add_argument(
|
|
411
|
+
"--typescript-output",
|
|
412
|
+
type=Path,
|
|
413
|
+
required=True,
|
|
414
|
+
help="Output path for generated TypeScript file",
|
|
415
|
+
)
|
|
416
|
+
|
|
417
|
+
args = parser.parse_args()
|
|
418
|
+
|
|
419
|
+
if not args.specs_dir.exists():
|
|
420
|
+
print(f"Error: Specs directory does not exist: {args.specs_dir}")
|
|
421
|
+
sys.exit(1)
|
|
422
|
+
|
|
423
|
+
print(f"Loading loop specs from {args.specs_dir}...")
|
|
424
|
+
specs = load_loop_specs(args.specs_dir)
|
|
425
|
+
print(f"Loaded {len(specs)} loop specifications")
|
|
426
|
+
|
|
427
|
+
print("Generating Python code...")
|
|
428
|
+
python_code = generate_python_code(specs)
|
|
429
|
+
args.python_output.parent.mkdir(parents=True, exist_ok=True)
|
|
430
|
+
args.python_output.write_text(python_code)
|
|
431
|
+
print(f"✓ Generated {args.python_output}")
|
|
432
|
+
|
|
433
|
+
print("Generating TypeScript code...")
|
|
434
|
+
typescript_code = generate_typescript_code(specs)
|
|
435
|
+
args.typescript_output.parent.mkdir(parents=True, exist_ok=True)
|
|
436
|
+
args.typescript_output.write_text(typescript_code)
|
|
437
|
+
print(f"✓ Generated {args.typescript_output}")
|
|
438
|
+
|
|
439
|
+
print(f"\n✓ Successfully generated code from {len(specs)} loop specs")
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
if __name__ == "__main__":
|
|
443
|
+
main()
|