@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
@@ -8,7 +8,7 @@ import { InputPromptLexical } from './InputPromptLexical';
8
8
  /**
9
9
  * InputPrompt — Integrated chat input with header, input area, and footer.
10
10
  */
11
- export function InputPrompt({ variant = 'text', placeholder = 'Ask anything…', isLoading = false, onSend, onStop, autoFocus = false, focusTrigger, showBorderTop = true, showBackground = true, padding = 3, disabled = false, sx, value: controlledValue, onChange: controlledOnChange, headerContent, footerContent, footerRightContent, }) {
11
+ export function InputPrompt({ variant = 'text', placeholder = 'Ask anything…', isLoading = false, isKernelBusy = false, onSend, onStop, autoFocus = false, focusTrigger, showBorderTop = true, showBackground = true, padding = 3, disabled = false, readOnly = false, sx, value: controlledValue, onChange: controlledOnChange, headerContent, footerContent, footerRightContent, }) {
12
12
  // ---- Controlled / uncontrolled state -----------------------------------
13
13
  const [internalInput, setInternalInput] = useState('');
14
14
  const input = controlledValue !== undefined ? controlledValue : internalInput;
@@ -46,14 +46,14 @@ export function InputPrompt({ variant = 'text', placeholder = 'Ask anything…',
46
46
  }, [isLoading, variant]);
47
47
  // ---- Send / Stop handlers ----------------------------------------------
48
48
  const handleSend = useCallback(() => {
49
- if (!input.trim() || isLoading || disabled)
49
+ if (!input.trim() || isLoading || disabled || readOnly)
50
50
  return;
51
51
  const message = input.trim();
52
52
  if (controlledValue === undefined) {
53
53
  setInput('');
54
54
  }
55
55
  onSend(message);
56
- }, [input, isLoading, disabled, onSend, setInput, controlledValue]);
56
+ }, [input, isLoading, disabled, readOnly, onSend, setInput, controlledValue]);
57
57
  const handleStop = useCallback(() => {
58
58
  onStop?.();
59
59
  }, [onStop]);
@@ -78,6 +78,6 @@ export function InputPrompt({ variant = 'text', placeholder = 'Ask anything…',
78
78
  borderColor: 'accent.fg',
79
79
  boxShadow: (t) => `0 0 0 1px ${t?.colors?.accent?.fg ?? '#0969da'}`,
80
80
  },
81
- }, children: [_jsx(InputPromptHeader, { children: headerContent }), variant === 'lexical' ? (_jsx(InputPromptLexical, { value: input, onChange: setInput, placeholder: placeholder, disabled: isLoading || disabled, onSubmit: handleSend, autoFocus: autoFocus })) : (_jsx(InputPromptText, { value: input, onChange: setInput, placeholder: placeholder, disabled: isLoading || disabled, onSubmit: handleSend, inputRef: inputRef })), _jsx(InputPromptFooter, { isLoading: isLoading, sendDisabled: !input.trim() || disabled, onSend: handleSend, onStop: handleStop, rightContent: footerRightContent, children: footerContent })] }) }) }));
81
+ }, children: [_jsx(InputPromptHeader, { children: headerContent }), variant === 'lexical' ? (_jsx(InputPromptLexical, { value: input, onChange: setInput, placeholder: placeholder, disabled: isLoading || disabled, readOnly: readOnly, onSubmit: handleSend, autoFocus: autoFocus })) : (_jsx(InputPromptText, { value: input, onChange: setInput, placeholder: placeholder, disabled: isLoading || disabled, readOnly: readOnly, onSubmit: handleSend, inputRef: inputRef })), _jsx(InputPromptFooter, { isLoading: isLoading, isKernelBusy: isKernelBusy, sendDisabled: !input.trim() || disabled || readOnly, onSend: handleSend, onStop: handleStop, rightContent: footerRightContent, children: footerContent })] }) }) }));
82
82
  }
83
83
  export default InputPrompt;
@@ -16,10 +16,12 @@ export interface InputPromptFooterProps {
16
16
  isLoading?: boolean;
17
17
  /** Whether the send button should be disabled */
18
18
  sendDisabled?: boolean;
19
+ /** Whether the connected kernel is currently busy */
20
+ isKernelBusy?: boolean;
19
21
  /** Callback when the send button is clicked */
20
22
  onSend: () => void;
21
23
  /** Callback when the stop button is clicked */
22
24
  onStop?: () => void;
23
25
  }
24
- export declare function InputPromptFooter({ children, rightContent, isLoading, sendDisabled, onSend, onStop, }: InputPromptFooterProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare function InputPromptFooter({ children, rightContent, isLoading, sendDisabled, isKernelBusy, onSend, onStop, }: InputPromptFooterProps): import("react/jsx-runtime").JSX.Element;
25
27
  export default InputPromptFooter;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { IconButton } from '@primer/react';
3
3
  import { Box } from '@datalayer/primer-addons';
4
- import { PaperAirplaneIcon, SquareCircleIcon } from '@primer/octicons-react';
5
- export function InputPromptFooter({ children, rightContent, isLoading = false, sendDisabled = false, onSend, onStop, }) {
4
+ import { PaperAirplaneIcon, SquareCircleIcon, PauseIcon, } from '@primer/octicons-react';
5
+ export function InputPromptFooter({ children, rightContent, isLoading = false, sendDisabled = false, isKernelBusy = false, onSend, onStop, }) {
6
6
  return (_jsxs(Box, { sx: {
7
7
  display: 'flex',
8
8
  alignItems: 'center',
@@ -10,6 +10,6 @@ export function InputPromptFooter({ children, rightContent, isLoading = false, s
10
10
  px: 2,
11
11
  pt: 1,
12
12
  pb: 2,
13
- }, children: [_jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2, flex: 1 }, children: children }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: [rightContent, isLoading ? (_jsx(IconButton, { icon: SquareCircleIcon, "aria-label": "Stop", onClick: onStop, size: "small" })) : (_jsx(IconButton, { icon: PaperAirplaneIcon, "aria-label": "Send", onClick: onSend, disabled: sendDisabled, size: "small" }))] })] }));
13
+ }, children: [_jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2, flex: 1 }, children: children }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: [rightContent, isLoading ? (_jsx(IconButton, { icon: SquareCircleIcon, "aria-label": "Stop", onClick: onStop, size: "small", variant: "invisible" })) : isKernelBusy ? (_jsx(IconButton, { icon: PauseIcon, "aria-label": "Pause (kernel busy)", onClick: onStop, size: "small", variant: "invisible", disabled: !onStop })) : (_jsx(IconButton, { icon: PaperAirplaneIcon, "aria-label": "Send", onClick: onSend, disabled: sendDisabled, size: "small", variant: "invisible" }))] })] }));
14
14
  }
15
15
  export default InputPromptFooter;
@@ -7,10 +7,12 @@ export interface InputPromptLexicalProps {
7
7
  placeholder?: string;
8
8
  /** Whether the input is disabled */
9
9
  disabled?: boolean;
10
+ /** Whether the input is read-only */
11
+ readOnly?: boolean;
10
12
  /** Callback when the user presses Enter (without Shift) */
11
13
  onSubmit?: () => void;
12
14
  /** Auto-focus the editor on mount */
13
15
  autoFocus?: boolean;
14
16
  }
15
- export declare function InputPromptLexical({ value, onChange, placeholder, disabled, onSubmit, autoFocus, }: InputPromptLexicalProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function InputPromptLexical({ value, onChange, placeholder, disabled, readOnly, onSubmit, autoFocus, }: InputPromptLexicalProps): import("react/jsx-runtime").JSX.Element;
16
18
  export default InputPromptLexical;
@@ -38,17 +38,17 @@ const EDITOR_CONFIG = {
38
38
  },
39
39
  };
40
40
  // ---- Enter-to-submit plugin ---------------------------------------------
41
- function EnterSubmitPlugin({ onSubmit, disabled, }) {
41
+ function EnterSubmitPlugin({ onSubmit, disabled, readOnly, }) {
42
42
  const [editor] = useLexicalComposerContext();
43
43
  useEffect(() => {
44
44
  return editor.registerCommand(KEY_ENTER_COMMAND, (event) => {
45
- if (event?.shiftKey || disabled)
45
+ if (event?.shiftKey || disabled || readOnly)
46
46
  return false;
47
47
  event?.preventDefault();
48
48
  onSubmit?.();
49
49
  return true;
50
50
  }, COMMAND_PRIORITY_HIGH);
51
- }, [editor, onSubmit, disabled]);
51
+ }, [editor, onSubmit, disabled, readOnly]);
52
52
  return null;
53
53
  }
54
54
  // ---- Sync plugin (controlled component bridge) --------------------------
@@ -94,7 +94,14 @@ function AutoFocusPlugin({ autoFocus }) {
94
94
  }, [editor, autoFocus]);
95
95
  return null;
96
96
  }
97
- export function InputPromptLexical({ value, onChange, placeholder = 'Ask anything…', disabled = false, onSubmit, autoFocus = false, }) {
97
+ function ReadOnlyPlugin({ readOnly }) {
98
+ const [editor] = useLexicalComposerContext();
99
+ useEffect(() => {
100
+ editor.setEditable(!readOnly);
101
+ }, [editor, readOnly]);
102
+ return null;
103
+ }
104
+ export function InputPromptLexical({ value, onChange, placeholder = 'Ask anything…', disabled = false, readOnly = false, onSubmit, autoFocus = false, }) {
98
105
  return (_jsx(Box, { sx: {
99
106
  px: 2,
100
107
  py: 1,
@@ -117,6 +124,6 @@ export function InputPromptLexical({ value, onChange, placeholder = 'Ask anythin
117
124
  fontSize: 1,
118
125
  pointerEvents: 'none',
119
126
  userSelect: 'none',
120
- }, children: placeholder }), ErrorBoundary: LexicalErrorBoundary }), _jsx(HistoryPlugin, {}), _jsx(SyncPlugin, { value: value, onChange: onChange }), _jsx(EnterSubmitPlugin, { onSubmit: onSubmit, disabled: disabled }), _jsx(AutoFocusPlugin, { autoFocus: autoFocus })] }) }));
127
+ }, children: placeholder }), ErrorBoundary: LexicalErrorBoundary }), _jsx(HistoryPlugin, {}), _jsx(SyncPlugin, { value: value, onChange: onChange }), _jsx(ReadOnlyPlugin, { readOnly: readOnly || disabled }), _jsx(EnterSubmitPlugin, { onSubmit: onSubmit, disabled: disabled, readOnly: readOnly }), _jsx(AutoFocusPlugin, { autoFocus: autoFocus })] }) }));
121
128
  }
122
129
  export default InputPromptLexical;
@@ -15,10 +15,12 @@ export interface InputPromptTextProps {
15
15
  placeholder?: string;
16
16
  /** Whether the input is disabled */
17
17
  disabled?: boolean;
18
+ /** Whether the input is read-only */
19
+ readOnly?: boolean;
18
20
  /** Callback when the user presses Enter (without Shift) */
19
21
  onSubmit?: () => void;
20
22
  /** Ref forwarded to the underlying textarea */
21
23
  inputRef?: Ref<HTMLTextAreaElement>;
22
24
  }
23
- export declare function InputPromptText({ value, onChange, placeholder, disabled, onSubmit, inputRef, }: InputPromptTextProps): import("react/jsx-runtime").JSX.Element;
25
+ export declare function InputPromptText({ value, onChange, placeholder, disabled, readOnly, onSubmit, inputRef, }: InputPromptTextProps): import("react/jsx-runtime").JSX.Element;
24
26
  export default InputPromptText;
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { useCallback, useEffect, } from 'react';
14
14
  import { Textarea } from '@primer/react';
15
15
  import { Box } from '@datalayer/primer-addons';
16
- export function InputPromptText({ value, onChange, placeholder = 'Ask anything…', disabled = false, onSubmit, inputRef, }) {
16
+ export function InputPromptText({ value, onChange, placeholder = 'Ask anything…', disabled = false, readOnly = false, onSubmit, inputRef, }) {
17
17
  // Auto-resize
18
18
  const adjustHeight = useCallback(() => {
19
19
  const el = inputRef && 'current' in inputRef
@@ -41,7 +41,7 @@ export function InputPromptText({ value, onChange, placeholder = 'Ask anything
41
41
  onSubmit?.();
42
42
  }
43
43
  }, [onSubmit]);
44
- return (_jsx(Box, { sx: { px: 2, py: 1 }, children: _jsx(Textarea, { ref: inputRef, value: value, onChange: e => onChange(e.target.value), onKeyDown: handleKeyDown, placeholder: placeholder, disabled: disabled, sx: {
44
+ return (_jsx(Box, { sx: { px: 2, py: 1 }, children: _jsx(Textarea, { ref: inputRef, value: value, onChange: e => onChange(e.target.value), onKeyDown: handleKeyDown, placeholder: placeholder, disabled: disabled, readOnly: readOnly, sx: {
45
45
  width: '100%',
46
46
  resize: 'none',
47
47
  minHeight: '40px',
@@ -46,7 +46,7 @@ export function ToolApprovalBanner({ pendingApprovals, onReview, onApproveAll, o
46
46
  justifyContent: 'space-between',
47
47
  px: 3,
48
48
  py: 2,
49
- }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(AlertIcon, { size: 16 }), _jsxs(Text, { sx: { fontSize: 1, fontWeight: 'semibold' }, children: [pendingApprovals.length, " tool", ' ', pendingApprovals.length === 1 ? 'approval' : 'approvals', " pending"] })] }), _jsxs(Box, { sx: { display: 'flex', gap: 1 }, children: [onApproveAll && pendingApprovals.length > 1 && (_jsx(Button, { size: "small", variant: "primary", leadingVisual: CheckIcon, onClick: onApproveAll, children: "Approve all" })), collapsible && (_jsx(Button, { size: "small", variant: "invisible", onClick: () => setCollapsed(true), children: "Collapse" })), onDismiss && (_jsx(Button, { size: "small", variant: "invisible", leadingVisual: XIcon, onClick: onDismiss, "aria-label": "Dismiss" }))] })] }), _jsx(Box, { sx: { px: 3, pb: 2 }, children: pendingApprovals.map(approval => (_jsxs(Box, { sx: {
49
+ }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(AlertIcon, { size: 16 }), _jsxs(Text, { sx: { fontSize: 1, fontWeight: 'semibold' }, children: [pendingApprovals.length, " tool", ' ', pendingApprovals.length === 1 ? 'approval' : 'approvals', " pending"] })] }), _jsxs(Box, { sx: { display: 'flex', gap: 1 }, children: [onApproveAll && pendingApprovals.length >= 1 && (_jsx(Button, { size: "small", variant: "primary", leadingVisual: CheckIcon, onClick: onApproveAll, children: "Approve all" })), collapsible && (_jsx(Button, { size: "small", variant: "invisible", onClick: () => setCollapsed(true), children: "Collapse" })), onDismiss && (_jsx(Button, { size: "small", variant: "invisible", leadingVisual: XIcon, onClick: onDismiss, "aria-label": "Dismiss" }))] })] }), _jsx(Box, { sx: { px: 3, pb: 2 }, children: pendingApprovals.map(approval => (_jsxs(Box, { sx: {
50
50
  display: 'flex',
51
51
  alignItems: 'center',
52
52
  justifyContent: 'space-between',
@@ -28,6 +28,8 @@ export interface ToolCallDisplayProps {
28
28
  approvalRequired?: boolean;
29
29
  /** Approval state for this tool call */
30
30
  approvalState?: 'pending' | 'approved' | 'denied';
31
+ /** Where the approval decision originated */
32
+ approvalDecisionSource?: 'inline' | 'external';
31
33
  /** Called when user approves this tool call */
32
34
  onApprove?: () => void;
33
35
  /** Called when user denies this tool call */
@@ -45,5 +47,5 @@ export interface ToolCallDisplayProps {
45
47
  * - Color-coded status indicators
46
48
  * - Rich error display distinguishing execution errors from code errors
47
49
  */
48
- export declare function ToolCallDisplay({ toolCallId, toolName, args, result, status, error, executionResult, codeError, exitCode, executionError, approvalRequired, approvalState, onApprove, onDeny, approvalLoading, }: ToolCallDisplayProps): import("react/jsx-runtime").JSX.Element;
50
+ export declare function ToolCallDisplay({ toolCallId, toolName, args, result, status, error, executionResult, codeError, exitCode, executionError, approvalRequired, approvalState, approvalDecisionSource, onApprove, onDeny, approvalLoading, }: ToolCallDisplayProps): import("react/jsx-runtime").JSX.Element;
49
51
  export default ToolCallDisplay;
@@ -124,7 +124,7 @@ function getArgsSummary(args) {
124
124
  * - Color-coded status indicators
125
125
  * - Rich error display distinguishing execution errors from code errors
126
126
  */
127
- export function ToolCallDisplay({ toolCallId, toolName, args, result, status, error, executionResult, codeError, exitCode, executionError, approvalRequired = false, approvalState, onApprove, onDeny, approvalLoading = false, }) {
127
+ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, error, executionResult, codeError, exitCode, executionError, approvalRequired = false, approvalState, approvalDecisionSource, onApprove, onDeny, approvalLoading = false, }) {
128
128
  const [isExpanded, setIsExpanded] = useState(false);
129
129
  // Determine effective exit code from props or execution result
130
130
  const effectiveExitCode = exitCode ?? executionResult?.exit_code;
@@ -265,7 +265,7 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
265
265
  wordBreak: 'break-word',
266
266
  }, children: typeof result === 'string'
267
267
  ? result
268
- : JSON.stringify(result, null, 2) }) })] })), approvalRequired && (_jsx(Box, { sx: { mt: status === 'complete' && result !== undefined ? 3 : 0 }, children: approvalState === 'approved' ? (_jsx(Text, { sx: { color: 'success.fg', fontSize: 1 }, children: "Approved. Executing tool." })) : approvalState === 'denied' ? (_jsx(Text, { sx: { color: 'danger.fg', fontSize: 1 }, children: "Denied. Tool will not run." })) : (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 1, color: 'fg.default' }, children: "This tool requires your approval to run." }), _jsxs(Box, { sx: { mt: 2, display: 'flex', gap: 2 }, children: [_jsx(Button, { size: "small", onClick: onApprove, disabled: approvalLoading || !onApprove, children: "Approve" }), _jsx(Button, { size: "small", variant: "danger", onClick: onDeny, disabled: approvalLoading || !onDeny, children: "Deny" })] })] })) })), status === 'error' && effectiveExecutionError && (_jsxs(Box, { children: [_jsxs(Text, { sx: {
268
+ : JSON.stringify(result, null, 2) }) })] })), approvalRequired && (_jsx(Box, { sx: { mt: status === 'complete' && result !== undefined ? 3 : 0 }, children: approvalState === 'approved' ? (_jsxs(Box, { children: [_jsx(Text, { sx: { color: 'success.fg', fontSize: 1, display: 'block' }, children: "Approved. Executing tool." }), approvalDecisionSource === 'external' && (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 0, display: 'block' }, children: "Approved from sidebar." }))] })) : approvalState === 'denied' ? (_jsxs(Box, { children: [_jsx(Text, { sx: { color: 'danger.fg', fontSize: 1, display: 'block' }, children: "Denied. Tool will not run." }), approvalDecisionSource === 'external' && (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 0, display: 'block' }, children: "Decision came from sidebar." }))] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 1, color: 'fg.default' }, children: "This tool requires your approval to run." }), _jsxs(Box, { sx: { mt: 2, display: 'flex', gap: 2 }, children: [_jsx(Button, { size: "small", onClick: onApprove, disabled: approvalLoading || !onApprove, children: "Approve" }), _jsx(Button, { size: "small", variant: "danger", onClick: onDeny, disabled: approvalLoading || !onDeny, children: "Deny" })] })] })) })), status === 'error' && effectiveExecutionError && (_jsxs(Box, { children: [_jsxs(Text, { sx: {
269
269
  display: 'block',
270
270
  fontSize: 0,
271
271
  fontWeight: 'semibold',
@@ -29,6 +29,19 @@ export function TokenUsageBar({ agentUsage, padding }) {
29
29
  const hasSession = agentUsage.sessionUsage &&
30
30
  (agentUsage.sessionUsage.inputTokens > 0 ||
31
31
  agentUsage.sessionUsage.outputTokens > 0);
32
+ const hasCostUsage = !!agentUsage.costUsage &&
33
+ (agentUsage.costUsage.cumulativeCostUsd > 0 ||
34
+ agentUsage.costUsage.lastTurnCostUsd > 0);
35
+ const sessionUsage = agentUsage.sessionUsage;
36
+ const turnUsage = agentUsage.turnUsage;
37
+ const costUsage = agentUsage.costUsage;
38
+ const formatUsd = (amount) => {
39
+ if (amount < 0.01)
40
+ return `$${amount.toFixed(4)}`;
41
+ if (amount < 1)
42
+ return `$${amount.toFixed(3)}`;
43
+ return `$${amount.toFixed(2)}`;
44
+ };
32
45
  // Build pie chart data
33
46
  const usedTokens = agentUsage.totalTokens;
34
47
  const windowTokens = agentUsage.contextWindow;
@@ -180,7 +193,12 @@ export function TokenUsageBar({ agentUsage, padding }) {
180
193
  color: 'fg.default',
181
194
  display: 'block',
182
195
  mb: 2,
183
- }, children: "Context Window" }), _jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted', display: 'block', mb: 1 }, children: [_jsx(Text, { as: "span", sx: { fontWeight: 'semibold', color: 'fg.default' }, children: formatTokenCount(usedTokens) }), ' / ', formatTokenCount(windowTokens), ' tokens'] }), _jsxs(Text, { sx: {
196
+ }, children: "Context Window" }), _jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted', display: 'block', mb: 1 }, children: [_jsx(Text, { as: "span", sx: { fontWeight: 'semibold', color: 'fg.default' }, children: formatTokenCount(usedTokens) }), ' / ', formatTokenCount(windowTokens), ' tokens'] }), agentUsage.costUsage && (_jsxs(Text, { sx: {
197
+ fontSize: 0,
198
+ color: 'fg.muted',
199
+ display: 'block',
200
+ mb: 2,
201
+ }, children: ['cost ', _jsx(Text, { as: "span", sx: { fontWeight: 'semibold', color: 'fg.default' }, children: formatUsd(agentUsage.costUsage.lastTurnCostUsd) }), ' turn · ', _jsx(Text, { as: "span", sx: { fontWeight: 'semibold', color: 'fg.default' }, children: formatUsd(agentUsage.costUsage.cumulativeCostUsd) }), ' total'] })), _jsxs(Text, { sx: {
184
202
  fontSize: 0,
185
203
  color: pct > 90
186
204
  ? 'danger.fg'
@@ -209,5 +227,5 @@ export function TokenUsageBar({ agentUsage, padding }) {
209
227
  display: 'block',
210
228
  mt: 2,
211
229
  fontStyle: 'italic',
212
- }, children: "Quality may decline as limit nears." }))] }))] }), _jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted', flexShrink: 0 }, children: [_jsx(Text, { as: "span", sx: { fontWeight: 'semibold', color: 'fg.default', fontSize: 0 }, children: formatTokenCount(agentUsage.totalTokens) }), ' / ', formatTokenCount(agentUsage.contextWindow), ' ctx'] }), hasSession && (_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted', flexShrink: 0 }, children: ['· ', formatTokenCount(agentUsage.sessionUsage.inputTokens), _jsx(Text, { as: "span", sx: { color: 'success.fg', fontSize: 0 }, children: '▲' }), ' ', formatTokenCount(agentUsage.sessionUsage.outputTokens), _jsx(Text, { as: "span", sx: { color: 'attention.fg', fontSize: 0 }, children: '▼' })] })), hasTurn && (_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted', flexShrink: 0 }, children: ['· turn ', formatTokenCount(agentUsage.turnUsage.inputTokens), _jsx(Text, { as: "span", sx: { color: 'success.fg', fontSize: 0 }, children: '▲' }), ' ', formatTokenCount(agentUsage.turnUsage.outputTokens), _jsx(Text, { as: "span", sx: { color: 'attention.fg', fontSize: 0 }, children: '▼' })] }))] }));
230
+ }, children: "Quality may decline as limit nears." }))] }))] }), _jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted', flexShrink: 0 }, children: [_jsx(Text, { as: "span", sx: { fontWeight: 'semibold', color: 'fg.default', fontSize: 0 }, children: formatTokenCount(agentUsage.totalTokens) }), ' / ', formatTokenCount(agentUsage.contextWindow), ' ctx'] }), hasCostUsage && (_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted', flexShrink: 0 }, children: ['· cost ', _jsx(Text, { as: "span", sx: { fontWeight: 'semibold', color: 'fg.default', fontSize: 0 }, children: formatUsd(costUsage?.lastTurnCostUsd ?? 0) }), ' turn / ', _jsx(Text, { as: "span", sx: { fontWeight: 'semibold', color: 'fg.default', fontSize: 0 }, children: formatUsd(costUsage?.cumulativeCostUsd ?? 0) })] })), hasSession && (_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted', flexShrink: 0 }, children: ['· ', formatTokenCount(sessionUsage?.inputTokens ?? 0), _jsx(Text, { as: "span", sx: { color: 'success.fg', fontSize: 0 }, children: '▲' }), ' ', formatTokenCount(sessionUsage?.outputTokens ?? 0), _jsx(Text, { as: "span", sx: { color: 'attention.fg', fontSize: 0 }, children: '▼' })] })), hasTurn && (_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted', flexShrink: 0 }, children: ['· turn ', formatTokenCount(turnUsage?.inputTokens ?? 0), _jsx(Text, { as: "span", sx: { color: 'success.fg', fontSize: 0 }, children: '▲' }), ' ', formatTokenCount(turnUsage?.outputTokens ?? 0), _jsx(Text, { as: "span", sx: { color: 'attention.fg', fontSize: 0 }, children: '▼' })] }))] }));
213
231
  }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * React context and hook for injecting an {@link IAgentRuntimesClient}
3
+ * implementation into the chat component tree.
4
+ *
5
+ * Consumers wrap the `<Chat>` component with `<AgentRuntimesClientProvider>`
6
+ * and pass the implementation of their choice — the default
7
+ * `SdkAgentRuntimesClient` for browser / Node, or a bridge
8
+ * implementation in the VSCode webview sandbox. Components and hooks inside
9
+ * the tree call {@link useAgentRuntimesClient} to retrieve the current client
10
+ * without knowing anything about how it talks to the backend.
11
+ *
12
+ * @module client/AgentRuntimesClientContext
13
+ */
14
+ import type { ReactNode } from 'react';
15
+ import type { IAgentRuntimesClient } from './IAgentRuntimesClient';
16
+ /** Props for {@link AgentRuntimesClientProvider}. */
17
+ export interface AgentRuntimesClientProviderProps {
18
+ /** Client implementation to make available to descendants. */
19
+ client: IAgentRuntimesClient;
20
+ /** Descendants that should see the provided client. */
21
+ children: ReactNode;
22
+ }
23
+ /**
24
+ * Provides an {@link IAgentRuntimesClient} instance to every descendant.
25
+ *
26
+ * @param props - Provider props.
27
+ *
28
+ * @returns A React element that exposes `props.client` to descendants.
29
+ */
30
+ export declare function AgentRuntimesClientProvider(props: AgentRuntimesClientProviderProps): JSX.Element;
31
+ /**
32
+ * Reads the active {@link IAgentRuntimesClient} from context.
33
+ *
34
+ * @returns The active client.
35
+ *
36
+ * @throws When called outside an {@link AgentRuntimesClientProvider}. Prefer a
37
+ * loud failure to silently falling back to a default client, because a
38
+ * missing provider usually indicates a wiring bug (especially in the VSCode
39
+ * webview where the default client would make forbidden direct HTTP calls).
40
+ */
41
+ export declare function useAgentRuntimesClient(): IAgentRuntimesClient;
42
+ /**
43
+ * Reads the current {@link IAgentRuntimesClient} from context without
44
+ * throwing.
45
+ *
46
+ * Use this variant in code paths that want to fall back to some other behavior
47
+ * when no provider is mounted (for example, legacy hook implementations that
48
+ * currently still make direct network calls and are being migrated
49
+ * incrementally).
50
+ *
51
+ * @returns The active client, or `null` when no provider is mounted.
52
+ */
53
+ export declare function useOptionalAgentRuntimesClient(): IAgentRuntimesClient | null;
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo } from 'react';
3
+ /**
4
+ * React context carrying the active {@link IAgentRuntimesClient}. `null` when
5
+ * no provider is mounted — in that case {@link useAgentRuntimesClient} throws
6
+ * so callers fail loudly rather than silently making no-op HTTP calls.
7
+ */
8
+ const AgentRuntimesClientContext = createContext(null);
9
+ /**
10
+ * Provides an {@link IAgentRuntimesClient} instance to every descendant.
11
+ *
12
+ * @param props - Provider props.
13
+ *
14
+ * @returns A React element that exposes `props.client` to descendants.
15
+ */
16
+ export function AgentRuntimesClientProvider(props) {
17
+ const { client, children } = props;
18
+ // Memoize the context value so identity only changes when the client
19
+ // reference itself changes.
20
+ const value = useMemo(() => client, [client]);
21
+ return (_jsx(AgentRuntimesClientContext.Provider, { value: value, children: children }));
22
+ }
23
+ /**
24
+ * Reads the active {@link IAgentRuntimesClient} from context.
25
+ *
26
+ * @returns The active client.
27
+ *
28
+ * @throws When called outside an {@link AgentRuntimesClientProvider}. Prefer a
29
+ * loud failure to silently falling back to a default client, because a
30
+ * missing provider usually indicates a wiring bug (especially in the VSCode
31
+ * webview where the default client would make forbidden direct HTTP calls).
32
+ */
33
+ export function useAgentRuntimesClient() {
34
+ const client = useContext(AgentRuntimesClientContext);
35
+ if (client === null) {
36
+ throw new Error('useAgentRuntimesClient must be called inside an <AgentRuntimesClientProvider>. ' +
37
+ 'Wrap your <Chat> component (or the subtree that uses agent-runtimes hooks) ' +
38
+ 'with <AgentRuntimesClientProvider client={...}>.');
39
+ }
40
+ return client;
41
+ }
42
+ /**
43
+ * Reads the current {@link IAgentRuntimesClient} from context without
44
+ * throwing.
45
+ *
46
+ * Use this variant in code paths that want to fall back to some other behavior
47
+ * when no provider is mounted (for example, legacy hook implementations that
48
+ * currently still make direct network calls and are being migrated
49
+ * incrementally).
50
+ *
51
+ * @returns The active client, or `null` when no provider is mounted.
52
+ */
53
+ export function useOptionalAgentRuntimesClient() {
54
+ return useContext(AgentRuntimesClientContext);
55
+ }
@@ -13,7 +13,6 @@
13
13
  import type { Constructor } from '@datalayer/core/lib/client/utils/mixins';
14
14
  import type { AgentEvent, CreateAgentEventRequest, GetAgentEventResponse, ListAgentEventsParams, ListAgentEventsResponse, UpdateAgentEventRequest, RunningAgent, AgentUsageSummary, ConversationCheckpoint, AgentNotification, NotificationFilters, OutputArtifact, EvalReport, RunEvalsRequest, ContextUsage, CostUsage, AgentSpec } from '../types';
15
15
  import type { CreateAgentRuntimeRequest, CreateRuntimeApiResponse } from '../types/agents-lifecycle';
16
- import type { ToolApproval, ToolApprovalFilters } from '../types/tool-approvals';
17
16
  /** Agents mixin providing durable agent management. */
18
17
  export declare function AgentsMixin<TBase extends Constructor>(Base: TBase): {
19
18
  new (...args: any[]): {
@@ -53,23 +52,6 @@ export declare function AgentsMixin<TBase extends Constructor>(Base: TBase): {
53
52
  * @returns Usage summary including tokens, cost, iterations
54
53
  */
55
54
  getAgentUsage(podName: string, agentId?: string): Promise<AgentUsageSummary>;
56
- /**
57
- * List tool approval requests, optionally filtered.
58
- * @param filters - Optional filters (status, agentId)
59
- * @returns Array of tool approval records
60
- */
61
- getToolApprovals(filters?: ToolApprovalFilters): Promise<ToolApproval[]>;
62
- /**
63
- * Approve a tool execution request.
64
- * @param approvalId - ID of the approval to approve
65
- */
66
- approveToolRequest(approvalId: string): Promise<void>;
67
- /**
68
- * Reject a tool execution request.
69
- * @param approvalId - ID of the approval to reject
70
- * @param reason - Optional rejection reason
71
- */
72
- rejectToolRequest(approvalId: string, reason?: string): Promise<void>;
73
55
  /**
74
56
  * List notifications, optionally filtered.
75
57
  * @param filters - Optional filters (level, read status)
@@ -3,7 +3,6 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  import * as agents from '../api/agents';
6
- import * as toolApprovals from '../api/tool-approvals';
7
6
  import * as notifications from '../api/notifications';
8
7
  import * as events from '../api/events';
9
8
  import * as output from '../api/output';
@@ -80,35 +79,12 @@ export function AgentsMixin(Base) {
80
79
  // ========================================================================
81
80
  // Tool Approvals
82
81
  // ========================================================================
83
- /**
84
- * List tool approval requests, optionally filtered.
85
- * @param filters - Optional filters (status, agentId)
86
- * @returns Array of tool approval records
87
- */
88
- async getToolApprovals(filters) {
89
- const token = this.getToken();
90
- const baseUrl = this.getIamRunUrl();
91
- return toolApprovals.getToolApprovals(token, filters, baseUrl);
92
- }
93
- /**
94
- * Approve a tool execution request.
95
- * @param approvalId - ID of the approval to approve
96
- */
97
- async approveToolRequest(approvalId) {
98
- const token = this.getToken();
99
- const baseUrl = this.getIamRunUrl();
100
- return toolApprovals.approveToolRequest(token, approvalId, baseUrl);
101
- }
102
- /**
103
- * Reject a tool execution request.
104
- * @param approvalId - ID of the approval to reject
105
- * @param reason - Optional rejection reason
106
- */
107
- async rejectToolRequest(approvalId, reason) {
108
- const token = this.getToken();
109
- const baseUrl = this.getIamRunUrl();
110
- return toolApprovals.rejectToolRequest(token, approvalId, reason, baseUrl);
111
- }
82
+ //
83
+ // Tool approval interactions have been removed from the REST mixin.
84
+ // All approval flows (list / approve / reject / realtime updates) now
85
+ // travel exclusively over the AI Agents websocket stream. Use the
86
+ // `useToolApprovals` React hook (or send `tool_approval_decision`
87
+ // messages directly on the stream) instead.
112
88
  // ========================================================================
113
89
  // Notifications
114
90
  // ========================================================================
@@ -353,6 +329,11 @@ export function AgentsMixin(Base) {
353
329
  async createAgentRuntime(data) {
354
330
  const token = this.getToken();
355
331
  const runtimesRunUrl = this.getRuntimesRunUrl();
332
+ const normalizedVolumeUids = Array.isArray(data.volumeUids)
333
+ ? data.volumeUids.map(uid => String(uid || '').trim()).filter(Boolean)
334
+ : data.volumeUid
335
+ ? [String(data.volumeUid).trim()]
336
+ : [];
356
337
  return requestDatalayerAPI({
357
338
  url: `${runtimesRunUrl}/api/runtimes/v1/runtimes`,
358
339
  method: 'POST',
@@ -366,6 +347,15 @@ export function AgentsMixin(Base) {
366
347
  enable_codemode: data.enableCodemode ?? false,
367
348
  agent_spec_id: data.agentSpecId || undefined,
368
349
  agent_spec: data.agentSpec || undefined,
350
+ user_account_handle: data.userAccountHandle || undefined,
351
+ billable_account_uid: data.billableAccountUid || undefined,
352
+ billable_account_type: data.billableAccountType || undefined,
353
+ billable_account_handle: data.billableAccountHandle || undefined,
354
+ billable_source_organization_uid: data.billableSourceOrganizationUid || undefined,
355
+ billable_source_organization_handle: data.billableSourceOrganizationHandle || undefined,
356
+ mount_home_folder: data.mountHomeFolder ?? false,
357
+ volume_uids: normalizedVolumeUids.length > 0 ? normalizedVolumeUids : undefined,
358
+ volume_uid: normalizedVolumeUids[0] || data.volumeUid || undefined,
369
359
  },
370
360
  });
371
361
  }