@datalayer/agent-runtimes 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/lib/App.js +1 -1
- package/lib/agents/AgentDetails.d.ts +22 -1
- package/lib/agents/AgentDetails.js +34 -47
- package/lib/api/index.d.ts +0 -1
- package/lib/api/index.js +4 -2
- package/lib/chat/Chat.d.ts +5 -106
- package/lib/chat/Chat.js +4 -4
- package/lib/chat/ChatFloating.d.ts +7 -140
- package/lib/chat/ChatFloating.js +2 -2
- package/lib/chat/ChatPopupStandalone.d.ts +8 -47
- package/lib/chat/ChatPopupStandalone.js +3 -3
- package/lib/chat/ChatSidebar.d.ts +4 -69
- package/lib/chat/ChatSidebar.js +2 -2
- package/lib/chat/ChatStandalone.d.ts +4 -54
- package/lib/chat/ChatStandalone.js +3 -3
- package/lib/chat/base/ChatBase.js +1083 -157
- package/lib/chat/header/ChatHeaderBase.d.ts +11 -6
- package/lib/chat/header/ChatHeaderBase.js +18 -16
- package/lib/chat/indicators/McpStatusIndicator.d.ts +7 -4
- package/lib/chat/indicators/McpStatusIndicator.js +7 -32
- package/lib/chat/indicators/SandboxStatusIndicator.d.ts +4 -1
- package/lib/chat/indicators/SandboxStatusIndicator.js +9 -9
- package/lib/chat/indicators/SkillsStatusIndicator.d.ts +7 -0
- package/lib/chat/indicators/SkillsStatusIndicator.js +88 -0
- package/lib/chat/indicators/index.d.ts +1 -0
- package/lib/chat/indicators/index.js +1 -0
- package/lib/chat/messages/ChatMessageList.d.ts +1 -1
- package/lib/chat/messages/ChatMessageList.js +108 -113
- package/lib/chat/prompt/InputFooter.d.ts +19 -6
- package/lib/chat/prompt/InputFooter.js +71 -18
- package/lib/chat/prompt/InputPrompt.d.ts +3 -1
- package/lib/chat/prompt/InputPrompt.js +4 -4
- package/lib/chat/prompt/InputPromptFooter.js +1 -1
- package/lib/chat/prompt/InputPromptLexical.d.ts +3 -1
- package/lib/chat/prompt/InputPromptLexical.js +12 -5
- package/lib/chat/prompt/InputPromptText.d.ts +3 -1
- package/lib/chat/prompt/InputPromptText.js +2 -2
- package/lib/chat/tools/ToolApprovalBanner.js +1 -1
- package/lib/chat/tools/ToolCallDisplay.d.ts +3 -1
- package/lib/chat/tools/ToolCallDisplay.js +2 -2
- package/lib/chat/usage/TokenUsageBar.js +20 -2
- package/lib/client/AgentRuntimesClientContext.d.ts +53 -0
- package/lib/client/AgentRuntimesClientContext.js +55 -0
- package/lib/client/AgentsMixin.d.ts +0 -18
- package/lib/client/AgentsMixin.js +6 -30
- package/lib/client/IAgentRuntimesClient.d.ts +215 -0
- package/lib/client/IAgentRuntimesClient.js +5 -0
- package/lib/client/SdkAgentRuntimesClient.d.ts +151 -0
- package/lib/client/SdkAgentRuntimesClient.js +134 -0
- package/lib/client/index.d.ts +4 -1
- package/lib/client/index.js +3 -1
- package/lib/components/NotificationEventCard.js +5 -1
- package/lib/config/AgentConfiguration.js +3 -3
- package/lib/context/ContextDistribution.d.ts +3 -1
- package/lib/context/ContextDistribution.js +8 -27
- package/lib/context/ContextInspector.d.ts +3 -1
- package/lib/context/ContextInspector.js +19 -67
- package/lib/context/ContextPanel.d.ts +3 -1
- package/lib/context/ContextPanel.js +104 -64
- package/lib/context/ContextUsage.d.ts +3 -1
- package/lib/context/ContextUsage.js +3 -3
- package/lib/context/CostTracker.d.ts +9 -3
- package/lib/context/CostTracker.js +26 -47
- package/lib/context/CostUsageChart.d.ts +12 -0
- package/lib/context/CostUsageChart.js +378 -0
- package/lib/context/GraphFlowChart.d.ts +16 -0
- package/lib/context/GraphFlowChart.js +182 -0
- package/lib/context/TokenUsageChart.d.ts +8 -1
- package/lib/context/TokenUsageChart.js +349 -211
- package/lib/context/TurnGraphChart.d.ts +39 -0
- package/lib/context/TurnGraphChart.js +538 -0
- package/lib/context/otelWsPool.d.ts +20 -0
- package/lib/context/otelWsPool.js +69 -0
- package/lib/examples/A2UiComponentGalleryExample.d.ts +0 -17
- package/lib/examples/A2UiComponentGalleryExample.js +315 -522
- package/lib/examples/A2UiContactCardExample.d.ts +0 -18
- package/lib/examples/A2UiContactCardExample.js +154 -411
- package/lib/examples/A2UiRestaurantExample.d.ts +0 -30
- package/lib/examples/A2UiRestaurantExample.js +114 -212
- package/lib/examples/A2UiViewerExample.d.ts +0 -18
- package/lib/examples/A2UiViewerExample.js +283 -532
- package/lib/examples/AgUiBackendToolRenderingExample.js +1 -1
- package/lib/examples/AgUiHaikuGenUiExample.d.ts +1 -1
- package/lib/examples/AgUiHaikuGenUiExample.js +1 -1
- package/lib/examples/AgentCheckpointsExample.js +13 -27
- package/lib/examples/AgentCodemodeExample.d.ts +4 -6
- package/lib/examples/AgentCodemodeExample.js +591 -169
- package/lib/examples/AgentEvalsExample.js +12 -16
- package/lib/examples/AgentGuardrailsExample.js +370 -64
- package/lib/examples/AgentHooksExample.d.ts +3 -0
- package/lib/examples/AgentHooksExample.js +104 -0
- package/lib/examples/AgentMCPExample.d.ts +3 -0
- package/lib/examples/AgentMCPExample.js +480 -0
- package/lib/examples/AgentMemoryExample.js +13 -17
- package/lib/examples/AgentMonitoringExample.js +260 -199
- package/lib/examples/AgentNotificationsExample.js +49 -17
- package/lib/examples/AgentOtelExample.js +2 -3
- package/lib/examples/AgentOutputsExample.d.ts +11 -6
- package/lib/examples/AgentOutputsExample.js +382 -81
- package/lib/examples/AgentParametersExample.d.ts +3 -0
- package/lib/examples/AgentParametersExample.js +246 -0
- package/lib/examples/AgentSandboxExample.d.ts +2 -2
- package/lib/examples/AgentSandboxExample.js +68 -40
- package/lib/examples/AgentSkillsExample.js +91 -99
- package/lib/examples/{AgentspecExample.js → AgentSpecsExample.js} +10 -21
- package/lib/examples/AgentSubagentsExample.d.ts +14 -0
- package/lib/examples/AgentSubagentsExample.js +228 -0
- package/lib/examples/AgentToolApprovalsExample.js +29 -557
- package/lib/examples/AgentTriggersExample.js +819 -565
- package/lib/examples/ChatCustomExample.js +11 -24
- package/lib/examples/ChatExample.js +7 -24
- package/lib/examples/CopilotKitLexicalExample.js +2 -1
- package/lib/examples/CopilotKitNotebookExample.js +2 -1
- package/lib/examples/HomeExample.d.ts +15 -0
- package/lib/examples/HomeExample.js +77 -0
- package/lib/examples/Lexical2Example.js +4 -2
- package/lib/examples/{LexicalExample.d.ts → LexicalAgentExample.d.ts} +4 -4
- package/lib/examples/{LexicalExample.js → LexicalAgentExample.js} +65 -16
- package/lib/examples/{LexicalSidebarExample.d.ts → LexicalAgentSidebarExample.d.ts} +5 -5
- package/lib/examples/LexicalAgentSidebarExample.js +261 -0
- package/lib/examples/NotebookAgentExample.d.ts +9 -0
- package/lib/examples/NotebookAgentExample.js +192 -0
- package/lib/examples/{NotebookSidebarExample.d.ts → NotebookAgentSidebarExample.d.ts} +2 -2
- package/lib/examples/NotebookAgentSidebarExample.js +221 -0
- package/lib/examples/{DatalayerNotebookExample.d.ts → NotebookCollaborationExample.d.ts} +4 -4
- package/lib/examples/{DatalayerNotebookExample.js → NotebookCollaborationExample.js} +3 -3
- package/lib/examples/NotebookExample.d.ts +4 -7
- package/lib/examples/NotebookExample.js +14 -146
- package/lib/examples/components/AuthRequiredView.d.ts +6 -0
- package/lib/examples/components/AuthRequiredView.js +33 -0
- package/lib/examples/components/ExampleWrapper.d.ts +7 -0
- package/lib/examples/components/ExampleWrapper.js +25 -6
- package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.js +1 -1
- package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.js +1 -1
- package/lib/examples/{ag-ui → components}/haiku/index.d.ts +1 -1
- package/lib/examples/{ag-ui → components}/haiku/index.js +1 -1
- package/lib/examples/components/index.d.ts +3 -0
- package/lib/examples/components/index.js +4 -0
- package/lib/examples/{ag-ui → components}/weather/index.d.ts +1 -1
- package/lib/examples/{ag-ui → components}/weather/index.js +1 -1
- package/lib/examples/example-selector.d.ts +17 -4
- package/lib/examples/example-selector.js +107 -41
- package/lib/examples/index.d.ts +9 -6
- package/lib/examples/index.js +9 -6
- package/lib/examples/main.js +217 -27
- package/lib/examples/utils/a2ui.d.ts +18 -0
- package/lib/examples/utils/a2ui.js +69 -0
- package/lib/examples/utils/a2uiMarkdownProvider.d.ts +7 -0
- package/lib/examples/utils/a2uiMarkdownProvider.js +9 -0
- package/lib/examples/utils/agentId.d.ts +18 -0
- package/lib/examples/utils/agentId.js +54 -0
- package/lib/examples/utils/agents/earthquake-detector.json +11 -11
- package/lib/examples/utils/agents/sales-forecaster.json +11 -11
- package/lib/examples/utils/agents/social-post-generator.json +11 -11
- package/lib/examples/utils/agents/stock-market.json +11 -11
- package/lib/examples/utils/examplesStore.js +82 -27
- package/lib/hooks/index.d.ts +8 -8
- package/lib/hooks/index.js +7 -7
- package/lib/hooks/useA2A.d.ts +2 -3
- package/lib/hooks/useAIAgentsWebSocket.d.ts +43 -4
- package/lib/hooks/useAIAgentsWebSocket.js +118 -12
- package/lib/hooks/useAcp.d.ts +1 -2
- package/lib/hooks/useAgUi.d.ts +1 -1
- package/lib/hooks/{useAgents.d.ts → useAgentRuntimes.d.ts} +39 -2
- package/lib/hooks/{useAgents.js → useAgentRuntimes.js} +125 -15
- package/lib/hooks/useAgentsCatalog.js +1 -1
- package/lib/hooks/useAgentsService.d.ts +2 -2
- package/lib/hooks/useAgentsService.js +7 -7
- package/lib/hooks/useCheckpoints.js +1 -1
- package/lib/hooks/useConfig.d.ts +4 -1
- package/lib/hooks/useConfig.js +10 -3
- package/lib/hooks/useContextSnapshot.d.ts +9 -4
- package/lib/hooks/useContextSnapshot.js +9 -37
- package/lib/hooks/useMonitoring.js +3 -0
- package/lib/hooks/useSandbox.d.ts +20 -8
- package/lib/hooks/useSandbox.js +105 -40
- package/lib/hooks/useSkills.d.ts +23 -5
- package/lib/hooks/useSkills.js +94 -39
- package/lib/hooks/useToolApprovals.d.ts +60 -36
- package/lib/hooks/useToolApprovals.js +318 -69
- package/lib/hooks/useVercelAI.d.ts +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +1 -0
- package/lib/inference/index.d.ts +0 -1
- package/lib/middleware/index.d.ts +0 -1
- package/lib/protocols/AGUIAdapter.js +6 -0
- package/lib/protocols/VercelAIAdapter.d.ts +7 -0
- package/lib/protocols/VercelAIAdapter.js +59 -7
- package/lib/specs/agents/agents.d.ts +10 -0
- package/lib/specs/agents/agents.js +2139 -262
- package/lib/specs/agents/index.js +3 -1
- package/lib/specs/envvars.d.ts +1 -0
- package/lib/specs/envvars.js +38 -20
- package/lib/specs/evals.js +6 -6
- package/lib/specs/events.d.ts +3 -10
- package/lib/specs/events.js +127 -84
- package/lib/specs/frontendTools.js +2 -2
- package/lib/specs/guardrails.d.ts +0 -7
- package/lib/specs/guardrails.js +240 -159
- package/lib/specs/index.d.ts +1 -0
- package/lib/specs/index.js +1 -0
- package/lib/specs/mcpServers.js +35 -6
- package/lib/specs/memory.d.ts +0 -2
- package/lib/specs/memory.js +4 -17
- package/lib/specs/models.js +25 -5
- package/lib/specs/notifications.js +102 -18
- package/lib/specs/outputs.js +15 -9
- package/lib/specs/personas.d.ts +41 -0
- package/lib/specs/personas.js +168 -0
- package/lib/specs/skills.d.ts +2 -1
- package/lib/specs/skills.js +41 -23
- package/lib/specs/teams/index.js +3 -1
- package/lib/specs/teams/teams.js +468 -348
- package/lib/specs/tools.js +4 -4
- package/lib/specs/triggers.js +61 -11
- package/lib/stores/agentRuntimeStore.d.ts +204 -0
- package/lib/stores/agentRuntimeStore.js +636 -0
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/index.js +1 -1
- package/lib/tools/adapters/copilotkit/lexicalHooks.d.ts +1 -2
- package/lib/tools/adapters/copilotkit/lexicalHooks.js +1 -3
- package/lib/tools/adapters/copilotkit/notebookHooks.d.ts +1 -2
- package/lib/tools/adapters/copilotkit/notebookHooks.js +1 -3
- package/lib/tools/index.d.ts +0 -2
- package/lib/tools/index.js +0 -1
- package/lib/types/agentspecs.d.ts +50 -1
- package/lib/types/chat.d.ts +309 -8
- package/lib/types/context.d.ts +27 -0
- package/lib/types/cost.d.ts +2 -2
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +2 -0
- package/lib/types/mcp.d.ts +8 -0
- package/lib/types/models.d.ts +2 -2
- package/lib/types/personas.d.ts +25 -0
- package/lib/types/personas.js +5 -0
- package/lib/types/skills.d.ts +43 -1
- package/lib/types/stream.d.ts +110 -0
- package/lib/types/stream.js +36 -0
- package/lib/utils/utils.d.ts +9 -5
- package/lib/utils/utils.js +9 -5
- package/package.json +13 -9
- package/scripts/codegen/__pycache__/generate_agents.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_events.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- package/scripts/codegen/generate_agents.py +102 -6
- package/scripts/codegen/generate_events.py +35 -13
- package/scripts/codegen/generate_personas.py +319 -0
- package/scripts/codegen/generate_skills.py +9 -9
- package/scripts/sync-jupyter.sh +26 -7
- package/lib/api/tool-approvals.d.ts +0 -62
- package/lib/api/tool-approvals.js +0 -145
- package/lib/examples/LexicalSidebarExample.js +0 -163
- package/lib/examples/NotebookSidebarExample.js +0 -119
- package/lib/examples/NotebookSimpleExample.d.ts +0 -6
- package/lib/examples/NotebookSimpleExample.js +0 -22
- package/lib/examples/ag-ui/index.d.ts +0 -10
- package/lib/examples/ag-ui/index.js +0 -16
- package/lib/hooks/useAgentsRegistry.d.ts +0 -10
- package/lib/hooks/useAgentsRegistry.js +0 -20
- package/lib/stores/agentsStore.d.ts +0 -123
- package/lib/stores/agentsStore.js +0 -270
- /package/lib/examples/{AgentspecExample.d.ts → AgentSpecsExample.d.ts} +0 -0
- /package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.d.ts +0 -0
- /package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.d.ts +0 -0
- /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.d.ts +0 -0
- /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.js +0 -0
package/README.md
CHANGED
|
@@ -55,6 +55,27 @@ Agent Runtimes solves the complexity of deploying AI agents by providing:
|
|
|
55
55
|
- 💾 **Persistence**: DBOS support for durable execution
|
|
56
56
|
- 🔒 **Context Optimization**: LLM context management
|
|
57
57
|
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
The examples will demonstrate how to use the Agent Runtimes functionality in various scenarios and frameworks.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
make examples
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
On the main page, you’ll find an example gallery (cards) that break things down into practical building blocks:
|
|
67
|
+
|
|
68
|
+
• UX patterns (aka GenUI) with protocols like A2UI and AG-UI
|
|
69
|
+
• Interactive or triggered workflows
|
|
70
|
+
• Agent Identity and Controls with guardrails, monitoring, tool approvals
|
|
71
|
+
• Programmatic tooling with Sandbox and Codemode for MCP and Skills
|
|
72
|
+
• Outputs and Notifications
|
|
73
|
+
• Real-time collaboration with users, subagents, and multi-agent teams
|
|
74
|
+
• Custom agents built from Agentspecs
|
|
75
|
+
• ...
|
|
76
|
+
|
|
77
|
+
Each of these concerns deserves more than a one-off solution—they need deep, composable, and pluggable implementations.
|
|
78
|
+
|
|
58
79
|
## Documentation
|
|
59
80
|
|
|
60
81
|
The detailed guides for architecture, use cases, interactive chat, key concepts, and runtime configuration are now in Docusaurus docs:
|
|
@@ -65,3 +86,16 @@ The detailed guides for architecture, use cases, interactive chat, key concepts,
|
|
|
65
86
|
- [Transports](https://agent-runtimes.datalayer.tech/transports)
|
|
66
87
|
- [Programmatic Tools](https://agent-runtimes.datalayer.tech/programmatic-tools)
|
|
67
88
|
- [CLI](https://agent-runtimes.datalayer.tech/cli)
|
|
89
|
+
|
|
90
|
+
## Agentspecs
|
|
91
|
+
|
|
92
|
+
Generated catalogs are produced via:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
make specs
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Generation scripts are under [scripts/codegen](https://github.com/datalayer/agent-runtimes/tree/main/scripts/codegen), and outputs are written to:
|
|
99
|
+
|
|
100
|
+
- Python: [agent_runtimes/specs](https://github.com/datalayer/agent-runtimes/tree/main/agent_runtimes/specs)
|
|
101
|
+
- TypeScript: [src/specs](https://github.com/datalayer/agent-runtimes/tree/main/src/specs)
|
package/lib/App.js
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*/
|
|
6
6
|
import { useJupyter, JupyterReactTheme } from '@datalayer/jupyter-react';
|
|
7
7
|
import { JupyterCellExample } from './examples/CellSimpleExample';
|
|
8
|
-
import { JupyterNotebookExample } from './examples/
|
|
8
|
+
import { JupyterNotebookExample } from './examples/NotebookExample';
|
|
9
9
|
import './App.css';
|
|
10
10
|
export function App() {
|
|
11
11
|
const { serviceManager } = useJupyter({
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* including name, protocol, URL, message count, and context details.
|
|
4
4
|
*/
|
|
5
5
|
import type { ReactNode } from 'react';
|
|
6
|
+
import { type FullContextResponse } from '../context/ContextInspector';
|
|
7
|
+
import type { ContextSnapshotResponse } from '../context/ContextPanel';
|
|
6
8
|
import type { OAuthProvider, OAuthProviderConfig, Identity } from '../identity';
|
|
9
|
+
import type { CodemodeStatusData } from '../types/stream';
|
|
7
10
|
export interface AgentDetailsProps {
|
|
8
11
|
/** Agent name/title */
|
|
9
12
|
name?: string;
|
|
@@ -39,9 +42,27 @@ export interface AgentDetailsProps {
|
|
|
39
42
|
showBackHeader?: boolean;
|
|
40
43
|
/** Whether to show context usage/history and context snapshot sections (default: true) */
|
|
41
44
|
showUsage?: boolean;
|
|
45
|
+
/** Live MCP status from WS — bypasses REST polling when provided */
|
|
46
|
+
mcpStatusData?: MCPToolsetsStatus | null;
|
|
47
|
+
/** Live codemode status from WS — bypasses REST polling when provided */
|
|
48
|
+
codemodeStatusData?: CodemodeStatusData | null;
|
|
49
|
+
/** Live context usage snapshot from WS — bypasses REST polling when provided */
|
|
50
|
+
contextSnapshotData?: ContextSnapshotResponse | null;
|
|
51
|
+
/** Live full context from WS — bypasses REST polling when provided */
|
|
52
|
+
fullContextData?: FullContextResponse | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* MCP toolsets status response
|
|
56
|
+
*/
|
|
57
|
+
interface MCPToolsetsStatus {
|
|
58
|
+
initialized: boolean;
|
|
59
|
+
ready_count: number;
|
|
60
|
+
failed_count: number;
|
|
61
|
+
ready_servers: string[];
|
|
62
|
+
failed_servers: Record<string, string>;
|
|
42
63
|
}
|
|
43
64
|
/**
|
|
44
65
|
* AgentDetails component displays comprehensive information about the agent.
|
|
45
66
|
*/
|
|
46
|
-
export declare function AgentDetails({ name, icon, emoji, protocol, url, messageCount, agentId, apiBase, identityProviders, onIdentityConnect, onIdentityDisconnect, onBack, showBackHeader, showUsage, }: AgentDetailsProps): import("react/jsx-runtime").JSX.Element;
|
|
67
|
+
export declare function AgentDetails({ name, icon, emoji, protocol, url, messageCount, agentId, apiBase, identityProviders, onIdentityConnect, onIdentityDisconnect, onBack, showBackHeader, showUsage, mcpStatusData, codemodeStatusData, contextSnapshotData, fullContextData, }: AgentDetailsProps): import("react/jsx-runtime").JSX.Element;
|
|
47
68
|
export default AgentDetails;
|
|
@@ -3,10 +3,11 @@ import { ArrowLeftIcon, CheckCircleIcon, XCircleIcon, CodeIcon, BriefcaseIcon, D
|
|
|
3
3
|
import { Button, Heading, IconButton, Text, Label, Spinner, ToggleSwitch, } from '@primer/react';
|
|
4
4
|
import { Box } from '@datalayer/primer-addons';
|
|
5
5
|
import { AiAgentIcon } from '@datalayer/icons-react';
|
|
6
|
-
import { useQuery, useMutation
|
|
6
|
+
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
7
7
|
import { ContextPanel } from '../context/ContextPanel';
|
|
8
8
|
import { ContextInspector, } from '../context/ContextInspector';
|
|
9
9
|
import { AgentIdentity } from '../identity/AgentIdentity';
|
|
10
|
+
import { useAgentRuntimeCodemodeStatus, useAgentRuntimeContextSnapshot, useAgentRuntimeFullContext, useAgentRuntimeMcpStatus, useAgentRuntimeWsState, } from '../stores';
|
|
10
11
|
/**
|
|
11
12
|
* Get the API base URL for fetching data.
|
|
12
13
|
* If apiBase prop is provided, use it.
|
|
@@ -27,13 +28,11 @@ function getApiBase(apiBase) {
|
|
|
27
28
|
/**
|
|
28
29
|
* Convert context snapshot data to CSV format and trigger download
|
|
29
30
|
*/
|
|
30
|
-
async function downloadContextSnapshotAsCSV(agentId,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (!response.ok) {
|
|
34
|
-
throw new Error('Failed to fetch context snapshot');
|
|
31
|
+
async function downloadContextSnapshotAsCSV(agentId, _apiBase, preloadedData) {
|
|
32
|
+
if (!preloadedData) {
|
|
33
|
+
throw new Error('No context data available for CSV export. Data is delivered via WebSocket.');
|
|
35
34
|
}
|
|
36
|
-
const data =
|
|
35
|
+
const data = preloadedData;
|
|
37
36
|
const rows = [];
|
|
38
37
|
// Header section
|
|
39
38
|
rows.push(['Context Snapshot for Agent', data.agentId]);
|
|
@@ -165,34 +164,23 @@ async function downloadContextSnapshotAsCSV(agentId, apiBase) {
|
|
|
165
164
|
/**
|
|
166
165
|
* AgentDetails component displays comprehensive information about the agent.
|
|
167
166
|
*/
|
|
168
|
-
export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, messageCount, agentId, apiBase, identityProviders, onIdentityConnect, onIdentityDisconnect, onBack, showBackHeader = true, showUsage = true, }) {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const
|
|
185
|
-
queryKey: ['codemode-status', apiBase],
|
|
186
|
-
queryFn: async () => {
|
|
187
|
-
const base = getApiBase(apiBase);
|
|
188
|
-
const response = await fetch(`${base}/api/v1/configure/codemode-status`);
|
|
189
|
-
if (!response.ok) {
|
|
190
|
-
throw new Error('Failed to fetch Codemode status');
|
|
191
|
-
}
|
|
192
|
-
return response.json();
|
|
193
|
-
},
|
|
194
|
-
refetchInterval: 5000, // Refresh every 5 seconds
|
|
195
|
-
});
|
|
167
|
+
export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, messageCount, agentId, apiBase, identityProviders, onIdentityConnect, onIdentityDisconnect, onBack, showBackHeader = true, showUsage = true, mcpStatusData, codemodeStatusData, contextSnapshotData, fullContextData, }) {
|
|
168
|
+
const wsMcpStatus = useAgentRuntimeMcpStatus();
|
|
169
|
+
const wsCodemodeStatus = useAgentRuntimeCodemodeStatus();
|
|
170
|
+
const wsContextSnapshot = useAgentRuntimeContextSnapshot();
|
|
171
|
+
const wsFullContext = useAgentRuntimeFullContext();
|
|
172
|
+
const wsState = useAgentRuntimeWsState();
|
|
173
|
+
const mcpStatus = mcpStatusData ?? wsMcpStatus;
|
|
174
|
+
const codemodeStatus = codemodeStatusData ??
|
|
175
|
+
wsCodemodeStatus;
|
|
176
|
+
const resolvedContextSnapshot = contextSnapshotData ??
|
|
177
|
+
wsContextSnapshot;
|
|
178
|
+
const resolvedFullContext = fullContextData ?? wsFullContext;
|
|
179
|
+
const hasMcpLiveData = mcpStatusData !== undefined || wsState !== 'closed';
|
|
180
|
+
const hasCodemodeLiveData = codemodeStatusData !== undefined || wsState !== 'closed';
|
|
181
|
+
// REST polling removed — data comes exclusively via WS `agent.snapshot`.
|
|
182
|
+
const mcpLoading = wsState === 'connecting' && !mcpStatus;
|
|
183
|
+
const codemodeLoading = wsState === 'connecting' && !codemodeStatus;
|
|
196
184
|
// Mutation to toggle codemode
|
|
197
185
|
const toggleCodemodeMutation = useMutation({
|
|
198
186
|
mutationFn: async (enabled) => {
|
|
@@ -210,8 +198,7 @@ export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, me
|
|
|
210
198
|
return response.json();
|
|
211
199
|
},
|
|
212
200
|
onSuccess: () => {
|
|
213
|
-
//
|
|
214
|
-
queryClient.invalidateQueries({ queryKey: ['codemode-status'] });
|
|
201
|
+
// Status update will arrive via WS `agent.snapshot` push
|
|
215
202
|
},
|
|
216
203
|
});
|
|
217
204
|
// Fetch agent spec (original creation request with separated system prompts)
|
|
@@ -330,7 +317,7 @@ export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, me
|
|
|
330
317
|
borderRadius: 2,
|
|
331
318
|
border: '1px solid',
|
|
332
319
|
borderColor: 'border.default',
|
|
333
|
-
}, 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 === '
|
|
320
|
+
}, 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 === 'jupyter'
|
|
334
321
|
? 'accent'
|
|
335
322
|
: '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: {
|
|
336
323
|
display: 'flex',
|
|
@@ -340,7 +327,7 @@ export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, me
|
|
|
340
327
|
display: 'flex',
|
|
341
328
|
alignItems: 'center',
|
|
342
329
|
gap: 1,
|
|
343
|
-
}, children: [_jsx(XCircleIcon, { size: 12, fill: "fg.muted" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No" })] }))] }), agentSpec.sandbox.variant === '
|
|
330
|
+
}, children: [_jsx(XCircleIcon, { size: 12, fill: "fg.muted" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No" })] }))] }), agentSpec.sandbox.variant === 'jupyter' && (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: {
|
|
344
331
|
fontSize: 0,
|
|
345
332
|
color: 'fg.muted',
|
|
346
333
|
width: 100,
|
|
@@ -424,7 +411,7 @@ export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, me
|
|
|
424
411
|
borderRadius: 2,
|
|
425
412
|
border: '1px solid',
|
|
426
413
|
borderColor: 'border.default',
|
|
427
|
-
}, children: mcpLoading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Loading MCP status..." })] })) : mcpStatus ? (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: _jsxs(Text, { sx: { fontSize: 1 }, children: [_jsx(Text, { as: "span", sx: { fontWeight: 'semibold' }, children: mcpStatus.ready_count }), ' ', "ready,", ' ', _jsx(Text, { as: "span", sx: { fontWeight: 'semibold' }, children: mcpStatus.failed_count }), ' ', "failed"] }) }), mcpStatus.ready_servers.length > 0 && (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsx(Text, { sx: {
|
|
414
|
+
}, children: !hasMcpLiveData && mcpLoading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Loading MCP status..." })] })) : mcpStatus ? (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: _jsxs(Text, { sx: { fontSize: 1 }, children: [_jsx(Text, { as: "span", sx: { fontWeight: 'semibold' }, children: mcpStatus.ready_count }), ' ', "ready,", ' ', _jsx(Text, { as: "span", sx: { fontWeight: 'semibold' }, children: mcpStatus.failed_count }), ' ', "failed"] }) }), mcpStatus.ready_servers.length > 0 && (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsx(Text, { sx: {
|
|
428
415
|
fontSize: 0,
|
|
429
416
|
fontWeight: 'semibold',
|
|
430
417
|
color: 'fg.muted',
|
|
@@ -453,7 +440,7 @@ export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, me
|
|
|
453
440
|
pl: 4,
|
|
454
441
|
whiteSpace: 'pre-wrap',
|
|
455
442
|
wordBreak: 'break-word',
|
|
456
|
-
}, children: error.split('\n')[0] })] }, server)))] }))] })) : (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Failed to load MCP status" })) })] }), _jsxs(Box, { children: [_jsx(Heading, { as: "h4", sx: {
|
|
443
|
+
}, children: error.split('\n')[0] })] }, server)))] }))] })) : hasMcpLiveData ? (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Waiting for MCP status from WebSocket stream..." })) : (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Failed to load MCP status" })) })] }), _jsxs(Box, { children: [_jsx(Heading, { as: "h4", sx: {
|
|
457
444
|
fontSize: 1,
|
|
458
445
|
fontWeight: 'semibold',
|
|
459
446
|
mb: 2,
|
|
@@ -464,7 +451,7 @@ export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, me
|
|
|
464
451
|
borderRadius: 2,
|
|
465
452
|
border: '1px solid',
|
|
466
453
|
borderColor: 'border.default',
|
|
467
|
-
}, children: codemodeLoading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Loading Codemode status..." })] })) : codemodeStatus ? (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3 }, children: [_jsxs(Box, { sx: {
|
|
454
|
+
}, children: !hasCodemodeLiveData && codemodeLoading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Loading Codemode status..." })] })) : codemodeStatus ? (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3 }, children: [_jsxs(Box, { sx: {
|
|
468
455
|
display: 'flex',
|
|
469
456
|
alignItems: 'center',
|
|
470
457
|
justifyContent: 'space-between',
|
|
@@ -486,9 +473,9 @@ export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, me
|
|
|
486
473
|
flexDirection: 'column',
|
|
487
474
|
gap: 1,
|
|
488
475
|
pl: 4,
|
|
489
|
-
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 80 }, children: "Variant:" }), _jsx(Label, { variant: codemodeStatus.sandbox.variant === '
|
|
476
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', width: 80 }, children: "Variant:" }), _jsx(Label, { variant: codemodeStatus.sandbox.variant === 'jupyter'
|
|
490
477
|
? 'accent'
|
|
491
|
-
: 'secondary', size: "small", children: codemodeStatus.sandbox.variant })] }), codemodeStatus.sandbox.variant === '
|
|
478
|
+
: 'secondary', size: "small", children: codemodeStatus.sandbox.variant })] }), codemodeStatus.sandbox.variant === 'jupyter' && (_jsxs(_Fragment, { children: [_jsxs(Box, { sx: {
|
|
492
479
|
display: 'flex',
|
|
493
480
|
alignItems: 'center',
|
|
494
481
|
gap: 2,
|
|
@@ -573,7 +560,7 @@ export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, me
|
|
|
573
560
|
gap: 1,
|
|
574
561
|
flexWrap: 'wrap',
|
|
575
562
|
mt: 1,
|
|
576
|
-
}, children: codemodeStatus.available_skills.map(skill => (_jsx(Label, { variant: "secondary", size: "small", children: skill.name }, skill.name))) })] })), codemodeStatus.available_skills.length === 0 && (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No skills available.
|
|
563
|
+
}, children: codemodeStatus.available_skills.map(skill => (_jsx(Label, { variant: "secondary", size: "small", children: skill.name }, skill.name))) })] })), codemodeStatus.available_skills.length === 0 && (_jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "No CodeMode skills are available for this agent. You can still use MCP tools by selecting MCP servers." }))] })) : hasCodemodeLiveData ? (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Waiting for Codemode status from WebSocket stream..." })) : (_jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: "Failed to load Codemode status" })) })] }), showUsage && agentId && (_jsx(ContextPanel, { agentId: agentId, apiBase: apiBase, liveData: resolvedContextSnapshot, messageCount: messageCount, chartHeight: "200px" })), showUsage && agentId && (_jsxs(Box, { sx: { mt: 3 }, children: [_jsxs(Box, { sx: {
|
|
577
564
|
display: 'flex',
|
|
578
565
|
alignItems: 'center',
|
|
579
566
|
justifyContent: 'space-between',
|
|
@@ -582,12 +569,12 @@ export function AgentDetails({ name = 'AI Agent', icon, emoji, protocol, url, me
|
|
|
582
569
|
fontSize: 1,
|
|
583
570
|
fontWeight: 'semibold',
|
|
584
571
|
color: 'fg.muted',
|
|
585
|
-
}, children: "Context Snapshot" }), _jsx(Button, { size: "small", variant: "invisible", leadingVisual: DownloadIcon, onClick: () => downloadContextSnapshotAsCSV(agentId, apiBase), children: "Download" })] }), _jsx(Box, { sx: {
|
|
572
|
+
}, children: "Context Snapshot" }), _jsx(Button, { size: "small", variant: "invisible", leadingVisual: DownloadIcon, onClick: () => downloadContextSnapshotAsCSV(agentId, apiBase, resolvedFullContext), children: "Download" })] }), _jsx(Box, { sx: {
|
|
586
573
|
p: 3,
|
|
587
574
|
bg: 'canvas.subtle',
|
|
588
575
|
borderRadius: 2,
|
|
589
576
|
border: '1px solid',
|
|
590
577
|
borderColor: 'border.default',
|
|
591
|
-
}, 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" }) }))] })] }));
|
|
578
|
+
}, children: _jsx(ContextInspector, { agentId: agentId, apiBase: apiBase, liveData: resolvedFullContext }) })] })), _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" }) }))] })] }));
|
|
592
579
|
}
|
|
593
580
|
export default AgentDetails;
|
package/lib/api/index.d.ts
CHANGED
package/lib/api/index.js
CHANGED
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module api
|
|
12
12
|
*/
|
|
13
|
-
// Agents Service API (agents,
|
|
13
|
+
// Agents Service API (agents, notifications, etc.)
|
|
14
|
+
// Tool approvals are intentionally NOT exposed over REST here — all
|
|
15
|
+
// approval interactions flow over the websocket stream; see
|
|
16
|
+
// `hooks/useToolApprovals` and `components/ToolApprovalBanner`.
|
|
14
17
|
export * as agents from './agents';
|
|
15
18
|
export * as context from './context';
|
|
16
19
|
export * as evals from './evals';
|
|
17
20
|
export * as events from './events';
|
|
18
21
|
export * as notifications from './notifications';
|
|
19
22
|
export * as output from './output';
|
|
20
|
-
export * as toolApprovals from './tool-approvals';
|
package/lib/chat/Chat.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
1
|
import type { OAuthProvider, OAuthProviderConfig, Identity } from '../identity';
|
|
3
|
-
import type {
|
|
2
|
+
import type { ChatCommonProps, Extension, Protocol } from '../types';
|
|
4
3
|
/**
|
|
5
|
-
* Chat props
|
|
4
|
+
* Chat props — extends ChatCommonProps with transport-specific configuration.
|
|
6
5
|
*/
|
|
7
|
-
export interface ChatProps {
|
|
8
|
-
/** Transport to use */
|
|
6
|
+
export interface ChatProps extends ChatCommonProps {
|
|
7
|
+
/** Transport to use — REQUIRED (narrows protocol to string enum) */
|
|
9
8
|
protocol: Protocol;
|
|
10
9
|
/** Extensions for chat features */
|
|
11
10
|
extensions?: Extension[];
|
|
@@ -15,14 +14,6 @@ export interface ChatProps {
|
|
|
15
14
|
wsUrl?: string;
|
|
16
15
|
/** Agent ID */
|
|
17
16
|
agentId?: string;
|
|
18
|
-
/** Authentication token (JWT) to send as Authorization Bearer header */
|
|
19
|
-
authToken?: string;
|
|
20
|
-
/** Custom placeholder text */
|
|
21
|
-
placeholder?: string;
|
|
22
|
-
/** Custom title */
|
|
23
|
-
title?: string;
|
|
24
|
-
/** Brand icon shown in chat header/empty state and details title */
|
|
25
|
-
brandIcon?: ReactNode;
|
|
26
17
|
/** Whether to auto-connect on mount */
|
|
27
18
|
autoConnect?: boolean;
|
|
28
19
|
/** Whether to use streaming (for protocols that support it) */
|
|
@@ -37,57 +28,10 @@ export interface ChatProps {
|
|
|
37
28
|
onLogout?: () => void;
|
|
38
29
|
/** Callback when collapse panel is clicked */
|
|
39
30
|
onCollapsePanel?: () => void;
|
|
40
|
-
/** Custom styles */
|
|
41
|
-
className?: string;
|
|
42
31
|
/** Height of the chat container */
|
|
43
32
|
height?: string | number;
|
|
44
|
-
/** Show header with connection status */
|
|
45
|
-
showHeader?: boolean;
|
|
46
|
-
/** Show the new chat (+) button in the header */
|
|
47
|
-
showNewChatButton?: boolean;
|
|
48
|
-
/** Show the clear chat button in the header */
|
|
49
|
-
showClearButton?: boolean;
|
|
50
|
-
/** Show model selector (fetched from /configure endpoint) */
|
|
51
|
-
showModelSelector?: boolean;
|
|
52
|
-
/** Show tools menu (fetched from /configure endpoint) */
|
|
53
|
-
showToolsMenu?: boolean;
|
|
54
|
-
/** Show input area */
|
|
55
|
-
showInput?: boolean;
|
|
56
|
-
/** Show skills menu (fetched from /skills endpoint) */
|
|
57
|
-
showSkillsMenu?: boolean;
|
|
58
|
-
/** Indicate tools are accessed via Codemode meta-tools */
|
|
59
|
-
codemodeEnabled?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Show token usage bar between input and selectors.
|
|
62
|
-
* @default true
|
|
63
|
-
*/
|
|
64
|
-
showTokenUsage?: boolean;
|
|
65
|
-
/** Initial model ID to select (e.g., 'openai:gpt-4o-mini') */
|
|
66
|
-
initialModel?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Override the list of available models.
|
|
69
|
-
* When provided, this list replaces the models returned by the config endpoint.
|
|
70
|
-
* Use this to restrict the model selector to a specific subset of models.
|
|
71
|
-
*/
|
|
72
|
-
availableModels?: ModelConfig[];
|
|
73
|
-
/** MCP server selections to enable (others will be disabled) */
|
|
74
|
-
mcpServers?: McpServerSelection[];
|
|
75
|
-
/** Initial skill IDs to enable */
|
|
76
|
-
initialSkills?: string[];
|
|
77
33
|
/** Clear messages when component mounts or agentId changes */
|
|
78
34
|
clearOnMount?: boolean;
|
|
79
|
-
/** Suggestions to show in empty state */
|
|
80
|
-
suggestions?: Suggestion[];
|
|
81
|
-
/** Whether to automatically submit the message when a suggestion is clicked */
|
|
82
|
-
submitOnSuggestionClick?: boolean;
|
|
83
|
-
/** Description shown in empty state */
|
|
84
|
-
description?: string;
|
|
85
|
-
/** Custom content to render in the chat header title row (left side). */
|
|
86
|
-
headerContent?: ReactNode;
|
|
87
|
-
/** Custom actions to render in the chat header title row (right side). */
|
|
88
|
-
headerActions?: ReactNode;
|
|
89
|
-
/** Auto-focus the input on mount */
|
|
90
|
-
autoFocus?: boolean;
|
|
91
35
|
/** Identity providers configuration for OAuth */
|
|
92
36
|
identityProviders?: {
|
|
93
37
|
[K in OAuthProvider]?: {
|
|
@@ -100,24 +44,6 @@ export interface ChatProps {
|
|
|
100
44
|
onIdentityConnect?: (identity: Identity) => void;
|
|
101
45
|
/** Callback when identity disconnects */
|
|
102
46
|
onIdentityDisconnect?: (provider: OAuthProvider) => void;
|
|
103
|
-
/**
|
|
104
|
-
* Runtime ID for conversation persistence.
|
|
105
|
-
* When provided, messages are fetched from the server API on page reload
|
|
106
|
-
* and prevents message mixing between different agent runtimes.
|
|
107
|
-
*/
|
|
108
|
-
runtimeId?: string;
|
|
109
|
-
/**
|
|
110
|
-
* Endpoint URL for fetching conversation history.
|
|
111
|
-
* When runtimeId is provided, this endpoint is called to fetch
|
|
112
|
-
* the conversation history on mount.
|
|
113
|
-
* If not provided, defaults to `{protocol.endpoint}/api/v1/history`.
|
|
114
|
-
*/
|
|
115
|
-
historyEndpoint?: string;
|
|
116
|
-
/**
|
|
117
|
-
* A prompt to append and send after the conversation history is loaded.
|
|
118
|
-
* The message is shown in the chat and sent to the agent exactly once.
|
|
119
|
-
*/
|
|
120
|
-
pendingPrompt?: string;
|
|
121
47
|
/**
|
|
122
48
|
* Error banner to display at the top of the chat.
|
|
123
49
|
* Use this to show sandbox connection errors or other warnings.
|
|
@@ -126,33 +52,6 @@ export interface ChatProps {
|
|
|
126
52
|
message: string;
|
|
127
53
|
variant?: 'danger' | 'warning';
|
|
128
54
|
};
|
|
129
|
-
/**
|
|
130
|
-
* Show the information icon in the header.
|
|
131
|
-
* When clicked, it opens the agent details panel.
|
|
132
|
-
* @default false
|
|
133
|
-
*/
|
|
134
|
-
showInformation?: boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Current chat view mode for the header segmented toggle.
|
|
137
|
-
* When provided, a view-mode toggle is rendered in the header.
|
|
138
|
-
*/
|
|
139
|
-
chatViewMode?: ChatViewMode;
|
|
140
|
-
/**
|
|
141
|
-
* Callback when the user switches chat view mode via the header toggle.
|
|
142
|
-
*/
|
|
143
|
-
onChatViewModeChange?: (mode: ChatViewMode) => void;
|
|
144
|
-
/**
|
|
145
|
-
* Frontend tool definitions to register with the chat.
|
|
146
|
-
* Pass an empty array to explicitly disable all frontend tools.
|
|
147
|
-
*/
|
|
148
|
-
frontendTools?: FrontendToolDefinition[];
|
|
149
|
-
/** Optional custom renderer for tool-call message cards. */
|
|
150
|
-
renderToolResult?: RenderToolResult;
|
|
151
|
-
/**
|
|
152
|
-
* Hide assistant messages that follow a rendered tool call UI.
|
|
153
|
-
* Useful to suppress raw tool-call/continuation text and show only tool cards.
|
|
154
|
-
*/
|
|
155
|
-
hideMessagesAfterToolUI?: boolean;
|
|
156
55
|
}
|
|
157
56
|
/**
|
|
158
57
|
* Chat Component
|
|
@@ -195,5 +94,5 @@ export interface ChatProps {
|
|
|
195
94
|
* />
|
|
196
95
|
* ```
|
|
197
96
|
*/
|
|
198
|
-
export declare function Chat({ protocol: transport, extensions: _extensions, baseUrl, wsUrl, agentId, authToken: authTokenProp, placeholder, title, brandIcon, autoConnect: _autoConnect, streaming: _streaming, onMessageSent: _onMessageSent, onMessageReceived: _onMessageReceived, onDisconnect, onLogout: _onLogout, onCollapsePanel: _onCollapsePanel, className, height, showHeader, showNewChatButton, showClearButton, showModelSelector, showToolsMenu, showInput, showSkillsMenu, codemodeEnabled, showTokenUsage, initialModel, availableModels, mcpServers, initialSkills, clearOnMount: _clearOnMount, suggestions, submitOnSuggestionClick, description, headerContent, headerActions, autoFocus, identityProviders, onIdentityConnect, onIdentityDisconnect, runtimeId, historyEndpoint, pendingPrompt, errorBanner, showInformation, chatViewMode, onChatViewModeChange, frontendTools, renderToolResult, hideMessagesAfterToolUI, }: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
97
|
+
export declare function Chat({ protocol: transport, extensions: _extensions, baseUrl, wsUrl, agentId, authToken: authTokenProp, placeholder, title, subtitle, brandIcon, autoConnect: _autoConnect, streaming: _streaming, onMessageSent: _onMessageSent, onMessageReceived: _onMessageReceived, onDisconnect, onLogout: _onLogout, onCollapsePanel: _onCollapsePanel, className, height, showHeader, showNewChatButton, showClearButton, showModelSelector, showToolsMenu, showInput, disableInputPrompt, showSkillsMenu, codemodeEnabled, onToggleCodemode, showTokenUsage, initialModel, availableModels, mcpServers, initialSkills, clearOnMount: _clearOnMount, suggestions, submitOnSuggestionClick, description, headerContent, headerActions, autoFocus, identityProviders, onIdentityConnect, onIdentityDisconnect, runtimeId, historyEndpoint, pendingPrompt, errorBanner, showInformation, chatViewMode, onChatViewModeChange, frontendTools, onToolCallStart, onToolCallComplete, renderToolResult, hideMessagesAfterToolUI, contextSnapshot, mcpStatusData, codemodeStatusData, sandboxStatusData, showToolApprovalBanner, pendingApprovals, onApproveApproval, onRejectApproval, }: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
199
98
|
export default Chat;
|
package/lib/chat/Chat.js
CHANGED
|
@@ -133,7 +133,7 @@ function getProtocolType(protocol) {
|
|
|
133
133
|
* />
|
|
134
134
|
* ```
|
|
135
135
|
*/
|
|
136
|
-
export function Chat({ protocol: transport, extensions: _extensions, baseUrl = 'http://localhost:8765', wsUrl, agentId, authToken: authTokenProp, placeholder = 'Type your message...', title, brandIcon, autoConnect: _autoConnect = true, streaming: _streaming = true, onMessageSent: _onMessageSent, onMessageReceived: _onMessageReceived, onDisconnect, onLogout: _onLogout, onCollapsePanel: _onCollapsePanel, className, height = '600px', showHeader = true, showNewChatButton = true, showClearButton = true, showModelSelector = true, showToolsMenu = true, showInput = true,
|
|
136
|
+
export function Chat({ protocol: transport, extensions: _extensions, baseUrl = 'http://localhost:8765', wsUrl, agentId, authToken: authTokenProp, placeholder = 'Type your message...', title, subtitle, brandIcon, autoConnect: _autoConnect = true, streaming: _streaming = true, onMessageSent: _onMessageSent, onMessageReceived: _onMessageReceived, onDisconnect, onLogout: _onLogout, onCollapsePanel: _onCollapsePanel, className, height = '600px', showHeader = true, showNewChatButton = true, showClearButton = true, showModelSelector = true, showToolsMenu = true, showInput = true, disableInputPrompt = false, showSkillsMenu = true, codemodeEnabled = false, onToggleCodemode, showTokenUsage = true, initialModel, availableModels, mcpServers, initialSkills, clearOnMount: _clearOnMount = true, suggestions, submitOnSuggestionClick = true, description, headerContent, headerActions, autoFocus = false, identityProviders, onIdentityConnect, onIdentityDisconnect, runtimeId, historyEndpoint, pendingPrompt, errorBanner, showInformation = true, chatViewMode, onChatViewModeChange, frontendTools, onToolCallStart, onToolCallComplete, renderToolResult, hideMessagesAfterToolUI = false, contextSnapshot, mcpStatusData, codemodeStatusData, sandboxStatusData, showToolApprovalBanner, pendingApprovals, onApproveApproval, onRejectApproval, }) {
|
|
137
137
|
const [error, setError] = useState(null);
|
|
138
138
|
const [isInitializing, setIsInitializing] = useState(true);
|
|
139
139
|
const [showDetails, setShowDetails] = useState(false);
|
|
@@ -285,7 +285,7 @@ export function Chat({ protocol: transport, extensions: _extensions, baseUrl = '
|
|
|
285
285
|
display: showDetails ? 'flex' : 'none',
|
|
286
286
|
flexDirection: 'column',
|
|
287
287
|
height: '100%',
|
|
288
|
-
}, children: _jsx(AgentDetails, { name: title || 'AI Agent', icon: brandIcon, protocol: transport, url: protocolConfig?.endpoint || baseUrl, messageCount: messageCount, agentId: agentId, apiBase: baseUrl, identityProviders: identityProviders, onIdentityConnect: onIdentityConnect, onIdentityDisconnect: onIdentityDisconnect, onBack: () => setShowDetails(false) }) }), _jsxs(Box, { sx: {
|
|
288
|
+
}, children: _jsx(AgentDetails, { name: title || 'AI Agent', icon: brandIcon, protocol: transport, url: protocolConfig?.endpoint || baseUrl, messageCount: messageCount, agentId: agentId, apiBase: baseUrl, identityProviders: identityProviders, onIdentityConnect: onIdentityConnect, onIdentityDisconnect: onIdentityDisconnect, onBack: () => setShowDetails(false), mcpStatusData: mcpStatusData, codemodeStatusData: codemodeStatusData }) }), _jsxs(Box, { sx: {
|
|
289
289
|
display: showDetails ? 'none' : 'flex',
|
|
290
290
|
flexDirection: 'column',
|
|
291
291
|
height: '100%',
|
|
@@ -310,12 +310,12 @@ export function Chat({ protocol: transport, extensions: _extensions, baseUrl = '
|
|
|
310
310
|
? 'attention.fg'
|
|
311
311
|
: 'danger.fg',
|
|
312
312
|
flex: 1,
|
|
313
|
-
}, children: errorBanner.message })] })), _jsx(ChatBase, { title: title, brandIcon: brandIcon, 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), headerContent: headerContent, headerActions: headerActions, showModelSelector: showModelSelector, showToolsMenu: showToolsMenu, showInput: showInput, showSkillsMenu: showSkillsMenu, showTokenUsage: showTokenUsage, codemodeEnabled: codemodeEnabled, initialModel: initialModel, availableModels: availableModels, mcpServers: mcpServers, initialSkills: initialSkills, connectedIdentities: identitiesForChat, onNewChat: handleNewChat, onMessagesChange: messages => setMessageCount(messages.length), headerButtons: {
|
|
313
|
+
}, children: errorBanner.message })] })), _jsx(ChatBase, { title: title, subtitle: subtitle, brandIcon: brandIcon, 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), headerContent: headerContent, headerActions: headerActions, showModelSelector: showModelSelector, showToolsMenu: showToolsMenu, showInput: showInput, disableInputPrompt: disableInputPrompt, showSkillsMenu: showSkillsMenu, showTokenUsage: showTokenUsage, codemodeEnabled: codemodeEnabled, onToggleCodemode: onToggleCodemode, initialModel: initialModel, availableModels: availableModels, mcpServers: mcpServers, initialSkills: initialSkills, connectedIdentities: identitiesForChat, onNewChat: handleNewChat, onMessagesChange: messages => setMessageCount(messages.length), headerButtons: {
|
|
314
314
|
showNewChat: showNewChatButton,
|
|
315
315
|
showClear: showClearButton,
|
|
316
316
|
onNewChat: handleNewChat,
|
|
317
317
|
}, avatarConfig: {
|
|
318
318
|
showAvatars: true,
|
|
319
|
-
}, backgroundColor: "canvas.default", focusTrigger: focusTrigger, chatViewMode: chatViewMode, onChatViewModeChange: onChatViewModeChange, frontendTools: frontendTools, renderToolResult: renderToolResult, hideMessagesAfterToolUI: hideMessagesAfterToolUI })] })] }) }));
|
|
319
|
+
}, backgroundColor: "canvas.default", focusTrigger: focusTrigger, chatViewMode: chatViewMode, onChatViewModeChange: onChatViewModeChange, frontendTools: frontendTools, onToolCallStart: onToolCallStart, onToolCallComplete: onToolCallComplete, renderToolResult: renderToolResult, hideMessagesAfterToolUI: hideMessagesAfterToolUI, contextSnapshot: contextSnapshot, mcpStatusData: mcpStatusData, sandboxStatusData: sandboxStatusData, showToolApprovalBanner: showToolApprovalBanner, pendingApprovals: pendingApprovals, onApproveApproval: onApproveApproval, onRejectApproval: onRejectApproval })] })] }) }));
|
|
320
320
|
}
|
|
321
321
|
export default Chat;
|