@datalayer/agent-runtimes 1.0.10 → 1.0.18

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.
Files changed (452) hide show
  1. package/README.md +82 -1
  2. package/lib/{AgentLexical.d.ts → AgentDocument.d.ts} +5 -5
  3. package/lib/{AgentLexical.js → AgentDocument.js} +156 -26
  4. package/lib/AgentNode.js +32 -31
  5. package/lib/AgentNotebook.js +172 -17
  6. package/lib/AppExamples2.css +47 -0
  7. package/lib/AppExamples2.d.ts +3 -0
  8. package/lib/AppExamples2.js +21 -0
  9. package/lib/{agent-lexical-main.js → agent-document-main.js} +2 -2
  10. package/lib/agents/AgentRuntimeChat.d.ts +73 -0
  11. package/lib/agents/AgentRuntimeChat.js +198 -0
  12. package/lib/api/index.d.ts +12 -0
  13. package/lib/api/index.js +46 -0
  14. package/lib/api/runtimes/checkpoints.d.ts +122 -0
  15. package/lib/api/runtimes/checkpoints.js +118 -0
  16. package/lib/api/runtimes/environments.d.ts +9 -0
  17. package/lib/api/runtimes/environments.js +29 -0
  18. package/lib/api/runtimes/healthz.d.ts +15 -0
  19. package/lib/api/runtimes/healthz.js +44 -0
  20. package/lib/api/runtimes/index.d.ts +12 -0
  21. package/lib/api/runtimes/index.js +16 -0
  22. package/lib/api/runtimes/runtimes.d.ts +138 -0
  23. package/lib/api/runtimes/runtimes.js +230 -0
  24. package/lib/api/runtimes/snapshots.d.ts +38 -0
  25. package/lib/api/runtimes/snapshots.js +82 -0
  26. package/lib/api/scheduler/index.d.ts +6 -0
  27. package/lib/api/scheduler/index.js +10 -0
  28. package/lib/api/scheduler/schedules.d.ts +85 -0
  29. package/lib/api/scheduler/schedules.js +78 -0
  30. package/lib/api/spacer/documents.d.ts +12 -0
  31. package/lib/api/spacer/documents.js +43 -0
  32. package/lib/api/spacer/healthz.d.ts +15 -0
  33. package/lib/api/spacer/healthz.js +44 -0
  34. package/lib/api/spacer/index.d.ts +15 -0
  35. package/lib/api/spacer/index.js +19 -0
  36. package/lib/api/spacer/items.d.ts +25 -0
  37. package/lib/api/spacer/items.js +55 -0
  38. package/lib/api/spacer/lexicals.d.ts +34 -0
  39. package/lib/api/spacer/lexicals.js +89 -0
  40. package/lib/api/spacer/notebooks.d.ts +34 -0
  41. package/lib/api/spacer/notebooks.js +89 -0
  42. package/lib/api/spacer/spaces.d.ts +84 -0
  43. package/lib/api/spacer/spaces.js +170 -0
  44. package/lib/api/spacer/users.d.ts +9 -0
  45. package/lib/api/spacer/users.js +29 -0
  46. package/lib/chat/Chat.d.ts +1 -1
  47. package/lib/chat/Chat.js +54 -54
  48. package/lib/chat/ChatFloating.d.ts +2 -2
  49. package/lib/chat/ChatFloating.js +136 -25
  50. package/lib/chat/ChatSidebar.js +20 -22
  51. package/lib/chat/base/ChatBase.js +429 -39
  52. package/lib/chat/display/EmptyState.js +21 -21
  53. package/lib/chat/document/EphemeralDocument.d.ts +23 -0
  54. package/lib/chat/document/EphemeralDocument.js +270 -0
  55. package/lib/chat/header/ChatHeaderBase.d.ts +12 -2
  56. package/lib/chat/header/ChatHeaderBase.js +78 -23
  57. package/lib/chat/index.d.ts +1 -0
  58. package/lib/chat/index.js +2 -0
  59. package/lib/chat/notebook/EphemeralNotebook.d.ts +24 -0
  60. package/lib/chat/notebook/EphemeralNotebook.js +252 -0
  61. package/lib/chat/prompt/InputFooter.js +4 -1
  62. package/lib/client/AgentRuntimesClient.d.ts +127 -0
  63. package/lib/client/AgentRuntimesClient.js +36 -0
  64. package/lib/client/AgentsMixin.js +28 -28
  65. package/lib/client/SdkAgentRuntimesClient.d.ts +1 -1
  66. package/lib/client/SdkAgentRuntimesClient.js +1 -1
  67. package/lib/client/mixins/RuntimesMixin.d.ts +93 -0
  68. package/lib/client/mixins/RuntimesMixin.js +229 -0
  69. package/lib/client/mixins/SpacerMixin.d.ts +210 -0
  70. package/lib/client/mixins/SpacerMixin.js +615 -0
  71. package/lib/client/utils/spacerUtils.d.ts +18 -0
  72. package/lib/client/utils/spacerUtils.js +32 -0
  73. package/lib/collaboration/DatalayerCollaboration.d.ts +13 -0
  74. package/lib/collaboration/DatalayerCollaboration.js +28 -0
  75. package/lib/collaboration/DatalayerCollaborationProvider.d.ts +58 -0
  76. package/lib/collaboration/DatalayerCollaborationProvider.js +148 -0
  77. package/lib/collaboration/index.d.ts +2 -0
  78. package/lib/collaboration/index.js +6 -0
  79. package/lib/components/AgentSummary.d.ts +19 -0
  80. package/lib/components/AgentSummary.js +89 -0
  81. package/lib/components/a2ui/A2uiSurfaceComposed.d.ts +13 -0
  82. package/lib/components/a2ui/A2uiSurfaceComposed.js +110 -0
  83. package/lib/components/a2ui/index.d.ts +2 -0
  84. package/lib/components/a2ui/index.js +6 -0
  85. package/lib/components/a2ui/styles.d.ts +14 -0
  86. package/lib/components/a2ui/styles.js +142 -0
  87. package/lib/components/context/SpaceSelect.d.ts +2 -0
  88. package/lib/components/context/SpaceSelect.js +42 -0
  89. package/lib/components/flashes/FlashDisclaimer.d.ts +2 -0
  90. package/lib/components/flashes/FlashDisclaimer.js +17 -0
  91. package/lib/components/icons/ArtifactIcon.d.ts +10 -0
  92. package/lib/components/icons/ArtifactIcon.js +58 -0
  93. package/lib/components/icons/index.d.ts +1 -0
  94. package/lib/components/icons/index.js +5 -0
  95. package/lib/components/index.d.ts +5 -0
  96. package/lib/components/index.js +5 -0
  97. package/lib/components/nbgrader/NbGradesDetails.d.ts +5 -0
  98. package/lib/components/nbgrader/NbGradesDetails.js +19 -0
  99. package/lib/components/nbgrader/index.d.ts +1 -0
  100. package/lib/components/nbgrader/index.js +5 -0
  101. package/lib/components/progress/CreditsIndicator.d.ts +33 -0
  102. package/lib/components/progress/CreditsIndicator.js +23 -0
  103. package/lib/components/progress/index.d.ts +2 -0
  104. package/lib/components/progress/index.js +6 -0
  105. package/lib/components/runtimes/RuntimeCellVariables.d.ts +39 -0
  106. package/lib/components/runtimes/RuntimeCellVariables.js +172 -0
  107. package/lib/components/runtimes/RuntimeCellVariablesDialog.d.ts +37 -0
  108. package/lib/components/runtimes/RuntimeCellVariablesDialog.js +101 -0
  109. package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +57 -0
  110. package/lib/components/runtimes/RuntimeLauncherDialog.js +275 -0
  111. package/lib/components/runtimes/RuntimePickerBase.d.ts +69 -0
  112. package/lib/components/runtimes/RuntimePickerBase.js +122 -0
  113. package/lib/components/runtimes/RuntimePickerCell.d.ts +34 -0
  114. package/lib/components/runtimes/RuntimePickerCell.js +104 -0
  115. package/lib/components/runtimes/RuntimePickerNotebook.d.ts +42 -0
  116. package/lib/components/runtimes/RuntimePickerNotebook.js +232 -0
  117. package/lib/components/runtimes/RuntimeReservationControl.d.ts +47 -0
  118. package/lib/components/runtimes/RuntimeReservationControl.js +42 -0
  119. package/lib/components/runtimes/RuntimeSimplePicker.d.ts +38 -0
  120. package/lib/components/runtimes/RuntimeSimplePicker.js +155 -0
  121. package/lib/components/runtimes/RuntimeTransfer.d.ts +16 -0
  122. package/lib/components/runtimes/RuntimeTransfer.js +5 -0
  123. package/lib/components/runtimes/RuntimeUtils.d.ts +17 -0
  124. package/lib/components/runtimes/RuntimeUtils.js +178 -0
  125. package/lib/components/runtimes/RuntimeVariables.d.ts +38 -0
  126. package/lib/components/runtimes/RuntimeVariables.js +75 -0
  127. package/lib/components/runtimes/index.d.ts +11 -0
  128. package/lib/components/runtimes/index.js +15 -0
  129. package/lib/components/scheduler/ScheduleMenu.d.ts +54 -0
  130. package/lib/components/scheduler/ScheduleMenu.js +154 -0
  131. package/lib/components/scheduler/index.d.ts +1 -0
  132. package/lib/components/scheduler/index.js +5 -0
  133. package/lib/components/snapshots/SandboxSnapshotMenu.d.ts +33 -0
  134. package/lib/components/snapshots/SandboxSnapshotMenu.js +169 -0
  135. package/lib/components/snapshots/index.d.ts +1 -0
  136. package/lib/components/snapshots/index.js +5 -0
  137. package/lib/components/snippets/SnippetDialog.d.ts +42 -0
  138. package/lib/components/snippets/SnippetDialog.js +42 -0
  139. package/lib/components/students/StudentItemStatus.d.ts +7 -0
  140. package/lib/components/students/StudentItemStatus.js +68 -0
  141. package/lib/components/students/index.d.ts +1 -0
  142. package/lib/components/students/index.js +5 -0
  143. package/lib/components/tokens/SpaceVariantToken.d.ts +5 -0
  144. package/lib/components/tokens/SpaceVariantToken.js +23 -0
  145. package/lib/components/tokens/index.d.ts +1 -0
  146. package/lib/components/tokens/index.js +5 -0
  147. package/lib/components/toolbars/AssignmentEditorToolbar.d.ts +4 -0
  148. package/lib/components/toolbars/AssignmentEditorToolbar.js +18 -0
  149. package/lib/components/toolbars/DocumentEditorToolbar.d.ts +2 -0
  150. package/lib/components/toolbars/DocumentEditorToolbar.js +12 -0
  151. package/lib/components/toolbars/NotebookEditorToolbar.d.ts +29 -0
  152. package/lib/components/toolbars/NotebookEditorToolbar.js +30 -0
  153. package/lib/context/ContextInspector.d.ts +1 -14
  154. package/lib/context/ContextInspector.js +3 -73
  155. package/lib/context/CostUsageChart.d.ts +4 -3
  156. package/lib/context/CostUsageChart.js +236 -35
  157. package/lib/context/MessageHistory.d.ts +30 -0
  158. package/lib/context/MessageHistory.js +129 -0
  159. package/lib/context/TokenUsageChart.d.ts +4 -3
  160. package/lib/context/TokenUsageChart.js +180 -30
  161. package/lib/context/TurnGraphChart.d.ts +1 -1
  162. package/lib/context/TurnGraphChart.js +6 -6
  163. package/lib/examples/A2UiAgentExample.d.ts +22 -0
  164. package/lib/examples/A2UiAgentExample.js +442 -0
  165. package/lib/examples/A2UiComponentsGalleryExample.d.ts +3 -0
  166. package/lib/examples/A2UiComponentsGalleryExample.js +863 -0
  167. package/lib/examples/A2UiContactCardExample.js +9 -5
  168. package/lib/examples/A2UiRestaurantExample.js +23 -8
  169. package/lib/examples/A2UiViewerExample.js +75 -3
  170. package/lib/examples/AgUiAgenticExample.d.ts +1 -12
  171. package/lib/examples/AgUiAgenticExample.js +52 -8
  172. package/lib/examples/AgUiBackendToolRenderingExample.d.ts +1 -16
  173. package/lib/examples/AgUiBackendToolRenderingExample.js +32 -17
  174. package/lib/examples/AgUiHaikuGenUiExample.d.ts +1 -17
  175. package/lib/examples/AgUiHaikuGenUiExample.js +49 -33
  176. package/lib/examples/AgUiHumanInTheLoopExample.d.ts +1 -12
  177. package/lib/examples/AgUiHumanInTheLoopExample.js +21 -6
  178. package/lib/examples/AgUiSharedStateExample.d.ts +1 -14
  179. package/lib/examples/AgUiSharedStateExample.js +21 -6
  180. package/lib/examples/AgUiToolsBasedGenUiExample.d.ts +1 -14
  181. package/lib/examples/AgUiToolsBasedGenUiExample.js +21 -6
  182. package/lib/examples/AgentCheckpointsExample.d.ts +1 -1
  183. package/lib/examples/AgentCheckpointsExample.js +9 -10
  184. package/lib/examples/AgentCodeSandboxesExample.d.ts +3 -0
  185. package/lib/examples/AgentCodeSandboxesExample.js +192 -0
  186. package/lib/examples/AgentCodemodeExample.js +3 -3
  187. package/lib/examples/AgentEvalsExample.js +5 -5
  188. package/lib/examples/AgentGuardrailsExample.js +17 -12
  189. package/lib/examples/AgentHooksExample.js +14 -55
  190. package/lib/examples/AgentInferenceProviderExample.js +4 -4
  191. package/lib/examples/AgentLoopExample.d.ts +10 -0
  192. package/lib/examples/AgentLoopExample.js +304 -0
  193. package/lib/examples/AgentMCPExample.js +7 -7
  194. package/lib/examples/AgentMemoryExample.js +4 -4
  195. package/lib/examples/AgentMonitoringExample.js +114 -44
  196. package/lib/examples/AgentNotificationsExample.js +4 -4
  197. package/lib/examples/AgentOtelExample.d.ts +3 -3
  198. package/lib/examples/AgentOtelExample.js +15 -10
  199. package/lib/examples/AgentOutputsExample.js +6 -6
  200. package/lib/examples/AgentParametersExample.js +21 -33
  201. package/lib/examples/AgentSandboxExample.js +5 -5
  202. package/lib/examples/AgentSkillsExample.js +7 -7
  203. package/lib/examples/AgentSubagentsExample.js +4 -4
  204. package/lib/examples/AgentToolApprovalsExample.js +5 -5
  205. package/lib/examples/AgentTriggersExample.js +9 -9
  206. package/lib/examples/AgentspecsExample.js +63 -41
  207. package/lib/examples/ChatCustomExample.js +23 -77
  208. package/lib/examples/ChatExample.js +13 -44
  209. package/lib/examples/LexicalAgentExample.js +43 -91
  210. package/lib/examples/LexicalAgentSidebarExample.js +45 -73
  211. package/lib/examples/NotebookAgentExample.js +52 -81
  212. package/lib/examples/NotebookAgentSidebarExample.js +43 -71
  213. package/lib/examples/NotebookCollaborationExample.js +11 -9
  214. package/lib/examples/NotebookExample.js +5 -2
  215. package/lib/examples/components/AuthRequiredView.js +1 -1
  216. package/lib/examples/components/ExampleErrorBoundary.d.ts +46 -0
  217. package/lib/examples/components/ExampleErrorBoundary.js +67 -0
  218. package/lib/examples/components/haiku/haiku-card.css +11 -0
  219. package/lib/examples/components/weather/weather-card.css +11 -0
  220. package/lib/examples/example-selector.js +4 -1
  221. package/lib/examples/hooks/useExampleAgentRuntime.d.ts +35 -0
  222. package/lib/examples/hooks/useExampleAgentRuntime.js +82 -0
  223. package/lib/examples/hooks/useSpecRenderToolResult.d.ts +30 -0
  224. package/lib/examples/hooks/useSpecRenderToolResult.js +61 -0
  225. package/lib/examples/index.d.ts +4 -1
  226. package/lib/examples/index.js +4 -1
  227. package/lib/examples/main.js +340 -93
  228. package/lib/examples/utils/a2ui.d.ts +2 -0
  229. package/lib/examples/utils/a2ui.js +97 -2
  230. package/lib/examples/utils/agentSummaryStore.d.ts +21 -0
  231. package/lib/examples/utils/agentSummaryStore.js +23 -0
  232. package/lib/examples/utils/notebooks/Empty.ipynb.json +30 -30
  233. package/lib/examples/utils/runtimeTargetStore.d.ts +9 -0
  234. package/lib/examples/utils/runtimeTargetStore.js +27 -0
  235. package/lib/examples/utils/teardownAgents.d.ts +13 -0
  236. package/lib/examples/utils/teardownAgents.js +78 -0
  237. package/lib/examples/utils/useExampleAgentRuntimesUrl.d.ts +2 -0
  238. package/lib/examples/utils/useExampleAgentRuntimesUrl.js +26 -7
  239. package/lib/examples2/CellExample.d.ts +6 -0
  240. package/lib/examples2/CellExample.js +20 -0
  241. package/lib/examples2/DatalayerNotebookExample.d.ts +16 -0
  242. package/lib/examples2/DatalayerNotebookExample.js +109 -0
  243. package/lib/examples2/NativeNavigationExample.d.ts +8 -0
  244. package/lib/examples2/NativeNavigationExample.js +97 -0
  245. package/lib/examples2/NotebookExample.d.ts +6 -0
  246. package/lib/examples2/NotebookExample.js +19 -0
  247. package/lib/examples2/NotebookMutationsKernel.d.ts +2 -0
  248. package/lib/examples2/NotebookMutationsKernel.js +105 -0
  249. package/lib/examples2/NotebookMutationsServiceManager.d.ts +2 -0
  250. package/lib/examples2/NotebookMutationsServiceManager.js +109 -0
  251. package/lib/examples2/ReactRouterExample.d.ts +6 -0
  252. package/lib/examples2/ReactRouterExample.js +175 -0
  253. package/lib/examples2/example-selector.d.ts +22 -0
  254. package/lib/examples2/example-selector.js +45 -0
  255. package/lib/examples2/index.d.ts +2 -0
  256. package/lib/examples2/index.js +6 -0
  257. package/lib/examples2/lexical-theme.css +436 -0
  258. package/lib/examples2/main.d.ts +2 -0
  259. package/lib/examples2/main.js +330 -0
  260. package/lib/examples2/notebooks/IPyWidgetsExample.ipynb.json +101 -0
  261. package/lib/examples2/notebooks/IPyWidgetsExampleWithState.ipynb.json +112 -0
  262. package/lib/examples2/notebooks/Lite.ipynb.json +128 -0
  263. package/lib/examples2/notebooks/Matplotlib.ipynb.json +137 -0
  264. package/lib/examples2/notebooks/NotebookExample1.ipynb.json +126 -0
  265. package/lib/examples2/notebooks/NotebookExample2.ipynb.json +48 -0
  266. package/lib/examples2/notebooks/NotebookOutputs.ipynb.json +49 -0
  267. package/lib/examples2/notebooks/NotebookToCExample.ipynb.json +102 -0
  268. package/lib/examples2/notebooks/OutputIPyWidgetsExample.d.ts +145 -0
  269. package/lib/examples2/notebooks/OutputIPyWidgetsExample.js +153 -0
  270. package/lib/examples2/notebooks/PyGWalker.ipynb.json +55 -0
  271. package/lib/hooks/index.d.ts +9 -1
  272. package/lib/hooks/index.js +13 -1
  273. package/lib/hooks/useAIAgentsWebSocket.d.ts +1 -1
  274. package/lib/hooks/useAIAgentsWebSocket.js +39 -3
  275. package/lib/hooks/useAgentRuntimes.d.ts +15 -3
  276. package/lib/hooks/useAgentRuntimes.js +186 -27
  277. package/lib/hooks/useAgentsService.js +5 -5
  278. package/lib/hooks/useCellOutputshot.d.ts +4 -0
  279. package/lib/hooks/useCellOutputshot.js +25 -0
  280. package/lib/hooks/useCheckpoints.d.ts +8 -8
  281. package/lib/hooks/useCheckpoints.js +36 -26
  282. package/lib/hooks/useConfig.d.ts +1 -1
  283. package/lib/hooks/useMonitoring.d.ts +7 -5
  284. package/lib/hooks/useMonitoring.js +16 -10
  285. package/lib/hooks/useNotifications.d.ts +11 -11
  286. package/lib/hooks/useNotifications.js +1 -1
  287. package/lib/hooks/useProgressStore.d.ts +25 -0
  288. package/lib/hooks/useProgressStore.js +58 -0
  289. package/lib/hooks/useProgressTask.d.ts +9 -0
  290. package/lib/hooks/useProgressTask.js +41 -0
  291. package/lib/hooks/useProjects.d.ts +628 -0
  292. package/lib/hooks/useProjects.js +190 -0
  293. package/lib/hooks/useRuntimes.d.ts +5 -0
  294. package/lib/hooks/useRuntimes.js +34 -0
  295. package/lib/hooks/useToolApprovals.d.ts +6 -6
  296. package/lib/index.d.ts +1 -0
  297. package/lib/index.js +1 -0
  298. package/lib/jupyter/exec/Python.d.ts +5 -0
  299. package/lib/jupyter/exec/Python.js +100 -0
  300. package/lib/jupyter/exec/Snippets.d.ts +105 -0
  301. package/lib/jupyter/exec/Snippets.js +101 -0
  302. package/lib/jupyter/exec/index.d.ts +2 -0
  303. package/lib/jupyter/exec/index.js +6 -0
  304. package/lib/jupyter/index.d.ts +2 -0
  305. package/lib/jupyter/index.js +6 -0
  306. package/lib/jupyter/kernelsHandler.d.ts +8 -0
  307. package/lib/jupyter/kernelsHandler.js +39 -0
  308. package/lib/mocks/models/CourseMock.d.ts +6 -0
  309. package/lib/mocks/models/CourseMock.js +29 -0
  310. package/lib/mocks/models/SpaceMock.d.ts +6 -0
  311. package/lib/mocks/models/SpaceMock.js +25 -0
  312. package/lib/models/Assignment.d.ts +7 -0
  313. package/lib/models/Assignment.js +5 -0
  314. package/lib/models/Cell.d.ts +8 -0
  315. package/lib/models/Cell.js +5 -0
  316. package/lib/models/CodeBlock.d.ts +10 -0
  317. package/lib/models/CodeBlock.js +5 -0
  318. package/lib/models/CodeSandboxSnapshot.d.ts +92 -0
  319. package/lib/models/CodeSandboxSnapshot.js +13 -0
  320. package/lib/models/CodeSandboxSnapshotDTO.d.ts +173 -0
  321. package/lib/models/CodeSandboxSnapshotDTO.js +139 -0
  322. package/lib/models/CodefeedBlocks.d.ts +7 -0
  323. package/lib/models/CodefeedBlocks.js +5 -0
  324. package/lib/models/Content.d.ts +5 -0
  325. package/lib/models/Content.js +5 -0
  326. package/lib/models/Course.d.ts +17 -0
  327. package/lib/models/Course.js +5 -0
  328. package/lib/models/Dataset.d.ts +16 -0
  329. package/lib/models/Dataset.js +5 -0
  330. package/lib/models/Document.d.ts +8 -0
  331. package/lib/models/Document.js +5 -0
  332. package/lib/models/Environment.d.ts +86 -0
  333. package/lib/models/Environment.js +5 -0
  334. package/lib/models/EnvironmentDTO.d.ts +125 -0
  335. package/lib/models/EnvironmentDTO.js +88 -0
  336. package/lib/models/Exercise.d.ts +16 -0
  337. package/lib/models/Exercise.js +5 -0
  338. package/lib/models/Item.d.ts +20 -0
  339. package/lib/models/Item.js +5 -0
  340. package/lib/models/ItemDTO.d.ts +74 -0
  341. package/lib/models/ItemDTO.js +186 -0
  342. package/lib/models/ItemType.d.ts +2 -0
  343. package/lib/models/ItemType.js +5 -0
  344. package/lib/models/Lesson.d.ts +5 -0
  345. package/lib/models/Lesson.js +5 -0
  346. package/lib/models/LexicalDTO.d.ts +155 -0
  347. package/lib/models/LexicalDTO.js +157 -0
  348. package/lib/models/Library.d.ts +10 -0
  349. package/lib/models/Library.js +5 -0
  350. package/lib/models/Notebook.d.ts +11 -0
  351. package/lib/models/Notebook.js +5 -0
  352. package/lib/models/NotebookDTO.d.ts +96 -0
  353. package/lib/models/NotebookDTO.js +153 -0
  354. package/lib/models/Page.d.ts +41 -0
  355. package/lib/models/Page.js +25 -0
  356. package/lib/models/PageTag.d.ts +19 -0
  357. package/lib/models/PageTag.js +94 -0
  358. package/lib/models/ProjectDTO.d.ts +89 -0
  359. package/lib/models/ProjectDTO.js +131 -0
  360. package/lib/models/Runtime.d.ts +160 -0
  361. package/lib/models/Runtime.js +18 -0
  362. package/lib/models/RuntimeDTO.d.ts +172 -0
  363. package/lib/models/RuntimeDTO.js +204 -0
  364. package/lib/models/Space.d.ts +35 -0
  365. package/lib/models/Space.js +66 -0
  366. package/lib/models/SpaceDTO.d.ts +334 -0
  367. package/lib/models/SpaceDTO.js +244 -0
  368. package/lib/models/SpaceItem.d.ts +10 -0
  369. package/lib/models/SpaceItem.js +5 -0
  370. package/lib/models/SpaceMember.d.ts +6 -0
  371. package/lib/models/SpaceMember.js +5 -0
  372. package/lib/models/StudentItem.d.ts +21 -0
  373. package/lib/models/StudentItem.js +5 -0
  374. package/lib/models/index.d.ts +32 -0
  375. package/lib/models/index.js +39 -0
  376. package/lib/protocols/AGUIAdapter.js +1 -1
  377. package/lib/runtimes/actions.d.ts +102 -0
  378. package/lib/runtimes/actions.js +249 -0
  379. package/lib/runtimes/apis.d.ts +273 -0
  380. package/lib/runtimes/apis.js +5 -0
  381. package/lib/runtimes/index.d.ts +5 -0
  382. package/lib/runtimes/index.js +9 -0
  383. package/lib/runtimes/settings.d.ts +15 -0
  384. package/lib/runtimes/settings.js +31 -0
  385. package/lib/runtimes/snapshots.d.ts +25 -0
  386. package/lib/runtimes/snapshots.js +150 -0
  387. package/lib/runtimes/utils.d.ts +7 -0
  388. package/lib/runtimes/utils.js +14 -0
  389. package/lib/services/DatalayerServiceManager.d.ts +23 -0
  390. package/lib/services/DatalayerServiceManager.js +90 -0
  391. package/lib/services/reconnectToRuntime.d.ts +32 -0
  392. package/lib/services/reconnectToRuntime.js +59 -0
  393. package/lib/services/sandboxServiceManagers.d.ts +31 -0
  394. package/lib/services/sandboxServiceManagers.js +57 -0
  395. package/lib/specs/agents/agents.d.ts +78 -26
  396. package/lib/specs/agents/agents.js +4434 -1639
  397. package/lib/specs/index.d.ts +1 -0
  398. package/lib/specs/index.js +1 -0
  399. package/lib/specs/loops.d.ts +34 -0
  400. package/lib/specs/loops.js +188 -0
  401. package/lib/specs/mcpServers.d.ts +1 -0
  402. package/lib/specs/mcpServers.js +17 -0
  403. package/lib/specs/models.d.ts +4 -0
  404. package/lib/specs/models.js +30 -0
  405. package/lib/specs/skills.d.ts +1 -0
  406. package/lib/specs/skills.js +18 -0
  407. package/lib/specs/tools.d.ts +15 -0
  408. package/lib/specs/tools.js +285 -0
  409. package/lib/state/index.d.ts +4 -0
  410. package/lib/state/index.js +10 -0
  411. package/lib/state/substates/CellState.d.ts +12 -0
  412. package/lib/state/substates/CellState.js +22 -0
  413. package/lib/state/substates/DocumentState.d.ts +10 -0
  414. package/lib/state/substates/DocumentState.js +14 -0
  415. package/lib/state/substates/GradeState.d.ts +10 -0
  416. package/lib/state/substates/GradeState.js +14 -0
  417. package/lib/state/substates/JupyterLabState.d.ts +16 -0
  418. package/lib/state/substates/JupyterLabState.js +17 -0
  419. package/lib/state/substates/NbformatState.d.ts +13 -0
  420. package/lib/state/substates/NbformatState.js +16 -0
  421. package/lib/state/substates/RuntimesState.d.ts +87 -0
  422. package/lib/state/substates/RuntimesState.js +192 -0
  423. package/lib/state/substates/SpaceState.d.ts +11 -0
  424. package/lib/state/substates/SpaceState.js +16 -0
  425. package/lib/state/substates/index.d.ts +8 -0
  426. package/lib/state/substates/index.js +14 -0
  427. package/lib/stores/agentRuntimeStore.d.ts +25 -2
  428. package/lib/stores/agentRuntimeStore.js +114 -19
  429. package/lib/stories/Button.stories.d.ts +1 -1
  430. package/lib/stories/Header.stories.d.ts +3 -3
  431. package/lib/test-setup.js +10 -0
  432. package/lib/types/agents-lifecycle.d.ts +5 -5
  433. package/lib/types/agents.d.ts +3 -3
  434. package/lib/types/agentspecs.d.ts +4 -2
  435. package/lib/types/chat.d.ts +135 -3
  436. package/lib/types/config.d.ts +19 -1
  437. package/lib/types/index.d.ts +1 -0
  438. package/lib/types/index.js +1 -0
  439. package/lib/types/loops.d.ts +64 -0
  440. package/lib/types/loops.js +5 -0
  441. package/lib/types/tools.d.ts +16 -0
  442. package/lib/utils/Cells.d.ts +2 -0
  443. package/lib/utils/Cells.js +28 -0
  444. package/package.json +24 -18
  445. package/scripts/codegen/__pycache__/generate_sandbox_agents.cpython-313.pyc +0 -0
  446. package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
  447. package/scripts/codegen/generate_agents.py +21 -4
  448. package/scripts/codegen/generate_loops.py +443 -0
  449. package/scripts/codegen/generate_sandbox_agents.py +145 -0
  450. package/lib/examples/A2UiComponentGalleryExample.d.ts +0 -3
  451. package/lib/examples/A2UiComponentGalleryExample.js +0 -361
  452. /package/lib/{agent-lexical-main.d.ts → agent-document-main.d.ts} +0 -0
@@ -5,22 +5,11 @@
5
5
  * Human in the Loop example backend. This shows how to implement
6
6
  * approval workflows where the human must approve generated plans.
7
7
  *
8
- * Backend: /api/v1/examples/human_in_the_loop/
8
+ * Backend: managed AG-UI agent runtime (agentspec: example-human-in-the-loop)
9
9
  *
10
10
  * Pattern: Uses renderToolResult with respond callback for human-in-the-loop
11
11
  * interactions, matching the CopilotKit useHumanInTheLoop pattern.
12
12
  */
13
13
  import React from 'react';
14
- /**
15
- * AgUiHumanInTheLoopExample Component
16
- *
17
- * Demonstrates human-in-the-loop approval patterns with AG-UI.
18
- * The agent generates task steps that require human approval before proceeding.
19
- *
20
- * Features demonstrated:
21
- * - Tool call rendering with Reject/Confirm buttons
22
- * - respond callback for sending user decisions back to the agent
23
- * - UI state changes based on user actions
24
- */
25
14
  declare const AgUiHumanInTheLoopExample: React.FC;
26
15
  export default AgUiHumanInTheLoopExample;
@@ -10,19 +10,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
10
10
  * Human in the Loop example backend. This shows how to implement
11
11
  * approval workflows where the human must approve generated plans.
12
12
  *
13
- * Backend: /api/v1/examples/human_in_the_loop/
13
+ * Backend: managed AG-UI agent runtime (agentspec: example-human-in-the-loop)
14
14
  *
15
15
  * Pattern: Uses renderToolResult with respond callback for human-in-the-loop
16
16
  * interactions, matching the CopilotKit useHumanInTheLoop pattern.
17
17
  */
18
- import { useState, useEffect } from 'react';
18
+ import { useState, useEffect, useMemo } from 'react';
19
19
  import { Text, Checkbox, FormControl, Label, ProgressBar, Button, } from '@primer/react';
20
20
  import { Box } from '@datalayer/primer-addons';
21
21
  import { ThemedProvider, useThemeBrandColor } from './utils/themedProvider';
22
22
  import { ChatFloating } from '../chat';
23
+ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
24
+ import { uniqueAgentId } from './utils/agentId';
25
+ import { useExampleAgentRuntime } from './hooks/useExampleAgentRuntime';
23
26
  import { TasklistIcon, CheckCircleFillIcon, XCircleFillIcon, } from '@primer/octicons-react';
24
- // AG-UI endpoint for human in the loop example
25
- const HUMAN_IN_THE_LOOP_ENDPOINT = 'http://localhost:8765/api/v1/examples/human_in_the_loop/';
26
27
  /**
27
28
  * StepsFeedback Component
28
29
  *
@@ -177,8 +178,22 @@ const renderTaskStepsTool = (context) => {
177
178
  * - respond callback for sending user decisions back to the agent
178
179
  * - UI state changes based on user actions
179
180
  */
181
+ const AGENT_NAME = 'ag-ui-human-in-the-loop';
182
+ const AGENTSPEC_ID = 'example-human-in-the-loop';
180
183
  const AgUiHumanInTheLoopExample = () => {
181
184
  const brandColor = useThemeBrandColor();
185
+ const baseUrl = useExampleAgentRuntimesUrl();
186
+ const agentName = useMemo(() => uniqueAgentId(AGENT_NAME), []);
187
+ const { agentId } = useExampleAgentRuntime({
188
+ exampleId: 'AgUiHumanInTheLoopExample',
189
+ agentName,
190
+ specId: AGENTSPEC_ID,
191
+ agentConfig: {
192
+ protocol: 'ag-ui',
193
+ agentSpecId: AGENTSPEC_ID,
194
+ },
195
+ });
196
+ const humanInTheLoopEndpoint = agentId != null ? `${baseUrl}/api/v1/ag-ui/${agentId}/` : undefined;
182
197
  return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
183
198
  minHeight: '100vh',
184
199
  backgroundColor: 'canvas.default',
@@ -207,7 +222,7 @@ const AgUiHumanInTheLoopExample = () => {
207
222
  borderRadius: 2,
208
223
  border: '1px solid',
209
224
  borderColor: 'accent.muted',
210
- }, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Key Concept: respond() Callback" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.default' }, children: ["The ", _jsx("code", { children: "renderToolResult" }), " function receives a", ' ', _jsx("code", { children: "respond" }), " callback when the tool status is \"executing\". Calling ", _jsxs("code", { children: ["respond(", '{ accepted: true, steps: [...] }', ")"] }), ' ', "sends the user's decision back to the agent, completing the human-in-the-loop interaction."] })] })] }), _jsx(ChatFloating, { protocol: "ag-ui", endpoint: HUMAN_IN_THE_LOOP_ENDPOINT, title: "Task Planner", description: "I can help you plan tasks. I'll generate steps for your review.", position: "bottom-right", brandColor: brandColor, renderToolResult: renderTaskStepsTool, hideMessagesAfterToolUI: true, suggestions: [
225
+ }, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Key Concept: respond() Callback" }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.default' }, children: ["The ", _jsx("code", { children: "renderToolResult" }), " function receives a", ' ', _jsx("code", { children: "respond" }), " callback when the tool status is \"executing\". Calling ", _jsxs("code", { children: ["respond(", '{ accepted: true, steps: [...] }', ")"] }), ' ', "sends the user's decision back to the agent, completing the human-in-the-loop interaction."] })] })] }), humanInTheLoopEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: humanInTheLoopEndpoint, title: "Task Planner", description: "I can help you plan tasks. I'll generate steps for your review.", position: "bottom-right", brandColor: brandColor, renderToolResult: renderTaskStepsTool, hideMessagesAfterToolUI: true, suggestions: [
211
226
  {
212
227
  title: 'Plan a trip',
213
228
  message: 'Plan a weekend trip to Paris.',
@@ -216,6 +231,6 @@ const AgUiHumanInTheLoopExample = () => {
216
231
  title: 'Organize party',
217
232
  message: 'Plan a birthday party for next Saturday.',
218
233
  },
219
- ] })] }) }));
234
+ ] }))] }) }));
220
235
  };
221
236
  export default AgUiHumanInTheLoopExample;
@@ -5,21 +5,8 @@
5
5
  * and the AI agent using AG-UI. This example shows a recipe builder where
6
6
  * both the user and the AI can modify the shared state.
7
7
  *
8
- * Backend: /api/v1/examples/shared_state/
8
+ * Backend: managed AG-UI agent runtime (agentspec: example-shared-state)
9
9
  */
10
10
  import React from 'react';
11
- /**
12
- * AgUiSharedStateExample Component
13
- *
14
- * Demonstrates bidirectional shared state with AG-UI.
15
- * Both the frontend and the AI agent can modify the recipe state,
16
- * with changes synchronized via STATE_SNAPSHOT events.
17
- *
18
- * Features demonstrated:
19
- * - Bidirectional state synchronization
20
- * - StateDeps for passing state to agent
21
- * - STATE_SNAPSHOT for receiving state from agent
22
- * - Editable UI that updates shared state
23
- */
24
11
  declare const AgUiSharedStateExample: React.FC;
25
12
  export default AgUiSharedStateExample;
@@ -10,16 +10,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  * and the AI agent using AG-UI. This example shows a recipe builder where
11
11
  * both the user and the AI can modify the shared state.
12
12
  *
13
- * Backend: /api/v1/examples/shared_state/
13
+ * Backend: managed AG-UI agent runtime (agentspec: example-shared-state)
14
14
  */
15
- import { useState, useCallback } from 'react';
15
+ import { useState, useCallback, useMemo } from 'react';
16
16
  import { Text, Button, TextInput, Label } from '@primer/react';
17
17
  import { Box } from '@datalayer/primer-addons';
18
18
  import { ThemedProvider, useThemeBrandColor } from './utils/themedProvider';
19
19
  import { ChatFloating } from '../chat';
20
+ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
21
+ import { uniqueAgentId } from './utils/agentId';
22
+ import { useExampleAgentRuntime } from './hooks/useExampleAgentRuntime';
20
23
  import { PlusIcon, XIcon, BeakerIcon, ClockIcon, PersonIcon, } from '@primer/octicons-react';
21
- // AG-UI endpoint for shared state example
22
- const SHARED_STATE_ENDPOINT = 'http://localhost:8765/api/v1/examples/shared_state/';
23
24
  const DEFAULT_RECIPE = {
24
25
  title: '',
25
26
  description: '',
@@ -103,8 +104,22 @@ const RecipeDisplay = ({ recipe, onUpdate }) => {
103
104
  * - STATE_SNAPSHOT for receiving state from agent
104
105
  * - Editable UI that updates shared state
105
106
  */
107
+ const AGENT_NAME = 'ag-ui-shared-state';
108
+ const AGENTSPEC_ID = 'example-shared-state';
106
109
  const AgUiSharedStateExample = () => {
107
110
  const brandColor = useThemeBrandColor();
111
+ const baseUrl = useExampleAgentRuntimesUrl();
112
+ const agentName = useMemo(() => uniqueAgentId(AGENT_NAME), []);
113
+ const { agentId } = useExampleAgentRuntime({
114
+ exampleId: 'AgUiSharedStateExample',
115
+ agentName,
116
+ specId: AGENTSPEC_ID,
117
+ agentConfig: {
118
+ protocol: 'ag-ui',
119
+ agentSpecId: AGENTSPEC_ID,
120
+ },
121
+ });
122
+ const sharedStateEndpoint = agentId != null ? `${baseUrl}/api/v1/ag-ui/${agentId}/` : undefined;
108
123
  const [recipe, setRecipe] = useState(DEFAULT_RECIPE);
109
124
  // Handle state updates from AG-UI
110
125
  const handleStateUpdate = useCallback((state) => {
@@ -169,7 +184,7 @@ const AgUiSharedStateExample = () => {
169
184
  marginTop: 1,
170
185
  fontSize: 1,
171
186
  color: 'fg.muted',
172
- }, children: [_jsx("li", { children: "\"Create a recipe for chocolate chip cookies\"" }), _jsx("li", { children: "\"Add butter and sugar to the ingredients\"" }), _jsx("li", { children: "\"Update the prep time to 20 minutes\"" }), _jsx("li", { children: "\"Suggest 3 more ingredients for my recipe\"" })] })] })] })] }), _jsx(ChatFloating, { protocol: "ag-ui", endpoint: SHARED_STATE_ENDPOINT, title: "Recipe Assistant", description: "Let's build a recipe together! I can add ingredients, instructions, and more.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
187
+ }, children: [_jsx("li", { children: "\"Create a recipe for chocolate chip cookies\"" }), _jsx("li", { children: "\"Add butter and sugar to the ingredients\"" }), _jsx("li", { children: "\"Update the prep time to 20 minutes\"" }), _jsx("li", { children: "\"Suggest 3 more ingredients for my recipe\"" })] })] })] })] }), sharedStateEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: sharedStateEndpoint, title: "Recipe Assistant", description: "Let's build a recipe together! I can add ingredients, instructions, and more.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
173
188
  {
174
189
  title: 'Pasta recipe',
175
190
  message: 'Help me create a simple pasta recipe.',
@@ -178,6 +193,6 @@ const AgUiSharedStateExample = () => {
178
193
  title: 'Add ingredient',
179
194
  message: 'Add tomatoes to the recipe.',
180
195
  },
181
- ] })] }) }));
196
+ ] }))] }) }));
182
197
  };
183
198
  export default AgUiSharedStateExample;
@@ -5,21 +5,8 @@
5
5
  * that render UI components. Unlike frontend tools, these are backend
6
6
  * tools that return structured data to be rendered on the frontend.
7
7
  *
8
- * Backend: /api/v1/examples/agentic_generative_ui/
8
+ * Backend: managed AG-UI agent runtime (agentspec: example-agentic-generative-ui)
9
9
  */
10
10
  import React from 'react';
11
- /**
12
- * AgUiToolsBasedGenUiExample Component
13
- *
14
- * Demonstrates tool-based generative UI with AG-UI.
15
- * The agent uses tools (create_plan, update_plan_step) that emit
16
- * STATE_SNAPSHOT and STATE_DELTA events to update the UI.
17
- *
18
- * Features demonstrated:
19
- * - STATE_SNAPSHOT events for full state updates
20
- * - STATE_DELTA events with JSON Patch for incremental updates
21
- * - Real-time UI updates as agent works
22
- * - Interactive step selection with Confirm/Reject buttons
23
- */
24
11
  declare const AgUiToolsBasedGenUiExample: React.FC;
25
12
  export default AgUiToolsBasedGenUiExample;
@@ -10,16 +10,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  * that render UI components. Unlike frontend tools, these are backend
11
11
  * tools that return structured data to be rendered on the frontend.
12
12
  *
13
- * Backend: /api/v1/examples/agentic_generative_ui/
13
+ * Backend: managed AG-UI agent runtime (agentspec: example-agentic-generative-ui)
14
14
  */
15
- import { useState, useCallback } from 'react';
15
+ import { useState, useCallback, useMemo } from 'react';
16
16
  import { Text, ProgressBar, Button } from '@primer/react';
17
17
  import { Box } from '@datalayer/primer-addons';
18
18
  import { ThemedProvider, useThemeBrandColor } from './utils/themedProvider';
19
19
  import { ChatFloating } from '../chat';
20
+ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
21
+ import { uniqueAgentId } from './utils/agentId';
22
+ import { useExampleAgentRuntime } from './hooks/useExampleAgentRuntime';
20
23
  import { CheckCircleIcon, CircleIcon, DotFillIcon, CheckIcon, XIcon, } from '@primer/octicons-react';
21
- // AG-UI endpoint for agentic generative UI example
22
- const AGENTIC_GENERATIVE_UI_ENDPOINT = 'http://localhost:8765/api/v1/examples/agentic_generative_ui/';
23
24
  /**
24
25
  * PlanStepItem Component
25
26
  * Renders a single plan step with status indicator and optional click handler
@@ -168,8 +169,22 @@ const PlanDisplay = ({ plan, isInteractive = true, onStepToggle, onConfirm, onRe
168
169
  * - Real-time UI updates as agent works
169
170
  * - Interactive step selection with Confirm/Reject buttons
170
171
  */
172
+ const AGENT_NAME = 'ag-ui-generative-ui';
173
+ const AGENTSPEC_ID = 'example-agentic-generative-ui';
171
174
  const AgUiToolsBasedGenUiExample = () => {
172
175
  const brandColor = useThemeBrandColor();
176
+ const baseUrl = useExampleAgentRuntimesUrl();
177
+ const agentName = useMemo(() => uniqueAgentId(AGENT_NAME), []);
178
+ const { agentId } = useExampleAgentRuntime({
179
+ exampleId: 'AgUiToolsBasedGenUiExample',
180
+ agentName,
181
+ specId: AGENTSPEC_ID,
182
+ agentConfig: {
183
+ protocol: 'ag-ui',
184
+ agentSpecId: AGENTSPEC_ID,
185
+ },
186
+ });
187
+ const agenticGenerativeUiEndpoint = agentId != null ? `${baseUrl}/api/v1/ag-ui/${agentId}/` : undefined;
173
188
  const [plan, setPlan] = useState(null);
174
189
  const [decision, setDecision] = useState(null);
175
190
  // Handle state updates from AG-UI events
@@ -244,7 +259,7 @@ const AgUiToolsBasedGenUiExample = () => {
244
259
  marginTop: 1,
245
260
  fontSize: 1,
246
261
  color: 'fg.muted',
247
- }, children: [_jsx("li", { children: "STATE_SNAPSHOT - Full state replacement" }), _jsx("li", { children: "STATE_DELTA - Incremental JSON Patch updates (RFC 6902)" }), _jsx("li", { children: "TOOL_CALL_START / TOOL_CALL_END - Tool execution tracking" })] })] })] })] }), _jsx(ChatFloating, { protocol: "ag-ui", endpoint: AGENTIC_GENERATIVE_UI_ENDPOINT, title: "Plan Generator", description: "I can create detailed plans and update them in real-time.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
262
+ }, children: [_jsx("li", { children: "STATE_SNAPSHOT - Full state replacement" }), _jsx("li", { children: "STATE_DELTA - Incremental JSON Patch updates (RFC 6902)" }), _jsx("li", { children: "TOOL_CALL_START / TOOL_CALL_END - Tool execution tracking" })] })] })] })] }), agenticGenerativeUiEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: agenticGenerativeUiEndpoint, title: "Plan Generator", description: "I can create detailed plans and update them in real-time.", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, suggestions: [
248
263
  {
249
264
  title: 'Project plan',
250
265
  message: 'Create a project plan for building a mobile app.',
@@ -253,6 +268,6 @@ const AgUiToolsBasedGenUiExample = () => {
253
268
  title: 'Marketing strategy',
254
269
  message: 'Generate a marketing strategy for a new product launch.',
255
270
  },
256
- ] })] }) }));
271
+ ] }))] }) }));
257
272
  };
258
273
  export default AgUiToolsBasedGenUiExample;
@@ -11,7 +11,7 @@
11
11
  * 3. Provides pause/resume/terminate lifecycle backed by CRIU
12
12
  *
13
13
  * Prerequisites:
14
- * - Datalayer core configuration (runtimesRunUrl, aiagentsRunUrl)
14
+ * - Datalayer core configuration (runtimesUrl, aiAgentsUrl)
15
15
  * - Valid IAM token (set via SignInSimple or iamStore)
16
16
  */
17
17
  import React from 'react';
@@ -16,7 +16,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
16
16
  * 3. Provides pause/resume/terminate lifecycle backed by CRIU
17
17
  *
18
18
  * Prerequisites:
19
- * - Datalayer core configuration (runtimesRunUrl, aiagentsRunUrl)
19
+ * - Datalayer core configuration (runtimesUrl, aiAgentsUrl)
20
20
  * - Valid IAM token (set via SignInSimple or iamStore)
21
21
  */
22
22
  /// <reference types="vite/client" />
@@ -29,7 +29,7 @@ import { AuthRequiredView, ErrorView } from './components';
29
29
  import { ThemedProvider } from './utils/themedProvider';
30
30
  import { useSimpleAuthStore } from '@datalayer/core/lib/views/otel';
31
31
  import { Chat } from '../chat';
32
- import { useAgentRuntimes, useAgentRuntimesQuery, useRefreshAgentRuntimes, useDeleteAgentRuntime, } from '../hooks/useAgentRuntimes';
32
+ import { useAgentsRuntimes, useAgentRuntimes, useAgentRuntimesQuery, useRefreshAgentRuntimes, } from '../hooks/useAgentRuntimes';
33
33
  import { useAgentLifecycle } from '../hooks/useCheckpoints';
34
34
  import { useDeletePausedAgentRuntime } from '../hooks/useCheckpoints';
35
35
  import { AGENT_STATUS_COLORS } from '../types/agents';
@@ -106,10 +106,9 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
106
106
  });
107
107
  // Agent runtimes from the focused hook
108
108
  const { data: agentRuntimes } = useAgentRuntimesQuery();
109
+ const { terminateRuntimeByPod } = useAgentsRuntimes();
109
110
  const refetchRuntimes = useRefreshAgentRuntimes();
110
- const deleteRuntimeMutation = useDeleteAgentRuntime();
111
111
  const deletePausedRuntimeMutation = useDeletePausedAgentRuntime();
112
- const deleteRuntimeByPod = deleteRuntimeMutation.mutateAsync;
113
112
  const deletePausedRuntimeByPod = deletePausedRuntimeMutation.mutateAsync;
114
113
  const [isStarting, setIsStarting] = useState(false);
115
114
  const [sidebarOpen, setSidebarOpen] = useState(true);
@@ -246,7 +245,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
246
245
  await deletePausedRuntimeByPod(agent.podName);
247
246
  }
248
247
  else {
249
- await deleteRuntimeByPod(agent.podName);
248
+ await terminateRuntimeByPod(agent.podName);
250
249
  }
251
250
  // Ensure sidebar terminate resets to the home state like header terminate.
252
251
  if (isCurrentRuntime || isLastKnownRuntime) {
@@ -262,7 +261,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
262
261
  }
263
262
  }, [
264
263
  deletePausedRuntimeByPod,
265
- deleteRuntimeByPod,
264
+ terminateRuntimeByPod,
266
265
  refreshAgents,
267
266
  refreshCheckpoints,
268
267
  runningAgents,
@@ -286,7 +285,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
286
285
  }
287
286
  // ── Running / Paused ─────────────────────────────────────────────────────
288
287
  return (_jsxs(Box, { sx: {
289
- height: 'calc(100vh - 60px)',
288
+ height: '100%',
290
289
  display: 'flex',
291
290
  flexDirection: 'column',
292
291
  }, children: [_jsxs(Box, { sx: {
@@ -436,7 +435,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
436
435
  gap: 3,
437
436
  px: 3,
438
437
  }, children: [_jsx(AgentIcon, { size: 48 }), _jsx(Heading, { as: "h2", sx: { fontSize: 3 }, children: "Checkpoint Agent" }), _jsxs(Text, { sx: { color: 'fg.muted', textAlign: 'center', maxWidth: 560 }, children: ["Launch a cloud agent runtime with pause/resume checkpointing. The agent will be deployed from the", ' ', _jsx("strong", { children: AGENTSPEC_ID }), " spec."] }), displayError && (_jsx(Flash, { variant: "danger", sx: { maxWidth: 560, width: '100%' }, children: displayError })), _jsx(Button, { variant: "primary", size: "large", leadingVisual: PlayIcon, onClick: handleLaunch, children: "Launch Agent" })] })) : (isReady || runtimeStatus === 'resumed') &&
439
- runtimeStatus !== 'paused' ? (_jsx(Chat, { protocol: "vercel-ai", baseUrl: agentBaseUrl, agentId: agentId, title: "Monitor Sales KPI Agent", brandIcon: _jsx(AgentIcon, { size: 16 }), placeholder: "Ask about sales KPIs\u2026", description: "Monitor Sales KPI agent with pause/resume checkpointing", showHeader: false, showTokenUsage: true, autoFocus: true, height: "100%", runtimeId: podName, historyEndpoint: `${agentBaseUrl}/api/v1/history`, suggestions: [
438
+ runtimeStatus !== 'paused' ? (_jsx(Chat, { protocol: "vercel-ai", baseUrl: agentBaseUrl, agentId: agentId, title: "Monitor Sales KPI Agent", brandIcon: _jsx(AgentIcon, { size: 16 }), placeholder: "Ask about sales KPIs\u2026", description: "Monitor Sales KPI agent with pause/resume checkpointing", showHeader: true, showTokenUsage: true, autoFocus: true, height: "100%", runtimeId: podName, historyEndpoint: `${agentBaseUrl}/api/v1/history`, suggestions: [
440
439
  {
441
440
  title: 'KPIs',
442
441
  message: "Show me today's sales KPI dashboard",
@@ -464,7 +463,7 @@ const AgentCheckpointsExample = () => {
464
463
  useEffect(() => {
465
464
  if (token && !hasSynced.current) {
466
465
  hasSynced.current = true;
467
- import('@datalayer/core/lib/state').then(({ iamStore }) => {
466
+ import('../state/substates').then(({ iamStore }) => {
468
467
  iamStore.setState({ token });
469
468
  });
470
469
  }
@@ -474,7 +473,7 @@ const AgentCheckpointsExample = () => {
474
473
  const handleLogout = useCallback(() => {
475
474
  clearAuth();
476
475
  hasSynced.current = false;
477
- import('@datalayer/core/lib/state').then(({ iamStore }) => {
476
+ import('../state/substates').then(({ iamStore }) => {
478
477
  iamStore.setState({ token: undefined });
479
478
  });
480
479
  }, [clearAuth]);
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const AgentCodeSandboxesExample: React.FC;
3
+ export default AgentCodeSandboxesExample;
@@ -0,0 +1,192 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2025-2026 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ /// <reference types="vite/client" />
7
+ import { useCallback, useMemo, useState } from 'react';
8
+ import { Box } from '@datalayer/primer-addons';
9
+ import { Button, Heading, Label, Spinner, Text } from '@primer/react';
10
+ import { PackageIcon } from '@primer/octicons-react';
11
+ import { useSimpleAuthStore } from '@datalayer/core/lib/views/otel';
12
+ import { ThemedProvider } from './utils/themedProvider';
13
+ import { AuthRequiredView, ErrorView } from './components';
14
+ import { uniqueAgentId } from './utils/agentId';
15
+ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
16
+ import { Chat } from '../chat';
17
+ const SANDBOX_SPEC_OPTIONS = [
18
+ {
19
+ variant: 'eval',
20
+ specId: 'example-sandbox-eval',
21
+ title: 'Eval Sandbox',
22
+ description: 'In-process Python execution for quick local iteration.',
23
+ },
24
+ {
25
+ variant: 'jupyter',
26
+ specId: 'example-sandbox-jupyter',
27
+ title: 'Jupyter Sandbox',
28
+ description: 'Kernel-backed execution with notebook-compatible behavior.',
29
+ },
30
+ {
31
+ variant: 'docker',
32
+ specId: 'example-sandbox-docker',
33
+ title: 'Docker Sandbox',
34
+ description: 'Containerized execution for stronger process isolation.',
35
+ },
36
+ {
37
+ variant: 'datalayer',
38
+ specId: 'example-sandbox-datalayer',
39
+ title: 'Datalayer Sandbox',
40
+ description: 'Cloud sandbox runtime powered by Datalayer environments.',
41
+ },
42
+ {
43
+ variant: 'colab',
44
+ specId: 'example-sandbox-colab',
45
+ title: 'Colab Sandbox',
46
+ description: 'Google Colab runtime connector (reuse an already-running kernel).',
47
+ },
48
+ {
49
+ variant: 'kaggle',
50
+ specId: 'example-sandbox-kaggle',
51
+ title: 'Kaggle Sandbox',
52
+ description: 'Kaggle runtime connector (create kernel with API token or attach existing).',
53
+ },
54
+ {
55
+ variant: 'monty',
56
+ specId: 'example-sandbox-monty',
57
+ title: 'Monty Sandbox',
58
+ description: 'Secure in-process interpreter focused on safe snippets.',
59
+ },
60
+ {
61
+ variant: 'modal',
62
+ specId: 'example-sandbox-modal',
63
+ title: 'Modal Sandbox',
64
+ description: 'Modal cloud sandbox for scalable remote code execution.',
65
+ },
66
+ ];
67
+ const AgentCodeSandboxesInner = ({ onLogout, }) => {
68
+ const { token } = useSimpleAuthStore();
69
+ const baseUrl = useExampleAgentRuntimesUrl();
70
+ const [selectedSpecId, setSelectedSpecId] = useState(SANDBOX_SPEC_OPTIONS[0].specId);
71
+ const [agentId, setAgentId] = useState(null);
72
+ const [activeSpecId, setActiveSpecId] = useState(null);
73
+ const [isLaunching, setIsLaunching] = useState(false);
74
+ const [error, setError] = useState(null);
75
+ const selectedOption = useMemo(() => SANDBOX_SPEC_OPTIONS.find(option => option.specId === selectedSpecId) ??
76
+ SANDBOX_SPEC_OPTIONS[0], [selectedSpecId]);
77
+ const activeOption = useMemo(() => SANDBOX_SPEC_OPTIONS.find(option => option.specId === activeSpecId) ??
78
+ selectedOption, [activeSpecId, selectedOption]);
79
+ const authFetch = useCallback((url, opts = {}) => fetch(url, {
80
+ ...opts,
81
+ headers: {
82
+ 'Content-Type': 'application/json',
83
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
84
+ ...(opts.headers ?? {}),
85
+ },
86
+ }), [token]);
87
+ const launchAgent = useCallback(async () => {
88
+ setIsLaunching(true);
89
+ setError(null);
90
+ try {
91
+ if (agentId) {
92
+ await authFetch(`${baseUrl}/api/v1/agents/${agentId}`, {
93
+ method: 'DELETE',
94
+ }).catch(() => {
95
+ // Ignore teardown errors while switching specs.
96
+ });
97
+ }
98
+ const agentName = uniqueAgentId(`code-sandbox-${selectedOption.variant}`);
99
+ const response = await authFetch(`${baseUrl}/api/v1/agents`, {
100
+ method: 'POST',
101
+ body: JSON.stringify({
102
+ name: agentName,
103
+ description: `Code sandbox demo (${selectedOption.variant})`,
104
+ agent_library: 'pydantic-ai',
105
+ transport: 'vercel-ai',
106
+ agent_spec_id: selectedOption.specId,
107
+ enable_codemode: true,
108
+ enable_skills: true,
109
+ tools: [],
110
+ }),
111
+ });
112
+ if (!response.ok) {
113
+ const contentType = response.headers.get('content-type') || '';
114
+ let detail = '';
115
+ if (contentType.includes('application/json')) {
116
+ const payload = await response.json().catch(() => null);
117
+ detail =
118
+ (typeof payload?.detail === 'string' && payload.detail) ||
119
+ (typeof payload?.message === 'string' && payload.message) ||
120
+ '';
121
+ }
122
+ else {
123
+ detail = await response.text().catch(() => '');
124
+ }
125
+ throw new Error(detail || `Failed to create agent (${response.status})`);
126
+ }
127
+ const payload = await response.json();
128
+ const createdAgentId = payload?.id || agentName;
129
+ setAgentId(createdAgentId);
130
+ setActiveSpecId(selectedOption.specId);
131
+ }
132
+ catch (e) {
133
+ setError(e instanceof Error ? e.message : 'Failed to launch agent');
134
+ }
135
+ finally {
136
+ setIsLaunching(false);
137
+ }
138
+ }, [agentId, authFetch, baseUrl, selectedOption]);
139
+ if (!agentId) {
140
+ return (_jsxs(Box, { sx: {
141
+ maxWidth: 840,
142
+ mx: 'auto',
143
+ mt: 6,
144
+ px: 3,
145
+ py: 3,
146
+ border: '1px solid',
147
+ borderColor: 'border.default',
148
+ borderRadius: 2,
149
+ display: 'flex',
150
+ flexDirection: 'column',
151
+ gap: 3,
152
+ bg: 'canvas.subtle',
153
+ }, children: [_jsx(Text, { sx: { fontSize: 0, fontWeight: 'bold', color: 'fg.muted' }, children: "SANDBOX VARIANT DEMO" }), _jsx(Heading, { as: "h2", sx: { fontSize: 3 }, children: "Agent Code Sandboxes" }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Choose a sandbox variant-backed spec, launch the agent, then run code from chat to compare behavior across sandboxes." }), _jsxs(Box, { sx: { display: 'flex', gap: 2, flexWrap: 'wrap' }, children: [_jsxs(Label, { variant: "accent", children: ["Spec: ", selectedOption.specId] }), _jsxs(Label, { variant: "secondary", children: ["Variant: ", selectedOption.variant] }), _jsx(Label, { variant: "success", children: "Codemode: enabled" })] }), _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 1, fontWeight: 600 }, children: "Sandbox Variant" }), _jsx("select", { value: selectedSpecId, onChange: event => {
154
+ setSelectedSpecId(event.target.value);
155
+ }, style: {
156
+ width: '100%',
157
+ maxWidth: 420,
158
+ padding: '8px 10px',
159
+ borderRadius: '6px',
160
+ border: '1px solid var(--borderColor-default)',
161
+ background: 'var(--bgColor-default)',
162
+ color: 'var(--fgColor-default)',
163
+ }, children: SANDBOX_SPEC_OPTIONS.map(option => (_jsxs("option", { value: option.specId, children: [option.title, " (", option.variant, ")"] }, option.specId))) }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 0 }, children: selectedOption.description })] }), _jsx(Button, { variant: "primary", onClick: () => {
164
+ void launchAgent();
165
+ }, disabled: isLaunching, sx: { width: '100%', maxWidth: 420 }, children: isLaunching ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { size: "small" }), " Launching..."] })) : (`Launch ${selectedOption.title}`) }), error && _jsx(ErrorView, { error: error, onLogout: onLogout })] }));
166
+ }
167
+ return (_jsx(Chat, { protocol: "vercel-ai", baseUrl: baseUrl, agentId: agentId, runtimeId: agentId, title: `Code Sandboxes: ${activeOption.title}`, description: `Spec ${activeOption.specId} (${activeOption.variant})`, brandIcon: _jsx(PackageIcon, { size: 16 }), showHeader: true, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, showTokenUsage: true, showInformation: true, autoFocus: true, height: "100vh", historyEndpoint: `${baseUrl}/api/v1/history`, suggestions: [
168
+ {
169
+ title: 'Identify sandbox variant',
170
+ message: 'Use execute_code to print(os.getenv("DATALAYER_CODE_SANDBOX_VARIANT")) and summarize the result.',
171
+ },
172
+ {
173
+ title: 'Run numeric workload',
174
+ message: 'Use execute_code to compute sum(i*i for i in range(10000)) and report timing and result.',
175
+ },
176
+ {
177
+ title: 'Check package availability',
178
+ message: 'Use execute_code to import pandas and print(pandas.__version__).',
179
+ },
180
+ ], submitOnSuggestionClick: true }));
181
+ };
182
+ const AgentCodeSandboxesExample = () => {
183
+ const { token, clearAuth } = useSimpleAuthStore();
184
+ const handleLogout = useCallback(() => {
185
+ clearAuth();
186
+ }, [clearAuth]);
187
+ if (!token) {
188
+ return _jsx(AuthRequiredView, {});
189
+ }
190
+ return (_jsx(ThemedProvider, { children: _jsx(AgentCodeSandboxesInner, { onLogout: handleLogout }) }));
191
+ };
192
+ export default AgentCodeSandboxesExample;
@@ -529,7 +529,7 @@ const AgentCodemodeInner = ({ onLogout, }) => {
529
529
  return null;
530
530
  }
531
531
  return (_jsxs(Box, { sx: {
532
- height: 'calc(100vh - 60px)',
532
+ height: '100%',
533
533
  display: 'flex',
534
534
  flexDirection: 'column',
535
535
  }, children: [_jsxs(Box, { sx: {
@@ -662,7 +662,7 @@ const AgentCodemodeInner = ({ onLogout, }) => {
662
662
  })())] })] }));
663
663
  };
664
664
  const syncTokenToIamStore = (token) => {
665
- import('@datalayer/core/lib/state').then(({ iamStore }) => {
665
+ import('../state/substates').then(({ iamStore }) => {
666
666
  iamStore.setState({ token });
667
667
  });
668
668
  };
@@ -678,7 +678,7 @@ const AgentCodemodeExample = () => {
678
678
  const handleLogout = useCallback(() => {
679
679
  clearAuth();
680
680
  hasSynced.current = false;
681
- import('@datalayer/core/lib/state').then(({ iamStore }) => {
681
+ import('../state/substates').then(({ iamStore }) => {
682
682
  iamStore.setState({ token: undefined });
683
683
  });
684
684
  }, [clearAuth]);
@@ -80,7 +80,7 @@ const AgentEvalsInner = ({ onLogout, executionTarget, onExecutionTargetChange })
80
80
  const cloudRuntimeBaseUrl = useMemo(() => {
81
81
  const envRuntimesUrl = normalizeHttpUrl(import.meta.env.VITE_DATALAYER_RUNTIMES_URL);
82
82
  const envAgentRuntimesUrl = normalizeHttpUrl(import.meta.env.VITE_DATALAYER_AGENT_RUNTIMES_URL);
83
- const configuredRuntimesUrl = normalizeHttpUrl(configuration?.runtimesRunUrl);
83
+ const configuredRuntimesUrl = normalizeHttpUrl(configuration?.runtimesUrl);
84
84
  if (envRuntimesUrl && !isLocalhostUrl(envRuntimesUrl)) {
85
85
  return envRuntimesUrl;
86
86
  }
@@ -91,7 +91,7 @@ const AgentEvalsInner = ({ onLogout, executionTarget, onExecutionTargetChange })
91
91
  return envAgentRuntimesUrl;
92
92
  }
93
93
  return 'https://r1.datalayer.run';
94
- }, [configuration?.runtimesRunUrl]);
94
+ }, [configuration?.runtimesUrl]);
95
95
  const { runtime, status: runtimeStatus, isReady, error: hookError, runtimeCreationBaseUrl, } = useAgentRuntimes({
96
96
  agentSpecId: AGENTSPEC_ID,
97
97
  autoStart: executionTarget === 'cloud',
@@ -123,7 +123,7 @@ const AgentEvalsInner = ({ onLogout, executionTarget, onExecutionTargetChange })
123
123
  ? `local:${agentId}`
124
124
  : runtime?.podName || '(launching…)';
125
125
  const controlPlaneBaseUrl = import.meta.env.VITE_RUN_URL ||
126
- configuration?.runUrl ||
126
+ configuration?.datalayerUrl ||
127
127
  (cloudAgentBaseUrl ? new URL(cloudAgentBaseUrl).origin : '');
128
128
  const isAgentReady = executionTarget === 'local' ? localStatus === 'ready' : isReady;
129
129
  const agentStatus = executionTarget === 'local' ? localStatus : runtimeStatus;
@@ -466,7 +466,7 @@ const AgentEvalsInner = ({ onLogout, executionTarget, onExecutionTargetChange })
466
466
  };
467
467
  // ─── Sync token to core IAM store ──────────────────────────────────────────
468
468
  const syncTokenToIamStore = (token) => {
469
- import('@datalayer/core/lib/state').then(({ iamStore }) => {
469
+ import('../state/substates').then(({ iamStore }) => {
470
470
  iamStore.setState({ token });
471
471
  });
472
472
  };
@@ -484,7 +484,7 @@ const AgentEvalsExample = () => {
484
484
  const handleLogout = useCallback(() => {
485
485
  clearAuth();
486
486
  hasSynced.current = false;
487
- import('@datalayer/core/lib/state').then(({ iamStore }) => {
487
+ import('../state/substates').then(({ iamStore }) => {
488
488
  iamStore.setState({ token: undefined });
489
489
  });
490
490
  }, [clearAuth]);