@skein-js/config
v0.5.0
Published
langgraph.json parser and graph loader (path:export) for skein-js.
Maintainers
Readme
@skein-js/config
Loads an unchanged
langgraph.json, validates it, and resolves eachpath:exportgraph, its schemas, and the optional custom-auth module.
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: langgraph.json loading, path:export graph resolution, graph-schema introspection, env resolution, and custom-auth loading.
What it does
loadConfig() reads an existing langgraph.json unchanged, validates it (Zod, unknown keys
preserved), and returns the parsed config plus a lazy graph registry — the boot-time entry point the
CLI, the runtime assembler, and the adapters all start from.
graphs.load(id)resolves a"./path:export"entry to a runnable graph. It mirrors the LangGraph CLI'sresolveGraphexactly — splits on the first colon, falls back to thedefaultexport, compiles an uncompiled graph builder, unwraps thecreateAgentwrapper, and returns a factory export un-invoked so per-run config still applies — so a project moves onto skein-js with no code change. Loads are cached; a failed load is not memoized, so a transient error can be retried.graphs.schemas(id)extracts the graph's input/output/state/config JSON schemas via static analysis (no module execution), for assistant introspection.resolveEnv()resolves the config'senv(a.envpath or an inline map) to a plain object — without touchingprocess.env.loadAuthEngine()loads the optionalauthblock'spath:exportmodule (a LangGraph@langchain/langgraph-sdk/authAuthinstance) and adapts it to core's injectableAuthEngine.- The parsed
env/store/checkpointer/http/authfields are exposed onconfigfor the CLI and adapters to wire up.
Install
pnpm add @skein-js/configPeer dependencies: @langchain/langgraph and @langchain/langgraph-sdk.
Usage
import { loadConfig, loadAuthEngine } from "@skein-js/config";
const { config, configDir, graphs } = await loadConfig({ configPath: "./langgraph.json" });
const graph = await graphs.load("agent"); // a CompiledGraph or a per-config factory
const schemas = await graphs.schemas("agent"); // input/output/state/config JSON schemas
const auth = await loadAuthEngine(config.auth, { configDir }); // AuthEngine | undefinedTo load TypeScript graphs (e.g. under skein dev), pass an importModule — a TS-capable importer
(the CLI injects a vite loader); it defaults to native dynamic import().
API
loadConfig(options?): Promise<SkeinConfig>—options:{ cwd?, configPath?, importModule? }. Returns{ config: LanggraphJson, configPath, configDir, graphs: GraphRegistry }.GraphRegistry—{ ids, spec(id), load(id), schemas(id) }.parseLanggraphJson(raw): LanggraphJson+langgraphJsonSchema— validate/parse the config (passthrough: unknown keys preserved). Validated fields includegraphs,node_version,env,store.index,checkpointer,http,auth,dockerfile_lines,dependencies.parseGraphSpec(spec, baseDir)/loadGraph(spec, importModule?)— the low-levelpath:exportresolver (GraphSpec,ResolvedGraph,CompiledGraphFactory,ModuleImporter).parseEnvFile(text)/resolveEnv(config, configDir)—.envparsing + env resolution.loadAuthEngine(auth, { configDir, importModule? })—AuthConfig→AuthEngine | undefined.class SkeinConfigError— boot-time config error (distinct from core's edgeSkeinHttpError).
Reuse
Reuses @langchain/langgraph-api's ./schema parser (getStaticGraphSchema, GraphSpec,
isAuthMatching) for introspection and auth-filter semantics, and mirrors its (non-exported)
resolveGraph algorithm for path:export loading — rather than diverging from the CLI it replaces.
