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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ai.ntellect/core

v0.8.3

Published

A TypeScript framework for building workflow automation with event-driven architecture.

Readme

@ai.ntellect/core

A TypeScript framework for building workflow automation with event-driven architecture.

Features

  • Graph-based workflow execution
  • Event-driven node processing
  • TypeScript type safety
  • Zod schema validation
  • Retry mechanisms
  • State observation
  • AI Agent integration

Installation

npm install @ai.ntellect/core zod

Basic Usage

Building a simple workflow

import { z } from "zod";
import { GraphFlow } from "@ai.ntellect/core";
import { GraphContext, GraphNodeConfig } from "@ai.ntellect/core/types";

// Define the schema
const Schema = z.object({
  message: z.string(),
});

// Define a node
const greetNode = {
  name: "greet",
  execute: async (context: GraphContext<typeof Schema>) => {
    context.message = "Hello, World!";
  },
};

// Create workflow
const workflow = new GraphFlow({
  name: "hello",
  schema: Schema,
  context: { message: "" },
  nodes: [greetNode],
});

// Execute and observe
const main = async () => {
  // Observe state changes
  workflow
    .observe()
    .state()
    .subscribe((context) => {
      console.log(context);
    });

  // Execute workflow
  await workflow.execute("greet");
};

main();

Handling events in a workflow

import { z } from "zod";
import { GraphFlow } from "@ai.ntellect/core";
import { GraphContext } from "@ai.ntellect/core/types";

// Define schema
const OrderSchema = z.object({
  orderId: z.string(),
  status: z.string(),
  amount: z.number(),
});

// Define nodes
const paymentNode: GraphNodeConfig<typeof OrderSchema> = {
  name: "payment",
  when: {
    events: ["payment.received"],
    timeout: 30000,
    strategy: { type: "single" },
  },
  execute: async (context: GraphContext<typeof OrderSchema>) => {
    context.status = "processing";
  },
  next: ["validation"],
};

const validationNode: GraphNodeConfig<typeof OrderSchema> = {
  name: "validation",
  when: {
    events: ["payment.validated", "inventory.checked"],
    timeout: 5000,
    strategy: {
      type: "correlate",
      correlation: (events) => {
        return events.every(
          (e) => e.payload.orderId === events[0].payload.orderId
        );
      },
    },
  },
  execute: async (context: GraphContext<typeof OrderSchema>) => {
    context.status = "validated";
  },
};

// Create workflow
const orderWorkflow = new GraphFlow({
  name: "order",
  schema: OrderSchema,
  context: {
    orderId: "",
    status: "pending",
    amount: 0,
  },
  nodes: [paymentNode, validationNode],
});

// Usage
const main = async () => {
  // Observe state
  orderWorkflow
    .observe()
    .property("status")
    .subscribe((status) => {
      console.log("Status:", status);
    });

  // Start listening for events
  orderWorkflow.execute("payment");

  // Emit event after a short delay
  setTimeout(async () => {
    await orderWorkflow.emit("payment.received", {
      orderId: "123",
      amount: 100,
    });
  }, 100);

  // Observe payment received event
  orderWorkflow
    .observe()
    .event("payment.received")
    .subscribe((event) => {
      console.log("Payment received:", event);
      orderWorkflow.emit("inventory.checked", {
        orderId: event.payload.orderId,
      });
    });

  // Observe inventory checked event
  orderWorkflow
    .observe()
    .event("inventory.checked")
    .subscribe((event) => {
      console.log("Inventory checked:", event);
      orderWorkflow.emit("payment.validated", {
        orderId: event.payload.orderId,
      });
    });

  // Observe payment validated event
  orderWorkflow
    .observe()
    .event("payment.validated")
    .subscribe((event) => {
      console.log("Payment validated:", event);
    });
};

main();

Creating a workflow with Agent

import { z } from "zod";
import { GraphFlow, Agent } from "@ai.ntellect/core";
import { GraphContext } from "@ai.ntellect/core/types";

const EmailSchema = z.object({
  to: z.string(),
  subject: z.string(),
  content: z.string(),
  status: z.string(),
});

const sendNode = {
  name: "send",
  execute: async (context: GraphContext<typeof EmailSchema>) => {
    context.status = "sending";
    // Email sending implementation
    context.status = "sent";
  },
};

const emailFlow = new GraphFlow({
  name: "email",
  schema: EmailSchema,
  context: {
    to: "",
    subject: "",
    content: "",
    status: "pending",
  },
  nodes: [sendNode],
});

const assistant = new Agent({
  role: "Email Assistant",
  goal: "Help users send emails",
  tools: [emailFlow],
  llmConfig: {
    provider: "openai",
    model: "gpt-4",
    apiKey: process.env.OPENAI_API_KEY,
  },
});

const main = async () => {
  const result = await assistant.process(
    "Send an email to [email protected] about the project update"
  );
  console.log(result);
};

main();

Documentation

See the documentation for detailed usage examples.

Contributing

Contributions are welcome. Please submit pull requests with tests.

License

MIT