@datalayer/agent-runtimes 0.0.10 → 0.0.12
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/README.md +2 -2
- package/lib/Agent.d.ts +29 -0
- package/lib/Agent.js +131 -0
- package/lib/AgentLexical.d.ts +34 -0
- package/lib/AgentLexical.js +296 -0
- package/lib/AgentNotebook.d.ts +19 -0
- package/lib/AgentNotebook.js +192 -0
- package/lib/agent-lexical-main.d.ts +1 -0
- package/lib/agent-lexical-main.js +11 -0
- package/lib/agent-main.d.ts +1 -0
- package/lib/agent-main.js +11 -0
- package/lib/agent-notebook-main.d.ts +1 -0
- package/lib/agent-notebook-main.js +12 -0
- package/lib/components/AgentConfiguration.d.ts +33 -21
- package/lib/components/AgentConfiguration.js +76 -21
- package/lib/components/chat/components/AgentDetails.d.ts +3 -1
- package/lib/components/chat/components/AgentDetails.js +164 -6
- package/lib/components/chat/components/Chat.d.ts +29 -3
- package/lib/components/chat/components/Chat.js +64 -59
- package/lib/components/chat/components/ChatFloating.d.ts +34 -12
- package/lib/components/chat/components/ChatFloating.js +54 -21
- package/lib/components/chat/components/ChatInline.d.ts +5 -1
- package/lib/components/chat/components/ChatInline.js +8 -1
- package/lib/components/chat/components/ChatSidebar.d.ts +6 -1
- package/lib/components/chat/components/ChatSidebar.js +2 -2
- package/lib/components/chat/components/ChatStandalone.d.ts +6 -1
- package/lib/components/chat/components/ChatStandalone.js +2 -2
- package/lib/components/chat/components/ContextDistribution.js +2 -2
- package/lib/components/chat/components/ContextInspector.js +4 -2
- package/lib/components/chat/components/ContextPanel.js +1 -6
- package/lib/components/chat/components/base/ChatBase.d.ts +49 -8
- package/lib/components/chat/components/base/ChatBase.js +544 -149
- package/lib/components/chat/components/base/InputPrompt.d.ts +42 -0
- package/lib/components/chat/components/base/InputPrompt.js +131 -0
- package/lib/components/chat/components/index.d.ts +3 -3
- package/lib/components/chat/components/index.js +1 -1
- package/lib/components/chat/components/parts/ReasoningPart.js +2 -4
- package/lib/components/chat/components/parts/TextPart.js +2 -70
- package/lib/components/chat/components/styles/streamdownStyles.d.ts +23 -0
- package/lib/components/chat/components/styles/streamdownStyles.js +319 -0
- package/lib/components/chat/index.d.ts +1 -1
- package/lib/components/chat/index.js +1 -1
- package/lib/components/chat/inference/DatalayerInferenceProvider.js +16 -12
- package/lib/components/chat/inference/SelfHostedInferenceProvider.js +16 -12
- package/lib/components/chat/protocols/AGUIAdapter.d.ts +10 -3
- package/lib/components/chat/protocols/AGUIAdapter.js +123 -44
- package/lib/components/chat/types/tool.d.ts +5 -2
- package/lib/components/index.d.ts +2 -19
- package/lib/components/index.js +1 -10
- package/lib/config/index.d.ts +0 -3
- package/lib/config/index.js +0 -3
- package/lib/examples/A2UiRestaurantExample.js +1 -1
- package/lib/examples/AgentRuntimeChatExample.d.ts +15 -0
- package/lib/examples/AgentRuntimeChatExample.js +126 -0
- package/lib/examples/{AgentSpaceFormExample.d.ts → AgentRuntimeFormExample.d.ts} +3 -3
- package/lib/examples/{AgentSpaceFormExample.js → AgentRuntimeFormExample.js} +61 -17
- package/lib/examples/AgentRuntimeLexicalExample.js +6 -3
- package/lib/examples/AgentRuntimeLexicalSidebarExample.js +8 -1
- package/lib/examples/AgentRuntimeNotebookExample.js +6 -5
- package/lib/examples/CopilotKitNotebookExample.js +2 -2
- package/lib/examples/JupyterNotebookExample.js +2 -2
- package/lib/{components → examples/components}/Header.d.ts +2 -1
- package/lib/{components → examples/components}/HeaderControls.js +1 -1
- package/lib/{components → examples/components}/LexicalEditor.d.ts +6 -1
- package/lib/{components → examples/components}/LexicalEditor.js +4 -4
- package/lib/{components → examples/components}/MainContent.d.ts +1 -1
- package/lib/{components → examples/components}/MainContent.js +7 -5
- package/lib/examples/components/index.d.ts +16 -0
- package/lib/examples/components/index.js +13 -0
- package/lib/examples/example-selector.js +2 -1
- package/lib/examples/index.d.ts +1 -1
- package/lib/examples/index.js +1 -1
- package/lib/examples/main.js +2 -2
- package/lib/examples/stores/examplesStore.d.ts +2 -23
- package/lib/index.d.ts +2 -1
- package/lib/index.js +1 -0
- package/lib/lexical/ChatInlinePlugin.d.ts +13 -2
- package/lib/lexical/ChatInlinePlugin.js +41 -179
- package/lib/lexical/index.d.ts +1 -0
- package/lib/lexical/index.js +1 -0
- package/lib/lexical/useChatInlineToolbarItems.d.ts +28 -0
- package/lib/lexical/useChatInlineToolbarItems.js +163 -0
- package/lib/runtime/useAgentRuntime.d.ts +1 -1
- package/lib/runtime/useAgentRuntime.js +1 -1
- package/lib/specs/agents/codeai/agents.d.ts +28 -0
- package/lib/specs/agents/codeai/agents.js +151 -0
- package/lib/specs/agents/codeai/index.d.ts +1 -0
- package/lib/specs/agents/codeai/index.js +5 -0
- package/lib/{config → specs/agents/codemode-paper}/agents.d.ts +4 -6
- package/lib/specs/agents/codemode-paper/agents.js +308 -0
- package/lib/specs/agents/codemode-paper/index.d.ts +1 -0
- package/lib/specs/agents/codemode-paper/index.js +5 -0
- package/lib/specs/agents/datalayer-ai/agents.d.ts +31 -0
- package/lib/{config → specs/agents/datalayer-ai}/agents.js +42 -184
- package/lib/specs/agents/datalayer-ai/index.d.ts +1 -0
- package/lib/specs/agents/datalayer-ai/index.js +5 -0
- package/lib/specs/agents/index.d.ts +21 -0
- package/lib/specs/agents/index.js +47 -0
- package/lib/specs/envvars.d.ts +29 -0
- package/lib/specs/envvars.js +125 -0
- package/lib/specs/index.d.ts +5 -0
- package/lib/specs/index.js +9 -0
- package/lib/{config → specs}/mcpServers.d.ts +2 -1
- package/lib/{config → specs}/mcpServers.js +47 -1
- package/lib/specs/models.d.ts +68 -0
- package/lib/specs/models.js +239 -0
- package/lib/{config → specs}/skills.d.ts +2 -0
- package/lib/{config → specs}/skills.js +6 -0
- package/lib/state/substates/AIAgentState.d.ts +0 -1
- package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.d.ts +11 -22
- package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.js +5 -5
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +6 -6
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +4 -4
- package/lib/tools/adapters/agent-runtimes/notebookHooks.d.ts +6 -6
- package/lib/tools/adapters/agent-runtimes/notebookHooks.js +4 -4
- package/lib/{types.d.ts → types/Types.d.ts} +42 -8
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +11 -5
- package/scripts/codegen/generate_agents.py +608 -157
- package/scripts/codegen/generate_envvars.py +302 -0
- package/scripts/codegen/generate_mcp_servers.py +33 -21
- package/scripts/codegen/generate_models.py +486 -0
- package/scripts/codegen/generate_skills.py +21 -8
- package/style/primer-primitives.css +22 -0
- package/lib/components/chat/components/elements/ChatInputPrompt.d.ts +0 -37
- package/lib/components/chat/components/elements/ChatInputPrompt.js +0 -150
- /package/lib/{components → examples/components}/FooterMetrics.d.ts +0 -0
- /package/lib/{components → examples/components}/FooterMetrics.js +0 -0
- /package/lib/{components → examples/components}/Header.js +0 -0
- /package/lib/{components → examples/components}/HeaderControls.d.ts +0 -0
- /package/lib/{components → examples/components}/MockFileBrowser.d.ts +0 -0
- /package/lib/{components → examples/components}/MockFileBrowser.js +0 -0
- /package/lib/{components → examples/components}/SessionTabs.d.ts +0 -0
- /package/lib/{components → examples/components}/SessionTabs.js +0 -0
- /package/lib/{components → examples/components}/TimeTravel.d.ts +0 -0
- /package/lib/{components → examples/components}/TimeTravel.js +0 -0
- /package/lib/{types.js → types/Types.js} +0 -0
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
5
5
|
* AgentDetails component - Shows detailed information about the agent
|
|
6
6
|
* including name, protocol, URL, message count, and context details.
|
|
7
7
|
*/
|
|
8
|
-
import { ArrowLeftIcon, CheckCircleIcon, XCircleIcon, CodeIcon,
|
|
8
|
+
import { ArrowLeftIcon, CheckCircleIcon, XCircleIcon, CodeIcon, BriefcaseIcon, DownloadIcon, NoteIcon, ServerIcon, } from '@primer/octicons-react';
|
|
9
9
|
import { Button, Heading, IconButton, Text, Label, Spinner, ToggleSwitch, } from '@primer/react';
|
|
10
10
|
import { Box } from '@datalayer/primer-addons';
|
|
11
11
|
import { AiAgentIcon } from '@datalayer/icons-react';
|
|
@@ -171,7 +171,7 @@ async function downloadContextSnapshotAsCSV(agentId, apiBase) {
|
|
|
171
171
|
/**
|
|
172
172
|
* AgentDetails component displays comprehensive information about the agent.
|
|
173
173
|
*/
|
|
174
|
-
export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, agentId, apiBase, identityProviders, onIdentityConnect, onIdentityDisconnect, onBack, }) {
|
|
174
|
+
export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, agentId, apiBase, identityProviders, onIdentityConnect, onIdentityDisconnect, onBack, showBackHeader = true, }) {
|
|
175
175
|
const queryClient = useQueryClient();
|
|
176
176
|
// Fetch MCP toolsets status
|
|
177
177
|
const { data: mcpStatus, isLoading: mcpLoading } = useQuery({
|
|
@@ -220,20 +220,33 @@ export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, a
|
|
|
220
220
|
queryClient.invalidateQueries({ queryKey: ['codemode-status'] });
|
|
221
221
|
},
|
|
222
222
|
});
|
|
223
|
+
// Fetch agent spec (original creation request with separated system prompts)
|
|
224
|
+
const { data: agentSpec, isLoading: specLoading } = useQuery({
|
|
225
|
+
queryKey: ['agent-spec', agentId, apiBase],
|
|
226
|
+
queryFn: async () => {
|
|
227
|
+
const base = getApiBase(apiBase);
|
|
228
|
+
const response = await fetch(`${base}/api/v1/configure/agents/${encodeURIComponent(agentId)}/spec`);
|
|
229
|
+
if (!response.ok) {
|
|
230
|
+
throw new Error('Failed to fetch agent spec');
|
|
231
|
+
}
|
|
232
|
+
return response.json();
|
|
233
|
+
},
|
|
234
|
+
enabled: !!agentId,
|
|
235
|
+
});
|
|
223
236
|
return (_jsxs(Box, { sx: {
|
|
224
237
|
display: 'flex',
|
|
225
238
|
flexDirection: 'column',
|
|
226
239
|
height: '100%',
|
|
227
240
|
bg: 'canvas.default',
|
|
228
241
|
overflow: 'auto',
|
|
229
|
-
}, children: [_jsxs(Box, { sx: {
|
|
242
|
+
}, children: [showBackHeader && (_jsxs(Box, { sx: {
|
|
230
243
|
display: 'flex',
|
|
231
244
|
alignItems: 'center',
|
|
232
245
|
gap: 2,
|
|
233
246
|
p: 3,
|
|
234
247
|
borderBottom: '1px solid',
|
|
235
248
|
borderColor: 'border.default',
|
|
236
|
-
}, children: [_jsx(IconButton, { icon: ArrowLeftIcon, "aria-label": "Back to chat", variant: "invisible", onClick: onBack }), _jsx(Heading, { as: "h2", sx: { fontSize: 3, fontWeight: 'semibold' }, children: "Agent Details" })] }), _jsxs(Box, { sx: { p: 3, display: 'flex', flexDirection: 'column', gap: 4 }, children: [_jsxs(Box, { sx: {
|
|
249
|
+
}, children: [_jsx(IconButton, { icon: ArrowLeftIcon, "aria-label": "Back to chat", variant: "invisible", onClick: onBack }), _jsx(Heading, { as: "h2", sx: { fontSize: 3, fontWeight: 'semibold' }, children: "Agent Details" })] })), _jsxs(Box, { sx: { p: 3, display: 'flex', flexDirection: 'column', gap: 4 }, children: [_jsxs(Box, { sx: {
|
|
237
250
|
display: 'flex',
|
|
238
251
|
alignItems: 'center',
|
|
239
252
|
gap: 3,
|
|
@@ -266,6 +279,151 @@ export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, a
|
|
|
266
279
|
fontWeight: 'semibold',
|
|
267
280
|
mb: 2,
|
|
268
281
|
color: 'fg.muted',
|
|
282
|
+
}, children: "Agent Spec" }), _jsx(Box, { sx: {
|
|
283
|
+
p: 3,
|
|
284
|
+
bg: 'canvas.subtle',
|
|
285
|
+
borderRadius: 2,
|
|
286
|
+
border: '1px solid',
|
|
287
|
+
borderColor: 'border.default',
|
|
288
|
+
}, children: specLoading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Loading agent spec..." })] })) : agentSpec ? (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3 }, children: [_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Model:" }), _jsx(Text, { sx: {
|
|
289
|
+
fontSize: 0,
|
|
290
|
+
fontFamily: 'mono',
|
|
291
|
+
color: 'fg.default',
|
|
292
|
+
}, children: agentSpec.model })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Library:" }), _jsx(Label, { variant: "secondary", size: "small", children: agentSpec.agent_library })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Codemode:" }), _jsx(Label, { variant: agentSpec.enable_codemode ? 'accent' : 'secondary', size: "small", children: agentSpec.enable_codemode ? 'Enabled' : 'Disabled' })] }), agentSpec.enable_skills && agentSpec.skills.length > 0 && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Skills:" }), _jsx(Box, { sx: { display: 'flex', gap: 1, flexWrap: 'wrap' }, children: agentSpec.skills.map(skill => (_jsx(Label, { variant: "secondary", size: "small", children: skill }, skill))) })] }))] }), _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(NoteIcon, { size: 16 }), _jsx(Text, { sx: {
|
|
293
|
+
fontSize: 0,
|
|
294
|
+
fontWeight: 'semibold',
|
|
295
|
+
color: 'fg.muted',
|
|
296
|
+
}, children: "System Prompt" })] }), _jsx(Box, { sx: {
|
|
297
|
+
p: 2,
|
|
298
|
+
bg: 'canvas.default',
|
|
299
|
+
borderRadius: 2,
|
|
300
|
+
border: '1px solid',
|
|
301
|
+
borderColor: 'border.default',
|
|
302
|
+
maxHeight: 200,
|
|
303
|
+
overflow: 'auto',
|
|
304
|
+
}, children: _jsx(Text, { sx: {
|
|
305
|
+
fontSize: 0,
|
|
306
|
+
fontFamily: 'mono',
|
|
307
|
+
whiteSpace: 'pre-wrap',
|
|
308
|
+
wordBreak: 'break-word',
|
|
309
|
+
color: 'fg.default',
|
|
310
|
+
}, children: agentSpec.system_prompt }) })] }), agentSpec.system_prompt_codemode_addons && (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(CodeIcon, { size: 16 }), _jsx(Text, { sx: {
|
|
311
|
+
fontSize: 0,
|
|
312
|
+
fontWeight: 'semibold',
|
|
313
|
+
color: 'fg.muted',
|
|
314
|
+
}, children: "Codemode Addon Prompt" }), agentSpec.enable_codemode ? (_jsx(Label, { variant: "accent", size: "small", children: "Active" })) : (_jsx(Label, { variant: "secondary", size: "small", children: "Inactive" }))] }), _jsx(Box, { sx: {
|
|
315
|
+
p: 2,
|
|
316
|
+
bg: 'canvas.default',
|
|
317
|
+
borderRadius: 2,
|
|
318
|
+
border: '1px solid',
|
|
319
|
+
borderColor: 'border.default',
|
|
320
|
+
maxHeight: 200,
|
|
321
|
+
overflow: 'auto',
|
|
322
|
+
}, children: _jsx(Text, { sx: {
|
|
323
|
+
fontSize: 0,
|
|
324
|
+
fontFamily: 'mono',
|
|
325
|
+
whiteSpace: 'pre-wrap',
|
|
326
|
+
wordBreak: 'break-word',
|
|
327
|
+
color: 'fg.default',
|
|
328
|
+
}, children: agentSpec.system_prompt_codemode_addons }) })] }))] })) : (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "No agent spec available" })) })] }), agentSpec?.sandbox && (_jsxs(Box, { children: [_jsx(Heading, { as: "h4", sx: {
|
|
329
|
+
fontSize: 1,
|
|
330
|
+
fontWeight: 'semibold',
|
|
331
|
+
mb: 2,
|
|
332
|
+
color: 'fg.muted',
|
|
333
|
+
}, children: "Code Sandbox" }), _jsx(Box, { sx: {
|
|
334
|
+
p: 3,
|
|
335
|
+
bg: 'canvas.subtle',
|
|
336
|
+
borderRadius: 2,
|
|
337
|
+
border: '1px solid',
|
|
338
|
+
borderColor: 'border.default',
|
|
339
|
+
}, children: _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(ServerIcon, { size: 16 }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100 }, children: "Variant:" }), _jsx(Label, { variant: agentSpec.sandbox.variant === 'local-jupyter'
|
|
340
|
+
? 'accent'
|
|
341
|
+
: 'secondary', size: "small", children: agentSpec.sandbox.variant })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 100, pl: 4 }, children: "Running:" }), agentSpec.sandbox.sandbox_running ? (_jsxs(Box, { sx: {
|
|
342
|
+
display: 'flex',
|
|
343
|
+
alignItems: 'center',
|
|
344
|
+
gap: 1,
|
|
345
|
+
}, children: [_jsx(CheckCircleIcon, { size: 12, fill: "success.fg" }), _jsx(Text, { sx: { fontSize: 0, color: 'success.fg' }, children: "Yes" })] })) : (_jsxs(Box, { sx: {
|
|
346
|
+
display: 'flex',
|
|
347
|
+
alignItems: 'center',
|
|
348
|
+
gap: 1,
|
|
349
|
+
}, children: [_jsx(XCircleIcon, { size: 12, fill: "fg.muted" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No" })] }))] }), agentSpec.sandbox.variant === 'local-jupyter' && (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
350
|
+
fontSize: 0,
|
|
351
|
+
color: 'fg.muted',
|
|
352
|
+
width: 100,
|
|
353
|
+
pl: 4,
|
|
354
|
+
}, children: "Jupyter URL:" }), _jsx(Text, { sx: {
|
|
355
|
+
fontSize: 0,
|
|
356
|
+
fontFamily: 'mono',
|
|
357
|
+
color: 'fg.default',
|
|
358
|
+
overflow: 'hidden',
|
|
359
|
+
textOverflow: 'ellipsis',
|
|
360
|
+
whiteSpace: 'nowrap',
|
|
361
|
+
}, children: agentSpec.jupyter_sandbox ||
|
|
362
|
+
agentSpec.sandbox.jupyter_url ||
|
|
363
|
+
'Not configured' })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
364
|
+
fontSize: 0,
|
|
365
|
+
color: 'fg.muted',
|
|
366
|
+
width: 100,
|
|
367
|
+
pl: 4,
|
|
368
|
+
}, children: "Connection:" }), agentSpec.sandbox.jupyter_connected ? (_jsxs(Box, { sx: {
|
|
369
|
+
display: 'flex',
|
|
370
|
+
alignItems: 'center',
|
|
371
|
+
gap: 1,
|
|
372
|
+
}, children: [_jsx(CheckCircleIcon, { size: 12, fill: "success.fg" }), _jsx(Text, { sx: { fontSize: 0, color: 'success.fg' }, children: "Connected" })] })) : (_jsxs(Box, { sx: {
|
|
373
|
+
display: 'flex',
|
|
374
|
+
flexDirection: 'column',
|
|
375
|
+
gap: 1,
|
|
376
|
+
}, children: [_jsxs(Box, { sx: {
|
|
377
|
+
display: 'flex',
|
|
378
|
+
alignItems: 'center',
|
|
379
|
+
gap: 1,
|
|
380
|
+
}, children: [_jsx(XCircleIcon, { size: 12, fill: "danger.fg" }), _jsx(Text, { sx: { fontSize: 0, color: 'danger.fg' }, children: "Not Connected" })] }), agentSpec.sandbox.jupyter_error && (_jsx(Text, { sx: {
|
|
381
|
+
fontSize: 0,
|
|
382
|
+
color: 'danger.fg',
|
|
383
|
+
fontFamily: 'mono',
|
|
384
|
+
whiteSpace: 'pre-wrap',
|
|
385
|
+
wordBreak: 'break-word',
|
|
386
|
+
}, children: agentSpec.sandbox.jupyter_error }))] }))] })] })), agentSpec.sandbox.generated_path && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
387
|
+
fontSize: 0,
|
|
388
|
+
color: 'fg.muted',
|
|
389
|
+
width: 100,
|
|
390
|
+
pl: 4,
|
|
391
|
+
}, children: "Generated:" }), _jsx(Text, { sx: {
|
|
392
|
+
fontSize: 0,
|
|
393
|
+
fontFamily: 'mono',
|
|
394
|
+
color: 'fg.default',
|
|
395
|
+
overflow: 'hidden',
|
|
396
|
+
textOverflow: 'ellipsis',
|
|
397
|
+
whiteSpace: 'nowrap',
|
|
398
|
+
}, title: agentSpec.sandbox.generated_path, children: agentSpec.sandbox.generated_path })] })), agentSpec.sandbox.skills_path && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
399
|
+
fontSize: 0,
|
|
400
|
+
color: 'fg.muted',
|
|
401
|
+
width: 100,
|
|
402
|
+
pl: 4,
|
|
403
|
+
}, children: "Skills:" }), _jsx(Text, { sx: {
|
|
404
|
+
fontSize: 0,
|
|
405
|
+
fontFamily: 'mono',
|
|
406
|
+
color: 'fg.default',
|
|
407
|
+
overflow: 'hidden',
|
|
408
|
+
textOverflow: 'ellipsis',
|
|
409
|
+
whiteSpace: 'nowrap',
|
|
410
|
+
}, title: agentSpec.sandbox.skills_path, children: agentSpec.sandbox.skills_path })] })), agentSpec.sandbox.python_path && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
411
|
+
fontSize: 0,
|
|
412
|
+
color: 'fg.muted',
|
|
413
|
+
width: 100,
|
|
414
|
+
pl: 4,
|
|
415
|
+
}, children: "Python:" }), _jsx(Text, { sx: {
|
|
416
|
+
fontSize: 0,
|
|
417
|
+
fontFamily: 'mono',
|
|
418
|
+
color: 'fg.default',
|
|
419
|
+
overflow: 'hidden',
|
|
420
|
+
textOverflow: 'ellipsis',
|
|
421
|
+
whiteSpace: 'nowrap',
|
|
422
|
+
}, title: agentSpec.sandbox.python_path, children: agentSpec.sandbox.python_path })] }))] }) })] })), _jsxs(Box, { children: [_jsx(Heading, { as: "h4", sx: {
|
|
423
|
+
fontSize: 1,
|
|
424
|
+
fontWeight: 'semibold',
|
|
425
|
+
mb: 2,
|
|
426
|
+
color: 'fg.muted',
|
|
269
427
|
}, children: "Config MCP Servers" }), _jsx(Box, { sx: {
|
|
270
428
|
p: 3,
|
|
271
429
|
bg: 'canvas.subtle',
|
|
@@ -399,7 +557,7 @@ export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, a
|
|
|
399
557
|
overflow: 'hidden',
|
|
400
558
|
textOverflow: 'ellipsis',
|
|
401
559
|
whiteSpace: 'nowrap',
|
|
402
|
-
}, title: codemodeStatus.sandbox.python_path, children: codemodeStatus.sandbox.python_path })] }))] })] })), codemodeStatus.skills.length > 0 && (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(
|
|
560
|
+
}, title: codemodeStatus.sandbox.python_path, children: codemodeStatus.sandbox.python_path })] }))] })] })), codemodeStatus.skills.length > 0 && (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(BriefcaseIcon, { size: 16 }), _jsxs(Text, { sx: {
|
|
403
561
|
fontSize: 0,
|
|
404
562
|
fontWeight: 'semibold',
|
|
405
563
|
color: 'fg.muted',
|
|
@@ -436,6 +594,6 @@ export function AgentDetails({ name = 'AI Agent', protocol, url, messageCount, a
|
|
|
436
594
|
borderRadius: 2,
|
|
437
595
|
border: '1px solid',
|
|
438
596
|
borderColor: 'border.default',
|
|
439
|
-
}, children: _jsx(ContextInspector, { agentId: agentId, apiBase: apiBase }) })] })), _jsx(AgentIdentity, { providers: identityProviders, title: "Connected Accounts", showHeader: true, showDescription: true, description: "OAuth identities connected to this agent. Agents can use these to access external services like GitHub repositories on your behalf.", showExpirationDetails: true, allowReconnect: Boolean(identityProviders), onConnect: onIdentityConnect, onDisconnect: onIdentityDisconnect }), _jsx(Box, { sx: { mt: 2 }, children: _jsx(Button, { variant: "primary", onClick: onBack, sx: { width: '100%' }, children: "Back to Chat" }) })] })] }));
|
|
597
|
+
}, children: _jsx(ContextInspector, { agentId: agentId, apiBase: apiBase }) })] })), _jsx(AgentIdentity, { providers: identityProviders, title: "Connected Accounts", showHeader: true, showDescription: true, description: "OAuth identities connected to this agent. Agents can use these to access external services like GitHub repositories on your behalf.", showExpirationDetails: true, allowReconnect: Boolean(identityProviders), onConnect: onIdentityConnect, onDisconnect: onIdentityDisconnect }), showBackHeader && (_jsx(Box, { sx: { mt: 2 }, children: _jsx(Button, { variant: "primary", onClick: onBack, sx: { width: '100%' }, children: "Back to Chat" }) }))] })] }));
|
|
440
598
|
}
|
|
441
599
|
export default AgentDetails;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Suggestion } from './base/ChatBase';
|
|
2
|
-
import type { ModelConfig } from './base/ChatBase';
|
|
2
|
+
import type { ModelConfig, ChatViewMode } from './base/ChatBase';
|
|
3
|
+
import type { FrontendToolDefinition } from '../types/tool';
|
|
3
4
|
import type { McpServerSelection } from '../types';
|
|
4
5
|
import type { OAuthProvider, OAuthProviderConfig, Identity } from '../../../identity';
|
|
5
6
|
/**
|
|
@@ -105,9 +106,14 @@ export interface ChatProps {
|
|
|
105
106
|
* Endpoint URL for fetching conversation history.
|
|
106
107
|
* When runtimeId is provided, this endpoint is called to fetch
|
|
107
108
|
* the conversation history on mount.
|
|
108
|
-
* If not provided, defaults to `{protocol.endpoint}/history`.
|
|
109
|
+
* If not provided, defaults to `{protocol.endpoint}/api/v1/history`.
|
|
109
110
|
*/
|
|
110
111
|
historyEndpoint?: string;
|
|
112
|
+
/**
|
|
113
|
+
* A prompt to append and send after the conversation history is loaded.
|
|
114
|
+
* The message is shown in the chat and sent to the agent exactly once.
|
|
115
|
+
*/
|
|
116
|
+
pendingPrompt?: string;
|
|
111
117
|
/**
|
|
112
118
|
* Error banner to display at the top of the chat.
|
|
113
119
|
* Use this to show sandbox connection errors or other warnings.
|
|
@@ -116,6 +122,26 @@ export interface ChatProps {
|
|
|
116
122
|
message: string;
|
|
117
123
|
variant?: 'danger' | 'warning';
|
|
118
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* Show the information icon in the header.
|
|
127
|
+
* When clicked, it opens the agent details panel.
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
showInformation?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Current chat view mode for the header segmented toggle.
|
|
133
|
+
* When provided, a view-mode toggle is rendered in the header.
|
|
134
|
+
*/
|
|
135
|
+
chatViewMode?: ChatViewMode;
|
|
136
|
+
/**
|
|
137
|
+
* Callback when the user switches chat view mode via the header toggle.
|
|
138
|
+
*/
|
|
139
|
+
onChatViewModeChange?: (mode: ChatViewMode) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Frontend tool definitions to register with the chat.
|
|
142
|
+
* Pass an empty array to explicitly disable all frontend tools.
|
|
143
|
+
*/
|
|
144
|
+
frontendTools?: FrontendToolDefinition[];
|
|
119
145
|
}
|
|
120
146
|
/**
|
|
121
147
|
* Chat Component
|
|
@@ -158,5 +184,5 @@ export interface ChatProps {
|
|
|
158
184
|
* />
|
|
159
185
|
* ```
|
|
160
186
|
*/
|
|
161
|
-
export declare function Chat({ transport, extensions: _extensions, baseUrl, wsUrl, agentId, placeholder, title, autoConnect: _autoConnect, streaming: _streaming, onMessageSent: _onMessageSent, onMessageReceived: _onMessageReceived, onDisconnect, onLogout: _onLogout, onCollapsePanel: _onCollapsePanel, className, height, showHeader, showModelSelector, showToolsMenu, showSkillsMenu, codemodeEnabled, showTokenUsage, initialModel, availableModels, mcpServers, initialSkills, clearOnMount: _clearOnMount, suggestions, submitOnSuggestionClick, description, autoFocus, identityProviders, onIdentityConnect, onIdentityDisconnect, runtimeId, historyEndpoint, errorBanner, }: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
187
|
+
export declare function Chat({ transport, extensions: _extensions, baseUrl, wsUrl, agentId, placeholder, title, autoConnect: _autoConnect, streaming: _streaming, onMessageSent: _onMessageSent, onMessageReceived: _onMessageReceived, onDisconnect, onLogout: _onLogout, onCollapsePanel: _onCollapsePanel, className, height, showHeader, showModelSelector, showToolsMenu, showSkillsMenu, codemodeEnabled, showTokenUsage, initialModel, availableModels, mcpServers, initialSkills, clearOnMount: _clearOnMount, suggestions, submitOnSuggestionClick, description, autoFocus, identityProviders, onIdentityConnect, onIdentityDisconnect, runtimeId, historyEndpoint, pendingPrompt, errorBanner, showInformation, chatViewMode, onChatViewModeChange, frontendTools, }: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
162
188
|
export default Chat;
|
|
@@ -19,8 +19,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
* @module components/chat/components/Chat
|
|
20
20
|
*/
|
|
21
21
|
import { useEffect, useMemo, useState } from 'react';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
22
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
23
|
+
import { Text, Button, Spinner } from '@primer/react';
|
|
24
|
+
import { AlertIcon, SyncIcon } from '@primer/octicons-react';
|
|
24
25
|
import { Box } from '@datalayer/primer-addons';
|
|
25
26
|
import { ChatBase } from './base/ChatBase';
|
|
26
27
|
import { AgentDetails } from './AgentDetails';
|
|
@@ -56,6 +57,8 @@ catch {
|
|
|
56
57
|
// No Jupyter config available
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
// Shared QueryClient for AgentDetails and ChatBase
|
|
61
|
+
const queryClient = new QueryClient();
|
|
59
62
|
/**
|
|
60
63
|
* Get transport endpoint path
|
|
61
64
|
*/
|
|
@@ -130,7 +133,7 @@ function getProtocolType(transport) {
|
|
|
130
133
|
* />
|
|
131
134
|
* ```
|
|
132
135
|
*/
|
|
133
|
-
export function Chat({ transport, extensions: _extensions, baseUrl = 'http://localhost:8765', wsUrl, agentId, placeholder = 'Type your message...', title, autoConnect: _autoConnect = true, streaming: _streaming = true, onMessageSent: _onMessageSent, onMessageReceived: _onMessageReceived, onDisconnect, onLogout: _onLogout, onCollapsePanel: _onCollapsePanel, className, height = '600px', showHeader = true, showModelSelector = true, showToolsMenu = true, showSkillsMenu = false, codemodeEnabled = false, showTokenUsage = true, initialModel, availableModels, mcpServers, initialSkills, clearOnMount: _clearOnMount = true, suggestions, submitOnSuggestionClick = true, description, autoFocus = false, identityProviders, onIdentityConnect, onIdentityDisconnect, runtimeId, historyEndpoint, errorBanner, }) {
|
|
136
|
+
export function Chat({ transport, extensions: _extensions, baseUrl = 'http://localhost:8765', wsUrl, agentId, placeholder = 'Type your message...', title, autoConnect: _autoConnect = true, streaming: _streaming = true, onMessageSent: _onMessageSent, onMessageReceived: _onMessageReceived, onDisconnect, onLogout: _onLogout, onCollapsePanel: _onCollapsePanel, className, height = '600px', showHeader = true, showModelSelector = true, showToolsMenu = true, showSkillsMenu = false, codemodeEnabled = false, showTokenUsage = true, initialModel, availableModels, mcpServers, initialSkills, clearOnMount: _clearOnMount = true, suggestions, submitOnSuggestionClick = true, description, autoFocus = false, identityProviders, onIdentityConnect, onIdentityDisconnect, runtimeId, historyEndpoint, pendingPrompt, errorBanner, showInformation = true, chatViewMode, onChatViewModeChange, frontendTools, }) {
|
|
134
137
|
const [error, setError] = useState(null);
|
|
135
138
|
const [isInitializing, setIsInitializing] = useState(true);
|
|
136
139
|
const [showDetails, setShowDetails] = useState(false);
|
|
@@ -250,67 +253,69 @@ export function Chat({ transport, extensions: _extensions, baseUrl = 'http://loc
|
|
|
250
253
|
};
|
|
251
254
|
// Render error state
|
|
252
255
|
if (error) {
|
|
253
|
-
return (_jsxs(Box, { className: className, sx: {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
256
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Box, { className: className, sx: {
|
|
257
|
+
display: 'flex',
|
|
258
|
+
flexDirection: 'column',
|
|
259
|
+
alignItems: 'center',
|
|
260
|
+
justifyContent: 'center',
|
|
261
|
+
height,
|
|
262
|
+
p: 4,
|
|
263
|
+
bg: 'canvas.default',
|
|
264
|
+
}, children: [_jsx(AlertIcon, { size: 48 }), _jsx(Text, { sx: { mt: 3, color: 'danger.fg', fontSize: 2 }, children: "Connection Error" }), _jsx(Text, { sx: { mt: 1, color: 'fg.muted', fontSize: 1 }, children: error }), _jsx(Button, { variant: "primary", sx: { mt: 3 }, leadingVisual: SyncIcon, onClick: handleReconnect, children: "Retry" })] }) }));
|
|
262
265
|
}
|
|
263
266
|
// Render loading state
|
|
264
267
|
if (isInitializing || !protocolConfig) {
|
|
265
|
-
return (_jsxs(Box, { className: className, sx: {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Box, { className: className, sx: {
|
|
269
|
+
display: 'flex',
|
|
270
|
+
flexDirection: 'column',
|
|
271
|
+
alignItems: 'center',
|
|
272
|
+
justifyContent: 'center',
|
|
273
|
+
height,
|
|
274
|
+
p: 4,
|
|
275
|
+
bg: 'canvas.default',
|
|
276
|
+
}, children: [_jsx(Spinner, { size: "large" }), _jsxs(Text, { sx: { mt: 3, color: 'fg.muted' }, children: ["Connecting to ", transport.toUpperCase().replace('-', ' '), " agent..."] })] }) }));
|
|
277
|
+
}
|
|
278
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Box, { className: className, sx: {
|
|
279
|
+
position: 'relative',
|
|
270
280
|
height,
|
|
271
|
-
p: 4,
|
|
272
281
|
bg: 'canvas.default',
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
: 'danger.subtle',
|
|
298
|
-
borderBottom: '1px solid',
|
|
299
|
-
borderColor: errorBanner.variant === 'warning'
|
|
300
|
-
? 'attention.muted'
|
|
301
|
-
: 'danger.muted',
|
|
302
|
-
}, children: [_jsx(AlertIcon, { size: 16, fill: errorBanner.variant === 'warning' ? 'attention.fg' : 'danger.fg' }), _jsx(Text, { sx: {
|
|
303
|
-
fontSize: 1,
|
|
304
|
-
color: errorBanner.variant === 'warning'
|
|
282
|
+
display: 'flex',
|
|
283
|
+
flexDirection: 'column',
|
|
284
|
+
}, children: [_jsx(Box, { sx: {
|
|
285
|
+
display: showDetails ? 'flex' : 'none',
|
|
286
|
+
flexDirection: 'column',
|
|
287
|
+
height: '100%',
|
|
288
|
+
}, children: _jsx(AgentDetails, { name: title || 'AI Agent', protocol: transport, url: protocolConfig?.endpoint || baseUrl, messageCount: messageCount, agentId: agentId, apiBase: baseUrl, identityProviders: identityProviders, onIdentityConnect: onIdentityConnect, onIdentityDisconnect: onIdentityDisconnect, onBack: () => setShowDetails(false) }) }), _jsxs(Box, { sx: {
|
|
289
|
+
display: showDetails ? 'none' : 'flex',
|
|
290
|
+
flexDirection: 'column',
|
|
291
|
+
height: '100%',
|
|
292
|
+
}, children: [errorBanner && (_jsxs(Box, { sx: {
|
|
293
|
+
display: 'flex',
|
|
294
|
+
alignItems: 'center',
|
|
295
|
+
gap: 2,
|
|
296
|
+
px: 3,
|
|
297
|
+
py: 2,
|
|
298
|
+
bg: errorBanner.variant === 'warning'
|
|
299
|
+
? 'attention.subtle'
|
|
300
|
+
: 'danger.subtle',
|
|
301
|
+
borderBottom: '1px solid',
|
|
302
|
+
borderColor: errorBanner.variant === 'warning'
|
|
303
|
+
? 'attention.muted'
|
|
304
|
+
: 'danger.muted',
|
|
305
|
+
}, children: [_jsx(AlertIcon, { size: 16, fill: errorBanner.variant === 'warning'
|
|
305
306
|
? 'attention.fg'
|
|
306
|
-
: 'danger.fg',
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
307
|
+
: 'danger.fg' }), _jsx(Text, { sx: {
|
|
308
|
+
fontSize: 1,
|
|
309
|
+
color: errorBanner.variant === 'warning'
|
|
310
|
+
? 'attention.fg'
|
|
311
|
+
: 'danger.fg',
|
|
312
|
+
flex: 1,
|
|
313
|
+
}, children: errorBanner.message })] })), _jsx(ChatBase, { title: title, showHeader: showHeader, protocol: protocolConfig, placeholder: placeholder, description: description, suggestions: suggestions, submitOnSuggestionClick: submitOnSuggestionClick, autoFocus: autoFocus, runtimeId: runtimeId, historyEndpoint: historyEndpoint, pendingPrompt: pendingPrompt, showInformation: showInformation, onInformationClick: () => setShowDetails(true), showModelSelector: showModelSelector, showToolsMenu: showToolsMenu, showSkillsMenu: showSkillsMenu, showTokenUsage: showTokenUsage, codemodeEnabled: codemodeEnabled, initialModel: initialModel, availableModels: availableModels, mcpServers: mcpServers, initialSkills: initialSkills, connectedIdentities: identitiesForChat, onNewChat: handleNewChat, onMessagesChange: messages => setMessageCount(messages.length), headerButtons: {
|
|
314
|
+
showNewChat: true,
|
|
315
|
+
showClear: true,
|
|
316
|
+
onNewChat: handleNewChat,
|
|
317
|
+
}, avatarConfig: {
|
|
318
|
+
showAvatars: true,
|
|
319
|
+
}, backgroundColor: "canvas.default", focusTrigger: focusTrigger, chatViewMode: chatViewMode, onChatViewModeChange: onChatViewModeChange, frontendTools: frontendTools })] })] }) }));
|
|
315
320
|
}
|
|
316
321
|
export default Chat;
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
* @module components/chat/components/ChatFloating
|
|
13
13
|
*/
|
|
14
14
|
import React from 'react';
|
|
15
|
-
import { type ChatBaseProps, type RenderToolResult, type ToolCallRenderContext, type ToolCallStatus, type ProtocolConfig, type RespondCallback, type Suggestion, type RemoteConfig, type ModelConfig, type BuiltinTool, type MCPServerConfig, type MCPServerTool } from './base/ChatBase';
|
|
15
|
+
import { type ChatBaseProps, type RenderToolResult, type ToolCallRenderContext, type ToolCallStatus, type ProtocolConfig, type RespondCallback, type Suggestion, type RemoteConfig, type ModelConfig, type BuiltinTool, type MCPServerConfig, type MCPServerTool, type ChatViewMode } from './base/ChatBase';
|
|
16
16
|
import type { PoweredByTagProps } from './elements/PoweredByTag';
|
|
17
|
-
|
|
17
|
+
import type { FrontendToolDefinition } from '../types/tool';
|
|
18
|
+
export type { ToolCallStatus, ToolCallRenderContext, RenderToolResult, RespondCallback, Suggestion, RemoteConfig, ModelConfig, BuiltinTool, MCPServerConfig, MCPServerTool, ChatViewMode, };
|
|
18
19
|
/**
|
|
19
20
|
* ChatFloating props
|
|
20
21
|
*/
|
|
@@ -100,13 +101,11 @@ export interface ChatFloatingProps {
|
|
|
100
101
|
* using this function instead of being hidden.
|
|
101
102
|
*/
|
|
102
103
|
renderToolResult?: RenderToolResult;
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
handler: (args: unknown) => Promise<unknown>;
|
|
109
|
-
}>;
|
|
104
|
+
/**
|
|
105
|
+
* Frontend tool definitions to register with the chat.
|
|
106
|
+
* Consistent with Chat and ChatBase.
|
|
107
|
+
*/
|
|
108
|
+
frontendTools?: FrontendToolDefinition[];
|
|
110
109
|
/** Initial state (for shared state example) */
|
|
111
110
|
initialState?: Record<string, unknown>;
|
|
112
111
|
/**
|
|
@@ -126,9 +125,19 @@ export interface ChatFloatingProps {
|
|
|
126
125
|
hideMessagesAfterToolUI?: boolean;
|
|
127
126
|
/**
|
|
128
127
|
* Default view mode.
|
|
128
|
+
* - 'floating': Full-height floating panel (pinned to right edge with offset)
|
|
129
|
+
* - 'floating-small': Standard floating popup
|
|
130
|
+
* - 'panel': Full-height side panel (right edge, no floating offset)
|
|
129
131
|
* @default 'floating'
|
|
130
132
|
*/
|
|
131
|
-
defaultViewMode?: 'floating' | 'panel';
|
|
133
|
+
defaultViewMode?: 'floating' | 'floating-small' | 'panel';
|
|
134
|
+
/**
|
|
135
|
+
* Callback when the user switches view mode via the header toggle.
|
|
136
|
+
* The parent component receives the new ChatViewMode value.
|
|
137
|
+
* When the user selects 'sidebar', the parent should switch to rendering
|
|
138
|
+
* a ChatSidebar instead.
|
|
139
|
+
*/
|
|
140
|
+
onViewModeChange?: (mode: ChatViewMode) => void;
|
|
132
141
|
/**
|
|
133
142
|
* Show backdrop overlay in panel mode.
|
|
134
143
|
* When true, a semi-transparent overlay covers the page behind the panel.
|
|
@@ -168,13 +177,26 @@ export interface ChatFloatingProps {
|
|
|
168
177
|
runtimeId?: string;
|
|
169
178
|
/**
|
|
170
179
|
* Endpoint URL for fetching conversation history.
|
|
171
|
-
* Defaults to `{protocol.endpoint}/history` when runtimeId is set.
|
|
180
|
+
* Defaults to `{protocol.endpoint}/api/v1/history` when runtimeId is set.
|
|
172
181
|
*/
|
|
173
182
|
historyEndpoint?: string;
|
|
174
183
|
/**
|
|
175
184
|
* Auth token for the history endpoint.
|
|
176
185
|
*/
|
|
177
186
|
historyAuthToken?: string;
|
|
187
|
+
/**
|
|
188
|
+
* A prompt to append and send after the conversation history is loaded.
|
|
189
|
+
* The message is shown in the chat and sent to the agent exactly once.
|
|
190
|
+
*/
|
|
191
|
+
pendingPrompt?: string;
|
|
192
|
+
/**
|
|
193
|
+
* Show the information icon in the header.
|
|
194
|
+
* When clicked, fires onInformationClick.
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
showInformation?: boolean;
|
|
198
|
+
/** Callback when the information icon is clicked */
|
|
199
|
+
onInformationClick?: () => void;
|
|
178
200
|
/** Additional ChatBase props */
|
|
179
201
|
panelProps?: Partial<ChatBaseProps>;
|
|
180
202
|
}
|
|
@@ -182,5 +204,5 @@ export interface ChatFloatingProps {
|
|
|
182
204
|
* ChatFloating component
|
|
183
205
|
* A floating chat window built on ChatBase
|
|
184
206
|
*/
|
|
185
|
-
export declare function ChatFloating({ endpoint, protocol: protocolProp, useStore: useStoreMode, title, description, position, defaultOpen, width, height, showHeader, showButton, showNewChatButton, showClearButton, showSettingsButton, enableKeyboardShortcuts, toggleShortcut, showPoweredBy, poweredByProps, clickOutsideToClose, escapeToClose, className, onSettingsClick, onNewChat, onOpen, onClose, onStateUpdate, children, brandIcon, buttonIcon, buttonTooltip, brandColor, offset, animationDuration, renderToolResult,
|
|
207
|
+
export declare function ChatFloating({ endpoint, protocol: protocolProp, useStore: useStoreMode, title, description, position, defaultOpen, width, height, showHeader, showButton, showNewChatButton, showClearButton, showSettingsButton, enableKeyboardShortcuts, toggleShortcut, showPoweredBy, poweredByProps, clickOutsideToClose, escapeToClose, className, onSettingsClick, onNewChat, onOpen, onClose, onStateUpdate, children, brandIcon, buttonIcon, buttonTooltip, brandColor, offset, animationDuration, renderToolResult, frontendTools, initialState: _initialState, suggestions, submitOnSuggestionClick, hideMessagesAfterToolUI, defaultViewMode, onViewModeChange, showPanelBackdrop, availableModels, showModelSelector, showToolsMenu, showSkillsMenu, showTokenUsage, runtimeId, historyEndpoint, historyAuthToken, pendingPrompt, showInformation, onInformationClick, panelProps, }: ChatFloatingProps): import("react/jsx-runtime").JSX.Element;
|
|
186
208
|
export default ChatFloating;
|