@datalayer/agent-runtimes 1.3.89 → 1.3.91
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.
- package/lib/Agent.js +2 -18
- package/lib/AgentDocument.js +5 -55
- package/lib/AgentNode.js +31 -208
- package/lib/AgentNotebook.js +5 -59
- package/lib/agent-node/AgentNodeGallery.js +23 -111
- package/lib/agents/AgentDetails.js +36 -274
- package/lib/agents/AgentRuntimeChat.js +1 -8
- package/lib/chat/Chat.js +7 -46
- package/lib/chat/ChatFloating.js +15 -100
- package/lib/chat/ChatInline.js +5 -47
- package/lib/chat/ChatPopupStandalone.js +5 -53
- package/lib/chat/ChatSidebar.js +4 -51
- package/lib/chat/ChatStandalone.js +4 -45
- package/lib/chat/EphemeralSurfaceControl.js +5 -25
- package/lib/chat/assistant/AssistantContextMenu.d.ts +8 -0
- package/lib/chat/assistant/AssistantContextMenu.js +17 -1
- package/lib/chat/assistant/AssistantStage.js +6 -25
- package/lib/chat/assistant/BalloonParts.js +8 -40
- package/lib/chat/assistant/BalloonVisual.js +2 -2
- package/lib/chat/assistant/ConversationBalloon.js +2 -11
- package/lib/chat/assistant/DecisionAsk.js +3 -3
- package/lib/chat/assistant/SandboxDetailsDialog.js +3 -17
- package/lib/chat/assistant/SpeechBalloon.js +14 -78
- package/lib/chat/base/ChatBase.js +37 -172
- package/lib/chat/display/EmptyState.js +7 -35
- package/lib/chat/display/FloatingBrandButton.js +4 -34
- package/lib/chat/display/PoweredByTag.js +3 -14
- package/lib/chat/document/EphemeralDocument.js +3 -18
- package/lib/chat/header/ChatHeader.js +1 -17
- package/lib/chat/header/ChatHeaderBase.js +2 -24
- package/lib/chat/header/ChatViewModeToggle.js +7 -29
- package/lib/chat/indicators/McpStatusIndicator.js +3 -12
- package/lib/chat/indicators/SandboxStatusIndicator.js +6 -34
- package/lib/chat/indicators/SkillsStatusIndicator.js +3 -12
- package/lib/chat/indicators/TypingDots.js +1 -11
- package/lib/chat/messages/ChatMessageList.js +58 -185
- package/lib/chat/messages/ChatMessages.js +15 -79
- package/lib/chat/messages/FormSubmissionMessage.js +2 -33
- package/lib/chat/messages/NotebookToolSurfaces.js +12 -41
- package/lib/chat/messages/TurnFooter.js +4 -10
- package/lib/chat/notebook/EphemeralNotebook.js +2 -10
- package/lib/chat/parts/ReasoningPart.js +2 -16
- package/lib/chat/parts/TextPart.js +2 -12
- package/lib/chat/parts/ToolPart.js +16 -90
- package/lib/chat/presence/Presence.js +5 -33
- package/lib/chat/prompt/FloatingCard.js +1 -13
- package/lib/chat/prompt/InputPrompt.js +1 -6
- package/lib/chat/prompt/InputPromptBase.js +4 -17
- package/lib/chat/prompt/InputPromptLexical.js +44 -45
- package/lib/chat/prompt/InputPromptText.js +1 -1
- package/lib/chat/prompt/footer/InPromptFooter.js +1 -8
- package/lib/chat/prompt/menus/AgentsMenu.js +1 -1
- package/lib/chat/prompt/menus/InlineAgentsMenu.js +1 -1
- package/lib/chat/prompt/menus/ModelSelector.js +1 -5
- package/lib/chat/prompt/menus/SkillsMenu.js +3 -30
- package/lib/chat/prompt/menus/SuggestionsMenu.js +1 -1
- package/lib/chat/prompt/menus/ToolsMenu.js +4 -48
- package/lib/chat/prompt/plugins/AgentMentionPlugin.js +2 -9
- package/lib/chat/prompt/plugins/CommandPlugin.js +2 -9
- package/lib/chat/prompt/plugins/MentionChip.js +1 -15
- package/lib/chat/prompt/stack.js +1 -19
- package/lib/chat/tools/A2AAgentDialog.js +9 -42
- package/lib/chat/tools/SubagentActivity.js +5 -22
- package/lib/chat/tools/ToolApprovalBanner.js +4 -34
- package/lib/chat/tools/ToolApprovalDialog.js +4 -19
- package/lib/chat/tools/ToolCallDisplay.js +12 -97
- package/lib/chat/usage/ContextPie.js +4 -45
- package/lib/chat/words.d.ts +7 -0
- package/lib/chat/words.js +12 -0
- package/lib/components/a2ui/datalayer/Chart.js +4 -10
- package/lib/components/a2ui/datalayer/Chat.js +2 -10
- package/lib/components/a2ui/datalayer/Download.js +1 -1
- package/lib/components/a2ui/datalayer/Evidence.js +1 -15
- package/lib/components/a2ui/datalayer/FileUpload.js +1 -12
- package/lib/components/a2ui/datalayer/Table.js +9 -17
- package/lib/components/a2ui/datalayer/formWidgets.js +3 -2
- package/lib/components/a2ui/datalayer/parts.js +1 -16
- package/lib/components/a2ui/styles.js +16 -5
- package/lib/components/agents/AgentSummary.js +1 -51
- package/lib/components/cards/NotificationEventCard.js +6 -72
- package/lib/components/cards/OutputCard.js +4 -48
- package/lib/components/cards/ToolApprovalCard.js +2 -35
- package/lib/components/code-sandboxes/CodeSandboxCellVariables.js +1 -1
- package/lib/components/code-sandboxes/CodeSandboxEnvironmentSelect.js +4 -14
- package/lib/components/code-sandboxes/CodeSandboxPicker.js +16 -21
- package/lib/components/code-sandboxes/CodeSandboxVariables.js +2 -2
- package/lib/components/scheduler/ScheduleMenu.js +5 -10
- package/lib/components/specs/SpecPayloadPreview.js +1 -26
- package/lib/components/teams/A2ATeamGraph.d.ts +4 -3
- package/lib/components/teams/A2ATeamGraph.js +25 -71
- package/lib/components/teams/AnswerSurfacesView.js +2 -2
- package/lib/components/teams/NotebookPreview.js +1 -10
- package/lib/components/teams/NotebookPreviewView.js +2 -3
- package/lib/components/teams/SceneTranscript.js +3 -17
- package/lib/components/teams/SceneView.js +1 -8
- package/lib/components/teams/TeamNotebook.js +5 -13
- package/lib/components/teams/TeamNotebookView.js +2 -12
- package/lib/components/teams/index.d.ts +1 -0
- package/lib/components/teams/index.js +1 -0
- package/lib/components/teams/useBalloonRoom.d.ts +39 -0
- package/lib/components/teams/useBalloonRoom.js +89 -0
- package/lib/config/AgentConfiguration.js +22 -225
- package/lib/context/ContextDistribution.js +7 -41
- package/lib/context/ContextInspector.js +9 -107
- package/lib/context/ContextPanel.js +11 -86
- package/lib/context/ContextUsage.js +6 -34
- package/lib/context/CostTracker.js +7 -42
- package/lib/context/MessageHistory.js +3 -37
- package/lib/context/TurnGraphChart.js +9 -41
- package/lib/examples/A2UiAgentExample.js +6 -108
- package/lib/examples/A2UiComponentsGalleryExample.js +1 -1
- package/lib/examples/A2UiContactCardExample.js +1 -1
- package/lib/examples/A2UiJupyterOutputExample.js +25 -125
- package/lib/examples/A2UiRestaurantExample.js +1 -1
- package/lib/examples/A2UiViewerExample.js +1 -1
- package/lib/examples/AgUiAgenticExample.js +3 -35
- package/lib/examples/AgUiBackendToolRenderingExample.js +2 -25
- package/lib/examples/AgUiHaikuGenUiExample.js +2 -32
- package/lib/examples/AgUiHumanInTheLoopExample.js +5 -59
- package/lib/examples/AgUiSharedStateExample.js +6 -56
- package/lib/examples/AgUiToolsBasedGenUiExample.js +25 -120
- package/lib/examples/AgentA2AExample.js +1 -15
- package/lib/examples/AgentA2ATeamExample.js +6 -30
- package/lib/examples/AgentCheckpointsExample.js +11 -145
- package/lib/examples/AgentCodeSandboxExample.js +5 -108
- package/lib/examples/AgentCodeSandboxesExample.js +3 -30
- package/lib/examples/AgentCodemodeExample.js +9 -85
- package/lib/examples/AgentCompactionExample.js +3 -64
- package/lib/examples/AgentDecideExample.js +1 -13
- package/lib/examples/AgentEvalsExample.js +5 -60
- package/lib/examples/AgentGuardrailsExample.js +4 -28
- package/lib/examples/AgentHooksExample.js +1 -1
- package/lib/examples/AgentInferenceProviderExample.js +5 -96
- package/lib/examples/AgentMCPExample.js +7 -105
- package/lib/examples/AgentMemoryExample.js +5 -74
- package/lib/examples/AgentMonitoringExample.js +7 -53
- package/lib/examples/AgentNotificationsExample.js +3 -61
- package/lib/examples/AgentOtelExample.js +3 -72
- package/lib/examples/AgentOutputsExample.js +6 -81
- package/lib/examples/AgentParametersExample.js +2 -37
- package/lib/examples/AgentSkillsExample.js +3 -45
- package/lib/examples/AgentSubagentsExample.js +6 -56
- package/lib/examples/AgentToolApprovalsExample.js +1 -11
- package/lib/examples/AgentTriggersExample.js +29 -239
- package/lib/examples/AgentspecsExample.js +6 -60
- package/lib/examples/AssistantExample.js +5 -5
- package/lib/examples/AssistantGalleryExample.js +8 -65
- package/lib/examples/CellExample.js +1 -6
- package/lib/examples/ChatCustomExample.js +2 -31
- package/lib/examples/ChatExample.js +1 -9
- package/lib/examples/ChatStandaloneExample.js +3 -37
- package/lib/examples/CopilotKitLexicalExample.js +1 -24
- package/lib/examples/DecksAgent.js +1 -1
- package/lib/examples/DocumentPageAgent.js +1 -1
- package/lib/examples/HomeExample.js +14 -62
- package/lib/examples/Lexical2Example.js +3 -32
- package/lib/examples/LexicalAgentExample.js +2 -34
- package/lib/examples/LexicalAgentSidebarExample.js +3 -34
- package/lib/examples/LoopAppComputerExample.js +1 -1
- package/lib/examples/LoopShellExample.js +2 -2
- package/lib/examples/LoopStrategyExample.js +15 -87
- package/lib/examples/LoopWorkspaceEmbed.js +2 -18
- package/lib/examples/LoopWorkspaceExample.js +2 -2
- package/lib/examples/NotebookAgentExample.js +2 -33
- package/lib/examples/NotebookAgentSidebarExample.js +3 -46
- package/lib/examples/NotebookCollaborationExample.js +1 -31
- package/lib/examples/NotebookExample.js +1 -18
- package/lib/examples/NotebookPageAgent.js +1 -1
- package/lib/examples/ScenesExample.js +5 -24
- package/lib/examples/VoiceChatExample.js +1 -1
- package/lib/examples/components/AuthRequiredView.js +1 -7
- package/lib/examples/components/ErrorView.js +1 -8
- package/lib/examples/components/ExampleErrorBoundary.js +1 -14
- package/lib/examples/components/FooterMetrics.js +1 -7
- package/lib/examples/components/Header.js +12 -51
- package/lib/examples/components/HeaderControls.js +1 -9
- package/lib/examples/components/LexicalEditor.js +1 -8
- package/lib/examples/components/MainContent.js +1 -13
- package/lib/examples/components/MockFileBrowser.js +4 -40
- package/lib/examples/components/SessionTabs.js +1 -1
- package/lib/examples/components/TimeTravel.js +1 -13
- package/lib/examples/main.js +13 -81
- package/lib/examples/scenes/A2UiComponentsGalleryScene.js +3 -34
- package/lib/examples/scenes/A2UiContactCardScene.js +3 -35
- package/lib/examples/scenes/A2UiRestaurantScene.js +3 -53
- package/lib/examples/scenes/A2UiViewerScene.js +3 -34
- package/lib/examples/utils/AssistantGalleryGrid.js +6 -35
- package/lib/examples2/DatalayerNotebookExample.js +3 -33
- package/lib/examples2/NativeNavigationExample.js +4 -10
- package/lib/examples2/NotebookMutationsKernel.js +2 -1
- package/lib/examples2/NotebookMutationsServiceManager.js +2 -1
- package/lib/examples2/ReactRouterExample.js +14 -42
- package/lib/hooks/useToolApprovals.d.ts +2 -34
- package/lib/hooks/useToolApprovals.js +1 -64
- package/lib/identity/AgentIdentity.js +17 -62
- package/lib/identity/IdentityConnect.js +13 -59
- package/lib/identity/OAuthCallback.js +6 -44
- package/lib/lexical/ChatInlinePlugin.js +6 -14
- package/lib/loop/apps/AppFeedback.js +12 -3
- package/lib/loop/apps/AppRenderer.d.ts +4 -3
- package/lib/loop/apps/AppRenderer.js +11 -12
- package/lib/loop/apps/appspec.js +6 -3
- package/lib/loop/apps/feedback.d.ts +3 -2
- package/lib/loop/apps/feedback.js +4 -2
- package/lib/loop/core/index.d.ts +19 -0
- package/lib/loop/core/index.js +27 -0
- package/lib/loop/embed/AppEmbed.d.ts +1 -1
- package/lib/loop/embed/AppEmbed.js +2 -1
- package/lib/loop/embed/LoopEmbed.js +1 -7
- package/lib/loop/embed/embedConfig.d.ts +3 -3
- package/lib/loop/embed/embedConfig.js +2 -3
- package/lib/loop/embed/embedTheme.d.ts +4 -4
- package/lib/loop/embed/embedTheme.js +11 -7
- package/lib/loop/plugins/a2a-sidebar/A2ASidebar.js +7 -34
- package/lib/loop/plugins/a2ui/A2uiView.js +4 -12
- package/lib/loop/plugins/a2ui-surface/InlineSurface.js +1 -16
- package/lib/loop/plugins/a2ui-surface/SurfaceToolResult.js +2 -12
- package/lib/loop/plugins/agents/AnonymousKeyBadge.js +3 -2
- package/lib/loop/plugins/agents/SandboxSelector.js +3 -7
- package/lib/loop/plugins/agents/SandboxView.js +4 -27
- package/lib/loop/plugins/agents/TeamMemberPicker.js +2 -2
- package/lib/loop/plugins/agentspecs/AgentspecPicker.js +3 -2
- package/lib/loop/plugins/app-activity/AppActivity.js +1 -1
- package/lib/loop/plugins/app-computer/AppComputer.js +32 -27
- package/lib/loop/plugins/app-elements/AppElements.js +2 -31
- package/lib/loop/plugins/app-page/AppPage.js +26 -8
- package/lib/loop/plugins/app-rules/AppRulesCard.js +4 -20
- package/lib/loop/plugins/assistant/index.js +1 -13
- package/lib/loop/plugins/chat/ChatView.js +89 -130
- package/lib/loop/plugins/checkpoints-sidebar/CheckpointsSidebar.js +2 -13
- package/lib/loop/plugins/decks/DeckSurface.js +2 -2
- package/lib/loop/plugins/document/DocumentView.js +4 -12
- package/lib/loop/plugins/document-toolbar/SandboxStatusItem.js +3 -8
- package/lib/loop/plugins/graph/GraphView.js +2 -2
- package/lib/loop/plugins/input-prompt/ComposerView.js +1 -1
- package/lib/loop/plugins/notebook/NotebookView.js +3 -11
- package/lib/loop/plugins/page-layout/SplitLayout.js +11 -34
- package/lib/loop/plugins/page-layout/TurnPanel.js +9 -35
- package/lib/loop/plugins/shell/useEditorPreviews.js +3 -2
- package/lib/loop/plugins/subagent-activity/SubagentPulse.js +1 -13
- package/lib/loop/plugins/window-frame/WindowFrame.js +10 -44
- package/lib/loop/plugins/window-frame/index.js +1 -1
- package/lib/loop/shell/LoopWorkspace.js +34 -77
- package/lib/loop/shell/PluginToggles.js +4 -15
- package/lib/loop/shell/SidebarRail.js +8 -40
- package/lib/loop/shell/ViewSwitcher.js +4 -24
- package/lib/loop-main.js +2 -3
- package/lib/mcp/McpServerManager.js +6 -37
- package/lib/portable/index.d.ts +11 -0
- package/lib/portable/index.js +20 -0
- package/lib/protocols/AGUIAdapter.js +2 -2
- package/lib/protocols/BaseProtocolAdapter.d.ts +2 -0
- package/lib/protocols/BaseProtocolAdapter.js +4 -0
- package/lib/specs/apps.js +6 -0
- package/lib/specs/appspecSchema.js +11 -4
- package/lib/stories/loop/ReferenceScreens.js +17 -91
- package/lib/stories/loop/pictures-main.js +1 -1
- package/lib/types/agentspecs.d.ts +5 -2
- package/lib/types/protocol.d.ts +2 -0
- package/lib/utils/approvals.d.ts +59 -0
- package/lib/utils/approvals.js +101 -0
- package/lib/voice/VoiceInput.js +3 -39
- package/package.json +2 -2
- package/lib/shims/primerAddonsBox.d.ts +0 -1
- package/lib/shims/primerAddonsBox.js +0 -7
|
@@ -87,24 +87,7 @@ export function SubagentActivity({ toolCallId, }) {
|
|
|
87
87
|
: isDone
|
|
88
88
|
? 'success.fg'
|
|
89
89
|
: 'accent.fg';
|
|
90
|
-
return (_jsxs(Box, { sx: {
|
|
91
|
-
mt: 1,
|
|
92
|
-
ml: 2,
|
|
93
|
-
borderLeft: '2px solid',
|
|
94
|
-
borderColor: 'border.muted',
|
|
95
|
-
pl: 2,
|
|
96
|
-
}, children: [_jsxs(Box, { as: "button", onClick: () => setExpanded(prev => !prev), sx: {
|
|
97
|
-
display: 'flex',
|
|
98
|
-
alignItems: 'center',
|
|
99
|
-
gap: 1,
|
|
100
|
-
width: '100%',
|
|
101
|
-
border: 'none',
|
|
102
|
-
background: 'transparent',
|
|
103
|
-
cursor: 'pointer',
|
|
104
|
-
p: 0,
|
|
105
|
-
color: 'fg.muted',
|
|
106
|
-
textAlign: 'left',
|
|
107
|
-
}, children: [expanded ? (_jsx(ChevronDownIcon, { size: 12 })) : (_jsx(ChevronRightIcon, { size: 12 })), _jsx(Box, { sx: { color: statusColor, display: 'flex' }, children: _jsx(StatusIcon, { size: 14 }) }), _jsx(Text, { sx: { fontSize: 0, fontWeight: 'bold', color: 'fg.default' }, children: subagentName }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: hasError ? 'failed' : isDone ? 'done' : 'working…' })] }), expanded && (_jsx(Box, { sx: { mt: 1, display: 'flex', flexDirection: 'column', gap: 1 }, children: segments.map((segment, index) => (_jsx(SubagentSegmentView, { segment: segment }, index))) }))] }));
|
|
90
|
+
return (_jsxs(Box, { mt: 1, ml: 2, borderLeft: "2px solid", borderColor: "border.muted", pl: 2, children: [_jsxs(Box, { as: "button", onClick: () => setExpanded(prev => !prev), display: "flex", alignItems: "center", gap: 1, width: "100%", border: "none", background: "transparent", cursor: "pointer", p: 0, color: "fg.muted", textAlign: "left", children: [expanded ? (_jsx(ChevronDownIcon, { size: 12 })) : (_jsx(ChevronRightIcon, { size: 12 })), _jsx(Box, { color: statusColor, display: "flex", children: _jsx(StatusIcon, { size: 14 }) }), _jsx(Text, { sx: { fontSize: 0, fontWeight: 'bold', color: 'fg.default' }, children: subagentName }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: hasError ? 'failed' : isDone ? 'done' : 'working…' })] }), expanded && (_jsx(Box, { mt: 1, display: "flex", flexDirection: "column", gap: 1, children: segments.map((segment, index) => (_jsx(SubagentSegmentView, { segment: segment }, index))) }))] }));
|
|
108
91
|
}
|
|
109
92
|
function SubagentSegmentView({ segment, }) {
|
|
110
93
|
switch (segment.kind) {
|
|
@@ -120,14 +103,14 @@ function SubagentSegmentView({ segment, }) {
|
|
|
120
103
|
case 'thinking':
|
|
121
104
|
if (!segment.text)
|
|
122
105
|
return null;
|
|
123
|
-
return (_jsxs(Box, {
|
|
106
|
+
return (_jsxs(Box, { display: "flex", gap: 1, color: "fg.muted", children: [_jsx(Box, { mt: "2px", flexShrink: 0, children: _jsx(LightBulbIcon, { size: 12 }) }), _jsx(Text, { sx: {
|
|
124
107
|
fontSize: 0,
|
|
125
108
|
fontStyle: 'italic',
|
|
126
109
|
whiteSpace: 'pre-wrap',
|
|
127
110
|
wordBreak: 'break-word',
|
|
128
111
|
}, children: segment.text })] }));
|
|
129
112
|
case 'tool_call':
|
|
130
|
-
return (_jsxs(Box, {
|
|
113
|
+
return (_jsxs(Box, { display: "flex", gap: 1, color: "fg.muted", children: [_jsx(Box, { mt: "2px", flexShrink: 0, children: _jsx(ToolsIcon, { size: 12 }) }), _jsxs(Box, { minWidth: 0, children: [_jsx(Text, { sx: { fontSize: 0, fontWeight: 'bold' }, children: segment.toolName ?? 'tool' }), segment.toolArgs && Object.keys(segment.toolArgs).length > 0 && (_jsx(Text, { as: "pre", sx: {
|
|
131
114
|
fontSize: 0,
|
|
132
115
|
fontFamily: 'mono',
|
|
133
116
|
m: 0,
|
|
@@ -139,7 +122,7 @@ function SubagentSegmentView({ segment, }) {
|
|
|
139
122
|
case 'tool_result':
|
|
140
123
|
if (!segment.result)
|
|
141
124
|
return null;
|
|
142
|
-
return (_jsxs(Box, {
|
|
125
|
+
return (_jsxs(Box, { display: "flex", gap: 1, color: "fg.muted", children: [_jsx(Box, { mt: "2px", flexShrink: 0, color: "success.fg", children: _jsx(CheckCircleIcon, { size: 12 }) }), _jsx(Text, { as: "pre", sx: {
|
|
143
126
|
fontSize: 0,
|
|
144
127
|
fontFamily: 'mono',
|
|
145
128
|
m: 0,
|
|
@@ -147,7 +130,7 @@ function SubagentSegmentView({ segment, }) {
|
|
|
147
130
|
wordBreak: 'break-word',
|
|
148
131
|
}, children: segment.result })] }));
|
|
149
132
|
case 'error':
|
|
150
|
-
return (_jsxs(Box, {
|
|
133
|
+
return (_jsxs(Box, { display: "flex", gap: 1, color: "danger.fg", children: [_jsx(Box, { mt: "2px", flexShrink: 0, children: _jsx(AlertIcon, { size: 12 }) }), _jsx(Text, { sx: { fontSize: 0 }, children: segment.error ?? 'Subagent failed' })] }));
|
|
151
134
|
default:
|
|
152
135
|
return null;
|
|
153
136
|
}
|
|
@@ -13,7 +13,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
* @module chat/tools/ToolApprovalBanner
|
|
14
14
|
*/
|
|
15
15
|
import { useState } from 'react';
|
|
16
|
-
import { Box
|
|
16
|
+
import { Box } from '@datalayer/primer-addons';
|
|
17
|
+
import { Button, Text, CounterLabel } from '@primer/react';
|
|
17
18
|
import { ShieldCheckIcon, AlertIcon, CheckIcon, XIcon, } from '@primer/octicons-react';
|
|
18
19
|
import { useChatWords } from '../ChatLanguage';
|
|
19
20
|
/**
|
|
@@ -26,39 +27,8 @@ export function ToolApprovalBanner({ pendingApprovals, onReview, onApproveAll, o
|
|
|
26
27
|
return null;
|
|
27
28
|
}
|
|
28
29
|
if (collapsed) {
|
|
29
|
-
return (_jsxs(Box, { sx: {
|
|
30
|
-
display: 'flex',
|
|
31
|
-
alignItems: 'center',
|
|
32
|
-
gap: 2,
|
|
33
|
-
px: 3,
|
|
34
|
-
py: 2,
|
|
35
|
-
bg: 'attention.subtle',
|
|
36
|
-
borderBottom: '1px solid',
|
|
37
|
-
borderColor: 'attention.muted',
|
|
38
|
-
cursor: 'pointer',
|
|
39
|
-
}, onClick: () => setCollapsed(false), children: [_jsx(ShieldCheckIcon, { size: 16 }), _jsx(Text, { sx: { fontSize: 1, fontWeight: 'semibold' }, children: chatText.toolApprovalsPending }), _jsx(CounterLabel, { children: pendingApprovals.length })] }));
|
|
30
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, px: 3, py: 2, bg: "attention.subtle", borderBottom: "1px solid", borderColor: "attention.muted", cursor: "pointer", onClick: () => setCollapsed(false), children: [_jsx(ShieldCheckIcon, { size: 16 }), _jsx(Text, { sx: { fontSize: 1, fontWeight: 'semibold' }, children: chatText.toolApprovalsPending }), _jsx(CounterLabel, { children: pendingApprovals.length })] }));
|
|
40
31
|
}
|
|
41
|
-
return (_jsxs(Box, { sx: {
|
|
42
|
-
borderBottom: '1px solid',
|
|
43
|
-
borderColor: 'attention.muted',
|
|
44
|
-
bg: 'attention.subtle',
|
|
45
|
-
}, children: [_jsxs(Box, { sx: {
|
|
46
|
-
display: 'flex',
|
|
47
|
-
alignItems: 'center',
|
|
48
|
-
justifyContent: 'space-between',
|
|
49
|
-
px: 3,
|
|
50
|
-
py: 2,
|
|
51
|
-
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(AlertIcon, { size: 16 }), _jsx(Text, { sx: { fontSize: 1, fontWeight: 'semibold' }, children: chatText.approvalsPending(pendingApprovals.length) })] }), _jsxs(Box, { sx: { display: 'flex', gap: 1 }, children: [onApproveAll && pendingApprovals.length >= 1 && (_jsx(Button, { size: "small", variant: "primary", leadingVisual: CheckIcon, onClick: onApproveAll, children: chatText.approveAll })), collapsible && (_jsx(Button, { size: "small", variant: "invisible", onClick: () => setCollapsed(true), children: chatText.collapse })), onDismiss && (_jsx(Button, { size: "small", variant: "invisible", leadingVisual: XIcon, onClick: onDismiss, "aria-label": chatText.dismiss }))] })] }), _jsx(Box, { sx: { px: 3, pb: 2 }, children: pendingApprovals.map(approval => (_jsxs(Box, { sx: {
|
|
52
|
-
display: 'flex',
|
|
53
|
-
alignItems: 'center',
|
|
54
|
-
justifyContent: 'space-between',
|
|
55
|
-
py: 1,
|
|
56
|
-
px: 2,
|
|
57
|
-
mb: 1,
|
|
58
|
-
bg: 'canvas.default',
|
|
59
|
-
borderRadius: 2,
|
|
60
|
-
border: '1px solid',
|
|
61
|
-
borderColor: 'border.default',
|
|
62
|
-
}, children: [_jsxs(Box, { children: [_jsx(Text, { sx: { fontWeight: 'semibold', fontSize: 1 }, children: approval.toolName }), approval.toolDescription && (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 0, ml: 2 }, children: approval.toolDescription }))] }), _jsx(Button, { size: "small", variant: "default", onClick: () => onReview(approval), children: chatText.review })] }, approval.id))) })] }));
|
|
32
|
+
return (_jsxs(Box, { borderBottom: "1px solid", borderColor: "attention.muted", bg: "attention.subtle", children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", px: 3, py: 2, children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, children: [_jsx(AlertIcon, { size: 16 }), _jsx(Text, { sx: { fontSize: 1, fontWeight: 'semibold' }, children: chatText.approvalsPending(pendingApprovals.length) })] }), _jsxs(Box, { display: "flex", gap: 1, children: [onApproveAll && pendingApprovals.length >= 1 && (_jsx(Button, { size: "small", variant: "primary", leadingVisual: CheckIcon, onClick: onApproveAll, children: chatText.approveAll })), collapsible && (_jsx(Button, { size: "small", variant: "invisible", onClick: () => setCollapsed(true), children: chatText.collapse })), onDismiss && (_jsx(Button, { size: "small", variant: "invisible", leadingVisual: XIcon, onClick: onDismiss, "aria-label": chatText.dismiss }))] })] }), _jsx(Box, { px: 3, pb: 2, children: pendingApprovals.map(approval => (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", py: 1, px: 2, mb: 1, bg: "canvas.default", borderRadius: 2, border: "1px solid", borderColor: "border.default", children: [_jsxs(Box, { children: [_jsx(Text, { sx: { fontWeight: 'semibold', fontSize: 1 }, children: approval.toolName }), approval.toolDescription && (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 0, ml: 2 }, children: approval.toolDescription }))] }), _jsx(Button, { size: "small", variant: "default", onClick: () => onReview(approval), children: chatText.review })] }, approval.id))) })] }));
|
|
63
33
|
}
|
|
64
34
|
export default ToolApprovalBanner;
|
|
@@ -10,7 +10,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
* @module chat/tools/ToolApprovalDialog
|
|
11
11
|
*/
|
|
12
12
|
import { useCallback, useState } from 'react';
|
|
13
|
-
import { Box
|
|
13
|
+
import { Box } from '@datalayer/primer-addons';
|
|
14
|
+
import { Button, Text, Heading, FormControl, Checkbox } from '@primer/react';
|
|
14
15
|
import { Dialog } from '@primer/react/experimental';
|
|
15
16
|
import { AlertIcon, ToolsIcon, CheckIcon, XIcon } from '@primer/octicons-react';
|
|
16
17
|
import { useChatWords } from '../ChatLanguage';
|
|
@@ -29,28 +30,12 @@ export function ToolApprovalDialog({ isOpen, toolName, toolDescription, args, on
|
|
|
29
30
|
if (!isOpen) {
|
|
30
31
|
return null;
|
|
31
32
|
}
|
|
32
|
-
return (_jsxs(Dialog, { onClose: onClose, "aria-labelledby": "tool-approval-title", children: [_jsx(Dialog.Header, { children: _jsxs(Box, {
|
|
33
|
+
return (_jsxs(Dialog, { onClose: onClose, "aria-labelledby": "tool-approval-title", children: [_jsx(Dialog.Header, { children: _jsxs(Box, { display: "flex", alignItems: "center", gap: 2, children: [_jsx(AlertIcon, { size: 16 }), chatText.approvalTitle] }) }), _jsxs(Box, { p: 3, children: [_jsxs(Box, { mb: 3, children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, mb: 2, children: [_jsx(ToolsIcon, { size: 20 }), _jsx(Heading, { as: "h4", sx: { fontSize: 2 }, children: toolName })] }), toolDescription && (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: toolDescription }))] }), _jsxs(Box, { mb: 3, children: [_jsx(Text, { sx: {
|
|
33
34
|
fontWeight: 'semibold',
|
|
34
35
|
fontSize: 1,
|
|
35
36
|
mb: 2,
|
|
36
37
|
display: 'block',
|
|
37
|
-
}, children: chatText.arguments }), _jsx(Box, { as: "pre", sx: {
|
|
38
|
-
p: 3,
|
|
39
|
-
bg: 'canvas.subtle',
|
|
40
|
-
borderRadius: 2,
|
|
41
|
-
border: '1px solid',
|
|
42
|
-
borderColor: 'border.default',
|
|
43
|
-
overflow: 'auto',
|
|
44
|
-
maxHeight: 200,
|
|
45
|
-
fontSize: 0,
|
|
46
|
-
}, children: JSON.stringify(args, null, 2) })] }), _jsx(Box, { sx: {
|
|
47
|
-
p: 3,
|
|
48
|
-
bg: 'attention.subtle',
|
|
49
|
-
borderRadius: 2,
|
|
50
|
-
border: '1px solid',
|
|
51
|
-
borderColor: 'attention.muted',
|
|
52
|
-
mb: 3,
|
|
53
|
-
}, children: _jsx(Text, { sx: { fontSize: 1 }, children: chatText.approvalWarning }) }), showRememberChoice && (_jsxs(FormControl, { sx: { mb: 3 }, children: [_jsx(Checkbox, { checked: rememberChoice, onChange: e => setRememberChoice(e.target.checked) }), _jsx(FormControl.Label, { children: chatText.rememberChoice })] })), _jsxs(Box, { sx: { display: 'flex', justifyContent: 'flex-end', gap: 2 }, children: [_jsx(Button, { variant: "danger", onClick: handleDeny, leadingVisual: XIcon, children: chatText.deny }), _jsx(Button, { variant: "primary", onClick: handleApprove, leadingVisual: CheckIcon, children: chatText.approve })] })] })] }));
|
|
38
|
+
}, children: chatText.arguments }), _jsx(Box, { as: "pre", p: 3, bg: "canvas.subtle", borderRadius: 2, border: "1px solid", borderColor: "border.default", overflow: "auto", maxHeight: 200, fontSize: 0, children: JSON.stringify(args, null, 2) })] }), _jsx(Box, { p: 3, bg: "attention.subtle", borderRadius: 2, border: "1px solid", borderColor: "attention.muted", mb: 3, children: _jsx(Text, { sx: { fontSize: 1 }, children: chatText.approvalWarning }) }), showRememberChoice && (_jsxs(FormControl, { sx: { mb: 3 }, children: [_jsx(Checkbox, { checked: rememberChoice, onChange: e => setRememberChoice(e.target.checked) }), _jsx(FormControl.Label, { children: chatText.rememberChoice })] })), _jsxs(Box, { display: "flex", justifyContent: "flex-end", gap: 2, children: [_jsx(Button, { variant: "danger", onClick: handleDeny, leadingVisual: XIcon, children: chatText.deny }), _jsx(Button, { variant: "primary", onClick: handleApprove, leadingVisual: CheckIcon, children: chatText.approve })] })] })] }));
|
|
54
39
|
}
|
|
55
40
|
/**
|
|
56
41
|
* Hook to manage tool approval dialog state
|
|
@@ -171,43 +171,12 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
171
171
|
result.stderr ??
|
|
172
172
|
undefined)
|
|
173
173
|
: undefined);
|
|
174
|
-
return (_jsxs(Box, { "data-tool-call": toolName, "data-tool-call-status": status, sx: {
|
|
175
|
-
width: '100%',
|
|
176
|
-
border: '1px solid',
|
|
177
|
-
borderColor: 'border.default',
|
|
178
|
-
borderRadius: compact ? '8px' : '12px',
|
|
179
|
-
overflow: 'hidden',
|
|
180
|
-
backgroundColor: 'canvas.default',
|
|
181
|
-
}, children: [_jsxs(Box, { as: "button", onClick: () => setIsExpanded(!isExpanded), sx: {
|
|
182
|
-
width: '100%',
|
|
183
|
-
display: 'flex',
|
|
184
|
-
alignItems: 'center',
|
|
185
|
-
gap: compact ? 1 : 2,
|
|
186
|
-
padding: compact ? 1 : 2,
|
|
187
|
-
backgroundColor: 'canvas.subtle',
|
|
188
|
-
border: 'none',
|
|
189
|
-
borderBottom: isExpanded ? '1px solid' : 'none',
|
|
190
|
-
borderColor: 'border.default',
|
|
191
|
-
cursor: 'pointer',
|
|
192
|
-
textAlign: 'left',
|
|
193
|
-
'&:hover': {
|
|
194
|
-
backgroundColor: 'neutral.muted',
|
|
195
|
-
},
|
|
196
|
-
}, children: [_jsx(Box, { sx: { color: 'fg.muted', flexShrink: 0 }, children: isExpanded ? (_jsx(ChevronDownIcon, { size: 16 })) : (_jsx(ChevronRightIcon, { size: 16 })) }), hasMark(marks) && (_jsx(Box, { sx: { color: 'fg.muted', flexShrink: 0, display: 'flex' }, children: _jsx(SpecMark, { icon: marks?.icon, emoji: marks?.emoji, size: 16 }) })), _jsx(Text, { sx: {
|
|
174
|
+
return (_jsxs(Box, { "data-tool-call": toolName, "data-tool-call-status": status, width: "100%", border: "1px solid", borderColor: "border.default", borderRadius: compact ? '8px' : '12px', overflow: "hidden", backgroundColor: "canvas.default", children: [_jsxs(Box, { as: "button", onClick: () => setIsExpanded(!isExpanded), width: "100%", display: "flex", alignItems: "center", gap: compact ? 1 : 2, padding: compact ? 1 : 2, backgroundColor: "canvas.subtle", border: "none", borderBottom: isExpanded ? '1px solid' : 'none', borderColor: "border.default", cursor: "pointer", textAlign: "left", hover: { backgroundColor: 'neutral.muted' }, children: [_jsx(Box, { color: "fg.muted", flexShrink: 0, children: isExpanded ? (_jsx(ChevronDownIcon, { size: 16 })) : (_jsx(ChevronRightIcon, { size: 16 })) }), hasMark(marks) && (_jsx(Box, { color: "fg.muted", flexShrink: 0, display: "flex", children: _jsx(SpecMark, { icon: marks?.icon, emoji: marks?.emoji, size: 16 }) })), _jsx(Text, { sx: {
|
|
197
175
|
fontWeight: 'semibold',
|
|
198
176
|
fontSize: compact ? 0 : 1,
|
|
199
177
|
color: 'fg.default',
|
|
200
178
|
flexShrink: 0,
|
|
201
|
-
}, children: displayName }), _jsxs(Box, { sx: {
|
|
202
|
-
display: 'inline-flex',
|
|
203
|
-
alignItems: 'center',
|
|
204
|
-
gap: 1,
|
|
205
|
-
px: 2,
|
|
206
|
-
py: '2px',
|
|
207
|
-
borderRadius: 2,
|
|
208
|
-
backgroundColor: statusDisplay.bgColor,
|
|
209
|
-
flexShrink: 0,
|
|
210
|
-
}, children: [_jsx(Box, { sx: { color: statusDisplay.color, display: 'flex' }, children: statusDisplay.icon }), _jsx(Text, { sx: {
|
|
179
|
+
}, children: displayName }), _jsxs(Box, { display: "inline-flex", alignItems: "center", gap: 1, px: 2, py: "2px", borderRadius: 2, backgroundColor: statusDisplay.bgColor, flexShrink: 0, children: [_jsx(Box, { color: statusDisplay.color, display: "flex", children: statusDisplay.icon }), _jsx(Text, { sx: {
|
|
211
180
|
fontSize: 0,
|
|
212
181
|
fontWeight: 'medium',
|
|
213
182
|
color: statusDisplay.color,
|
|
@@ -221,7 +190,7 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
221
190
|
whiteSpace: 'nowrap',
|
|
222
191
|
flex: 1,
|
|
223
192
|
minWidth: 0,
|
|
224
|
-
}, children: argsSummary }))] }), isExpanded && (_jsxs(Box, {
|
|
193
|
+
}, children: argsSummary }))] }), isExpanded && (_jsxs(Box, { p: 3, children: [_jsxs(Box, { mb: result !== undefined || error ? 3 : 0, children: [_jsx(Text, { sx: {
|
|
225
194
|
display: 'block',
|
|
226
195
|
fontSize: 0,
|
|
227
196
|
fontWeight: 'semibold',
|
|
@@ -229,14 +198,7 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
229
198
|
textTransform: 'uppercase',
|
|
230
199
|
letterSpacing: '0.05em',
|
|
231
200
|
mb: 2,
|
|
232
|
-
}, children: chatText.parameters }), _jsx(Box, {
|
|
233
|
-
backgroundColor: 'canvas.inset',
|
|
234
|
-
borderRadius: 2,
|
|
235
|
-
border: '1px solid',
|
|
236
|
-
borderColor: 'border.default',
|
|
237
|
-
overflow: 'auto',
|
|
238
|
-
maxHeight: '200px',
|
|
239
|
-
}, children: _jsx("pre", { style: {
|
|
201
|
+
}, children: chatText.parameters }), _jsx(Box, { backgroundColor: "canvas.inset", borderRadius: 2, border: "1px solid", borderColor: "border.default", overflow: "auto", maxHeight: "200px", children: _jsx("pre", { style: {
|
|
240
202
|
margin: 0,
|
|
241
203
|
padding: '12px',
|
|
242
204
|
fontSize: '12px',
|
|
@@ -254,14 +216,7 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
254
216
|
textTransform: 'uppercase',
|
|
255
217
|
letterSpacing: '0.05em',
|
|
256
218
|
mb: 2,
|
|
257
|
-
}, children: chatText.result }), _jsx(Box, {
|
|
258
|
-
backgroundColor: 'success.subtle',
|
|
259
|
-
borderRadius: 2,
|
|
260
|
-
border: '1px solid',
|
|
261
|
-
borderColor: 'success.muted',
|
|
262
|
-
overflow: 'auto',
|
|
263
|
-
maxHeight: '300px',
|
|
264
|
-
}, children: _jsx("pre", { style: {
|
|
219
|
+
}, children: chatText.result }), _jsx(Box, { backgroundColor: "success.subtle", borderRadius: 2, border: "1px solid", borderColor: "success.muted", overflow: "auto", maxHeight: "300px", children: _jsx("pre", { style: {
|
|
265
220
|
margin: 0,
|
|
266
221
|
padding: '12px',
|
|
267
222
|
fontSize: '12px',
|
|
@@ -271,7 +226,7 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
271
226
|
wordBreak: 'break-word',
|
|
272
227
|
}, children: typeof result === 'string'
|
|
273
228
|
? result
|
|
274
|
-
: JSON.stringify(result, null, 2) }) })] })), approvalRequired && (_jsx(Box, {
|
|
229
|
+
: JSON.stringify(result, null, 2) }) })] })), approvalRequired && (_jsx(Box, { mt: status === 'complete' && result !== undefined ? 3 : 0, children: approvalState === 'approved' ? (_jsxs(Box, { children: [_jsx(Text, { sx: { color: 'success.fg', fontSize: 1, display: 'block' }, children: chatText.approvedRunning }), approvalDecisionSource === 'external' && (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 0, display: 'block' }, children: chatText.approvedElsewhere }))] })) : approvalState === 'denied' ? (_jsxs(Box, { children: [_jsx(Text, { sx: { color: 'danger.fg', fontSize: 1, display: 'block' }, children: chatText.deniedWontRun }), approvalDecisionSource === 'external' && (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 0, display: 'block' }, children: chatText.decidedElsewhere }))] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 1, color: 'fg.default' }, children: chatText.approvalNeeded }), _jsxs(Box, { mt: 2, display: "flex", gap: 2, children: [_jsx(Button, { size: "small", onClick: onApprove, disabled: approvalLoading || !onApprove, children: chatText.approve }), _jsx(Button, { size: "small", variant: "danger", onClick: onDeny, disabled: approvalLoading || !onDeny, children: chatText.deny })] })] })) })), status === 'error' && effectiveExecutionError && (_jsxs(Box, { children: [_jsxs(Text, { sx: {
|
|
275
230
|
display: 'block',
|
|
276
231
|
fontSize: 0,
|
|
277
232
|
fontWeight: 'semibold',
|
|
@@ -279,13 +234,7 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
279
234
|
textTransform: 'uppercase',
|
|
280
235
|
letterSpacing: '0.05em',
|
|
281
236
|
mb: 2,
|
|
282
|
-
}, children: [_jsx(AlertIcon, { size: 12 }), " ", chatText.executionError] }), _jsxs(Box, { sx: {
|
|
283
|
-
backgroundColor: 'danger.subtle',
|
|
284
|
-
borderRadius: 2,
|
|
285
|
-
border: '1px solid',
|
|
286
|
-
borderColor: 'danger.muted',
|
|
287
|
-
p: 2,
|
|
288
|
-
}, children: [_jsx(Text, { sx: { fontSize: 1, color: 'danger.fg' }, children: effectiveExecutionError }), _jsx(Text, { sx: {
|
|
237
|
+
}, children: [_jsx(AlertIcon, { size: 12 }), " ", chatText.executionError] }), _jsxs(Box, { backgroundColor: "danger.subtle", borderRadius: 2, border: "1px solid", borderColor: "danger.muted", p: 2, children: [_jsx(Text, { sx: { fontSize: 1, color: 'danger.fg' }, children: effectiveExecutionError }), _jsx(Text, { sx: {
|
|
289
238
|
display: 'block',
|
|
290
239
|
fontSize: 0,
|
|
291
240
|
color: 'fg.muted',
|
|
@@ -298,17 +247,7 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
298
247
|
textTransform: 'uppercase',
|
|
299
248
|
letterSpacing: '0.05em',
|
|
300
249
|
mb: 2,
|
|
301
|
-
}, children: [chatText.toolCodeError, ": ", effectiveCodeError.name] }), _jsxs(Box, { sx: {
|
|
302
|
-
backgroundColor: 'severe.subtle',
|
|
303
|
-
borderRadius: 2,
|
|
304
|
-
border: '1px solid',
|
|
305
|
-
borderColor: 'severe.muted',
|
|
306
|
-
overflow: 'hidden',
|
|
307
|
-
}, children: [_jsx(Box, { sx: { p: 2 }, children: _jsx(Text, { sx: { fontSize: 1, color: 'severe.fg' }, children: effectiveCodeError.value }) }), effectiveCodeError.traceback && (_jsx(Box, { sx: {
|
|
308
|
-
borderTop: '1px solid',
|
|
309
|
-
borderColor: 'severe.muted',
|
|
310
|
-
backgroundColor: 'canvas.inset',
|
|
311
|
-
}, children: _jsx("pre", { style: {
|
|
250
|
+
}, children: [chatText.toolCodeError, ": ", effectiveCodeError.name] }), _jsxs(Box, { backgroundColor: "severe.subtle", borderRadius: 2, border: "1px solid", borderColor: "severe.muted", overflow: "hidden", children: [_jsx(Box, { p: 2, children: _jsx(Text, { sx: { fontSize: 1, color: 'severe.fg' }, children: effectiveCodeError.value }) }), effectiveCodeError.traceback && (_jsx(Box, { borderTop: "1px solid", borderColor: "severe.muted", backgroundColor: "canvas.inset", children: _jsx("pre", { style: {
|
|
312
251
|
margin: 0,
|
|
313
252
|
padding: '8px 12px',
|
|
314
253
|
fontSize: '11px',
|
|
@@ -330,13 +269,7 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
330
269
|
textTransform: 'uppercase',
|
|
331
270
|
letterSpacing: '0.05em',
|
|
332
271
|
mb: 2,
|
|
333
|
-
}, children: chatText.errorHeading }), _jsx(Box, { sx: {
|
|
334
|
-
backgroundColor: 'danger.subtle',
|
|
335
|
-
borderRadius: 2,
|
|
336
|
-
border: '1px solid',
|
|
337
|
-
borderColor: 'danger.muted',
|
|
338
|
-
p: 2,
|
|
339
|
-
}, children: _jsx(Text, { sx: { fontSize: 1, color: 'danger.fg' }, children: effectiveError }) })] })), hasNonZeroExit &&
|
|
272
|
+
}, children: chatText.errorHeading }), _jsx(Box, { backgroundColor: "danger.subtle", borderRadius: 2, border: "1px solid", borderColor: "danger.muted", p: 2, children: _jsx(Text, { sx: { fontSize: 1, color: 'danger.fg' }, children: effectiveError }) })] })), hasNonZeroExit &&
|
|
340
273
|
!effectiveExecutionError &&
|
|
341
274
|
!effectiveCodeError && (_jsxs(Box, { children: [_jsxs(Text, { sx: {
|
|
342
275
|
display: 'block',
|
|
@@ -346,25 +279,12 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
346
279
|
textTransform: 'uppercase',
|
|
347
280
|
letterSpacing: '0.05em',
|
|
348
281
|
mb: 2,
|
|
349
|
-
}, children: [_jsx(AlertIcon, { size: 12 }), " ", chatText.processExited] }), _jsxs(Box, { sx: {
|
|
350
|
-
backgroundColor: 'attention.subtle',
|
|
351
|
-
borderRadius: 2,
|
|
352
|
-
border: '1px solid',
|
|
353
|
-
borderColor: 'attention.muted',
|
|
354
|
-
p: 2,
|
|
355
|
-
}, children: [_jsx(Text, { sx: { fontSize: 1, color: 'attention.fg' }, children: chatText.exitedWithCode(String(effectiveExitCode)) }), _jsx(Text, { sx: {
|
|
282
|
+
}, children: [_jsx(AlertIcon, { size: 12 }), " ", chatText.processExited] }), _jsxs(Box, { backgroundColor: "attention.subtle", borderRadius: 2, border: "1px solid", borderColor: "attention.muted", p: 2, children: [_jsx(Text, { sx: { fontSize: 1, color: 'attention.fg' }, children: chatText.exitedWithCode(String(effectiveExitCode)) }), _jsx(Text, { sx: {
|
|
356
283
|
display: 'block',
|
|
357
284
|
fontSize: 0,
|
|
358
285
|
color: 'fg.muted',
|
|
359
286
|
mt: 1,
|
|
360
|
-
}, children: chatText.nonZeroExit })] }), effectiveExitOutput && (_jsx(Box, {
|
|
361
|
-
mt: 2,
|
|
362
|
-
backgroundColor: 'canvas.inset',
|
|
363
|
-
borderRadius: 2,
|
|
364
|
-
border: '1px solid',
|
|
365
|
-
borderColor: 'attention.muted',
|
|
366
|
-
overflow: 'auto',
|
|
367
|
-
}, children: _jsx("pre", { style: {
|
|
287
|
+
}, children: chatText.nonZeroExit })] }), effectiveExitOutput && (_jsx(Box, { mt: 2, backgroundColor: "canvas.inset", borderRadius: 2, border: "1px solid", borderColor: "attention.muted", overflow: "auto", children: _jsx("pre", { style: {
|
|
368
288
|
margin: 0,
|
|
369
289
|
padding: '10px 12px',
|
|
370
290
|
fontSize: '12px',
|
|
@@ -373,11 +293,6 @@ export function ToolCallDisplay({ toolCallId, toolName, args, result, status, er
|
|
|
373
293
|
whiteSpace: 'pre-wrap',
|
|
374
294
|
wordBreak: 'break-word',
|
|
375
295
|
maxHeight: '200px',
|
|
376
|
-
}, children: effectiveExitOutput }) }))] })), _jsx(Box, { sx: {
|
|
377
|
-
mt: 3,
|
|
378
|
-
pt: 2,
|
|
379
|
-
borderTop: '1px solid',
|
|
380
|
-
borderColor: 'border.muted',
|
|
381
|
-
}, children: _jsxs(Text, { sx: { fontSize: 0, color: 'fg.subtle', fontFamily: 'monospace' }, children: ["ID: ", toolCallId] }) })] }))] }));
|
|
296
|
+
}, children: effectiveExitOutput }) }))] })), _jsx(Box, { mt: 3, pt: 2, borderTop: "1px solid", borderColor: "border.muted", children: _jsxs(Text, { sx: { fontSize: 0, color: 'fg.subtle', fontFamily: 'monospace' }, children: ["ID: ", toolCallId] }) })] }))] }));
|
|
382
297
|
}
|
|
383
298
|
export default ToolCallDisplay;
|
|
@@ -150,19 +150,7 @@ export function ContextPie({ agentUsage, padding, showContextRing = false, }) {
|
|
|
150
150
|
},
|
|
151
151
|
],
|
|
152
152
|
};
|
|
153
|
-
return (_jsxs(Box, {
|
|
154
|
-
display: 'flex',
|
|
155
|
-
alignItems: 'center',
|
|
156
|
-
justifyContent: 'flex-start',
|
|
157
|
-
gap: 2,
|
|
158
|
-
py: 1,
|
|
159
|
-
px: padding,
|
|
160
|
-
bg: 'canvas.subtle',
|
|
161
|
-
flexWrap: 'nowrap',
|
|
162
|
-
overflow: 'visible',
|
|
163
|
-
whiteSpace: 'nowrap',
|
|
164
|
-
minWidth: 0,
|
|
165
|
-
}, children: [showContextRing && (_jsxs(Box, { sx: { position: 'relative', flexShrink: 0 }, onMouseEnter: () => {
|
|
153
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "flex-start", gap: 2, py: 1, px: padding, bg: "canvas.subtle", flexWrap: "nowrap", overflow: "visible", whiteSpace: "nowrap", minWidth: 0, children: [showContextRing && (_jsxs(Box, { position: "relative", flexShrink: 0, onMouseEnter: () => {
|
|
166
154
|
if (hoverTimeoutRef.current)
|
|
167
155
|
clearTimeout(hoverTimeoutRef.current);
|
|
168
156
|
hoverTimeoutRef.current = setTimeout(() => setContextOverlayOpen(true), 150);
|
|
@@ -170,30 +158,7 @@ export function ContextPie({ agentUsage, padding, showContextRing = false, }) {
|
|
|
170
158
|
if (hoverTimeoutRef.current)
|
|
171
159
|
clearTimeout(hoverTimeoutRef.current);
|
|
172
160
|
hoverTimeoutRef.current = setTimeout(() => setContextOverlayOpen(false), 250);
|
|
173
|
-
}, children: [_jsx(Box, { ref: contextAnchorRef, sx: {
|
|
174
|
-
cursor: 'pointer',
|
|
175
|
-
width: 20,
|
|
176
|
-
height: 20,
|
|
177
|
-
display: 'flex',
|
|
178
|
-
alignItems: 'center',
|
|
179
|
-
justifyContent: 'center',
|
|
180
|
-
border: '1px solid',
|
|
181
|
-
borderColor: 'border.default',
|
|
182
|
-
borderRadius: '50%',
|
|
183
|
-
}, children: _jsx(ReactECharts, { option: miniPieOption, style: { width: 18, height: 18 }, opts: { renderer: 'svg' } }) }), contextOverlayOpen && (_jsxs(Box, { sx: {
|
|
184
|
-
position: 'absolute',
|
|
185
|
-
bottom: '100%',
|
|
186
|
-
left: 0,
|
|
187
|
-
mb: 1,
|
|
188
|
-
p: 3,
|
|
189
|
-
width: 260,
|
|
190
|
-
bg: 'canvas.overlay',
|
|
191
|
-
borderRadius: 2,
|
|
192
|
-
boxShadow: 'shadow.large',
|
|
193
|
-
border: '1px solid',
|
|
194
|
-
borderColor: 'border.default',
|
|
195
|
-
zIndex: 100,
|
|
196
|
-
}, children: [_jsx(Text, { sx: {
|
|
161
|
+
}, children: [_jsx(Box, { ref: contextAnchorRef, cursor: "pointer", width: 20, height: 20, display: "flex", alignItems: "center", justifyContent: "center", border: "1px solid", borderColor: "border.default", borderRadius: "50%", children: _jsx(ReactECharts, { option: miniPieOption, style: { width: 18, height: 18 }, opts: { renderer: 'svg' } }) }), contextOverlayOpen && (_jsxs(Box, { position: "absolute", bottom: "100%", left: 0, mb: 1, p: 3, width: 260, bg: "canvas.overlay", borderRadius: 2, boxShadow: "shadow.large", border: "1px solid", borderColor: "border.default", zIndex: 100, children: [_jsx(Text, { sx: {
|
|
197
162
|
fontWeight: 'bold',
|
|
198
163
|
fontSize: 1,
|
|
199
164
|
color: 'fg.default',
|
|
@@ -214,15 +179,9 @@ export function ContextPie({ agentUsage, padding, showContextRing = false, }) {
|
|
|
214
179
|
fontWeight: 'semibold',
|
|
215
180
|
display: 'block',
|
|
216
181
|
mb: 2,
|
|
217
|
-
}, children: ['• ', pct.toFixed(0), "%"] }), _jsx(Box, {
|
|
182
|
+
}, children: ['• ', pct.toFixed(0), "%"] }), _jsx(Box, { display: "flex", justifyContent: "center", mb: 2, children: _jsx(ReactECharts, { option: overlayPieOption, style: { width: 80, height: 80 }, opts: { renderer: 'svg' } }) }), _jsx(Box, { display: "flex", flexDirection: "column", gap: 1, children: categories.map(cat => {
|
|
218
183
|
const catPct = usedTokens > 0 ? (cat.value / usedTokens) * 100 : 0;
|
|
219
|
-
return (_jsxs(Box, {
|
|
220
|
-
width: 8,
|
|
221
|
-
height: 8,
|
|
222
|
-
borderRadius: '50%',
|
|
223
|
-
bg: cat.color,
|
|
224
|
-
flexShrink: 0,
|
|
225
|
-
} }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', flex: 1 }, children: cat.name }), _jsxs(Text, { sx: {
|
|
184
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, children: [_jsx(Box, { width: 8, height: 8, borderRadius: "50%", bg: cat.color, flexShrink: 0 }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', flex: 1 }, children: cat.name }), _jsxs(Text, { sx: {
|
|
226
185
|
fontSize: 0,
|
|
227
186
|
color: 'fg.default',
|
|
228
187
|
fontWeight: 'semibold',
|
package/lib/chat/words.d.ts
CHANGED
|
@@ -20,6 +20,13 @@ export type ChatWords = {
|
|
|
20
20
|
demoKeyExpired: string;
|
|
21
21
|
/** The person's key has run out. */
|
|
22
22
|
keyExpired: string;
|
|
23
|
+
/**
|
|
24
|
+
* No runtime is assigned to the conversation on Datalayer (the pool had
|
|
25
|
+
* none, or its launch was refused), with why: nothing is sent.
|
|
26
|
+
*/
|
|
27
|
+
noRuntime: (reason: string) => string;
|
|
28
|
+
/** Its runtime is still being assigned: nothing is sent until it is. */
|
|
29
|
+
runtimeStarting: string;
|
|
23
30
|
/** The empty chat's title. */
|
|
24
31
|
startConversation: string;
|
|
25
32
|
/** The empty chat's line when it has no starters. */
|
package/lib/chat/words.js
CHANGED
|
@@ -30,6 +30,8 @@ export const CHAT_WORDS = {
|
|
|
30
30
|
suggestedPrompts: 'Suggested prompts',
|
|
31
31
|
demoKeyExpired: 'This demo runs on a shared key, and its time is up. Sign in to keep going.',
|
|
32
32
|
keyExpired: 'Your key has expired. Sign in to keep going.',
|
|
33
|
+
noRuntime: reason => `No runtime is assigned to this conversation, so nothing can be sent. ${reason}`,
|
|
34
|
+
runtimeStarting: 'Its runtime is being assigned: you can send once it is.',
|
|
33
35
|
startConversation: 'Start a conversation',
|
|
34
36
|
sendToBegin: 'Send a message to begin chatting',
|
|
35
37
|
copyTurn: 'Copy this turn',
|
|
@@ -99,6 +101,8 @@ export const CHAT_WORDS = {
|
|
|
99
101
|
suggestedPrompts: 'Suggestions de questions',
|
|
100
102
|
demoKeyExpired: 'Cette démo utilise une clé partagée, et son temps est écoulé. Connectez-vous pour continuer.',
|
|
101
103
|
keyExpired: 'Votre clé a expiré. Connectez-vous pour continuer.',
|
|
104
|
+
noRuntime: reason => `Aucun runtime n’est attribué à cette conversation : rien ne peut être envoyé. ${reason}`,
|
|
105
|
+
runtimeStarting: 'Son runtime est en cours d’attribution : vous pourrez envoyer une fois qu’il le sera.',
|
|
102
106
|
startConversation: 'Commencer une conversation',
|
|
103
107
|
sendToBegin: 'Envoyez un message pour commencer',
|
|
104
108
|
copyTurn: 'Copier cet échange',
|
|
@@ -170,6 +174,8 @@ export const CHAT_WORDS = {
|
|
|
170
174
|
suggestedPrompts: 'Preguntas sugeridas',
|
|
171
175
|
demoKeyExpired: 'Esta demo usa una clave compartida y su tiempo se ha agotado. Inicia sesión para continuar.',
|
|
172
176
|
keyExpired: 'Tu clave ha caducado. Inicia sesión para continuar.',
|
|
177
|
+
noRuntime: reason => `No hay ningún runtime asignado a esta conversación, así que no se puede enviar nada. ${reason}`,
|
|
178
|
+
runtimeStarting: 'Se le está asignando un runtime: podrás enviar cuando lo tenga.',
|
|
173
179
|
startConversation: 'Empieza una conversación',
|
|
174
180
|
sendToBegin: 'Envía un mensaje para empezar',
|
|
175
181
|
copyTurn: 'Copiar este turno',
|
|
@@ -241,6 +247,8 @@ export const CHAT_WORDS = {
|
|
|
241
247
|
suggestedPrompts: 'Vorgeschlagene Fragen',
|
|
242
248
|
demoKeyExpired: 'Diese Demo läuft mit einem geteilten Schlüssel, und ihre Zeit ist abgelaufen. Melde dich an, um weiterzumachen.',
|
|
243
249
|
keyExpired: 'Dein Schlüssel ist abgelaufen. Melde dich an, um weiterzumachen.',
|
|
250
|
+
noRuntime: reason => `Diesem Gespräch ist keine Runtime zugewiesen, daher kann nichts gesendet werden. ${reason}`,
|
|
251
|
+
runtimeStarting: 'Eine Runtime wird zugewiesen: Du kannst senden, sobald sie da ist.',
|
|
244
252
|
startConversation: 'Ein Gespräch beginnen',
|
|
245
253
|
sendToBegin: 'Sende eine Nachricht, um zu beginnen',
|
|
246
254
|
copyTurn: 'Diesen Austausch kopieren',
|
|
@@ -312,6 +320,8 @@ export const CHAT_WORDS = {
|
|
|
312
320
|
suggestedPrompts: 'Domande suggerite',
|
|
313
321
|
demoKeyExpired: 'Questa demo usa una chiave condivisa e il suo tempo è scaduto. Accedi per continuare.',
|
|
314
322
|
keyExpired: 'La tua chiave è scaduta. Accedi per continuare.',
|
|
323
|
+
noRuntime: reason => `Nessun runtime è assegnato a questa conversazione, quindi non si può inviare nulla. ${reason}`,
|
|
324
|
+
runtimeStarting: 'Gli si sta assegnando un runtime: potrai inviare appena sarà pronto.',
|
|
315
325
|
startConversation: 'Inizia una conversazione',
|
|
316
326
|
sendToBegin: 'Invia un messaggio per iniziare',
|
|
317
327
|
copyTurn: 'Copia questo scambio',
|
|
@@ -383,6 +393,8 @@ export const CHAT_WORDS = {
|
|
|
383
393
|
suggestedPrompts: 'Perguntas sugeridas',
|
|
384
394
|
demoKeyExpired: 'Esta demonstração usa uma chave compartilhada e o tempo dela acabou. Entre para continuar.',
|
|
385
395
|
keyExpired: 'Sua chave expirou. Entre para continuar.',
|
|
396
|
+
noRuntime: reason => `Nenhum runtime está atribuído a esta conversa, então nada pode ser enviado. ${reason}`,
|
|
397
|
+
runtimeStarting: 'Um runtime está sendo atribuído: você poderá enviar assim que estiver.',
|
|
386
398
|
startConversation: 'Comece uma conversa',
|
|
387
399
|
sendToBegin: 'Envie uma mensagem para começar',
|
|
388
400
|
copyTurn: 'Copiar esta troca',
|
|
@@ -152,16 +152,10 @@ export function ChartView({ props }) {
|
|
|
152
152
|
const option = useMemo(() => chartOption(points, { kind, x, y, series }, colours), [points, kind, x, y, series, colours]);
|
|
153
153
|
const columns = series ? [x, series, y] : [x, y];
|
|
154
154
|
const label = `${title || 'Chart'}: ${y} by ${x}, as a ${kind}`;
|
|
155
|
-
return (_jsx(BlockFrame, { title: title, label: "Chart", weight: props.weight, testId: "a2ui-chart", children: _jsx(Box, { ref: frame, children: 'problem' in read ? (_jsx(Problem, { children: read.problem })) : points.length === 0 ? (_jsx(Quiet, { children: "No points yet." })) : (_jsxs(Box, { as: "figure", "aria-label": label,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
outline: '2px solid',
|
|
160
|
-
outlineColor: 'accent.fg',
|
|
161
|
-
},
|
|
162
|
-
}, children: _jsx(Text, { children: "The numbers" }) }), _jsxs(Box, { as: "table", sx: {
|
|
163
|
-
mt: 1,
|
|
164
|
-
borderCollapse: 'collapse',
|
|
155
|
+
return (_jsx(BlockFrame, { title: title, label: "Chart", weight: props.weight, testId: "a2ui-chart", children: _jsx(Box, { ref: frame, children: 'problem' in read ? (_jsx(Problem, { children: read.problem })) : points.length === 0 ? (_jsx(Quiet, { children: "No points yet." })) : (_jsxs(Box, { as: "figure", "aria-label": label, m: 0, children: [_jsx("div", { "aria-hidden": "true", children: _jsx(ReactECharts, { option: option, style: { height: 240, width: '100%' }, opts: { renderer: 'svg' }, notMerge: true, lazyUpdate: true }) }), _jsxs(Box, { as: "details", fontSize: 1, children: [_jsx(Box, { as: "summary", cursor: "pointer", color: "fg.muted", focusVisible: {
|
|
156
|
+
outline: '2px solid',
|
|
157
|
+
outlineColor: 'accent.fg',
|
|
158
|
+
}, children: _jsx(Text, { children: "The numbers" }) }), _jsxs(Box, { as: "table", mt: 1, borderCollapse: "collapse", sx: {
|
|
165
159
|
'& th, & td': {
|
|
166
160
|
textAlign: 'left',
|
|
167
161
|
pr: 3,
|
|
@@ -100,17 +100,9 @@ export function ChatView({ props }) {
|
|
|
100
100
|
action?.();
|
|
101
101
|
setDraft('');
|
|
102
102
|
};
|
|
103
|
-
return (_jsxs(BlockFrame, { label: "Chat", weight: props.weight, testId: "a2ui-chat", children: ['problem' in read ? (_jsx(Problem, { children: read.problem })) : (_jsx(Box, {
|
|
104
|
-
maxHeight: 420,
|
|
105
|
-
overflowY: 'auto',
|
|
106
|
-
borderRadius: CARD_RADIUS,
|
|
107
|
-
}, children: _jsx(ChatMessageList, { displayItems: read.items, isLoading: false, isStreaming: false, showLoadingIndicator: false, hideMessagesAfterToolUI: false, avatarConfig: AVATARS, padding: 2, emptyContent: _jsx(ChatEmptyState, { description: "", emptyState: { title: welcome || 'Start a conversation' }, suggestions: starters.map(starter => ({
|
|
103
|
+
return (_jsxs(BlockFrame, { label: "Chat", weight: props.weight, testId: "a2ui-chat", children: ['problem' in read ? (_jsx(Problem, { children: read.problem })) : (_jsx(Box, { maxHeight: 420, overflowY: "auto", borderRadius: CARD_RADIUS, children: _jsx(ChatMessageList, { displayItems: read.items, isLoading: false, isStreaming: false, showLoadingIndicator: false, hideMessagesAfterToolUI: false, avatarConfig: AVATARS, padding: 2, emptyContent: _jsx(ChatEmptyState, { description: "", emptyState: { title: welcome || 'Start a conversation' }, suggestions: starters.map(starter => ({
|
|
108
104
|
title: starter,
|
|
109
105
|
message: starter,
|
|
110
|
-
})), onSuggestionSubmit: suggestion => send(suggestion.message) }), messagesEndRef: messagesEnd, onRespond: async () => undefined }) })), _jsxs(Box, {
|
|
111
|
-
display: 'flex',
|
|
112
|
-
alignItems: 'flex-end',
|
|
113
|
-
gap: 2,
|
|
114
|
-
}, children: [_jsx(Box, { sx: { flex: 1, minWidth: 0 }, children: _jsx(InputPromptText, { value: draft, onChange: setDraft, placeholder: placeholder, onSubmit: () => send(draft), inputRef: inputRef }) }), _jsx(IconButton, { icon: PaperAirplaneIcon, "aria-label": "Send", variant: "primary", disabled: !draft.trim(), onClick: () => send(draft) })] })] }));
|
|
106
|
+
})), onSuggestionSubmit: suggestion => send(suggestion.message) }), messagesEndRef: messagesEnd, onRespond: async () => undefined }) })), _jsxs(Box, { display: "flex", alignItems: "flex-end", gap: 2, children: [_jsx(Box, { flex: 1, minWidth: 0, children: _jsx(InputPromptText, { value: draft, onChange: setDraft, placeholder: placeholder, onSubmit: () => send(draft), inputRef: inputRef }) }), _jsx(IconButton, { icon: PaperAirplaneIcon, "aria-label": "Send", variant: "primary", disabled: !draft.trim(), onClick: () => send(draft) })] })] }));
|
|
115
107
|
}
|
|
116
108
|
export const Chat = ownImplementation('Chat', ChatView);
|
|
@@ -61,6 +61,6 @@ export function DownloadView({ props }) {
|
|
|
61
61
|
const said = [props.media_type, sizeInWords(props.size)]
|
|
62
62
|
.filter(Boolean)
|
|
63
63
|
.join(' · ');
|
|
64
|
-
return (_jsx(BlockFrame, { label: "File to download", weight: props.weight, testId: "a2ui-download", children: 'problem' in offered ? (_jsx(Problem, { children: offered.problem })) : (_jsxs(Box, {
|
|
64
|
+
return (_jsx(BlockFrame, { label: "File to download", weight: props.weight, testId: "a2ui-download", children: 'problem' in offered ? (_jsx(Problem, { children: offered.problem })) : (_jsxs(Box, { display: "flex", gap: 2, alignItems: "flex-start", children: [_jsx(Box, { color: "fg.muted", pt: "2px", children: _jsx(DownloadIcon, { size: 16, "aria-hidden": "true" }) }), _jsxs(Box, { display: "flex", flexDirection: "column", minWidth: 0, children: [_jsxs(Box, { children: [_jsx(Link, { href: offered.url, download: offered.name, target: "_blank", rel: "noreferrer noopener", onClick: () => action?.(), sx: { fontWeight: 'semibold', wordBreak: 'break-word' }, children: offered.name }), said ? (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 1, ml: 2 }, children: said })) : null] }), props.description ? (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: props.description })) : null] })] })) }));
|
|
65
65
|
}
|
|
66
66
|
export const Download = ownImplementation('Download', DownloadView);
|
|
@@ -54,20 +54,6 @@ export function EvidenceView({ props }) {
|
|
|
54
54
|
const sources = 'sources' in read ? read.sources : [];
|
|
55
55
|
const shown = all ? sources : sources.slice(0, maxItems);
|
|
56
56
|
const hidden = sources.length - shown.length;
|
|
57
|
-
return (_jsxs(BlockFrame, { title: title, label: "Evidence", weight: props.weight, testId: "a2ui-evidence", children: ['problem' in read ? (_jsx(Problem, { children: read.problem })) : sources.length === 0 ? (_jsx(Quiet, { children: "Nothing cited yet." })) : (_jsx(Box, { as: "ol", sx: {
|
|
58
|
-
m: 0,
|
|
59
|
-
pl: 3,
|
|
60
|
-
display: 'flex',
|
|
61
|
-
flexDirection: 'column',
|
|
62
|
-
gap: 2,
|
|
63
|
-
}, children: shown.map((source, index) => (_jsxs("li", { children: [source.url ? (_jsxs(Link, { href: source.url, target: "_blank", rel: "noreferrer noopener", onClick: () => action?.(), sx: { fontWeight: 'semibold' }, children: [source.title, ' ', _jsx(LinkExternalIcon, { size: 12, "aria-label": "opens in a new tab" })] })) : (_jsx(Text, { sx: { fontWeight: 'semibold' }, children: source.title })), showPassages && source.passage ? (_jsx(Box, { as: "blockquote", sx: {
|
|
64
|
-
m: 0,
|
|
65
|
-
mt: 1,
|
|
66
|
-
pl: 2,
|
|
67
|
-
borderLeft: '3px solid',
|
|
68
|
-
borderColor: 'border.default',
|
|
69
|
-
color: 'fg.muted',
|
|
70
|
-
fontSize: 1,
|
|
71
|
-
}, children: source.passage })) : null] }, `${source.url}-${index}`))) })), hidden > 0 ? (_jsx(Box, { children: _jsxs(Button, { size: "small", variant: "invisible", onClick: () => setAll(true), children: [hidden, " more"] }) })) : null] }));
|
|
57
|
+
return (_jsxs(BlockFrame, { title: title, label: "Evidence", weight: props.weight, testId: "a2ui-evidence", children: ['problem' in read ? (_jsx(Problem, { children: read.problem })) : sources.length === 0 ? (_jsx(Quiet, { children: "Nothing cited yet." })) : (_jsx(Box, { as: "ol", m: 0, pl: 3, display: "flex", flexDirection: "column", gap: 2, children: shown.map((source, index) => (_jsxs("li", { children: [source.url ? (_jsxs(Link, { href: source.url, target: "_blank", rel: "noreferrer noopener", onClick: () => action?.(), sx: { fontWeight: 'semibold' }, children: [source.title, ' ', _jsx(LinkExternalIcon, { size: 12, "aria-label": "opens in a new tab" })] })) : (_jsx(Text, { sx: { fontWeight: 'semibold' }, children: source.title })), showPassages && source.passage ? (_jsx(Box, { as: "blockquote", m: 0, mt: 1, pl: 2, borderLeft: "3px solid", borderColor: "border.default", color: "fg.muted", fontSize: 1, children: source.passage })) : null] }, `${source.url}-${index}`))) })), hidden > 0 ? (_jsx(Box, { children: _jsxs(Button, { size: "small", variant: "invisible", onClick: () => setAll(true), children: [hidden, " more"] }) })) : null] }));
|
|
72
58
|
}
|
|
73
59
|
export const Evidence = ownImplementation('Evidence', EvidenceView);
|