Squashed 'vendor/ruvector/' content from commit b64c2172

git-subtree-dir: vendor/ruvector
git-subtree-split: b64c21726f2bb37286d9ee36a7869fef60cc6900
This commit is contained in:
ruv
2026-02-28 14:39:40 -05:00
commit d803bfe2b1
7854 changed files with 3522914 additions and 0 deletions

View File

@@ -0,0 +1,410 @@
# @ruvector/nervous-system-wasm - Bio-Inspired AI for WebAssembly
[![npm version](https://img.shields.io/npm/v/ruvector-nervous-system-wasm.svg)](https://www.npmjs.com/package/ruvector-nervous-system-wasm)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ruvnet/ruvector)
[![Bundle Size](https://img.shields.io/badge/bundle%20size-174KB%20gzip-green.svg)](https://www.npmjs.com/package/ruvector-nervous-system-wasm)
[![WebAssembly](https://img.shields.io/badge/WebAssembly-654FF0?logo=webassembly&logoColor=white)](https://webassembly.org/)
**Bio-inspired neural system components** for browser execution. Implements neuromorphic computing primitives including Hyperdimensional Computing (HDC), Behavioral Timescale Synaptic Plasticity (BTSP), Winner-Take-All networks, and Global Workspace attention.
## Key Features
- **Hyperdimensional Computing (HDC)**: 10,000-bit binary hypervectors for similarity-preserving encoding
- **BTSP (Behavioral Timescale Synaptic Plasticity)**: One-shot learning without iteration
- **Winner-Take-All (WTA)**: Sub-microsecond instant decisions through lateral inhibition
- **K-WTA (K-Winner-Take-All)**: Sparse distributed coding for neural representations
- **Global Workspace**: 4-7 item attention bottleneck inspired by conscious access
- **WASM-Optimized**: Designed for browser ML and edge inference
## Installation
```bash
npm install ruvector-nervous-system-wasm
# or
yarn add ruvector-nervous-system-wasm
# or
pnpm add ruvector-nervous-system-wasm
```
## Quick Start
```typescript
import init, {
BTSPLayer,
Hypervector,
HdcMemory,
WTALayer,
KWTALayer,
GlobalWorkspace,
WorkspaceItem
} from 'ruvector-nervous-system-wasm';
await init();
// One-shot learning with BTSP
const btsp = new BTSPLayer(100, 2000.0);
const pattern = new Float32Array(100).fill(0.1);
btsp.one_shot_associate(pattern, 1.0);
// Hyperdimensional computing
const apple = Hypervector.random();
const orange = Hypervector.random();
const similarity = apple.similarity(orange);
// Winner-take-all decisions
const wta = new WTALayer(1000, 0.5, 0.8);
const activations = new Float32Array(1000);
const winner = wta.compete(activations);
```
## Hyperdimensional Computing (HDC)
HDC represents information using high-dimensional binary vectors (~10,000 bits). Similar concepts have similar vectors, enabling robust pattern matching.
### Key Properties
- **High Dimensionality**: 10,000 bits provides exponential capacity
- **Holographic**: Information distributed across entire vector
- **Noise Tolerant**: Robust to bit flips and partial corruption
- **Single-Operation Learning**: No iterative training needed
```typescript
import { Hypervector, HdcMemory } from 'ruvector-nervous-system-wasm';
// Create random hypervectors for concepts
const apple = Hypervector.random();
const red = Hypervector.random();
const fruit = Hypervector.random();
// Bind: Associate concepts (XOR operation)
// Binding is self-inverse: a.bind(b).bind(b) == a
const redApple = apple.bind(red);
// Bundle: Combine multiple concepts (majority voting)
const fruitConcept = Hypervector.bundle_3(apple, orange, banana);
// Measure similarity (-1.0 to 1.0)
const sim = apple.similarity(redApple);
console.log(`Apple-RedApple similarity: ${sim.toFixed(3)}`);
// Hamming distance (number of differing bits)
const distance = apple.hamming_distance(orange);
console.log(`Hamming distance: ${distance}`);
// Reproducible vectors from seed
const seededVector = Hypervector.from_seed(42n);
// Serialize/deserialize
const bytes = apple.to_bytes();
const restored = Hypervector.from_bytes(bytes);
```
### HDC Memory Store
```typescript
import { HdcMemory, Hypervector } from 'ruvector-nervous-system-wasm';
const memory = new HdcMemory();
// Store concept vectors
memory.store("apple", Hypervector.random());
memory.store("banana", Hypervector.random());
memory.store("car", Hypervector.random());
// Retrieve similar concepts
const query = memory.get("apple")!;
const results = memory.retrieve(query, 0.8); // threshold
console.log(`Found ${results.length} similar concepts`);
// Get top-k most similar
const topK = memory.top_k(query, 3);
for (const [label, similarity] of topK) {
console.log(`${label}: ${similarity.toFixed(3)}`);
}
// Check existence
if (memory.has("apple")) {
const vec = memory.get("apple");
}
```
## BTSP (Behavioral Timescale Synaptic Plasticity)
BTSP enables **one-shot learning** - learning patterns in a single exposure, inspired by hippocampal place field formation (Bittner et al., 2017).
```typescript
import { BTSPLayer, BTSPSynapse, BTSPAssociativeMemory } from 'ruvector-nervous-system-wasm';
// Create BTSP layer
const btsp = new BTSPLayer(256, 2000.0); // 256 synapses, 2s time constant
// One-shot association: learn pattern -> target immediately
const pattern = new Float32Array(256);
pattern.fill(0.1);
pattern[0] = 0.9; pattern[42] = 0.8;
btsp.one_shot_associate(pattern, 1.0); // Target value = 1.0
// Forward pass - retrieves learned pattern
const output = btsp.forward(pattern);
console.log(`Retrieved value: ${output.toFixed(3)}`);
// Get learned weights
const weights = btsp.get_weights();
```
### Individual Synapse Control
```typescript
import { BTSPSynapse } from 'ruvector-nervous-system-wasm';
// Create synapse with initial weight
const synapse = new BTSPSynapse(0.5, 2000.0);
// Update based on neural activity
synapse.update(
true, // presynaptic active
true, // plateau signal detected
10.0 // dt in milliseconds
);
console.log(`Weight: ${synapse.weight.toFixed(3)}`);
console.log(`Eligibility: ${synapse.eligibility_trace.toFixed(3)}`);
```
### Associative Memory
```typescript
import { BTSPAssociativeMemory } from 'ruvector-nervous-system-wasm';
// Create key-value associative memory
const assocMem = new BTSPAssociativeMemory(64, 128); // 64-dim keys -> 128-dim values
// Store associations in one shot
const key = new Float32Array(64).fill(0.1);
const value = new Float32Array(128).fill(0.5);
assocMem.store_one_shot(key, value);
// Retrieve from partial/noisy key
const query = new Float32Array(64).fill(0.1);
const retrieved = assocMem.retrieve(query);
```
## Winner-Take-All (WTA)
WTA implements competitive neural dynamics where only the strongest activation survives - enabling ultra-fast decision making.
```typescript
import { WTALayer } from 'ruvector-nervous-system-wasm';
// Create WTA layer: 1000 neurons, 0.5 threshold, 0.8 inhibition
const wta = new WTALayer(1000, 0.5, 0.8);
// Compete for winner
const activations = new Float32Array(1000);
activations[42] = 0.9;
activations[100] = 0.7;
const winner = wta.compete(activations);
console.log(`Winner index: ${winner}`); // 42, or -1 if none exceed threshold
// Soft competition (softmax-like)
const softActivations = wta.compete_soft(activations);
// Get membrane potentials
const membranes = wta.get_membranes();
// Configure refractory period
wta.set_refractory_period(5.0);
// Reset layer state
wta.reset();
```
## K-Winner-Take-All (K-WTA)
K-WTA selects the top-k neurons, enabling sparse distributed coding.
```typescript
import { KWTALayer } from 'ruvector-nervous-system-wasm';
// Create K-WTA: 1000 neurons, select top 50
const kwta = new KWTALayer(1000, 50);
const activations = new Float32Array(1000);
// Fill with random values
for (let i = 0; i < 1000; i++) {
activations[i] = Math.random();
}
// Get indices of top-k winners (sorted descending by value)
const winnerIndices = kwta.select(activations);
console.log(`Top 50 winners: ${winnerIndices}`);
// Get winners with their values
const winnersWithValues = kwta.select_with_values(activations);
for (const [index, value] of winnersWithValues) {
console.log(`Neuron ${index}: ${value.toFixed(3)}`);
}
// Create sparse activation vector
const sparse = kwta.sparse_activations(activations);
// Only top-k values preserved, rest are 0
```
## Global Workspace
Implements the Global Workspace Theory of consciousness - a limited-capacity "workspace" where only the most salient information gains access.
```typescript
import { GlobalWorkspace, WorkspaceItem } from 'ruvector-nervous-system-wasm';
// Create workspace with capacity 7 (Miller's Law: 7 +/- 2)
const workspace = new GlobalWorkspace(7);
// Create workspace items
const content = new Float32Array([1.0, 2.0, 3.0, 4.0]);
const item1 = new WorkspaceItem(
content,
0.9, // salience
1, // source module ID
BigInt(Date.now())
);
const item2 = WorkspaceItem.with_decay(
content,
0.7, // salience
2, // source module
BigInt(Date.now()),
0.1, // decay rate
5000n // lifetime ms
);
// Broadcast to workspace (returns true if accepted)
if (workspace.broadcast(item1)) {
console.log("Item accepted into workspace");
}
// Run competitive dynamics
workspace.compete(); // Lower salience items decay/get pruned
// Retrieve most salient
const mostSalient = workspace.most_salient();
if (mostSalient) {
console.log(`Most salient: ${mostSalient.salience}`);
}
// Get all current items
const allItems = workspace.retrieve();
// Get top-k items
const topItems = workspace.retrieve_top_k(3);
// Check workspace state
console.log(`Items: ${workspace.len} / ${workspace.capacity}`);
console.log(`Load: ${(workspace.current_load() * 100).toFixed(1)}%`);
console.log(`Average salience: ${workspace.average_salience().toFixed(2)}`);
// Configure decay
workspace.set_decay_rate(0.05);
```
## Performance Benchmarks
| Component | Operation | Target Latency |
|-----------|-----------|----------------|
| BTSP | one_shot_associate | Immediate (no iteration) |
| HDC | bind (XOR) | < 50ns |
| HDC | similarity | < 100ns |
| WTA | compete | < 1us |
| K-WTA | select (k=50, n=1000) | < 10us |
| Workspace | broadcast | < 10us |
## Biological References
| Component | Biological Inspiration | Reference |
|-----------|----------------------|-----------|
| BTSP | Hippocampal place fields | Bittner et al., 2017 |
| HDC | Cortical sparse coding | Kanerva, 1988; Plate, 2003 |
| WTA | Lateral inhibition | Cortical microcircuits |
| Global Workspace | Conscious access | Baars, 1988; Dehaene, 2014 |
## API Reference
### Hypervector
| Method | Description |
|--------|-------------|
| `random()` | Create random hypervector (static) |
| `from_seed(seed)` | Reproducible from seed (static) |
| `bind(other)` | XOR binding (associative, self-inverse) |
| `bundle_3(a, b, c)` | Majority voting bundle (static) |
| `similarity(other)` | Cosine-like similarity (-1 to 1) |
| `hamming_distance(other)` | Number of differing bits |
| `to_bytes()` / `from_bytes()` | Serialization |
### BTSPLayer
| Method | Description |
|--------|-------------|
| `new(size, tau)` | Create layer |
| `one_shot_associate(pattern, target)` | Single-step learning |
| `forward(input)` | Compute output |
| `get_weights()` | Get learned weights |
| `reset()` | Reset to initial state |
### WTALayer / KWTALayer
| Method | Description |
|--------|-------------|
| `new(size, threshold, inhibition)` | Create WTA |
| `new(size, k)` | Create K-WTA |
| `compete(inputs)` | Get winner index |
| `select(inputs)` | Get top-k indices |
| `sparse_activations(inputs)` | Sparse output |
### GlobalWorkspace
| Method | Description |
|--------|-------------|
| `new(capacity)` | Create workspace (4-7 typical) |
| `broadcast(item)` | Add item to workspace |
| `compete()` | Run competitive dynamics |
| `most_salient()` | Get top item |
| `retrieve_top_k(k)` | Get top k items |
## Use Cases
- **Neuromorphic Computing**: Brain-inspired computing architectures
- **One-Shot Learning**: Learn from single examples
- **Attention Mechanisms**: Biologically-plausible attention
- **Sparse Coding**: Efficient neural representations
- **Symbol Binding**: Compositional representations with HDC
- **Fast Decision Making**: Ultra-low-latency neural decisions
- **Memory Systems**: Associative and content-addressable memory
## Bundle Size
- **WASM binary**: ~174KB (uncompressed)
- **Gzip compressed**: ~65KB
- **JavaScript glue**: ~8KB
## Related Packages
- [ruvector-attention-unified-wasm](https://www.npmjs.com/package/ruvector-attention-unified-wasm) - 18+ attention mechanisms
- [ruvector-learning-wasm](https://www.npmjs.com/package/ruvector-learning-wasm) - MicroLoRA adaptation
- [ruvector-exotic-wasm](https://www.npmjs.com/package/ruvector-exotic-wasm) - NAO governance, exotic AI
## License
MIT
## Links
- [GitHub Repository](https://github.com/ruvnet/ruvector)
- [Full Documentation](https://ruv.io)
- [Bug Reports](https://github.com/ruvnet/ruvector/issues)
---
**Keywords**: hyperdimensional computing, HDC, BTSP, behavioral timescale synaptic plasticity, neuromorphic, winner-take-all, WTA, K-WTA, sparse coding, neural networks, one-shot learning, WebAssembly, WASM, bio-inspired, brain-inspired, neural competition, lateral inhibition, global workspace, attention, consciousness, associative memory

View File

@@ -0,0 +1,43 @@
{
"name": "@ruvector/nervous-system-wasm",
"type": "module",
"collaborators": [
"RuVector Team"
],
"author": "RuVector Team <ruvnet@users.noreply.github.com>",
"description": "WASM bindings for ruvector-nervous-system bio-inspired AI components - HDC, BTSP, neuromorphic computing",
"version": "0.1.29",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/ruvector"
},
"bugs": {
"url": "https://github.com/ruvnet/ruvector/issues"
},
"files": [
"ruvector_nervous_system_wasm_bg.wasm",
"ruvector_nervous_system_wasm.js",
"ruvector_nervous_system_wasm.d.ts",
"ruvector_nervous_system_wasm_bg.wasm.d.ts",
"README.md"
],
"main": "ruvector_nervous_system_wasm.js",
"homepage": "https://ruv.io",
"types": "ruvector_nervous_system_wasm.d.ts",
"sideEffects": [
"./snippets/*"
],
"keywords": [
"wasm",
"neural",
"hdc",
"btsp",
"neuromorphic",
"ruvector",
"webassembly",
"hyperdimensional-computing",
"spiking-neural-networks",
"bio-inspired"
]
}

View File

@@ -0,0 +1,548 @@
/* tslint:disable */
/* eslint-disable */
export class BTSPAssociativeMemory {
free(): void;
[Symbol.dispose](): void;
/**
* Get memory dimensions
*/
dimensions(): any;
/**
* Store key-value association in one shot
*/
store_one_shot(key: Float32Array, value: Float32Array): void;
/**
* Create new associative memory
*
* # Arguments
* * `input_size` - Dimension of key vectors
* * `output_size` - Dimension of value vectors
*/
constructor(input_size: number, output_size: number);
/**
* Retrieve value from key
*/
retrieve(query: Float32Array): Float32Array;
}
export class BTSPLayer {
free(): void;
[Symbol.dispose](): void;
/**
* Get weights as Float32Array
*/
get_weights(): Float32Array;
/**
* One-shot association: learn pattern -> target in single step
*
* This is the key BTSP capability: immediate learning without iteration.
* Uses gradient normalization for single-step convergence.
*/
one_shot_associate(pattern: Float32Array, target: number): void;
/**
* Create a new BTSP layer
*
* # Arguments
* * `size` - Number of synapses (input dimension)
* * `tau` - Time constant in milliseconds (2000ms default)
*/
constructor(size: number, tau: number);
/**
* Reset layer to initial state
*/
reset(): void;
/**
* Forward pass: compute layer output
*/
forward(input: Float32Array): number;
/**
* Get number of synapses
*/
readonly size: number;
}
export class BTSPSynapse {
free(): void;
[Symbol.dispose](): void;
/**
* Create a new BTSP synapse
*
* # Arguments
* * `initial_weight` - Starting weight (0.0 to 1.0)
* * `tau_btsp` - Time constant in milliseconds (1000-3000ms recommended)
*/
constructor(initial_weight: number, tau_btsp: number);
/**
* Update synapse based on activity and plateau signal
*
* # Arguments
* * `presynaptic_active` - Is presynaptic neuron firing?
* * `plateau_signal` - Dendritic plateau potential detected?
* * `dt` - Time step in milliseconds
*/
update(presynaptic_active: boolean, plateau_signal: boolean, dt: number): void;
/**
* Compute synaptic output
*/
forward(input: number): number;
/**
* Get eligibility trace
*/
readonly eligibility_trace: number;
/**
* Get current weight
*/
readonly weight: number;
}
export class GlobalWorkspace {
free(): void;
[Symbol.dispose](): void;
/**
* Get current load (0.0 to 1.0)
*/
current_load(): number;
/**
* Get most salient item
*/
most_salient(): WorkspaceItem | undefined;
/**
* Retrieve top-k most salient representations
*/
retrieve_top_k(k: number): any;
/**
* Set salience decay rate
*/
set_decay_rate(decay: number): void;
/**
* Create with custom threshold
*/
static with_threshold(capacity: number, threshold: number): GlobalWorkspace;
/**
* Get available slots
*/
available_slots(): number;
/**
* Get average salience
*/
average_salience(): number;
/**
* Create a new global workspace
*
* # Arguments
* * `capacity` - Maximum number of representations (typically 4-7)
*/
constructor(capacity: number);
/**
* Clear all representations
*/
clear(): void;
/**
* Run competitive dynamics (salience decay and pruning)
*/
compete(): void;
/**
* Check if workspace is at capacity
*/
is_full(): boolean;
/**
* Check if workspace is empty
*/
is_empty(): boolean;
/**
* Retrieve all current representations as JSON
*/
retrieve(): any;
/**
* Broadcast a representation to the workspace
*
* Returns true if accepted, false if rejected.
*/
broadcast(item: WorkspaceItem): boolean;
/**
* Get current number of representations
*/
readonly len: number;
/**
* Get workspace capacity
*/
readonly capacity: number;
}
export class HdcMemory {
free(): void;
[Symbol.dispose](): void;
/**
* Get a vector by label
*/
get(label: string): Hypervector | undefined;
/**
* Check if a label exists
*/
has(label: string): boolean;
/**
* Create a new empty HDC memory
*/
constructor();
/**
* Clear all stored vectors
*/
clear(): void;
/**
* Store a hypervector with a label
*/
store(label: string, vector: Hypervector): void;
/**
* Find the k most similar vectors to query
*/
top_k(query: Hypervector, k: number): any;
/**
* Retrieve vectors similar to query above threshold
*
* Returns array of [label, similarity] pairs
*/
retrieve(query: Hypervector, threshold: number): any;
/**
* Get number of stored vectors
*/
readonly size: number;
}
export class Hypervector {
free(): void;
[Symbol.dispose](): void;
/**
* Create from raw bytes
*/
static from_bytes(bytes: Uint8Array): Hypervector;
/**
* Compute similarity between two hypervectors
*
* Returns a value in [-1.0, 1.0] where:
* - 1.0 = identical vectors
* - 0.0 = random/orthogonal vectors
* - -1.0 = completely opposite vectors
*/
similarity(other: Hypervector): number;
/**
* Compute Hamming distance (number of differing bits)
*/
hamming_distance(other: Hypervector): number;
/**
* Create a zero hypervector
*/
constructor();
/**
* Bind two hypervectors using XOR
*
* Binding is associative, commutative, and self-inverse:
* - a.bind(b) == b.bind(a)
* - a.bind(b).bind(b) == a
*/
bind(other: Hypervector): Hypervector;
/**
* Create a random hypervector with ~50% bits set
*/
static random(): Hypervector;
/**
* Bundle multiple vectors by majority voting on each bit
*/
static bundle_3(a: Hypervector, b: Hypervector, c: Hypervector): Hypervector;
/**
* Count the number of set bits (population count)
*/
popcount(): number;
/**
* Get the raw bits as Uint8Array (for serialization)
*/
to_bytes(): Uint8Array;
/**
* Create a hypervector from a seed for reproducibility
*/
static from_seed(seed: bigint): Hypervector;
/**
* Get number of bits
*/
readonly dimension: number;
}
export class KWTALayer {
free(): void;
[Symbol.dispose](): void;
/**
* Set activation threshold
*/
with_threshold(threshold: number): void;
/**
* Select top-k neurons with their activation values
*
* Returns array of [index, value] pairs.
*/
select_with_values(inputs: Float32Array): any;
/**
* Create sparse activation vector (only top-k preserved)
*/
sparse_activations(inputs: Float32Array): Float32Array;
/**
* Create a new K-WTA layer
*
* # Arguments
* * `size` - Total number of neurons
* * `k` - Number of winners to select
*/
constructor(size: number, k: number);
/**
* Select top-k neurons
*
* Returns indices of k neurons with highest activations, sorted descending.
*/
select(inputs: Float32Array): Uint32Array;
/**
* Get number of winners
*/
readonly k: number;
/**
* Get layer size
*/
readonly size: number;
}
export class WTALayer {
free(): void;
[Symbol.dispose](): void;
/**
* Soft competition with normalized activations
*
* Returns activation levels for all neurons after softmax-like normalization.
*/
compete_soft(inputs: Float32Array): Float32Array;
/**
* Get current membrane potentials
*/
get_membranes(): Float32Array;
/**
* Set refractory period
*/
set_refractory_period(period: number): void;
/**
* Create a new WTA layer
*
* # Arguments
* * `size` - Number of competing neurons
* * `threshold` - Activation threshold for firing
* * `inhibition` - Lateral inhibition strength (0.0-1.0)
*/
constructor(size: number, threshold: number, inhibition: number);
/**
* Reset layer state
*/
reset(): void;
/**
* Run winner-take-all competition
*
* Returns the index of the winning neuron, or -1 if no neuron exceeds threshold.
*/
compete(inputs: Float32Array): number;
/**
* Get layer size
*/
readonly size: number;
}
export class WorkspaceItem {
free(): void;
[Symbol.dispose](): void;
/**
* Check if expired
*/
is_expired(current_time: bigint): boolean;
/**
* Create with custom decay and lifetime
*/
static with_decay(content: Float32Array, salience: number, source_module: number, timestamp: bigint, decay_rate: number, lifetime: bigint): WorkspaceItem;
/**
* Apply temporal decay
*/
apply_decay(dt: number): void;
/**
* Get content as Float32Array
*/
get_content(): Float32Array;
/**
* Update salience
*/
update_salience(new_salience: number): void;
/**
* Create a new workspace item
*/
constructor(content: Float32Array, salience: number, source_module: number, timestamp: bigint);
/**
* Compute content magnitude (L2 norm)
*/
magnitude(): number;
/**
* Get source module
*/
readonly source_module: number;
/**
* Get ID
*/
readonly id: bigint;
/**
* Get salience
*/
readonly salience: number;
/**
* Get timestamp
*/
readonly timestamp: bigint;
}
/**
* Get information about available bio-inspired mechanisms
*/
export function available_mechanisms(): any;
/**
* Get biological references for the mechanisms
*/
export function biological_references(): any;
/**
* Initialize the WASM module with panic hook
*/
export function init(): void;
/**
* Get performance targets for each mechanism
*/
export function performance_targets(): any;
/**
* Get the version of the crate
*/
export function version(): string;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly __wbg_btspassociativememory_free: (a: number, b: number) => void;
readonly __wbg_btsplayer_free: (a: number, b: number) => void;
readonly __wbg_btspsynapse_free: (a: number, b: number) => void;
readonly __wbg_globalworkspace_free: (a: number, b: number) => void;
readonly __wbg_hdcmemory_free: (a: number, b: number) => void;
readonly __wbg_hypervector_free: (a: number, b: number) => void;
readonly __wbg_kwtalayer_free: (a: number, b: number) => void;
readonly __wbg_workspaceitem_free: (a: number, b: number) => void;
readonly __wbg_wtalayer_free: (a: number, b: number) => void;
readonly available_mechanisms: () => number;
readonly biological_references: () => number;
readonly btspassociativememory_dimensions: (a: number) => number;
readonly btspassociativememory_new: (a: number, b: number) => number;
readonly btspassociativememory_retrieve: (a: number, b: number, c: number, d: number) => void;
readonly btspassociativememory_store_one_shot: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
readonly btsplayer_forward: (a: number, b: number, c: number, d: number) => void;
readonly btsplayer_get_weights: (a: number) => number;
readonly btsplayer_new: (a: number, b: number) => number;
readonly btsplayer_one_shot_associate: (a: number, b: number, c: number, d: number, e: number) => void;
readonly btsplayer_reset: (a: number) => void;
readonly btsplayer_size: (a: number) => number;
readonly btspsynapse_eligibility_trace: (a: number) => number;
readonly btspsynapse_forward: (a: number, b: number) => number;
readonly btspsynapse_new: (a: number, b: number, c: number) => void;
readonly btspsynapse_update: (a: number, b: number, c: number, d: number) => void;
readonly btspsynapse_weight: (a: number) => number;
readonly globalworkspace_available_slots: (a: number) => number;
readonly globalworkspace_average_salience: (a: number) => number;
readonly globalworkspace_broadcast: (a: number, b: number) => number;
readonly globalworkspace_capacity: (a: number) => number;
readonly globalworkspace_clear: (a: number) => void;
readonly globalworkspace_compete: (a: number) => void;
readonly globalworkspace_current_load: (a: number) => number;
readonly globalworkspace_is_empty: (a: number) => number;
readonly globalworkspace_is_full: (a: number) => number;
readonly globalworkspace_len: (a: number) => number;
readonly globalworkspace_most_salient: (a: number) => number;
readonly globalworkspace_new: (a: number) => number;
readonly globalworkspace_retrieve: (a: number) => number;
readonly globalworkspace_retrieve_top_k: (a: number, b: number) => number;
readonly globalworkspace_set_decay_rate: (a: number, b: number) => void;
readonly globalworkspace_with_threshold: (a: number, b: number) => number;
readonly hdcmemory_clear: (a: number) => void;
readonly hdcmemory_get: (a: number, b: number, c: number) => number;
readonly hdcmemory_has: (a: number, b: number, c: number) => number;
readonly hdcmemory_new: () => number;
readonly hdcmemory_retrieve: (a: number, b: number, c: number) => number;
readonly hdcmemory_size: (a: number) => number;
readonly hdcmemory_store: (a: number, b: number, c: number, d: number) => void;
readonly hdcmemory_top_k: (a: number, b: number, c: number) => number;
readonly hypervector_bind: (a: number, b: number) => number;
readonly hypervector_bundle_3: (a: number, b: number, c: number) => number;
readonly hypervector_dimension: (a: number) => number;
readonly hypervector_from_bytes: (a: number, b: number, c: number) => void;
readonly hypervector_from_seed: (a: bigint) => number;
readonly hypervector_hamming_distance: (a: number, b: number) => number;
readonly hypervector_new: () => number;
readonly hypervector_popcount: (a: number) => number;
readonly hypervector_random: () => number;
readonly hypervector_similarity: (a: number, b: number) => number;
readonly hypervector_to_bytes: (a: number) => number;
readonly kwtalayer_k: (a: number) => number;
readonly kwtalayer_new: (a: number, b: number, c: number) => void;
readonly kwtalayer_select: (a: number, b: number, c: number, d: number) => void;
readonly kwtalayer_select_with_values: (a: number, b: number, c: number, d: number) => void;
readonly kwtalayer_size: (a: number) => number;
readonly kwtalayer_sparse_activations: (a: number, b: number, c: number, d: number) => void;
readonly kwtalayer_with_threshold: (a: number, b: number) => void;
readonly performance_targets: () => number;
readonly version: (a: number) => void;
readonly workspaceitem_apply_decay: (a: number, b: number) => void;
readonly workspaceitem_get_content: (a: number) => number;
readonly workspaceitem_id: (a: number) => bigint;
readonly workspaceitem_is_expired: (a: number, b: bigint) => number;
readonly workspaceitem_magnitude: (a: number) => number;
readonly workspaceitem_new: (a: number, b: number, c: number, d: number, e: bigint) => number;
readonly workspaceitem_salience: (a: number) => number;
readonly workspaceitem_source_module: (a: number) => number;
readonly workspaceitem_timestamp: (a: number) => bigint;
readonly workspaceitem_update_salience: (a: number, b: number) => void;
readonly workspaceitem_with_decay: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: bigint) => number;
readonly wtalayer_compete: (a: number, b: number, c: number, d: number) => void;
readonly wtalayer_compete_soft: (a: number, b: number, c: number, d: number) => void;
readonly wtalayer_get_membranes: (a: number) => number;
readonly wtalayer_new: (a: number, b: number, c: number, d: number) => void;
readonly wtalayer_reset: (a: number) => void;
readonly wtalayer_set_refractory_period: (a: number, b: number) => void;
readonly init: () => void;
readonly wtalayer_size: (a: number) => number;
readonly __wbindgen_export: (a: number, b: number) => number;
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_export3: (a: number) => void;
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_start: () => void;
}
export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
*
* @returns {InitOutput}
*/
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,98 @@
/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export const __wbg_btspassociativememory_free: (a: number, b: number) => void;
export const __wbg_btsplayer_free: (a: number, b: number) => void;
export const __wbg_btspsynapse_free: (a: number, b: number) => void;
export const __wbg_globalworkspace_free: (a: number, b: number) => void;
export const __wbg_hdcmemory_free: (a: number, b: number) => void;
export const __wbg_hypervector_free: (a: number, b: number) => void;
export const __wbg_kwtalayer_free: (a: number, b: number) => void;
export const __wbg_workspaceitem_free: (a: number, b: number) => void;
export const __wbg_wtalayer_free: (a: number, b: number) => void;
export const available_mechanisms: () => number;
export const biological_references: () => number;
export const btspassociativememory_dimensions: (a: number) => number;
export const btspassociativememory_new: (a: number, b: number) => number;
export const btspassociativememory_retrieve: (a: number, b: number, c: number, d: number) => void;
export const btspassociativememory_store_one_shot: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
export const btsplayer_forward: (a: number, b: number, c: number, d: number) => void;
export const btsplayer_get_weights: (a: number) => number;
export const btsplayer_new: (a: number, b: number) => number;
export const btsplayer_one_shot_associate: (a: number, b: number, c: number, d: number, e: number) => void;
export const btsplayer_reset: (a: number) => void;
export const btsplayer_size: (a: number) => number;
export const btspsynapse_eligibility_trace: (a: number) => number;
export const btspsynapse_forward: (a: number, b: number) => number;
export const btspsynapse_new: (a: number, b: number, c: number) => void;
export const btspsynapse_update: (a: number, b: number, c: number, d: number) => void;
export const btspsynapse_weight: (a: number) => number;
export const globalworkspace_available_slots: (a: number) => number;
export const globalworkspace_average_salience: (a: number) => number;
export const globalworkspace_broadcast: (a: number, b: number) => number;
export const globalworkspace_capacity: (a: number) => number;
export const globalworkspace_clear: (a: number) => void;
export const globalworkspace_compete: (a: number) => void;
export const globalworkspace_current_load: (a: number) => number;
export const globalworkspace_is_empty: (a: number) => number;
export const globalworkspace_is_full: (a: number) => number;
export const globalworkspace_len: (a: number) => number;
export const globalworkspace_most_salient: (a: number) => number;
export const globalworkspace_new: (a: number) => number;
export const globalworkspace_retrieve: (a: number) => number;
export const globalworkspace_retrieve_top_k: (a: number, b: number) => number;
export const globalworkspace_set_decay_rate: (a: number, b: number) => void;
export const globalworkspace_with_threshold: (a: number, b: number) => number;
export const hdcmemory_clear: (a: number) => void;
export const hdcmemory_get: (a: number, b: number, c: number) => number;
export const hdcmemory_has: (a: number, b: number, c: number) => number;
export const hdcmemory_new: () => number;
export const hdcmemory_retrieve: (a: number, b: number, c: number) => number;
export const hdcmemory_size: (a: number) => number;
export const hdcmemory_store: (a: number, b: number, c: number, d: number) => void;
export const hdcmemory_top_k: (a: number, b: number, c: number) => number;
export const hypervector_bind: (a: number, b: number) => number;
export const hypervector_bundle_3: (a: number, b: number, c: number) => number;
export const hypervector_dimension: (a: number) => number;
export const hypervector_from_bytes: (a: number, b: number, c: number) => void;
export const hypervector_from_seed: (a: bigint) => number;
export const hypervector_hamming_distance: (a: number, b: number) => number;
export const hypervector_new: () => number;
export const hypervector_popcount: (a: number) => number;
export const hypervector_random: () => number;
export const hypervector_similarity: (a: number, b: number) => number;
export const hypervector_to_bytes: (a: number) => number;
export const kwtalayer_k: (a: number) => number;
export const kwtalayer_new: (a: number, b: number, c: number) => void;
export const kwtalayer_select: (a: number, b: number, c: number, d: number) => void;
export const kwtalayer_select_with_values: (a: number, b: number, c: number, d: number) => void;
export const kwtalayer_size: (a: number) => number;
export const kwtalayer_sparse_activations: (a: number, b: number, c: number, d: number) => void;
export const kwtalayer_with_threshold: (a: number, b: number) => void;
export const performance_targets: () => number;
export const version: (a: number) => void;
export const workspaceitem_apply_decay: (a: number, b: number) => void;
export const workspaceitem_get_content: (a: number) => number;
export const workspaceitem_id: (a: number) => bigint;
export const workspaceitem_is_expired: (a: number, b: bigint) => number;
export const workspaceitem_magnitude: (a: number) => number;
export const workspaceitem_new: (a: number, b: number, c: number, d: number, e: bigint) => number;
export const workspaceitem_salience: (a: number) => number;
export const workspaceitem_source_module: (a: number) => number;
export const workspaceitem_timestamp: (a: number) => bigint;
export const workspaceitem_update_salience: (a: number, b: number) => void;
export const workspaceitem_with_decay: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: bigint) => number;
export const wtalayer_compete: (a: number, b: number, c: number, d: number) => void;
export const wtalayer_compete_soft: (a: number, b: number, c: number, d: number) => void;
export const wtalayer_get_membranes: (a: number) => number;
export const wtalayer_new: (a: number, b: number, c: number, d: number) => void;
export const wtalayer_reset: (a: number) => void;
export const wtalayer_set_refractory_period: (a: number, b: number) => void;
export const init: () => void;
export const wtalayer_size: (a: number) => number;
export const __wbindgen_export: (a: number, b: number) => number;
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
export const __wbindgen_export3: (a: number) => void;
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
export const __wbindgen_start: () => void;