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

@atlasent/behavior

v1.0.1

Published

AtlaSent Behavior Verification System (BVS) integration — state summary, category aggregates, and evaluate context enrichment

Readme

@atlasent/behavior

AtlaSent Behavior Verification System (BVS) integration — read privacy-bounded behavioral aggregates from the behavior-insights service and enrich AtlaSent evaluate calls with a bvsSnapshot context field for v2 riskScore computation.

This package never sees raw event text. Every response is checked client-side against a raw-text-field blocklist (text, note, body, transcript, etc.) as defense-in-depth on top of the server-side privacy enforcement in behavior-insights — a match throws RawTextLeakError instead of returning the value.

Install

npm install @atlasent/behavior

Peer dependency: @atlasent/sdk ^2.0.0.

Usage

import { getStateSummary, getCategoryAggregate, attachToEvaluate } from '@atlasent/behavior';

const clientOpts = {
  baseUrl: 'https://behavior-insights.example.com',
  apiKey: process.env.BEHAVIOR_INSIGHTS_API_KEY!,
};

// Aggregate event counts over a rolling window (default 30 days)
const summary = await getStateSummary(userId, clientOpts, { windowDays: 14 });
// -> { user_id, window_start, window_end, event_count, category_counts } | null

// Count for a single behavior category
const aggregate = await getCategoryAggregate(
  userId,
  'behavior.health.adherence',
  clientOpts,
);
// -> { user_id, category, count, window_days, confidence_low }

Enriching an evaluate call

attachToEvaluate fetches the frozen BvsSnapshot wire shape and returns an object to spread into EvaluateRequest.context. It fails open ({}) when the snapshot is unavailable — a down or empty behavior-insights service must never block an unrelated evaluate call.

import { AtlaSentClient } from '@atlasent/sdk';
import { attachToEvaluate } from '@atlasent/behavior';

const atlasent = new AtlaSentClient({ apiKey, baseUrl });

const context = {
  ...baseContext,
  ...(await attachToEvaluate(userId, clientOpts)),
};

const decision = await atlasent.evaluate({ action_type: actionType, actor_id: actorId, context });

API

| Export | Signature | Description | |---|---|---| | getStateSummary | (userId, clientOpts, opts?) => Promise<StateSummary \| null> | Rolling-window event counts by category | | getCategoryAggregate | (userId, category, clientOpts, opts?) => Promise<CategoryAggregate> | Count for a single BehaviorCategory | | getBvsSnapshot | (userId, clientOpts) => Promise<BvsSnapshot \| null> | Raw BvsSnapshot (factors, confidence, computed_at) | | attachToEvaluate | (userId, clientOpts) => Promise<Record<string, unknown>> | { bvsSnapshot } or {} — spread into evaluate context | | assertNoRawText | (data, path?) => void | Throws RawTextLeakError if a raw-text field is present |

BehaviorClientOptions: { baseUrl, apiKey, timeoutMs? } (timeoutMs default 10000).

All aggregate shapes (StateSummary, CategoryAggregate, BvsSnapshot, ConsentClassProjection, BehaviorCategory) are exported as types from @atlasent/behavior.

Local development

cd typescript/packages/behavior
npm install
npm run typecheck
npm run build

License

Apache-2.0 — see LICENSE.