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

@redux-ai/state

v2.0.0

Published

Core state management functionality for Redux AI, providing intelligent state tracking and prediction capabilities powered by vector storage and XState machines.

Downloads

156

Readme

@redux-ai/state

Core state management functionality for Redux AI, providing intelligent state tracking and prediction capabilities powered by vector storage and XState machines.

Features

  • AI-powered state tracking with TypeScript
  • Automatic action suggestion based on state patterns
  • Vector storage integration for historical analysis
  • XState machine integration for complex state flows
  • Efficient state diffing and change tracking
  • Redux Toolkit middleware and enhancers
  • Type-safe state prediction and optimization

Installation

# Using pnpm (recommended)
pnpm add @redux-ai/state

# Or using npm
npm install @redux-ai/state

Usage

import { createAIStore, type AIState } from '@redux-ai/state';
import type { RootState } from './types';

// Create an AI-powered store
const store = createAIStore<RootState>({
  reducer: rootReducer,
  initialState: {},
  vectorConfig: {
    dimensions: 128,
  },
  predictorConfig: {
    confidenceThreshold: 0.8,
    maxPredictions: 5,
  },
});

// The store automatically tracks state changes
store.subscribe(() => {
  const state = store.getState();
  const suggestions = store.getSuggestions();
  console.log('Suggested actions:', suggestions);
});

// Use the AI middleware
const aiMiddleware = createAIMiddleware({
  enablePrediction: true,
  trackingConfig: {
    includeMeta: true,
    storeHistory: true,
  },
});

// Add to your Redux store
const store = configureStore({
  reducer: rootReducer,
  middleware: getDefault => getDefault().concat(aiMiddleware),
});

API Reference

Store Configuration

createAIStore(config)

Creates a new Redux store with AI capabilities.

type AIStoreConfig<S> = {
  reducer: Reducer<S>;
  initialState: S;
  vectorConfig: VectorConfig;
  predictorConfig?: PredictorConfig;
};

Parameters

  • reducer (Reducer) - Root reducer function
  • initialState (State) - Initial state object
  • vectorConfig (VectorConfig) - Vector storage configuration
  • predictorConfig (PredictorConfig, optional) - AI predictor settings

Methods

AI Store Methods

  • getSuggestions(): Get AI-suggested actions based on current state
  • predictStateChange(action): Predict state after an action
  • getOptimizedActions(): Get optimized action sequences
  • getStateAnalytics(): Get analytics about state changes

Testing

# Run tests
pnpm test

# Run tests with coverage
pnpm test:coverage

Type Safety

The package is written in TypeScript and provides strong type safety:

import type { AIState, AIAction } from '@redux-ai/state';

// State types are properly inferred
const state: AIState = store.getState();

// Actions are type-checked
store.dispatch<AIAction>({
  type: 'AI_PREDICT',
  payload: {
    confidenceThreshold: 0.9,
  },
});

State Machine Integration

import { createStateMachine } from '@redux-ai/state';

const authMachine = createStateMachine({
  id: 'auth',
  initial: 'idle',
  states: {
    idle: {
      on: { LOGIN: 'authenticating' },
    },
    authenticating: {
      on: {
        SUCCESS: 'authenticated',
        ERROR: 'error',
      },
    },
  },
});

// Integrate with Redux store
store.attachStateMachine(authMachine);

Performance Optimization

  • Efficient state diffing for change detection
  • Batched updates for prediction calculations
  • Cached suggestion results
  • Configurable tracking granularity

Contributing

Please read our Contributing Guide for details on our code of conduct and development process.

License

MIT