npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@paragondao/bagle-sdk

v0.1.1

Published

SDK for the BAGLE (Brain-AI General Learning Encoder) API — encode any biosignal into 128 universal coefficients

Downloads

171

Readme

@paragondao/bagle-sdk

SDK for the BAGLE (Brain-AI General Learning Encoder) API.

Encode any biosignal — breathing, EEG, accelerometer, heart rate, typing cadence, gait — into 128 universal coefficients (512 bytes). The encoder is signal-agnostic: it only sees numbers.

Install

npm install @paragondao/bagle-sdk

Quick Start

import { BagleClient } from '@paragondao/bagle-sdk';

const client = new BagleClient();

// Encode any time-series into 128 coefficients
const result = await client.encode([1.2, 3.4, 5.6, 7.8, /* ... */]);
console.log(result.encoding); // 128 numbers
console.log(result.dim);      // 128
console.log(result.latency_ms); // ~3ms

// Compare two encodings
const sim = await client.similarity(encodingA, encodingB);
console.log(sim.similarity); // 0.0 to 1.0

Client-Side Encoding (Offline)

For encoding without hitting the API:

import { gleEncodeSignal, cosineSimilarity } from '@paragondao/bagle-sdk';

// Any numeric array — accelerometer, heart rate, breathing, typing intervals
const coefficients = gleEncodeSignal([1.2, 3.4, 5.6, 7.8, /* ... */]);
console.log(coefficients.length); // 128

// Compare locally
const score = cosineSimilarity(coefficientsA, coefficientsB);

API Reference

BagleClient

const client = new BagleClient({
  baseUrl: 'https://bagle-api.fly.dev', // default
  apiKey: 'your-key',                    // optional
  timeout: 10000,                        // ms, default
});

client.encode(features, modality?)

Encode a numeric array into 128 GLE coefficients.

client.similarity(encodingA, encodingB)

Cosine similarity between two 128-dim encodings. Returns { similarity, distance }.

client.health()

Check API status and model availability.

Client-Side Functions

gleEncode(audioSamples, sampleRate?)

Encode PCM audio (16kHz default) using 1-second windows with identity band extraction (20-1000Hz).

gleEncodeSignal(samples, opts?)

General-purpose encoder for any numeric time-series. Options: windowSize, bandMin, bandMax.

cosineSimilarity(a, b)

Compute cosine similarity between two coefficient vectors.

What Can You Encode?

Every phone sensor produces a time-series. Every time-series can be GLE-encoded:

| Signal | Source | Example App | |--------|--------|------------| | Breathing audio | Phone mic | Crisis screening, stress detection | | Heart rate | Camera PPG | Fitness, sleep quality | | Accelerometer | Motion sensor | Gait analysis, fall detection | | Gyroscope | Rotation sensor | Tremor detection, balance | | Typing cadence | Keyboard | Cognitive load, fatigue | | EEG | MUSE headband | Consciousness classification | | Temperature | Sensor | Fever screening | | Barometric pressure | Barometer | Altitude sickness |

The network doesn't care what signal produced the 128 numbers.

License

MIT