@coreason-ai/sensory-core 1.0.3

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +57 -0
  3. package/NOTICE +21 -0
  4. package/README.md +60 -0
  5. package/dist/components/CognitiveIntrospectionPanel.d.ts +15 -0
  6. package/dist/components/CognitiveIntrospectionPanel.js +45 -0
  7. package/dist/components/ConstrainedDecodingInspector.d.ts +2 -0
  8. package/dist/components/ConstrainedDecodingInspector.js +71 -0
  9. package/dist/components/ConstraintInspector.d.ts +11 -0
  10. package/dist/components/ConstraintInspector.js +52 -0
  11. package/dist/components/DynamicToposRenderer.d.ts +17 -0
  12. package/dist/components/DynamicToposRenderer.js +40 -0
  13. package/dist/components/ForgePreview.d.ts +9 -0
  14. package/dist/components/ForgePreview.js +81 -0
  15. package/dist/components/GlassBox.d.ts +9 -0
  16. package/dist/components/GlassBox.js +32 -0
  17. package/dist/components/HardwareProfiler.d.ts +20 -0
  18. package/dist/components/HardwareProfiler.js +54 -0
  19. package/dist/components/HolographicAuditTrail.d.ts +21 -0
  20. package/dist/components/HolographicAuditTrail.js +53 -0
  21. package/dist/components/KnowledgeTree.d.ts +12 -0
  22. package/dist/components/KnowledgeTree.js +23 -0
  23. package/dist/components/LogitVisualizer.d.ts +16 -0
  24. package/dist/components/LogitVisualizer.js +113 -0
  25. package/dist/components/ManifestExplorer.d.ts +10 -0
  26. package/dist/components/ManifestExplorer.js +51 -0
  27. package/dist/components/MarkovBlanketLens.d.ts +20 -0
  28. package/dist/components/MarkovBlanketLens.js +45 -0
  29. package/dist/components/MultimodalCapture.d.ts +13 -0
  30. package/dist/components/MultimodalCapture.js +59 -0
  31. package/dist/components/MultimodalProjection.d.ts +8 -0
  32. package/dist/components/MultimodalProjection.js +39 -0
  33. package/dist/components/QuorumAdjudicator.d.ts +21 -0
  34. package/dist/components/QuorumAdjudicator.js +46 -0
  35. package/dist/components/SensoryUnfolder.d.ts +13 -0
  36. package/dist/components/SensoryUnfolder.js +77 -0
  37. package/dist/components/StatusPulse.d.ts +8 -0
  38. package/dist/components/StatusPulse.js +56 -0
  39. package/dist/components/TemporalScrubber.d.ts +16 -0
  40. package/dist/components/TemporalScrubber.js +36 -0
  41. package/dist/components/ThermodynamicGovernor.d.ts +17 -0
  42. package/dist/components/ThermodynamicGovernor.js +50 -0
  43. package/dist/components/TopologicalCanvas.d.ts +27 -0
  44. package/dist/components/TopologicalCanvas.js +183 -0
  45. package/dist/components/VFEIndicator.d.ts +15 -0
  46. package/dist/components/VFEIndicator.js +52 -0
  47. package/dist/components/VerifiedCapabilityReceipt.d.ts +19 -0
  48. package/dist/components/VerifiedCapabilityReceipt.js +37 -0
  49. package/dist/components/nodes/AgentNode.d.ts +14 -0
  50. package/dist/components/nodes/AgentNode.js +51 -0
  51. package/dist/components/nodes/SandboxNode.d.ts +11 -0
  52. package/dist/components/nodes/SandboxNode.js +66 -0
  53. package/dist/components/nodes/SubstrateNode.d.ts +4 -0
  54. package/dist/components/nodes/SubstrateNode.js +57 -0
  55. package/dist/components/nodes/ThermodynamicNode.d.ts +12 -0
  56. package/dist/components/nodes/ThermodynamicNode.js +52 -0
  57. package/dist/index.d.ts +17 -0
  58. package/dist/index.js +26 -0
  59. package/dist/test/setup.d.ts +1 -0
  60. package/dist/test/setup.js +1 -0
  61. package/dist/workers/elkWorker.d.ts +1 -0
  62. package/dist/workers/elkWorker.js +45 -0
  63. package/package.json +88 -0
@@ -0,0 +1,77 @@
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 { TopologicalCanvas } from './TopologicalCanvas';
12
+ import { GlassBox } from './GlassBox';
13
+ import { StatusPulse } from './StatusPulse';
14
+ import { VFEIndicator } from './VFEIndicator';
15
+ import { HolographicAuditTrail } from './HolographicAuditTrail';
16
+ import { KnowledgeTree } from './KnowledgeTree';
17
+ import { ConstrainedDecodingInspector } from './ConstrainedDecodingInspector';
18
+ import { ThermodynamicGovernor } from './ThermodynamicGovernor';
19
+ import { QuorumAdjudicator } from './QuorumAdjudicator';
20
+ class SensoryErrorBoundary extends React.Component {
21
+ constructor(props) {
22
+ super(props);
23
+ this.state = { hasError: false, error: null };
24
+ }
25
+ static getDerivedStateFromError(error) {
26
+ return { hasError: true, error };
27
+ }
28
+ componentDidCatch(error, errorInfo) {
29
+ console.error('SensoryUnfolder error boundary caught an execution bleed:', error, errorInfo);
30
+ }
31
+ render() {
32
+ if (this.state.hasError) {
33
+ return this.props.fallback;
34
+ }
35
+ return this.props.children;
36
+ }
37
+ }
38
+ const SensoryPrimitive = ({ urn, data }) => {
39
+ switch (urn) {
40
+ case 'urn:coreason:actionspace:sensory:topological_canvas:v1':
41
+ return React.createElement(TopologicalCanvas, Object.assign({}, data));
42
+ case 'urn:coreason:actionspace:sensory:glass_box:v1':
43
+ return React.createElement(GlassBox, Object.assign({}, data), data.children);
44
+ case 'urn:coreason:actionspace:sensory:status_pulse:v1':
45
+ return React.createElement(StatusPulse, Object.assign({}, data));
46
+ case 'urn:coreason:actionspace:sensory:vfe_indicator:v1':
47
+ return React.createElement(VFEIndicator, Object.assign({}, data));
48
+ case 'urn:coreason:actionspace:sensory:audit_trail:v1':
49
+ return React.createElement(HolographicAuditTrail, Object.assign({}, data));
50
+ case 'urn:coreason:actionspace:sensory:knowledge_tree:v1':
51
+ return React.createElement(KnowledgeTree, Object.assign({}, data));
52
+ case 'urn:coreason:actionspace:sensory:decoding_inspector:v1':
53
+ return React.createElement(ConstrainedDecodingInspector, Object.assign({}, data));
54
+ case 'urn:coreason:actionspace:sensory:thermodynamic_governor:v1':
55
+ return React.createElement(ThermodynamicGovernor, Object.assign({}, data));
56
+ case 'urn:coreason:actionspace:sensory:quorum_adjudicator:v1':
57
+ return React.createElement(QuorumAdjudicator, Object.assign({}, data));
58
+ default:
59
+ throw new Error(`URN '${urn}' is not supported in the active layout registry.`);
60
+ }
61
+ };
62
+ /**
63
+ * AGENT INSTRUCTION: This core component performs the recursive JIT unfolding of nested URN visual geometries.
64
+ * CAUSAL AFFORDANCE: Dynamically maps standard URN strings to their corresponding React/WebGL visual enclaves.
65
+ * EPISTEMIC BOUNDS: Gracefully handles missing URN mappings via a localized error boundary and fallback mechanism.
66
+ * MCP ROUTING TRIGGERS: Sensory, Unfolding, JIT, Hot-Swap, URN Registry.
67
+ */
68
+ export const SensoryUnfolder = ({ urn, data, fallback }) => {
69
+ const defaultFallback = (React.createElement("div", { className: "p-4 rounded-xl border border-dashed border-[var(--cr-accent-orange)] bg-[rgba(255,100,0,0.05)] text-[var(--cr-accent-orange)] font-mono text-xs max-w-md" },
70
+ React.createElement("div", { className: "font-bold mb-1" }, "\u26A0\uFE0F EPISTEMIC DEFICIT GAVE UNRESOLVED BOUNDARY"),
71
+ React.createElement("div", null,
72
+ "Requested URN ",
73
+ React.createElement("span", { className: "underline" }, urn),
74
+ " could not be unfolded by the active sensory manifold.")));
75
+ return (React.createElement(SensoryErrorBoundary, { fallback: fallback || defaultFallback },
76
+ React.createElement(SensoryPrimitive, { urn: urn, data: data })));
77
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface StatusPulseProps {
3
+ status: 'executing' | 'suspended_vfe_breach' | 'completed' | 'idle';
4
+ vfeValue?: number;
5
+ label?: string;
6
+ className?: string;
7
+ }
8
+ export declare const StatusPulse: React.FC<StatusPulseProps>;
@@ -0,0 +1,56 @@
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 { motion } from 'framer-motion';
12
+ import { cn } from './GlassBox';
13
+ export const StatusPulse = ({ status, vfeValue, label, className }) => {
14
+ const isError = status === 'suspended_vfe_breach';
15
+ const isExecuting = status === 'executing';
16
+ const isCompleted = status === 'completed';
17
+ const baseColor = isError
18
+ ? 'var(--cr-accent-orange)'
19
+ : isExecuting
20
+ ? 'var(--cr-accent-cyan)'
21
+ : isCompleted
22
+ ? '#00cc44'
23
+ : '#666';
24
+ // Compute dynamic pulse duration based on VFE stress
25
+ const pulseDuration = vfeValue !== undefined && vfeValue > 0
26
+ ? Math.max(0.3, 1.5 - (vfeValue * 0.8)) // breathing rate speeds up as VFE increases
27
+ : isError
28
+ ? 0.5 // Rapid flashing on error
29
+ : 1.8; // Calmer breathing under normal load
30
+ return (React.createElement("div", { className: cn("flex items-center gap-2", className) },
31
+ React.createElement(motion.div, { animate: isExecuting || isError
32
+ ? {
33
+ scale: [1, 1.25, 1],
34
+ opacity: [0.6, 1, 0.6],
35
+ boxShadow: [
36
+ `0 0 4px ${baseColor}`,
37
+ `0 0 16px ${baseColor}`,
38
+ `0 0 4px ${baseColor}`,
39
+ ],
40
+ }
41
+ : {
42
+ scale: 1,
43
+ opacity: 1,
44
+ boxShadow: `0 0 2px ${baseColor}`,
45
+ }, transition: {
46
+ repeat: isExecuting || isError ? Infinity : 0,
47
+ duration: pulseDuration,
48
+ ease: 'easeInOut',
49
+ }, className: cn('w-3 h-3 rounded-full'), style: {
50
+ backgroundColor: baseColor,
51
+ } }),
52
+ React.createElement("span", { className: "font-mono text-xs font-semibold", style: { color: baseColor } },
53
+ label || status.toUpperCase(),
54
+ " ",
55
+ vfeValue !== undefined && `(VFE: ${vfeValue.toFixed(2)})`)));
56
+ };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ export interface TemporalFork {
3
+ id: string;
4
+ branchPoint: number;
5
+ name: string;
6
+ }
7
+ export interface TemporalScrubberProps {
8
+ timestamp: number;
9
+ minRange: number;
10
+ maxRange: number;
11
+ forks?: TemporalFork[];
12
+ onScrub: (newTime: number) => void;
13
+ onForkSelect?: (forkId: string) => void;
14
+ className?: string;
15
+ }
16
+ export declare const TemporalScrubber: React.FC<TemporalScrubberProps>;
@@ -0,0 +1,36 @@
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 { motion } from 'framer-motion';
12
+ import { cn } from './GlassBox';
13
+ export const TemporalScrubber = ({ timestamp, minRange, maxRange, forks = [], onScrub, onForkSelect, className }) => {
14
+ const getPercentage = (val) => ((val - minRange) / (maxRange - minRange)) * 100;
15
+ return (React.createElement("div", { className: cn('flex flex-col items-stretch gap-4 p-4 bg-[var(--cr-glass-box-black)] rounded-xl border border-gray-800', className) },
16
+ React.createElement("div", { className: "flex justify-between items-center mb-2" },
17
+ React.createElement("span", { className: "text-white uppercase tracking-widest text-xs font-bold" }, "Temporal Navigation"),
18
+ React.createElement("span", { className: "text-[var(--cr-accent-cyan)] font-mono text-xs" },
19
+ "T - ",
20
+ Math.floor((Date.now() - timestamp) / 1000),
21
+ "s")),
22
+ React.createElement("div", { className: "relative h-16 w-full" },
23
+ React.createElement("div", { className: "absolute top-8 left-0 right-0 h-1 bg-gray-700 rounded-full" }),
24
+ React.createElement("div", { className: "absolute top-8 left-0 h-1 bg-[var(--cr-accent-cyan)] rounded-full transition-all", style: { width: `${getPercentage(timestamp)}%` } }),
25
+ forks.map((fork, idx) => {
26
+ const startPct = getPercentage(fork.branchPoint);
27
+ const topOffset = idx % 2 === 0 ? 0 : 16;
28
+ return (React.createElement(motion.div, { key: fork.id, initial: { opacity: 0 }, animate: { opacity: 1 }, className: "absolute h-1 bg-[var(--cr-accent-orange)] cursor-pointer group", style: { left: `${startPct}%`, top: topOffset, width: `calc(100% - ${startPct}%)` }, onClick: () => onForkSelect === null || onForkSelect === void 0 ? void 0 : onForkSelect(fork.id) },
29
+ React.createElement("div", { className: "absolute -left-1 -top-1 w-3 h-3 rounded-full bg-[var(--cr-accent-orange)]" }),
30
+ React.createElement("div", { className: "absolute -top-6 left-0 opacity-0 group-hover:opacity-100 transition-opacity bg-black text-[var(--cr-accent-orange)] text-[10px] font-mono px-2 py-1 rounded" },
31
+ "\u2443 ",
32
+ fork.name)));
33
+ }),
34
+ React.createElement("input", { type: "range", min: minRange, max: maxRange, value: timestamp, onChange: (e) => onScrub(Number(e.target.value)), className: "absolute top-[26px] w-full cursor-ew-resize opacity-0 z-10" }),
35
+ React.createElement(motion.div, { className: "absolute top-6 w-5 h-5 rounded-full bg-white border-2 border-[var(--cr-accent-cyan)] shadow-[0_0_10px_var(--cr-accent-cyan)] pointer-events-none", style: { left: `calc(${getPercentage(timestamp)}% - 10px)` }, layout: true }))));
36
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export interface ThermodynamicGovernorProps {
3
+ vramAllocationMb: number;
4
+ tokenBurnRateSec: number;
5
+ maxBudgetTokens: number;
6
+ consumedTokens: number;
7
+ spiffeStatus: 'VERIFIED' | 'REVOKED' | 'PENDING';
8
+ }
9
+ /**
10
+ * ThermodynamicGovernor
11
+ *
12
+ * Target Persona: System Administrator
13
+ * Concept: Resource Governance & Sovereign Computing
14
+ * Translates abstract AI usage into physical thermodynamic costs (VRAM, Token Burn)
15
+ * and cryptographic identity (SPIFFE/SPIRE).
16
+ */
17
+ export declare const ThermodynamicGovernor: React.FC<ThermodynamicGovernorProps>;
@@ -0,0 +1,50 @@
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 { GlassBox } from './GlassBox';
12
+ /**
13
+ * ThermodynamicGovernor
14
+ *
15
+ * Target Persona: System Administrator
16
+ * Concept: Resource Governance & Sovereign Computing
17
+ * Translates abstract AI usage into physical thermodynamic costs (VRAM, Token Burn)
18
+ * and cryptographic identity (SPIFFE/SPIRE).
19
+ */
20
+ export const ThermodynamicGovernor = ({ vramAllocationMb, tokenBurnRateSec, maxBudgetTokens, consumedTokens, spiffeStatus }) => {
21
+ const budgetPercent = Math.min((consumedTokens / maxBudgetTokens) * 100, 100);
22
+ const isCritical = budgetPercent > 90;
23
+ return (React.createElement(GlassBox, { density: "dense" },
24
+ React.createElement("div", { className: "flex flex-col space-y-3" },
25
+ React.createElement("div", { className: "flex justify-between items-center border-b border-gray-700 pb-2" },
26
+ React.createElement("h3", { className: "text-sm font-semibold text-white tracking-widest uppercase" }, "Thermodynamic Governor"),
27
+ React.createElement("span", { className: `text-xs px-2 py-1 rounded-full ${spiffeStatus === 'VERIFIED' ? 'bg-green-900 text-green-300' : 'bg-red-900 text-red-300'}` },
28
+ "SPIFFE: ",
29
+ spiffeStatus)),
30
+ React.createElement("div", { className: "grid grid-cols-2 gap-4" },
31
+ React.createElement("div", { className: "flex flex-col" },
32
+ React.createElement("span", { className: "text-xs text-gray-400" }, "VRAM Allocation"),
33
+ React.createElement("span", { className: "text-lg font-mono text-white" },
34
+ vramAllocationMb.toLocaleString(),
35
+ " MB")),
36
+ React.createElement("div", { className: "flex flex-col" },
37
+ React.createElement("span", { className: "text-xs text-gray-400" }, "Token Velocity"),
38
+ React.createElement("span", { className: "text-lg font-mono text-[var(--cr-accent-orange)]" },
39
+ tokenBurnRateSec,
40
+ " T/s"))),
41
+ React.createElement("div", { className: "flex flex-col space-y-1 pt-2" },
42
+ React.createElement("div", { className: "flex justify-between text-xs" },
43
+ React.createElement("span", { className: "text-gray-400" }, "Compute Budget"),
44
+ React.createElement("span", { className: isCritical ? 'text-red-400' : 'text-gray-400' },
45
+ consumedTokens.toLocaleString(),
46
+ " / ",
47
+ maxBudgetTokens.toLocaleString())),
48
+ React.createElement("div", { className: "w-full bg-gray-800 rounded-full h-1.5 overflow-hidden" },
49
+ React.createElement("div", { className: `h-1.5 rounded-full ${isCritical ? 'bg-red-500' : 'bg-[var(--cr-accent-orange)]'}`, style: { width: `${budgetPercent}%`, transition: 'width 0.5s ease-out' } }))))));
50
+ };
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { Node, Edge } from '@xyflow/react';
3
+ import '@xyflow/react/dist/style.css';
4
+ export interface CapabilityRegistryItem {
5
+ urn: string;
6
+ typeLabel: string;
7
+ }
8
+ export interface TopologicalCanvasProps {
9
+ nodes: Node[];
10
+ edges: Edge[];
11
+ availableCapabilities?: CapabilityRegistryItem[];
12
+ onNodeClick?: (event: React.MouseEvent, node: Node) => void;
13
+ onNodesChange?: (changes: any) => void;
14
+ onEdgesChange?: (changes: any) => void;
15
+ onConnect?: (connection: any) => void;
16
+ onDropCapability?: (capability: CapabilityRegistryItem, position: {
17
+ x: number;
18
+ y: number;
19
+ }) => void;
20
+ }
21
+ /**
22
+ * TopologicalCanvas
23
+ *
24
+ * Concept: Visualizes the Macro-Swarm Architecture
25
+ * Uses ReactFlow to map mathematical DAGs to the UI.
26
+ */
27
+ export declare const TopologicalCanvas: React.FC<TopologicalCanvasProps>;
@@ -0,0 +1,183 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
11
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12
+ return new (P || (P = Promise))(function (resolve, reject) {
13
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
14
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
15
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
16
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
17
+ });
18
+ };
19
+ import React from 'react';
20
+ import { ReactFlow, Background, Controls, getBezierPath, EdgeLabelRenderer, Panel } from '@xyflow/react';
21
+ import '@xyflow/react/dist/style.css';
22
+ import { GlassBox } from './GlassBox';
23
+ import { StatusPulse } from './StatusPulse';
24
+ // Custom Node: SwarmNode
25
+ const SwarmNode = ({ data }) => {
26
+ var _a;
27
+ return (React.createElement(GlassBox, { density: "dense", className: `border ${data.isAnomalous ? 'border-[var(--cr-accent-orange)]' : 'border-gray-800'} min-w-[150px]` },
28
+ React.createElement("div", { className: "flex flex-col" },
29
+ React.createElement("div", { className: "flex justify-between items-center mb-2" },
30
+ React.createElement("span", { className: "text-[10px] uppercase tracking-widest text-gray-500" }, data.typeLabel || 'AGENT'),
31
+ React.createElement(StatusPulse, { status: data.status || 'idle' })),
32
+ 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'))));
33
+ };
34
+ // Custom Node: SandboxNode (For Fractal Infrastructure)
35
+ const SandboxNode = ({ id, data }) => {
36
+ const fuelPercentage = data.cpuFuel && data.maxFuel ? (data.cpuFuel / data.maxFuel) * 100 : 100;
37
+ const memoryPercentage = data.memoryUsage && data.maxMemory ? (data.memoryUsage / data.maxMemory) * 100 : 0;
38
+ return (React.createElement("div", { className: "bg-[rgba(20,20,20,0.8)] border border-[var(--cr-accent-orange)] rounded-lg p-4 min-w-[300px] min-h-[200px] relative shadow-[0_0_15px_rgba(255,100,0,0.2)]" },
39
+ React.createElement("div", { className: "absolute top-0 left-0 right-0 bg-[var(--cr-accent-orange)] text-black text-[10px] font-bold uppercase tracking-wider px-2 py-1 rounded-t-sm flex justify-between items-center" },
40
+ React.createElement("span", null,
41
+ "\u26CA ",
42
+ data.sandboxType || 'WASM ENCLAVE',
43
+ " ISOLATION BOUNDARY"),
44
+ React.createElement("span", { className: "font-mono" }, data.id || id)),
45
+ React.createElement("div", { className: "mt-6 mb-2 flex flex-col gap-2" },
46
+ React.createElement("div", { className: "flex items-center justify-between text-[10px] font-mono text-gray-400" },
47
+ React.createElement("span", null, "CPU FUEL"),
48
+ React.createElement("span", null,
49
+ data.cpuFuel || 0,
50
+ " / ",
51
+ data.maxFuel || 0)),
52
+ React.createElement("div", { className: "h-1 bg-gray-800 rounded-full overflow-hidden" },
53
+ React.createElement("div", { className: "h-full bg-[var(--cr-accent-orange)] transition-all", style: { width: `${fuelPercentage}%` } })),
54
+ React.createElement("div", { className: "flex items-center justify-between text-[10px] font-mono text-gray-400 mt-2" },
55
+ React.createElement("span", null, "VOLUMETRIC RAM"),
56
+ React.createElement("span", null,
57
+ data.memoryUsage || 0,
58
+ "MB / ",
59
+ data.maxMemory || 10,
60
+ "MB")),
61
+ React.createElement("div", { className: "h-1 bg-gray-800 rounded-full overflow-hidden" },
62
+ React.createElement("div", { className: "h-full bg-blue-400 transition-all", style: { width: `${memoryPercentage}%` } })))));
63
+ };
64
+ // Custom Edge: TelemetryEdge
65
+ const TelemetryEdge = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style = {}, markerEnd, data }) => {
66
+ const [edgePath, labelX, labelY] = getBezierPath({
67
+ sourceX,
68
+ sourceY,
69
+ sourcePosition,
70
+ targetX,
71
+ targetY,
72
+ targetPosition,
73
+ });
74
+ return (React.createElement("g", null,
75
+ React.createElement("path", { id: id, style: Object.assign(Object.assign({}, style), { strokeWidth: 2, stroke: (data === null || data === void 0 ? void 0 : data.isStreaming) ? 'var(--cr-accent-orange)' : '#4B5563', strokeDasharray: (data === null || data === void 0 ? void 0 : data.isStreaming) ? '5,5' : 'none', animation: (data === null || data === void 0 ? void 0 : data.isStreaming) ? 'dashdraw 1s linear infinite' : 'none' }), className: "react-flow__edge-path", d: edgePath, markerEnd: markerEnd }),
76
+ (data === null || data === void 0 ? void 0 : data.label) && (React.createElement(EdgeLabelRenderer, null,
77
+ React.createElement("div", { style: {
78
+ position: 'absolute',
79
+ transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
80
+ pointerEvents: 'all',
81
+ }, className: "bg-black border border-gray-800 text-[10px] text-gray-400 font-mono px-2 py-0.5 rounded uppercase tracking-wider" }, data.label)))));
82
+ };
83
+ const nodeTypes = {
84
+ swarmNode: SwarmNode,
85
+ sandboxNode: SandboxNode,
86
+ };
87
+ const edgeTypes = {
88
+ telemetryEdge: TelemetryEdge,
89
+ };
90
+ /**
91
+ * TopologicalCanvas
92
+ *
93
+ * Concept: Visualizes the Macro-Swarm Architecture
94
+ * Uses ReactFlow to map mathematical DAGs to the UI.
95
+ */
96
+ export const TopologicalCanvas = ({ nodes, edges, availableCapabilities = [], onNodeClick, onNodesChange, onEdgesChange, onConnect, onDropCapability }) => {
97
+ const [isLayouting, setIsLayouting] = React.useState(false);
98
+ const onDragStart = (event, capability) => {
99
+ event.dataTransfer.setData('application/reactflow', JSON.stringify(capability));
100
+ event.dataTransfer.effectAllowed = 'move';
101
+ };
102
+ const onDragOver = (event) => {
103
+ event.preventDefault();
104
+ event.dataTransfer.dropEffect = 'move';
105
+ };
106
+ const onDrop = (event) => {
107
+ event.preventDefault();
108
+ const reactFlowBounds = event.currentTarget.getBoundingClientRect();
109
+ const capabilityData = event.dataTransfer.getData('application/reactflow');
110
+ if (capabilityData && onDropCapability) {
111
+ const capability = JSON.parse(capabilityData);
112
+ const position = {
113
+ x: event.clientX - reactFlowBounds.left,
114
+ y: event.clientY - reactFlowBounds.top,
115
+ };
116
+ onDropCapability(capability, position);
117
+ }
118
+ };
119
+ const handleAutoLayout = () => __awaiter(void 0, void 0, void 0, function* () {
120
+ if (nodes.length === 0)
121
+ return;
122
+ setIsLayouting(true);
123
+ try {
124
+ const ELK = (yield import('elkjs/lib/elk.bundled.js')).default;
125
+ const elk = new ELK();
126
+ const graph = {
127
+ id: 'root',
128
+ layoutOptions: {
129
+ 'elk.algorithm': 'layered',
130
+ 'elk.direction': 'RIGHT',
131
+ 'elk.spacing.nodeNode': '75',
132
+ 'elk.layered.spacing.nodeNodeBetweenLayers': '100',
133
+ },
134
+ children: nodes.map((node) => (Object.assign({ id: node.id, width: node.width || 250, height: node.height || 100 }, node))),
135
+ edges: edges.map((edge) => (Object.assign({ id: edge.id, sources: [edge.source], targets: [edge.target] }, edge))),
136
+ };
137
+ const layoutedGraph = yield elk.layout(graph);
138
+ if (onNodesChange && layoutedGraph.children) {
139
+ const changes = nodes.map((node) => {
140
+ var _a;
141
+ const elkNode = (_a = layoutedGraph.children) === null || _a === void 0 ? void 0 : _a.find((n) => n.id === node.id);
142
+ if (elkNode) {
143
+ return {
144
+ id: node.id,
145
+ type: 'position',
146
+ position: { x: elkNode.x, y: elkNode.y },
147
+ dragging: false,
148
+ };
149
+ }
150
+ return null;
151
+ }).filter(Boolean);
152
+ onNodesChange(changes);
153
+ }
154
+ }
155
+ catch (error) {
156
+ console.error('ELK Layout error:', error);
157
+ }
158
+ finally {
159
+ setIsLayouting(false);
160
+ }
161
+ });
162
+ return (React.createElement("div", { className: "flex h-full w-full rounded-xl overflow-hidden border border-gray-800 bg-black" },
163
+ availableCapabilities.length > 0 && (React.createElement("div", { className: "w-64 border-r border-gray-800 bg-[var(--cr-glass-box-black)] p-4 overflow-y-auto" },
164
+ React.createElement("div", { className: "text-white uppercase tracking-widest text-xs font-bold mb-4 border-b border-gray-800 pb-2" }, "URN Registry"),
165
+ React.createElement("div", { className: "flex flex-col gap-3" }, availableCapabilities.map((cap) => (React.createElement("div", { key: cap.urn, className: "bg-[rgba(20,20,20,0.8)] border border-gray-700 p-2 rounded cursor-grab hover:border-[var(--cr-accent-cyan)] transition-colors", onDragStart: (event) => onDragStart(event, cap), draggable: true },
166
+ React.createElement("div", { className: "text-[10px] text-gray-500 font-mono mb-1" }, cap.typeLabel),
167
+ React.createElement("div", { className: "text-[11px] text-white font-mono break-all" }, cap.urn))))))),
168
+ React.createElement("div", { className: "flex-1 relative w-full h-full min-h-0", onDragOver: onDragOver, onDrop: onDrop },
169
+ React.createElement("style", null, `
170
+ @keyframes dashdraw {
171
+ from { stroke-dashoffset: 10; }
172
+ to { stroke-dashoffset: 0; }
173
+ }
174
+ .react-flow__background {
175
+ background-color: #000;
176
+ }
177
+ `),
178
+ React.createElement(ReactFlow, { nodes: nodes, edges: edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodeClick: onNodeClick, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onConnect: onConnect, fitView: true, proOptions: { hideAttribution: true } },
179
+ React.createElement(Background, { color: "#1f2937", gap: 20 }),
180
+ React.createElement(Controls, { className: "bg-[var(--cr-glass-box-black)] border border-gray-800 fill-white" }),
181
+ React.createElement(Panel, { position: "top-right", className: "m-4" },
182
+ 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'))))));
183
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export interface VFEIndicatorProps {
3
+ currentVfe?: number;
4
+ vfeValue?: number;
5
+ threshold: number;
6
+ tokenBurnRate?: number;
7
+ maxTokenBurnRate?: number;
8
+ }
9
+ /**
10
+ * AGENT INSTRUCTION: This hollow component visually projects backend token burn and Variational Free Energy (VFE) spikes without requiring explicit user interaction.
11
+ * CAUSAL AFFORDANCE: Renders the divergence between structural prior and the agent's generative trajectory via an animated ring.
12
+ * EPISTEMIC BOUNDS: Bounded by `currentVfe` (or `vfeValue`) and `threshold`. If VFE > `threshold`, the component transitions into a suspended state.
13
+ * MCP ROUTING TRIGGERS: VFE, Token Burn, Threshold Breach, System 1, System 2.
14
+ */
15
+ export declare const VFEIndicator: React.FC<VFEIndicatorProps>;
@@ -0,0 +1,52 @@
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
+ /**
13
+ * AGENT INSTRUCTION: This hollow component visually projects backend token burn and Variational Free Energy (VFE) spikes without requiring explicit user interaction.
14
+ * CAUSAL AFFORDANCE: Renders the divergence between structural prior and the agent's generative trajectory via an animated ring.
15
+ * EPISTEMIC BOUNDS: Bounded by `currentVfe` (or `vfeValue`) and `threshold`. If VFE > `threshold`, the component transitions into a suspended state.
16
+ * MCP ROUTING TRIGGERS: VFE, Token Burn, Threshold Breach, System 1, System 2.
17
+ */
18
+ export const VFEIndicator = ({ currentVfe, vfeValue, threshold = 1, tokenBurnRate = 0, maxTokenBurnRate = 1000 }) => {
19
+ const vfe = currentVfe !== undefined ? currentVfe : (vfeValue !== undefined ? vfeValue : 0);
20
+ const isBreached = vfe >= threshold;
21
+ const percentage = Math.min((vfe / threshold) * 100, 100);
22
+ const ringColor = isBreached ? 'var(--cr-accent-orange)' : 'var(--cr-accent-cyan)';
23
+ // Compute burn rate percentage
24
+ const burnPercentage = Math.min((tokenBurnRate / maxTokenBurnRate) * 100, 100);
25
+ return (React.createElement("div", { className: "flex flex-col items-center justify-center p-6 rounded-xl bg-[var(--cr-glass-box-black)] border border-[#333] w-full max-w-[240px]" },
26
+ React.createElement("div", { className: "relative w-28 h-28" },
27
+ React.createElement("svg", { className: "w-full h-full transform -rotate-90" },
28
+ React.createElement("circle", { cx: "56", cy: "56", r: "48", stroke: "currentColor", strokeWidth: "8", fill: "transparent", className: "text-gray-800" }),
29
+ React.createElement(motion.circle, { cx: "56", cy: "56", r: "48", stroke: ringColor, strokeWidth: "8", fill: "transparent", strokeDasharray: "301.6" /* 2 * PI * 48 */, initial: { strokeDashoffset: 301.6 }, animate: { strokeDashoffset: 301.6 - (301.6 * percentage) / 100 }, transition: { type: 'spring', stiffness: 50, damping: 12 } })),
30
+ React.createElement("div", { className: "absolute inset-0 flex flex-col items-center justify-center" },
31
+ React.createElement("span", { className: "text-white font-mono text-base font-bold" }, vfe.toFixed(2)),
32
+ React.createElement("span", { className: "text-[10px] text-gray-500 font-mono" },
33
+ "LIMIT: ",
34
+ threshold.toFixed(1)))),
35
+ React.createElement("div", { className: "mt-4 text-xs font-mono text-gray-300 font-bold uppercase tracking-wider" },
36
+ "VFE ",
37
+ isBreached ? 'BREACHED' : 'NOMINAL'),
38
+ React.createElement("div", { className: "mt-4 w-full flex flex-col gap-1.5 border-t border-gray-800 pt-3" },
39
+ React.createElement("div", { className: "flex justify-between items-center text-[10px] font-mono text-gray-400" },
40
+ React.createElement("span", null, "TOKEN BURN RATE"),
41
+ React.createElement("span", { className: "text-white font-semibold" },
42
+ tokenBurnRate.toFixed(0),
43
+ " T/S")),
44
+ React.createElement("div", { className: "h-2 w-full bg-gray-900 rounded-full overflow-hidden border border-gray-800 relative" },
45
+ React.createElement(motion.div, { initial: { width: 0 }, animate: { width: `${burnPercentage}%` }, transition: { type: 'spring', stiffness: 60, damping: 15 }, className: "h-full bg-gradient-to-r from-blue-500 to-[var(--cr-accent-cyan)] rounded-full relative" }, tokenBurnRate > 0 && (React.createElement(motion.div, { animate: {
46
+ x: ['-100%', '100%']
47
+ }, transition: {
48
+ repeat: Infinity,
49
+ duration: Math.max(0.5, 2 - (tokenBurnRate / 500)), // faster shimmer at higher rates
50
+ ease: 'linear'
51
+ }, className: "absolute inset-0 bg-gradient-to-r from-transparent via-[rgba(255,255,255,0.4)] to-transparent" })))))));
52
+ };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export interface VerifiedCapabilityReceiptProps {
3
+ urn: string;
4
+ ociUri: string;
5
+ signerDid: string;
6
+ verifiedAt: number;
7
+ className?: string;
8
+ }
9
+ /**
10
+ * AGENT INSTRUCTION: This component visualizes the cryptographic provenance of a capability,
11
+ * bridging the coreason-urn-authority ledger with the sensory manifold.
12
+ *
13
+ * CAUSAL AFFORDANCE: Renders the OCI Trust Anchor verification receipt for any URN-addressable capability.
14
+ *
15
+ * EPISTEMIC BOUNDS: Strictly read-only projection of cryptographic signatures; does not issue credentials.
16
+ *
17
+ * MCP ROUTING TRIGGERS: Ledger, Provenance, Cosign Verification, Zero-Trust
18
+ */
19
+ export declare const VerifiedCapabilityReceipt: React.FC<VerifiedCapabilityReceiptProps>;
@@ -0,0 +1,37 @@
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 { GlassBox, cn } from './GlassBox';
12
+ /**
13
+ * AGENT INSTRUCTION: This component visualizes the cryptographic provenance of a capability,
14
+ * bridging the coreason-urn-authority ledger with the sensory manifold.
15
+ *
16
+ * CAUSAL AFFORDANCE: Renders the OCI Trust Anchor verification receipt for any URN-addressable capability.
17
+ *
18
+ * EPISTEMIC BOUNDS: Strictly read-only projection of cryptographic signatures; does not issue credentials.
19
+ *
20
+ * MCP ROUTING TRIGGERS: Ledger, Provenance, Cosign Verification, Zero-Trust
21
+ */
22
+ export const VerifiedCapabilityReceipt = ({ urn, ociUri, signerDid, verifiedAt, className }) => {
23
+ return (React.createElement(GlassBox, { density: "dense", className: cn('flex flex-col gap-2 min-w-[300px] border border-green-800 bg-[rgba(10,30,10,0.8)]', className) },
24
+ React.createElement("div", { className: "flex justify-between items-center mb-1" },
25
+ React.createElement("span", { className: "text-[10px] uppercase tracking-widest text-green-400 font-bold" }, "\u26BF VERIFIED CAPABILITY"),
26
+ React.createElement("span", { className: "text-[10px] text-gray-500 font-mono" }, verifiedAt ? new Date(verifiedAt).toISOString() : 'UNKNOWN')),
27
+ React.createElement("div", { className: "flex flex-col gap-1 text-[11px] font-mono" },
28
+ React.createElement("div", { className: "flex flex-col" },
29
+ React.createElement("span", { className: "text-gray-500 uppercase text-[9px]" }, "URN"),
30
+ React.createElement("span", { className: "text-white truncate", title: urn }, urn)),
31
+ React.createElement("div", { className: "flex flex-col" },
32
+ React.createElement("span", { className: "text-gray-500 uppercase text-[9px]" }, "OCI Artifact"),
33
+ React.createElement("span", { className: "text-blue-300 truncate", title: ociUri }, ociUri)),
34
+ React.createElement("div", { className: "flex flex-col" },
35
+ React.createElement("span", { className: "text-gray-500 uppercase text-[9px]" }, "Signer DID"),
36
+ React.createElement("span", { className: "text-purple-400 truncate", title: signerDid }, signerDid)))));
37
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export interface AgentNodeData {
3
+ label: string;
4
+ status: string;
5
+ tokens?: string;
6
+ vfe?: number;
7
+ memoryAllocatedMb?: number;
8
+ cpuFuelRemaining?: number;
9
+ persona?: string;
10
+ }
11
+ export interface AgentNodeProps {
12
+ data: AgentNodeData;
13
+ }
14
+ export declare const AgentNode: React.FC<AgentNodeProps>;