@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
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import { useCallback, useEffect, useMemo, useState } from 'react';
7
7
  import { Box } from '@datalayer/primer-addons';
8
8
  import { Button, Text } from '@primer/react';
9
- import { A2uiSurface } from '@a2ui/react/v0_9';
9
+ import { A2UI_RENDER_SCOPE_SX, A2uiSurfaceComposed } from '../components/a2ui';
10
10
  import { ThemedProvider } from './utils/themedProvider';
11
11
  import { A2uiMarkdownProvider } from './utils/a2uiMarkdownProvider';
12
12
  import { createSceneMessages, useA2uiProcessor } from './utils/a2ui';
@@ -121,7 +121,7 @@ const CONTACT_CARD_MESSAGES = createSceneMessages({
121
121
  },
122
122
  });
123
123
  function ContactCardContent({ onAction, }) {
124
- const { surfaces, processMessages, resetSurfaces } = useA2uiProcessor(onAction);
124
+ const { surfaces, processMessages, resetSurfaces, themeStyle } = useA2uiProcessor(onAction);
125
125
  const loadCard = useCallback(() => {
126
126
  resetSurfaces();
127
127
  processMessages(CONTACT_CARD_MESSAGES);
@@ -129,18 +129,22 @@ function ContactCardContent({ onAction, }) {
129
129
  useEffect(() => {
130
130
  loadCard();
131
131
  }, [loadCard]);
132
- return (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3, px: 3, pb: 3 }, children: [_jsxs(Box, { sx: { display: 'flex', gap: 2 }, children: [_jsx(Button, { size: "small", variant: "primary", onClick: loadCard, children: "Reload Card" }), _jsx(Button, { size: "small", variant: "invisible", onClick: resetSurfaces, children: "Clear" })] }), _jsx(Box, { sx: { display: 'grid', gap: 3 }, children: surfaces.map(surface => (_jsx(Box, { sx: {
132
+ return (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3, px: 3, pb: 3 }, children: [_jsxs(Box, { sx: { display: 'flex', gap: 2 }, children: [_jsx(Button, { size: "small", variant: "primary", onClick: loadCard, children: "Reload Card" }), _jsx(Button, { size: "small", variant: "invisible", onClick: resetSurfaces, children: "Clear" })] }), _jsx(Box, { style: themeStyle, sx: {
133
+ ...A2UI_RENDER_SCOPE_SX,
134
+ display: 'grid',
135
+ gap: 3,
136
+ }, children: surfaces.map(surface => (_jsx(Box, { sx: {
133
137
  border: '1px solid',
134
138
  borderColor: 'border.default',
135
139
  borderRadius: 2,
136
140
  p: 3,
137
141
  backgroundColor: 'canvas.subtle',
138
- }, children: _jsx(A2uiSurface, { surface: surface }) }, surface.id))) })] }));
142
+ }, children: _jsx(A2uiSurfaceComposed, { surface: surface }) }, surface.id))) })] }));
139
143
  }
140
144
  const A2UiContactCardExample = () => {
141
145
  const [lastAction, setLastAction] = useState(null);
142
146
  const handleAction = useCallback((action) => {
143
- console.log('A2UI Contact Card Action:', action);
147
+ console.warn('A2UI Contact Card Action:', action);
144
148
  setLastAction(action);
145
149
  }, []);
146
150
  const actionPreview = useMemo(() => {
@@ -6,12 +6,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import { useCallback, useEffect, useRef, useState } from 'react';
7
7
  import { Box, getCardGradient } from '@datalayer/primer-addons';
8
8
  import { Text, Spinner, TextInput, Button } from '@primer/react';
9
- import { A2uiSurface } from '@a2ui/react/v0_9';
9
+ import { A2UI_RENDER_SCOPE_SX, A2uiSurfaceComposed } from '../components/a2ui';
10
+ import { basicCatalog } from '@a2ui/react/v0_9';
10
11
  import { ThemedProvider } from './utils/themedProvider';
11
12
  import { A2uiMarkdownProvider } from './utils/a2uiMarkdownProvider';
12
13
  import { useExampleThemeStore } from './utils/themeStore';
13
14
  import { useA2uiProcessor } from './utils/a2ui';
14
- const A2UI_RESTAURANT_ENDPOINT = 'http://localhost:8765/api/v1/a2ui/restaurant/';
15
+ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
15
16
  const LOADING_TEXT_LINES = [
16
17
  'Finding the best spots for you...',
17
18
  'Checking reviews...',
@@ -27,6 +28,13 @@ const extractV09Messages = (data) => {
27
28
  }
28
29
  const message = part.data;
29
30
  if (message.version === 'v0.9') {
31
+ // Normalize the catalog id so surfaces render regardless of which
32
+ // catalog URL variant the backend/LLM emits (the frontend only has the
33
+ // registered basicCatalog).
34
+ const createSurface = message.createSurface;
35
+ if (createSurface && createSurface.catalogId !== basicCatalog.id) {
36
+ createSurface.catalogId = basicCatalog.id;
37
+ }
30
38
  messages.push(message);
31
39
  }
32
40
  });
@@ -62,6 +70,8 @@ function RestaurantSearch({ onSearch, isLoading, }) {
62
70
  }, children: _jsx(Text, { sx: { fontSize: '4rem' }, children: "\uD83C\uDF7D\uFE0F" }) }), _jsx(Text, { as: "h1", sx: { fontSize: '2rem', fontWeight: 'bold', textAlign: 'center' }, children: "Restaurant Finder" }), _jsx(Text, { sx: { color: 'fg.muted', textAlign: 'center' }, children: "A2UI renderer connected to a live agent backend." }), _jsx("form", { onSubmit: handleSubmit, style: { width: '100%' }, children: _jsxs(Box, { sx: { display: 'flex', gap: 2 }, children: [_jsx(TextInput, { value: inputValue, onChange: e => setInputValue(e.target.value), placeholder: "Search for restaurants...", disabled: isLoading, sx: { flex: 1 }, block: true }), _jsx(Button, { type: "submit", disabled: isLoading || !inputValue.trim(), children: isLoading ? _jsx(Spinner, { size: "small" }) : 'Search' })] }) })] }));
63
71
  }
64
72
  const A2UiRestaurantExample = () => {
73
+ const baseUrl = useExampleAgentRuntimesUrl();
74
+ const a2uiRestaurantEndpoint = `${baseUrl}/api/v1/a2ui/restaurant/`;
65
75
  const [isLoading, setIsLoading] = useState(false);
66
76
  const [error, setError] = useState(null);
67
77
  const [hasData, setHasData] = useState(false);
@@ -77,7 +87,7 @@ const A2UiRestaurantExample = () => {
77
87
  context: action.context,
78
88
  });
79
89
  }, []);
80
- const { surfaces, processMessages, resetSurfaces } = useA2uiProcessor(handleAction);
90
+ const { surfaces, processMessages, resetSurfaces, themeStyle } = useA2uiProcessor(handleAction);
81
91
  useEffect(() => {
82
92
  if (!isLoading) {
83
93
  return;
@@ -94,7 +104,7 @@ const A2UiRestaurantExample = () => {
94
104
  setIsLoading(true);
95
105
  setError(null);
96
106
  setLoadingTextIndex(0);
97
- const response = await fetch(A2UI_RESTAURANT_ENDPOINT, {
107
+ const response = await fetch(a2uiRestaurantEndpoint, {
98
108
  method: 'POST',
99
109
  headers: { 'Content-Type': 'application/json' },
100
110
  body: JSON.stringify(payload),
@@ -124,7 +134,7 @@ const A2UiRestaurantExample = () => {
124
134
  finally {
125
135
  setIsLoading(false);
126
136
  }
127
- }, [processMessages, resetSurfaces]);
137
+ }, [processMessages, resetSurfaces, a2uiRestaurantEndpoint]);
128
138
  useEffect(() => {
129
139
  sendPayloadRef.current = sendPayload;
130
140
  }, [sendPayload]);
@@ -156,17 +166,22 @@ const A2UiRestaurantExample = () => {
156
166
  alignItems: 'center',
157
167
  gap: 3,
158
168
  p: 4,
159
- }, children: [_jsxs(Text, { sx: { color: 'danger.fg' }, children: ["\u26A0\uFE0F ", error] }), _jsx(Button, { onClick: handleRetry, disabled: !lastQuery, children: "Retry" })] })), !isLoading && hasData && !error && (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3 }, children: [_jsx(Button, { variant: "invisible", sx: { alignSelf: 'flex-start' }, onClick: () => setHasData(false), children: "\u2190 New Search" }), surfaces.map(surface => (_jsx(Box, { sx: {
169
+ }, children: [_jsxs(Text, { sx: { color: 'danger.fg' }, children: ["\u26A0\uFE0F ", error] }), _jsx(Button, { onClick: handleRetry, disabled: !lastQuery, children: "Retry" })] })), !isLoading && hasData && !error && (_jsxs(Box, { style: themeStyle, sx: {
170
+ ...A2UI_RENDER_SCOPE_SX,
171
+ display: 'flex',
172
+ flexDirection: 'column',
173
+ gap: 3,
174
+ }, children: [_jsx(Button, { variant: "invisible", sx: { alignSelf: 'flex-start' }, onClick: () => setHasData(false), children: "\u2190 New Search" }), surfaces.map(surface => (_jsx(Box, { sx: {
160
175
  border: '1px solid',
161
176
  borderColor: 'border.default',
162
177
  borderRadius: 1,
163
178
  p: 3,
164
- }, children: _jsx(A2uiSurface, { surface: surface }) }, surface.id)))] }))] }), _jsx(Box, { sx: {
179
+ }, children: _jsx(A2uiSurfaceComposed, { surface: surface }) }, surface.id)))] }))] }), _jsx(Box, { sx: {
165
180
  p: 2,
166
181
  borderTop: '1px solid',
167
182
  borderColor: 'border.default',
168
183
  backgroundColor: 'canvas.subtle',
169
184
  textAlign: 'center',
170
- }, children: _jsxs(Text, { sx: { fontSize: '0.75rem', color: 'fg.muted' }, children: ["Backend: ", A2UI_RESTAURANT_ENDPOINT] }) })] }) }) }));
185
+ }, children: _jsxs(Text, { sx: { fontSize: '0.75rem', color: 'fg.muted' }, children: ["Backend: ", a2uiRestaurantEndpoint] }) })] }) }) }));
171
186
  };
172
187
  export default A2UiRestaurantExample;
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import { useCallback, useEffect, useMemo, useState } from 'react';
7
7
  import { Box } from '@datalayer/primer-addons';
8
8
  import { SegmentedControl, Text } from '@primer/react';
9
- import { A2uiSurface } from '@a2ui/react/v0_9';
9
+ import { A2UI_RENDER_SCOPE_SX, A2uiSurfaceComposed } from '../components/a2ui';
10
10
  import { ThemedProvider } from './utils/themedProvider';
11
11
  import { A2uiMarkdownProvider } from './utils/a2uiMarkdownProvider';
12
12
  import { createSceneMessages, useA2uiProcessor } from './utils/a2ui';
@@ -264,9 +264,75 @@ const SCENES = [
264
264
  ],
265
265
  }),
266
266
  },
267
+ {
268
+ id: 'shipping',
269
+ label: 'Shipping Status',
270
+ emoji: '📦',
271
+ description: 'Order fulfillment timeline with current package state.',
272
+ messages: createSceneMessages({
273
+ surfaceId: 'viewer-shipping',
274
+ components: [
275
+ { id: 'root', component: 'Card', child: 'main' },
276
+ {
277
+ id: 'main',
278
+ component: 'Column',
279
+ children: [
280
+ 'title-row',
281
+ 'tracking',
282
+ 'divider',
283
+ 'status-1',
284
+ 'status-2',
285
+ 'status-3',
286
+ 'eta',
287
+ ],
288
+ },
289
+ {
290
+ id: 'title-row',
291
+ component: 'Row',
292
+ align: 'center',
293
+ children: ['title-icon', 'title'],
294
+ },
295
+ { id: 'title-icon', component: 'Icon', name: 'inventory' },
296
+ {
297
+ id: 'title',
298
+ component: 'Text',
299
+ variant: 'h2',
300
+ text: 'Package Status',
301
+ },
302
+ {
303
+ id: 'tracking',
304
+ component: 'Text',
305
+ variant: 'caption',
306
+ text: { path: '/tracking' },
307
+ },
308
+ { id: 'divider', component: 'Divider' },
309
+ { id: 'status-1', component: 'Text', text: { path: '/statusPlaced' } },
310
+ { id: 'status-2', component: 'Text', text: { path: '/statusShipped' } },
311
+ {
312
+ id: 'status-3',
313
+ component: 'Text',
314
+ variant: 'h3',
315
+ text: { path: '/statusDelivery' },
316
+ },
317
+ {
318
+ id: 'eta',
319
+ component: 'Text',
320
+ variant: 'caption',
321
+ text: { path: '/eta' },
322
+ },
323
+ ],
324
+ value: {
325
+ tracking: 'Tracking: 17999AA10123456784',
326
+ statusPlaced: '✓ Order Placed',
327
+ statusShipped: '✓ Shipped',
328
+ statusDelivery: '🚚 Out for Delivery',
329
+ eta: 'Estimated delivery: Today by 8 PM',
330
+ },
331
+ }),
332
+ },
267
333
  ];
268
334
  function ViewerContent({ onAction, }) {
269
- const { surfaces, processMessages, resetSurfaces } = useA2uiProcessor(onAction);
335
+ const { surfaces, processMessages, resetSurfaces, themeStyle } = useA2uiProcessor(onAction);
270
336
  const [selectedSceneId, setSelectedSceneId] = useState(SCENES[0].id);
271
337
  const selectedScene = useMemo(() => SCENES.find(scene => scene.id === selectedSceneId) ?? SCENES[0], [selectedSceneId]);
272
338
  useEffect(() => {
@@ -283,7 +349,13 @@ function ViewerContent({ onAction, }) {
283
349
  display: 'flex',
284
350
  flexDirection: 'column',
285
351
  gap: 3,
286
- }, children: [_jsx(Text, { sx: { fontSize: 2, fontWeight: 'bold' }, children: "Select Scene" }), _jsx(SegmentedControl, { "aria-label": "A2UI viewer scene picker", fullWidth: true, children: SCENES.map(scene => (_jsx(SegmentedControl.Button, { selected: scene.id === selectedSceneId, onClick: () => setSelectedSceneId(scene.id), children: `${scene.emoji} ${scene.label}` }, scene.id))) }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: selectedScene.description })] }), _jsx(Box, { sx: { width: '100%', display: 'flex', flexDirection: 'column', gap: 3 }, children: surfaces.map(surface => (_jsx(Box, { sx: { width: '100%' }, children: _jsx(A2uiSurface, { surface: surface }) }, surface.id))) })] }));
352
+ }, children: [_jsx(Text, { sx: { fontSize: 2, fontWeight: 'bold' }, children: "Select Scene" }), _jsx(SegmentedControl, { "aria-label": "A2UI viewer scene picker", fullWidth: true, children: SCENES.map(scene => (_jsx(SegmentedControl.Button, { selected: scene.id === selectedSceneId, onClick: () => setSelectedSceneId(scene.id), children: `${scene.emoji} ${scene.label}` }, scene.id))) }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: selectedScene.description })] }), _jsx(Box, { style: themeStyle, sx: {
353
+ ...A2UI_RENDER_SCOPE_SX,
354
+ width: '100%',
355
+ display: 'flex',
356
+ flexDirection: 'column',
357
+ gap: 3,
358
+ }, children: surfaces.map(surface => (_jsx(Box, { sx: { width: '100%' }, children: _jsx(A2uiSurfaceComposed, { surface: surface }) }, surface.id))) })] }));
287
359
  }
288
360
  const A2UiViewerExample = () => {
289
361
  const [lastAction, setLastAction] = useState(null);
@@ -7,19 +7,8 @@
7
7
  *
8
8
  * This is the simplest AG-UI example showing basic chat with tool use.
9
9
  *
10
- * Backend: /api/v1/examples/agentic_chat/
10
+ * Backend: managed AG-UI agent runtime (agentspec: example-agentic-chat)
11
11
  */
12
12
  import React from 'react';
13
- /**
14
- * AgUiAgenticExample Component
15
- *
16
- * Shows a floating chat button that opens a chat popup connected to
17
- * the Agentic Chat AG-UI example.
18
- *
19
- * Features demonstrated:
20
- * - Basic AG-UI SSE streaming
21
- * - Tool calling (current_time tool)
22
- * - Floating popup interface
23
- */
24
13
  declare const AgUiAgenticExample: React.FC;
25
14
  export default AgUiAgenticExample;
@@ -1,10 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Text } from '@primer/react';
2
+ /*
3
+ * Copyright (c) 2025-2026 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ /**
7
+ * AgUiAgenticExample
8
+ *
9
+ * Demonstrates a floating chat popup that connects to the AG-UI
10
+ * Agentic Chat example backend. The agent has access to tools like
11
+ * getting the current time.
12
+ *
13
+ * This is the simplest AG-UI example showing basic chat with tool use.
14
+ *
15
+ * Backend: managed AG-UI agent runtime (agentspec: example-agentic-chat)
16
+ */
17
+ import { useMemo } from 'react';
18
+ import { Spinner, Text } from '@primer/react';
3
19
  import { Box } from '@datalayer/primer-addons';
4
20
  import { ThemedProvider } from './utils/themedProvider';
5
21
  import { ChatFloating } from '../chat';
6
- // AG-UI endpoint for agentic chat example
7
- const AGENTIC_CHAT_ENDPOINT = 'http://localhost:8765/api/v1/examples/agentic_chat/';
22
+ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
23
+ import { uniqueAgentId } from './utils/agentId';
24
+ import { useExampleAgentRuntime } from './hooks/useExampleAgentRuntime';
8
25
  /**
9
26
  * AgUiAgenticExample Component
10
27
  *
@@ -16,7 +33,22 @@ const AGENTIC_CHAT_ENDPOINT = 'http://localhost:8765/api/v1/examples/agentic_cha
16
33
  * - Tool calling (current_time tool)
17
34
  * - Floating popup interface
18
35
  */
36
+ const AGENT_NAME = 'ag-ui-agentic';
37
+ const AGENTSPEC_ID = 'example-agentic-chat';
19
38
  const AgUiAgenticExample = () => {
39
+ const baseUrl = useExampleAgentRuntimesUrl();
40
+ const agentName = useMemo(() => uniqueAgentId(AGENT_NAME), []);
41
+ const { agentId, status, error, isReady } = useExampleAgentRuntime({
42
+ exampleId: 'AgUiAgenticExample',
43
+ agentName,
44
+ specId: AGENTSPEC_ID,
45
+ agentConfig: {
46
+ protocol: 'ag-ui',
47
+ agentSpecId: AGENTSPEC_ID,
48
+ },
49
+ });
50
+ const agenticChatEndpoint = agentId != null ? `${baseUrl}/api/v1/ag-ui/${agentId}/` : undefined;
51
+ const isLoading = !isReady && status !== 'error';
20
52
  return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
21
53
  minHeight: '100vh',
22
54
  backgroundColor: 'canvas.default',
@@ -32,24 +64,36 @@ const AgUiAgenticExample = () => {
32
64
  fontSize: 2,
33
65
  color: 'fg.muted',
34
66
  marginBottom: 4,
35
- }, children: "Click the chat button in the bottom-right corner to start a conversation with an AI agent that can use tools." }), _jsxs(Box, { sx: {
67
+ }, children: "Click the chat button in the bottom-right corner to start a conversation with an AI agent. The runtime target (local or cloud) follows your selection in the examples header." }), isLoading && (_jsxs(Box, { sx: {
68
+ display: 'flex',
69
+ alignItems: 'center',
70
+ gap: 2,
71
+ marginBottom: 3,
72
+ }, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Starting managed agent runtime..." })] })), error && (_jsx(Box, { sx: {
73
+ padding: 3,
74
+ marginBottom: 3,
75
+ backgroundColor: 'danger.subtle',
76
+ borderRadius: 2,
77
+ border: '1px solid',
78
+ borderColor: 'danger.muted',
79
+ }, children: _jsxs(Text, { sx: { color: 'danger.fg', fontSize: 1 }, children: ["Failed to initialize managed agent runtime: ", error] }) })), _jsxs(Box, { sx: {
36
80
  padding: 4,
37
81
  backgroundColor: 'canvas.subtle',
38
82
  borderRadius: 2,
39
83
  border: '1px solid',
40
84
  borderColor: 'border.default',
41
- }, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Available Tools" }), _jsx(Box, { as: "ul", sx: { paddingLeft: 3 }, children: _jsxs(Box, { as: "li", sx: { marginBottom: 1 }, children: [_jsx(Text, { sx: { fontFamily: 'mono', fontSize: 1 }, children: "current_time()" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: [' ', "- Returns the current date and time"] })] }) }), _jsx(Text, { as: "p", sx: {
85
+ }, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "Runtime Mode" }), _jsx(Box, { as: "ul", sx: { paddingLeft: 3 }, children: _jsxs(Box, { as: "li", sx: { marginBottom: 1 }, children: [_jsx(Text, { sx: { fontFamily: 'mono', fontSize: 1 }, children: "managed runtime + managed agent" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: [' ', "- Launches on cloud when the header target is set to cloud"] })] }) }), _jsx(Text, { as: "p", sx: {
42
86
  fontSize: 1,
43
87
  color: 'fg.muted',
44
88
  marginTop: 3,
45
- }, children: "Try asking: \"What time is it?\" or \"What's the current date?\"" })] }), _jsxs(Box, { sx: {
89
+ }, children: "Try asking: \"hi\" or \"what can you help with?\"" })] }), _jsxs(Box, { sx: {
46
90
  marginTop: 4,
47
91
  padding: 4,
48
92
  backgroundColor: 'canvas.subtle',
49
93
  borderRadius: 2,
50
94
  border: '1px solid',
51
95
  borderColor: 'border.default',
52
- }, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "About This Example" }), _jsx(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted' }, children: "This example demonstrates the AG-UI (Agent User Interface) protocol for streaming AI interactions. The agent uses SSE (Server-Sent Events) to stream responses and tool calls in real-time." }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted', marginTop: 2 }, children: [_jsx("strong", { children: "Protocol Events:" }), " TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, TEXT_MESSAGE_END, TOOL_CALL_START, TOOL_CALL_END"] })] })] }), _jsx(ChatFloating, { protocol: "ag-ui", endpoint: AGENTIC_CHAT_ENDPOINT, title: "Agentic Chat", description: "Chat with an AI agent that can use tools like getting the current time.", position: "bottom-right", defaultOpen: true, suggestions: [
96
+ }, children: [_jsx(Text, { as: "h2", sx: { fontSize: 2, fontWeight: 'semibold', marginBottom: 2 }, children: "About This Example" }), _jsx(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted' }, children: "This example demonstrates the AG-UI (Agent User Interface) protocol for streaming AI interactions. The agent uses SSE (Server-Sent Events) to stream responses and tool calls in real-time." }), _jsxs(Text, { as: "p", sx: { fontSize: 1, color: 'fg.muted', marginTop: 2 }, children: [_jsx("strong", { children: "Protocol Events:" }), " TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, TEXT_MESSAGE_END, TOOL_CALL_START, TOOL_CALL_END"] })] })] }), agenticChatEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: agenticChatEndpoint, title: "Agentic Chat", description: "Chat with a managed AG-UI agent runtime.", position: "bottom-right", defaultOpen: true, suggestions: [
53
97
  {
54
98
  title: 'What time is it?',
55
99
  message: 'What is the current time?',
@@ -58,6 +102,6 @@ const AgUiAgenticExample = () => {
58
102
  title: "Today's date",
59
103
  message: "What's the current date?",
60
104
  },
61
- ] })] }) }));
105
+ ] }))] }) }));
62
106
  };
63
107
  export default AgUiAgenticExample;
@@ -8,23 +8,8 @@
8
8
  * and renders beautiful weather cards directly in the chat conversation,
9
9
  * similar to the AG-UI Dojo implementation.
10
10
  *
11
- * Backend: /api/v1/examples/backend_tool_rendering/
11
+ * Backend: managed AG-UI agent runtime (agentspec: example-backend-tool-rendering)
12
12
  */
13
13
  import React from 'react';
14
- /**
15
- * AgUiBackendToolRenderingExample Component
16
- *
17
- * Demonstrates backend tool rendering with AG-UI.
18
- * The agent has a `get_weather` tool that calls the Open-Meteo API
19
- * and returns weather data. This data is rendered INLINE in the chat
20
- * as a beautiful weather card with dynamic theming.
21
- *
22
- * Features demonstrated:
23
- * - Backend tool execution
24
- * - Real API integration (Open-Meteo)
25
- * - INLINE rendering of tool results in chat
26
- * - Dynamic theming based on weather conditions
27
- * - Loading states while fetching data
28
- */
29
14
  declare const AgUiBackendToolRenderingExample: React.FC;
30
15
  export default AgUiBackendToolRenderingExample;
@@ -13,29 +13,28 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  * and renders beautiful weather cards directly in the chat conversation,
14
14
  * similar to the AG-UI Dojo implementation.
15
15
  *
16
- * Backend: /api/v1/examples/backend_tool_rendering/
16
+ * Backend: managed AG-UI agent runtime (agentspec: example-backend-tool-rendering)
17
17
  */
18
- import { useCallback } from 'react';
18
+ import { useCallback, useMemo } from 'react';
19
19
  import { Text } 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
23
  import { InlineWeatherCard } from './components/weather';
24
- // AG-UI endpoint for backend tool rendering example
25
- const BACKEND_TOOL_RENDERING_ENDPOINT = 'http://localhost:8765/api/v1/examples/backend_tool_rendering/';
24
+ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
25
+ import { uniqueAgentId } from './utils/agentId';
26
+ import { useExampleAgentRuntime } from './hooks/useExampleAgentRuntime';
27
+ import { useSpecRenderToolResult, specRendererClassName, } from './hooks/useSpecRenderToolResult';
26
28
  /**
27
- * Render function for tool results - renders weather cards inline in chat
29
+ * Renderers for this example, keyed by the spec's renderer id. The tool name to
30
+ * match and the CSS file to load come from the agent spec, not from this file.
28
31
  */
29
- const renderWeatherToolResult = (context) => {
30
- // Only render for the get_weather tool
31
- if (context.toolName !== 'get_weather') {
32
- return null;
33
- }
34
- // Extract location from args
35
- const location = context.args?.location;
36
- // Cast result to WeatherResult if available
37
- const weatherResult = context.result;
38
- return (_jsx(InlineWeatherCard, { location: location, result: weatherResult, status: context.status, error: context.error }));
32
+ const weatherRenderers = {
33
+ 'weather-card': (context, binding) => {
34
+ const location = context.args?.location;
35
+ const weatherResult = context.result;
36
+ return (_jsx("div", { className: specRendererClassName(binding), children: _jsx(InlineWeatherCard, { location: location, result: weatherResult, status: context.status, error: context.error }) }));
37
+ },
39
38
  };
40
39
  /**
41
40
  * AgUiBackendToolRenderingExample Component
@@ -52,8 +51,24 @@ const renderWeatherToolResult = (context) => {
52
51
  * - Dynamic theming based on weather conditions
53
52
  * - Loading states while fetching data
54
53
  */
54
+ const AGENT_NAME = 'ag-ui-backend-tools';
55
+ const AGENTSPEC_ID = 'example-backend-tool-rendering';
55
56
  const AgUiBackendToolRenderingExample = () => {
56
57
  const brandColor = useThemeBrandColor();
58
+ const baseUrl = useExampleAgentRuntimesUrl();
59
+ const agentName = useMemo(() => uniqueAgentId(AGENT_NAME), []);
60
+ const { agentId } = useExampleAgentRuntime({
61
+ exampleId: 'AgUiBackendToolRenderingExample',
62
+ agentName,
63
+ specId: AGENTSPEC_ID,
64
+ agentConfig: {
65
+ protocol: 'ag-ui',
66
+ agentSpecId: AGENTSPEC_ID,
67
+ },
68
+ });
69
+ const backendToolRenderingEndpoint = agentId != null ? `${baseUrl}/api/v1/ag-ui/${agentId}/` : undefined;
70
+ // Tool name to match and CSS file to load are read from the agent spec.
71
+ const renderToolResult = useSpecRenderToolResult(AGENTSPEC_ID, weatherRenderers);
57
72
  // Optional: still track weather for sidebar display if needed
58
73
  const handleStateUpdate = useCallback((_state) => {
59
74
  // State updates are still available if needed for other purposes
@@ -90,7 +105,7 @@ const AgUiBackendToolRenderingExample = () => {
90
105
  marginTop: 1,
91
106
  fontSize: 1,
92
107
  color: 'fg.muted',
93
- }, children: [_jsx("li", { children: "\"What's the weather in New York?\"" }), _jsx("li", { children: "\"Weather in London and Paris\"" }), _jsx("li", { children: "\"Is it sunny in Sydney?\"" }), _jsx("li", { children: "\"How's the weather in Tokyo today?\"" })] })] })] })] }), _jsx(ChatFloating, { protocol: "ag-ui", endpoint: BACKEND_TOOL_RENDERING_ENDPOINT, title: "Weather Assistant", description: "Ask me about the weather anywhere in the world!", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, renderToolResult: renderWeatherToolResult, suggestions: [
108
+ }, children: [_jsx("li", { children: "\"What's the weather in New York?\"" }), _jsx("li", { children: "\"Weather in London and Paris\"" }), _jsx("li", { children: "\"Is it sunny in Sydney?\"" }), _jsx("li", { children: "\"How's the weather in Tokyo today?\"" })] })] })] })] }), backendToolRenderingEndpoint && (_jsx(ChatFloating, { protocol: "ag-ui", endpoint: backendToolRenderingEndpoint, title: "Weather Assistant", description: "Ask me about the weather anywhere in the world!", position: "bottom-right", brandColor: brandColor, onStateUpdate: handleStateUpdate, renderToolResult: renderToolResult, suggestions: [
94
109
  {
95
110
  title: 'Paris weather',
96
111
  message: "What's the weather like in Paris?",
@@ -99,6 +114,6 @@ const AgUiBackendToolRenderingExample = () => {
99
114
  title: 'Tokyo forecast',
100
115
  message: 'Show me the weather forecast for Tokyo.',
101
116
  },
102
- ] })] }) }));
117
+ ] }))] }) }));
103
118
  };
104
119
  export default AgUiBackendToolRenderingExample;
@@ -9,7 +9,7 @@
9
9
  * This follows the AG-UI Dojo pattern where tool results are rendered
10
10
  * as UI components in both locations.
11
11
  *
12
- * Backend: /api/v1/examples/haiku_generative_ui/
12
+ * Backend: managed AG-UI agent runtime (agentspec: example-haiku-generative-ui)
13
13
  */
14
14
  import React from 'react';
15
15
  import { type HaikuResult } from './components/haiku';
@@ -24,21 +24,5 @@ export interface HaikuDisplayHandle {
24
24
  /** Clear all haikus */
25
25
  clearHaikus: () => void;
26
26
  }
27
- /**
28
- * AgUiHaikuGenUiExample Component
29
- *
30
- * Demonstrates tool-based generative UI with haiku generation.
31
- * The agent has a `generate_haiku` tool that returns structured
32
- * haiku data. This data is rendered:
33
- * - INLINE in the chat as a haiku card
34
- * - In the main view as part of a carousel
35
- *
36
- * Features demonstrated:
37
- * - Tool-based generative UI
38
- * - Ref-based state synchronization between chat and main view
39
- * - Carousel display for multiple haikus
40
- * - Dynamic gradient backgrounds
41
- * - Japanese/English text rendering
42
- */
43
27
  declare const AgUiHaikuGenUiExample: React.FC;
44
28
  export default AgUiHaikuGenUiExample;
@@ -14,16 +14,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  * This follows the AG-UI Dojo pattern where tool results are rendered
15
15
  * as UI components in both locations.
16
16
  *
17
- * Backend: /api/v1/examples/haiku_generative_ui/
17
+ * Backend: managed AG-UI agent runtime (agentspec: example-haiku-generative-ui)
18
18
  */
19
- import { useState, useCallback, useRef, useImperativeHandle, forwardRef, } from 'react';
19
+ import { useState, useMemo, useRef, useImperativeHandle, forwardRef, } from 'react';
20
20
  import { Text } from '@primer/react';
21
21
  import { Box } from '@datalayer/primer-addons';
22
22
  import { ThemedProvider, useThemeBrandColor } from './utils/themedProvider';
23
23
  import { ChatFloating } from '../chat';
24
24
  import { InlineHaikuCard, HaikuDisplay, } from './components/haiku';
25
- // AG-UI endpoint for haiku generative UI example
26
- const HAIKU_ENDPOINT = 'http://localhost:8765/api/v1/examples/haiku_generative_ui/';
25
+ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
26
+ import { uniqueAgentId } from './utils/agentId';
27
+ import { useExampleAgentRuntime } from './hooks/useExampleAgentRuntime';
28
+ import { useSpecRenderToolResult, specRendererClassName, } from './hooks/useSpecRenderToolResult';
27
29
  /**
28
30
  * HaikuDisplayWithRef - A display component that exposes a ref for external control.
29
31
  *
@@ -59,43 +61,57 @@ HaikuDisplayWithRef.displayName = 'HaikuDisplayWithRef';
59
61
  * - Dynamic gradient backgrounds
60
62
  * - Japanese/English text rendering
61
63
  */
64
+ const AGENT_NAME = 'ag-ui-haiku';
65
+ const AGENTSPEC_ID = 'example-haiku-generative-ui';
62
66
  const AgUiHaikuGenUiExample = () => {
63
67
  const brandColor = useThemeBrandColor();
68
+ const baseUrl = useExampleAgentRuntimesUrl();
69
+ const agentName = useMemo(() => uniqueAgentId(AGENT_NAME), []);
70
+ const { agentId } = useExampleAgentRuntime({
71
+ exampleId: 'AgUiHaikuGenUiExample',
72
+ agentName,
73
+ specId: AGENTSPEC_ID,
74
+ agentConfig: {
75
+ protocol: 'ag-ui',
76
+ agentSpecId: AGENTSPEC_ID,
77
+ },
78
+ });
79
+ const haikuGenUiEndpoint = agentId != null ? `${baseUrl}/api/v1/ag-ui/${agentId}/` : undefined;
64
80
  // Ref to the main display for adding haikus
65
81
  const displayRef = useRef(null);
66
82
  // Track processed tool call IDs to avoid duplicates
67
83
  const processedToolCallIds = useRef(new Set());
68
84
  /**
69
- * Render function for tool results - renders haiku cards inline in chat
70
- * and also updates the main display
85
+ * Renderers keyed by the spec's renderer id. The tool name to match and the
86
+ * CSS file to load come from the agent spec, not from this file.
71
87
  */
72
- const renderHaikuToolResult = useCallback((context) => {
73
- // Only render for the generate_haiku tool
74
- if (context.toolName !== 'generate_haiku') {
75
- return null;
76
- }
77
- // Extract haiku data from args (the tool's parameters are what we render)
78
- const args = context.args;
79
- // Build haiku result from args
80
- const haiku = args.japanese && args.english
81
- ? {
82
- japanese: args.japanese,
83
- english: args.english,
84
- gradient: args.gradient ||
85
- 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
88
+ const haikuRenderers = useMemo(() => ({
89
+ 'haiku-card': (context, binding) => {
90
+ // Extract haiku data from args (the tool parameters are what we render)
91
+ const args = context.args;
92
+ // Build haiku result from args
93
+ const haiku = args.japanese && args.english
94
+ ? {
95
+ japanese: args.japanese,
96
+ english: args.english,
97
+ gradient: args.gradient ||
98
+ 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
99
+ }
100
+ : undefined;
101
+ // When tool completes successfully, add to main display (deduplicated)
102
+ if (context.status === 'complete' &&
103
+ haiku &&
104
+ displayRef.current &&
105
+ context.toolCallId &&
106
+ !processedToolCallIds.current.has(context.toolCallId)) {
107
+ processedToolCallIds.current.add(context.toolCallId);
108
+ displayRef.current.addHaiku(haiku);
86
109
  }
87
- : undefined;
88
- // When tool completes successfully, add to main display (deduplicated)
89
- if (context.status === 'complete' &&
90
- haiku &&
91
- displayRef.current &&
92
- context.toolCallId &&
93
- !processedToolCallIds.current.has(context.toolCallId)) {
94
- processedToolCallIds.current.add(context.toolCallId);
95
- displayRef.current.addHaiku(haiku);
96
- }
97
- return (_jsx(InlineHaikuCard, { haiku: haiku, status: context.status, error: context.error }));
98
- }, []);
110
+ return (_jsx("div", { className: specRendererClassName(binding), children: _jsx(InlineHaikuCard, { haiku: haiku, status: context.status, error: context.error }) }));
111
+ },
112
+ }), []);
113
+ // Tool name to match and CSS file to load are read from the agent spec.
114
+ const renderToolResult = useSpecRenderToolResult(AGENTSPEC_ID, haikuRenderers);
99
115
  return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
100
116
  minHeight: '100vh',
101
117
  backgroundColor: 'canvas.default',
@@ -134,7 +150,7 @@ const AgUiHaikuGenUiExample = () => {
134
150
  marginTop: 1,
135
151
  fontSize: 1,
136
152
  color: 'fg.muted',
137
- }, children: [_jsx("li", { children: "\"Write me a haiku about cherry blossoms\"" }), _jsx("li", { children: "\"Create a haiku about coding late at night\"" }), _jsx("li", { children: "\"Generate a haiku about the ocean\"" }), _jsx("li", { children: "\"Write a haiku about autumn leaves\"" })] })] })] })] }), _jsx(ChatFloating, { protocol: "ag-ui", endpoint: HAIKU_ENDPOINT, title: "Haiku Generator", description: "Ask me to write haiku poetry about any topic!", position: "bottom-right", brandColor: brandColor, defaultOpen: true, renderToolResult: renderHaikuToolResult, hideMessagesAfterToolUI: true, suggestions: [
153
+ }, children: [_jsx("li", { children: "\"Write me a haiku about cherry blossoms\"" }), _jsx("li", { children: "\"Create a haiku about coding late at night\"" }), _jsx("li", { children: "\"Generate a haiku about the ocean\"" }), _jsx("li", { children: "\"Write a haiku about autumn leaves\"" })] })] })] })] }), _jsx(ChatFloating, { protocol: "ag-ui", endpoint: haikuGenUiEndpoint, launching: !haikuGenUiEndpoint, launchingMessage: "Starting the haiku agent runtime\u2026", title: "Haiku Generator", description: "Ask me to write haiku poetry about any topic!", position: "bottom-right", brandColor: brandColor, defaultOpen: true, renderToolResult: renderToolResult, hideMessagesAfterToolUI: true, suggestions: [
138
154
  {
139
155
  title: 'Cherry blossoms',
140
156
  message: 'Write me a haiku about cherry blossoms in spring.',