@backbay/glia-three 0.2.0-alpha.2
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/package.json +43 -0
- package/src/environment/AuroraLayer/AuroraLayer.stories.tsx +43 -0
- package/src/environment/AuroraLayer/AuroraLayer.tsx +200 -0
- package/src/environment/AuroraLayer/index.ts +2 -0
- package/src/environment/AuroraLayer/types.ts +30 -0
- package/src/environment/EnvironmentLayer/EnvironmentLayer.stories.tsx +262 -0
- package/src/environment/EnvironmentLayer/EnvironmentLayer.tsx +105 -0
- package/src/environment/EnvironmentLayer/index.ts +4 -0
- package/src/environment/EnvironmentLayer/presets.ts +128 -0
- package/src/environment/FogLayer/FogLayer.stories.tsx +83 -0
- package/src/environment/FogLayer/FogLayer.tsx +113 -0
- package/src/environment/FogLayer/index.ts +2 -0
- package/src/environment/FogLayer/types.ts +45 -0
- package/src/environment/VolumetricLight/VolumetricLight.stories.tsx +55 -0
- package/src/environment/VolumetricLight/VolumetricLight.tsx +188 -0
- package/src/environment/VolumetricLight/index.ts +2 -0
- package/src/environment/VolumetricLight/types.ts +33 -0
- package/src/environment/WeatherLayer/WeatherLayer.stories.tsx +348 -0
- package/src/environment/WeatherLayer/WeatherLayer.tsx +266 -0
- package/src/environment/WeatherLayer/cinematicCanvas.tsx +809 -0
- package/src/environment/WeatherLayer/colors.ts +27 -0
- package/src/environment/WeatherLayer/index.ts +4 -0
- package/src/environment/WeatherLayer/leafPresets.ts +12 -0
- package/src/environment/WeatherLayer/particles.ts +227 -0
- package/src/environment/WeatherLayer/types.ts +140 -0
- package/src/environment/index.ts +17 -0
- package/src/environment/shared/index.ts +2 -0
- package/src/environment/shared/noise.ts +10 -0
- package/src/environment/shared/performance.ts +33 -0
- package/src/environment/shared/types.ts +26 -0
- package/src/index.ts +2 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/vision-types.ts +84 -0
- package/src/three/AgentConsole/AgentConsole.stories.tsx +397 -0
- package/src/three/AgentConsole/AgentConsole.tsx +195 -0
- package/src/three/AgentConsole/ConsoleChat.tsx +237 -0
- package/src/three/AgentConsole/FocusConstellation.tsx +297 -0
- package/src/three/AgentConsole/GlyphAvatar.stories.tsx +110 -0
- package/src/three/AgentConsole/GlyphAvatar.tsx +117 -0
- package/src/three/AgentConsole/QuickActions.tsx +111 -0
- package/src/three/AgentConsole/index.ts +41 -0
- package/src/three/AgentConsole/types.ts +241 -0
- package/src/three/AmbientField/AmbientField.stories.tsx +290 -0
- package/src/three/AmbientField/AmbientField.tsx +307 -0
- package/src/three/AmbientField/BackbayFieldBus.ts +326 -0
- package/src/three/AmbientField/FieldProvider.tsx +83 -0
- package/src/three/AmbientField/index.ts +37 -0
- package/src/three/AmbientField/shaders/constellation.ts +384 -0
- package/src/three/AmbientField/types.ts +174 -0
- package/src/three/AttackGraph/AttackGraph.stories.tsx +144 -0
- package/src/three/AttackGraph/AttackGraph.tsx +325 -0
- package/src/three/AttackGraph/index.ts +19 -0
- package/src/three/AttackGraph/types.ts +97 -0
- package/src/three/AuditTrail/AuditTrail.stories.tsx +567 -0
- package/src/three/AuditTrail/AuditTrail.tsx +644 -0
- package/src/three/AuditTrail/index.ts +33 -0
- package/src/three/AuditTrail/types.ts +192 -0
- package/src/three/CrystallineOrganism/Breadcrumb.tsx +61 -0
- package/src/three/CrystallineOrganism/CrystallineOrganism.stories.tsx +509 -0
- package/src/three/CrystallineOrganism/CrystallineOrganism.tsx +273 -0
- package/src/three/CrystallineOrganism/LatticeEdge.tsx +69 -0
- package/src/three/CrystallineOrganism/OrganismLattice.tsx +159 -0
- package/src/three/CrystallineOrganism/OrganismParticles.tsx +148 -0
- package/src/three/CrystallineOrganism/OrganismShell.tsx +277 -0
- package/src/three/CrystallineOrganism/constants.ts +161 -0
- package/src/three/CrystallineOrganism/index.ts +17 -0
- package/src/three/CrystallineOrganism/layouts/hexGrid.ts +85 -0
- package/src/three/CrystallineOrganism/layouts/index.ts +1 -0
- package/src/three/CrystallineOrganism/types.ts +167 -0
- package/src/three/CrystallineOrganism/useOrganismEmotion.ts +84 -0
- package/src/three/FirewallBarrier/FirewallBarrier.stories.tsx +167 -0
- package/src/three/FirewallBarrier/FirewallBarrier.tsx +259 -0
- package/src/three/FirewallBarrier/index.ts +14 -0
- package/src/three/FirewallBarrier/types.ts +52 -0
- package/src/three/Glyph/GlyphObject.stories.tsx +577 -0
- package/src/three/Glyph/GlyphObject.tsx +422 -0
- package/src/three/Glyph/index.ts +10 -0
- package/src/three/Glyph/types.ts +36 -0
- package/src/three/Glyph/useGlyphController.ts +231 -0
- package/src/three/Glyph/useGlyphEmotion.ts +70 -0
- package/src/three/Graph3D/Graph3D.stories.tsx +269 -0
- package/src/three/Graph3D/Graph3D.tsx +248 -0
- package/src/three/Graph3D/GraphEdge.tsx +79 -0
- package/src/three/Graph3D/GraphNode.tsx +239 -0
- package/src/three/Graph3D/types.ts +66 -0
- package/src/three/Graph3D/utils.ts +204 -0
- package/src/three/IntelFeed/IntelFeed.stories.tsx +168 -0
- package/src/three/IntelFeed/IntelFeed.tsx +284 -0
- package/src/three/IntelFeed/index.ts +14 -0
- package/src/three/IntelFeed/types.ts +56 -0
- package/src/three/MetricsGalaxy/MetricsGalaxy.tsx +484 -0
- package/src/three/MetricsGalaxy/index.ts +6 -0
- package/src/three/MetricsGalaxy/types.ts +26 -0
- package/src/three/NetworkTopology/NetworkTopology.stories.tsx +184 -0
- package/src/three/NetworkTopology/NetworkTopology.tsx +421 -0
- package/src/three/NetworkTopology/index.ts +34 -0
- package/src/three/NetworkTopology/types.ts +128 -0
- package/src/three/ParticleField/ParticleField.stories.tsx +162 -0
- package/src/three/ParticleField/ParticleField.tsx +81 -0
- package/src/three/ParticleField/index.ts +1 -0
- package/src/three/PermissionMatrix/PermissionMatrix.stories.tsx +475 -0
- package/src/three/PermissionMatrix/PermissionMatrix.tsx +380 -0
- package/src/three/PermissionMatrix/index.ts +15 -0
- package/src/three/PermissionMatrix/types.ts +54 -0
- package/src/three/QuantumField/ConstellationField.tsx +238 -0
- package/src/three/QuantumField/FieldBus.ts +349 -0
- package/src/three/QuantumField/FieldLayer.tsx +430 -0
- package/src/three/QuantumField/FieldProvider.tsx +460 -0
- package/src/three/QuantumField/PcbField.tsx +406 -0
- package/src/three/QuantumField/QuantumField.stories.tsx +1155 -0
- package/src/three/QuantumField/TrailRTT.ts +212 -0
- package/src/three/QuantumField/WaterField.tsx +226 -0
- package/src/three/QuantumField/WaterSimRTT.ts +283 -0
- package/src/three/QuantumField/domMapping.ts +185 -0
- package/src/three/QuantumField/index.ts +110 -0
- package/src/three/QuantumField/styles/index.ts +9 -0
- package/src/three/QuantumField/styles/styleA.ts +526 -0
- package/src/three/QuantumField/styles/styleB.ts +1210 -0
- package/src/three/QuantumField/styles/styleC.ts +266 -0
- package/src/three/QuantumField/themes.ts +211 -0
- package/src/three/QuantumField/types.ts +380 -0
- package/src/three/SOCCommandCenter/SOCCommandCenter.stories.tsx +591 -0
- package/src/three/SOCCommandCenter/SOCCommandCenter.tsx +248 -0
- package/src/three/SOCCommandCenter/index.ts +26 -0
- package/src/three/SOCCommandCenter/types.ts +201 -0
- package/src/three/SecurityDashboard/SecurityDashboard.stories.tsx +508 -0
- package/src/three/SecurityDashboard/SecurityDashboard.tsx +507 -0
- package/src/three/SecurityDashboard/index.ts +37 -0
- package/src/three/SecurityDashboard/types.ts +143 -0
- package/src/three/SecurityShield/SecurityShield.stories.tsx +257 -0
- package/src/three/SecurityShield/SecurityShield.tsx +502 -0
- package/src/three/SecurityShield/index.ts +25 -0
- package/src/three/SecurityShield/types.ts +64 -0
- package/src/three/Sentinel/AvatarMode.tsx +578 -0
- package/src/three/Sentinel/AvatarRenderer.tsx +199 -0
- package/src/three/Sentinel/CameraPip.tsx +127 -0
- package/src/three/Sentinel/CardinalItem.tsx +83 -0
- package/src/three/Sentinel/CardinalMenu.tsx +370 -0
- package/src/three/Sentinel/DockedMiniOrb.tsx +146 -0
- package/src/three/Sentinel/RadialSubmenu.tsx +273 -0
- package/src/three/Sentinel/SentinelConversation.tsx +802 -0
- package/src/three/Sentinel/SentinelOrb.tsx +316 -0
- package/src/three/Sentinel/SentinelOverlay.tsx +146 -0
- package/src/three/Sentinel/SentinelProvider.tsx +145 -0
- package/src/three/Sentinel/SentinelTether.tsx +182 -0
- package/src/three/Sentinel/SigilPlaceholder.tsx +176 -0
- package/src/three/Sentinel/VerticalSubmenu.tsx +150 -0
- package/src/three/Sentinel/index.ts +145 -0
- package/src/three/Sentinel/sentinelStore.ts +196 -0
- package/src/three/Sentinel/types.ts +403 -0
- package/src/three/Sentinel/useCameraPermission.ts +153 -0
- package/src/three/Sentinel/useThrowPhysics.ts +220 -0
- package/src/three/SpatialWorkspace/CyntraWorkspace.tsx +84 -0
- package/src/three/SpatialWorkspace/JobCluster.tsx +281 -0
- package/src/three/SpatialWorkspace/NodeGraph.tsx +236 -0
- package/src/three/SpatialWorkspace/ReceiptOrbit.tsx +368 -0
- package/src/three/SpatialWorkspace/SpatialWorkspace.stories.tsx +547 -0
- package/src/three/SpatialWorkspace/SpatialWorkspace.tsx +428 -0
- package/src/three/SpatialWorkspace/TrustRings.tsx +228 -0
- package/src/three/SpatialWorkspace/adapters.ts +353 -0
- package/src/three/SpatialWorkspace/index.ts +85 -0
- package/src/three/SpatialWorkspace/nexusAdapter.ts +182 -0
- package/src/three/SpatialWorkspace/types.ts +389 -0
- package/src/three/ThreatRadar/ThreatRadar.stories.tsx +451 -0
- package/src/three/ThreatRadar/ThreatRadar.tsx +542 -0
- package/src/three/ThreatRadar/index.ts +8 -0
- package/src/three/ThreatRadar/types.ts +90 -0
- package/src/three/ThreeErrorBoundary/ThreeErrorBoundary.tsx +235 -0
- package/src/three/ThreeErrorBoundary/index.ts +5 -0
- package/src/three/index.ts +56 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +21 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { AgentConsole } from "./AgentConsole";
|
|
3
|
+
import type { Message, FocusNode, QuickAction, AgentState, AgentMode } from "./types";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof AgentConsole> = {
|
|
6
|
+
title: "Primitives/3D/Agent/AgentConsole",
|
|
7
|
+
component: AgentConsole,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "fullscreen",
|
|
10
|
+
backgrounds: { default: "dark" },
|
|
11
|
+
},
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
argTypes: {
|
|
14
|
+
agentState: {
|
|
15
|
+
control: "select",
|
|
16
|
+
options: ["idle", "listening", "thinking", "responding", "error"],
|
|
17
|
+
},
|
|
18
|
+
agentMode: {
|
|
19
|
+
control: "select",
|
|
20
|
+
options: ["conversational", "monitoring", "focused", "commanding"],
|
|
21
|
+
},
|
|
22
|
+
trustTier: {
|
|
23
|
+
control: "select",
|
|
24
|
+
options: ["bronze", "silver", "gold"],
|
|
25
|
+
},
|
|
26
|
+
isTyping: {
|
|
27
|
+
control: "boolean",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
type Story = StoryObj<typeof AgentConsole>;
|
|
34
|
+
|
|
35
|
+
// Mock data
|
|
36
|
+
const sampleMessages: Message[] = [
|
|
37
|
+
{
|
|
38
|
+
id: "1",
|
|
39
|
+
role: "user",
|
|
40
|
+
content: "What's the status of the current jobs?",
|
|
41
|
+
timestamp: new Date(Date.now() - 60000).toISOString(),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "2",
|
|
45
|
+
role: "agent",
|
|
46
|
+
content: "I can see 3 running jobs and 2 queued. The fab network is operating normally with all nodes online.",
|
|
47
|
+
timestamp: new Date(Date.now() - 45000).toISOString(),
|
|
48
|
+
thinking: "Checking job status across all clusters...",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "3",
|
|
52
|
+
role: "user",
|
|
53
|
+
content: "Can you prioritize job-42?",
|
|
54
|
+
timestamp: new Date(Date.now() - 30000).toISOString(),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "4",
|
|
58
|
+
role: "agent",
|
|
59
|
+
content: "Done! Job-42 has been moved to high priority. It should start processing within the next few seconds.",
|
|
60
|
+
timestamp: new Date(Date.now() - 15000).toISOString(),
|
|
61
|
+
toolCalls: [
|
|
62
|
+
{
|
|
63
|
+
id: "tc-1",
|
|
64
|
+
name: "prioritize_job",
|
|
65
|
+
arguments: { job_id: "job-42", priority: "high" },
|
|
66
|
+
result: { success: true },
|
|
67
|
+
status: "completed",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
const sampleFocusNodes: FocusNode[] = [
|
|
74
|
+
{
|
|
75
|
+
id: "focus-1",
|
|
76
|
+
label: "Job 42",
|
|
77
|
+
kind: "job",
|
|
78
|
+
importance: 0.9,
|
|
79
|
+
hasUnread: true,
|
|
80
|
+
entityRef: { type: "job", id: "job-42" },
|
|
81
|
+
description: "High priority render task",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "focus-2",
|
|
85
|
+
label: "Node Alpha",
|
|
86
|
+
kind: "node",
|
|
87
|
+
importance: 0.7,
|
|
88
|
+
entityRef: { type: "node", id: "node-alpha" },
|
|
89
|
+
description: "Primary compute node",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "focus-3",
|
|
93
|
+
label: "Warning",
|
|
94
|
+
kind: "warning",
|
|
95
|
+
importance: 0.8,
|
|
96
|
+
description: "Node Beta is degraded",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "focus-4",
|
|
100
|
+
label: "Context",
|
|
101
|
+
kind: "context",
|
|
102
|
+
importance: 0.5,
|
|
103
|
+
description: "Current workspace context",
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
const sampleQuickActions: QuickAction[] = [
|
|
108
|
+
{
|
|
109
|
+
id: "action-1",
|
|
110
|
+
label: "New Job",
|
|
111
|
+
icon: "plus",
|
|
112
|
+
shortcut: "N",
|
|
113
|
+
enabled: true,
|
|
114
|
+
category: "primary",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "action-2",
|
|
118
|
+
label: "Pause All",
|
|
119
|
+
icon: "pause",
|
|
120
|
+
shortcut: "P",
|
|
121
|
+
enabled: true,
|
|
122
|
+
category: "secondary",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "action-3",
|
|
126
|
+
label: "Emergency Stop",
|
|
127
|
+
icon: "alert",
|
|
128
|
+
shortcut: "Esc",
|
|
129
|
+
enabled: true,
|
|
130
|
+
category: "danger",
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
const handlePromptSubmit = (text: string) => {
|
|
135
|
+
console.log("Prompt submitted:", text);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const Idle: Story = {
|
|
139
|
+
args: {
|
|
140
|
+
agentState: "idle",
|
|
141
|
+
agentMode: "conversational",
|
|
142
|
+
trustTier: "silver",
|
|
143
|
+
isTyping: false,
|
|
144
|
+
messages: sampleMessages,
|
|
145
|
+
focusNodes: sampleFocusNodes,
|
|
146
|
+
quickActions: sampleQuickActions,
|
|
147
|
+
onPromptSubmit: handlePromptSubmit,
|
|
148
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
149
|
+
onFocusNodeClick: (id) => console.log("Focus node clicked:", id),
|
|
150
|
+
style: { width: "100%", height: "600px" },
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const Listening: Story = {
|
|
155
|
+
args: {
|
|
156
|
+
agentState: "listening",
|
|
157
|
+
agentMode: "conversational",
|
|
158
|
+
trustTier: "silver",
|
|
159
|
+
isTyping: false,
|
|
160
|
+
messages: sampleMessages,
|
|
161
|
+
focusNodes: sampleFocusNodes,
|
|
162
|
+
quickActions: sampleQuickActions,
|
|
163
|
+
onPromptSubmit: handlePromptSubmit,
|
|
164
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
165
|
+
style: { width: "100%", height: "600px" },
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const Thinking: Story = {
|
|
170
|
+
args: {
|
|
171
|
+
agentState: "thinking",
|
|
172
|
+
agentMode: "conversational",
|
|
173
|
+
trustTier: "silver",
|
|
174
|
+
isTyping: true,
|
|
175
|
+
messages: sampleMessages,
|
|
176
|
+
focusNodes: sampleFocusNodes,
|
|
177
|
+
quickActions: sampleQuickActions,
|
|
178
|
+
onPromptSubmit: handlePromptSubmit,
|
|
179
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
180
|
+
style: { width: "100%", height: "600px" },
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export const Responding: Story = {
|
|
185
|
+
args: {
|
|
186
|
+
agentState: "responding",
|
|
187
|
+
agentMode: "conversational",
|
|
188
|
+
trustTier: "silver",
|
|
189
|
+
isTyping: true,
|
|
190
|
+
messages: sampleMessages,
|
|
191
|
+
focusNodes: sampleFocusNodes,
|
|
192
|
+
quickActions: sampleQuickActions,
|
|
193
|
+
onPromptSubmit: handlePromptSubmit,
|
|
194
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
195
|
+
style: { width: "100%", height: "600px" },
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export const Error: Story = {
|
|
200
|
+
args: {
|
|
201
|
+
agentState: "error",
|
|
202
|
+
agentMode: "conversational",
|
|
203
|
+
trustTier: "silver",
|
|
204
|
+
isTyping: false,
|
|
205
|
+
messages: [
|
|
206
|
+
...sampleMessages,
|
|
207
|
+
{
|
|
208
|
+
id: "error-1",
|
|
209
|
+
role: "system" as const,
|
|
210
|
+
content: "Connection to fab network lost. Attempting to reconnect...",
|
|
211
|
+
timestamp: new Date().toISOString(),
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
focusNodes: sampleFocusNodes,
|
|
215
|
+
quickActions: sampleQuickActions,
|
|
216
|
+
onPromptSubmit: handlePromptSubmit,
|
|
217
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
218
|
+
style: { width: "100%", height: "600px" },
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const MonitoringMode: Story = {
|
|
223
|
+
args: {
|
|
224
|
+
agentState: "idle",
|
|
225
|
+
agentMode: "monitoring",
|
|
226
|
+
trustTier: "gold",
|
|
227
|
+
isTyping: false,
|
|
228
|
+
messages: [
|
|
229
|
+
{
|
|
230
|
+
id: "m-1",
|
|
231
|
+
role: "agent",
|
|
232
|
+
content: "Monitoring mode active. I'll alert you to any significant changes.",
|
|
233
|
+
timestamp: new Date().toISOString(),
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
focusNodes: [
|
|
237
|
+
{ id: "f-1", label: "CPU Usage", kind: "context", importance: 0.6 },
|
|
238
|
+
{ id: "f-2", label: "Active Jobs", kind: "job", importance: 0.8 },
|
|
239
|
+
{ id: "f-3", label: "Network", kind: "node", importance: 0.5 },
|
|
240
|
+
],
|
|
241
|
+
quickActions: sampleQuickActions,
|
|
242
|
+
onPromptSubmit: handlePromptSubmit,
|
|
243
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
244
|
+
style: { width: "100%", height: "600px" },
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export const FocusedMode: Story = {
|
|
249
|
+
args: {
|
|
250
|
+
agentState: "thinking",
|
|
251
|
+
agentMode: "focused",
|
|
252
|
+
trustTier: "silver",
|
|
253
|
+
isTyping: true,
|
|
254
|
+
messages: [
|
|
255
|
+
{
|
|
256
|
+
id: "m-1",
|
|
257
|
+
role: "user",
|
|
258
|
+
content: "Analyze job-42 in detail",
|
|
259
|
+
timestamp: new Date(Date.now() - 10000).toISOString(),
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
id: "m-2",
|
|
263
|
+
role: "agent",
|
|
264
|
+
content: "Focusing on job-42. Analyzing execution history, dependencies, and performance metrics...",
|
|
265
|
+
timestamp: new Date().toISOString(),
|
|
266
|
+
thinking: "Gathering detailed metrics from job execution logs...",
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
focusNodes: sampleFocusNodes,
|
|
270
|
+
focusedNodeId: "focus-1",
|
|
271
|
+
quickActions: sampleQuickActions,
|
|
272
|
+
onPromptSubmit: handlePromptSubmit,
|
|
273
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
274
|
+
onFocusNodeClick: (id) => console.log("Focus node clicked:", id),
|
|
275
|
+
style: { width: "100%", height: "600px" },
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export const CommandingMode: Story = {
|
|
280
|
+
args: {
|
|
281
|
+
agentState: "responding",
|
|
282
|
+
agentMode: "commanding",
|
|
283
|
+
trustTier: "gold",
|
|
284
|
+
isTyping: true,
|
|
285
|
+
messages: [
|
|
286
|
+
{
|
|
287
|
+
id: "m-1",
|
|
288
|
+
role: "user",
|
|
289
|
+
content: "Execute emergency failover",
|
|
290
|
+
timestamp: new Date(Date.now() - 5000).toISOString(),
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
id: "m-2",
|
|
294
|
+
role: "agent",
|
|
295
|
+
content: "Initiating emergency failover sequence...",
|
|
296
|
+
timestamp: new Date().toISOString(),
|
|
297
|
+
toolCalls: [
|
|
298
|
+
{
|
|
299
|
+
id: "tc-1",
|
|
300
|
+
name: "emergency_failover",
|
|
301
|
+
arguments: { confirm: true },
|
|
302
|
+
status: "running",
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
focusNodes: [
|
|
308
|
+
{ id: "f-1", label: "Failover", kind: "action", importance: 1.0 },
|
|
309
|
+
{ id: "f-2", label: "Warning", kind: "warning", importance: 0.9 },
|
|
310
|
+
],
|
|
311
|
+
quickActions: [
|
|
312
|
+
{ id: "cancel", label: "Cancel", category: "danger", enabled: true },
|
|
313
|
+
],
|
|
314
|
+
onPromptSubmit: handlePromptSubmit,
|
|
315
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
316
|
+
style: { width: "100%", height: "600px" },
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export const BronzeTier: Story = {
|
|
321
|
+
args: {
|
|
322
|
+
agentState: "idle",
|
|
323
|
+
agentMode: "conversational",
|
|
324
|
+
trustTier: "bronze",
|
|
325
|
+
isTyping: false,
|
|
326
|
+
messages: sampleMessages.slice(0, 2),
|
|
327
|
+
focusNodes: sampleFocusNodes.slice(0, 2),
|
|
328
|
+
quickActions: sampleQuickActions.slice(0, 2),
|
|
329
|
+
onPromptSubmit: handlePromptSubmit,
|
|
330
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
331
|
+
style: { width: "100%", height: "600px" },
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export const GoldTier: Story = {
|
|
336
|
+
args: {
|
|
337
|
+
agentState: "idle",
|
|
338
|
+
agentMode: "conversational",
|
|
339
|
+
trustTier: "gold",
|
|
340
|
+
isTyping: false,
|
|
341
|
+
messages: sampleMessages,
|
|
342
|
+
focusNodes: sampleFocusNodes,
|
|
343
|
+
quickActions: sampleQuickActions,
|
|
344
|
+
onPromptSubmit: handlePromptSubmit,
|
|
345
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
346
|
+
style: { width: "100%", height: "600px" },
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export const MinimalUI: Story = {
|
|
351
|
+
args: {
|
|
352
|
+
agentState: "idle",
|
|
353
|
+
agentMode: "conversational",
|
|
354
|
+
trustTier: "silver",
|
|
355
|
+
isTyping: false,
|
|
356
|
+
messages: [],
|
|
357
|
+
focusNodes: [],
|
|
358
|
+
quickActions: [],
|
|
359
|
+
onPromptSubmit: handlePromptSubmit,
|
|
360
|
+
style: { width: "100%", height: "600px" },
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
export const LongConversation: Story = {
|
|
365
|
+
args: {
|
|
366
|
+
agentState: "idle",
|
|
367
|
+
agentMode: "conversational",
|
|
368
|
+
trustTier: "silver",
|
|
369
|
+
isTyping: false,
|
|
370
|
+
messages: [
|
|
371
|
+
...sampleMessages,
|
|
372
|
+
{
|
|
373
|
+
id: "5",
|
|
374
|
+
role: "user" as const,
|
|
375
|
+
content: "What about the node performance?",
|
|
376
|
+
timestamp: new Date(Date.now() - 10000).toISOString(),
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
id: "6",
|
|
380
|
+
role: "agent" as const,
|
|
381
|
+
content: "All nodes are performing within normal parameters. Node Alpha is at 72% capacity, Node Beta at 45%.",
|
|
382
|
+
timestamp: new Date(Date.now() - 5000).toISOString(),
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
id: "7",
|
|
386
|
+
role: "user" as const,
|
|
387
|
+
content: "Scale up Node Beta",
|
|
388
|
+
timestamp: new Date().toISOString(),
|
|
389
|
+
},
|
|
390
|
+
],
|
|
391
|
+
focusNodes: sampleFocusNodes,
|
|
392
|
+
quickActions: sampleQuickActions,
|
|
393
|
+
onPromptSubmit: handlePromptSubmit,
|
|
394
|
+
onQuickAction: (id) => console.log("Quick action:", id),
|
|
395
|
+
style: { width: "100%", height: "600px" },
|
|
396
|
+
},
|
|
397
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AgentConsole - Main conversational agent interface
|
|
5
|
+
*
|
|
6
|
+
* Integrates GlyphAvatar, ConsoleChat, QuickActions, and FocusConstellation
|
|
7
|
+
* into a unified agent interface experience.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Canvas } from "@react-three/fiber";
|
|
11
|
+
import { OrbitControls } from "@react-three/drei";
|
|
12
|
+
import { GlyphAvatar } from "./GlyphAvatar";
|
|
13
|
+
import { ConsoleChat } from "./ConsoleChat";
|
|
14
|
+
import { QuickActions } from "./QuickActions";
|
|
15
|
+
import { FocusConstellation } from "./FocusConstellation";
|
|
16
|
+
import type { AgentConsoleProps, Message, FocusNode, QuickAction } from "./types";
|
|
17
|
+
|
|
18
|
+
// -----------------------------------------------------------------------------
|
|
19
|
+
// Console Scene (inside Canvas)
|
|
20
|
+
// -----------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
interface ConsoleSceneProps {
|
|
23
|
+
agentState: AgentConsoleProps["agentState"];
|
|
24
|
+
agentMode: AgentConsoleProps["agentMode"];
|
|
25
|
+
trustTier: AgentConsoleProps["trustTier"];
|
|
26
|
+
isTyping: boolean;
|
|
27
|
+
messages: Message[];
|
|
28
|
+
focusNodes: FocusNode[];
|
|
29
|
+
quickActions: QuickAction[];
|
|
30
|
+
focusedNodeId: string | null;
|
|
31
|
+
onPromptSubmit: (text: string) => void;
|
|
32
|
+
onFocusNodeClick?: (id: string) => void;
|
|
33
|
+
onQuickAction?: (actionId: string) => void;
|
|
34
|
+
onEntityClick?: AgentConsoleProps["onEntityClick"];
|
|
35
|
+
onAvatarClick?: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ConsoleScene({
|
|
39
|
+
agentState,
|
|
40
|
+
agentMode,
|
|
41
|
+
trustTier,
|
|
42
|
+
isTyping,
|
|
43
|
+
messages,
|
|
44
|
+
focusNodes,
|
|
45
|
+
quickActions,
|
|
46
|
+
focusedNodeId,
|
|
47
|
+
onPromptSubmit,
|
|
48
|
+
onFocusNodeClick,
|
|
49
|
+
onQuickAction,
|
|
50
|
+
onEntityClick,
|
|
51
|
+
onAvatarClick,
|
|
52
|
+
}: ConsoleSceneProps) {
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
{/* Camera controls */}
|
|
56
|
+
<OrbitControls
|
|
57
|
+
enablePan={false}
|
|
58
|
+
enableZoom={true}
|
|
59
|
+
minDistance={2}
|
|
60
|
+
maxDistance={8}
|
|
61
|
+
maxPolarAngle={Math.PI / 2 + 0.3}
|
|
62
|
+
autoRotate={false}
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
{/* Lighting */}
|
|
66
|
+
<ambientLight intensity={0.4} />
|
|
67
|
+
<directionalLight position={[5, 5, 5]} intensity={0.6} />
|
|
68
|
+
<directionalLight position={[-5, -5, -5]} intensity={0.2} />
|
|
69
|
+
|
|
70
|
+
{/* Central agent avatar */}
|
|
71
|
+
<GlyphAvatar
|
|
72
|
+
state={agentState}
|
|
73
|
+
mode={agentMode}
|
|
74
|
+
trustTier={trustTier}
|
|
75
|
+
position={[0, 0, 0]}
|
|
76
|
+
scale={1}
|
|
77
|
+
onClick={onAvatarClick}
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
{/* Focus constellation around avatar */}
|
|
81
|
+
{focusNodes.length > 0 && (
|
|
82
|
+
<FocusConstellation
|
|
83
|
+
nodes={focusNodes}
|
|
84
|
+
focusedId={focusedNodeId}
|
|
85
|
+
onNodeClick={onFocusNodeClick}
|
|
86
|
+
radius={1.5}
|
|
87
|
+
position={[0, 0, 0]}
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
|
|
91
|
+
{/* Quick actions above avatar */}
|
|
92
|
+
{quickActions.length > 0 && onQuickAction && (
|
|
93
|
+
<QuickActions
|
|
94
|
+
actions={quickActions}
|
|
95
|
+
onAction={onQuickAction}
|
|
96
|
+
direction="horizontal"
|
|
97
|
+
position={[0, 1.2, 0]}
|
|
98
|
+
/>
|
|
99
|
+
)}
|
|
100
|
+
|
|
101
|
+
{/* Chat interface below avatar */}
|
|
102
|
+
<ConsoleChat
|
|
103
|
+
messages={messages}
|
|
104
|
+
isTyping={isTyping}
|
|
105
|
+
onSubmit={onPromptSubmit}
|
|
106
|
+
onEntityClick={onEntityClick}
|
|
107
|
+
position={[0, -1.5, 0]}
|
|
108
|
+
maxVisibleMessages={8}
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
{/* Subtle grid for grounding */}
|
|
112
|
+
<gridHelper args={[10, 20, "#1a1a2e", "#1a1a2e"]} position={[0, -2, 0]} />
|
|
113
|
+
</>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// -----------------------------------------------------------------------------
|
|
118
|
+
// Agent Console Container
|
|
119
|
+
// -----------------------------------------------------------------------------
|
|
120
|
+
|
|
121
|
+
export function AgentConsole({
|
|
122
|
+
agentState,
|
|
123
|
+
agentMode = "conversational",
|
|
124
|
+
trustTier = "bronze",
|
|
125
|
+
isTyping = false,
|
|
126
|
+
messages = [],
|
|
127
|
+
focusNodes = [],
|
|
128
|
+
quickActions = [],
|
|
129
|
+
focusedNodeId = null,
|
|
130
|
+
onPromptSubmit,
|
|
131
|
+
onFocusNodeClick,
|
|
132
|
+
onQuickAction,
|
|
133
|
+
onEntityClick,
|
|
134
|
+
onAvatarClick,
|
|
135
|
+
className,
|
|
136
|
+
style,
|
|
137
|
+
}: AgentConsoleProps) {
|
|
138
|
+
return (
|
|
139
|
+
<div
|
|
140
|
+
className={className}
|
|
141
|
+
style={{
|
|
142
|
+
position: "relative",
|
|
143
|
+
width: "100%",
|
|
144
|
+
height: "100%",
|
|
145
|
+
background: "linear-gradient(to bottom, #0a0a15, #050510)",
|
|
146
|
+
...style,
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<Canvas
|
|
150
|
+
camera={{
|
|
151
|
+
position: [0, 1, 4],
|
|
152
|
+
fov: 50,
|
|
153
|
+
near: 0.1,
|
|
154
|
+
far: 100,
|
|
155
|
+
}}
|
|
156
|
+
dpr={[1, 2]}
|
|
157
|
+
>
|
|
158
|
+
<ConsoleScene
|
|
159
|
+
agentState={agentState}
|
|
160
|
+
agentMode={agentMode}
|
|
161
|
+
trustTier={trustTier}
|
|
162
|
+
isTyping={isTyping}
|
|
163
|
+
messages={messages}
|
|
164
|
+
focusNodes={focusNodes}
|
|
165
|
+
quickActions={quickActions}
|
|
166
|
+
focusedNodeId={focusedNodeId}
|
|
167
|
+
onPromptSubmit={onPromptSubmit}
|
|
168
|
+
onFocusNodeClick={onFocusNodeClick}
|
|
169
|
+
onQuickAction={onQuickAction}
|
|
170
|
+
onEntityClick={onEntityClick}
|
|
171
|
+
onAvatarClick={onAvatarClick}
|
|
172
|
+
/>
|
|
173
|
+
</Canvas>
|
|
174
|
+
|
|
175
|
+
{/* State indicator overlay */}
|
|
176
|
+
<div className="absolute top-4 right-4 bg-black/60 text-white/60 text-xs font-mono p-2 rounded">
|
|
177
|
+
<div className="flex items-center gap-2">
|
|
178
|
+
<span
|
|
179
|
+
className="w-2 h-2 rounded-full"
|
|
180
|
+
style={{
|
|
181
|
+
backgroundColor:
|
|
182
|
+
agentState === "idle" ? "#6366f1" :
|
|
183
|
+
agentState === "listening" ? "#22c55e" :
|
|
184
|
+
agentState === "thinking" ? "#eab308" :
|
|
185
|
+
agentState === "responding" ? "#3b82f6" :
|
|
186
|
+
"#ef4444",
|
|
187
|
+
}}
|
|
188
|
+
/>
|
|
189
|
+
<span>{agentState.toUpperCase()}</span>
|
|
190
|
+
</div>
|
|
191
|
+
<div className="text-white/40 mt-1">{agentMode}</div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
}
|