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

@skein-js/core

v0.6.3

Published

Framework-agnostic Agent Protocol engine for LangGraph.js — the heart of skein-js.

Downloads

1,091

Readme

@skein-js/core

The shared Agent Protocol contract for skein-js — wire types, the SkeinStore interface, the queue / bus / auth seams, and the edge error type.

Part of skein-js — a TypeScript Agent Protocol server for LangGraph.js, and a drop-in replacement for the LangGraph CLI.

Status: 🚧 Pre-alpha — implemented. The run engine, handler table, and SSE mapping that build on this contract live in @skein-js/agent-protocol.

Contents

What it does

Holds the Agent Protocol contract once, against normalized types, so behavior is identical across every framework adapter and storage driver. It defines interfaces; it implements nothing — the drivers (storage-memory, storage-postgres, redis) implement these interfaces and the engine consumes them. Everything downstream imports it:

  • Wire types re-exported from @langchain/langgraph-sdk (Assistant, Thread, Run, RunStatus, Config, Metadata, Item, StreamMode, Interrupt, …) — the single seam that pins the protocol version. skein-js never redefines them.
  • SkeinStore — the persistence interface for protocol resources (assistants / threads / runs / store), including the hasActiveRun concurrency guard and isTerminalRunStatus.
  • RunQueue / RunEventBus / RunFrame — the background-run queue and streaming pub/sub seams.
  • AuthEngine — the authentication + authorization contract (LangGraph-style custom auth), consulted per request by the engine when present.
  • SkeinHttpError — the typed edge error carrying an HTTP status.
  • serializeWireJson — flattens LangChain messages to the Agent Protocol wire shape for output.

Install

pnpm add @skein-js/core

Peer dependencies (install once in your project): @langchain/langgraph and @langchain/langgraph-sdk. core bundles nothing itself.

Usage

You rarely import core directly — you get it transitively. You reach for it when implementing a driver or handling errors at the HTTP edge:

import { type SkeinStore, SkeinHttpError, isTerminalRunStatus } from "@skein-js/core";

// Storage drivers implement SkeinStore…
export class MyStore implements SkeinStore {
  /* assistants / threads / runs / store repos */
}

// …and adapters throw/catch SkeinHttpError at the HTTP edge.
throw SkeinHttpError.notFound(`Thread "${id}" not found.`);

API

  • Wire types (re-exported from @langchain/langgraph-sdk): Assistant, AssistantBase, AssistantGraph, Checkpoint, Config, DefaultValues, GraphSchema, Interrupt, Item, Metadata, Run, SearchItem, StreamMode, Thread, ThreadState, ThreadStatus, ThreadTask; plus RunStatus and MultitaskStrategy derived from Run.
  • interface SkeinStore{ assistants: AssistantRepo; threads: ThreadRepo; runs: RunRepo; store: StoreRepo }. Each repo exposes CRUD + list/search; RunRepo.hasActiveRun(threadId) is the concurrency guard (true while a run is pending/running). Input types: AssistantCreate, ThreadCreate, ThreadUpdate, RunCreate, RunKwargs, StoreSearchQuery.
  • TERMINAL_RUN_STATUSES / isTerminalRunStatus(status)success / error / timeout / interrupted are terminal (a resume arrives as a fresh run).
  • interface RunQueueenqueue(run) + consume(process, options?)RunConsumer. interface RunEventBuspublish / close / subscribe(runId, afterSeq?). RunFrame = { seq, event, data } (monotonic seq per run). Plus QueuedRun, RunProcessor, RunConsumer, RunConsumerOptions.
  • interface AuthEngineauthenticate(request) (→ AuthContext, throws 401) + authorize({ resource, action, value, context }) (→ { filters?, value }, throws 403) + matchesFilters(...). Plus AuthContext, AuthUser, AuthResource, AuthAction, AuthFilters, AuthFilterValue.
  • class SkeinHttpErrornew SkeinHttpError(status, message, options?) and the static helpers badRequest (400) / unauthorized (401) / forbidden (403) / notFound (404) / conflict (409) / unprocessable (422); isSkeinHttpError(value) narrows it.
  • serializeWireJson(value): stringJSON.stringify replacement that flattens LangChain BaseMessages to the wire shape the SDK / useStream / Agent Chat UI expect.

Reuse

Reuses @langchain/langgraph-sdk TypeScript types as the wire contract rather than redefining them. Graphs run through @langchain/langgraph (CompiledStateGraph.invoke/.stream, interrupts/resume) in @skein-js/agent-protocol — never a reimplemented runtime.

Learn more

License

Apache-2.0