@datalayer/agent-runtimes 0.0.7 → 0.0.9

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 (104) hide show
  1. package/README.md +9 -0
  2. package/lib/components/chat/components/AgentDetails.d.ts +14 -1
  3. package/lib/components/chat/components/AgentDetails.js +3 -2
  4. package/lib/components/chat/components/AgentIdentity.d.ts +92 -0
  5. package/lib/components/chat/components/AgentIdentity.js +318 -0
  6. package/lib/components/chat/components/Chat.d.ts +20 -1
  7. package/lib/components/chat/components/Chat.js +16 -3
  8. package/lib/components/chat/components/ChatFloating.d.ts +6 -1
  9. package/lib/components/chat/components/ChatFloating.js +12 -6
  10. package/lib/components/chat/components/base/ChatBase.d.ts +47 -1
  11. package/lib/components/chat/components/base/ChatBase.js +242 -63
  12. package/lib/components/chat/components/display/ToolCallDisplay.d.ts +16 -2
  13. package/lib/components/chat/components/display/ToolCallDisplay.js +148 -6
  14. package/lib/components/chat/components/display/index.d.ts +1 -1
  15. package/lib/components/chat/components/display/index.js +1 -1
  16. package/lib/components/chat/components/elements/ChatInputPrompt.d.ts +12 -1
  17. package/lib/components/chat/components/elements/ChatInputPrompt.js +8 -3
  18. package/lib/components/chat/components/index.d.ts +1 -0
  19. package/lib/components/chat/components/index.js +1 -0
  20. package/lib/components/chat/components/parts/ToolPart.d.ts +1 -1
  21. package/lib/components/chat/components/parts/ToolPart.js +142 -6
  22. package/lib/components/chat/index.d.ts +1 -1
  23. package/lib/components/chat/index.js +1 -1
  24. package/lib/components/chat/protocols/A2AAdapter.d.ts +9 -0
  25. package/lib/components/chat/protocols/A2AAdapter.js +13 -2
  26. package/lib/components/chat/protocols/ACPAdapter.d.ts +9 -0
  27. package/lib/components/chat/protocols/ACPAdapter.js +13 -2
  28. package/lib/components/chat/protocols/AGUIAdapter.d.ts +9 -0
  29. package/lib/components/chat/protocols/AGUIAdapter.js +19 -1
  30. package/lib/components/chat/protocols/VercelAIAdapter.d.ts +7 -0
  31. package/lib/components/chat/protocols/VercelAIAdapter.js +19 -0
  32. package/lib/components/chat/types/execution.d.ts +78 -0
  33. package/lib/components/chat/types/execution.js +64 -0
  34. package/lib/components/chat/types/index.d.ts +1 -0
  35. package/lib/components/chat/types/index.js +1 -0
  36. package/lib/components/chat/types/protocol.d.ts +9 -0
  37. package/lib/components/ui/pagination.d.ts +2 -2
  38. package/lib/components/ui/pagination.js +4 -4
  39. package/lib/components/ui/resizable.d.ts +4 -4
  40. package/lib/components/ui/resizable.js +4 -4
  41. package/lib/examples/A2UiRestaurantExample.js +2 -2
  42. package/lib/examples/AgUiAgenticExample.js +2 -2
  43. package/lib/examples/AgUiBackendToolRenderingExample.js +2 -2
  44. package/lib/examples/AgUiHaikuGenUIExample.js +2 -2
  45. package/lib/examples/AgUiHumanInTheLoopExample.js +2 -2
  46. package/lib/examples/AgUiSharedStateExample.js +2 -2
  47. package/lib/examples/AgUiToolsBasedGenUIExample.js +2 -2
  48. package/lib/examples/AgentRuntimeCustomExample.js +2 -2
  49. package/lib/examples/AgentRuntimeLexical2Example.js +2 -1
  50. package/lib/examples/AgentRuntimeLexicalExample.js +5 -2
  51. package/lib/examples/AgentRuntimeLexicalSidebarExample.js +4 -2
  52. package/lib/examples/AgentRuntimeNotebookExample.js +1 -1
  53. package/lib/examples/AgentRuntimeStandaloneExample.js +2 -2
  54. package/lib/examples/AgentSpaceFormExample.d.ts +70 -2
  55. package/lib/examples/AgentSpaceFormExample.js +177 -43
  56. package/lib/examples/CopilotKitLexicalExample.js +2 -1
  57. package/lib/examples/components/AgentConfiguration.d.ts +17 -2
  58. package/lib/examples/components/AgentConfiguration.js +220 -16
  59. package/lib/examples/components/LexicalEditor.js +2 -1
  60. package/lib/examples/components/MockFileBrowser.js +6 -2
  61. package/lib/examples/components/index.d.ts +0 -1
  62. package/lib/examples/components/index.js +0 -1
  63. package/lib/examples/example-selector.js +0 -1
  64. package/lib/examples/index.d.ts +0 -1
  65. package/lib/examples/index.js +0 -1
  66. package/lib/examples/lexical/editorConfig.d.ts +3 -2
  67. package/lib/examples/lexical/editorConfig.js +7 -1
  68. package/lib/examples/lexical/initial-content.json +2210 -0
  69. package/lib/examples/main.js +15 -1
  70. package/lib/identity/IdentityConnect.d.ts +90 -0
  71. package/lib/identity/IdentityConnect.js +316 -0
  72. package/lib/identity/OAuthCallback.d.ts +58 -0
  73. package/lib/identity/OAuthCallback.js +223 -0
  74. package/lib/identity/dcr.d.ts +257 -0
  75. package/lib/identity/dcr.js +282 -0
  76. package/lib/identity/identityStore.d.ts +72 -0
  77. package/lib/identity/identityStore.js +529 -0
  78. package/lib/identity/index.d.ts +46 -0
  79. package/lib/identity/index.js +17 -0
  80. package/lib/identity/pkce.d.ts +30 -0
  81. package/lib/identity/pkce.js +65 -0
  82. package/lib/identity/types.d.ts +293 -0
  83. package/lib/identity/types.js +73 -0
  84. package/lib/identity/useIdentity.d.ts +108 -0
  85. package/lib/identity/useIdentity.js +323 -0
  86. package/lib/index.d.ts +1 -0
  87. package/lib/index.js +1 -0
  88. package/lib/lib/utils.js +1 -1
  89. package/lib/renderers/a2ui/lib/utils.js +1 -1
  90. package/lib/test-setup.d.ts +1 -1
  91. package/lib/test-setup.js +1 -0
  92. package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.js +32 -1
  93. package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +6 -0
  94. package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +16 -17
  95. package/package.json +20 -7
  96. package/patches/@datalayer+jupyter-lexical+1.0.8.patch +11628 -0
  97. package/patches/@datalayer+jupyter-react+2.0.2.patch +5338 -0
  98. package/scripts/apply-patches.sh +32 -0
  99. package/lib/examples/AgentSpaceHomeExample.d.ts +0 -8
  100. package/lib/examples/AgentSpaceHomeExample.js +0 -171
  101. package/lib/examples/components/AgentsDataTable.d.ts +0 -13
  102. package/lib/examples/components/AgentsDataTable.js +0 -74
  103. package/lib/examples/components/Rating.d.ts +0 -14
  104. package/lib/examples/components/Rating.js +0 -12
@@ -12,11 +12,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  import { useState } from 'react';
13
13
  import { Text, Spinner } from '@primer/react';
14
14
  import { Box } from '@datalayer/primer-addons';
15
- import { ChevronDownIcon, ChevronRightIcon, ToolsIcon, CheckCircleIcon, XCircleIcon, ClockIcon, } from '@primer/octicons-react';
15
+ import { ChevronDownIcon, ChevronRightIcon, ToolsIcon, CheckCircleIcon, XCircleIcon, ClockIcon, AlertIcon, } from '@primer/octicons-react';
16
16
  /**
17
17
  * Get status icon and color based on tool call status
18
18
  */
19
- function getStatusDisplay(status) {
19
+ function getStatusDisplay(status, errorType) {
20
20
  switch (status) {
21
21
  case 'inProgress':
22
22
  return {
@@ -40,6 +40,31 @@ function getStatusDisplay(status) {
40
40
  bgColor: 'success.subtle',
41
41
  };
42
42
  case 'error':
43
+ // Distinguish between execution errors, code errors, and exit codes
44
+ if (errorType === 'execution') {
45
+ return {
46
+ icon: _jsx(AlertIcon, { size: 14 }),
47
+ color: 'danger.fg',
48
+ label: 'Execution Failed',
49
+ bgColor: 'danger.subtle',
50
+ };
51
+ }
52
+ else if (errorType === 'code') {
53
+ return {
54
+ icon: _jsx(XCircleIcon, { size: 14 }),
55
+ color: 'severe.fg',
56
+ label: 'Code Error',
57
+ bgColor: 'severe.subtle',
58
+ };
59
+ }
60
+ else if (errorType === 'exit') {
61
+ return {
62
+ icon: _jsx(AlertIcon, { size: 14 }),
63
+ color: 'attention.fg',
64
+ label: 'Exited',
65
+ bgColor: 'attention.subtle',
66
+ };
67
+ }
43
68
  return {
44
69
  icon: _jsx(XCircleIcon, { size: 14 }),
45
70
  color: 'danger.fg',
@@ -97,12 +122,41 @@ function getArgsSummary(args) {
97
122
  * - Shows tool name, status icon, and brief summary when collapsed
98
123
  * - Expands to show full parameters and results
99
124
  * - Color-coded status indicators
125
+ * - Rich error display distinguishing execution errors from code errors
100
126
  */
101
- export function ToolCallDisplay({ toolCallId, toolName, args, result, status, error, }) {
127
+ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, error, executionResult, codeError, exitCode, executionError, }) {
102
128
  const [isExpanded, setIsExpanded] = useState(false);
103
- const statusDisplay = getStatusDisplay(status);
129
+ // Determine effective exit code from props or execution result
130
+ const effectiveExitCode = exitCode ?? executionResult?.exit_code;
131
+ const hasNonZeroExit = effectiveExitCode != null && effectiveExitCode !== 0;
132
+ // Determine error type for status display
133
+ // Priority: execution error > code error > non-zero exit code
134
+ const errorType = status === 'error'
135
+ ? executionError || executionResult?.execution_error
136
+ ? 'execution'
137
+ : codeError || executionResult?.code_error
138
+ ? 'code'
139
+ : hasNonZeroExit
140
+ ? 'exit'
141
+ : 'unknown'
142
+ : undefined;
143
+ const statusDisplay = getStatusDisplay(status, errorType);
104
144
  const displayName = formatToolName(toolName);
105
145
  const argsSummary = getArgsSummary(args);
146
+ // Get error details from various sources (prefer rich error info)
147
+ const effectiveCodeError = codeError || executionResult?.code_error || undefined;
148
+ const effectiveExecutionError = executionError || executionResult?.execution_error || undefined;
149
+ const effectiveError = error || executionResult?.error || effectiveExecutionError || undefined;
150
+ const exitOutput = executionResult?.output;
151
+ const effectiveExitOutput = exitOutput ??
152
+ (typeof result === 'string'
153
+ ? result
154
+ : result != null && typeof result === 'object'
155
+ ? (result.output ??
156
+ result.stdout ??
157
+ result.stderr ??
158
+ undefined)
159
+ : undefined);
106
160
  return (_jsxs(Box, { sx: {
107
161
  width: '100%',
108
162
  border: '1px solid',
@@ -201,7 +255,58 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
201
255
  wordBreak: 'break-word',
202
256
  }, children: typeof result === 'string'
203
257
  ? result
204
- : JSON.stringify(result, null, 2) }) })] })), status === 'error' && error && (_jsxs(Box, { children: [_jsx(Text, { sx: {
258
+ : JSON.stringify(result, null, 2) }) })] })), status === 'error' && effectiveExecutionError && (_jsxs(Box, { children: [_jsxs(Text, { sx: {
259
+ display: 'block',
260
+ fontSize: 0,
261
+ fontWeight: 'semibold',
262
+ color: 'danger.fg',
263
+ textTransform: 'uppercase',
264
+ letterSpacing: '0.05em',
265
+ mb: 2,
266
+ }, children: [_jsx(AlertIcon, { size: 12 }), " Execution Error"] }), _jsxs(Box, { sx: {
267
+ backgroundColor: 'danger.subtle',
268
+ borderRadius: 2,
269
+ border: '1px solid',
270
+ borderColor: 'danger.muted',
271
+ p: 2,
272
+ }, children: [_jsx(Text, { sx: { fontSize: 1, color: 'danger.fg' }, children: effectiveExecutionError }), _jsx(Text, { sx: {
273
+ display: 'block',
274
+ fontSize: 0,
275
+ color: 'fg.muted',
276
+ mt: 1,
277
+ }, children: "The sandbox or execution environment failed to run the code." })] })] })), status === 'error' && effectiveCodeError && (_jsxs(Box, { children: [_jsxs(Text, { sx: {
278
+ display: 'block',
279
+ fontSize: 0,
280
+ fontWeight: 'semibold',
281
+ color: 'severe.fg',
282
+ textTransform: 'uppercase',
283
+ letterSpacing: '0.05em',
284
+ mb: 2,
285
+ }, children: ["Code Error: ", effectiveCodeError.name] }), _jsxs(Box, { sx: {
286
+ backgroundColor: 'severe.subtle',
287
+ borderRadius: 2,
288
+ border: '1px solid',
289
+ borderColor: 'severe.muted',
290
+ overflow: 'hidden',
291
+ }, children: [_jsx(Box, { sx: { p: 2 }, children: _jsx(Text, { sx: { fontSize: 1, color: 'severe.fg' }, children: effectiveCodeError.value }) }), effectiveCodeError.traceback && (_jsx(Box, { sx: {
292
+ borderTop: '1px solid',
293
+ borderColor: 'severe.muted',
294
+ backgroundColor: 'canvas.inset',
295
+ }, children: _jsx("pre", { style: {
296
+ margin: 0,
297
+ padding: '8px 12px',
298
+ fontSize: '11px',
299
+ fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',
300
+ lineHeight: 1.4,
301
+ whiteSpace: 'pre-wrap',
302
+ wordBreak: 'break-word',
303
+ maxHeight: '200px',
304
+ overflow: 'auto',
305
+ }, children: effectiveCodeError.traceback }) }))] })] })), status === 'error' &&
306
+ effectiveError &&
307
+ !effectiveExecutionError &&
308
+ !effectiveCodeError &&
309
+ !hasNonZeroExit && (_jsxs(Box, { children: [_jsx(Text, { sx: {
205
310
  display: 'block',
206
311
  fontSize: 0,
207
312
  fontWeight: 'semibold',
@@ -215,7 +320,44 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
215
320
  border: '1px solid',
216
321
  borderColor: 'danger.muted',
217
322
  p: 2,
218
- }, children: _jsx(Text, { sx: { fontSize: 1, color: 'danger.fg' }, children: error }) })] })), _jsx(Box, { sx: {
323
+ }, children: _jsx(Text, { sx: { fontSize: 1, color: 'danger.fg' }, children: effectiveError }) })] })), hasNonZeroExit &&
324
+ !effectiveExecutionError &&
325
+ !effectiveCodeError && (_jsxs(Box, { children: [_jsxs(Text, { sx: {
326
+ display: 'block',
327
+ fontSize: 0,
328
+ fontWeight: 'semibold',
329
+ color: 'attention.fg',
330
+ textTransform: 'uppercase',
331
+ letterSpacing: '0.05em',
332
+ mb: 2,
333
+ }, children: [_jsx(AlertIcon, { size: 12 }), " Process Exited"] }), _jsxs(Box, { sx: {
334
+ backgroundColor: 'attention.subtle',
335
+ borderRadius: 2,
336
+ border: '1px solid',
337
+ borderColor: 'attention.muted',
338
+ p: 2,
339
+ }, children: [_jsxs(Text, { sx: { fontSize: 1, color: 'attention.fg' }, children: ["Process exited with code ", effectiveExitCode] }), _jsx(Text, { sx: {
340
+ display: 'block',
341
+ fontSize: 0,
342
+ color: 'fg.muted',
343
+ mt: 1,
344
+ }, children: "The code called sys.exit() with a non-zero exit code." })] }), effectiveExitOutput && (_jsx(Box, { sx: {
345
+ mt: 2,
346
+ backgroundColor: 'canvas.inset',
347
+ borderRadius: 2,
348
+ border: '1px solid',
349
+ borderColor: 'attention.muted',
350
+ overflow: 'auto',
351
+ }, children: _jsx("pre", { style: {
352
+ margin: 0,
353
+ padding: '10px 12px',
354
+ fontSize: '12px',
355
+ fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',
356
+ lineHeight: 1.4,
357
+ whiteSpace: 'pre-wrap',
358
+ wordBreak: 'break-word',
359
+ maxHeight: '200px',
360
+ }, children: effectiveExitOutput }) }))] })), _jsx(Box, { sx: {
219
361
  mt: 3,
220
362
  pt: 2,
221
363
  borderTop: '1px solid',
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * @module components/chat/components/display
5
5
  */
6
- export { ToolCallDisplay, type ToolCallDisplayProps } from './ToolCallDisplay';
6
+ export { ToolCallDisplay, type ToolCallDisplayProps, type ErrorType, } from './ToolCallDisplay';
@@ -7,4 +7,4 @@
7
7
  *
8
8
  * @module components/chat/components/display
9
9
  */
10
- export { ToolCallDisplay } from './ToolCallDisplay';
10
+ export { ToolCallDisplay, } from './ToolCallDisplay';
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Chat input component.
3
+ * Provides the message input area with send button and optional tool suggestions.
4
+ *
5
+ * @module components/chat/components/elements/ChatInputPrompt
6
+ */
7
+ import React from 'react';
1
8
  /**
2
9
  * ChatInputPrompt props
3
10
  */
@@ -14,6 +21,10 @@ export interface ChatInputPromptProps {
14
21
  maxRows?: number;
15
22
  /** Custom class name */
16
23
  className?: string;
24
+ /** Leading icon to display on the left of the input */
25
+ leadingIcon?: React.ReactNode;
26
+ /** Custom send button text */
27
+ sendButtonText?: string;
17
28
  /** Callback before sending */
18
29
  onBeforeSend?: (content: string) => boolean | void;
19
30
  /** Callback after sending */
@@ -22,5 +33,5 @@ export interface ChatInputPromptProps {
22
33
  /**
23
34
  * Chat Input Prompt component
24
35
  */
25
- export declare function ChatInputPrompt({ placeholder, disabled, showToolSuggestions, showFileUpload, maxRows, className, onBeforeSend, onAfterSend, }: ChatInputPromptProps): import("react/jsx-runtime").JSX.Element;
36
+ export declare function ChatInputPrompt({ placeholder, disabled, showToolSuggestions, showFileUpload, maxRows, className, leadingIcon, sendButtonText, onBeforeSend, onAfterSend, }: ChatInputPromptProps): import("react/jsx-runtime").JSX.Element;
26
37
  export default ChatInputPrompt;
@@ -18,7 +18,7 @@ import { useChatStreaming, useChatTools } from '../../store/chatStore';
18
18
  /**
19
19
  * Chat Input Prompt component
20
20
  */
21
- export function ChatInputPrompt({ placeholder = 'Type a message...', disabled = false, showToolSuggestions = true, showFileUpload = false, maxRows = 6, className, onBeforeSend, onAfterSend, }) {
21
+ export function ChatInputPrompt({ placeholder = 'Type a message...', disabled = false, showToolSuggestions = true, showFileUpload = false, maxRows = 6, className, leadingIcon, sendButtonText = 'Send', onBeforeSend, onAfterSend, }) {
22
22
  const [input, setInput] = useState('');
23
23
  const [showSuggestions, setShowSuggestions] = useState(false);
24
24
  const textareaRef = useRef(null);
@@ -133,13 +133,18 @@ export function ChatInputPrompt({ placeholder = 'Type a message...', disabled =
133
133
  borderRadius: 2,
134
134
  boxShadow: 'shadow.large',
135
135
  zIndex: 10,
136
- }, children: _jsx(ActionList, { children: filteredTools.map(tool => (_jsxs(ActionList.Item, { onSelect: () => handleToolMention(tool.name), children: [_jsx(ActionList.LeadingVisual, { children: _jsx(MentionIcon, {}) }), _jsxs(Box, { children: [_jsx(Box, { sx: { fontWeight: 'semibold' }, children: tool.name }), tool.description && (_jsx(Box, { sx: { fontSize: 0, color: 'fg.muted' }, children: tool.description }))] })] }, tool.name))) }) })), _jsxs(Box, { sx: { display: 'flex', gap: 2, alignItems: 'flex-end' }, children: [showFileUpload && (_jsx(IconButton, { icon: UploadIcon, "aria-label": "Upload file", variant: "invisible", disabled: disabled || !!isStreaming })), _jsx(Box, { sx: { flex: 1 }, children: _jsx(Textarea, { ref: textareaRef, value: input, onChange: e => setInput(e.target.value), onKeyDown: handleKeyDown, onBlur: () => setTimeout(() => setShowSuggestions(false), 200), placeholder: placeholder, disabled: disabled || !!isStreaming, rows: 1, sx: {
136
+ }, children: _jsx(ActionList, { children: filteredTools.map(tool => (_jsxs(ActionList.Item, { onSelect: () => handleToolMention(tool.name), children: [_jsx(ActionList.LeadingVisual, { children: _jsx(MentionIcon, {}) }), _jsxs(Box, { children: [_jsx(Box, { sx: { fontWeight: 'semibold' }, children: tool.name }), tool.description && (_jsx(Box, { sx: { fontSize: 0, color: 'fg.muted' }, children: tool.description }))] })] }, tool.name))) }) })), _jsxs(Box, { sx: { display: 'flex', gap: 2, alignItems: 'flex-end' }, children: [leadingIcon && (_jsx(Box, { sx: {
137
+ display: 'flex',
138
+ alignItems: 'center',
139
+ color: 'fg.muted',
140
+ pb: 2,
141
+ }, children: leadingIcon })), showFileUpload && (_jsx(IconButton, { icon: UploadIcon, "aria-label": "Upload file", variant: "invisible", disabled: disabled || !!isStreaming })), _jsx(Box, { sx: { flex: 1 }, children: _jsx(Textarea, { ref: textareaRef, value: input, onChange: e => setInput(e.target.value), onKeyDown: handleKeyDown, onBlur: () => setTimeout(() => setShowSuggestions(false), 200), placeholder: placeholder, disabled: disabled || !!isStreaming, rows: 1, sx: {
137
142
  width: '100%',
138
143
  maxHeight: `${maxRows * 24}px`,
139
144
  minHeight: '40px',
140
145
  resize: 'none',
141
146
  overflow: 'hidden',
142
147
  transition: 'height 0.1s ease-out',
143
- } }) }), isStreaming ? (_jsx(Button, { variant: "danger", onClick: handleStop, leadingVisual: SquareCircleIcon, "aria-label": "Stop generation", children: "Stop" })) : (_jsx(Button, { variant: "primary", onClick: handleSend, disabled: disabled || !input.trim(), leadingVisual: PaperAirplaneIcon, "aria-label": "Send message", children: "Send" }))] }), _jsxs(Box, { sx: { fontSize: 0, color: 'fg.muted' }, children: ["Press ", _jsx("kbd", { children: "Enter" }), " to send, ", _jsx("kbd", { children: "Shift+Enter" }), " for new line", showToolSuggestions && ', @ to mention tools'] })] }));
148
+ } }) }), isStreaming ? (_jsx(Button, { variant: "danger", onClick: handleStop, leadingVisual: SquareCircleIcon, "aria-label": "Stop generation", children: "Stop" })) : (_jsx(Button, { variant: "primary", onClick: handleSend, disabled: disabled || !input.trim(), leadingVisual: PaperAirplaneIcon, "aria-label": "Send message", children: sendButtonText }))] }), _jsxs(Box, { sx: { fontSize: 0, color: 'fg.muted' }, children: ["Press ", _jsx("kbd", { children: "Enter" }), " to send, ", _jsx("kbd", { children: "Shift+Enter" }), " for new line", showToolSuggestions && ', @ to mention tools'] })] }));
144
149
  }
145
150
  export default ChatInputPrompt;
@@ -9,6 +9,7 @@ export { ChatSidebar, type ChatSidebarProps } from './ChatSidebar';
9
9
  export { ChatStandalone, type ChatStandaloneProps, type MessageHandler, } from './ChatStandalone';
10
10
  export { ChatBase, type ChatBaseProps, type ProtocolConfig, } from './base/ChatBase';
11
11
  export { AgentDetails, type AgentDetailsProps } from './AgentDetails';
12
+ export { AgentIdentity, IdentityCard, getTokenStatus, formatDuration, formatExpirationStatus, type AgentIdentityProps, type IdentityCardProps, type TokenStatus, } from './AgentIdentity';
12
13
  export { ContextUsage, type ContextUsageProps, type ContextDetailsResponse, } from './ContextUsage';
13
14
  export { ContextDistribution, type ContextDistributionProps, type ContextSnapshotResponse, } from './ContextDistribution';
14
15
  export { ToolApprovalDialog, useToolApprovalDialog, type ToolApprovalDialogProps, } from './elements/ToolApprovalDialog';
@@ -13,6 +13,7 @@ export { ChatSidebar } from './ChatSidebar';
13
13
  export { ChatStandalone, } from './ChatStandalone';
14
14
  export { ChatBase, } from './base/ChatBase';
15
15
  export { AgentDetails } from './AgentDetails';
16
+ export { AgentIdentity, IdentityCard, getTokenStatus, formatDuration, formatExpirationStatus, } from './AgentIdentity';
16
17
  export { ContextUsage, } from './ContextUsage';
17
18
  export { ContextDistribution, } from './ContextDistribution';
18
19
  export { ToolApprovalDialog, useToolApprovalDialog, } from './elements/ToolApprovalDialog';
@@ -11,7 +11,7 @@ export interface ToolPartProps {
11
11
  * - Status indicator (pending, running, completed, error)
12
12
  * - JSON display for input parameters
13
13
  * - JSON display for output/result
14
- * - Error highlighting
14
+ * - Rich error display with execution vs code error distinction
15
15
  */
16
16
  export declare function ToolPart({ part }: ToolPartProps): import("react/jsx-runtime").JSX.Element;
17
17
  export default ToolPart;
@@ -12,11 +12,44 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  import React from 'react';
13
13
  import { Text, Button } from '@primer/react';
14
14
  import { Box } from '@datalayer/primer-addons';
15
- import { ChevronDownIcon } from '@primer/octicons-react';
15
+ import { ChevronDownIcon, AlertIcon } from '@primer/octicons-react';
16
+ /**
17
+ * Check if output contains execution result with errors
18
+ */
19
+ function extractExecutionResult(output) {
20
+ if (!output || typeof output !== 'object')
21
+ return null;
22
+ const obj = output;
23
+ // Check if it looks like an ExecutionResult
24
+ if ('execution_ok' in obj ||
25
+ 'code_error' in obj ||
26
+ 'execution_error' in obj ||
27
+ 'exit_code' in obj) {
28
+ return obj;
29
+ }
30
+ return null;
31
+ }
16
32
  /**
17
33
  * Get status info (label, color, icon) for tool state
18
34
  */
19
- function getStatusInfo(state) {
35
+ function getStatusInfo(state, executionResult) {
36
+ // Check for execution errors in the result
37
+ if (executionResult) {
38
+ if (!executionResult.execution_ok) {
39
+ return { label: 'Execution Failed', color: 'danger.fg', icon: '⚠' };
40
+ }
41
+ if (executionResult.code_error) {
42
+ return { label: 'Code Error', color: 'severe.fg', icon: '✕' };
43
+ }
44
+ // Check for non-zero exit code
45
+ if (executionResult.exit_code != null && executionResult.exit_code !== 0) {
46
+ return {
47
+ label: `Exit ${executionResult.exit_code}`,
48
+ color: 'attention.fg',
49
+ icon: '⚠',
50
+ };
51
+ }
52
+ }
20
53
  const statusMap = {
21
54
  call: { label: 'Pending', color: 'accent.fg', icon: '○' },
22
55
  'input-streaming': { label: 'Pending', color: 'accent.fg', icon: '○' },
@@ -48,12 +81,23 @@ function getStatusInfo(state) {
48
81
  * - Status indicator (pending, running, completed, error)
49
82
  * - JSON display for input parameters
50
83
  * - JSON display for output/result
51
- * - Error highlighting
84
+ * - Rich error display with execution vs code error distinction
52
85
  */
53
86
  export function ToolPart({ part }) {
54
87
  const [isExpanded, setIsExpanded] = React.useState(true);
55
- const statusInfo = getStatusInfo(part.state);
88
+ // Extract execution result if present in output
89
+ const executionResult = extractExecutionResult(part.output);
90
+ const statusInfo = getStatusInfo(part.state, executionResult);
56
91
  const toolName = part.type.split('-').slice(1).join('-') || part.type;
92
+ const effectiveExitOutput = executionResult?.output ??
93
+ (typeof part.output === 'string'
94
+ ? part.output
95
+ : part.output != null && typeof part.output === 'object'
96
+ ? (part.output.output ??
97
+ part.output.stdout ??
98
+ part.output.stderr ??
99
+ undefined)
100
+ : undefined);
57
101
  return (_jsxs(Box, { sx: {
58
102
  marginBottom: 2,
59
103
  border: '1px solid',
@@ -141,9 +185,101 @@ export function ToolPart({ part }) {
141
185
  ? typeof part.output === 'string'
142
186
  ? part.output
143
187
  : JSON.stringify(part.output, null, 2)
144
- : 'No output' }) })] })), part.state === 'output-error' &&
188
+ : 'No output' }) })] })), executionResult && !executionResult.execution_ok && (_jsxs(Box, { sx: { padding: 3 }, children: [_jsxs(Text, { sx: {
189
+ display: 'block',
190
+ fontSize: 0,
191
+ fontWeight: 'semibold',
192
+ color: 'danger.fg',
193
+ textTransform: 'uppercase',
194
+ letterSpacing: '0.05em',
195
+ marginBottom: 2,
196
+ }, children: [_jsx(AlertIcon, { size: 12 }), " Execution Error"] }), _jsxs(Box, { sx: {
197
+ backgroundColor: 'danger.subtle',
198
+ borderRadius: 2,
199
+ overflow: 'auto',
200
+ border: '1px solid',
201
+ borderColor: 'danger.muted',
202
+ padding: 2,
203
+ }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'danger.fg' }, children: executionResult.execution_error ||
204
+ 'Sandbox execution failed' }), _jsx(Text, { sx: {
205
+ display: 'block',
206
+ fontSize: 0,
207
+ color: 'fg.muted',
208
+ marginTop: 1,
209
+ }, children: "The sandbox or execution environment failed to run the code." })] })] })), executionResult &&
210
+ executionResult.execution_ok &&
211
+ executionResult.code_error && (_jsxs(Box, { sx: { padding: 3 }, children: [_jsxs(Text, { sx: {
212
+ display: 'block',
213
+ fontSize: 0,
214
+ fontWeight: 'semibold',
215
+ color: 'severe.fg',
216
+ textTransform: 'uppercase',
217
+ letterSpacing: '0.05em',
218
+ marginBottom: 2,
219
+ }, children: ["Code Error: ", executionResult.code_error.name] }), _jsxs(Box, { sx: {
220
+ backgroundColor: 'severe.subtle',
221
+ borderRadius: 2,
222
+ overflow: 'hidden',
223
+ border: '1px solid',
224
+ borderColor: 'severe.muted',
225
+ }, children: [_jsx(Box, { sx: { padding: 2 }, children: _jsx(Text, { sx: { fontSize: 0, color: 'severe.fg' }, children: executionResult.code_error.value }) }), executionResult.code_error.traceback && (_jsx(Box, { sx: {
226
+ borderTop: '1px solid',
227
+ borderColor: 'severe.muted',
228
+ backgroundColor: 'canvas.inset',
229
+ }, children: _jsx("pre", { style: {
230
+ margin: 0,
231
+ padding: '8px 12px',
232
+ fontSize: '11px',
233
+ fontFamily: 'monospace',
234
+ lineHeight: 1.4,
235
+ whiteSpace: 'pre-wrap',
236
+ wordBreak: 'break-word',
237
+ maxHeight: '200px',
238
+ overflow: 'auto',
239
+ }, children: executionResult.code_error.traceback }) }))] })] })), executionResult &&
240
+ executionResult.execution_ok &&
241
+ !executionResult.code_error &&
242
+ executionResult.exit_code != null &&
243
+ executionResult.exit_code !== 0 && (_jsxs(Box, { sx: { padding: 3 }, children: [_jsx(Text, { sx: {
244
+ display: 'block',
245
+ fontSize: 0,
246
+ fontWeight: 'semibold',
247
+ color: 'attention.fg',
248
+ textTransform: 'uppercase',
249
+ letterSpacing: '0.05em',
250
+ marginBottom: 2,
251
+ }, children: "Process Exited" }), _jsxs(Box, { sx: {
252
+ backgroundColor: 'attention.subtle',
253
+ borderRadius: 2,
254
+ overflow: 'hidden',
255
+ border: '1px solid',
256
+ borderColor: 'attention.muted',
257
+ padding: 2,
258
+ }, children: [_jsxs(Text, { sx: { fontSize: 0, color: 'attention.fg' }, children: ["Process exited with code ", executionResult.exit_code] }), _jsx(Text, { sx: {
259
+ display: 'block',
260
+ fontSize: 0,
261
+ color: 'fg.muted',
262
+ marginTop: 1,
263
+ }, children: "The code called sys.exit() with a non-zero exit code." }), effectiveExitOutput && (_jsx(Box, { sx: {
264
+ mt: 2,
265
+ backgroundColor: 'canvas.inset',
266
+ borderRadius: 2,
267
+ border: '1px solid',
268
+ borderColor: 'attention.muted',
269
+ overflow: 'auto',
270
+ }, children: _jsx("pre", { style: {
271
+ margin: 0,
272
+ padding: '10px 12px',
273
+ fontSize: '12px',
274
+ fontFamily: 'monospace',
275
+ lineHeight: 1.4,
276
+ whiteSpace: 'pre-wrap',
277
+ wordBreak: 'break-word',
278
+ maxHeight: '200px',
279
+ }, children: effectiveExitOutput }) }))] })] })), part.state === 'output-error' &&
145
280
  'errorText' in part &&
146
- part.errorText && (_jsxs(Box, { sx: { padding: 3 }, children: [_jsx(Text, { sx: {
281
+ part.errorText &&
282
+ !executionResult && (_jsxs(Box, { sx: { padding: 3 }, children: [_jsx(Text, { sx: {
147
283
  display: 'block',
148
284
  fontSize: 0,
149
285
  fontWeight: 'semibold',
@@ -56,6 +56,6 @@ export { BaseProtocolAdapter, AGUIAdapter, A2AAdapter, ACPAdapter, type AGUIAdap
56
56
  export { ToolExecutor, type ToolExecutionContext } from './tools';
57
57
  export { MiddlewarePipeline, createMiddleware, loggingMiddleware, createHITLMiddleware, type RequestContext, type ResponseContext, } from './middleware';
58
58
  export { ExtensionRegistry, createMessageRenderer, createActivityRenderer, createA2UIRenderer, A2UIExtensionImpl, type A2UIMessage, } from './extensions';
59
- export { ChatMessages, ChatInputPrompt, ChatSidebar, ChatStandalone, ChatBase, ToolApprovalDialog, useToolApprovalDialog, PoweredByTag, FloatingBrandButton, ChatHeader, MessagePart, TextPart, ReasoningPart, ToolPart, DynamicToolPart, ToolCallDisplay, Chat, ChatFloating, type ChatMessagesProps, type ChatInputPromptProps, type ChatSidebarProps, type ChatStandaloneProps, type MessageHandler, type ChatBaseProps, type ProtocolConfig, type ToolApprovalDialogProps, type PoweredByTagProps, type FloatingBrandButtonProps, type ChatFloatingProps, type ToolCallRenderContext, type ToolCallStatus, type RenderToolResult, type RespondCallback, type Suggestion, type RemoteConfig, type ModelConfig, type BuiltinTool, type MCPServerConfig, type MCPServerTool, type ChatHeaderProps, type ConnectionState, type MessagePartProps, type TextPartProps, type ReasoningPartProps, type ToolPartProps, type DynamicToolPartProps, type ToolCallDisplayProps, type ChatProps, type Transport, type Extension, } from './components';
59
+ export { ChatMessages, ChatInputPrompt, ChatSidebar, ChatStandalone, ChatBase, ToolApprovalDialog, useToolApprovalDialog, PoweredByTag, FloatingBrandButton, ChatHeader, MessagePart, TextPart, ReasoningPart, ToolPart, DynamicToolPart, ToolCallDisplay, Chat, ChatFloating, AgentDetails, AgentIdentity, IdentityCard, getTokenStatus, formatDuration, formatExpirationStatus, type ChatMessagesProps, type ChatInputPromptProps, type ChatSidebarProps, type ChatStandaloneProps, type MessageHandler, type ChatBaseProps, type ProtocolConfig, type ToolApprovalDialogProps, type PoweredByTagProps, type FloatingBrandButtonProps, type ChatFloatingProps, type ToolCallRenderContext, type ToolCallStatus, type RenderToolResult, type RespondCallback, type Suggestion, type RemoteConfig, type ModelConfig, type BuiltinTool, type MCPServerConfig, type MCPServerTool, type AgentDetailsProps, type AgentIdentityProps, type IdentityCardProps, type TokenStatus, type ChatHeaderProps, type ConnectionState, type MessagePartProps, type TextPartProps, type ReasoningPartProps, type ToolPartProps, type DynamicToolPartProps, type ToolCallDisplayProps, type ChatProps, type Transport, type Extension, } from './components';
60
60
  export { requestAPI } from './handler';
61
61
  export { useKeyboardShortcuts, useChatKeyboardShortcuts, getShortcutDisplay, type KeyboardShortcut, type UseKeyboardShortcutsOptions, } from '../../hooks';
@@ -69,7 +69,7 @@ export { MiddlewarePipeline, createMiddleware, loggingMiddleware, createHITLMidd
69
69
  // Extensions
70
70
  export { ExtensionRegistry, createMessageRenderer, createActivityRenderer, createA2UIRenderer, A2UIExtensionImpl, } from './extensions';
71
71
  // Components
72
- export { ChatMessages, ChatInputPrompt, ChatSidebar, ChatStandalone, ChatBase, ToolApprovalDialog, useToolApprovalDialog, PoweredByTag, FloatingBrandButton, ChatHeader, MessagePart, TextPart, ReasoningPart, ToolPart, DynamicToolPart, ToolCallDisplay, Chat, ChatFloating, } from './components';
72
+ export { ChatMessages, ChatInputPrompt, ChatSidebar, ChatStandalone, ChatBase, ToolApprovalDialog, useToolApprovalDialog, PoweredByTag, FloatingBrandButton, ChatHeader, MessagePart, TextPart, ReasoningPart, ToolPart, DynamicToolPart, ToolCallDisplay, Chat, ChatFloating, AgentDetails, AgentIdentity, IdentityCard, getTokenStatus, formatDuration, formatExpirationStatus, } from './components';
73
73
  // Simple API request handler (merged from chat)
74
74
  export { requestAPI } from './handler';
75
75
  // Keyboard shortcuts (re-exported from main hooks folder)
@@ -53,6 +53,15 @@ export declare class A2AAdapter extends BaseProtocolAdapter {
53
53
  metadata?: Record<string, unknown>;
54
54
  /** Model to use for this request (overrides agent default) */
55
55
  model?: string;
56
+ /** Built-in MCP tool names to enable */
57
+ builtinTools?: string[];
58
+ /** Skill IDs to enable */
59
+ skills?: string[];
60
+ /** Connected identity tokens to pass to backend for tool execution */
61
+ identities?: Array<{
62
+ provider: string;
63
+ accessToken: string;
64
+ }>;
56
65
  }): Promise<void>;
57
66
  /**
58
67
  * Send tool result back
@@ -121,6 +121,14 @@ export class A2AAdapter extends BaseProtocolAdapter {
121
121
  }
122
122
  }
123
123
  }
124
+ // Build metadata with model and identities
125
+ const metadata = {};
126
+ if (options?.model) {
127
+ metadata.model = options.model;
128
+ }
129
+ if (options?.identities && options.identities.length > 0) {
130
+ metadata.identities = options.identities;
131
+ }
124
132
  // Build JSON-RPC request with A2A message format
125
133
  // Use message/stream for SSE streaming responses
126
134
  const messageId = generateMessageId();
@@ -142,14 +150,17 @@ export class A2AAdapter extends BaseProtocolAdapter {
142
150
  // The model is configured at agent creation time
143
151
  ...(options?.model && { model: options.model }),
144
152
  },
145
- // Also send model in metadata for potential future support
146
- ...(options?.model && { metadata: { model: options.model } }),
153
+ // Also send metadata with model and identities
154
+ ...(Object.keys(metadata).length > 0 && { metadata }),
147
155
  },
148
156
  id: taskId,
149
157
  };
150
158
  if (options?.model) {
151
159
  console.log('[A2AAdapter] Sending with model:', options.model, '(Note: A2A uses agent-level model, not per-request)');
152
160
  }
161
+ if (options?.identities && options.identities.length > 0) {
162
+ console.log('[A2AAdapter] Sending with identities:', options.identities.map(i => i.provider));
163
+ }
153
164
  try {
154
165
  const response = await fetch(this.a2aConfig.baseUrl, {
155
166
  method: 'POST',
@@ -115,6 +115,15 @@ export declare class ACPAdapter extends BaseProtocolAdapter {
115
115
  metadata?: Record<string, unknown>;
116
116
  /** Model to use for this request (overrides agent default) */
117
117
  model?: string;
118
+ /** Built-in MCP tool names to enable */
119
+ builtinTools?: string[];
120
+ /** Skill IDs to enable */
121
+ skills?: string[];
122
+ /** Connected identity tokens to pass to backend for tool execution */
123
+ identities?: Array<{
124
+ provider: string;
125
+ accessToken: string;
126
+ }>;
118
127
  }): Promise<void>;
119
128
  /**
120
129
  * Send tool result back through ACP
@@ -224,11 +224,22 @@ export class ACPAdapter extends BaseProtocolAdapter {
224
224
  if (_options?.model) {
225
225
  console.log('[ACPAdapter] Sending with model:', _options.model);
226
226
  }
227
+ if (_options?.identities && _options.identities.length > 0) {
228
+ console.log('[ACPAdapter] Sending with identities:', _options.identities.map(i => i.provider));
229
+ }
230
+ // Build metadata including model override and identities
231
+ const metadata = {};
232
+ if (_options?.model) {
233
+ metadata.model = _options.model;
234
+ }
235
+ if (_options?.identities && _options.identities.length > 0) {
236
+ metadata.identities = _options.identities;
237
+ }
227
238
  await this.sendRequest(AGENT_METHODS.session_prompt, {
228
239
  sessionId: this.session.sessionId,
229
240
  content: [{ type: 'text', text: content }],
230
- // Include model for per-request model override
231
- ...(_options?.model && { metadata: { model: _options.model } }),
241
+ // Include metadata with model and identities
242
+ ...(Object.keys(metadata).length > 0 && { metadata }),
232
243
  });
233
244
  }
234
245
  catch (error) {
@@ -54,6 +54,15 @@ export declare class AGUIAdapter extends BaseProtocolAdapter {
54
54
  messages?: ChatMessage[];
55
55
  /** Model to use for this request (overrides agent default) */
56
56
  model?: string;
57
+ /** Built-in MCP tool names to enable */
58
+ builtinTools?: string[];
59
+ /** Skill IDs to enable */
60
+ skills?: string[];
61
+ /** Connected identity tokens to pass to backend for tool execution */
62
+ identities?: Array<{
63
+ provider: string;
64
+ accessToken: string;
65
+ }>;
57
66
  }): Promise<void>;
58
67
  /**
59
68
  * Send tool result back through AG-UI and continue the conversation