/** * SNNCognitionEngine — snn-webgpu backed CAELCognitionEngine implementation. * * Replaces the inline SNNCognition placeholder (simplified V*leak+I LIF) * with the parameterized Leaky Integrate-and-Fire implementation from * @holoscript/snn-webgpu's CPUReferenceSimulator: * * V[t+1] = V_rest + (V[t] - V_rest) * exp(-dt/tau) + I_syn[t] * spike when V[t+1] >= V_threshold * refractory period of 2ms post-spike * * The wrapper accepts either CPUReferenceSimulator or LIFSimulator, but their * observable histories are not equivalent: the CPU path records per-step * spikes and final voltages, while the GPU path currently exposes only the * final binary spike mask and no membrane-voltage snapshot. * * Sensor → Current mapping: * sensor values (physical units, e.g. Pa stress, K temperature) are scaled * to input currents in mV via `inputScalemV` (default: 20mV full-scale). * This injection range pushes neurons from rest (-65mV) toward threshold * (-55mV) at roughly 20% → light spiking, 100% → near-saturated spiking. * * Per-tick behaviour: * Each think() call runs `stepsPerTick` LIF steps (default = round(dt_s * 1000)). * The CPU path collects spikes across every internal step and timestamps * them relative to the tick window. The GPU path reads one final binary * spike mask after all steps; it cannot reconstruct per-step timestamps. * * Evidence boundary: * This adapter turns supplied sensor readings into a `CognitionSnapshot` for * a CAEL caller. It does not by itself prove a browser/GPU execution path, * cross-backend spike parity, trace authentication, or simulation replay. */ import { type LIFParams } from '@holoscript/snn-webgpu'; import type { CAELCognitionEngine, CognitionSnapshot, SensorReading } from './CAELAgent'; export interface SNNCognitionEngineConfig { /** Unique identifier for provenance. Default: 'snn-cognition-engine' */ id?: string; /** Number of LIF neurons. Default: 128 */ neuronCount?: number; /** * LIF biophysical parameters. * Defaults from @holoscript/snn-webgpu: * tau=20ms, vThreshold=-55mV, vReset=-75mV, vRest=-65mV, dt=1ms */ lifParams?: Partial; /** * Scale factor mapping sensor value [0,1] to input current in mV. * Full-scale sensor = inputScalemV injected into each neuron. * Default: 20mV (drives neurons from rest toward threshold without saturation). */ inputScalemV?: number; /** * Number of LIF steps to run per think() call. * If undefined (default), computed as round(dt_seconds * 1000 / lifParams.dt). * Minimum is 1. */ stepsPerTick?: number; /** * Population name to tag spikes with in the cognition snapshot. * Default: 'snn-lif' */ population?: string; } /** * CAEL cognition engine backed by snn-webgpu CPUReferenceSimulator. * * Replacement for the SNNCognition placeholder. The CPU and WebGPU backends * share the wrapper's output shape, but no bit-exact or spike-history parity * claim is made between them. */ export declare class SNNCognitionEngine implements CAELCognitionEngine { readonly id: string; private sim; private readonly neuronCount; private readonly inputScalemV; private readonly stepsPerTickOverride; private readonly population; private readonly lifDt; private readonly lifParams; private isInitialized; constructor(config?: SNNCognitionEngineConfig); /** * Initializes the WebGPU context and binds the LIFSimulator targeting it. * If this is skipped, the engine safely runs via the CPUReferenceSimulator backend. */ initialize(): Promise; think(sensors: SensorReading[], dt: number): Promise; encode(snapshot: CognitionSnapshot): Record; /** * Map SensorReading arrays to a Float32Array of input currents in mV. * * Sensor values from the solver (Pa, K, m/s²…) are first normalized * to [0,1] relative to their observed range within the reading, then * scaled to [0, inputScalemV]. Multiple sensor readings are averaged * per neuron when sensors > neuronCount. * * If sensors < neuronCount, the input array is tiled. */ private sensorsToCurrents; /** Get current membrane voltages (mV) for all neurons. */ getMembraneVoltages(): Float32Array; /** Reset all neurons to resting potential. */ reset(): void; } //# sourceMappingURL=SNNCognitionEngine.d.ts.map