@coreason-ai/sensory-core 1.3.0 → 1.4.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.4.0](https://github.com/CoReason-AI/coreason-sensory-core/compare/v1.3.0...v1.4.0) (2026-05-22)
9
+
10
+
11
+ ### Features
12
+
13
+ * **sensory-core:** implement telemetry components for speculative decoding, active inference, and causal canvas overrides ([5dcd6c3](https://github.com/CoReason-AI/coreason-sensory-core/commit/5dcd6c31fbac46a92b9c22075c455c7c6abff813))
14
+ * **sensory:** integrate sandbox caging telemetry visual primitives and prediction market hud ([3ef8ee9](https://github.com/CoReason-AI/coreason-sensory-core/commit/3ef8ee9d5297501227a857889963698c35c33967))
15
+
8
16
  ## [1.2.0](https://github.com/CoReason-AI/coreason-sensory-core/compare/v1.1.0...v1.2.0) (2026-05-21)
9
17
 
10
18
 
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export interface EpistemicDeficitRadarProps {
3
+ intentBoundary: number[];
4
+ activeTrajectory: number[];
5
+ dimensions: string[];
6
+ vfe: number;
7
+ threshold: number;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * EpistemicDeficitRadar
12
+ *
13
+ * Target Persona: Systems Operator / Generalist / Intelligencer
14
+ * Concept: Active Inference & Epistemic Alignment.
15
+ * Visualizes the divergence between policy intent boundaries and the agent's actual trajectory.
16
+ * Highlights the divergence area (Free Energy Gap) via an animated diagonal-stripe pattern
17
+ * and sounds a visual pulse alarm if the Variational Free Energy (VFE) surprise threshold is breached.
18
+ */
19
+ export declare const EpistemicDeficitRadar: React.FC<EpistemicDeficitRadarProps>;
@@ -0,0 +1,108 @@
1
+ // Copyright (c) 2026 CoReason, Inc
2
+ //
3
+ // This software is proprietary and dual-licensed
4
+ // Licensed under the Prosperity Public License 3.0 (the "License")
5
+ // A copy of the license is available at <https://prosperitylicense.com/versions/3.0.0>
6
+ // For details, see the LICENSE file
7
+ // Commercial use beyond a 30-day trial requires a separate license
8
+ //
9
+ // Source Code: <https://github.com/CoReason-AI/coreason-sensory-core>
10
+ import React from 'react';
11
+ import { motion } from 'framer-motion';
12
+ import { GlassBox } from './GlassBox';
13
+ /**
14
+ * EpistemicDeficitRadar
15
+ *
16
+ * Target Persona: Systems Operator / Generalist / Intelligencer
17
+ * Concept: Active Inference & Epistemic Alignment.
18
+ * Visualizes the divergence between policy intent boundaries and the agent's actual trajectory.
19
+ * Highlights the divergence area (Free Energy Gap) via an animated diagonal-stripe pattern
20
+ * and sounds a visual pulse alarm if the Variational Free Energy (VFE) surprise threshold is breached.
21
+ */
22
+ export const EpistemicDeficitRadar = ({ intentBoundary, activeTrajectory, dimensions, vfe, threshold, className, }) => {
23
+ const cx = 160;
24
+ const cy = 160;
25
+ const r = 110;
26
+ const N = dimensions.length;
27
+ const isBreached = vfe >= threshold;
28
+ // Calculate coordinates for intent boundaries and active trajectory
29
+ const intentCoords = intentBoundary.map((val, i) => {
30
+ const angle = i * ((2 * Math.PI) / N) - Math.PI / 2;
31
+ return {
32
+ x: cx + val * r * Math.cos(angle),
33
+ y: cy + val * r * Math.sin(angle),
34
+ };
35
+ });
36
+ const activeCoords = activeTrajectory.map((val, i) => {
37
+ const angle = i * ((2 * Math.PI) / N) - Math.PI / 2;
38
+ return {
39
+ x: cx + val * r * Math.cos(angle),
40
+ y: cy + val * r * Math.sin(angle),
41
+ };
42
+ });
43
+ // Construct polygon paths
44
+ // Intent boundary: clockwise winding
45
+ const intentPathPart = intentCoords.map((c, i) => `${i === 0 ? 'M' : 'L'} ${c.x.toFixed(2)} ${c.y.toFixed(2)}`).join(' ') + ' Z';
46
+ // Active trajectory: counter-clockwise winding
47
+ const activePathPart = [...activeCoords].reverse().map((c, i) => `${i === 0 ? 'M' : 'L'} ${c.x.toFixed(2)} ${c.y.toFixed(2)}`).join(' ') + ' Z';
48
+ // Combine paths with nonzero fill rule to highlight the symmetric difference (Free Energy Gap)
49
+ const gapPathData = `${intentPathPart} ${activePathPart}`;
50
+ const intentPolygonPath = intentCoords.map((c, i) => `${i === 0 ? 'M' : 'L'} ${c.x.toFixed(2)} ${c.y.toFixed(2)}`).join(' ') + ' Z';
51
+ const activePolygonPath = activeCoords.map((c, i) => `${i === 0 ? 'M' : 'L'} ${c.x.toFixed(2)} ${c.y.toFixed(2)}`).join(' ') + ' Z';
52
+ return (React.createElement(GlassBox, { className: className, variant: "black" },
53
+ React.createElement("div", { className: "flex flex-col space-y-4 font-mono" },
54
+ React.createElement("div", { className: "flex justify-between items-center border-b border-gray-800 pb-2" },
55
+ React.createElement("div", null,
56
+ React.createElement("h3", { className: "text-xs font-semibold text-white tracking-widest uppercase" }, "Epistemic Alignment"),
57
+ React.createElement("span", { className: "text-[9px] text-gray-500 uppercase" }, "Active Inference & Surprise Topology")),
58
+ React.createElement("div", { className: "text-[10px] text-right font-bold" },
59
+ React.createElement("span", { className: "text-gray-500 uppercase mr-1" }, "VFE:"),
60
+ React.createElement("span", { className: isBreached ? 'text-amber-500' : 'text-[var(--cr-accent-cyan)]' }, vfe.toFixed(3)),
61
+ React.createElement("span", { className: "text-gray-600 font-normal" },
62
+ " / ",
63
+ threshold.toFixed(2)))),
64
+ React.createElement("div", { className: "relative w-full flex justify-center bg-black/60 rounded border border-gray-850 py-3" },
65
+ React.createElement("svg", { width: "320", height: "320", className: "overflow-visible" },
66
+ React.createElement("defs", null,
67
+ React.createElement("pattern", { id: "free-energy-gap-stripes", width: "20", height: "20", patternUnits: "userSpaceOnUse" },
68
+ React.createElement("path", { d: "M -5,5 L 5,-5 M 0,20 L 20,0 M 15,25 L 25,15", stroke: isBreached ? 'rgba(245, 158, 11, 0.4)' : 'rgba(0, 255, 204, 0.25)', strokeWidth: "2.5" }),
69
+ React.createElement("animateTransform", { attributeName: "patternTransform", type: "translate", from: "0,0", to: "20,20", dur: "2.5s", repeatCount: "indefinite" }))),
70
+ [0.25, 0.5, 0.75, 1.0].map((scale) => (React.createElement("circle", { key: `grid-ring-${scale}`, cx: cx, cy: cy, r: r * scale, fill: "none", stroke: "rgba(255, 255, 255, 0.05)", strokeDasharray: "3, 3" }))),
71
+ dimensions.map((dim, i) => {
72
+ const angle = i * ((2 * Math.PI) / N) - Math.PI / 2;
73
+ const ax = cx + r * Math.cos(angle);
74
+ const ay = cy + r * Math.sin(angle);
75
+ return (React.createElement("line", { key: `axis-${dim}`, x1: cx, y1: cy, x2: ax, y2: ay, stroke: "rgba(255, 255, 255, 0.08)", strokeWidth: "1" }));
76
+ }),
77
+ React.createElement(motion.circle, { cx: cx, cy: cy, r: r + 15, fill: "none", stroke: isBreached ? '#f59e0b' : 'rgba(255, 255, 255, 0.15)', strokeWidth: isBreached ? 3 : 1, strokeDasharray: isBreached ? undefined : '4, 4', animate: isBreached ? {
78
+ scale: [1, 1.03, 1],
79
+ opacity: [0.5, 1, 0.5],
80
+ } : {
81
+ scale: 1,
82
+ opacity: 0.5,
83
+ }, transition: isBreached ? {
84
+ repeat: Infinity,
85
+ duration: 1.4,
86
+ ease: 'easeInOut',
87
+ } : undefined, style: { originX: `${cx}px`, originY: `${cy}px` } }),
88
+ React.createElement("path", { d: gapPathData, fill: "url(#free-energy-gap-stripes)", fillRule: "nonzero", className: "transition-all duration-300" }),
89
+ React.createElement("path", { d: intentPolygonPath, fill: "none", stroke: "rgba(255, 255, 255, 0.3)", strokeWidth: "1.5", strokeDasharray: "4, 4" }),
90
+ React.createElement("path", { d: activePolygonPath, fill: "rgba(0, 255, 204, 0.04)", stroke: isBreached ? '#f59e0b' : 'var(--cr-accent-cyan)', strokeWidth: "2.5", className: "transition-all duration-300" }),
91
+ dimensions.map((dim, i) => {
92
+ const angle = i * ((2 * Math.PI) / N) - Math.PI / 2;
93
+ const lx = cx + 1.25 * r * Math.cos(angle);
94
+ const ly = cy + 1.2 * r * Math.sin(angle) + 4;
95
+ const cos = Math.cos(angle);
96
+ const textAnchor = cos > 0.1 ? 'start' : cos < -0.1 ? 'end' : 'middle';
97
+ return (React.createElement("text", { key: `label-${dim}`, x: lx, y: ly, textAnchor: textAnchor, fill: "rgba(156, 163, 175, 0.85)", className: "text-[9px] font-bold tracking-wider uppercase select-none" }, dim.toUpperCase()));
98
+ }))),
99
+ React.createElement("div", { className: "grid grid-cols-2 gap-3 text-[10px] bg-black/40 border border-gray-850 p-2.5 rounded" },
100
+ React.createElement("div", { className: "space-y-1" },
101
+ React.createElement("span", { className: "text-gray-500 uppercase block text-[8px] tracking-wider" }, "Surprise Status"),
102
+ React.createElement("span", { className: `font-bold uppercase tracking-widest ${isBreached ? 'text-amber-500 animate-pulse' : 'text-green-400'}` }, isBreached ? 'Breached / Alarm' : 'Nominal alignment')),
103
+ React.createElement("div", { className: "space-y-1 border-l border-gray-850 pl-3" },
104
+ React.createElement("span", { className: "text-gray-500 uppercase block text-[8px] tracking-wider" }, "Free Energy Gap"),
105
+ React.createElement("span", { className: "text-white font-bold" },
106
+ Math.abs(vfe - 0.1).toFixed(4),
107
+ " bits"))))));
108
+ };
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ export interface DialecticStep {
3
+ sequenceIndex: number;
4
+ speakerUrn: string;
5
+ assertion: string;
6
+ confidenceScore: number;
7
+ timestamp: string;
8
+ }
9
+ export interface Hypothesis {
10
+ id: 'proponent' | 'opponent' | string;
11
+ agentUrn: string;
12
+ shares: number;
13
+ probability: number;
14
+ }
15
+ export interface ConvergencePoint {
16
+ timestamp: string;
17
+ proponentProbability: number;
18
+ }
19
+ export interface DebateSessionData {
20
+ debateUrn: string;
21
+ thesis: string;
22
+ liquidityParameter: number;
23
+ hypotheses: Hypothesis[];
24
+ historicalProbabilityConvergence: ConvergencePoint[];
25
+ arguments: DialecticStep[];
26
+ }
27
+ export interface PredictionMarketConsensusHudProps {
28
+ data: DebateSessionData;
29
+ onTrade?: (hypothesisId: string, shareQty: number) => void;
30
+ className?: string;
31
+ }
32
+ export declare const PredictionMarketConsensusHud: React.FC<PredictionMarketConsensusHudProps>;
@@ -0,0 +1,166 @@
1
+ // Copyright (c) 2026 CoReason, Inc
2
+ //
3
+ // This software is proprietary and dual-licensed
4
+ // Licensed under the Prosperity Public License 3.0 (the "License")
5
+ // A copy of the license is available at <https://prosperitylicense.com/versions/3.0.0>
6
+ // For details, see the LICENSE file
7
+ // Commercial use beyond a 30-day trial requires a separate license
8
+ //
9
+ // Source Code: <https://github.com/CoReason-AI/coreason-runtime>
10
+ import React from 'react';
11
+ import { GlassBox } from './GlassBox';
12
+ import { TrendingUp, X, User, Scale } from 'lucide-react';
13
+ export const PredictionMarketConsensusHud = ({ data, onTrade, className = '' }) => {
14
+ const [drawerOpen, setDrawerOpen] = React.useState(false);
15
+ const [selectedSpeaker, setSelectedSpeaker] = React.useState(null);
16
+ const proponent = data.hypotheses.find(h => h.id === 'proponent') || {
17
+ agentUrn: 'urn:coreason:agent:unknown-proponent',
18
+ shares: 0,
19
+ probability: 0.5
20
+ };
21
+ const opponent = data.hypotheses.find(h => h.id === 'opponent') || {
22
+ agentUrn: 'urn:coreason:agent:unknown-opponent',
23
+ shares: 0,
24
+ probability: 0.5
25
+ };
26
+ const proponentProb = proponent.probability;
27
+ const opponentProb = opponent.probability;
28
+ // Format short URN name for visual display
29
+ const getShortUrn = (urn) => {
30
+ return urn.split(':').slice(-2).join(':') || urn;
31
+ };
32
+ const filteredArguments = selectedSpeaker
33
+ ? data.arguments.filter(arg => arg.speakerUrn === selectedSpeaker)
34
+ : data.arguments;
35
+ // Build SVG points for opinion convergence chart
36
+ const points = React.useMemo(() => {
37
+ const history = data.historicalProbabilityConvergence || [];
38
+ if (history.length === 0)
39
+ return '';
40
+ const width = 500;
41
+ const height = 100;
42
+ return history
43
+ .map((p, index) => {
44
+ const x = history.length > 1 ? (index / (history.length - 1)) * width : width / 2;
45
+ const y = height - p.proponentProbability * height;
46
+ return `${x},${y}`;
47
+ })
48
+ .join(' ');
49
+ }, [data.historicalProbabilityConvergence]);
50
+ return (React.createElement("div", { className: `flex flex-col lg:flex-row gap-4 h-full w-full select-none ${className}` },
51
+ React.createElement("div", { className: "flex-1 flex flex-col gap-4 min-w-0" },
52
+ React.createElement(GlassBox, { density: "dense", className: "border border-white/10 bg-black/45 backdrop-blur-md p-4" },
53
+ React.createElement("div", { className: "flex items-start gap-3" },
54
+ React.createElement(Scale, { className: "w-5 h-5 text-[var(--cr-accent-orange)] shrink-0 mt-0.5" }),
55
+ React.createElement("div", null,
56
+ React.createElement("div", { className: "text-[10px] font-bold text-gray-500 uppercase tracking-widest" }, "Active Dialectic Hypothesis Debate"),
57
+ React.createElement("h2", { className: "text-sm font-semibold text-white mt-1 font-sans leading-relaxed" }, data.thesis),
58
+ React.createElement("div", { className: "text-[9px] font-mono text-gray-400 mt-1 break-all" },
59
+ "Debate Session: ",
60
+ data.debateUrn,
61
+ " | Liquidity parameter (b): ",
62
+ data.liquidityParameter)))),
63
+ React.createElement(GlassBox, { density: "dense", className: "border border-white/5 bg-black/65 backdrop-blur-md p-6 flex flex-col gap-6" },
64
+ React.createElement("div", { className: "text-[11px] font-bold text-gray-400 uppercase tracking-widest" }, "Tug-of-War Consensus Track"),
65
+ React.createElement("div", { className: "flex items-center justify-between gap-4 py-2" },
66
+ React.createElement("div", { onClick: () => {
67
+ setSelectedSpeaker(proponent.agentUrn);
68
+ setDrawerOpen(true);
69
+ }, className: `p-3 rounded-lg border cursor-pointer transition-all w-[180px] bg-black/40 ${proponentProb > opponentProb
70
+ ? 'border-[var(--cr-accent-cyan)] shadow-[0_0_15px_rgba(6,182,212,0.25)]'
71
+ : 'border-white/5 hover:border-white/20'}` },
72
+ React.createElement("div", { className: "flex items-center gap-2" },
73
+ React.createElement("div", { className: "p-1.5 rounded bg-[var(--cr-accent-cyan)]/10 text-[var(--cr-accent-cyan)]" },
74
+ React.createElement(User, { className: "w-4 h-4" })),
75
+ React.createElement("div", { className: "min-w-0" },
76
+ React.createElement("div", { className: "text-[9px] font-bold text-cyan-400 uppercase tracking-wider" }, "PROPONENT"),
77
+ React.createElement("div", { className: "text-[10px] font-mono text-white truncate" }, getShortUrn(proponent.agentUrn)))),
78
+ React.createElement("div", { className: "grid grid-cols-2 gap-2 mt-3 pt-2 border-t border-white/5" },
79
+ React.createElement("div", null,
80
+ React.createElement("div", { className: "text-[8px] text-gray-500 font-mono" }, "WEIGHT"),
81
+ React.createElement("div", { className: "text-xs font-bold text-white font-mono" },
82
+ (proponentProb * 100).toFixed(1),
83
+ "%")),
84
+ React.createElement("div", null,
85
+ React.createElement("div", { className: "text-[8px] text-gray-500 font-mono" }, "SHARES"),
86
+ React.createElement("div", { className: "text-xs font-bold text-white font-mono" }, proponent.shares.toFixed(1))))),
87
+ React.createElement("div", { className: "flex-1 relative h-6 flex items-center" },
88
+ React.createElement("div", { className: "absolute inset-x-0 h-1 bg-gray-800 rounded-full overflow-hidden" },
89
+ React.createElement("div", { className: "h-full bg-gradient-to-r from-cyan-400 via-purple-500 to-orange-400 transition-all duration-300", style: { width: '100%' } })),
90
+ React.createElement("div", { className: "absolute w-8 h-8 -ml-4 bg-white/10 backdrop-blur-md border-2 border-white rounded-full flex items-center justify-center shadow-[0_0_15px_rgba(255,255,255,0.4)] cursor-pointer transition-all duration-300 hover:scale-110 z-10", style: { left: `${proponentProb * 100}%` }, title: `Consensus Cursor: ${(proponentProb * 100).toFixed(1)}% Proponent` },
91
+ React.createElement("div", { className: "w-2 h-2 rounded-full bg-white animate-ping" }))),
92
+ React.createElement("div", { onClick: () => {
93
+ setSelectedSpeaker(opponent.agentUrn);
94
+ setDrawerOpen(true);
95
+ }, className: `p-3 rounded-lg border cursor-pointer transition-all w-[180px] bg-black/40 ${opponentProb > proponentProb
96
+ ? 'border-[var(--cr-accent-orange)] shadow-[0_0_15px_rgba(251,146,60,0.25)]'
97
+ : 'border-white/5 hover:border-white/20'}` },
98
+ React.createElement("div", { className: "flex items-center gap-2 justify-end text-right" },
99
+ React.createElement("div", { className: "min-w-0" },
100
+ React.createElement("div", { className: "text-[9px] font-bold text-orange-400 uppercase tracking-wider" }, "OPPONENT"),
101
+ React.createElement("div", { className: "text-[10px] font-mono text-white truncate" }, getShortUrn(opponent.agentUrn))),
102
+ React.createElement("div", { className: "p-1.5 rounded bg-[var(--cr-accent-orange)]/10 text-[var(--cr-accent-orange)]" },
103
+ React.createElement(User, { className: "w-4 h-4" }))),
104
+ React.createElement("div", { className: "grid grid-cols-2 gap-2 mt-3 pt-2 border-t border-white/5" },
105
+ React.createElement("div", null,
106
+ React.createElement("div", { className: "text-[8px] text-gray-500 font-mono" }, "WEIGHT"),
107
+ React.createElement("div", { className: "text-xs font-bold text-white font-mono" },
108
+ (opponentProb * 100).toFixed(1),
109
+ "%")),
110
+ React.createElement("div", null,
111
+ React.createElement("div", { className: "text-[8px] text-gray-500 font-mono" }, "SHARES"),
112
+ React.createElement("div", { className: "text-xs font-bold text-white font-mono" }, opponent.shares.toFixed(1)))))),
113
+ React.createElement("div", { className: "flex justify-between items-center pt-2 border-t border-white/5" },
114
+ React.createElement("div", { className: "flex items-center gap-2" },
115
+ React.createElement("button", { onClick: () => onTrade === null || onTrade === void 0 ? void 0 : onTrade('proponent', 10), className: "px-3 py-1.5 bg-cyan-950/45 hover:bg-cyan-950/80 border border-cyan-500/40 text-cyan-400 text-xs font-bold font-mono rounded cursor-pointer transition-all" }, "Bid Proponent (+10 Sh)"),
116
+ React.createElement("button", { onClick: () => onTrade === null || onTrade === void 0 ? void 0 : onTrade('proponent', 50), className: "px-3 py-1.5 bg-cyan-900/60 hover:bg-cyan-900/90 border border-cyan-500/60 text-cyan-200 text-xs font-bold font-mono rounded cursor-pointer transition-all" }, "Bid Proponent (+50 Sh)")),
117
+ React.createElement("div", { className: "text-[9px] font-mono text-gray-500 max-w-[150px] text-center leading-normal" }, "Bidding modifies market consensus probabilities using LMSR."),
118
+ React.createElement("div", { className: "flex items-center gap-2" },
119
+ React.createElement("button", { onClick: () => onTrade === null || onTrade === void 0 ? void 0 : onTrade('opponent', 10), className: "px-3 py-1.5 bg-orange-950/45 hover:bg-orange-950/80 border border-orange-500/40 text-orange-400 text-xs font-bold font-mono rounded cursor-pointer transition-all" }, "Bid Opponent (+10 Sh)"),
120
+ React.createElement("button", { onClick: () => onTrade === null || onTrade === void 0 ? void 0 : onTrade('opponent', 50), className: "px-3 py-1.5 bg-orange-900/60 hover:bg-orange-900/90 border border-orange-500/60 text-orange-200 text-xs font-bold font-mono rounded cursor-pointer transition-all" }, "Bid Opponent (+50 Sh)")))),
121
+ React.createElement(GlassBox, { density: "dense", className: "border border-white/5 bg-black/65 backdrop-blur-md p-6" },
122
+ React.createElement("div", { className: "flex justify-between items-center mb-4" },
123
+ React.createElement("div", { className: "flex items-center gap-2" },
124
+ React.createElement(TrendingUp, { className: "w-4 h-4 text-purple-400" }),
125
+ React.createElement("span", { className: "text-[11px] font-bold text-gray-400 uppercase tracking-widest" }, "Opinion Convergence Over Time")),
126
+ React.createElement("span", { className: "text-[9px] font-mono text-gray-500" }, "Y-Axis: Proponent Probability (0.0 to 1.0)")),
127
+ React.createElement("div", { className: "relative w-full h-[120px] bg-black/20 rounded border border-white/5 p-1" },
128
+ React.createElement("svg", { viewBox: "0 0 500 100", className: "w-full h-full", preserveAspectRatio: "none" },
129
+ React.createElement("defs", null,
130
+ React.createElement("linearGradient", { id: "chartGradient", x1: "0", y1: "0", x2: "0", y2: "1" },
131
+ React.createElement("stop", { offset: "0%", stopColor: "#06b6d4", stopOpacity: "0.4" }),
132
+ React.createElement("stop", { offset: "100%", stopColor: "#8b5cf6", stopOpacity: "0.0" }))),
133
+ React.createElement("line", { x1: "0", y1: "50", x2: "500", y2: "50", stroke: "#ffffff", strokeOpacity: "0.05", strokeDasharray: "5,5" }),
134
+ points && (React.createElement(React.Fragment, null,
135
+ React.createElement("polygon", { points: `0,100 ${points} 500,100`, fill: "url(#chartGradient)" }),
136
+ React.createElement("polyline", { fill: "none", stroke: "#00ffcc", strokeWidth: "1.5", points: points }))))))),
137
+ drawerOpen && (React.createElement(GlassBox, { density: "dense", className: "w-full lg:w-[320px] border border-white/15 bg-black/90 backdrop-blur-lg p-5 rounded-xl shadow-2xl flex flex-col shrink-0" },
138
+ React.createElement("div", { className: "flex justify-between items-center pb-3 border-b border-white/10 mb-4" },
139
+ React.createElement("div", { className: "flex flex-col" },
140
+ React.createElement("span", { className: "text-[10px] font-bold text-purple-400 uppercase tracking-widest" }, "Reasoning Log"),
141
+ React.createElement("span", { className: "text-[9px] text-gray-500 font-mono mt-0.5" }, selectedSpeaker ? `Speaker: ${getShortUrn(selectedSpeaker)}` : 'All Speakers')),
142
+ React.createElement("button", { onClick: () => {
143
+ setDrawerOpen(false);
144
+ setSelectedSpeaker(null);
145
+ }, className: "text-gray-400 hover:text-white transition-colors cursor-pointer p-0.5 bg-white/5 rounded" },
146
+ React.createElement(X, { className: "w-4 h-4" }))),
147
+ React.createElement("div", { className: "flex-1 overflow-y-auto space-y-3 pr-1 max-h-[400px] lg:max-h-none" }, filteredArguments.length === 0 ? (React.createElement("div", { className: "text-center py-8 text-xs text-gray-500 font-mono" }, "No debate arguments found.")) : (filteredArguments.map((arg) => {
148
+ const isProp = arg.speakerUrn === proponent.agentUrn;
149
+ return (React.createElement("div", { key: arg.sequenceIndex, className: `p-3 rounded-lg border flex flex-col gap-1.5 ${isProp
150
+ ? 'border-cyan-950 bg-cyan-950/20 text-left'
151
+ : 'border-orange-950 bg-orange-950/20 text-left'}` },
152
+ React.createElement("div", { className: "flex justify-between items-center" },
153
+ React.createElement("span", { className: "text-[8px] font-bold font-mono px-1.5 py-0.5 rounded bg-black/30 text-gray-300" },
154
+ "#",
155
+ arg.sequenceIndex),
156
+ React.createElement("span", { className: `text-[8px] font-bold font-mono uppercase tracking-wider ${isProp ? 'text-cyan-400' : 'text-orange-400'}` }, isProp ? 'PROPONENT' : 'OPPONENT')),
157
+ React.createElement("p", { className: "text-[10px] text-gray-200 leading-normal font-sans" }, arg.assertion),
158
+ React.createElement("div", { className: "flex justify-between items-center pt-1.5 border-t border-white/5 mt-1 text-[8px] font-mono text-gray-400" },
159
+ React.createElement("span", null,
160
+ "CONFIDENCE: ",
161
+ (arg.confidenceScore * 100).toFixed(0),
162
+ "%"),
163
+ React.createElement("span", null, new Date(arg.timestamp).toLocaleTimeString()))));
164
+ }))),
165
+ selectedSpeaker && (React.createElement("button", { onClick: () => setSelectedSpeaker(null), className: "mt-4 w-full py-1.5 bg-white/5 hover:bg-white/10 text-gray-300 hover:text-white border border-white/5 rounded text-[10px] font-mono font-bold cursor-pointer transition-all" }, "Clear Filter"))))));
166
+ };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ export type SpeculativeValidationStatus = 'speculative_draft' | 'target_validated' | 'target_rejected';
3
+ export interface SpeculativeTokenNode {
4
+ tokenId: string;
5
+ tokenValue: string;
6
+ logitProbability: number;
7
+ validationStatus: SpeculativeValidationStatus;
8
+ childSpeculations: SpeculativeTokenNode[];
9
+ }
10
+ export interface SpeculativeTreeRendererProps {
11
+ tokenTree: SpeculativeTokenNode;
12
+ onTokenFocus?: (token: SpeculativeTokenNode) => void;
13
+ className?: string;
14
+ }
15
+ /**
16
+ * SpeculativeTreeRenderer
17
+ *
18
+ * Target Persona: Systems Engineer / Operational Intelligencer
19
+ * Concept: System 1 / Speculative Decoding telemetry projection.
20
+ * Projects real-time speculative logit draft token proposals, visual decay,
21
+ * and target model validation status in a cybernetic tree diagram.
22
+ */
23
+ export declare const SpeculativeTreeRenderer: React.FC<SpeculativeTreeRendererProps>;
@@ -0,0 +1,202 @@
1
+ // Copyright (c) 2026 CoReason, Inc
2
+ //
3
+ // This software is proprietary and dual-licensed
4
+ // Licensed under the Prosperity Public License 3.0 (the "License")
5
+ // A copy of the license is available at <https://prosperitylicense.com/versions/3.0.0>
6
+ // For details, see the LICENSE file
7
+ // Commercial use beyond a 30-day trial requires a separate license
8
+ //
9
+ // Source Code: <https://github.com/CoReason-AI/coreason-sensory-core>
10
+ import React, { useState, useEffect, useRef } from 'react';
11
+ import { motion, AnimatePresence } from 'framer-motion';
12
+ import { GlassBox } from './GlassBox';
13
+ /**
14
+ * Computes horizontal tree layout using post-order positioning.
15
+ */
16
+ function computeTreeLayout(node, depth = 0, layoutState = { nextLeafY: 0 }, xSpacing = 170, ySpacing = 65) {
17
+ const x = depth * xSpacing + 70;
18
+ if (!node.childSpeculations || node.childSpeculations.length === 0) {
19
+ const y = layoutState.nextLeafY * ySpacing + 60;
20
+ layoutState.nextLeafY += 1;
21
+ return {
22
+ tokenId: node.tokenId,
23
+ tokenValue: node.tokenValue,
24
+ logitProbability: node.logitProbability,
25
+ validationStatus: node.validationStatus,
26
+ x,
27
+ y,
28
+ children: [],
29
+ };
30
+ }
31
+ const children = node.childSpeculations.map((child) => computeTreeLayout(child, depth + 1, layoutState, xSpacing, ySpacing));
32
+ const sumY = children.reduce((sum, child) => sum + child.y, 0);
33
+ const y = sumY / children.length;
34
+ return {
35
+ tokenId: node.tokenId,
36
+ tokenValue: node.tokenValue,
37
+ logitProbability: node.logitProbability,
38
+ validationStatus: node.validationStatus,
39
+ x,
40
+ y,
41
+ children,
42
+ };
43
+ }
44
+ /**
45
+ * Traverses the computed layout tree to gather all node and connection information.
46
+ */
47
+ function collectLayoutEntities(node, accumulatedNodes = [], accumulatedEdges = []) {
48
+ accumulatedNodes.push(node);
49
+ for (const child of node.children) {
50
+ accumulatedEdges.push({
51
+ parentId: node.tokenId,
52
+ childId: child.tokenId,
53
+ x1: node.x,
54
+ y1: node.y,
55
+ x2: child.x,
56
+ y2: child.y,
57
+ status: child.validationStatus,
58
+ });
59
+ collectLayoutEntities(child, accumulatedNodes, accumulatedEdges);
60
+ }
61
+ return { nodes: accumulatedNodes, edges: accumulatedEdges };
62
+ }
63
+ /**
64
+ * SpeculativeTreeRenderer
65
+ *
66
+ * Target Persona: Systems Engineer / Operational Intelligencer
67
+ * Concept: System 1 / Speculative Decoding telemetry projection.
68
+ * Projects real-time speculative logit draft token proposals, visual decay,
69
+ * and target model validation status in a cybernetic tree diagram.
70
+ */
71
+ export const SpeculativeTreeRenderer = ({ tokenTree, onTokenFocus, className, }) => {
72
+ const [particles, setParticles] = useState([]);
73
+ const [hoveredToken, setHoveredToken] = useState(null);
74
+ // Track triggered rejections to prevent double-spawning particles
75
+ const processedRejectionsRef = useRef(new Set());
76
+ // Compute layout structures
77
+ const layoutRoot = computeTreeLayout(tokenTree);
78
+ const { nodes: layoutNodes, edges: layoutEdges } = collectLayoutEntities(layoutRoot);
79
+ // Determine viewport boundary limits
80
+ const maxX = Math.max(...layoutNodes.map((n) => n.x), 500) + 120;
81
+ const maxY = Math.max(...layoutNodes.map((n) => n.y), 250) + 80;
82
+ useEffect(() => {
83
+ const freshRejections = [];
84
+ // Identify nodes that became rejected and haven't spawned particles yet
85
+ const inspectForRejections = (n) => {
86
+ if (n.validationStatus === 'target_rejected' && !processedRejectionsRef.current.has(n.tokenId)) {
87
+ freshRejections.push(n);
88
+ }
89
+ n.children.forEach(inspectForRejections);
90
+ };
91
+ inspectForRejections(layoutRoot);
92
+ if (freshRejections.length > 0) {
93
+ const generatedParticles = [];
94
+ for (const rejNode of freshRejections) {
95
+ processedRejectionsRef.current.add(rejNode.tokenId);
96
+ // Spawn 8 disperse particles for decay animation
97
+ for (let i = 0; i < 8; i++) {
98
+ const angle = Math.random() * Math.PI * 2;
99
+ const speed = 25 + Math.random() * 40;
100
+ generatedParticles.push({
101
+ id: `${rejNode.tokenId}-particle-${i}-${Math.random()}`,
102
+ x: rejNode.x,
103
+ y: rejNode.y,
104
+ dx: Math.cos(angle) * speed,
105
+ dy: Math.sin(angle) * speed,
106
+ color: Math.random() > 0.4 ? '#ff4444' : '#ffaa00',
107
+ size: 2 + Math.random() * 3,
108
+ });
109
+ }
110
+ }
111
+ setParticles((prev) => [...prev, ...generatedParticles]);
112
+ // Clean up dissolved particles after 500ms
113
+ const cleanupTimer = setTimeout(() => {
114
+ setParticles((prev) => prev.filter((p) => !generatedParticles.includes(p)));
115
+ }, 500);
116
+ return () => clearTimeout(cleanupTimer);
117
+ }
118
+ }, [tokenTree, layoutRoot]);
119
+ const handleInteraction = (token) => {
120
+ if (onTokenFocus) {
121
+ onTokenFocus({
122
+ tokenId: token.tokenId,
123
+ tokenValue: token.tokenValue,
124
+ logitProbability: token.logitProbability,
125
+ validationStatus: token.validationStatus,
126
+ childSpeculations: [],
127
+ });
128
+ }
129
+ };
130
+ return (React.createElement(GlassBox, { className: className, variant: "black" },
131
+ React.createElement("div", { className: "flex flex-col space-y-3 font-mono" },
132
+ React.createElement("div", { className: "flex justify-between items-center border-b border-gray-800 pb-2" },
133
+ React.createElement("div", null,
134
+ React.createElement("h3", { className: "text-xs font-semibold text-white tracking-widest uppercase" }, "Speculative Telemetry"),
135
+ React.createElement("span", { className: "text-[9px] text-gray-500 uppercase" }, "System 1 Draft Proposals & Validation Decay")),
136
+ React.createElement("div", { className: "flex gap-3 text-[9px] uppercase tracking-wider" },
137
+ React.createElement("span", { className: "flex items-center gap-1" },
138
+ React.createElement("span", { className: "w-1.5 h-1.5 rounded-full bg-[var(--cr-accent-cyan)] shadow-[0_0_4px_var(--cr-accent-cyan)]" }),
139
+ "Validated"),
140
+ React.createElement("span", { className: "flex items-center gap-1" },
141
+ React.createElement("span", { className: "w-1.5 h-1.5 rounded-full border border-dashed border-gray-500" }),
142
+ "Draft Proposal"),
143
+ React.createElement("span", { className: "flex items-center gap-1" },
144
+ React.createElement("span", { className: "w-1.5 h-1.5 rounded-full bg-red-500/40 line-through" }),
145
+ "Decayed"))),
146
+ React.createElement("div", { className: "relative w-full overflow-auto bg-black/60 rounded border border-gray-850 p-2 h-72 custom-scrollbar" },
147
+ React.createElement("svg", { width: maxX, height: maxY, className: "absolute top-0 left-0 overflow-visible" },
148
+ React.createElement("g", null, layoutEdges.map((edge) => {
149
+ const isRejected = edge.status === 'target_rejected';
150
+ const isValidated = edge.status === 'target_validated';
151
+ // SVG Bezier path curve calculation
152
+ const controlOffset = 50;
153
+ const pathData = `M ${edge.x1} ${edge.y1} C ${edge.x1 + controlOffset} ${edge.y1}, ${edge.x2 - controlOffset} ${edge.y2}, ${edge.x2} ${edge.y2}`;
154
+ return (React.createElement("path", { key: `${edge.parentId}-${edge.childId}`, d: pathData, fill: "none", stroke: isRejected
155
+ ? 'rgba(239, 68, 68, 0.1)'
156
+ : isValidated
157
+ ? 'var(--cr-accent-cyan)'
158
+ : 'rgba(255, 255, 255, 0.15)', strokeWidth: isValidated ? 2 : 1, strokeDasharray: isRejected ? '3, 3' : undefined, className: "transition-all duration-300" }));
159
+ })),
160
+ React.createElement("g", null, particles.map((p) => (React.createElement(motion.circle, { key: p.id, cx: p.x, cy: p.y, r: p.size, fill: p.color, initial: { opacity: 1, x: 0, y: 0 }, animate: { opacity: 0, x: p.dx, y: p.dy }, transition: { duration: 0.45, ease: 'easeOut' } }))))),
161
+ React.createElement("div", { className: "absolute top-0 left-0", style: { width: maxX, height: maxY } }, layoutNodes.map((node) => {
162
+ const isValidated = node.validationStatus === 'target_validated';
163
+ const isRejected = node.validationStatus === 'target_rejected';
164
+ // Map probability value to distinct colors
165
+ const probColor = node.logitProbability >= 0.8
166
+ ? 'text-green-400'
167
+ : node.logitProbability >= 0.5
168
+ ? 'text-yellow-400'
169
+ : 'text-red-400';
170
+ return (React.createElement(motion.div, { key: node.tokenId, style: {
171
+ position: 'absolute',
172
+ left: node.x,
173
+ top: node.y,
174
+ transform: 'translate(-50%, -50%)',
175
+ zIndex: 10,
176
+ }, initial: false, animate: {
177
+ scale: isRejected ? 0.85 : 1,
178
+ opacity: isRejected ? 0.35 : 1,
179
+ }, transition: { duration: 0.3 } },
180
+ React.createElement("button", { onClick: () => handleInteraction(node), onMouseEnter: () => setHoveredToken(node), onMouseLeave: () => setHoveredToken(null), style: { borderRadius: 'var(--cr-border-radius)' }, className: `px-3 py-2 text-xs font-mono transition-all duration-300 border flex flex-col items-center select-none ${isValidated
181
+ ? 'border-[var(--cr-accent-cyan)] shadow-[0_0_12px_rgba(0,255,204,0.4)] bg-black/90 text-white'
182
+ : isRejected
183
+ ? 'border-red-500/20 bg-red-950/5 text-gray-500 line-through'
184
+ : 'border-dashed border-gray-700 bg-gray-950/80 text-gray-300 hover:border-gray-500'}` },
185
+ React.createElement("span", { className: "font-semibold tracking-wider text-[11px]" }, node.tokenValue),
186
+ React.createElement("span", { className: `text-[8px] font-bold mt-0.5 ${probColor}` },
187
+ (node.logitProbability * 100).toFixed(0),
188
+ "%"))));
189
+ }))),
190
+ React.createElement(AnimatePresence, null, hoveredToken && (React.createElement(motion.div, { initial: { opacity: 0, y: 5 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: 5 }, className: "bg-gray-950/95 border border-gray-850 p-2.5 rounded text-[10px] text-gray-400 flex flex-col space-y-1" },
191
+ React.createElement("div", { className: "flex justify-between text-white font-semibold" },
192
+ React.createElement("span", null,
193
+ "Token ID: ",
194
+ hoveredToken.tokenId),
195
+ React.createElement("span", { className: "uppercase text-[9px] tracking-widest px-1.5 py-0.5 bg-gray-900 border border-gray-800 rounded" }, hoveredToken.validationStatus.replace('target_', '').replace('speculative_', ''))),
196
+ React.createElement("div", { className: "flex justify-between" },
197
+ React.createElement("span", null, "Value representation:"),
198
+ React.createElement("span", { className: "text-white font-mono bg-black px-1.5 rounded" }, JSON.stringify(hoveredToken.tokenValue))),
199
+ React.createElement("div", { className: "flex justify-between" },
200
+ React.createElement("span", null, "Logit Probability:"),
201
+ React.createElement("span", { className: "text-white font-mono" }, hoveredToken.logitProbability.toFixed(5)))))))));
202
+ };
@@ -17,11 +17,7 @@ export interface TopologicalCanvasProps {
17
17
  x: number;
18
18
  y: number;
19
19
  }) => void;
20
+ onExecuteIntervention?: (nodeId: string) => void;
20
21
  }
21
- /**
22
- * TopologicalCanvas
23
- *
24
- * Concept: Visualizes the Macro-Swarm Architecture
25
- * Uses ReactFlow to map mathematical DAGs to the UI
26
- */
22
+ export declare const computeBlastRadius: (nodes: Node[], edges: Edge[], startNodeId: string) => Set<string>;
27
23
  export declare const TopologicalCanvas: React.FC<TopologicalCanvasProps>;
@@ -17,14 +17,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  });
18
18
  };
19
19
  import React from 'react';
20
- import { ReactFlow, Background, Controls, getBezierPath, EdgeLabelRenderer, Panel } from '@xyflow/react';
20
+ import { ReactFlow, Background, Controls, getBezierPath, EdgeLabelRenderer, Panel, ReactFlowProvider, useViewport } from '@xyflow/react';
21
21
  import '@xyflow/react/dist/style.css';
22
22
  import { GlassBox } from './GlassBox';
23
23
  import { StatusPulse } from './StatusPulse';
24
- import { Lock, Unlock, ShieldAlert, ShieldX } from 'lucide-react';
24
+ import { Lock, Unlock, ShieldAlert, ShieldX, AlertTriangle } from 'lucide-react';
25
25
  import { ConformanceGuillotine } from './ConformanceGuillotine';
26
26
  // Custom Node: SwarmNode
27
- const SwarmNode = ({ data }) => {
27
+ const SwarmNode = ({ id, data }) => {
28
28
  var _a;
29
29
  const isBreached = data.status === 'suspended_security_violation' || data.isSecurityViolation;
30
30
  const isCompact = data.density === 'compact';
@@ -32,6 +32,9 @@ const SwarmNode = ({ data }) => {
32
32
  if (data.isPanicked) {
33
33
  borderColorClass = 'border-red-600/80 shadow-[0_0_15px_rgba(220,38,38,0.3)]';
34
34
  }
35
+ else if (data.isInBlastRadius) {
36
+ borderColorClass = 'border-red-500/90 shadow-[0_0_18px_rgba(239,68,68,0.6)] bg-red-950/20 animate-pulse';
37
+ }
35
38
  else if (isBreached) {
36
39
  borderColorClass = 'border-orange-500/80 shadow-[0_0_15px_rgba(249,115,22,0.3)]';
37
40
  }
@@ -48,7 +51,16 @@ const SwarmNode = ({ data }) => {
48
51
  React.createElement("div", { className: "flex flex-col" },
49
52
  React.createElement("div", { className: "flex justify-between items-center mb-2" },
50
53
  React.createElement("span", { className: "text-[10px] uppercase tracking-widest text-gray-500" }, data.typeLabel || 'AGENT'),
51
- !isCompact && React.createElement(StatusPulse, { status: data.status || 'idle' })),
54
+ React.createElement("div", { className: "flex items-center gap-1.5" },
55
+ React.createElement("button", { onMouseEnter: () => { var _a; return (_a = data.onHoverRetract) === null || _a === void 0 ? void 0 : _a.call(data, id); }, onMouseLeave: () => { var _a; return (_a = data.onLeaveRetract) === null || _a === void 0 ? void 0 : _a.call(data); }, onClick: (e) => {
56
+ var _a;
57
+ e.stopPropagation();
58
+ (_a = data.onExecuteIntervention) === null || _a === void 0 ? void 0 : _a.call(data, id);
59
+ }, className: "text-gray-500 hover:text-red-500 transition-colors p-0.5 rounded cursor-pointer flex items-center justify-center bg-black/40 border border-white/5 hover:border-red-500/30", title: "Retract Node (Do-Operator)" },
60
+ React.createElement("svg", { className: "w-3 h-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" },
61
+ React.createElement("circle", { cx: "12", cy: "12", r: "10" }),
62
+ React.createElement("line", { x1: "8", y1: "12", x2: "16", y2: "12" }))),
63
+ !isCompact && React.createElement(StatusPulse, { status: data.status || 'idle' }))),
52
64
  !isCompact && (React.createElement("span", { className: "text-sm font-mono text-white truncate max-w-[120px]", title: data.urn }, ((_a = data.urn) === null || _a === void 0 ? void 0 : _a.split(':').slice(-2).join(':')) || 'urn:unknown')),
53
65
  data.causalRole && (React.createElement("div", { className: `mt-2 text-[8px] font-bold uppercase tracking-wider px-1 py-0.5 rounded text-center ${data.causalRole === 'confounder'
54
66
  ? 'bg-yellow-500/20 text-yellow-400 border border-yellow-500/30'
@@ -76,13 +88,24 @@ const SandboxNode = ({ id, data }) => {
76
88
  const isCompact = data.density === 'compact';
77
89
  return (React.createElement("div", { className: `bg-[rgba(20,20,20,0.8)] border relative rounded-lg p-4 min-w-[300px] ${isCompact ? 'min-h-[50px]' : 'min-h-[200px]'} shadow-[0_0_15px_rgba(255,100,0,0.2)] ${data.isPanicked
78
90
  ? 'border-red-600/80 shadow-[0_0_20px_rgba(220,38,38,0.4)]'
79
- : 'border-[var(--cr-accent-orange)]'}` },
91
+ : data.isInBlastRadius
92
+ ? 'border-red-500/90 shadow-[0_0_20px_rgba(239,68,68,0.6)] bg-red-950/20 animate-pulse'
93
+ : 'border-[var(--cr-accent-orange)]'}` },
80
94
  React.createElement("div", { className: `absolute top-0 left-0 right-0 text-[10px] font-bold uppercase tracking-wider px-2 py-1 rounded-t-sm flex justify-between items-center ${data.isPanicked ? 'bg-red-600 text-white' : 'bg-[var(--cr-accent-orange)] text-black'}` },
81
95
  React.createElement("span", null,
82
96
  "\u26CA ",
83
97
  data.sandboxType || 'WASM ENCLAVE',
84
98
  " ISOLATION BOUNDARY"),
85
- React.createElement("span", { className: "font-mono" }, data.id || id)),
99
+ React.createElement("div", { className: "flex items-center gap-2" },
100
+ React.createElement("button", { onMouseEnter: () => { var _a; return (_a = data.onHoverRetract) === null || _a === void 0 ? void 0 : _a.call(data, id); }, onMouseLeave: () => { var _a; return (_a = data.onLeaveRetract) === null || _a === void 0 ? void 0 : _a.call(data); }, onClick: (e) => {
101
+ var _a;
102
+ e.stopPropagation();
103
+ (_a = data.onExecuteIntervention) === null || _a === void 0 ? void 0 : _a.call(data, id);
104
+ }, className: `p-0.5 rounded transition-colors cursor-pointer flex items-center justify-center bg-black/40 border border-white/5 ${data.isPanicked ? 'text-white/70 hover:text-white hover:border-white/30' : 'text-black/70 hover:text-red-600 hover:border-red-600/30'}`, title: "Retract WASM Sandbox" },
105
+ React.createElement("svg", { className: "w-3 h-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" },
106
+ React.createElement("circle", { cx: "12", cy: "12", r: "10" }),
107
+ React.createElement("line", { x1: "8", y1: "12", x2: "16", y2: "12" }))),
108
+ React.createElement("span", { className: "font-mono" }, data.id || id))),
86
109
  !isCompact && (React.createElement("div", { className: "mt-6 mb-2 flex flex-col gap-2" },
87
110
  React.createElement("div", { className: "flex items-center justify-between text-[10px] font-mono text-gray-400" },
88
111
  React.createElement("span", null, "CPU FUEL"),
@@ -124,6 +147,8 @@ const TelemetryEdge = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition,
124
147
  });
125
148
  const [showDetails, setShowDetails] = React.useState(false);
126
149
  const getEdgeColor = () => {
150
+ if (data === null || data === void 0 ? void 0 : data.isInBlastRadius)
151
+ return '#ef4444'; // Flashing red hazard line
127
152
  if (data === null || data === void 0 ? void 0 : data.isSecurityViolation)
128
153
  return '#f97316'; // Flashing firewall orange
129
154
  if (data === null || data === void 0 ? void 0 : data.isSecureMtls)
@@ -133,11 +158,15 @@ const TelemetryEdge = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition,
133
158
  return (data === null || data === void 0 ? void 0 : data.isStreaming) ? 'var(--cr-accent-orange)' : '#4B5563';
134
159
  };
135
160
  const getStrokeDashArray = () => {
161
+ if (data === null || data === void 0 ? void 0 : data.isInBlastRadius)
162
+ return '5,5';
136
163
  if ((data === null || data === void 0 ? void 0 : data.isSecureMtls) || (data === null || data === void 0 ? void 0 : data.isStreaming) || (data === null || data === void 0 ? void 0 : data.isSecurityViolation))
137
164
  return '5,5';
138
165
  return 'none';
139
166
  };
140
167
  const getAnimation = () => {
168
+ if (data === null || data === void 0 ? void 0 : data.isInBlastRadius)
169
+ return 'dashdraw 0.3s linear infinite'; // Accelerated dash warning
141
170
  if (data === null || data === void 0 ? void 0 : data.isSecurityViolation)
142
171
  return 'dashdraw 0.5s linear infinite';
143
172
  if ((data === null || data === void 0 ? void 0 : data.isStreaming) || (data === null || data === void 0 ? void 0 : data.isSecureMtls))
@@ -212,15 +241,101 @@ const nodeTypes = {
212
241
  const edgeTypes = {
213
242
  telemetryEdge: TelemetryEdge,
214
243
  };
215
- /**
216
- * TopologicalCanvas
217
- *
218
- * Concept: Visualizes the Macro-Swarm Architecture
219
- * Uses ReactFlow to map mathematical DAGs to the UI
220
- */
221
- export const TopologicalCanvas = ({ nodes, edges, availableCapabilities = [], onNodeClick, onNodesChange, onEdgesChange, onConnect, onDropCapability }) => {
244
+ export const computeBlastRadius = (nodes, edges, startNodeId) => {
245
+ const visited = new Set();
246
+ const queue = [startNodeId];
247
+ while (queue.length > 0) {
248
+ const current = queue.shift();
249
+ if (!visited.has(current)) {
250
+ visited.add(current);
251
+ const downstream = edges
252
+ .filter(e => e.source === current)
253
+ .map(e => e.target);
254
+ queue.push(...downstream);
255
+ }
256
+ }
257
+ return visited;
258
+ };
259
+ const CausalInterventionOverlay = ({ nodes, hoveredNodeId }) => {
260
+ var _a, _b, _c, _d;
261
+ const { x, y, zoom } = useViewport();
262
+ const [pulseRadius, setPulseRadius] = React.useState(0);
263
+ React.useEffect(() => {
264
+ let frame;
265
+ const start = performance.now();
266
+ const animate = (time) => {
267
+ const elapsed = time - start;
268
+ const progress = (elapsed % 1500) / 1500;
269
+ setPulseRadius(progress * 120);
270
+ frame = requestAnimationFrame(animate);
271
+ };
272
+ frame = requestAnimationFrame(animate);
273
+ return () => cancelAnimationFrame(frame);
274
+ }, []);
275
+ const targetNode = nodes.find(n => n.id === hoveredNodeId);
276
+ if (!targetNode)
277
+ return null;
278
+ const isSandbox = targetNode.type === 'sandboxNode';
279
+ const width = (_b = (_a = targetNode.measured) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : (isSandbox ? 300 : 150);
280
+ const height = (_d = (_c = targetNode.measured) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : (isSandbox ? 200 : 100);
281
+ const cx = targetNode.position.x + width / 2;
282
+ const cy = targetNode.position.y + height / 2;
283
+ const screenCx = cx * zoom + x;
284
+ const screenCy = cy * zoom + y;
285
+ return (React.createElement("svg", { style: {
286
+ position: 'absolute',
287
+ left: 0,
288
+ top: 0,
289
+ width: '100%',
290
+ height: '100%',
291
+ pointerEvents: 'none',
292
+ zIndex: 9999,
293
+ } },
294
+ React.createElement("circle", { cx: screenCx, cy: screenCy, r: pulseRadius * zoom, fill: "rgba(239, 68, 68, 0.08)", stroke: "rgba(239, 68, 68, 0.5)", strokeWidth: "2", style: {
295
+ transformOrigin: `${screenCx}px ${screenCy}px`,
296
+ } }),
297
+ React.createElement("circle", { cx: screenCx, cy: screenCy, r: 8 * zoom, fill: "#ef4444", className: "animate-ping" }),
298
+ React.createElement("circle", { cx: screenCx, cy: screenCy, r: 5 * zoom, fill: "#ef4444" })));
299
+ };
300
+ const TopologicalCanvasInner = ({ nodes, edges, availableCapabilities = [], onNodeClick, onNodesChange, onEdgesChange, onConnect, onDropCapability, onExecuteIntervention }) => {
301
+ var _a, _b;
222
302
  const [isLayouting, setIsLayouting] = React.useState(false);
223
303
  const [activePanicNode, setActivePanicNode] = React.useState(null);
304
+ const [hoveredRetractNodeId, setHoveredRetractNodeId] = React.useState(null);
305
+ const blastRadiusIds = React.useMemo(() => {
306
+ if (!hoveredRetractNodeId)
307
+ return new Set();
308
+ return computeBlastRadius(nodes, edges, hoveredRetractNodeId);
309
+ }, [nodes, edges, hoveredRetractNodeId]);
310
+ const processedNodes = React.useMemo(() => {
311
+ return nodes.map(node => {
312
+ const isInBlast = blastRadiusIds.has(node.id);
313
+ const isTarget = node.id === hoveredRetractNodeId;
314
+ return Object.assign(Object.assign({}, node), { data: Object.assign(Object.assign({}, node.data), { isInBlastRadius: isInBlast, isInterventionTarget: isTarget, onHoverRetract: (id) => setHoveredRetractNodeId(id), onLeaveRetract: () => setHoveredRetractNodeId(null), onExecuteIntervention: (id) => {
315
+ setHoveredRetractNodeId(null);
316
+ if (onExecuteIntervention) {
317
+ onExecuteIntervention(id);
318
+ }
319
+ } }) });
320
+ });
321
+ }, [nodes, blastRadiusIds, hoveredRetractNodeId, onExecuteIntervention]);
322
+ const processedEdges = React.useMemo(() => {
323
+ return edges.map(edge => {
324
+ const isInBlast = blastRadiusIds.has(edge.source);
325
+ return Object.assign(Object.assign({}, edge), { data: Object.assign(Object.assign({}, edge.data), { isInBlastRadius: isInBlast }) });
326
+ });
327
+ }, [edges, blastRadiusIds]);
328
+ const affectedSandboxCount = React.useMemo(() => {
329
+ return Array.from(blastRadiusIds).filter(id => {
330
+ var _a;
331
+ const node = nodes.find(n => n.id === id);
332
+ if (!node)
333
+ return false;
334
+ const urn = ((_a = node.data) === null || _a === void 0 ? void 0 : _a.urn) || '';
335
+ return node.type === 'sandboxNode' || urn.includes('urn:coreason:node:sandbox');
336
+ }).length;
337
+ }, [blastRadiusIds, nodes]);
338
+ const deficitForecast = blastRadiusIds.size * 150.0;
224
339
  const onDragStart = (event, capability) => {
225
340
  event.dataTransfer.setData('application/reactflow', JSON.stringify(capability));
226
341
  event.dataTransfer.effectAllowed = 'move';
@@ -291,8 +406,8 @@ export const TopologicalCanvas = ({ nodes, edges, availableCapabilities = [], on
291
406
  onNodesChange(changes);
292
407
  }
293
408
  }
294
- catch (error) {
295
- console.error('ELK Layout error:', error);
409
+ catch (err) {
410
+ console.error('ELK Layout fault:', err);
296
411
  }
297
412
  finally {
298
413
  setIsLayouting(false);
@@ -314,15 +429,41 @@ export const TopologicalCanvas = ({ nodes, edges, availableCapabilities = [], on
314
429
  background-color: #000;
315
430
  }
316
431
  `),
317
- React.createElement(ReactFlow, { nodes: nodes, edges: edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodeClick: handleInternalNodeClick, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onConnect: onConnect, fitView: true, proOptions: { hideAttribution: true } },
432
+ React.createElement(ReactFlow, { nodes: processedNodes, edges: processedEdges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodeClick: handleInternalNodeClick, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onConnect: onConnect, fitView: true, proOptions: { hideAttribution: true } },
318
433
  React.createElement(Background, { color: "#1f2937", gap: 20 }),
319
434
  React.createElement(Controls, { className: "bg-[var(--cr-glass-box-black)] border border-gray-800 fill-white" }),
320
435
  React.createElement(Panel, { position: "top-right", className: "m-4" },
321
- React.createElement("button", { onClick: handleAutoLayout, disabled: isLayouting, className: `bg-[var(--cr-accent-orange)] text-black font-bold uppercase tracking-wider text-[10px] px-4 py-2 rounded shadow-lg transition-opacity ${isLayouting ? 'opacity-50 cursor-not-allowed' : 'hover:opacity-90'}` }, isLayouting ? 'Computing Topology...' : 'Orthogonal Layout')))),
436
+ React.createElement("button", { onClick: handleAutoLayout, disabled: isLayouting, className: `bg-[var(--cr-accent-orange)] text-black font-bold uppercase tracking-wider text-[10px] px-4 py-2 rounded shadow-lg transition-opacity ${isLayouting ? 'opacity-50 cursor-not-allowed' : 'hover:opacity-90'}` }, isLayouting ? 'Computing Topology...' : 'Orthogonal Layout')),
437
+ hoveredRetractNodeId && (React.createElement(Panel, { position: "bottom-center", className: "mb-4" },
438
+ React.createElement(GlassBox, { density: "dense", className: "border border-red-500/30 bg-black/85 backdrop-blur-md p-4 rounded-lg w-[450px] shadow-[0_0_20px_rgba(239,68,68,0.2)]" },
439
+ React.createElement("div", { className: "flex items-start gap-3" },
440
+ React.createElement(AlertTriangle, { className: "w-5 h-5 text-red-500 animate-pulse shrink-0 mt-0.5" }),
441
+ React.createElement("div", { className: "flex-1 space-y-1.5" },
442
+ React.createElement("div", { className: "text-[11px] font-bold text-red-400 uppercase tracking-widest" }, "Causal Intervention Forecast"),
443
+ React.createElement("div", { className: "text-[10px] font-mono text-gray-400 break-all leading-normal" },
444
+ "Target URN: ",
445
+ React.createElement("span", { className: "text-white font-bold" }, String(((_b = (_a = nodes.find(n => n.id === hoveredRetractNodeId)) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.urn) || hoveredRetractNodeId))),
446
+ React.createElement("div", { className: "grid grid-cols-3 gap-2 py-1.5 border-t border-b border-white/5 my-1" },
447
+ React.createElement("div", null,
448
+ React.createElement("div", { className: "text-[9px] text-gray-500 font-mono" }, "AFFECTED NODES"),
449
+ React.createElement("div", { className: "text-xs font-bold text-white font-mono" }, blastRadiusIds.size)),
450
+ React.createElement("div", null,
451
+ React.createElement("div", { className: "text-[9px] text-gray-500 font-mono" }, "SANDBOXES"),
452
+ React.createElement("div", { className: "text-xs font-bold text-white font-mono" }, affectedSandboxCount)),
453
+ React.createElement("div", null,
454
+ React.createElement("div", { className: "text-[9px] text-gray-500 font-mono" }, "DEFICIT FORECAST"),
455
+ React.createElement("div", { className: "text-xs font-bold text-white font-mono" },
456
+ deficitForecast.toFixed(1),
457
+ " u"))),
458
+ React.createElement("div", { className: "text-[9px] text-red-400/80 font-sans italic leading-relaxed" }, "CAUTION: Retracting this node executes a Do-operator mutation. All downstream dependent nodes will be invalidated."))))))),
459
+ hoveredRetractNodeId && (React.createElement(CausalInterventionOverlay, { nodes: nodes, hoveredNodeId: hoveredRetractNodeId }))),
322
460
  activePanicNode && (React.createElement("div", { className: "absolute inset-0 bg-black/60 backdrop-blur-sm z-[9999] flex justify-center items-center p-6" },
323
461
  React.createElement(ConformanceGuillotine, { nodeId: activePanicNode.nodeId, panicMessage: activePanicNode.panicMessage, backtrace: activePanicNode.backtrace, onClose: () => setActivePanicNode(null), onRecover: () => {
324
462
  console.log(`Triggering hot enclave recovery for ${activePanicNode.nodeId}`);
325
- // In production this emits a hot-attestation reload request to the Temporal ledger
326
463
  setActivePanicNode(null);
327
464
  } })))));
328
465
  };
466
+ export const TopologicalCanvas = (props) => {
467
+ return (React.createElement(ReactFlowProvider, null,
468
+ React.createElement(TopologicalCanvasInner, Object.assign({}, props))));
469
+ };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export interface AttestationReceipt {
3
+ transactionId: string;
4
+ proofStatus: 'VALIDATED' | 'FORGED' | 'INVALID' | 'UNCHECKED';
5
+ originatingAgentUrn: string;
6
+ verificationTimestamp: string;
7
+ zkProofHash: string;
8
+ sdJwtCompliance: boolean;
9
+ }
10
+ export interface SandboxHardwareTelemetry {
11
+ sandboxUrn: string;
12
+ cpuFuelRemaining: number;
13
+ cpuFuelBurnRate: number;
14
+ ramBytesAllocated: number;
15
+ }
16
+ export interface WasmSandboxCagingHudProps {
17
+ telemetry: SandboxHardwareTelemetry;
18
+ attestation?: AttestationReceipt;
19
+ className?: string;
20
+ }
21
+ export declare const WasmSandboxCagingHud: React.FC<WasmSandboxCagingHudProps>;
@@ -0,0 +1,167 @@
1
+ // Copyright (c) 2026 CoReason, Inc
2
+ //
3
+ // This software is proprietary and dual-licensed
4
+ // Licensed under the Prosperity Public License 3.0 (the "License")
5
+ // A copy of the license is available at <https://prosperitylicense.com/versions/3.0.0>
6
+ // For details, see the LICENSE file
7
+ // Commercial use beyond a 30-day trial requires a separate license
8
+ //
9
+ // Source Code: <https://github.com/CoReason-AI/coreason-runtime>
10
+ import React from 'react';
11
+ import { GlassBox } from './GlassBox';
12
+ import { Shield, Zap, AlertTriangle, Activity } from 'lucide-react';
13
+ export const WasmSandboxCagingHud = ({ telemetry, attestation = {
14
+ transactionId: 'tx_pending',
15
+ proofStatus: 'UNCHECKED',
16
+ originatingAgentUrn: 'urn:coreason:agent:unknown',
17
+ verificationTimestamp: new Date().toISOString(),
18
+ zkProofHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
19
+ sdJwtCompliance: false
20
+ }, className = '' }) => {
21
+ const ceilingRam = 10485760; // 10MB in bytes
22
+ const ramPercent = Math.min((telemetry.ramBytesAllocated / ceilingRam) * 100, 100);
23
+ const ramMb = telemetry.ramBytesAllocated / 1048576;
24
+ const criticalThreshold = 8388608; // 8MB in bytes
25
+ const isCriticalRam = telemetry.ramBytesAllocated >= criticalThreshold;
26
+ // Determine bubble count and rise animation duration based on CPU burn rate
27
+ const bubbleCount = 8;
28
+ const bubbleSpeedSeconds = Math.max(0.4, 6 - Math.min(5.5, telemetry.cpuFuelBurnRate / 8000));
29
+ const isProofValidated = attestation.proofStatus === 'VALIDATED';
30
+ const isProofForged = attestation.proofStatus === 'FORGED' || attestation.proofStatus === 'INVALID';
31
+ return (React.createElement("div", { className: `flex flex-col lg:flex-row gap-6 w-full h-full select-none text-white ${className}` },
32
+ React.createElement(GlassBox, { density: "dense", className: "flex-1 border border-white/10 bg-black/55 backdrop-blur-md p-6 flex flex-col gap-6 rounded-xl" },
33
+ React.createElement("div", { className: "flex items-center justify-between border-b border-white/10 pb-3" },
34
+ React.createElement("div", { className: "flex items-center gap-2" },
35
+ React.createElement(Zap, { className: "w-4 h-4 text-cyan-400" }),
36
+ React.createElement("span", { className: "text-[11px] font-bold text-gray-400 uppercase tracking-widest" }, "WASM Thermodynamic Supervisor")),
37
+ React.createElement("span", { className: "text-[9px] font-mono text-gray-500 truncate max-w-[200px]", title: telemetry.sandboxUrn }, telemetry.sandboxUrn.split(':').slice(-2).join(':') || telemetry.sandboxUrn)),
38
+ React.createElement("div", { className: "flex flex-col md:flex-row gap-8 items-center justify-center py-4" },
39
+ React.createElement("div", { className: "flex flex-col items-center gap-3" },
40
+ React.createElement("div", { className: "text-[10px] font-bold text-gray-400 uppercase tracking-wider" }, "Volumetric RAM Ceiling (10MB)"),
41
+ React.createElement("div", { className: "relative w-28 h-64 bg-black/40 border border-white/10 rounded-t-full rounded-b-full shadow-inner overflow-hidden flex flex-col justify-end" },
42
+ React.createElement("div", { className: "absolute top-0 left-0 right-0 h-6 bg-white/5 border-b border-white/15 rounded-full z-20" }),
43
+ React.createElement("div", { className: "absolute inset-0 z-10 pointer-events-none overflow-hidden" }, Array.from({ length: bubbleCount }).map((_, index) => {
44
+ const leftOffset = 15 + index * 10;
45
+ const delay = index * 0.35;
46
+ const scale = 0.5 + (index % 3) * 0.25;
47
+ return (React.createElement("div", { key: index, className: "absolute bottom-2 w-2 h-2 bg-cyan-400/40 rounded-full", style: {
48
+ left: `${leftOffset}%`,
49
+ animationName: 'rise',
50
+ animationDuration: `${bubbleSpeedSeconds}s`,
51
+ animationTimingFunction: 'linear',
52
+ animationIterationCount: 'infinite',
53
+ animationDelay: `${delay}s`,
54
+ transform: `scale(${scale})`
55
+ } }));
56
+ })),
57
+ React.createElement("div", { className: `relative w-full transition-all duration-700 ease-out z-0 flex flex-col justify-start`, style: {
58
+ height: `${ramPercent}%`,
59
+ background: isCriticalRam
60
+ ? 'linear-gradient(to top, rgba(239, 68, 68, 0.4), rgba(220, 38, 38, 0.7))'
61
+ : 'linear-gradient(to top, rgba(6, 182, 212, 0.3), rgba(14, 165, 233, 0.55))'
62
+ } },
63
+ React.createElement("div", { className: `absolute -top-3 left-0 right-0 h-6 rounded-full border-t border-white/20 transition-all duration-700`, style: {
64
+ backgroundColor: isCriticalRam ? 'rgba(220, 38, 38, 0.85)' : 'rgba(14, 165, 233, 0.75)',
65
+ boxShadow: isCriticalRam ? '0 0 12px rgba(220, 38, 38, 0.8)' : '0 0 12px rgba(14, 165, 233, 0.6)'
66
+ } })),
67
+ React.createElement("div", { className: "absolute bottom-[80%] left-0 right-0 border-t border-red-500/30 border-dashed z-20 flex justify-end pr-2 pointer-events-none" },
68
+ React.createElement("span", { className: "text-[8px] text-red-400/70 font-mono bg-black/40 px-1 rounded -translate-y-1.5" }, "80% (8MB)"))),
69
+ React.createElement("div", { className: "text-center font-mono mt-1" },
70
+ React.createElement("span", { className: `text-base font-bold ${isCriticalRam ? 'text-red-400 animate-pulse' : 'text-cyan-400'}` },
71
+ ramMb.toFixed(2),
72
+ " MB"),
73
+ React.createElement("span", { className: "text-[9px] text-gray-500 block" },
74
+ "Utilization: ",
75
+ ramPercent.toFixed(1),
76
+ "%"))),
77
+ React.createElement("div", { className: "flex-1 w-full flex flex-col gap-4 font-mono" },
78
+ React.createElement("div", { className: "p-3 bg-black/35 rounded-lg border border-white/5" },
79
+ React.createElement("div", { className: "text-[9px] text-gray-500 uppercase tracking-wider" }, "Remaining Instruction Fuel"),
80
+ React.createElement("div", { className: "text-lg font-bold text-white mt-1" },
81
+ telemetry.cpuFuelRemaining.toLocaleString(),
82
+ " units"),
83
+ React.createElement("div", { className: "w-full bg-gray-900 rounded-full h-1.5 overflow-hidden border border-white/5 mt-2" },
84
+ React.createElement("div", { className: "h-full bg-cyan-400 rounded-full transition-all duration-300", style: { width: `${Math.min(100, (telemetry.cpuFuelRemaining / 1000000) * 100)}%` } }))),
85
+ React.createElement("div", { className: "p-3 bg-black/35 rounded-lg border border-white/5" },
86
+ React.createElement("div", { className: "text-[9px] text-gray-500 uppercase tracking-wider" }, "CPU Instruction Velocity"),
87
+ React.createElement("div", { className: "text-lg font-bold text-[var(--cr-accent-orange)] mt-1 flex items-baseline gap-1" },
88
+ telemetry.cpuFuelBurnRate.toLocaleString(),
89
+ React.createElement("span", { className: "text-[9px] text-gray-400 font-normal" }, "fuel/sec")),
90
+ React.createElement("div", { className: "flex items-center gap-1.5 mt-2 text-[9px] text-gray-400" },
91
+ React.createElement(Activity, { className: "w-3 h-3 text-orange-400 animate-pulse" }),
92
+ React.createElement("span", null, "Bubble speed scaled dynamically."))),
93
+ isCriticalRam && (React.createElement("div", { className: "p-3 bg-red-950/45 border border-red-500/40 rounded-lg flex items-start gap-2 animate-pulse" },
94
+ React.createElement(AlertTriangle, { className: "w-4 h-4 text-red-400 shrink-0 mt-0.5" }),
95
+ React.createElement("div", null,
96
+ React.createElement("div", { className: "text-[9px] font-bold text-red-300 uppercase tracking-wider" }, "RESOURCE PANIC STATUS"),
97
+ React.createElement("p", { className: "text-[9px] text-red-200 mt-0.5 leading-relaxed" }, "WASM guest node allocation has breached the 8MB thermodynamic warning limit. Isolation supervisor enforces hard halt at 10MB."))))))),
98
+ React.createElement(GlassBox, { density: "dense", className: "w-full lg:w-[360px] border border-white/10 bg-black/55 backdrop-blur-md p-6 flex flex-col gap-6 rounded-xl shrink-0" },
99
+ React.createElement("div", { className: "flex items-center gap-2 border-b border-white/10 pb-3" },
100
+ React.createElement(Shield, { className: "w-4 h-4 text-green-400" }),
101
+ React.createElement("span", { className: "text-[11px] font-bold text-gray-400 uppercase tracking-widest" }, "Attestation & Proof Shield")),
102
+ React.createElement("div", { className: "flex flex-col items-center justify-center py-6 gap-6" },
103
+ React.createElement("div", { className: "relative w-40 h-40 flex items-center justify-center perspective-[800px]" },
104
+ React.createElement("div", { className: "relative w-32 h-32 transform-style-3d transition-transform duration-1000 ease-in-out", style: {
105
+ transform: `rotateX(15deg) ${isProofForged ? 'rotateY(180deg)' : 'rotateY(0deg)'}`
106
+ } },
107
+ React.createElement("div", { className: "absolute inset-0 transform-style-3d transition-all duration-700 backface-hidden flex items-center justify-center", style: {
108
+ transform: isProofValidated ? 'rotateY(0deg)' : 'rotateY(110deg)'
109
+ } },
110
+ React.createElement("svg", { viewBox: "0 0 100 100", className: "w-full h-full drop-shadow-[0_0_15px_rgba(34,197,94,0.4)]" },
111
+ React.createElement("polygon", { points: "50,10 85,25 85,60 50,90 15,60 15,25", fill: "#14532d", fillOpacity: "0.8", stroke: "#22c55e", strokeWidth: "2" }),
112
+ React.createElement("polygon", { points: "50,10 50,90 15,60", fill: "#15803d", fillOpacity: "0.4", stroke: "#22c55e", strokeWidth: "1" }),
113
+ React.createElement("polygon", { points: "50,10 85,25 50,90", fill: "#166534", fillOpacity: "0.4", stroke: "#22c55e", strokeWidth: "1" }),
114
+ React.createElement("path", { d: "M40,40 V30 A10,10 0 0,1 60,30 V40 M32,40 H68 V68 H32 Z", fill: "none", stroke: "#22c55e", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }),
115
+ React.createElement("circle", { cx: "50", cy: "52", r: "3", fill: "#22c55e" }))),
116
+ React.createElement("div", { className: "absolute inset-0 transform-style-3d transition-all duration-700 backface-hidden flex items-center justify-center", style: {
117
+ transform: isProofForged ? 'rotateY(0deg)' : 'rotateY(-110deg)'
118
+ } },
119
+ React.createElement("svg", { viewBox: "0 0 100 100", className: "w-full h-full drop-shadow-[0_0_15px_rgba(249,115,22,0.45)]" },
120
+ React.createElement("polygon", { points: "50,25 65,45 35,45", fill: "#7c2d12", stroke: "#f97316", strokeWidth: "1.5" }),
121
+ React.createElement("polygon", { points: "35,45 20,65 50,65", fill: "#9a3412", stroke: "#f97316", strokeWidth: "1.5" }),
122
+ React.createElement("polygon", { points: "65,45 50,65 80,65", fill: "#7c2d12", stroke: "#f97316", strokeWidth: "1.5" }),
123
+ React.createElement("line", { x1: "30", y1: "35", x2: "70", y2: "75", stroke: "#ea580c", strokeWidth: "3", strokeDasharray: "4,4" }),
124
+ React.createElement("line", { x1: "40", y1: "25", x2: "80", y2: "65", stroke: "#ea580c", strokeWidth: "3", strokeDasharray: "4,4" }),
125
+ React.createElement("path", { d: "M45,45 L55,55 M55,45 L45,55", fill: "none", stroke: "#ef4444", strokeWidth: "3", strokeLinecap: "round" }))),
126
+ !isProofValidated && !isProofForged && (React.createElement("div", { className: "absolute inset-0 flex items-center justify-center" },
127
+ React.createElement("svg", { viewBox: "0 0 100 100", className: "w-full h-full opacity-60" },
128
+ React.createElement("polygon", { points: "50,15 80,30 80,65 50,85 20,65 20,30", fill: "#1e293b", fillOpacity: "0.7", stroke: "#64748b", strokeWidth: "2", strokeDasharray: "3,3" }),
129
+ React.createElement("path", { d: "M42,40 V32 A8,8 0 0,1 58,32 V40 M35,40 H65 V65 H35 Z", fill: "none", stroke: "#64748b", strokeWidth: "2" }))))),
130
+ React.createElement("div", { className: "absolute bottom-2 flex flex-col items-center" },
131
+ React.createElement("span", { className: `text-[10px] font-bold px-2 py-0.5 rounded tracking-widest font-mono border ${isProofValidated
132
+ ? 'bg-green-900/60 text-green-300 border-green-500/30'
133
+ : isProofForged
134
+ ? 'bg-orange-950/60 text-orange-400 border-orange-500/30 animate-pulse'
135
+ : 'bg-slate-900/60 text-slate-400 border-slate-700/30'}` }, attestation.proofStatus))),
136
+ React.createElement("div", { className: "w-full font-mono text-[9px] bg-black/35 rounded-lg border border-white/5 p-3 flex flex-col gap-2" },
137
+ React.createElement("div", { className: "flex justify-between border-b border-white/5 pb-1" },
138
+ React.createElement("span", { className: "text-gray-500" }, "Transaction ID"),
139
+ React.createElement("span", { className: "text-white font-bold" }, attestation.transactionId)),
140
+ React.createElement("div", { className: "flex justify-between border-b border-white/5 pb-1" },
141
+ React.createElement("span", { className: "text-gray-500" }, "Proof Hash"),
142
+ React.createElement("span", { className: "text-gray-300 truncate w-[160px] text-right", title: attestation.zkProofHash }, attestation.zkProofHash)),
143
+ React.createElement("div", { className: "flex justify-between border-b border-white/5 pb-1" },
144
+ React.createElement("span", { className: "text-gray-500" }, "SD-JWT Compliance"),
145
+ React.createElement("span", { className: attestation.sdJwtCompliance ? 'text-green-400 font-bold' : 'text-orange-400 font-bold' }, attestation.sdJwtCompliance ? 'COMPLIANT' : 'DEFICIT')),
146
+ React.createElement("div", { className: "flex justify-between" },
147
+ React.createElement("span", { className: "text-gray-500" }, "Attestation Timestamp"),
148
+ React.createElement("span", { className: "text-gray-400" }, new Date(attestation.verificationTimestamp).toLocaleTimeString()))))),
149
+ React.createElement("style", null, `
150
+ @keyframes rise {
151
+ 0% {
152
+ transform: translateY(100%) scale(0.6);
153
+ opacity: 0;
154
+ }
155
+ 10% {
156
+ opacity: 0.6;
157
+ }
158
+ 90% {
159
+ opacity: 0.6;
160
+ }
161
+ 100% {
162
+ transform: translateY(-240px) scale(1.1);
163
+ opacity: 0;
164
+ }
165
+ }
166
+ `)));
167
+ };
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { ThermodynamicGovernor } from './components/ThermodynamicGovernor';
6
6
  export { QuorumAdjudicator } from './components/QuorumAdjudicator';
7
7
  export { HolographicAuditTrail } from './components/HolographicAuditTrail';
8
8
  export { MarkovBlanketLens } from './components/MarkovBlanketLens';
9
- export { TopologicalCanvas } from './components/TopologicalCanvas';
9
+ export { TopologicalCanvas, computeBlastRadius } from './components/TopologicalCanvas';
10
10
  export { CognitiveIntrospectionPanel } from './components/CognitiveIntrospectionPanel';
11
11
  export { SVIDBadge } from './components/SVIDBadge';
12
12
  export { ConformanceGuillotine } from './components/ConformanceGuillotine';
@@ -17,3 +17,9 @@ export { SensoryUnfolder } from './components/SensoryUnfolder';
17
17
  export { MultimodalProjection } from './components/MultimodalProjection';
18
18
  export { MultimodalCapture } from './components/MultimodalCapture';
19
19
  export { DynamicToposRenderer } from './components/DynamicToposRenderer';
20
+ export { SpeculativeTreeRenderer } from './components/SpeculativeTreeRenderer';
21
+ export type { SpeculativeTokenNode, SpeculativeTreeRendererProps, SpeculativeValidationStatus } from './components/SpeculativeTreeRenderer';
22
+ export { EpistemicDeficitRadar } from './components/EpistemicDeficitRadar';
23
+ export type { EpistemicDeficitRadarProps } from './components/EpistemicDeficitRadar';
24
+ export { WasmSandboxCagingHud } from './components/WasmSandboxCagingHud';
25
+ export type { WasmSandboxCagingHudProps, SandboxHardwareTelemetry, AttestationReceipt } from './components/WasmSandboxCagingHud';
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ export { ThermodynamicGovernor } from './components/ThermodynamicGovernor';
15
15
  export { QuorumAdjudicator } from './components/QuorumAdjudicator';
16
16
  export { HolographicAuditTrail } from './components/HolographicAuditTrail';
17
17
  export { MarkovBlanketLens } from './components/MarkovBlanketLens';
18
- export { TopologicalCanvas } from './components/TopologicalCanvas';
18
+ export { TopologicalCanvas, computeBlastRadius } from './components/TopologicalCanvas';
19
19
  export { CognitiveIntrospectionPanel } from './components/CognitiveIntrospectionPanel';
20
20
  export { SVIDBadge } from './components/SVIDBadge';
21
21
  export { ConformanceGuillotine } from './components/ConformanceGuillotine';
@@ -26,3 +26,6 @@ export { SensoryUnfolder } from './components/SensoryUnfolder';
26
26
  export { MultimodalProjection } from './components/MultimodalProjection';
27
27
  export { MultimodalCapture } from './components/MultimodalCapture';
28
28
  export { DynamicToposRenderer } from './components/DynamicToposRenderer';
29
+ export { SpeculativeTreeRenderer } from './components/SpeculativeTreeRenderer';
30
+ export { EpistemicDeficitRadar } from './components/EpistemicDeficitRadar';
31
+ export { WasmSandboxCagingHud } from './components/WasmSandboxCagingHud';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreason-ai/sensory-core",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Topos-Theoretic UI primitive library for the CoReason Cybernetic Manifold. Stateless, hollow React components that project coreason-manifest Pydantic ASTs into the DOM.",
5
5
  "license": "Prosperity-3.0",
6
6
  "author": "CoReason, Inc. <info@coreason.ai>",