@skein-js/config 0.1.0 โ 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -19
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,45 +1,79 @@
|
|
|
1
1
|
# @skein-js/config
|
|
2
2
|
|
|
3
|
-
> langgraph.json
|
|
3
|
+
> Loads an unchanged `langgraph.json`, validates it, and resolves each `path:export` graph, its schemas, and the optional custom-auth module.
|
|
4
4
|
|
|
5
5
|
Part of **[skein-js](https://github.com/mainawycliffe/skein)** โ a TypeScript [Agent Protocol](https://github.com/langchain-ai/agent-protocol) server for [LangGraph.js](https://github.com/langchain-ai/langgraphjs), and a drop-in replacement for the LangGraph CLI.
|
|
6
6
|
|
|
7
|
-
**Status:** ๐ง Pre-alpha โ implemented: `langgraph.json` loading
|
|
7
|
+
**Status:** ๐ง Pre-alpha โ implemented: `langgraph.json` loading, `path:export` graph resolution, graph-schema introspection, env resolution, and custom-auth loading.
|
|
8
8
|
|
|
9
9
|
## What it does
|
|
10
10
|
|
|
11
|
-
`loadConfig()` reads an existing `langgraph.json` **unchanged**, validates it (Zod, unknown keys
|
|
11
|
+
`loadConfig()` reads an existing `langgraph.json` **unchanged**, validates it (Zod, unknown keys
|
|
12
|
+
preserved), and returns the parsed config plus a lazy graph registry โ the boot-time entry point the
|
|
13
|
+
CLI, the runtime assembler, and the adapters all start from.
|
|
14
|
+
|
|
15
|
+
- **`graphs.load(id)`** resolves a `"./path:export"` entry to a runnable graph. It mirrors the
|
|
16
|
+
LangGraph CLI's `resolveGraph` exactly โ splits on the first colon, falls back to the `default`
|
|
17
|
+
export, compiles an uncompiled graph builder, unwraps the `createAgent` wrapper, and returns a
|
|
18
|
+
factory export **un-invoked** so per-run config still applies โ so a project moves onto skein-js
|
|
19
|
+
with **no code change**. Loads are cached; a failed load is not memoized, so a transient error can
|
|
20
|
+
be retried.
|
|
21
|
+
- **`graphs.schemas(id)`** extracts the graph's input/output/state/config JSON schemas via static
|
|
22
|
+
analysis (no module execution), for assistant introspection.
|
|
23
|
+
- **`resolveEnv()`** resolves the config's `env` (a `.env` path or an inline map) to a plain object โ
|
|
24
|
+
without touching `process.env`.
|
|
25
|
+
- **`loadAuthEngine()`** loads the optional `auth` block's `path:export` module (a LangGraph
|
|
26
|
+
`@langchain/langgraph-sdk/auth` `Auth` instance) and adapts it to core's injectable `AuthEngine`.
|
|
27
|
+
- The parsed `env` / `store` / `checkpointer` / `http` / `auth` fields are exposed on `config` for
|
|
28
|
+
the CLI and adapters to wire up.
|
|
12
29
|
|
|
13
|
-
|
|
14
|
-
- **`graphs.schemas(id)`** extracts the graph's input/output/state/config JSON schemas (for assistant introspection).
|
|
15
|
-
- The parsed `env` / `store` / `checkpointer` / `http` fields are exposed on `config` for the CLI and adapters to wire up.
|
|
30
|
+
## Install
|
|
16
31
|
|
|
17
|
-
|
|
32
|
+
```bash
|
|
33
|
+
pnpm add @skein-js/config
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Peer dependencies: `@langchain/langgraph` and `@langchain/langgraph-sdk`.
|
|
18
37
|
|
|
19
38
|
## Usage
|
|
20
39
|
|
|
21
40
|
```ts
|
|
22
|
-
import { loadConfig } from "@skein-js/config";
|
|
41
|
+
import { loadConfig, loadAuthEngine } from "@skein-js/config";
|
|
42
|
+
|
|
43
|
+
const { config, configDir, graphs } = await loadConfig({ cwd: projectDir });
|
|
23
44
|
|
|
24
|
-
const
|
|
25
|
-
const
|
|
45
|
+
const graph = await graphs.load("agent"); // a CompiledGraph or a per-config factory
|
|
46
|
+
const schemas = await graphs.schemas("agent"); // input/output/state/config JSON schemas
|
|
47
|
+
const auth = await loadAuthEngine(config.auth, { configDir }); // AuthEngine | undefined
|
|
26
48
|
```
|
|
27
49
|
|
|
28
|
-
|
|
50
|
+
To load TypeScript graphs (e.g. under `skein dev`), pass an `importModule` โ a TS-capable importer
|
|
51
|
+
(the CLI injects a vite loader); it defaults to native dynamic `import()`.
|
|
29
52
|
|
|
30
|
-
|
|
53
|
+
## API
|
|
31
54
|
|
|
32
|
-
|
|
55
|
+
- **`loadConfig(options?): Promise<SkeinConfig>`** โ `options`: `{ cwd?, configPath?, importModule? }`.
|
|
56
|
+
Returns `{ config: LanggraphJson, configPath, configDir, graphs: GraphRegistry }`.
|
|
57
|
+
- **`GraphRegistry`** โ `{ ids, spec(id), load(id), schemas(id) }`.
|
|
58
|
+
- **`parseLanggraphJson(raw): LanggraphJson`** + **`langgraphJsonSchema`** โ validate/parse the config
|
|
59
|
+
(passthrough: unknown keys preserved). Validated fields include `graphs`, `node_version`, `env`,
|
|
60
|
+
`store.index`, `checkpointer`, `http`, `auth`, `dockerfile_lines`, `dependencies`.
|
|
61
|
+
- **`parseGraphSpec(spec, baseDir)`** / **`loadGraph(spec, importModule?)`** โ the low-level
|
|
62
|
+
`path:export` resolver (`GraphSpec`, `ResolvedGraph`, `CompiledGraphFactory`, `ModuleImporter`).
|
|
63
|
+
- **`parseEnvFile(text)`** / **`resolveEnv(config, configDir)`** โ `.env` parsing + env resolution.
|
|
64
|
+
- **`loadAuthEngine(auth, { configDir, importModule? })`** โ `AuthConfig` โ `AuthEngine | undefined`.
|
|
65
|
+
- **`class SkeinConfigError`** โ boot-time config error (distinct from core's edge `SkeinHttpError`).
|
|
33
66
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
67
|
+
## Reuse
|
|
68
|
+
|
|
69
|
+
Reuses `@langchain/langgraph-api`'s `./schema` parser (`getStaticGraphSchema`, `GraphSpec`,
|
|
70
|
+
`isAuthMatching`) for introspection and auth-filter semantics, and mirrors its (non-exported)
|
|
71
|
+
`resolveGraph` algorithm for `path:export` loading โ rather than diverging from the CLI it replaces.
|
|
37
72
|
|
|
38
73
|
## Learn more
|
|
39
74
|
|
|
40
|
-
- [
|
|
41
|
-
- [Reuse-first architecture](../../docs/reuse.md)
|
|
42
|
-
- [Roadmap](../../docs/roadmap.md)
|
|
75
|
+
- [LangGraph CLI compatibility](../../docs/langgraph-cli-compat.md) ยท [Storage](../../docs/storage.md)
|
|
76
|
+
- [skein-js overview](../../docs/index.md) ยท [Reuse-first architecture](../../docs/reuse.md)
|
|
43
77
|
|
|
44
78
|
## License
|
|
45
79
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skein-js/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "langgraph.json parser and graph loader (path:export) for skein-js.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Maina Wycliffe <wmmaina7@gmail.com>",
|
|
7
|
-
"homepage": "https://github.com/mainawycliffe/skein/tree/main/packages/config#readme",
|
|
7
|
+
"homepage": "https://github.com/mainawycliffe/skein-js/tree/main/packages/config#readme",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/mainawycliffe/skein.git",
|
|
10
|
+
"url": "git+https://github.com/mainawycliffe/skein-js.git",
|
|
11
11
|
"directory": "packages/config"
|
|
12
12
|
},
|
|
13
13
|
"bugs": {
|
|
14
|
-
"url": "https://github.com/mainawycliffe/skein/issues"
|
|
14
|
+
"url": "https://github.com/mainawycliffe/skein-js/issues"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
|
+
"typescript",
|
|
17
18
|
"langgraph",
|
|
18
19
|
"langgraph.json",
|
|
19
20
|
"config",
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"@langchain/langgraph-api": "^1.4.0",
|
|
43
44
|
"zod": "^3.25.76",
|
|
44
|
-
"@skein-js/core": "0.
|
|
45
|
+
"@skein-js/core": "0.2.0"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"@langchain/langgraph": "^1.4.0",
|