Sub-microsecond reactive runtime β SharedArrayBuffer-backed signals with true cross-thread propagation, zero postMessage overhead, and fleet-aware effect scheduling.
Existing signal libraries (Alien Signals, Preact Signals, SolidJS) operate within a single thread. Cross-worker reactivity requires serializing dependency graphs through postMessage, adding milliseconds of overhead per notification.
@kronos/warp-core eliminates this entirely:
| Feature | Traditional Signals | Warp Core |
|---|---|---|
| Cross-thread propagation | postMessage (1-5ms) | Atomics.notify (~0.1ΞΌs) |
| Memory model | Per-thread copies | Single SharedArrayBuffer |
| Dependency tracking | Per-thread graph | One arena, all threads |
| Effect scheduling | Microtask queue | CAS + waitAsync wakeup |
| Store API | Framework-specific | Framework-agnostic Proxy |
npm install @kronos/warp-coreimport { SignalArena, EffectScope } from '@kronos/warp-core';
// Create an arena (shared across all Workers)
const arena = SignalArena.create();
const counter = arena.createSignal(0);
// Set up reactive effects
const scope = new EffectScope(arena);
scope.effect(counter, (value) => {
console.log('Counter changed:', value);
});
// Write from any thread β all effects fire
arena.write(counter, 42);
// Pass to Workers
worker.postMessage({ buffer: arena.buffer }, []);
// In Worker: const arena = SignalArena.from(buffer);import { createStore } from '@kronos/warp-core';
const store = createStore({ count: 0, name: 'KRONOS' });
store.on('count', (newVal, oldVal) => {
console.log(`count: ${oldVal} β ${newVal}`);
});
store.state.count = 1; // triggers listener
// Batch updates
store.batch((s) => {
s.count = 10;
s.name = 'Warp';
}); // listeners fire after all writesimport { WorkerSync } from '@kronos/warp-core';
const sync = new WorkerSync({ nodeId: 'main-thread' });
sync.on('state-update', (msg) => {
console.log('Received update from:', msg.sourceId, msg.payload);
});
sync.send({ type: 'state-update', payload: { count: 42 } });import { SignalArena, installDevtoolsHook, arenaStats, scanSignals } from '@kronos/warp-core';
const arena = SignalArena.create();
installDevtoolsHook(arena);
// Inspect from console:
// globalThis.__WARP_CORE_DEVTOOLS__.arenaStats()
// globalThis.__WARP_CORE_DEVTOOLS__.scanSignals(10)SignalArena.create(byteSize?)β Create a new arena (default 64 MB)SignalArena.from(buffer)β Reconstruct from SharedArrayBufferarena.createSignal(initialValue)β Allocate a mutable signalarena.createComputed()β Allocate a computed nodearena.read(offset)β Read signal value (atomic)arena.write(offset, value)β Write value (CAS-locked, version-bumped)arena.waitForChange(offset, version)β Async wait for next writearena.addSubscriber(signal, subscriber)β Link subscriber to signal
new EffectScope(arena)β Create a scopescope.effect(signalOffset, callback)β Register reactive effectscope.stop()β Tear down all subscriptions
createStore(initial)β Create a Proxy-based storestore.on(field, listener)β Subscribe to field changesstore.onAny(listener)β Subscribe to all changesstore.batch(updater)β Batch multiple writesstore.snapshot()β Get a shallow copy
new WorkerSync(config)β Create a cross-context sync bussync.on(type, listener)β Subscribe to message typessync.send(message)β Send to all other nodessync.close()β Close the channel
inspectSignal(arena, offset)β Get signal snapshotarenaStats(arena)β Get arena utilizationscanSignals(arena, maxCount?)β Scan all allocated signalsinstallDevtoolsHook(arena)β Expose on globalThis
MIT