@datalayer/agent-runtimes 1.0.4 → 1.0.6

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 (299) hide show
  1. package/README.md +182 -1
  2. package/lib/AgentNode.d.ts +3 -0
  3. package/lib/AgentNode.js +676 -0
  4. package/lib/App.js +1 -1
  5. package/lib/agent-node/themeStore.d.ts +3 -0
  6. package/lib/agent-node/themeStore.js +156 -0
  7. package/lib/agent-node-main.d.ts +1 -0
  8. package/lib/agent-node-main.js +14 -0
  9. package/lib/agents/AgentDetails.d.ts +22 -1
  10. package/lib/agents/AgentDetails.js +34 -47
  11. package/lib/api/index.d.ts +0 -1
  12. package/lib/api/index.js +4 -2
  13. package/lib/chat/Chat.d.ts +5 -106
  14. package/lib/chat/Chat.js +20 -14
  15. package/lib/chat/ChatFloating.d.ts +7 -140
  16. package/lib/chat/ChatFloating.js +3 -3
  17. package/lib/chat/ChatPopupStandalone.d.ts +8 -47
  18. package/lib/chat/ChatPopupStandalone.js +3 -3
  19. package/lib/chat/ChatSidebar.d.ts +4 -69
  20. package/lib/chat/ChatSidebar.js +83 -51
  21. package/lib/chat/ChatStandalone.d.ts +4 -54
  22. package/lib/chat/ChatStandalone.js +3 -3
  23. package/lib/chat/base/ChatBase.js +1414 -174
  24. package/lib/chat/display/FloatingBrandButton.js +8 -1
  25. package/lib/chat/header/ChatHeader.d.ts +3 -1
  26. package/lib/chat/header/ChatHeader.js +15 -12
  27. package/lib/chat/header/ChatHeaderBase.d.ts +30 -5
  28. package/lib/chat/header/ChatHeaderBase.js +41 -16
  29. package/lib/chat/indicators/McpStatusIndicator.d.ts +7 -4
  30. package/lib/chat/indicators/McpStatusIndicator.js +7 -32
  31. package/lib/chat/indicators/SandboxStatusIndicator.d.ts +4 -1
  32. package/lib/chat/indicators/SandboxStatusIndicator.js +91 -56
  33. package/lib/chat/indicators/SkillsStatusIndicator.d.ts +7 -0
  34. package/lib/chat/indicators/SkillsStatusIndicator.js +88 -0
  35. package/lib/chat/indicators/index.d.ts +1 -0
  36. package/lib/chat/indicators/index.js +1 -0
  37. package/lib/chat/messages/ChatMessageList.d.ts +1 -1
  38. package/lib/chat/messages/ChatMessageList.js +154 -114
  39. package/lib/chat/messages/ChatMessages.js +6 -2
  40. package/lib/chat/prompt/InputFooter.d.ts +21 -6
  41. package/lib/chat/prompt/InputFooter.js +76 -20
  42. package/lib/chat/prompt/InputPrompt.d.ts +5 -1
  43. package/lib/chat/prompt/InputPrompt.js +4 -4
  44. package/lib/chat/prompt/InputPromptFooter.d.ts +3 -1
  45. package/lib/chat/prompt/InputPromptFooter.js +3 -3
  46. package/lib/chat/prompt/InputPromptLexical.d.ts +3 -1
  47. package/lib/chat/prompt/InputPromptLexical.js +12 -5
  48. package/lib/chat/prompt/InputPromptText.d.ts +3 -1
  49. package/lib/chat/prompt/InputPromptText.js +2 -2
  50. package/lib/chat/tools/ToolApprovalBanner.js +1 -1
  51. package/lib/chat/tools/ToolCallDisplay.d.ts +3 -1
  52. package/lib/chat/tools/ToolCallDisplay.js +2 -2
  53. package/lib/chat/usage/TokenUsageBar.js +20 -2
  54. package/lib/client/AgentRuntimesClientContext.d.ts +53 -0
  55. package/lib/client/AgentRuntimesClientContext.js +55 -0
  56. package/lib/client/AgentsMixin.d.ts +0 -18
  57. package/lib/client/AgentsMixin.js +20 -30
  58. package/lib/client/IAgentRuntimesClient.d.ts +215 -0
  59. package/lib/client/IAgentRuntimesClient.js +5 -0
  60. package/lib/client/SdkAgentRuntimesClient.d.ts +151 -0
  61. package/lib/client/SdkAgentRuntimesClient.js +134 -0
  62. package/lib/client/index.d.ts +4 -1
  63. package/lib/client/index.js +3 -1
  64. package/lib/components/NotificationEventCard.js +5 -1
  65. package/lib/config/AgentConfiguration.d.ts +22 -0
  66. package/lib/config/AgentConfiguration.js +319 -64
  67. package/lib/context/ContextDistribution.d.ts +3 -1
  68. package/lib/context/ContextDistribution.js +8 -27
  69. package/lib/context/ContextInspector.d.ts +3 -1
  70. package/lib/context/ContextInspector.js +19 -67
  71. package/lib/context/ContextPanel.d.ts +3 -1
  72. package/lib/context/ContextPanel.js +104 -64
  73. package/lib/context/ContextUsage.d.ts +3 -1
  74. package/lib/context/ContextUsage.js +3 -3
  75. package/lib/context/CostTracker.d.ts +9 -3
  76. package/lib/context/CostTracker.js +26 -47
  77. package/lib/context/CostUsageChart.d.ts +12 -0
  78. package/lib/context/CostUsageChart.js +378 -0
  79. package/lib/context/GraphFlowChart.d.ts +16 -0
  80. package/lib/context/GraphFlowChart.js +182 -0
  81. package/lib/context/TokenUsageChart.d.ts +8 -1
  82. package/lib/context/TokenUsageChart.js +349 -211
  83. package/lib/context/TurnGraphChart.d.ts +39 -0
  84. package/lib/context/TurnGraphChart.js +538 -0
  85. package/lib/context/otelWsPool.d.ts +20 -0
  86. package/lib/context/otelWsPool.js +69 -0
  87. package/lib/examples/A2UiComponentGalleryExample.d.ts +0 -17
  88. package/lib/examples/A2UiComponentGalleryExample.js +315 -522
  89. package/lib/examples/A2UiContactCardExample.d.ts +0 -18
  90. package/lib/examples/A2UiContactCardExample.js +154 -411
  91. package/lib/examples/A2UiRestaurantExample.d.ts +0 -30
  92. package/lib/examples/A2UiRestaurantExample.js +114 -212
  93. package/lib/examples/A2UiViewerExample.d.ts +0 -18
  94. package/lib/examples/A2UiViewerExample.js +283 -532
  95. package/lib/examples/AgUiBackendToolRenderingExample.js +1 -1
  96. package/lib/examples/AgUiHaikuGenUiExample.d.ts +1 -1
  97. package/lib/examples/AgUiHaikuGenUiExample.js +1 -1
  98. package/lib/examples/AgUiSharedStateExample.js +2 -1
  99. package/lib/examples/AgentCheckpointsExample.js +14 -28
  100. package/lib/examples/AgentCodemodeExample.d.ts +4 -6
  101. package/lib/examples/AgentCodemodeExample.js +603 -169
  102. package/lib/examples/AgentEvalsExample.js +339 -53
  103. package/lib/examples/AgentGuardrailsExample.js +383 -66
  104. package/lib/examples/AgentHooksExample.d.ts +3 -0
  105. package/lib/examples/AgentHooksExample.js +122 -0
  106. package/lib/examples/AgentInferenceProviderExample.d.ts +3 -0
  107. package/lib/examples/AgentInferenceProviderExample.js +329 -0
  108. package/lib/examples/AgentMCPExample.d.ts +3 -0
  109. package/lib/examples/AgentMCPExample.js +481 -0
  110. package/lib/examples/AgentMemoryExample.d.ts +1 -2
  111. package/lib/examples/AgentMemoryExample.js +78 -33
  112. package/lib/examples/AgentMonitoringExample.js +261 -200
  113. package/lib/examples/AgentNotificationsExample.d.ts +1 -2
  114. package/lib/examples/AgentNotificationsExample.js +114 -33
  115. package/lib/examples/AgentOtelExample.js +32 -42
  116. package/lib/examples/AgentOutputsExample.d.ts +11 -6
  117. package/lib/examples/AgentOutputsExample.js +433 -81
  118. package/lib/examples/AgentParametersExample.d.ts +3 -0
  119. package/lib/examples/AgentParametersExample.js +248 -0
  120. package/lib/examples/AgentSandboxExample.d.ts +3 -3
  121. package/lib/examples/AgentSandboxExample.js +74 -45
  122. package/lib/examples/AgentSkillsExample.js +95 -103
  123. package/lib/examples/AgentSubagentsExample.d.ts +14 -0
  124. package/lib/examples/AgentSubagentsExample.js +228 -0
  125. package/lib/examples/AgentToolApprovalsExample.js +49 -561
  126. package/lib/examples/AgentTriggersExample.js +823 -569
  127. package/lib/examples/{AgentspecExample.d.ts → AgentspecsExample.d.ts} +2 -2
  128. package/lib/examples/AgentspecsExample.js +1096 -0
  129. package/lib/examples/ChatCustomExample.js +16 -28
  130. package/lib/examples/ChatExample.js +13 -29
  131. package/lib/examples/CopilotKitLexicalExample.js +2 -1
  132. package/lib/examples/CopilotKitNotebookExample.js +2 -1
  133. package/lib/examples/HomeExample.d.ts +15 -0
  134. package/lib/examples/HomeExample.js +77 -0
  135. package/lib/examples/Lexical2Example.js +4 -2
  136. package/lib/examples/{LexicalExample.d.ts → LexicalAgentExample.d.ts} +4 -4
  137. package/lib/examples/{LexicalExample.js → LexicalAgentExample.js} +66 -17
  138. package/lib/examples/{LexicalSidebarExample.d.ts → LexicalAgentSidebarExample.d.ts} +5 -5
  139. package/lib/examples/LexicalAgentSidebarExample.js +261 -0
  140. package/lib/examples/NotebookAgentExample.d.ts +9 -0
  141. package/lib/examples/NotebookAgentExample.js +192 -0
  142. package/lib/examples/{NotebookSidebarExample.d.ts → NotebookAgentSidebarExample.d.ts} +2 -2
  143. package/lib/examples/NotebookAgentSidebarExample.js +221 -0
  144. package/lib/examples/{DatalayerNotebookExample.d.ts → NotebookCollaborationExample.d.ts} +4 -4
  145. package/lib/examples/{DatalayerNotebookExample.js → NotebookCollaborationExample.js} +3 -3
  146. package/lib/examples/NotebookExample.d.ts +4 -7
  147. package/lib/examples/NotebookExample.js +14 -146
  148. package/lib/examples/components/AuthRequiredView.d.ts +6 -0
  149. package/lib/examples/components/AuthRequiredView.js +33 -0
  150. package/lib/examples/components/ExampleWrapper.d.ts +9 -3
  151. package/lib/examples/components/ExampleWrapper.js +45 -9
  152. package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.js +1 -1
  153. package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.js +1 -1
  154. package/lib/examples/{ag-ui → components}/haiku/index.d.ts +1 -1
  155. package/lib/examples/{ag-ui → components}/haiku/index.js +1 -1
  156. package/lib/examples/components/index.d.ts +3 -0
  157. package/lib/examples/components/index.js +4 -0
  158. package/lib/examples/{ag-ui → components}/weather/index.d.ts +1 -1
  159. package/lib/examples/{ag-ui → components}/weather/index.js +1 -1
  160. package/lib/examples/example-selector.d.ts +17 -4
  161. package/lib/examples/example-selector.js +108 -41
  162. package/lib/examples/index.d.ts +10 -6
  163. package/lib/examples/index.js +10 -6
  164. package/lib/examples/lexical/initial-content.json +6 -6
  165. package/lib/examples/main.js +257 -27
  166. package/lib/examples/utils/a2ui.d.ts +18 -0
  167. package/lib/examples/utils/a2ui.js +69 -0
  168. package/lib/examples/utils/a2uiMarkdownProvider.d.ts +7 -0
  169. package/lib/examples/utils/a2uiMarkdownProvider.js +9 -0
  170. package/lib/examples/utils/agentId.d.ts +18 -0
  171. package/lib/examples/utils/agentId.js +54 -0
  172. package/lib/examples/utils/agents/earthquake-detector.json +11 -11
  173. package/lib/examples/utils/agents/sales-forecaster.json +11 -11
  174. package/lib/examples/utils/agents/social-post-generator.json +11 -11
  175. package/lib/examples/utils/agents/stock-market.json +11 -11
  176. package/lib/examples/utils/examplesStore.js +82 -27
  177. package/lib/examples/utils/useExampleAgentRuntimesUrl.d.ts +5 -0
  178. package/lib/examples/utils/useExampleAgentRuntimesUrl.js +19 -0
  179. package/lib/hooks/index.d.ts +8 -8
  180. package/lib/hooks/index.js +7 -7
  181. package/lib/hooks/useA2A.d.ts +2 -3
  182. package/lib/hooks/useAIAgentsWebSocket.d.ts +43 -4
  183. package/lib/hooks/useAIAgentsWebSocket.js +153 -12
  184. package/lib/hooks/useAcp.d.ts +1 -2
  185. package/lib/hooks/useAgUi.d.ts +1 -1
  186. package/lib/hooks/{useAgents.d.ts → useAgentRuntimes.d.ts} +70 -4
  187. package/lib/hooks/{useAgents.js → useAgentRuntimes.js} +237 -32
  188. package/lib/hooks/useAgentsCatalog.js +1 -1
  189. package/lib/hooks/useAgentsService.d.ts +2 -2
  190. package/lib/hooks/useAgentsService.js +7 -7
  191. package/lib/hooks/useCheckpoints.js +1 -1
  192. package/lib/hooks/useConfig.d.ts +4 -1
  193. package/lib/hooks/useConfig.js +10 -3
  194. package/lib/hooks/useContextSnapshot.d.ts +9 -4
  195. package/lib/hooks/useContextSnapshot.js +9 -37
  196. package/lib/hooks/useMonitoring.js +3 -0
  197. package/lib/hooks/useSandbox.d.ts +20 -8
  198. package/lib/hooks/useSandbox.js +105 -40
  199. package/lib/hooks/useSkills.d.ts +23 -5
  200. package/lib/hooks/useSkills.js +94 -39
  201. package/lib/hooks/useToolApprovals.d.ts +60 -36
  202. package/lib/hooks/useToolApprovals.js +318 -69
  203. package/lib/hooks/useVercelAI.d.ts +1 -1
  204. package/lib/index.d.ts +2 -1
  205. package/lib/index.js +1 -0
  206. package/lib/inference/index.d.ts +0 -1
  207. package/lib/middleware/index.d.ts +0 -1
  208. package/lib/protocols/AGUIAdapter.js +6 -0
  209. package/lib/protocols/VercelAIAdapter.d.ts +7 -0
  210. package/lib/protocols/VercelAIAdapter.js +59 -7
  211. package/lib/specs/agents/agents.d.ts +21 -4
  212. package/lib/specs/agents/agents.js +2879 -316
  213. package/lib/specs/agents/index.js +3 -1
  214. package/lib/specs/benchmarks.d.ts +20 -0
  215. package/lib/specs/benchmarks.js +205 -0
  216. package/lib/specs/envvars.js +27 -20
  217. package/lib/specs/evals.d.ts +10 -9
  218. package/lib/specs/evals.js +128 -88
  219. package/lib/specs/events.d.ts +3 -10
  220. package/lib/specs/events.js +127 -84
  221. package/lib/specs/frontendTools.js +2 -2
  222. package/lib/specs/guardrails.d.ts +0 -7
  223. package/lib/specs/guardrails.js +240 -159
  224. package/lib/specs/mcpServers.js +35 -6
  225. package/lib/specs/memory.d.ts +0 -2
  226. package/lib/specs/memory.js +4 -17
  227. package/lib/specs/models.d.ts +0 -2
  228. package/lib/specs/models.js +20 -15
  229. package/lib/specs/notifications.js +102 -18
  230. package/lib/specs/outputs.js +15 -9
  231. package/lib/specs/personas.d.ts +41 -0
  232. package/lib/specs/personas.js +168 -0
  233. package/lib/specs/skills.d.ts +1 -1
  234. package/lib/specs/skills.js +23 -23
  235. package/lib/specs/teams/index.js +3 -1
  236. package/lib/specs/teams/teams.js +468 -348
  237. package/lib/specs/tools.js +4 -4
  238. package/lib/specs/triggers.js +61 -11
  239. package/lib/stores/agentRuntimeStore.d.ts +208 -0
  240. package/lib/stores/agentRuntimeStore.js +650 -0
  241. package/lib/stores/conversationStore.js +2 -2
  242. package/lib/stores/index.d.ts +1 -1
  243. package/lib/stores/index.js +1 -1
  244. package/lib/tools/adapters/copilotkit/lexicalHooks.d.ts +1 -2
  245. package/lib/tools/adapters/copilotkit/lexicalHooks.js +1 -3
  246. package/lib/tools/adapters/copilotkit/notebookHooks.d.ts +1 -2
  247. package/lib/tools/adapters/copilotkit/notebookHooks.js +1 -3
  248. package/lib/tools/index.d.ts +0 -2
  249. package/lib/tools/index.js +0 -1
  250. package/lib/types/agents-lifecycle.d.ts +18 -0
  251. package/lib/types/agents.d.ts +6 -0
  252. package/lib/types/agentspecs.d.ts +54 -1
  253. package/lib/types/benchmarks.d.ts +43 -0
  254. package/lib/types/benchmarks.js +5 -0
  255. package/lib/types/chat.d.ts +325 -8
  256. package/lib/types/context.d.ts +27 -0
  257. package/lib/types/cost.d.ts +2 -2
  258. package/lib/types/evals.d.ts +26 -17
  259. package/lib/types/index.d.ts +3 -0
  260. package/lib/types/index.js +3 -0
  261. package/lib/types/mcp.d.ts +8 -0
  262. package/lib/types/models.d.ts +2 -2
  263. package/lib/types/personas.d.ts +25 -0
  264. package/lib/types/personas.js +5 -0
  265. package/lib/types/skills.d.ts +43 -1
  266. package/lib/types/stream.d.ts +110 -0
  267. package/lib/types/stream.js +36 -0
  268. package/lib/utils/utils.d.ts +9 -5
  269. package/lib/utils/utils.js +9 -5
  270. package/package.json +19 -11
  271. package/scripts/codegen/__pycache__/generate_agents.cpython-313.pyc +0 -0
  272. package/scripts/codegen/__pycache__/generate_benchmarks.cpython-313.pyc +0 -0
  273. package/scripts/codegen/__pycache__/generate_evals.cpython-313.pyc +0 -0
  274. package/scripts/codegen/__pycache__/generate_events.cpython-313.pyc +0 -0
  275. package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
  276. package/scripts/codegen/generate_agents.py +187 -45
  277. package/scripts/codegen/generate_benchmarks.py +441 -0
  278. package/scripts/codegen/generate_evals.py +94 -16
  279. package/scripts/codegen/generate_events.py +35 -14
  280. package/scripts/codegen/generate_personas.py +319 -0
  281. package/scripts/codegen/generate_skills.py +9 -9
  282. package/scripts/sync-jupyter.sh +26 -7
  283. package/lib/api/tool-approvals.d.ts +0 -62
  284. package/lib/api/tool-approvals.js +0 -145
  285. package/lib/examples/AgentspecExample.js +0 -705
  286. package/lib/examples/LexicalSidebarExample.js +0 -163
  287. package/lib/examples/NotebookSidebarExample.js +0 -119
  288. package/lib/examples/NotebookSimpleExample.d.ts +0 -6
  289. package/lib/examples/NotebookSimpleExample.js +0 -22
  290. package/lib/examples/ag-ui/index.d.ts +0 -10
  291. package/lib/examples/ag-ui/index.js +0 -16
  292. package/lib/hooks/useAgentsRegistry.d.ts +0 -10
  293. package/lib/hooks/useAgentsRegistry.js +0 -20
  294. package/lib/stores/agentsStore.d.ts +0 -123
  295. package/lib/stores/agentsStore.js +0 -270
  296. /package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.d.ts +0 -0
  297. /package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.d.ts +0 -0
  298. /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.d.ts +0 -0
  299. /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.js +0 -0
@@ -0,0 +1,650 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Unified Zustand store for the agent-runtime layer.
7
+ *
8
+ * Manages three concerns in a single store:
9
+ *
10
+ * 1. **Agent Registry** (persisted) — URL-addressable agents that were
11
+ * previously connected. Each entry has a `baseUrl` + protocol pair.
12
+ *
13
+ * 2. **Runtime Connection** (ephemeral) — a single currently-connected pod
14
+ * (launch, connect, create agent, disconnect).
15
+ *
16
+ * 3. **WebSocket Stream** (ephemeral) — monitoring snapshot pushed by the
17
+ * agent-runtime server over `/api/v1/tool-approvals/ws` (tool approvals,
18
+ * context, MCP status, cost usage, codemode status, full context).
19
+ *
20
+ * @module stores/agentRuntimeStore
21
+ */
22
+ import { createStore } from 'zustand/vanilla';
23
+ import { useStore } from 'zustand';
24
+ import { persist, createJSONStorage, subscribeWithSelector, } from 'zustand/middleware';
25
+ export function getMonitoringCacheKey(serviceName, agentId) {
26
+ return `${serviceName || '__unknown_service__'}::${agentId || '__unknown_agent__'}`;
27
+ }
28
+ // ---------------------------------------------------------------------------
29
+ // Helpers
30
+ // ---------------------------------------------------------------------------
31
+ function getTransportEndpoint(baseUrl, transport, agentId) {
32
+ switch (transport) {
33
+ case 'vercel-ai':
34
+ return `${baseUrl}/api/v1/vercel-ai/${agentId}`;
35
+ case 'a2a':
36
+ return `${baseUrl}/api/v1/a2a/agents/${agentId}/`;
37
+ case 'acp':
38
+ return `${baseUrl}/api/v1/acp/ws/${agentId}`;
39
+ case 'ag-ui':
40
+ default:
41
+ return `${baseUrl}/api/v1/ag-ui/${agentId}/`;
42
+ }
43
+ }
44
+ async function createAgentOnRuntime(agentBaseUrl, agentId, config = {}) {
45
+ if (!config.protocol) {
46
+ throw new Error('Agent protocol is required. Provide config.protocol from the selected spec/config.');
47
+ }
48
+ const transport = config.protocol;
49
+ if (!config.model) {
50
+ throw new Error('Agent model is required. Provide config.model from the selected spec/config.');
51
+ }
52
+ const response = await fetch(`${agentBaseUrl}/api/v1/agents`, {
53
+ method: 'POST',
54
+ headers: { 'Content-Type': 'application/json' },
55
+ body: JSON.stringify({
56
+ name: config.name || agentId,
57
+ description: config.description || 'AI assistant',
58
+ agent_library: config.agentLibrary || 'pydantic-ai',
59
+ transport,
60
+ model: config.model,
61
+ system_prompt: config.systemPrompt || 'You are a helpful AI assistant.',
62
+ }),
63
+ });
64
+ if (response.ok || response.status === 400) {
65
+ const endpoint = getTransportEndpoint(agentBaseUrl, transport, agentId);
66
+ return { agentId, endpoint, isReady: true };
67
+ }
68
+ const errorData = await response.json().catch(() => ({}));
69
+ throw new Error(errorData.detail || `Failed to create agent: ${response.status}`);
70
+ }
71
+ // ---------------------------------------------------------------------------
72
+ // Initial state
73
+ // ---------------------------------------------------------------------------
74
+ const initialRuntimeState = {
75
+ runtime: null,
76
+ status: 'idle',
77
+ error: null,
78
+ isLaunching: false,
79
+ };
80
+ const initialWsState = {
81
+ wsState: 'closed',
82
+ approvals: [],
83
+ pendingApprovalCount: 0,
84
+ contextSnapshot: null,
85
+ costUsage: null,
86
+ mcpStatus: null,
87
+ codemodeStatus: null,
88
+ fullContext: null,
89
+ monitoringCache: {},
90
+ loadedSkillsByAgentId: {},
91
+ };
92
+ const countPendingApprovals = (approvals) => approvals.filter(approval => approval.status === 'pending').length;
93
+ // ---------------------------------------------------------------------------
94
+ // Store
95
+ // ---------------------------------------------------------------------------
96
+ /** Internal ref kept outside React to avoid re-renders on WS assignment. */
97
+ let _ws = null;
98
+ const _wsByAgentId = new Map();
99
+ function _resolveWs(agentId) {
100
+ const hasAgentScopedSockets = _wsByAgentId.size > 0;
101
+ if (agentId) {
102
+ const wsForAgent = _wsByAgentId.get(agentId);
103
+ if (wsForAgent && wsForAgent.readyState === WebSocket.OPEN) {
104
+ return wsForAgent;
105
+ }
106
+ // In multi-agent mode, avoid falling back to an arbitrary global socket.
107
+ if (hasAgentScopedSockets) {
108
+ return null;
109
+ }
110
+ }
111
+ // When any agent-scoped sockets are registered, require explicit routing.
112
+ if (hasAgentScopedSockets) {
113
+ return null;
114
+ }
115
+ if (_ws && _ws.readyState === WebSocket.OPEN) {
116
+ return _ws;
117
+ }
118
+ return null;
119
+ }
120
+ export const agentRuntimeStore = createStore()(subscribeWithSelector(persist((set, get) => ({
121
+ // ── Registry ──────────────────────────────────────────────────
122
+ agents: [],
123
+ upsertAgent: agentData => {
124
+ set(state => {
125
+ const existingIndex = state.agents.findIndex(a => a.id === agentData.id);
126
+ const now = Date.now();
127
+ if (existingIndex >= 0) {
128
+ const updatedAgents = [...state.agents];
129
+ updatedAgents[existingIndex] = {
130
+ ...updatedAgents[existingIndex],
131
+ ...agentData,
132
+ lastUpdated: now,
133
+ };
134
+ return { agents: updatedAgents };
135
+ }
136
+ const newAgent = {
137
+ name: agentData.name || agentData.id,
138
+ description: agentData.description || '',
139
+ status: agentData.status || 'initializing',
140
+ lastUpdated: now,
141
+ ...agentData,
142
+ };
143
+ return { agents: [...state.agents, newAgent] };
144
+ });
145
+ },
146
+ getAgentById: (id) => get().agents.find(a => a.id === id),
147
+ getAgentByUrl: (baseUrl, protocol) => get().agents.find(a => a.baseUrl === baseUrl && a.protocol === protocol),
148
+ updateAgentStatus: (id, status, error = null) => {
149
+ set(state => {
150
+ const index = state.agents.findIndex(a => a.id === id);
151
+ if (index >= 0) {
152
+ const updatedAgents = [...state.agents];
153
+ updatedAgents[index] = {
154
+ ...updatedAgents[index],
155
+ status,
156
+ error,
157
+ lastUpdated: Date.now(),
158
+ };
159
+ return { agents: updatedAgents };
160
+ }
161
+ return {};
162
+ });
163
+ },
164
+ toggleAgentStatus: (id) => {
165
+ set(state => {
166
+ const index = state.agents.findIndex(a => a.id === id);
167
+ if (index >= 0) {
168
+ const updatedAgents = [...state.agents];
169
+ const currentStatus = updatedAgents[index].status;
170
+ updatedAgents[index] = {
171
+ ...updatedAgents[index],
172
+ status: currentStatus === 'running' ? 'paused' : 'running',
173
+ lastUpdated: Date.now(),
174
+ };
175
+ return { agents: updatedAgents };
176
+ }
177
+ return {};
178
+ });
179
+ },
180
+ deleteAgent: (id) => {
181
+ set(state => {
182
+ const { [id]: _removed, ...remainingLoadedSkills } = state.loadedSkillsByAgentId;
183
+ return {
184
+ agents: state.agents.filter(a => a.id !== id),
185
+ loadedSkillsByAgentId: remainingLoadedSkills,
186
+ };
187
+ });
188
+ },
189
+ clearAgents: () => {
190
+ set({ agents: [] });
191
+ },
192
+ setLoadedSkillsForAgent: (agentId, skills) => {
193
+ set(state => ({
194
+ loadedSkillsByAgentId: {
195
+ ...state.loadedSkillsByAgentId,
196
+ [agentId]: skills,
197
+ },
198
+ }));
199
+ },
200
+ getLoadedSkillsForAgent: agentId => get().loadedSkillsByAgentId[agentId] ?? [],
201
+ clearLoadedSkillsForAgent: agentId => {
202
+ set(state => {
203
+ if (!(agentId in state.loadedSkillsByAgentId)) {
204
+ return {};
205
+ }
206
+ const { [agentId]: _removed, ...remaining } = state.loadedSkillsByAgentId;
207
+ return { loadedSkillsByAgentId: remaining };
208
+ });
209
+ },
210
+ // ── Runtime connection ────────────────────────────────────────
211
+ ...initialRuntimeState,
212
+ connectAgent: connection => {
213
+ const baseUrl = connection.jupyterBaseUrl ||
214
+ connection.serviceManager?.serverSettings.baseUrl;
215
+ if (!baseUrl) {
216
+ throw new Error('connectAgent requires either jupyterBaseUrl or serviceManager');
217
+ }
218
+ const agentBaseUrl = baseUrl.replace('/jupyter/server/', '/agent-runtimes/');
219
+ set({
220
+ runtime: {
221
+ podName: connection.podName,
222
+ environmentName: connection.environmentName,
223
+ jupyterBaseUrl: baseUrl,
224
+ agentBaseUrl,
225
+ serviceManager: connection.serviceManager,
226
+ status: 'ready',
227
+ kernelId: connection.kernelId,
228
+ },
229
+ status: 'ready',
230
+ error: null,
231
+ });
232
+ },
233
+ launchAgent: async (config) => {
234
+ set({ status: 'launching', error: null, isLaunching: true });
235
+ try {
236
+ const { createRuntime } = await import('@datalayer/core/lib/api');
237
+ const { runtimesStore } = await import('@datalayer/core/lib/state');
238
+ if (config.runtimesRunUrl) {
239
+ runtimesStore.setState({
240
+ runtimesRunUrl: config.runtimesRunUrl,
241
+ });
242
+ }
243
+ const { runtimesRunUrl: _runtimesRunUrl, ...runtimeOptions } = config;
244
+ const runtimePod = await createRuntime({
245
+ environmentName: runtimeOptions.environmentName,
246
+ creditsLimit: runtimeOptions.creditsLimit,
247
+ type: runtimeOptions.type || 'notebook',
248
+ givenName: runtimeOptions.givenName,
249
+ capabilities: runtimeOptions.capabilities,
250
+ snapshot: runtimeOptions.snapshot,
251
+ });
252
+ set({ status: 'connecting' });
253
+ const jupyterBaseUrl = runtimePod.ingress;
254
+ const agentBaseUrl = jupyterBaseUrl.replace('/jupyter/server/', '/agent-runtimes/');
255
+ const conn = {
256
+ podName: runtimePod.pod_name,
257
+ environmentName: runtimePod.environment_name,
258
+ jupyterBaseUrl,
259
+ agentBaseUrl,
260
+ status: 'ready',
261
+ };
262
+ set({ runtime: conn, status: 'ready', isLaunching: false });
263
+ return conn;
264
+ }
265
+ catch (err) {
266
+ const errorMessage = err instanceof Error ? err.message : 'Failed to launch runtime';
267
+ set({ status: 'error', error: errorMessage, isLaunching: false });
268
+ throw err;
269
+ }
270
+ },
271
+ createAgent: async (config = {}) => {
272
+ const { runtime } = get();
273
+ if (!runtime) {
274
+ throw new Error('No runtime connected. Launch or connect to a runtime first.');
275
+ }
276
+ try {
277
+ const agentId = config.name || runtime.podName;
278
+ const agentConnection = await createAgentOnRuntime(runtime.agentBaseUrl, agentId, config);
279
+ set({
280
+ runtime: {
281
+ ...runtime,
282
+ agentId: agentConnection.agentId,
283
+ endpoint: agentConnection.endpoint,
284
+ isReady: agentConnection.isReady,
285
+ },
286
+ });
287
+ return agentConnection;
288
+ }
289
+ catch (err) {
290
+ const errorMessage = err instanceof Error ? err.message : 'Failed to create agent';
291
+ set({ error: errorMessage });
292
+ throw err;
293
+ }
294
+ },
295
+ disconnect: () => {
296
+ set({ runtime: null, status: 'disconnected', error: null });
297
+ },
298
+ clearError: () => set({ error: null }),
299
+ setError: error => set({ error, status: 'error' }),
300
+ // ── WebSocket stream ──────────────────────────────────────────
301
+ ...initialWsState,
302
+ setWsState: wsState => set({ wsState }),
303
+ setWs: (ws, agentId) => {
304
+ _ws = ws;
305
+ if (agentId) {
306
+ if (ws) {
307
+ _wsByAgentId.set(agentId, ws);
308
+ }
309
+ else {
310
+ _wsByAgentId.delete(agentId);
311
+ }
312
+ }
313
+ },
314
+ applySnapshot: payload => set(state => ({
315
+ // Tool-approval list/count are sourced from ai-agents WS only.
316
+ approvals: state.approvals,
317
+ pendingApprovalCount: state.pendingApprovalCount,
318
+ contextSnapshot: payload.contextSnapshot ?? null,
319
+ costUsage: payload.costUsage ?? null,
320
+ mcpStatus: payload.mcpStatus ?? null,
321
+ codemodeStatus: payload.codemodeStatus ?? null,
322
+ fullContext: payload.fullContext ?? null,
323
+ })),
324
+ upsertApproval: approval => set(state => {
325
+ const filtered = state.approvals.filter(a => a.id !== approval.id);
326
+ const approvals = [approval, ...filtered];
327
+ return {
328
+ approvals,
329
+ pendingApprovalCount: countPendingApprovals(approvals),
330
+ };
331
+ }),
332
+ removeApproval: approvalId => set(state => {
333
+ const approvals = state.approvals.filter(a => a.id !== approvalId);
334
+ return {
335
+ approvals,
336
+ pendingApprovalCount: countPendingApprovals(approvals),
337
+ };
338
+ }),
339
+ sendDecision: (approvalId, approved, note, toolCallId, agentId) => {
340
+ const targetWs = _resolveWs(agentId);
341
+ if (!targetWs) {
342
+ return false;
343
+ }
344
+ targetWs.send(JSON.stringify({
345
+ type: 'tool_approval_decision',
346
+ approvalId,
347
+ approved,
348
+ ...(note ? { note } : {}),
349
+ ...(toolCallId ? { toolCallId } : {}),
350
+ }));
351
+ return true;
352
+ },
353
+ requestRefresh: agentId => {
354
+ const targetWs = _resolveWs(agentId);
355
+ if (!targetWs) {
356
+ return false;
357
+ }
358
+ targetWs.send(JSON.stringify({ type: 'request_snapshot' }));
359
+ targetWs.send(JSON.stringify({ type: 'request_otel_flush' }));
360
+ return true;
361
+ },
362
+ sendRawMessage: (payload, agentId) => {
363
+ const targetWs = _resolveWs(agentId);
364
+ if (!targetWs) {
365
+ return false;
366
+ }
367
+ targetWs.send(JSON.stringify(payload));
368
+ return true;
369
+ },
370
+ appendLocalTokenTurn: ({ serviceName, agentId, timestampMs, promptTokens, completionTokens, totalTokens, }) => {
371
+ set(state => {
372
+ const key = getMonitoringCacheKey(serviceName, agentId);
373
+ const existing = state.monitoringCache[key] ?? {
374
+ tokenTurns: [],
375
+ costPoints: [],
376
+ };
377
+ const tokenTurns = [...existing.tokenTurns];
378
+ const lastTurn = tokenTurns[tokenTurns.length - 1];
379
+ if (lastTurn &&
380
+ lastTurn.userMessageTokens === promptTokens &&
381
+ lastTurn.aiMessageTokens === completionTokens &&
382
+ lastTurn.systemPromptTokens === 0 &&
383
+ lastTurn.toolsDescriptionTokens === 0 &&
384
+ lastTurn.toolsUsageTokens === 0 &&
385
+ lastTurn.totalTokens === totalTokens) {
386
+ tokenTurns[tokenTurns.length - 1] = {
387
+ ...lastTurn,
388
+ timestampMs: Math.max(lastTurn.timestampMs, timestampMs),
389
+ };
390
+ return {
391
+ monitoringCache: {
392
+ ...state.monitoringCache,
393
+ [key]: {
394
+ ...existing,
395
+ tokenTurns,
396
+ },
397
+ },
398
+ };
399
+ }
400
+ const turnNumber = (lastTurn?.turnNumber ?? 0) + 1;
401
+ tokenTurns.push({
402
+ turnNumber,
403
+ timestampMs,
404
+ systemPromptTokens: 0,
405
+ toolsDescriptionTokens: 0,
406
+ userMessageTokens: promptTokens,
407
+ aiMessageTokens: completionTokens,
408
+ toolsUsageTokens: 0,
409
+ totalTokens,
410
+ });
411
+ return {
412
+ monitoringCache: {
413
+ ...state.monitoringCache,
414
+ [key]: {
415
+ ...existing,
416
+ tokenTurns,
417
+ },
418
+ },
419
+ };
420
+ });
421
+ },
422
+ mergeTokenTurns: ({ serviceName, agentId, turns }) => {
423
+ if (turns.length === 0)
424
+ return;
425
+ set(state => {
426
+ const key = getMonitoringCacheKey(serviceName, agentId);
427
+ const existing = state.monitoringCache[key] ?? {
428
+ tokenTurns: [],
429
+ costPoints: [],
430
+ };
431
+ const byTurn = new Map();
432
+ for (const turn of existing.tokenTurns) {
433
+ byTurn.set(turn.turnNumber, turn);
434
+ }
435
+ for (const turn of turns) {
436
+ byTurn.set(turn.turnNumber, turn);
437
+ }
438
+ const tokenTurns = Array.from(byTurn.values()).sort((a, b) => a.turnNumber - b.turnNumber);
439
+ return {
440
+ monitoringCache: {
441
+ ...state.monitoringCache,
442
+ [key]: {
443
+ ...existing,
444
+ tokenTurns,
445
+ },
446
+ },
447
+ };
448
+ });
449
+ },
450
+ appendLocalTokenTurnFull: ({ serviceName, agentId, timestampMs, systemPromptTokens, toolsDescriptionTokens, userMessageTokens, aiMessageTokens, toolsUsageTokens, totalTokens, }) => {
451
+ set(state => {
452
+ const key = getMonitoringCacheKey(serviceName, agentId);
453
+ const existing = state.monitoringCache[key] ?? {
454
+ tokenTurns: [],
455
+ costPoints: [],
456
+ };
457
+ const tokenTurns = [...existing.tokenTurns];
458
+ const lastTurn = tokenTurns[tokenTurns.length - 1];
459
+ if (lastTurn &&
460
+ lastTurn.systemPromptTokens === systemPromptTokens &&
461
+ lastTurn.toolsDescriptionTokens === toolsDescriptionTokens &&
462
+ lastTurn.userMessageTokens === userMessageTokens &&
463
+ lastTurn.aiMessageTokens === aiMessageTokens &&
464
+ lastTurn.toolsUsageTokens === toolsUsageTokens &&
465
+ lastTurn.totalTokens === totalTokens) {
466
+ tokenTurns[tokenTurns.length - 1] = {
467
+ ...lastTurn,
468
+ timestampMs: Math.max(lastTurn.timestampMs, timestampMs),
469
+ };
470
+ return {
471
+ monitoringCache: {
472
+ ...state.monitoringCache,
473
+ [key]: {
474
+ ...existing,
475
+ tokenTurns,
476
+ },
477
+ },
478
+ };
479
+ }
480
+ const turnNumber = (lastTurn?.turnNumber ?? 0) + 1;
481
+ tokenTurns.push({
482
+ turnNumber,
483
+ timestampMs,
484
+ systemPromptTokens,
485
+ toolsDescriptionTokens,
486
+ userMessageTokens,
487
+ aiMessageTokens,
488
+ toolsUsageTokens,
489
+ totalTokens,
490
+ });
491
+ return {
492
+ monitoringCache: {
493
+ ...state.monitoringCache,
494
+ [key]: {
495
+ ...existing,
496
+ tokenTurns,
497
+ },
498
+ },
499
+ };
500
+ });
501
+ },
502
+ upsertLocalCostPoint: ({ serviceName, agentId, timestampMs, cumulativeUsd, }) => {
503
+ set(state => {
504
+ const key = getMonitoringCacheKey(serviceName, agentId);
505
+ const existing = state.monitoringCache[key] ?? {
506
+ tokenTurns: [],
507
+ costPoints: [],
508
+ };
509
+ const costPoints = [...existing.costPoints];
510
+ const existingIdx = costPoints.findIndex(point => Math.abs(point.timestampMs - timestampMs) < 1);
511
+ if (existingIdx >= 0) {
512
+ costPoints[existingIdx] = {
513
+ ...costPoints[existingIdx],
514
+ cumulativeUsd: Math.max(costPoints[existingIdx].cumulativeUsd, cumulativeUsd),
515
+ };
516
+ }
517
+ else {
518
+ costPoints.push({ timestampMs, cumulativeUsd });
519
+ }
520
+ costPoints.sort((a, b) => a.timestampMs - b.timestampMs);
521
+ return {
522
+ monitoringCache: {
523
+ ...state.monitoringCache,
524
+ [key]: {
525
+ ...existing,
526
+ costPoints,
527
+ },
528
+ },
529
+ };
530
+ });
531
+ },
532
+ mergeCostPoints: ({ serviceName, agentId, points }) => {
533
+ if (points.length === 0)
534
+ return;
535
+ set(state => {
536
+ const key = getMonitoringCacheKey(serviceName, agentId);
537
+ const existing = state.monitoringCache[key] ?? {
538
+ tokenTurns: [],
539
+ costPoints: [],
540
+ };
541
+ const byTs = new Map();
542
+ for (const point of existing.costPoints) {
543
+ byTs.set(point.timestampMs, point);
544
+ }
545
+ for (const point of points) {
546
+ const prev = byTs.get(point.timestampMs);
547
+ if (!prev) {
548
+ byTs.set(point.timestampMs, point);
549
+ }
550
+ else {
551
+ byTs.set(point.timestampMs, {
552
+ timestampMs: point.timestampMs,
553
+ cumulativeUsd: Math.max(prev.cumulativeUsd, point.cumulativeUsd),
554
+ });
555
+ }
556
+ }
557
+ const costPoints = Array.from(byTs.values()).sort((a, b) => a.timestampMs - b.timestampMs);
558
+ return {
559
+ monitoringCache: {
560
+ ...state.monitoringCache,
561
+ [key]: {
562
+ ...existing,
563
+ costPoints,
564
+ },
565
+ },
566
+ };
567
+ });
568
+ },
569
+ // ── Reset ─────────────────────────────────────────────────────
570
+ reset: () => {
571
+ // Close any live WebSocket so the backend tears down its
572
+ // per-connection state (subscriptions, approvals, monitoring).
573
+ if (_ws) {
574
+ try {
575
+ _ws.close(1000, 'reset');
576
+ }
577
+ catch {
578
+ // Ignore close errors — socket may already be in a closing
579
+ // state or the runtime may have been killed.
580
+ }
581
+ }
582
+ _ws = null;
583
+ _wsByAgentId.clear();
584
+ set({ ...initialRuntimeState, ...initialWsState });
585
+ },
586
+ resetWs: () => {
587
+ if (_ws) {
588
+ try {
589
+ _ws.close(1000, 'reset');
590
+ }
591
+ catch {
592
+ // Ignore.
593
+ }
594
+ }
595
+ _ws = null;
596
+ _wsByAgentId.clear();
597
+ set(initialWsState);
598
+ },
599
+ }), {
600
+ name: 'agent-runtimes-storage',
601
+ storage: createJSONStorage(() => localStorage),
602
+ partialize: state => ({
603
+ agents: state.agents.map(agent => ({
604
+ id: agent.id,
605
+ name: agent.name,
606
+ description: agent.description,
607
+ baseUrl: agent.baseUrl,
608
+ transport: agent.protocol,
609
+ status: agent.status,
610
+ lastUpdated: agent.lastUpdated,
611
+ documentId: agent.documentId,
612
+ runtimeId: agent.runtimeId,
613
+ })),
614
+ monitoringCache: state.monitoringCache,
615
+ loadedSkillsByAgentId: state.loadedSkillsByAgentId,
616
+ }),
617
+ })));
618
+ export function useAgentRuntimeStore(selector) {
619
+ const resolvedSelector = selector
620
+ ? selector
621
+ : (state) => state;
622
+ return useStore(agentRuntimeStore, resolvedSelector);
623
+ }
624
+ const useAgentRuntimeStoreWithStatics = useAgentRuntimeStore;
625
+ useAgentRuntimeStoreWithStatics.getState = agentRuntimeStore.getState;
626
+ useAgentRuntimeStoreWithStatics.subscribe = agentRuntimeStore.subscribe;
627
+ // ---------------------------------------------------------------------------
628
+ // Selector hooks — Registry
629
+ // ---------------------------------------------------------------------------
630
+ export const useAgentRuntimeConnection = () => useAgentRuntimeStore(s => s.runtime);
631
+ export const useAgentRuntimeStatus = () => useAgentRuntimeStore(s => s.status);
632
+ export const useAgentRuntimeError = () => useAgentRuntimeStore(s => s.error);
633
+ export const useAgentRuntimeIsLaunching = () => useAgentRuntimeStore(s => s.isLaunching);
634
+ // ---------------------------------------------------------------------------
635
+ // Selector hooks — WebSocket stream
636
+ // ---------------------------------------------------------------------------
637
+ export const useAgentRuntimeApprovals = () => useAgentRuntimeStore(s => s.approvals);
638
+ export const useAgentRuntimePendingCount = () => useAgentRuntimeStore(s => s.pendingApprovalCount);
639
+ export const useAgentRuntimeMcpStatus = () => useAgentRuntimeStore(s => s.mcpStatus);
640
+ export const useAgentRuntimeFullContext = () => useAgentRuntimeStore(s => s.fullContext);
641
+ export const useAgentRuntimeContextSnapshot = () => useAgentRuntimeStore(s => s.contextSnapshot);
642
+ export const useAgentRuntimeCostUsage = () => useAgentRuntimeStore(s => s.costUsage);
643
+ export const useAgentRuntimeCodemodeStatus = () => useAgentRuntimeStore(s => s.codemodeStatus);
644
+ export const useAgentRuntimeWsState = () => useAgentRuntimeStore(s => s.wsState);
645
+ export const useAgentRuntimeLoadedSkills = (agentId) => useAgentRuntimeStore(s => agentId ? (s.loadedSkillsByAgentId[agentId] ?? []) : []);
646
+ // ---------------------------------------------------------------------------
647
+ // Non-React access
648
+ // ---------------------------------------------------------------------------
649
+ export const getAgentRuntimeState = () => agentRuntimeStore.getState();
650
+ export const subscribeToAgentRuntime = agentRuntimeStore.subscribe;
@@ -8,8 +8,8 @@
8
8
  *
9
9
  * Key features:
10
10
  * - Messages are stored per runtime ID in memory
11
- * - On page reload, messages are fetched from the server API
12
- * - No browser storage persistence - server is the source of truth
11
+ * - On page reload, messages are synchronized from the runtime via websocket
12
+ * - No browser storage persistence - runtime is the source of truth
13
13
  *
14
14
  * @module store/conversationStore
15
15
  */
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * @module store
5
5
  */
6
- export { useAgentStore, useAgentRuntime, useAgentFromStore, useAgentStatus, useAgentError, useIsLaunching, getAgentState, subscribeToAgent, agentStore, type AgentRegistryEntry, type agentsStoreState, type agentsStoreActions, type agentsStore, type AgentRegistryState, type AgentState, } from './agentsStore';
6
+ export { agentRuntimeStore, useAgentRuntimeStore, useAgentRuntimeConnection, useAgentRuntimeStatus, useAgentRuntimeError, useAgentRuntimeIsLaunching, useAgentRuntimeApprovals, useAgentRuntimePendingCount, useAgentRuntimeMcpStatus, useAgentRuntimeFullContext, useAgentRuntimeContextSnapshot, useAgentRuntimeCostUsage, useAgentRuntimeCodemodeStatus, useAgentRuntimeWsState, useAgentRuntimeLoadedSkills, getAgentRuntimeState, subscribeToAgentRuntime, type AgentRegistryEntry, type AgentRuntimeWsState, type AgentRuntimeStoreState, type AgentRuntimeStoreActions, type AgentRuntimeStore, } from './agentRuntimeStore';
7
7
  export { useChatStore, useChatMessages, useChatLoading, useChatStreaming, useChatError, useChatTools, useChatOpen, useChatConfig, useChatReady, useChatInferenceProvider, useChatExtensionRegistry, defaultChatConfig, type ChatStore, type ChatState, type ChatActions, type ChatConfig, type ToolCallState, } from './chatStore';
8
8
  export { useConversationStore, useConversationMessages, useNeedsFetch, useIsFetching, type ConversationStore, type ConversationData, } from './conversationStore';
@@ -7,6 +7,6 @@
7
7
  *
8
8
  * @module store
9
9
  */
10
- export { useAgentStore, useAgentRuntime, useAgentFromStore, useAgentStatus, useAgentError, useIsLaunching, getAgentState, subscribeToAgent, agentStore, } from './agentsStore';
10
+ export { agentRuntimeStore, useAgentRuntimeStore, useAgentRuntimeConnection, useAgentRuntimeStatus, useAgentRuntimeError, useAgentRuntimeIsLaunching, useAgentRuntimeApprovals, useAgentRuntimePendingCount, useAgentRuntimeMcpStatus, useAgentRuntimeFullContext, useAgentRuntimeContextSnapshot, useAgentRuntimeCostUsage, useAgentRuntimeCodemodeStatus, useAgentRuntimeWsState, useAgentRuntimeLoadedSkills, getAgentRuntimeState, subscribeToAgentRuntime, } from './agentRuntimeStore';
11
11
  export { useChatStore, useChatMessages, useChatLoading, useChatStreaming, useChatError, useChatTools, useChatOpen, useChatConfig, useChatReady, useChatInferenceProvider, useChatExtensionRegistry, defaultChatConfig, } from './chatStore';
12
12
  export { useConversationStore, useConversationMessages, useNeedsFetch, useIsFetching, } from './conversationStore';
@@ -1,5 +1,5 @@
1
1
  import type { ToolExecutionContext } from '@datalayer/jupyter-react';
2
- import { createAllCopilotKitActions, ActionRegistrar, type UseFrontendToolFn } from './CopilotKitToolAdapter';
2
+ import { createAllCopilotKitActions } from './CopilotKitToolAdapter';
3
3
  /**
4
4
  * Hook that creates CopilotKit actions for lexical tools.
5
5
  * Returns stable actions array that won't cause re-renders.
@@ -24,4 +24,3 @@ import { createAllCopilotKitActions, ActionRegistrar, type UseFrontendToolFn } f
24
24
  * ```
25
25
  */
26
26
  export declare function useLexicalToolActions(documentId: string, contextOverrides?: Partial<Omit<ToolExecutionContext, 'executor' | 'documentId'>>): ReturnType<typeof createAllCopilotKitActions>;
27
- export { ActionRegistrar, type UseFrontendToolFn };