@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
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import { useMemo } from 'react';
12
12
  import { useLexicalStore, DefaultExecutor as LexicalDefaultExecutor, lexicalToolDefinitions, lexicalToolOperations, } from '@datalayer/jupyter-lexical';
13
- import { createAllCopilotKitActions, ActionRegistrar, } from './CopilotKitToolAdapter';
13
+ import { createAllCopilotKitActions } from './CopilotKitToolAdapter';
14
14
  /**
15
15
  * Hook that creates CopilotKit actions for lexical tools.
16
16
  * Returns stable actions array that won't cause re-renders.
@@ -55,5 +55,3 @@ export function useLexicalToolActions(documentId, contextOverrides) {
55
55
  const actions = useMemo(() => createAllCopilotKitActions(lexicalToolDefinitions, lexicalToolOperations, context), [context]);
56
56
  return actions;
57
57
  }
58
- // Re-export shared types and components for convenience
59
- export { ActionRegistrar };
@@ -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 notebook 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 useNotebookToolActions(documentId: string, contextOverrides?: Partial<Omit<ToolExecutionContext, 'executor' | 'documentId'>>): ReturnType<typeof createAllCopilotKitActions>;
27
- export { ActionRegistrar, type UseFrontendToolFn };
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import { useMemo } from 'react';
12
12
  import { notebookStore, DefaultExecutor, notebookToolDefinitions, notebookToolOperations, } from '@datalayer/jupyter-react';
13
- import { createAllCopilotKitActions, ActionRegistrar, } from './CopilotKitToolAdapter';
13
+ import { createAllCopilotKitActions } from './CopilotKitToolAdapter';
14
14
  // Hook wrapper to get notebook store state
15
15
  const useNotebookStore = () => notebookStore.getState();
16
16
  /**
@@ -55,5 +55,3 @@ export function useNotebookToolActions(documentId, contextOverrides) {
55
55
  // Create and return CopilotKit actions (stable reference)
56
56
  return useMemo(() => createAllCopilotKitActions(notebookToolDefinitions, notebookToolOperations, context), [context]);
57
57
  }
58
- // Re-export shared types and components for convenience
59
- export { ActionRegistrar };
@@ -5,5 +5,3 @@
5
5
  */
6
6
  export * from './adapters/copilotkit';
7
7
  export { ToolExecutor, createToolExecutor, type ToolExecutionContext, } from './ToolExecutor';
8
- export type { ToolDefinition, FrontendToolDefinition, BackendToolDefinition, ToolLocation, ToolParameter, ToolRenderStatus, ToolRenderProps, ToolRenderAndWaitProps, ToolCallRequest, ToolExecutionResult, ToolRegistryEntry, } from '../types/tools';
9
- export { isFrontendTool, isBackendTool, hasHitlRender } from '../types/tools';
@@ -11,4 +11,3 @@
11
11
  export * from './adapters/copilotkit';
12
12
  // Tool executor
13
13
  export { ToolExecutor, createToolExecutor, } from './ToolExecutor';
14
- export { isFrontendTool, isBackendTool, hasHitlRender } from '../types/tools';
@@ -18,6 +18,24 @@ export type CreateAgentRuntimeRequest = {
18
18
  agentSpecId?: string;
19
19
  /** Full agent spec payload to propagate to backend services */
20
20
  agentSpec?: Record<string, any>;
21
+ /** Account UID (user or organization) charged for runtime costs */
22
+ billableAccountUid?: string;
23
+ /** User account handle used for user home mount path. */
24
+ userAccountHandle?: string;
25
+ /** Account kind charged for runtime costs. */
26
+ billableAccountType?: 'user' | 'organization' | 'team';
27
+ /** Account handle charged for runtime costs. */
28
+ billableAccountHandle?: string;
29
+ /** Source organization UID for team-billed runtimes. */
30
+ billableSourceOrganizationUid?: string;
31
+ /** Source organization handle for team-billed runtimes. */
32
+ billableSourceOrganizationHandle?: string;
33
+ /** Mount account home folder into runtime. */
34
+ mountHomeFolder?: boolean;
35
+ /** Optional volume UID to mount into runtime. */
36
+ volumeUid?: string;
37
+ /** Optional volume UIDs to mount into runtime. */
38
+ volumeUids?: string[];
21
39
  };
22
40
  export type CreateRuntimeApiResponse = {
23
41
  success?: boolean;
@@ -53,6 +53,12 @@ export type AgentRuntimeData = {
53
53
  token?: string;
54
54
  agentSpec?: AgentSpec;
55
55
  agent_spec_id?: string;
56
+ billable_account_uid?: string;
57
+ billable_account_type?: 'user' | 'organization' | 'team';
58
+ billable_account_handle?: string;
59
+ mount_home_folder?: boolean;
60
+ volume_uid?: string;
61
+ volume_uids?: string[];
56
62
  };
57
63
  export interface RunningAgent {
58
64
  /** Unique agent ID within the runtime */
@@ -33,6 +33,8 @@ export interface AgentSpec {
33
33
  enabled: boolean;
34
34
  /** AI model identifier to use for this agent */
35
35
  model?: string;
36
+ /** Inference provider routing strategy */
37
+ inferenceProvider?: 'local' | 'datalayer';
36
38
  /** MCP servers used by this agent */
37
39
  mcpServers: MCPServer[];
38
40
  /** Skills available to this agent */
@@ -57,7 +59,7 @@ export interface AgentSpec {
57
59
  welcomeNotebook?: string;
58
60
  /** Path to Lexical document to show on agent creation */
59
61
  welcomeDocument?: string;
60
- /** Sandbox variant to use for this agent ('local-eval', 'jupyter', 'local-jupyter') */
62
+ /** Sandbox variant to use for this agent ('eval', 'jupyter') */
61
63
  sandboxVariant?: string;
62
64
  /** User-facing objective for the agent */
63
65
  goal?: string;
@@ -87,4 +89,55 @@ export interface AgentSpec {
87
89
  notifications?: AgentNotificationConfig;
88
90
  /** Memory backend identifier (e.g., 'ephemeral', 'mem0', 'memu', 'simplemem') */
89
91
  memory?: string;
92
+ /** Pre-launch hooks (package installs and sandbox code). */
93
+ preHooks?: {
94
+ packages?: string[];
95
+ sandbox?: string | string[];
96
+ };
97
+ /** Post-stop hooks (sandbox cleanup code). */
98
+ postHooks?: {
99
+ sandbox?: string | string[];
100
+ };
101
+ /** Per-tool-call hooks (authorization/audit integration). */
102
+ toolHooks?: Record<string, any>;
103
+ /** JSON schema for launch-time parameter values. */
104
+ parameters?: Record<string, any>;
105
+ /** Subagent delegation configuration. */
106
+ subagents?: SubAgentsConfig;
107
+ }
108
+ /**
109
+ * Configuration for a subagent within an agent specification.
110
+ */
111
+ export interface SubAgentSpecConfig {
112
+ /** Unique identifier for the subagent */
113
+ name: string;
114
+ /** Brief description shown to the parent agent */
115
+ description: string;
116
+ /** System prompt for the subagent */
117
+ instructions: string;
118
+ /** LLM model to use (defaults to parent agent's model) */
119
+ model?: string;
120
+ /** Whether the subagent can ask the parent for clarification */
121
+ canAskQuestions?: boolean;
122
+ /** Maximum questions the subagent may ask per task */
123
+ maxQuestions?: number;
124
+ /** Default execution mode preference */
125
+ preferredMode?: 'sync' | 'async' | 'auto';
126
+ /** Typical task complexity hint for auto-mode selection */
127
+ typicalComplexity?: 'simple' | 'moderate' | 'complex';
128
+ /** Whether this subagent typically needs user context */
129
+ typicallyNeedsContext?: boolean;
130
+ }
131
+ /**
132
+ * Top-level subagents configuration for an agent specification.
133
+ */
134
+ export interface SubAgentsConfig {
135
+ /** List of subagent configurations */
136
+ subagents: SubAgentSpecConfig[];
137
+ /** Default model for subagents that don't specify one */
138
+ defaultModel?: string;
139
+ /** Include a general-purpose fallback subagent */
140
+ includeGeneralPurpose?: boolean;
141
+ /** Maximum depth for nested subagent delegation (0 = no nesting) */
142
+ maxNestingDepth?: number;
90
143
  }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Evaluation benchmark specification.
3
+ */
4
+ export interface BenchmarkSpec {
5
+ /** Unique benchmark identifier */
6
+ id: string;
7
+ /** Version */
8
+ version?: string;
9
+ /** Display name */
10
+ name: string;
11
+ /** Description of the benchmark */
12
+ description: string;
13
+ /** Category: Coding, Knowledge, Reasoning, Agentic, or Safety */
14
+ category: 'Coding' | 'Knowledge' | 'Reasoning' | 'Agentic' | 'Safety';
15
+ /** Number of tasks in the benchmark */
16
+ task_count: number;
17
+ /** Primary metric (e.g., 'pass@1', 'accuracy', 'success_rate') */
18
+ metric: string;
19
+ /** Source URL or repository */
20
+ source: string;
21
+ /** Difficulty level */
22
+ difficulty: 'easy' | 'medium' | 'hard' | 'expert';
23
+ /** Relevant languages */
24
+ languages: string[];
25
+ /** Dataset source mode used by this benchmark */
26
+ dataset_source?: 'hosted' | 'local' | 'hybrid';
27
+ /** Whether this benchmark can be tracked in live monitoring */
28
+ supports_live_monitoring?: boolean;
29
+ /** Whether this benchmark supports side-by-side run comparison */
30
+ supports_experiment_comparison?: boolean;
31
+ /** Shapes emitted by evaluators (pass_rate, numeric, categorical, error_only) */
32
+ evaluator_shapes?: Array<'pass_rate' | 'numeric' | 'categorical' | 'error_only'>;
33
+ /** Evaluator IDs (optionally versioned) used to score this benchmark */
34
+ evaluators: string[];
35
+ /** Suggested time windows for monitoring UIs */
36
+ recommended_windows?: string[];
37
+ /** Whether traces include links from results to execution spans */
38
+ trace_integration?: boolean;
39
+ /** Whether cases are editable in hosted UI */
40
+ dataset_editability?: 'read-only' | 'editable';
41
+ /** SDK maturity level for this benchmark */
42
+ sdk_support?: 'none' | 'experimental' | 'stable';
43
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ export {};
@@ -9,8 +9,39 @@ import type { Protocol, ProtocolConfig } from './protocol';
9
9
  import type { McpServerSelection } from './inference';
10
10
  import type { MCPServerTool } from './mcp';
11
11
  import type { AgentRuntimeConfig } from './config';
12
+ import type { SandboxWsStatus } from './sandbox';
12
13
  import type { FrontendToolDefinition } from './tools';
13
14
  import type { PoweredByTagProps } from '../chat/display/PoweredByTag';
15
+ /**
16
+ * Context passed to tool-call pre-hooks.
17
+ * Fires when a tool call starts executing (backend or frontend).
18
+ */
19
+ export interface ToolCallStartContext {
20
+ /** The tool name as declared by the agent */
21
+ toolName: string;
22
+ /** Unique identifier for this tool invocation */
23
+ toolCallId: string;
24
+ /** Arguments passed to the tool */
25
+ args: Record<string, unknown>;
26
+ }
27
+ /**
28
+ * Context passed to tool-call post-hooks.
29
+ * Fires when a tool result is received.
30
+ */
31
+ export interface ToolCallCompleteContext {
32
+ /** The tool name as declared by the agent */
33
+ toolName: string;
34
+ /** Unique identifier for this tool invocation */
35
+ toolCallId: string;
36
+ /** Arguments that were passed to the tool */
37
+ args: Record<string, unknown>;
38
+ /** The tool result (may be a string, object, or undefined on error) */
39
+ result: unknown;
40
+ /** Final status of the tool invocation */
41
+ status: DisplayToolCallStatus;
42
+ /** Error message, if the tool call failed */
43
+ error?: string;
44
+ }
14
45
  /**
15
46
  * View mode for the chat component.
16
47
  * - 'floating': Full-height floating panel (pinned to the right edge with offset)
@@ -167,12 +198,197 @@ export interface MCPServerConfig {
167
198
  isConfig?: boolean;
168
199
  isRunning?: boolean;
169
200
  }
201
+ /**
202
+ * Common props shared by all Chat wrapper components
203
+ * (Chat, ChatFloating, ChatSidebar, ChatStandalone, ChatPopupStandalone).
204
+ *
205
+ * These props represent the public API surface that consumers interact with.
206
+ * Wrapper components forward most of them to ChatBase and translate others
207
+ * (e.g. `showNewChatButton` → `headerButtons.showNewChat`).
208
+ *
209
+ * Each wrapper extends this interface with component-specific props
210
+ * (e.g. `position`, `defaultOpen`, `width` for floating variants).
211
+ *
212
+ * Use `panelProps` as an escape hatch to pass any ChatBase prop not
213
+ * directly surfaced in this interface.
214
+ */
215
+ export interface ChatCommonProps {
216
+ /**
217
+ * Protocol type or full configuration.
218
+ *
219
+ * When a `Protocol` string is provided (e.g. `'vercel-ai'`), it is forwarded
220
+ * to ChatBase. When a full `ProtocolConfig` object is provided, it is used
221
+ * directly.
222
+ *
223
+ * @default 'vercel-ai'
224
+ */
225
+ protocol?: Protocol | ProtocolConfig;
226
+ /**
227
+ * Use Zustand store for state management instead of protocol endpoint.
228
+ * @default true
229
+ */
230
+ useStore?: boolean;
231
+ /** Chat title */
232
+ title?: string;
233
+ /** Chat subtitle (rendered under the title in the header) */
234
+ subtitle?: string;
235
+ /** Description shown in empty state */
236
+ description?: string;
237
+ /** Show header */
238
+ showHeader?: boolean;
239
+ /** Show input area */
240
+ showInput?: boolean;
241
+ /** Keep input visible but disabled */
242
+ disableInputPrompt?: boolean;
243
+ /** Custom class name */
244
+ className?: string;
245
+ /** Children to render in the messages area */
246
+ children?: ReactNode;
247
+ /** Custom brand icon for header / empty state */
248
+ brandIcon?: ReactNode;
249
+ /** Input placeholder */
250
+ placeholder?: string;
251
+ /** Show new chat button in header */
252
+ showNewChatButton?: boolean;
253
+ /** Show clear button in header */
254
+ showClearButton?: boolean;
255
+ /** Show settings button in header */
256
+ showSettingsButton?: boolean;
257
+ /** Show powered by tag */
258
+ showPoweredBy?: boolean;
259
+ /** Powered by tag props */
260
+ poweredByProps?: Partial<PoweredByTagProps>;
261
+ /** Callback when settings is clicked */
262
+ onSettingsClick?: () => void;
263
+ /** Callback when new chat is triggered */
264
+ onNewChat?: () => void;
265
+ /** Callback when the component opens */
266
+ onOpen?: () => void;
267
+ /** Callback when the component closes */
268
+ onClose?: () => void;
269
+ /**
270
+ * Custom message handler.
271
+ * When provided, uses this handler instead of protocol mode.
272
+ */
273
+ onSendMessage?: MessageHandler;
274
+ /**
275
+ * Enable streaming mode for custom message handler.
276
+ * @default false
277
+ */
278
+ enableStreaming?: boolean;
279
+ /** Show model selector */
280
+ showModelSelector?: boolean;
281
+ /** Show tools menu */
282
+ showToolsMenu?: boolean;
283
+ /** Show skills menu */
284
+ showSkillsMenu?: boolean;
285
+ /**
286
+ * Show token usage bar.
287
+ * @default true
288
+ */
289
+ showTokenUsage?: boolean;
290
+ /** Indicate tools are accessed via Codemode meta-tools */
291
+ codemodeEnabled?: boolean;
292
+ /**
293
+ * Callback fired when the user toggles codemode from the Tools menu.
294
+ * When omitted, the toggle renders in read-only mode.
295
+ */
296
+ onToggleCodemode?: (enabled: boolean) => void | Promise<void>;
297
+ /** Initial model ID to select (e.g., 'openai:gpt-4o-mini') */
298
+ initialModel?: string;
299
+ /**
300
+ * Override the list of available models.
301
+ * When provided, replaces models returned by the config endpoint.
302
+ */
303
+ availableModels?: ModelConfig[];
304
+ /** MCP server selections to enable (others disabled) */
305
+ mcpServers?: McpServerSelection[];
306
+ /** Initial skill IDs to enable */
307
+ initialSkills?: string[];
308
+ /** Custom render function for tool results */
309
+ renderToolResult?: RenderToolResult;
310
+ /** Frontend tool definitions to register with the chat */
311
+ frontendTools?: FrontendToolDefinition[];
312
+ /** Pre-hook: fires when a tool call starts executing */
313
+ onToolCallStart?: (context: ToolCallStartContext) => void;
314
+ /** Post-hook: fires when a tool result is received */
315
+ onToolCallComplete?: (context: ToolCallCompleteContext) => void;
316
+ /** Suggestions to show in empty state */
317
+ suggestions?: Suggestion[];
318
+ /**
319
+ * Whether to auto-submit when a suggestion is clicked.
320
+ * @default true
321
+ */
322
+ submitOnSuggestionClick?: boolean;
323
+ /**
324
+ * Hide assistant messages that follow a rendered tool call UI.
325
+ * @default false
326
+ */
327
+ hideMessagesAfterToolUI?: boolean;
328
+ /** Runtime ID for conversation persistence */
329
+ runtimeId?: string;
330
+ /** Optional legacy endpoint URL for fetching conversation history */
331
+ historyEndpoint?: string;
332
+ /** Auth token for the agent runtime */
333
+ authToken?: string;
334
+ /** Optional auth token for the legacy history endpoint */
335
+ historyAuthToken?: string;
336
+ /**
337
+ * A prompt to send after conversation history is loaded (sent once).
338
+ */
339
+ pendingPrompt?: string;
340
+ /**
341
+ * Show the information icon in the header.
342
+ * @default false
343
+ */
344
+ showInformation?: boolean;
345
+ /** Callback when the information icon is clicked */
346
+ onInformationClick?: () => void;
347
+ /** Current chat view mode for header segmented toggle */
348
+ chatViewMode?: ChatViewMode;
349
+ /** Callback when user switches chat view mode */
350
+ onChatViewModeChange?: (mode: ChatViewMode) => void;
351
+ /** External context snapshot data for the token usage bar */
352
+ contextSnapshot?: import('./context').ContextSnapshotData;
353
+ /** External MCP toolsets status data */
354
+ mcpStatusData?: import('./mcp').McpToolsetsStatusResponse | null;
355
+ /** External codemode status data (e.g. from WebSocket stream). */
356
+ codemodeStatusData?: import('./stream').CodemodeStatusData | null;
357
+ /** Optional sandbox status override for immediate UI updates. */
358
+ sandboxStatusData?: SandboxWsStatus | null;
359
+ /**
360
+ * Whether to render the top-of-chat tool approval banner when there are
361
+ * pending approvals. @default true
362
+ */
363
+ showToolApprovalBanner?: boolean;
364
+ /** Pending tool approval requests to render in the top banner. */
365
+ pendingApprovals?: import('../chat/tools').PendingApproval[];
366
+ /** Called when the user approves a pending request. */
367
+ onApproveApproval?: (approvalId: string, note?: string) => void | Promise<boolean | void>;
368
+ /** Called when the user rejects a pending request. */
369
+ onRejectApproval?: (approvalId: string, note?: string) => void | Promise<boolean | void>;
370
+ /** Custom header content (rendered below title row) */
371
+ headerContent?: ReactNode;
372
+ /** Custom header actions (rendered in title row, right side) */
373
+ headerActions?: ReactNode;
374
+ /** Auto-focus the input on mount */
375
+ autoFocus?: boolean;
376
+ /** Callback for state updates */
377
+ onStateUpdate?: (state: unknown) => void;
378
+ /**
379
+ * Additional ChatBase props (escape hatch).
380
+ * Props set here are spread onto ChatBase as overrides.
381
+ */
382
+ panelProps?: Partial<ChatBaseProps>;
383
+ }
170
384
  /**
171
385
  * ChatBase props
172
386
  */
173
387
  export interface ChatBaseProps {
174
388
  /** Chat title */
175
389
  title?: string;
390
+ /** Chat subtitle (rendered under the title in the header) */
391
+ subtitle?: string;
176
392
  /** Show header */
177
393
  showHeader?: boolean;
178
394
  /**
@@ -182,12 +398,39 @@ export interface ChatBaseProps {
182
398
  * @default true
183
399
  */
184
400
  showTokenUsage?: boolean;
401
+ /**
402
+ * External context snapshot data for the token usage bar.
403
+ * When provided, this overrides the built-in useContextSnapshot hook
404
+ * (which is a no-op since the REST endpoint was removed).
405
+ * Pass live data received from the monitoring WebSocket.
406
+ */
407
+ contextSnapshot?: import('./context').ContextSnapshotData;
408
+ /**
409
+ * External MCP toolsets status data for the MCP indicator.
410
+ * When provided, the data is forwarded to the McpStatusIndicator
411
+ * so it shows live status instead of "No MCP Server defined".
412
+ */
413
+ mcpStatusData?: import('./mcp').McpToolsetsStatusResponse | null;
414
+ /**
415
+ * External codemode status data. When provided, it is forwarded to
416
+ * AgentDetails so the info panel can render a live codemode status
417
+ * without waiting for the global WebSocket stream.
418
+ */
419
+ codemodeStatusData?: import('./stream').CodemodeStatusData | null;
420
+ /**
421
+ * External sandbox status data for the sandbox indicator.
422
+ * When provided, this data is preferred over the indicator's local
423
+ * WebSocket state, which allows optimistic variant updates.
424
+ */
425
+ sandboxStatusData?: SandboxWsStatus | null;
185
426
  /** Show loading indicator */
186
427
  showLoadingIndicator?: boolean;
187
428
  /** Show error messages */
188
429
  showErrors?: boolean;
189
430
  /** Show input area */
190
431
  showInput?: boolean;
432
+ /** Keep input visible but disabled */
433
+ disableInputPrompt?: boolean;
191
434
  /** Show model selector (for protocols that support it) */
192
435
  showModelSelector?: boolean;
193
436
  /** Show tools menu (for protocols that support it) */
@@ -196,6 +439,11 @@ export interface ChatBaseProps {
196
439
  showSkillsMenu?: boolean;
197
440
  /** Indicate tools are accessed via Codemode meta-tools */
198
441
  codemodeEnabled?: boolean;
442
+ /**
443
+ * Callback fired when the user toggles codemode from the Tools menu.
444
+ * When omitted, the toggle renders in read-only mode.
445
+ */
446
+ onToggleCodemode?: (enabled: boolean) => void | Promise<void>;
199
447
  /** Initial model ID to select (e.g., 'openai:gpt-4o-mini') */
200
448
  initialModel?: string;
201
449
  /**
@@ -214,6 +462,22 @@ export interface ChatBaseProps {
214
462
  loadingState?: React.ReactNode;
215
463
  /** Header actions */
216
464
  headerActions?: React.ReactNode;
465
+ /** Notebook kernel indicator state override for the chat header. */
466
+ kernelIndicatorState?: import('@datalayer/jupyter-react').ExecutionState;
467
+ /**
468
+ * Live notebook kernel connection. When provided, the chat header
469
+ * renders the same `<KernelIndicator>` as the notebook toolbar so
470
+ * the colour and tooltip remain in sync with the notebook runtime.
471
+ */
472
+ kernel?: import('@jupyterlab/services/lib/kernel/kernel').IKernelConnection | null;
473
+ /** Optional environment name displayed in kernel indicator details. */
474
+ kernelEnvironmentName?: string;
475
+ /** Optional CPU info displayed in kernel indicator details. */
476
+ kernelCpu?: string;
477
+ /** Optional memory info displayed in kernel indicator details. */
478
+ kernelMemory?: string;
479
+ /** Optional GPU info displayed in kernel indicator details. */
480
+ kernelGpu?: string;
217
481
  /**
218
482
  * Current chat view mode.
219
483
  * When provided, a segmented view-mode toggle is rendered in the header
@@ -392,20 +656,18 @@ export interface ChatBaseProps {
392
656
  }>;
393
657
  /**
394
658
  * Runtime ID for conversation persistence.
395
- * When provided, messages are fetched from the server API on page reload
396
- * and prevents message mixing between different agent runtimes.
659
+ * When provided, messages are restored from websocket snapshot data on
660
+ * reload and prevents message mixing between different agent runtimes.
397
661
  */
398
662
  runtimeId?: string;
399
663
  /**
400
- * Endpoint URL for fetching conversation history.
401
- * When runtimeId is provided, this endpoint is called to fetch
402
- * the conversation history on mount.
403
- * If not provided, defaults to `{protocol.endpoint}/api/v1/history`.
664
+ * Optional legacy endpoint URL for history backfill.
665
+ * History loading is websocket-first; this field is kept for
666
+ * compatibility with custom integrations.
404
667
  */
405
668
  historyEndpoint?: string;
406
669
  /**
407
- * Auth token for the history endpoint.
408
- * If not provided, uses the protocol's authToken.
670
+ * Optional auth token for the legacy history endpoint.
409
671
  */
410
672
  historyAuthToken?: string;
411
673
  /**
@@ -413,4 +675,59 @@ export interface ChatBaseProps {
413
675
  * The message is shown in the chat and sent to the agent exactly once.
414
676
  */
415
677
  pendingPrompt?: string;
678
+ /**
679
+ * Pre-hook: fires when a tool call starts executing.
680
+ * Called for both backend and frontend tools.
681
+ *
682
+ * @example
683
+ * ```tsx
684
+ * <Chat
685
+ * onToolCallStart={({ toolName, args }) => {
686
+ * console.log(`Tool ${toolName} started`, args);
687
+ * }}
688
+ * />
689
+ * ```
690
+ */
691
+ onToolCallStart?: (context: ToolCallStartContext) => void;
692
+ /**
693
+ * Post-hook: fires when a tool result is received.
694
+ * Called for both backend and frontend tools.
695
+ * Use this to react to specific tool outcomes (e.g. update UI state
696
+ * when a `load_skill` tool completes).
697
+ *
698
+ * @example
699
+ * ```tsx
700
+ * <Chat
701
+ * onToolCallComplete={({ toolName, result, status }) => {
702
+ * if (toolName === 'load_skill' && status === 'complete') {
703
+ * // Update skills sidebar from load_skill result
704
+ * updateSkillsFromResult(result);
705
+ * }
706
+ * }}
707
+ * />
708
+ * ```
709
+ */
710
+ onToolCallComplete?: (context: ToolCallCompleteContext) => void;
711
+ /**
712
+ * Whether to render the top-of-chat tool approval banner (and its review
713
+ * dialog) when `pendingApprovals` is non-empty. The banner/dialog render
714
+ * only when approvals are actually pending; this flag lets integrators opt
715
+ * out entirely.
716
+ * @default true
717
+ */
718
+ showToolApprovalBanner?: boolean;
719
+ /**
720
+ * Pending tool approval requests to render in the built-in banner.
721
+ * Typically sourced from the approvals websocket in the hosting app.
722
+ */
723
+ pendingApprovals?: import('../chat/tools').PendingApproval[];
724
+ /**
725
+ * Called when the user approves a pending request (from banner "Approve All"
726
+ * or from the review dialog).
727
+ */
728
+ onApproveApproval?: (approvalId: string, note?: string) => void | Promise<boolean | void>;
729
+ /**
730
+ * Called when the user rejects a pending request from the review dialog.
731
+ */
732
+ onRejectApproval?: (approvalId: string, note?: string) => void | Promise<boolean | void>;
416
733
  }
@@ -54,6 +54,33 @@ export interface ContextSnapshotData {
54
54
  turns: number;
55
55
  durationSeconds: number;
56
56
  } | null;
57
+ costUsage?: {
58
+ lastTurnCostUsd: number;
59
+ cumulativeCostUsd: number;
60
+ perRunBudgetUsd: number | null;
61
+ cumulativeBudgetUsd: number | null;
62
+ requestCount: number;
63
+ totalTokensUsed: number;
64
+ modelBreakdown: Array<{
65
+ model: string;
66
+ inputTokens: number;
67
+ outputTokens: number;
68
+ costUsd: number;
69
+ requests: number;
70
+ }>;
71
+ runs: Array<{
72
+ timestamp: string;
73
+ model: string;
74
+ inputTokens: number;
75
+ outputTokens: number;
76
+ runCostUsd: number;
77
+ cumulativeCostUsd: number;
78
+ pricePerInputToken: number | null;
79
+ pricePerOutputToken: number | null;
80
+ pricingResolved: boolean;
81
+ }>;
82
+ lastUpdated: string | null;
83
+ };
57
84
  error?: string;
58
85
  }
59
86
  /**
@@ -15,8 +15,8 @@ export interface ContextUsage {
15
15
  summarizationCount: number;
16
16
  }
17
17
  export interface CostUsage {
18
- /** Current run cost in USD */
19
- currentRunCostUsd: number;
18
+ /** Last turn cost in USD */
19
+ lastTurnCostUsd: number;
20
20
  /** Cumulative cost in USD */
21
21
  cumulativeCostUsd: number;
22
22
  /** Budget limit per run (from agentspec) */