Download src/lib/npt/data.ts from Omnixela/npt-connector: direct link, hf CLI and curl.
- Browser
- Download file 20.9 kB
-
https://huggingface.co/Omnixela/npt-connector/resolve/main/src/lib/npt/data.ts
- Command line
-
hf download hf://Omnixela/npt-connector/src/lib/npt/data.ts
-
curl -L -o data.ts https://huggingface.co/Omnixela/npt-connector/resolve/main/src/lib/npt/data.ts
20.9 kB
| import type { | |
| CognitiveNode, | |
| Connection, | |
| NodeCategory, | |
| NodeConfig, | |
| NodeKind, | |
| NodeStatus, | |
| RegisteredNode, | |
| } from "./types"; | |
| // --------------------------------------------------------------------------- | |
| // Node definitions — 40 active cognitive & platform nodes | |
| // --------------------------------------------------------------------------- | |
| interface NodeSeed { | |
| id: string; | |
| name: string; | |
| category: NodeCategory; | |
| kind: NodeKind; | |
| description: string; | |
| operations: string[]; | |
| status: NodeStatus; | |
| throughput: number; | |
| latencyMs: number; | |
| allostaticLoad: number; | |
| glutamateBudget: number; | |
| } | |
| const NODE_SEEDS: NodeSeed[] = [ | |
| // --- cognitive core --- | |
| { id: "aware", name: "aware", category: "cognitive", kind: "cognitive", description: "Global awareness orchestrator. Maintains the conscious context window and binds sensory streams into a unified field.", operations: ["bind", "scan", "focus", "release"], status: "active", throughput: 1280, latencyMs: 4, allostaticLoad: 0.42, glutamateBudget: 78 }, | |
| { id: "trn", name: "trn", category: "cognitive", kind: "cognitive", description: "Thalamic Relay Nucleus. Gated relay that filters and routes signal salience between cortical regions.", operations: ["relay", "filter", "evaluate", "gate"], status: "active", throughput: 980, latencyMs: 3, allostaticLoad: 0.36, glutamateBudget: 84 }, | |
| { id: "intuit", name: "intuit", category: "cognitive", kind: "cognitive", description: "Fast intuitive inference. Produces low-latency heuristic predictions from pattern memory.", operations: ["infer", "guess", "predict"], status: "active", throughput: 760, latencyMs: 6, allostaticLoad: 0.31, glutamateBudget: 70 }, | |
| { id: "reason", name: "reason", category: "cognitive", kind: "cognitive", description: "Deliberative reasoning engine. Performs multi-step logical chaining and causal verification.", operations: ["deduce", "verify", "chain"], status: "active", throughput: 540, latencyMs: 14, allostaticLoad: 0.55, glutamateBudget: 62 }, | |
| { id: "decide", name: "decide", category: "cognitive", kind: "cognitive", description: "Decision arbiter. Resolves competing action hypotheses against value & risk policies.", operations: ["arbitrate", "select", "commit"], status: "active", throughput: 620, latencyMs: 9, allostaticLoad: 0.48, glutamateBudget: 68 }, | |
| { id: "recall", name: "recall", category: "cognitive", kind: "cognitive", description: "Recall dispatcher. Indexes and retrieves episodic traces from long-term stores.", operations: ["retrieve", "index", "cue"], status: "active", throughput: 880, latencyMs: 11, allostaticLoad: 0.39, glutamateBudget: 74 }, | |
| { id: "infer", name: "infer", category: "cognitive", kind: "cognitive", description: "Bayesian inference core. Updates posterior beliefs over latent state hypotheses.", operations: ["update", "posterior", "sample"], status: "active", throughput: 700, latencyMs: 12, allostaticLoad: 0.44, glutamateBudget: 66 }, | |
| { id: "predict", name: "predict", category: "cognitive", kind: "cognitive", description: "Forward predictive model. Generates expected next-state trajectories for error minimization.", operations: ["forecast", "rollout", "delta"], status: "active", throughput: 820, latencyMs: 8, allostaticLoad: 0.41, glutamateBudget: 72 }, | |
| // --- perception --- | |
| { id: "perceive", name: "perceive", category: "perception", kind: "cognitive", description: "Perceptual integrator. Fuses multi-modal sensory primitives into coherent percepts.", operations: ["fuse", "segment", "label"], status: "active", throughput: 1100, latencyMs: 5, allostaticLoad: 0.38, glutamateBudget: 80 }, | |
| { id: "attend", name: "attend", category: "perception", kind: "cognitive", description: "Attention allocator. Distributes salience-weighted focus across the perceptual field.", operations: ["focus", "shift", "sustain"], status: "active", throughput: 940, latencyMs: 4, allostaticLoad: 0.35, glutamateBudget: 82 }, | |
| { id: "sense", name: "sense", category: "perception", kind: "cognitive", description: "Primary sensory ingress. Normalizes inbound signal streams for downstream routing.", operations: ["ingest", "normalize", "attend"], status: "active", throughput: 1420, latencyMs: 2, allostaticLoad: 0.28, glutamateBudget: 88 }, | |
| { id: "proprio", name: "proprio", category: "perception", kind: "cognitive", description: "Proprioceptive body schema. Tracks limb posture and kinematic state vectors.", operations: ["track", "calibrate"], status: "active", throughput: 460, latencyMs: 7, allostaticLoad: 0.22, glutamateBudget: 76 }, | |
| { id: "intero", name: "intero", category: "perception", kind: "cognitive", description: "Interoceptive vitals monitor. Reads autonomic and metabolic state from the body bus.", operations: ["read", "sample"], status: "active", throughput: 380, latencyMs: 9, allostaticLoad: 0.25, glutamateBudget: 79 }, | |
| // --- sensory --- | |
| { id: "vision", name: "vision", category: "sensory", kind: "cognitive", description: "Visual cortex stream. Encodes retinal input into feature hierarchies and spatial maps.", operations: ["encode", "detect", "track"], status: "active", throughput: 1600, latencyMs: 6, allostaticLoad: 0.47, glutamateBudget: 75 }, | |
| { id: "voice", name: "voice", category: "sensory", kind: "cognitive", description: "Vocal/auditory speech stream. Transduces acoustic waveforms into phonetic tokens.", operations: ["transduce", "phoneme", "stream"], status: "active", throughput: 720, latencyMs: 7, allostaticLoad: 0.33, glutamateBudget: 73 }, | |
| { id: "audio", name: "audio", category: "sensory", kind: "cognitive", description: "General auditory cortex. Localizes and separates sound sources in 3-space.", operations: ["localize", "separate"], status: "active", throughput: 680, latencyMs: 6, allostaticLoad: 0.30, glutamateBudget: 74 }, | |
| { id: "touch", name: "touch", category: "sensory", kind: "cognitive", description: "Somatosensory surface. Encodes pressure, temperature, and texture from tactile receptors.", operations: ["encode", "threshold"], status: "active", throughput: 540, latencyMs: 5, allostaticLoad: 0.24, glutamateBudget: 77 }, | |
| { id: "balance", name: "balance", category: "sensory", kind: "cognitive", description: "Vestibular equilibrium node. Resolves gravito-inertial orientation for posture control.", operations: ["orient", "stabilize"], status: "idle", throughput: 320, latencyMs: 8, allostaticLoad: 0.18, glutamateBudget: 81 }, | |
| // --- motor --- | |
| { id: "motor", name: "motor", category: "motor", kind: "cognitive", description: "Motor cortex planner. Decomposes intent into kinematic motor programs.", operations: ["plan", "execute", "halt"], status: "active", throughput: 860, latencyMs: 10, allostaticLoad: 0.40, glutamateBudget: 71 }, | |
| { id: "speech", name: "speech", category: "motor", kind: "cognitive", description: "Articulatory speech actuator. Synthesizes vocal motor sequences from linguistic tokens.", operations: ["synthesize", "articulate"], status: "active", throughput: 590, latencyMs: 12, allostaticLoad: 0.34, glutamateBudget: 69 }, | |
| { id: "gesture", name: "gesture", category: "motor", kind: "cognitive", description: "Gesture & expression actuator. Drives non-verbal communicative motor channels.", operations: ["pose", "express"], status: "active", throughput: 410, latencyMs: 11, allostaticLoad: 0.27, glutamateBudget: 72 }, | |
| { id: "navigate", name: "navigate", category: "motor", kind: "cognitive", description: "Locomotion & navigation controller. Plans paths through spatial environments.", operations: ["route", "step", "avoid"], status: "active", throughput: 530, latencyMs: 13, allostaticLoad: 0.37, glutamateBudget: 70 }, | |
| { id: "grasp", name: "grasp", category: "motor", kind: "cognitive", description: "Manipulation & grasp controller. Coordinates fine motor actuation of effectors.", operations: ["reach", "grasp", "release"], status: "active", throughput: 480, latencyMs: 9, allostaticLoad: 0.29, glutamateBudget: 71 }, | |
| // --- memory --- | |
| { id: "memory", name: "memory", category: "memory", kind: "cognitive", description: "Memory controller. Mediates encoding, consolidation, and retrieval across stores.", operations: ["encode", "consolidate", "retrieve"], status: "active", throughput: 1020, latencyMs: 10, allostaticLoad: 0.43, glutamateBudget: 76 }, | |
| { id: "ltm", name: "ltm", category: "memory", kind: "cognitive", description: "Long-term memory store. Persistent semantic & episodic trace vault.", operations: ["store", "query", "decay"], status: "active", throughput: 340, latencyMs: 22, allostaticLoad: 0.20, glutamateBudget: 90 }, | |
| { id: "stm", name: "stm", category: "memory", kind: "cognitive", description: "Short-term working scratch. Low-latency volatile buffer for active items.", operations: ["hold", "rotate", "drop"], status: "active", throughput: 1240, latencyMs: 3, allostaticLoad: 0.46, glutamateBudget: 64 }, | |
| { id: "episodic", name: "episodic", category: "memory", kind: "cognitive", description: "Episodic sequence store. Time-stamped experiential trajectories with context tags.", operations: ["record", "replay", "tag"], status: "active", throughput: 420, latencyMs: 18, allostaticLoad: 0.26, glutamateBudget: 83 }, | |
| { id: "working", name: "working", category: "memory", kind: "cognitive", description: "Working memory workspace. Holds & manipulates active representations for reasoning.", operations: ["maintain", "update", "manipulate"], status: "active", throughput: 980, latencyMs: 5, allostaticLoad: 0.45, glutamateBudget: 65 }, | |
| // --- executive --- | |
| { id: "surgery", name: "surgery", category: "executive", kind: "cognitive", description: "Executive surgery node. Performs controlled structural edits and surgical audits on pathways.", operations: ["edit", "audit", "patch", "sever"], status: "active", throughput: 380, latencyMs: 16, allostaticLoad: 0.52, glutamateBudget: 60 }, | |
| { id: "audit", name: "audit", category: "executive", kind: "cognitive", description: "Compliance & integrity auditor. Verifies pathway correctness against policy constraints.", operations: ["verify", "report", "flag"], status: "active", throughput: 450, latencyMs: 15, allostaticLoad: 0.38, glutamateBudget: 78 }, | |
| { id: "ethics", name: "ethics", category: "executive", kind: "cognitive", description: "Ethical policy gate. Evaluates actions against deontic and consequential constraints.", operations: ["evaluate", "veto", "permit"], status: "active", throughput: 360, latencyMs: 17, allostaticLoad: 0.33, glutamateBudget: 80 }, | |
| { id: "plan", name: "plan", category: "executive", kind: "cognitive", description: "Strategic planner. Constructs multi-stage action plans toward goal states.", operations: ["formulate", "sequence", "replan"], status: "active", throughput: 520, latencyMs: 13, allostaticLoad: 0.40, glutamateBudget: 73 }, | |
| { id: "eval", name: "eval", category: "executive", kind: "cognitive", description: "Outcome evaluator. Scores action results against expected utility for policy update.", operations: ["score", "compare", "credit"], status: "active", throughput: 600, latencyMs: 11, allostaticLoad: 0.36, glutamateBudget: 75 }, | |
| { id: "monitor", name: "monitor", category: "executive", kind: "cognitive", description: "Process monitor. Oversees active pipelines and surfaces anomalies to the operator.", operations: ["watch", "alert", "throttle"], status: "active", throughput: 710, latencyMs: 8, allostaticLoad: 0.34, glutamateBudget: 77 }, | |
| // --- platform --- | |
| { id: "router", name: "router", category: "platform", kind: "platform", description: "NPT core router. Topology-aware message routing across cognitive and platform nodes.", operations: ["route", "dispatch", "broadcast"], status: "active", throughput: 2200, latencyMs: 1, allostaticLoad: 0.30, glutamateBudget: 92 }, | |
| { id: "gateway", name: "gateway", category: "platform", kind: "platform", description: "Edge gateway. Bridges external npt:// endpoints to the internal cognitive mesh.", operations: ["bridge", "auth", "translate"], status: "active", throughput: 1800, latencyMs: 2, allostaticLoad: 0.28, glutamateBudget: 90 }, | |
| { id: "ledger", name: "ledger", category: "platform", kind: "platform", description: "Akashic ledger node. Appends SHA-256 signed transmission blocks to the immutable chain.", operations: ["append", "sign", "verify"], status: "active", throughput: 1500, latencyMs: 2, allostaticLoad: 0.24, glutamateBudget: 94 }, | |
| { id: "vault", name: "vault", category: "platform", kind: "platform", description: "Cryptographic vault. Holds signing keys and performs non-repudiation attestation.", operations: ["sign", "attest", "rotate"], status: "active", throughput: 900, latencyMs: 3, allostaticLoad: 0.21, glutamateBudget: 95 }, | |
| { id: "gate", name: "gate", category: "platform", kind: "platform", description: "Control-plane gate. Enforces confidence thresholds and adaptive gating decisions.", operations: ["enforce", "open", "close"], status: "active", throughput: 1100, latencyMs: 2, allostaticLoad: 0.26, glutamateBudget: 88 }, | |
| { id: "mesh", name: "mesh", category: "platform", kind: "platform", description: "Mesh sync. Maintains consensus on topology and pathway-strength state across peers.", operations: ["sync", "consensus", "gossip"], status: "active", throughput: 1300, latencyMs: 4, allostaticLoad: 0.27, glutamateBudget: 89 }, | |
| ]; | |
| // --------------------------------------------------------------------------- | |
| // Layout — cluster-ring placement by category | |
| // --------------------------------------------------------------------------- | |
| const CATEGORY_ORDER: NodeCategory[] = [ | |
| "platform", | |
| "cognitive", | |
| "perception", | |
| "sensory", | |
| "motor", | |
| "memory", | |
| "executive", | |
| ]; | |
| const CATEGORY_COLOR: Record<NodeCategory, string> = { | |
| cognitive: "#34d399", // emerald-400 | |
| perception: "#22d3ee", // cyan-400 | |
| sensory: "#2dd4bf", // teal-400 | |
| motor: "#a3e635", // lime-400 | |
| memory: "#f472b6", // pink-400 | |
| executive: "#fbbf24", // amber-400 | |
| platform: "#818cf8", // indigo-400 (platform accent, used sparingly) | |
| }; | |
| export const CATEGORY_META: Record< | |
| NodeCategory, | |
| { label: string; color: string; glyph: string } | |
| > = { | |
| cognitive: { label: "Cognitive Core", color: CATEGORY_COLOR.cognitive, glyph: "◉" }, | |
| perception: { label: "Perception", color: CATEGORY_COLOR.perception, glyph: "◈" }, | |
| sensory: { label: "Sensory", color: CATEGORY_COLOR.sensory, glyph: "◇" }, | |
| motor: { label: "Motor", color: CATEGORY_COLOR.motor, glyph: "◆" }, | |
| memory: { label: "Memory", color: CATEGORY_COLOR.memory, glyph: "❖" }, | |
| executive: { label: "Executive", color: CATEGORY_COLOR.executive, glyph: "⬡" }, | |
| platform: { label: "Platform", color: CATEGORY_COLOR.platform, glyph: "⬢" }, | |
| }; | |
| function computeLayout(): Map<string, { x: number; y: number }> { | |
| const layout = new Map<string, { x: number; y: number }>(); | |
| const cx = 0.5; | |
| const cy = 0.52; | |
| const ringR = 0.36; | |
| const arc = (Math.PI * 2) / CATEGORY_ORDER.length; | |
| CATEGORY_ORDER.forEach((cat, ci) => { | |
| const centerAngle = ci * arc - Math.PI / 2; | |
| const members = NODE_SEEDS.filter((n) => n.category === cat); | |
| const subArc = arc * 0.86; | |
| const start = centerAngle - subArc / 2; | |
| members.forEach((n, mi) => { | |
| const t = members.length === 1 ? 0.5 : mi / (members.length - 1); | |
| const a = start + t * subArc; | |
| // alternate radius slightly for organic spread | |
| const r = ringR + (mi % 2 === 0 ? 0.028 : -0.028) + (ci % 2 === 0 ? 0.012 : -0.012); | |
| layout.set(n.id, { | |
| x: cx + Math.cos(a) * r, | |
| y: cy + Math.sin(a) * r, | |
| }); | |
| }); | |
| }); | |
| return layout; | |
| } | |
| const LAYOUT = computeLayout(); | |
| export function buildNodes(): CognitiveNode[] { | |
| return NODE_SEEDS.map((s) => ({ | |
| ...s, | |
| x: LAYOUT.get(s.id)!.x, | |
| y: LAYOUT.get(s.id)!.y, | |
| })); | |
| } | |
| export function buildConfigs(nodes: CognitiveNode[]): Record<string, NodeConfig> { | |
| const cfg: Record<string, NodeConfig> = {}; | |
| for (const n of nodes) { | |
| cfg[n.id] = { | |
| nodeId: n.id, | |
| confidenceThreshold: round2(0.5 + (n.allostaticLoad * 0.2)), | |
| adaptiveRetry: n.category !== "platform", | |
| priorityWeight: | |
| n.category === "platform" | |
| ? 10 | |
| : n.category === "executive" | |
| ? 8 | |
| : n.category === "cognitive" | |
| ? 7 | |
| : 5, | |
| glutamateBudget: n.glutamateBudget, | |
| enabled: n.status !== "offline", | |
| }; | |
| } | |
| return cfg; | |
| } | |
| function round2(n: number) { | |
| return Math.round(n * 100) / 100; | |
| } | |
| // --------------------------------------------------------------------------- | |
| // Connections — Hebbian synaptic links between nodes | |
| // --------------------------------------------------------------------------- | |
| const LINKS: [string, string, number][] = [ | |
| // sensory ingress | |
| ["vision", "perceive", 0.92], | |
| ["voice", "audio", 0.88], | |
| ["audio", "perceive", 0.79], | |
| ["touch", "perceive", 0.71], | |
| ["balance", "proprio", 0.66], | |
| ["proprio", "perceive", 0.63], | |
| ["intero", "sense", 0.58], | |
| ["sense", "perceive", 0.95], | |
| ["sense", "attend", 0.74], | |
| // perception -> attention | |
| ["perceive", "attend", 0.9], | |
| ["perceive", "aware", 0.83], | |
| ["attend", "aware", 0.86], | |
| // awareness / thalamic relay | |
| ["aware", "trn", 0.81], | |
| ["trn", "working", 0.69], | |
| ["trn", "infer", 0.72], | |
| ["aware", "predict", 0.77], | |
| ["aware", "recall", 0.8], | |
| // reasoning / inference | |
| ["infer", "reason", 0.74], | |
| ["predict", "infer", 0.7], | |
| ["intuit", "infer", 0.68], | |
| ["reason", "decide", 0.76], | |
| ["intuit", "decide", 0.64], | |
| ["predict", "decide", 0.66], | |
| // memory | |
| ["recall", "memory", 0.85], | |
| ["memory", "ltm", 0.91], | |
| ["memory", "stm", 0.82], | |
| ["memory", "episodic", 0.78], | |
| ["working", "stm", 0.73], | |
| ["recall", "episodic", 0.67], | |
| ["stm", "working", 0.7], | |
| // executive | |
| ["decide", "plan", 0.78], | |
| ["plan", "surgery", 0.66], | |
| ["surgery", "audit", 0.72], | |
| ["audit", "ethics", 0.74], | |
| ["ethics", "decide", 0.61], | |
| ["decide", "eval", 0.69], | |
| ["eval", "monitor", 0.64], | |
| ["monitor", "aware", 0.58], | |
| ["surgery", "motor", 0.7], | |
| // motor outflow | |
| ["motor", "speech", 0.75], | |
| ["motor", "gesture", 0.68], | |
| ["motor", "navigate", 0.72], | |
| ["motor", "grasp", 0.8], | |
| ["decide", "motor", 0.77], | |
| // platform fabric | |
| ["router", "gateway", 0.93], | |
| ["gateway", "sense", 0.7], | |
| ["router", "trn", 0.68], | |
| ["router", "ledger", 0.85], | |
| ["ledger", "vault", 0.88], | |
| ["vault", "gate", 0.79], | |
| ["gate", "mesh", 0.81], | |
| ["mesh", "router", 0.84], | |
| ["gate", "monitor", 0.62], | |
| ["ledger", "audit", 0.6], | |
| // cross coupling | |
| ["aware", "memory", 0.57], | |
| ["working", "reason", 0.6], | |
| ["predict", "plan", 0.63], | |
| ["eval", "memory", 0.55], | |
| ["ethics", "surgery", 0.59], | |
| ["attend", "working", 0.65], | |
| ["intero", "monitor", 0.49], | |
| ["voice", "speech", 0.67], | |
| ["vision", "navigate", 0.54], | |
| ["proprio", "motor", 0.51], | |
| ["balance", "navigate", 0.46], | |
| ["grasp", "touch", 0.58], | |
| ]; | |
| export function buildConnections(): Connection[] { | |
| return LINKS.map(([source, target, w], i) => ({ | |
| id: `c-${source}-${target}`, | |
| source, | |
| target, | |
| weight: w, | |
| coactivations: Math.floor(8 + w * 120 + (i % 7) * 3), | |
| })); | |
| } | |
| // --------------------------------------------------------------------------- | |
| // Registered external platform nodes (mock) | |
| // --------------------------------------------------------------------------- | |
| export function buildRegistered(): RegisteredNode[] { | |
| const now = Date.now(); | |
| return [ | |
| { | |
| id: "reg-vision-probe", | |
| name: "vision.probe.07", | |
| endpoint: "npt://10.42.0.7:7781/vision", | |
| protocol: "npt-ws", | |
| status: "online", | |
| latencyMs: 14, | |
| lastSeen: new Date(now - 1200).toISOString(), | |
| mountedAt: new Date(now - 1000 * 60 * 60 * 26).toISOString(), | |
| telemetry: { packets: 184212, jitter: 1.8, integrity: 0.998 }, | |
| }, | |
| { | |
| id: "reg-audio-edge", | |
| name: "audio.edge.03", | |
| endpoint: "npt://edge-03.npt.mesh:7782/audio", | |
| protocol: "npt-grpc", | |
| status: "online", | |
| latencyMs: 22, | |
| lastSeen: new Date(now - 800).toISOString(), | |
| mountedAt: new Date(now - 1000 * 60 * 60 * 9).toISOString(), | |
| telemetry: { packets: 92341, jitter: 2.4, integrity: 0.995 }, | |
| }, | |
| { | |
| id: "reg-motor-rt", | |
| name: "motor.rt.unit-12", | |
| endpoint: "npt://unit-12.local:7783/motor", | |
| protocol: "npt-tcp", | |
| status: "probing", | |
| latencyMs: 41, | |
| lastSeen: new Date(now - 5400).toISOString(), | |
| mountedAt: new Date(now - 1000 * 60 * 60 * 3).toISOString(), | |
| telemetry: { packets: 12044, jitter: 6.1, integrity: 0.971 }, | |
| }, | |
| { | |
| id: "reg-iot-th", | |
| name: "iot.thermostat.west", | |
| endpoint: "npt://iot-west.npt.mesh:7784/env", | |
| protocol: "npt-mqtt", | |
| status: "offline", | |
| latencyMs: 0, | |
| lastSeen: new Date(now - 1000 * 60 * 14).toISOString(), | |
| mountedAt: new Date(now - 1000 * 60 * 60 * 72).toISOString(), | |
| telemetry: { packets: 4402, jitter: 12.3, integrity: 0.0 }, | |
| }, | |
| ]; | |
| } | |