@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,509 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CrystallineOrganism Stories
|
|
3
|
+
*
|
|
4
|
+
* Storybook stories demonstrating emotion-driven crystalline organisms.
|
|
5
|
+
* Uses the same AVO emotion system as the Glyph.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
9
|
+
import { Canvas } from "@react-three/fiber";
|
|
10
|
+
import { OrbitControls } from "@react-three/drei";
|
|
11
|
+
import { useState, useEffect } from "react";
|
|
12
|
+
|
|
13
|
+
import { CrystallineOrganism } from "./CrystallineOrganism";
|
|
14
|
+
import { OrganismShell } from "./OrganismShell";
|
|
15
|
+
import { OrganismLattice } from "./OrganismLattice";
|
|
16
|
+
import { Breadcrumb } from "./Breadcrumb";
|
|
17
|
+
import { ORGANISM_BASE_SIZE } from "./constants";
|
|
18
|
+
import { ANCHOR_STATES, computeVisualState } from "@backbay/glia-agent/emotion";
|
|
19
|
+
import type {
|
|
20
|
+
OrganismType,
|
|
21
|
+
OrganismState,
|
|
22
|
+
OrganismPower,
|
|
23
|
+
CrystallineOrganismProps,
|
|
24
|
+
LatticeEdge as LatticeEdgeType,
|
|
25
|
+
} from "./types";
|
|
26
|
+
|
|
27
|
+
// -----------------------------------------------------------------------------
|
|
28
|
+
// Story Setup
|
|
29
|
+
// -----------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
const CanvasWrapper = ({ children }: { children: React.ReactNode }) => (
|
|
32
|
+
<div
|
|
33
|
+
style={{
|
|
34
|
+
width: "100%",
|
|
35
|
+
height: "500px",
|
|
36
|
+
background: "linear-gradient(to bottom, #050812, #0a0f1a)",
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<Canvas camera={{ position: [0, 2, 5], fov: 50 }} dpr={[1, 2]}>
|
|
40
|
+
<ambientLight intensity={0.3} />
|
|
41
|
+
<directionalLight position={[5, 5, 5]} intensity={0.6} />
|
|
42
|
+
<directionalLight position={[-5, 3, -5]} intensity={0.3} />
|
|
43
|
+
<OrbitControls enablePan={false} />
|
|
44
|
+
{children}
|
|
45
|
+
</Canvas>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// -----------------------------------------------------------------------------
|
|
50
|
+
// Shell Stories - Demonstrates geometry + emotion-driven visuals
|
|
51
|
+
// -----------------------------------------------------------------------------
|
|
52
|
+
|
|
53
|
+
const ShellMeta: Meta<typeof OrganismShell> = {
|
|
54
|
+
title: "Primitives/3D/Fields/CrystallineOrganism/Shell",
|
|
55
|
+
component: OrganismShell,
|
|
56
|
+
decorators: [
|
|
57
|
+
(Story) => (
|
|
58
|
+
<CanvasWrapper>
|
|
59
|
+
<Story />
|
|
60
|
+
</CanvasWrapper>
|
|
61
|
+
),
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default ShellMeta;
|
|
66
|
+
|
|
67
|
+
type ShellStory = StoryObj<typeof OrganismShell>;
|
|
68
|
+
|
|
69
|
+
export const AllGeometries: ShellStory = {
|
|
70
|
+
name: "Geometry Types",
|
|
71
|
+
render: () => {
|
|
72
|
+
const types: OrganismType[] = [
|
|
73
|
+
"kernel",
|
|
74
|
+
"agent",
|
|
75
|
+
"workcell",
|
|
76
|
+
"task",
|
|
77
|
+
"storage",
|
|
78
|
+
"relay",
|
|
79
|
+
];
|
|
80
|
+
// All using idle state visual
|
|
81
|
+
const idleVisual = computeVisualState(ANCHOR_STATES.idle);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
{types.map((type, i) => (
|
|
86
|
+
<group key={type} position={[(i - 2.5) * 1.5, 0, 0]}>
|
|
87
|
+
<OrganismShell
|
|
88
|
+
type={type}
|
|
89
|
+
visualState={idleVisual}
|
|
90
|
+
size={ORGANISM_BASE_SIZE[type]}
|
|
91
|
+
/>
|
|
92
|
+
</group>
|
|
93
|
+
))}
|
|
94
|
+
</>
|
|
95
|
+
);
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const EmotionalStates: ShellStory = {
|
|
100
|
+
name: "Emotional States",
|
|
101
|
+
render: () => {
|
|
102
|
+
const states: Array<{ name: string; avo: typeof ANCHOR_STATES.idle }> = [
|
|
103
|
+
{ name: "idle", avo: ANCHOR_STATES.idle },
|
|
104
|
+
{ name: "attentive", avo: ANCHOR_STATES.attentive },
|
|
105
|
+
{ name: "thinking", avo: ANCHOR_STATES.thinking },
|
|
106
|
+
{ name: "enthusiastic", avo: ANCHOR_STATES.enthusiastic },
|
|
107
|
+
{ name: "error", avo: ANCHOR_STATES.error },
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<>
|
|
112
|
+
{states.map((state, i) => (
|
|
113
|
+
<group key={state.name} position={[(i - 2) * 1.8, 0, 0]}>
|
|
114
|
+
<OrganismShell
|
|
115
|
+
type="kernel"
|
|
116
|
+
visualState={computeVisualState(state.avo)}
|
|
117
|
+
size={0.5}
|
|
118
|
+
/>
|
|
119
|
+
</group>
|
|
120
|
+
))}
|
|
121
|
+
</>
|
|
122
|
+
);
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const SelectionStates: ShellStory = {
|
|
127
|
+
name: "Selection States",
|
|
128
|
+
render: () => {
|
|
129
|
+
const visualState = computeVisualState(ANCHOR_STATES.idle);
|
|
130
|
+
return (
|
|
131
|
+
<>
|
|
132
|
+
<group position={[-2, 0, 0]}>
|
|
133
|
+
<OrganismShell
|
|
134
|
+
type="agent"
|
|
135
|
+
visualState={visualState}
|
|
136
|
+
size={0.45}
|
|
137
|
+
/>
|
|
138
|
+
</group>
|
|
139
|
+
<group position={[0, 0, 0]}>
|
|
140
|
+
<OrganismShell
|
|
141
|
+
type="agent"
|
|
142
|
+
visualState={visualState}
|
|
143
|
+
size={0.45}
|
|
144
|
+
hovered
|
|
145
|
+
/>
|
|
146
|
+
</group>
|
|
147
|
+
<group position={[2, 0, 0]}>
|
|
148
|
+
<OrganismShell
|
|
149
|
+
type="agent"
|
|
150
|
+
visualState={visualState}
|
|
151
|
+
size={0.45}
|
|
152
|
+
selected
|
|
153
|
+
/>
|
|
154
|
+
</group>
|
|
155
|
+
</>
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// -----------------------------------------------------------------------------
|
|
161
|
+
// Full Organism Stories - Demonstrates the complete component with emotion
|
|
162
|
+
// -----------------------------------------------------------------------------
|
|
163
|
+
|
|
164
|
+
function SingleOrganismStory() {
|
|
165
|
+
const [selected, setSelected] = useState<string | null>(null);
|
|
166
|
+
const [state, setState] = useState<OrganismState>("idle");
|
|
167
|
+
|
|
168
|
+
// Cycle through states for demo
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
const states: OrganismState[] = ["idle", "listening", "thinking", "responding", "success"];
|
|
171
|
+
let i = 0;
|
|
172
|
+
const interval = setInterval(() => {
|
|
173
|
+
i = (i + 1) % states.length;
|
|
174
|
+
setState(states[i]);
|
|
175
|
+
}, 2000);
|
|
176
|
+
return () => clearInterval(interval);
|
|
177
|
+
}, []);
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<CrystallineOrganism
|
|
181
|
+
id="kernel-01"
|
|
182
|
+
type="kernel"
|
|
183
|
+
label="Kernel-01"
|
|
184
|
+
state={state}
|
|
185
|
+
power="elevated"
|
|
186
|
+
selected={selected === "kernel-01"}
|
|
187
|
+
onSelect={setSelected}
|
|
188
|
+
/>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export const SingleOrganism: StoryObj<typeof CrystallineOrganism> = {
|
|
193
|
+
name: "Single Organism (Animated)",
|
|
194
|
+
render: () => <SingleOrganismStory />,
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
function OrganismGridStory() {
|
|
198
|
+
const [selected, setSelected] = useState<string | null>(null);
|
|
199
|
+
|
|
200
|
+
const organisms: Array<{
|
|
201
|
+
id: string;
|
|
202
|
+
type: OrganismType;
|
|
203
|
+
label: string;
|
|
204
|
+
state: OrganismState;
|
|
205
|
+
power: OrganismPower;
|
|
206
|
+
position: [number, number, number];
|
|
207
|
+
}> = [
|
|
208
|
+
{ id: "kernel", type: "kernel", label: "Kernel", state: "responding", power: "elevated", position: [-2, 0, -2] },
|
|
209
|
+
{ id: "wc-01", type: "workcell", label: "WC-01", state: "busy", power: "standard", position: [0, 0, -2] },
|
|
210
|
+
{ id: "wc-02", type: "workcell", label: "WC-02", state: "thinking", power: "standard", position: [2, 0, -2] },
|
|
211
|
+
{ id: "agent-01", type: "agent", label: "Agent-01", state: "idle", power: "standard", position: [-2, 0, 0] },
|
|
212
|
+
{ id: "agent-02", type: "agent", label: "Agent-02", state: "error", power: "standard", position: [0, 0, 0] },
|
|
213
|
+
{ id: "task-01", type: "task", label: "Task-01", state: "success", power: "minimal", position: [2, 0, 0] },
|
|
214
|
+
{ id: "storage", type: "storage", label: "Storage", state: "sleep", power: "standard", position: [-1, 0, 2] },
|
|
215
|
+
{ id: "relay", type: "relay", label: "Relay", state: "listening", power: "standard", position: [1, 0, 2] },
|
|
216
|
+
];
|
|
217
|
+
|
|
218
|
+
return (
|
|
219
|
+
<>
|
|
220
|
+
{organisms.map((org) => (
|
|
221
|
+
<CrystallineOrganism
|
|
222
|
+
key={org.id}
|
|
223
|
+
id={org.id}
|
|
224
|
+
type={org.type}
|
|
225
|
+
label={org.label}
|
|
226
|
+
state={org.state}
|
|
227
|
+
power={org.power}
|
|
228
|
+
position={org.position}
|
|
229
|
+
selected={selected === org.id}
|
|
230
|
+
onSelect={setSelected}
|
|
231
|
+
/>
|
|
232
|
+
))}
|
|
233
|
+
</>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export const OrganismGrid: StoryObj<typeof CrystallineOrganism> = {
|
|
238
|
+
name: "Organism Grid",
|
|
239
|
+
render: () => <OrganismGridStory />,
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
function PowerLevelsStory() {
|
|
243
|
+
const powers: OrganismPower[] = ["minimal", "standard", "elevated", "intense"];
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<>
|
|
247
|
+
{powers.map((power, i) => (
|
|
248
|
+
<CrystallineOrganism
|
|
249
|
+
key={power}
|
|
250
|
+
id={`kernel-${power}`}
|
|
251
|
+
type="kernel"
|
|
252
|
+
label={power}
|
|
253
|
+
state="responding"
|
|
254
|
+
power={power}
|
|
255
|
+
position={[(i - 1.5) * 2, 0, 0]}
|
|
256
|
+
/>
|
|
257
|
+
))}
|
|
258
|
+
</>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export const PowerLevels: StoryObj<typeof CrystallineOrganism> = {
|
|
263
|
+
name: "Power Levels",
|
|
264
|
+
render: () => <PowerLevelsStory />,
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
function WithChildrenStory() {
|
|
268
|
+
const childOrganisms: CrystallineOrganismProps[] = [
|
|
269
|
+
{ id: "task-1", type: "task", label: "Task-1", state: "idle" },
|
|
270
|
+
{ id: "task-2", type: "task", label: "Task-2", state: "thinking" },
|
|
271
|
+
{ id: "task-3", type: "task", label: "Task-3", state: "error" },
|
|
272
|
+
];
|
|
273
|
+
|
|
274
|
+
return (
|
|
275
|
+
<CrystallineOrganism
|
|
276
|
+
id="workcell-01"
|
|
277
|
+
type="workcell"
|
|
278
|
+
label="Workcell-01"
|
|
279
|
+
state="busy"
|
|
280
|
+
power="elevated"
|
|
281
|
+
children={childOrganisms}
|
|
282
|
+
onSprawl={(id) => console.log("Sprawl:", id)}
|
|
283
|
+
/>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const WithChildren: StoryObj<typeof CrystallineOrganism> = {
|
|
288
|
+
name: "With Children (Click to Sprawl)",
|
|
289
|
+
render: () => <WithChildrenStory />,
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// -----------------------------------------------------------------------------
|
|
293
|
+
// Direct AVO Control Story
|
|
294
|
+
// -----------------------------------------------------------------------------
|
|
295
|
+
|
|
296
|
+
function DirectAVOStory() {
|
|
297
|
+
const [arousal, setArousal] = useState(0.5);
|
|
298
|
+
const [valence, setValence] = useState(0.7);
|
|
299
|
+
const [openness, setOpenness] = useState(0.5);
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
<>
|
|
303
|
+
<CrystallineOrganism
|
|
304
|
+
id="direct-avo"
|
|
305
|
+
type="kernel"
|
|
306
|
+
label="Direct AVO Control"
|
|
307
|
+
dimensions={{ arousal, valence, openness }}
|
|
308
|
+
power="elevated"
|
|
309
|
+
/>
|
|
310
|
+
|
|
311
|
+
{/* Controls overlay */}
|
|
312
|
+
<div
|
|
313
|
+
style={{
|
|
314
|
+
position: "absolute",
|
|
315
|
+
bottom: 20,
|
|
316
|
+
left: 20,
|
|
317
|
+
right: 20,
|
|
318
|
+
display: "flex",
|
|
319
|
+
gap: "20px",
|
|
320
|
+
background: "rgba(0,0,0,0.8)",
|
|
321
|
+
padding: "15px",
|
|
322
|
+
borderRadius: "8px",
|
|
323
|
+
fontFamily: "monospace",
|
|
324
|
+
fontSize: "12px",
|
|
325
|
+
color: "white",
|
|
326
|
+
}}
|
|
327
|
+
>
|
|
328
|
+
<label style={{ flex: 1 }}>
|
|
329
|
+
Arousal: {arousal.toFixed(2)}
|
|
330
|
+
<input
|
|
331
|
+
type="range"
|
|
332
|
+
min="0"
|
|
333
|
+
max="1"
|
|
334
|
+
step="0.01"
|
|
335
|
+
value={arousal}
|
|
336
|
+
onChange={(e) => setArousal(parseFloat(e.target.value))}
|
|
337
|
+
style={{ width: "100%", display: "block", marginTop: "5px" }}
|
|
338
|
+
/>
|
|
339
|
+
</label>
|
|
340
|
+
<label style={{ flex: 1 }}>
|
|
341
|
+
Valence: {valence.toFixed(2)}
|
|
342
|
+
<input
|
|
343
|
+
type="range"
|
|
344
|
+
min="0"
|
|
345
|
+
max="1"
|
|
346
|
+
step="0.01"
|
|
347
|
+
value={valence}
|
|
348
|
+
onChange={(e) => setValence(parseFloat(e.target.value))}
|
|
349
|
+
style={{ width: "100%", display: "block", marginTop: "5px" }}
|
|
350
|
+
/>
|
|
351
|
+
</label>
|
|
352
|
+
<label style={{ flex: 1 }}>
|
|
353
|
+
Openness: {openness.toFixed(2)}
|
|
354
|
+
<input
|
|
355
|
+
type="range"
|
|
356
|
+
min="0"
|
|
357
|
+
max="1"
|
|
358
|
+
step="0.01"
|
|
359
|
+
value={openness}
|
|
360
|
+
onChange={(e) => setOpenness(parseFloat(e.target.value))}
|
|
361
|
+
style={{ width: "100%", display: "block", marginTop: "5px" }}
|
|
362
|
+
/>
|
|
363
|
+
</label>
|
|
364
|
+
</div>
|
|
365
|
+
</>
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export const DirectAVOControl: StoryObj<typeof CrystallineOrganism> = {
|
|
370
|
+
name: "Direct AVO Control",
|
|
371
|
+
render: () => (
|
|
372
|
+
<div style={{ position: "relative" }}>
|
|
373
|
+
<CanvasWrapper>
|
|
374
|
+
<DirectAVOStory />
|
|
375
|
+
</CanvasWrapper>
|
|
376
|
+
</div>
|
|
377
|
+
),
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// -----------------------------------------------------------------------------
|
|
381
|
+
// Integration Stories - Full Lattice with Sprawl Navigation
|
|
382
|
+
// -----------------------------------------------------------------------------
|
|
383
|
+
|
|
384
|
+
export const FullLattice: StoryObj<typeof OrganismLattice> = {
|
|
385
|
+
name: "Full Lattice",
|
|
386
|
+
render: () => {
|
|
387
|
+
const [sprawlStack, setSprawlStack] = useState<string[]>([]);
|
|
388
|
+
|
|
389
|
+
const organisms: CrystallineOrganismProps[] = [
|
|
390
|
+
{
|
|
391
|
+
id: "kernel-01",
|
|
392
|
+
type: "kernel",
|
|
393
|
+
label: "Kernel-01",
|
|
394
|
+
state: "responding",
|
|
395
|
+
power: "elevated",
|
|
396
|
+
children: [
|
|
397
|
+
{ id: "wc-01", type: "workcell", label: "WC-01", state: "busy" },
|
|
398
|
+
{ id: "wc-02", type: "workcell", label: "WC-02", state: "thinking" },
|
|
399
|
+
{ id: "wc-03", type: "workcell", label: "WC-03", state: "idle" },
|
|
400
|
+
],
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
id: "kernel-02",
|
|
404
|
+
type: "kernel",
|
|
405
|
+
label: "Kernel-02",
|
|
406
|
+
state: "idle",
|
|
407
|
+
children: [
|
|
408
|
+
{ id: "agent-01", type: "agent", label: "Agent-01", state: "listening" },
|
|
409
|
+
{ id: "agent-02", type: "agent", label: "Agent-02", state: "error" },
|
|
410
|
+
],
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: "relay-01",
|
|
414
|
+
type: "relay",
|
|
415
|
+
label: "Relay-01",
|
|
416
|
+
state: "listening",
|
|
417
|
+
},
|
|
418
|
+
];
|
|
419
|
+
|
|
420
|
+
const edges: LatticeEdgeType[] = [
|
|
421
|
+
{ id: "e1", source: "kernel-01", target: "kernel-02", type: "communication", strength: 0.8, bidirectional: true },
|
|
422
|
+
{ id: "e2", source: "kernel-01", target: "relay-01", type: "data-flow", strength: 0.6, bidirectional: false },
|
|
423
|
+
{ id: "e3", source: "kernel-02", target: "relay-01", type: "data-flow", strength: 0.6, bidirectional: false },
|
|
424
|
+
];
|
|
425
|
+
|
|
426
|
+
const labels: Record<string, string> = {};
|
|
427
|
+
const collectLabels = (orgs: CrystallineOrganismProps[]) => {
|
|
428
|
+
orgs.forEach((o) => {
|
|
429
|
+
if (o.label) labels[o.id] = o.label;
|
|
430
|
+
if (o.children) collectLabels(o.children);
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
collectLabels(organisms);
|
|
434
|
+
|
|
435
|
+
const handleNavigate = (toIndex: number) => {
|
|
436
|
+
if (toIndex < 0) {
|
|
437
|
+
setSprawlStack([]);
|
|
438
|
+
} else {
|
|
439
|
+
setSprawlStack(sprawlStack.slice(0, toIndex + 1));
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
return (
|
|
444
|
+
<>
|
|
445
|
+
<Breadcrumb
|
|
446
|
+
stack={sprawlStack}
|
|
447
|
+
labels={labels}
|
|
448
|
+
onNavigate={handleNavigate}
|
|
449
|
+
/>
|
|
450
|
+
<OrganismLattice
|
|
451
|
+
organisms={organisms}
|
|
452
|
+
edges={edges}
|
|
453
|
+
layout="hex-grid"
|
|
454
|
+
sprawlStack={sprawlStack}
|
|
455
|
+
onSprawlChange={setSprawlStack}
|
|
456
|
+
/>
|
|
457
|
+
</>
|
|
458
|
+
);
|
|
459
|
+
},
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
export const KernelWithWorkcells: StoryObj<typeof OrganismLattice> = {
|
|
463
|
+
name: "Kernel With Workcells",
|
|
464
|
+
render: () => {
|
|
465
|
+
const [sprawlStack, setSprawlStack] = useState<string[]>(["kernel-01"]);
|
|
466
|
+
|
|
467
|
+
const workcells: CrystallineOrganismProps[] = [
|
|
468
|
+
{ id: "wc-01", type: "workcell", label: "WC-01", state: "busy" },
|
|
469
|
+
{ id: "wc-02", type: "workcell", label: "WC-02", state: "thinking" },
|
|
470
|
+
{ id: "wc-03", type: "workcell", label: "WC-03", state: "idle" },
|
|
471
|
+
{ id: "wc-04", type: "workcell", label: "WC-04", state: "error" },
|
|
472
|
+
{ id: "wc-05", type: "workcell", label: "WC-05", state: "sleep" },
|
|
473
|
+
];
|
|
474
|
+
|
|
475
|
+
const organisms: CrystallineOrganismProps[] = [
|
|
476
|
+
{
|
|
477
|
+
id: "kernel-01",
|
|
478
|
+
type: "kernel",
|
|
479
|
+
label: "Kernel-01",
|
|
480
|
+
state: "responding",
|
|
481
|
+
power: "elevated",
|
|
482
|
+
children: workcells,
|
|
483
|
+
},
|
|
484
|
+
];
|
|
485
|
+
|
|
486
|
+
const edges: LatticeEdgeType[] = [
|
|
487
|
+
{ id: "e1", source: "wc-01", target: "wc-02", type: "dependency", strength: 0.5, bidirectional: false },
|
|
488
|
+
{ id: "e2", source: "wc-02", target: "wc-03", type: "dependency", strength: 0.5, bidirectional: false },
|
|
489
|
+
{ id: "e3", source: "wc-01", target: "wc-04", type: "data-flow", strength: 0.7, bidirectional: false },
|
|
490
|
+
];
|
|
491
|
+
|
|
492
|
+
return (
|
|
493
|
+
<>
|
|
494
|
+
<Breadcrumb
|
|
495
|
+
stack={sprawlStack}
|
|
496
|
+
labels={{ "kernel-01": "Kernel-01" }}
|
|
497
|
+
onNavigate={(i) => setSprawlStack(i < 0 ? [] : sprawlStack.slice(0, i + 1))}
|
|
498
|
+
/>
|
|
499
|
+
<OrganismLattice
|
|
500
|
+
organisms={organisms}
|
|
501
|
+
edges={edges}
|
|
502
|
+
layout="hex-grid"
|
|
503
|
+
sprawlStack={sprawlStack}
|
|
504
|
+
onSprawlChange={setSprawlStack}
|
|
505
|
+
/>
|
|
506
|
+
</>
|
|
507
|
+
);
|
|
508
|
+
},
|
|
509
|
+
};
|