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

@aigentive/wire-core

v1.0.2

Published

Wire — canonical schema, validation, normalization, and layout for LLM-first diagrams.

Downloads

425

Readme

@aigentive/wire-core

Canonical Wire schema, validation, normalization, and layout. Zero React; pure TypeScript.

Install

npm install @aigentive/wire-core

Quick start

import {
  parseWireDiagram,
  validate,
  layoutDiagram,
  toMermaid,
  addNode,
  connect,
  emptyDiagram
} from "@aigentive/wire-core";

const diagram = parseWireDiagram({
  layout: "LR",
  nodes: [
    { id: "webhook", kind: "trigger", title: "Webhook fires" },
    { id: "classify", kind: "ai", title: "Classify intent", from: "webhook", model: "gpt-4.1" }
  ]
});

const result = validate(diagram);
if (!result.valid) console.error(result.issues);

const layout = layoutDiagram(diagram);            // dagre-positioned nodes
const mermaid = toMermaid(diagram);               // export as Mermaid string

// Mutations are pure — every editor returns a new diagram.
let d = emptyDiagram({ layout: "LR" });
d = addNode(d, { kind: "trigger", title: "Webhook fires", id: "webhook" }).diagram;
d = addNode(d, { kind: "ai", title: "Classify", from: "webhook", model: "gpt-4.1" }).diagram;

Exports

| Export | Purpose | |---|---| | WireDiagramSchema, parseWireDiagram, safeParseWireDiagram | Zod schema + parsers | | NodeSchema, kind-specific schemas (AINodeSchema, …) | Per-node Zod schemas | | validate(input) | Structural + reference validation; returns ValidationIssue[] with codes + repair hints | | normalize(diagram) | Resolves from/after into explicit edges + node index | | layoutDiagram(diagram, opts?) | Dagre layout returning {x,y,width,height} per node | | toMermaid(diagram) | Export as Mermaid flowchart string | | addNode, updateNode, removeNode, connect, disconnect, addNote, setLayout, emptyDiagram | Pure immutable editors | | generateNodeId(opts), slugify(s) | ID utilities | | splitFromRef(ref) | Parse "id.branch" |

Schema overview

type WireDiagram = {
  version: 1;
  id?: string;
  title?: string;
  layout: "LR" | "TB" | "RL" | "BT";   // default LR
  layoutEngine?: "dagre" | "elk";
  nodes: WireNode[];
  edges: WireEdge[];                    // optional explicit edges
  metadata?: Record<string, unknown>;
};

type WireNode = {
  id: string;
  kind: "trigger" | "action" | "ai" | "tool" | "condition" | "human" |
        "memory" | "retrieval" | "guardrail" | "end" | "note" | "group";
  title: string;
  description?: string;
  tone?: "default" | "success" | "warning" | "error" | "info" | "ai";
  from?: string | string[];   // "<sourceId>" or "<sourceId>.<branch>"
  after?: string | string[];  // alias for `from`
  attachedTo?: string;        // notes/annotations only
  parent?: string;            // group nesting
  position?: { x: number; y: number };
  size?: { width: number; height: number };
  data?: Record<string, unknown>;
  // condition: branches: string[]
  // ai: model?, prompt?, tools?
  // tool: ref?
  // note: body?
  // group: children?
};

Validation codes

| Code | Severity | Meaning | |---|---|---| | schema.* | error | Zod schema rejection | | node.duplicate-id | error | Two nodes with the same id | | node.attached-to-missing | error | attachedTo points to a missing node | | node.parent-missing | error | parent points to a missing node | | node.parent-not-group | error | parent is not a group node | | condition.no-branches | error | Condition without branches | | condition.duplicate-branch | error | Repeated branch name | | edge.from-missing / edge.to-missing | error | Source/target node missing | | edge.branch-from-non-condition | error | id.branch from a non-condition node | | edge.unknown-branch | error | Branch name not declared on the source condition | | node.orphan | warning | No incoming or outgoing edges | | edge.self-loop | warning | Node references itself |

License

MIT