@datalayer/agent-runtimes 1.0.4 → 1.0.5

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 (267) hide show
  1. package/README.md +34 -0
  2. package/lib/App.js +1 -1
  3. package/lib/agents/AgentDetails.d.ts +22 -1
  4. package/lib/agents/AgentDetails.js +34 -47
  5. package/lib/api/index.d.ts +0 -1
  6. package/lib/api/index.js +4 -2
  7. package/lib/chat/Chat.d.ts +5 -106
  8. package/lib/chat/Chat.js +4 -4
  9. package/lib/chat/ChatFloating.d.ts +7 -140
  10. package/lib/chat/ChatFloating.js +2 -2
  11. package/lib/chat/ChatPopupStandalone.d.ts +8 -47
  12. package/lib/chat/ChatPopupStandalone.js +3 -3
  13. package/lib/chat/ChatSidebar.d.ts +4 -69
  14. package/lib/chat/ChatSidebar.js +2 -2
  15. package/lib/chat/ChatStandalone.d.ts +4 -54
  16. package/lib/chat/ChatStandalone.js +3 -3
  17. package/lib/chat/base/ChatBase.js +1083 -157
  18. package/lib/chat/header/ChatHeaderBase.d.ts +11 -6
  19. package/lib/chat/header/ChatHeaderBase.js +18 -16
  20. package/lib/chat/indicators/McpStatusIndicator.d.ts +7 -4
  21. package/lib/chat/indicators/McpStatusIndicator.js +7 -32
  22. package/lib/chat/indicators/SandboxStatusIndicator.d.ts +4 -1
  23. package/lib/chat/indicators/SandboxStatusIndicator.js +9 -9
  24. package/lib/chat/indicators/SkillsStatusIndicator.d.ts +7 -0
  25. package/lib/chat/indicators/SkillsStatusIndicator.js +88 -0
  26. package/lib/chat/indicators/index.d.ts +1 -0
  27. package/lib/chat/indicators/index.js +1 -0
  28. package/lib/chat/messages/ChatMessageList.d.ts +1 -1
  29. package/lib/chat/messages/ChatMessageList.js +108 -113
  30. package/lib/chat/prompt/InputFooter.d.ts +19 -6
  31. package/lib/chat/prompt/InputFooter.js +71 -18
  32. package/lib/chat/prompt/InputPrompt.d.ts +3 -1
  33. package/lib/chat/prompt/InputPrompt.js +4 -4
  34. package/lib/chat/prompt/InputPromptFooter.js +1 -1
  35. package/lib/chat/prompt/InputPromptLexical.d.ts +3 -1
  36. package/lib/chat/prompt/InputPromptLexical.js +12 -5
  37. package/lib/chat/prompt/InputPromptText.d.ts +3 -1
  38. package/lib/chat/prompt/InputPromptText.js +2 -2
  39. package/lib/chat/tools/ToolApprovalBanner.js +1 -1
  40. package/lib/chat/tools/ToolCallDisplay.d.ts +3 -1
  41. package/lib/chat/tools/ToolCallDisplay.js +2 -2
  42. package/lib/chat/usage/TokenUsageBar.js +20 -2
  43. package/lib/client/AgentRuntimesClientContext.d.ts +53 -0
  44. package/lib/client/AgentRuntimesClientContext.js +55 -0
  45. package/lib/client/AgentsMixin.d.ts +0 -18
  46. package/lib/client/AgentsMixin.js +6 -30
  47. package/lib/client/IAgentRuntimesClient.d.ts +215 -0
  48. package/lib/client/IAgentRuntimesClient.js +5 -0
  49. package/lib/client/SdkAgentRuntimesClient.d.ts +151 -0
  50. package/lib/client/SdkAgentRuntimesClient.js +134 -0
  51. package/lib/client/index.d.ts +4 -1
  52. package/lib/client/index.js +3 -1
  53. package/lib/components/NotificationEventCard.js +5 -1
  54. package/lib/config/AgentConfiguration.js +3 -3
  55. package/lib/context/ContextDistribution.d.ts +3 -1
  56. package/lib/context/ContextDistribution.js +8 -27
  57. package/lib/context/ContextInspector.d.ts +3 -1
  58. package/lib/context/ContextInspector.js +19 -67
  59. package/lib/context/ContextPanel.d.ts +3 -1
  60. package/lib/context/ContextPanel.js +104 -64
  61. package/lib/context/ContextUsage.d.ts +3 -1
  62. package/lib/context/ContextUsage.js +3 -3
  63. package/lib/context/CostTracker.d.ts +9 -3
  64. package/lib/context/CostTracker.js +26 -47
  65. package/lib/context/CostUsageChart.d.ts +12 -0
  66. package/lib/context/CostUsageChart.js +378 -0
  67. package/lib/context/GraphFlowChart.d.ts +16 -0
  68. package/lib/context/GraphFlowChart.js +182 -0
  69. package/lib/context/TokenUsageChart.d.ts +8 -1
  70. package/lib/context/TokenUsageChart.js +349 -211
  71. package/lib/context/TurnGraphChart.d.ts +39 -0
  72. package/lib/context/TurnGraphChart.js +538 -0
  73. package/lib/context/otelWsPool.d.ts +20 -0
  74. package/lib/context/otelWsPool.js +69 -0
  75. package/lib/examples/A2UiComponentGalleryExample.d.ts +0 -17
  76. package/lib/examples/A2UiComponentGalleryExample.js +315 -522
  77. package/lib/examples/A2UiContactCardExample.d.ts +0 -18
  78. package/lib/examples/A2UiContactCardExample.js +154 -411
  79. package/lib/examples/A2UiRestaurantExample.d.ts +0 -30
  80. package/lib/examples/A2UiRestaurantExample.js +114 -212
  81. package/lib/examples/A2UiViewerExample.d.ts +0 -18
  82. package/lib/examples/A2UiViewerExample.js +283 -532
  83. package/lib/examples/AgUiBackendToolRenderingExample.js +1 -1
  84. package/lib/examples/AgUiHaikuGenUiExample.d.ts +1 -1
  85. package/lib/examples/AgUiHaikuGenUiExample.js +1 -1
  86. package/lib/examples/AgentCheckpointsExample.js +13 -27
  87. package/lib/examples/AgentCodemodeExample.d.ts +4 -6
  88. package/lib/examples/AgentCodemodeExample.js +591 -169
  89. package/lib/examples/AgentEvalsExample.js +12 -16
  90. package/lib/examples/AgentGuardrailsExample.js +370 -64
  91. package/lib/examples/AgentHooksExample.d.ts +3 -0
  92. package/lib/examples/AgentHooksExample.js +104 -0
  93. package/lib/examples/AgentMCPExample.d.ts +3 -0
  94. package/lib/examples/AgentMCPExample.js +480 -0
  95. package/lib/examples/AgentMemoryExample.js +13 -17
  96. package/lib/examples/AgentMonitoringExample.js +260 -199
  97. package/lib/examples/AgentNotificationsExample.js +49 -17
  98. package/lib/examples/AgentOtelExample.js +2 -3
  99. package/lib/examples/AgentOutputsExample.d.ts +11 -6
  100. package/lib/examples/AgentOutputsExample.js +382 -81
  101. package/lib/examples/AgentParametersExample.d.ts +3 -0
  102. package/lib/examples/AgentParametersExample.js +246 -0
  103. package/lib/examples/AgentSandboxExample.d.ts +2 -2
  104. package/lib/examples/AgentSandboxExample.js +68 -40
  105. package/lib/examples/AgentSkillsExample.js +91 -99
  106. package/lib/examples/{AgentspecExample.js → AgentSpecsExample.js} +10 -21
  107. package/lib/examples/AgentSubagentsExample.d.ts +14 -0
  108. package/lib/examples/AgentSubagentsExample.js +228 -0
  109. package/lib/examples/AgentToolApprovalsExample.js +29 -557
  110. package/lib/examples/AgentTriggersExample.js +819 -565
  111. package/lib/examples/ChatCustomExample.js +11 -24
  112. package/lib/examples/ChatExample.js +7 -24
  113. package/lib/examples/CopilotKitLexicalExample.js +2 -1
  114. package/lib/examples/CopilotKitNotebookExample.js +2 -1
  115. package/lib/examples/HomeExample.d.ts +15 -0
  116. package/lib/examples/HomeExample.js +77 -0
  117. package/lib/examples/Lexical2Example.js +4 -2
  118. package/lib/examples/{LexicalExample.d.ts → LexicalAgentExample.d.ts} +4 -4
  119. package/lib/examples/{LexicalExample.js → LexicalAgentExample.js} +65 -16
  120. package/lib/examples/{LexicalSidebarExample.d.ts → LexicalAgentSidebarExample.d.ts} +5 -5
  121. package/lib/examples/LexicalAgentSidebarExample.js +261 -0
  122. package/lib/examples/NotebookAgentExample.d.ts +9 -0
  123. package/lib/examples/NotebookAgentExample.js +192 -0
  124. package/lib/examples/{NotebookSidebarExample.d.ts → NotebookAgentSidebarExample.d.ts} +2 -2
  125. package/lib/examples/NotebookAgentSidebarExample.js +221 -0
  126. package/lib/examples/{DatalayerNotebookExample.d.ts → NotebookCollaborationExample.d.ts} +4 -4
  127. package/lib/examples/{DatalayerNotebookExample.js → NotebookCollaborationExample.js} +3 -3
  128. package/lib/examples/NotebookExample.d.ts +4 -7
  129. package/lib/examples/NotebookExample.js +14 -146
  130. package/lib/examples/components/AuthRequiredView.d.ts +6 -0
  131. package/lib/examples/components/AuthRequiredView.js +33 -0
  132. package/lib/examples/components/ExampleWrapper.d.ts +7 -0
  133. package/lib/examples/components/ExampleWrapper.js +25 -6
  134. package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.js +1 -1
  135. package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.js +1 -1
  136. package/lib/examples/{ag-ui → components}/haiku/index.d.ts +1 -1
  137. package/lib/examples/{ag-ui → components}/haiku/index.js +1 -1
  138. package/lib/examples/components/index.d.ts +3 -0
  139. package/lib/examples/components/index.js +4 -0
  140. package/lib/examples/{ag-ui → components}/weather/index.d.ts +1 -1
  141. package/lib/examples/{ag-ui → components}/weather/index.js +1 -1
  142. package/lib/examples/example-selector.d.ts +17 -4
  143. package/lib/examples/example-selector.js +107 -41
  144. package/lib/examples/index.d.ts +9 -6
  145. package/lib/examples/index.js +9 -6
  146. package/lib/examples/main.js +217 -27
  147. package/lib/examples/utils/a2ui.d.ts +18 -0
  148. package/lib/examples/utils/a2ui.js +69 -0
  149. package/lib/examples/utils/a2uiMarkdownProvider.d.ts +7 -0
  150. package/lib/examples/utils/a2uiMarkdownProvider.js +9 -0
  151. package/lib/examples/utils/agentId.d.ts +18 -0
  152. package/lib/examples/utils/agentId.js +54 -0
  153. package/lib/examples/utils/agents/earthquake-detector.json +11 -11
  154. package/lib/examples/utils/agents/sales-forecaster.json +11 -11
  155. package/lib/examples/utils/agents/social-post-generator.json +11 -11
  156. package/lib/examples/utils/agents/stock-market.json +11 -11
  157. package/lib/examples/utils/examplesStore.js +82 -27
  158. package/lib/hooks/index.d.ts +8 -8
  159. package/lib/hooks/index.js +7 -7
  160. package/lib/hooks/useA2A.d.ts +2 -3
  161. package/lib/hooks/useAIAgentsWebSocket.d.ts +43 -4
  162. package/lib/hooks/useAIAgentsWebSocket.js +118 -12
  163. package/lib/hooks/useAcp.d.ts +1 -2
  164. package/lib/hooks/useAgUi.d.ts +1 -1
  165. package/lib/hooks/{useAgents.d.ts → useAgentRuntimes.d.ts} +39 -2
  166. package/lib/hooks/{useAgents.js → useAgentRuntimes.js} +125 -15
  167. package/lib/hooks/useAgentsCatalog.js +1 -1
  168. package/lib/hooks/useAgentsService.d.ts +2 -2
  169. package/lib/hooks/useAgentsService.js +7 -7
  170. package/lib/hooks/useCheckpoints.js +1 -1
  171. package/lib/hooks/useConfig.d.ts +4 -1
  172. package/lib/hooks/useConfig.js +10 -3
  173. package/lib/hooks/useContextSnapshot.d.ts +9 -4
  174. package/lib/hooks/useContextSnapshot.js +9 -37
  175. package/lib/hooks/useMonitoring.js +3 -0
  176. package/lib/hooks/useSandbox.d.ts +20 -8
  177. package/lib/hooks/useSandbox.js +105 -40
  178. package/lib/hooks/useSkills.d.ts +23 -5
  179. package/lib/hooks/useSkills.js +94 -39
  180. package/lib/hooks/useToolApprovals.d.ts +60 -36
  181. package/lib/hooks/useToolApprovals.js +318 -69
  182. package/lib/hooks/useVercelAI.d.ts +1 -1
  183. package/lib/index.d.ts +2 -1
  184. package/lib/index.js +1 -0
  185. package/lib/inference/index.d.ts +0 -1
  186. package/lib/middleware/index.d.ts +0 -1
  187. package/lib/protocols/AGUIAdapter.js +6 -0
  188. package/lib/protocols/VercelAIAdapter.d.ts +7 -0
  189. package/lib/protocols/VercelAIAdapter.js +59 -7
  190. package/lib/specs/agents/agents.d.ts +10 -0
  191. package/lib/specs/agents/agents.js +2139 -262
  192. package/lib/specs/agents/index.js +3 -1
  193. package/lib/specs/envvars.d.ts +1 -0
  194. package/lib/specs/envvars.js +38 -20
  195. package/lib/specs/evals.js +6 -6
  196. package/lib/specs/events.d.ts +3 -10
  197. package/lib/specs/events.js +127 -84
  198. package/lib/specs/frontendTools.js +2 -2
  199. package/lib/specs/guardrails.d.ts +0 -7
  200. package/lib/specs/guardrails.js +240 -159
  201. package/lib/specs/index.d.ts +1 -0
  202. package/lib/specs/index.js +1 -0
  203. package/lib/specs/mcpServers.js +35 -6
  204. package/lib/specs/memory.d.ts +0 -2
  205. package/lib/specs/memory.js +4 -17
  206. package/lib/specs/models.js +25 -5
  207. package/lib/specs/notifications.js +102 -18
  208. package/lib/specs/outputs.js +15 -9
  209. package/lib/specs/personas.d.ts +41 -0
  210. package/lib/specs/personas.js +168 -0
  211. package/lib/specs/skills.d.ts +2 -1
  212. package/lib/specs/skills.js +41 -23
  213. package/lib/specs/teams/index.js +3 -1
  214. package/lib/specs/teams/teams.js +468 -348
  215. package/lib/specs/tools.js +4 -4
  216. package/lib/specs/triggers.js +61 -11
  217. package/lib/stores/agentRuntimeStore.d.ts +204 -0
  218. package/lib/stores/agentRuntimeStore.js +636 -0
  219. package/lib/stores/index.d.ts +1 -1
  220. package/lib/stores/index.js +1 -1
  221. package/lib/tools/adapters/copilotkit/lexicalHooks.d.ts +1 -2
  222. package/lib/tools/adapters/copilotkit/lexicalHooks.js +1 -3
  223. package/lib/tools/adapters/copilotkit/notebookHooks.d.ts +1 -2
  224. package/lib/tools/adapters/copilotkit/notebookHooks.js +1 -3
  225. package/lib/tools/index.d.ts +0 -2
  226. package/lib/tools/index.js +0 -1
  227. package/lib/types/agentspecs.d.ts +50 -1
  228. package/lib/types/chat.d.ts +309 -8
  229. package/lib/types/context.d.ts +27 -0
  230. package/lib/types/cost.d.ts +2 -2
  231. package/lib/types/index.d.ts +2 -0
  232. package/lib/types/index.js +2 -0
  233. package/lib/types/mcp.d.ts +8 -0
  234. package/lib/types/models.d.ts +2 -2
  235. package/lib/types/personas.d.ts +25 -0
  236. package/lib/types/personas.js +5 -0
  237. package/lib/types/skills.d.ts +43 -1
  238. package/lib/types/stream.d.ts +110 -0
  239. package/lib/types/stream.js +36 -0
  240. package/lib/utils/utils.d.ts +9 -5
  241. package/lib/utils/utils.js +9 -5
  242. package/package.json +13 -9
  243. package/scripts/codegen/__pycache__/generate_agents.cpython-313.pyc +0 -0
  244. package/scripts/codegen/__pycache__/generate_events.cpython-313.pyc +0 -0
  245. package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
  246. package/scripts/codegen/generate_agents.py +102 -6
  247. package/scripts/codegen/generate_events.py +35 -13
  248. package/scripts/codegen/generate_personas.py +319 -0
  249. package/scripts/codegen/generate_skills.py +9 -9
  250. package/scripts/sync-jupyter.sh +26 -7
  251. package/lib/api/tool-approvals.d.ts +0 -62
  252. package/lib/api/tool-approvals.js +0 -145
  253. package/lib/examples/LexicalSidebarExample.js +0 -163
  254. package/lib/examples/NotebookSidebarExample.js +0 -119
  255. package/lib/examples/NotebookSimpleExample.d.ts +0 -6
  256. package/lib/examples/NotebookSimpleExample.js +0 -22
  257. package/lib/examples/ag-ui/index.d.ts +0 -10
  258. package/lib/examples/ag-ui/index.js +0 -16
  259. package/lib/hooks/useAgentsRegistry.d.ts +0 -10
  260. package/lib/hooks/useAgentsRegistry.js +0 -20
  261. package/lib/stores/agentsStore.d.ts +0 -123
  262. package/lib/stores/agentsStore.js +0 -270
  263. /package/lib/examples/{AgentspecExample.d.ts → AgentSpecsExample.d.ts} +0 -0
  264. /package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.d.ts +0 -0
  265. /package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.d.ts +0 -0
  266. /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.d.ts +0 -0
  267. /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.js +0 -0
@@ -10,7 +10,7 @@ export const RUNTIME_ECHO_TOOL_SPEC_0_0_1 = {
10
10
  version: '0.0.1',
11
11
  name: 'Runtime Echo',
12
12
  description: 'Echo text back to the caller for quick runtime verification.',
13
- tags: ["runtime", "utility"],
13
+ tags: ['runtime', 'utility'],
14
14
  enabled: true,
15
15
  approval: 'auto',
16
16
  timeout: undefined,
@@ -28,7 +28,7 @@ export const RUNTIME_SEND_MAIL_TOOL_SPEC_0_0_1 = {
28
28
  version: '0.0.1',
29
29
  name: 'Runtime Send Mail (Fake)',
30
30
  description: 'Fake mail sender for tool approval demos; returns a simulated send receipt.',
31
- tags: ["runtime", "approval", "mail"],
31
+ tags: ['runtime', 'approval', 'mail'],
32
32
  enabled: true,
33
33
  approval: 'manual',
34
34
  timeout: undefined,
@@ -46,10 +46,10 @@ export const RUNTIME_SENSITIVE_ECHO_TOOL_SPEC_0_0_1 = {
46
46
  version: '0.0.1',
47
47
  name: 'Runtime Sensitive Echo',
48
48
  description: 'Echo text with a manual approval checkpoint before execution.',
49
- tags: ["runtime", "approval"],
49
+ tags: ['runtime', 'approval'],
50
50
  enabled: true,
51
51
  approval: 'manual',
52
- timeout: '5h0m0s',
52
+ timeout: undefined,
53
53
  requiresApproval: true,
54
54
  runtime: {
55
55
  language: 'python',
@@ -12,10 +12,35 @@ export const EVENT_TRIGGER_SPEC_0_0_1 = {
12
12
  description: 'Trigger on specific events such as a webhook call, API request, database change, file upload, or email arrival.',
13
13
  type: 'event',
14
14
  fields: [
15
- { name: 'event_source', label: 'Event Source URL', type: 'string', required: false, placeholder: 'https://helpdesk.example.com/webhooks', help: 'Allowed event source URL (leave empty to allow any source)' },
16
- { name: 'event', label: 'Event Name', type: 'string', required: false, placeholder: 'email_received' },
17
- { name: 'description', label: 'Description', type: 'string', required: false, placeholder: 'Description (e.g. \'Triggered on incoming email\')' },
18
- { name: 'prompt', label: 'Trigger Prompt', type: 'string', required: false, placeholder: 'Handle the incoming event and execute the agent end-to-end.' },
15
+ {
16
+ name: 'event_source',
17
+ label: 'Event Source URL',
18
+ type: 'string',
19
+ required: false,
20
+ placeholder: 'https://helpdesk.example.com/webhooks',
21
+ help: 'Allowed event source URL (leave empty to allow any source)',
22
+ },
23
+ {
24
+ name: 'event',
25
+ label: 'Event Name',
26
+ type: 'string',
27
+ required: false,
28
+ placeholder: 'email_received',
29
+ },
30
+ {
31
+ name: 'description',
32
+ label: 'Description',
33
+ type: 'string',
34
+ required: false,
35
+ placeholder: "Description (e.g. 'Triggered on incoming email')",
36
+ },
37
+ {
38
+ name: 'prompt',
39
+ label: 'Trigger Prompt',
40
+ type: 'string',
41
+ required: false,
42
+ placeholder: 'Handle the incoming event and execute the agent end-to-end.',
43
+ },
19
44
  ],
20
45
  };
21
46
  export const ONCE_TRIGGER_SPEC_0_0_1 = {
@@ -25,7 +50,13 @@ export const ONCE_TRIGGER_SPEC_0_0_1 = {
25
50
  description: 'Execute agent immediately after deployment.',
26
51
  type: 'once',
27
52
  fields: [
28
- { name: 'prompt', label: 'Trigger Prompt', type: 'string', required: false, placeholder: 'Start when requested by a user and complete the agent once.' },
53
+ {
54
+ name: 'prompt',
55
+ label: 'Trigger Prompt',
56
+ type: 'string',
57
+ required: false,
58
+ placeholder: 'Start when requested by a user and complete the agent once.',
59
+ },
29
60
  ],
30
61
  };
31
62
  export const SCHEDULE_TRIGGER_SPEC_0_0_1 = {
@@ -35,18 +66,37 @@ export const SCHEDULE_TRIGGER_SPEC_0_0_1 = {
35
66
  description: 'Run on a recurring schedule using a cron expression (e.g. daily at 9 AM, every Monday, monthly on the 1st).',
36
67
  type: 'schedule',
37
68
  fields: [
38
- { name: 'cron', label: 'Cron Expression', type: 'string', required: true, placeholder: '0 9 * * * (every day at 9 AM)', font: 'mono' },
39
- { name: 'description', label: 'Description', type: 'string', required: false, placeholder: 'Description (e.g. \'Monthly sales report\')' },
40
- { name: 'prompt', label: 'Trigger Prompt', type: 'string', required: false, placeholder: 'Run the scheduled agent and produce the configured deliverable.' },
69
+ {
70
+ name: 'cron',
71
+ label: 'Cron Expression',
72
+ type: 'string',
73
+ required: true,
74
+ placeholder: '0 9 * * * (every day at 9 AM)',
75
+ font: 'mono',
76
+ },
77
+ {
78
+ name: 'description',
79
+ label: 'Description',
80
+ type: 'string',
81
+ required: false,
82
+ placeholder: "Description (e.g. 'Monthly sales report')",
83
+ },
84
+ {
85
+ name: 'prompt',
86
+ label: 'Trigger Prompt',
87
+ type: 'string',
88
+ required: false,
89
+ placeholder: 'Run the scheduled agent and produce the configured deliverable.',
90
+ },
41
91
  ],
42
92
  };
43
93
  // ============================================================================
44
94
  // Trigger Catalog
45
95
  // ============================================================================
46
96
  export const TRIGGER_CATALOG = {
47
- 'event': EVENT_TRIGGER_SPEC_0_0_1,
48
- 'once': ONCE_TRIGGER_SPEC_0_0_1,
49
- 'schedule': SCHEDULE_TRIGGER_SPEC_0_0_1,
97
+ event: EVENT_TRIGGER_SPEC_0_0_1,
98
+ once: ONCE_TRIGGER_SPEC_0_0_1,
99
+ schedule: SCHEDULE_TRIGGER_SPEC_0_0_1,
50
100
  };
51
101
  export function getTriggerSpecs() {
52
102
  return Object.values(TRIGGER_CATALOG);
@@ -0,0 +1,204 @@
1
+ import type { ServiceManager } from '@jupyterlab/services';
2
+ import type { IRuntimeOptions } from '@datalayer/core/lib/stateful/runtimes/apis';
3
+ import type { AgentStatus, AgentConnection, AgentConfig, Protocol } from '../types';
4
+ import type { AgentStreamSnapshotPayload, AgentStreamToolApprovalPayload, CodemodeStatusData } from '../types/stream';
5
+ import type { ContextSnapshotData } from '../types/context';
6
+ import type { McpToolsetsStatusResponse } from '../types/mcp';
7
+ import type { LoadedSkillInfo } from '../types/skills';
8
+ /**
9
+ * A URL-addressable agent that has been previously connected.
10
+ * May originate from an agent runtime pod OR from the stable agents service.
11
+ */
12
+ export interface AgentRegistryEntry {
13
+ id: string;
14
+ name: string;
15
+ description: string;
16
+ baseUrl: string;
17
+ protocol: Protocol;
18
+ status: AgentStatus;
19
+ error?: string | null;
20
+ lastUpdated: number;
21
+ documentId?: string;
22
+ runtimeId?: string;
23
+ author?: string;
24
+ avatarUrl?: string;
25
+ }
26
+ export type AgentRuntimeWsState = 'closed' | 'connecting' | 'connected';
27
+ export interface LocalTokenTurn {
28
+ turnNumber: number;
29
+ timestampMs: number;
30
+ systemPromptTokens: number;
31
+ toolsDescriptionTokens: number;
32
+ userMessageTokens: number;
33
+ aiMessageTokens: number;
34
+ toolsUsageTokens: number;
35
+ totalTokens: number;
36
+ }
37
+ export interface LocalCostPoint {
38
+ timestampMs: number;
39
+ cumulativeUsd: number;
40
+ }
41
+ export interface MonitoringCacheEntry {
42
+ tokenTurns: LocalTokenTurn[];
43
+ costPoints: LocalCostPoint[];
44
+ }
45
+ export declare function getMonitoringCacheKey(serviceName?: string, agentId?: string): string;
46
+ export interface AgentRuntimeStoreState {
47
+ agents: readonly AgentRegistryEntry[];
48
+ runtime: AgentConnection | null;
49
+ status: AgentStatus;
50
+ error: string | null;
51
+ isLaunching: boolean;
52
+ wsState: AgentRuntimeWsState;
53
+ approvals: AgentStreamToolApprovalPayload[];
54
+ pendingApprovalCount: number;
55
+ contextSnapshot: ContextSnapshotData | null;
56
+ costUsage: ContextSnapshotData['costUsage'] | null;
57
+ mcpStatus: McpToolsetsStatusResponse | null;
58
+ codemodeStatus: CodemodeStatusData | null;
59
+ fullContext: Record<string, unknown> | null;
60
+ monitoringCache: Record<string, MonitoringCacheEntry>;
61
+ loadedSkillsByAgentId: Record<string, LoadedSkillInfo[]>;
62
+ }
63
+ export interface AgentRuntimeStoreActions {
64
+ upsertAgent: (agent: Partial<AgentRegistryEntry> & {
65
+ id: string;
66
+ baseUrl: string;
67
+ protocol: Protocol;
68
+ }) => void;
69
+ getAgentById: (id: string) => AgentRegistryEntry | undefined;
70
+ getAgentByUrl: (baseUrl: string, protocol: Protocol) => AgentRegistryEntry | undefined;
71
+ updateAgentStatus: (id: string, status: AgentStatus, error?: string | null) => void;
72
+ toggleAgentStatus: (id: string) => void;
73
+ deleteAgent: (id: string) => void;
74
+ clearAgents: () => void;
75
+ setLoadedSkillsForAgent: (agentId: string, skills: LoadedSkillInfo[]) => void;
76
+ getLoadedSkillsForAgent: (agentId: string) => LoadedSkillInfo[];
77
+ clearLoadedSkillsForAgent: (agentId: string) => void;
78
+ launchAgent: (options: IRuntimeOptions) => Promise<AgentConnection>;
79
+ connectAgent: (connection: {
80
+ podName: string;
81
+ environmentName: string;
82
+ serviceManager?: ServiceManager.IManager;
83
+ jupyterBaseUrl?: string;
84
+ kernelId?: string;
85
+ }) => void;
86
+ createAgent: (config?: AgentConfig) => Promise<Pick<AgentConnection, 'agentId' | 'endpoint' | 'isReady'>>;
87
+ disconnect: () => void;
88
+ clearError: () => void;
89
+ setError: (error: string) => void;
90
+ setWsState: (state: AgentRuntimeWsState) => void;
91
+ setWs: (ws: WebSocket | null, agentId?: string) => void;
92
+ applySnapshot: (payload: AgentStreamSnapshotPayload) => void;
93
+ upsertApproval: (approval: AgentStreamToolApprovalPayload) => void;
94
+ removeApproval: (approvalId: string) => void;
95
+ sendDecision: (approvalId: string, approved: boolean, note?: string, toolCallId?: string, agentId?: string) => boolean;
96
+ requestRefresh: (agentId?: string) => boolean;
97
+ sendRawMessage: (payload: Record<string, unknown>, agentId?: string) => boolean;
98
+ appendLocalTokenTurn: (params: {
99
+ serviceName?: string;
100
+ agentId?: string;
101
+ timestampMs: number;
102
+ promptTokens: number;
103
+ completionTokens: number;
104
+ totalTokens: number;
105
+ }) => void;
106
+ mergeTokenTurns: (params: {
107
+ serviceName?: string;
108
+ agentId?: string;
109
+ turns: LocalTokenTurn[];
110
+ }) => void;
111
+ appendLocalTokenTurnFull: (params: {
112
+ serviceName?: string;
113
+ agentId?: string;
114
+ timestampMs: number;
115
+ systemPromptTokens: number;
116
+ toolsDescriptionTokens: number;
117
+ userMessageTokens: number;
118
+ aiMessageTokens: number;
119
+ toolsUsageTokens: number;
120
+ totalTokens: number;
121
+ }) => void;
122
+ upsertLocalCostPoint: (params: {
123
+ serviceName?: string;
124
+ agentId?: string;
125
+ timestampMs: number;
126
+ cumulativeUsd: number;
127
+ }) => void;
128
+ mergeCostPoints: (params: {
129
+ serviceName?: string;
130
+ agentId?: string;
131
+ points: LocalCostPoint[];
132
+ }) => void;
133
+ reset: () => void;
134
+ resetWs: () => void;
135
+ }
136
+ export type AgentRuntimeStore = AgentRuntimeStoreState & AgentRuntimeStoreActions;
137
+ export declare const agentRuntimeStore: Omit<Omit<import("zustand").StoreApi<AgentRuntimeStore>, "subscribe"> & {
138
+ subscribe: {
139
+ (listener: (selectedState: AgentRuntimeStore, previousSelectedState: AgentRuntimeStore) => void): () => void;
140
+ <U>(selector: (state: AgentRuntimeStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
141
+ equalityFn?: ((a: U, b: U) => boolean) | undefined;
142
+ fireImmediately?: boolean;
143
+ } | undefined): () => void;
144
+ };
145
+ }, "persist"> & {
146
+ persist: {
147
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<AgentRuntimeStore, unknown>>) => void;
148
+ clearStorage: () => void;
149
+ rehydrate: () => Promise<void> | void;
150
+ hasHydrated: () => boolean;
151
+ onHydrate: (fn: (state: AgentRuntimeStore) => void) => () => void;
152
+ onFinishHydration: (fn: (state: AgentRuntimeStore) => void) => () => void;
153
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<AgentRuntimeStore, unknown>>;
154
+ };
155
+ };
156
+ export declare function useAgentRuntimeStore(): AgentRuntimeStore;
157
+ export declare function useAgentRuntimeStore<T>(selector: (state: AgentRuntimeStore) => T): T;
158
+ export declare const useAgentRuntimeConnection: () => AgentConnection | null;
159
+ export declare const useAgentRuntimeStatus: () => AgentStatus;
160
+ export declare const useAgentRuntimeError: () => string | null;
161
+ export declare const useAgentRuntimeIsLaunching: () => boolean;
162
+ export declare const useAgentRuntimeApprovals: () => AgentStreamToolApprovalPayload[];
163
+ export declare const useAgentRuntimePendingCount: () => number;
164
+ export declare const useAgentRuntimeMcpStatus: () => McpToolsetsStatusResponse | null;
165
+ export declare const useAgentRuntimeFullContext: () => Record<string, unknown> | null;
166
+ export declare const useAgentRuntimeContextSnapshot: () => ContextSnapshotData | null;
167
+ export declare const useAgentRuntimeCostUsage: () => {
168
+ lastTurnCostUsd: number;
169
+ cumulativeCostUsd: number;
170
+ perRunBudgetUsd: number | null;
171
+ cumulativeBudgetUsd: number | null;
172
+ requestCount: number;
173
+ totalTokensUsed: number;
174
+ modelBreakdown: Array<{
175
+ model: string;
176
+ inputTokens: number;
177
+ outputTokens: number;
178
+ costUsd: number;
179
+ requests: number;
180
+ }>;
181
+ runs: Array<{
182
+ timestamp: string;
183
+ model: string;
184
+ inputTokens: number;
185
+ outputTokens: number;
186
+ runCostUsd: number;
187
+ cumulativeCostUsd: number;
188
+ pricePerInputToken: number | null;
189
+ pricePerOutputToken: number | null;
190
+ pricingResolved: boolean;
191
+ }>;
192
+ lastUpdated: string | null;
193
+ } | null | undefined;
194
+ export declare const useAgentRuntimeCodemodeStatus: () => CodemodeStatusData | null;
195
+ export declare const useAgentRuntimeWsState: () => AgentRuntimeWsState;
196
+ export declare const useAgentRuntimeLoadedSkills: (agentId?: string) => LoadedSkillInfo[];
197
+ export declare const getAgentRuntimeState: () => AgentRuntimeStore;
198
+ export declare const subscribeToAgentRuntime: {
199
+ (listener: (selectedState: AgentRuntimeStore, previousSelectedState: AgentRuntimeStore) => void): () => void;
200
+ <U>(selector: (state: AgentRuntimeStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
201
+ equalityFn?: ((a: U, b: U) => boolean) | undefined;
202
+ fireImmediately?: boolean;
203
+ } | undefined): () => void;
204
+ };