@skein-js/runtime 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.
Files changed (2) hide show
  1. package/README.md +66 -14
  2. package/package.json +12 -11
package/README.md CHANGED
@@ -1,12 +1,22 @@
1
1
  # @skein-js/runtime
2
2
 
3
- Assembles a skein-js [`ProtocolDeps`](../agent-protocol/src/deps.ts) from a `langgraph.json`
4
- plus a chosen set of drivers, and hands it to any framework adapter through the injectable
5
- `{ deps }` seam. This is the piece that lets `skein dev` and `skein up` run the **same** engine
6
- against either the zero-setup in-memory drivers or production-shaped Postgres + Redis.
3
+ > Assembles a production `ProtocolDeps` (memory / Postgres / Redis) from a `langgraph.json`.
4
+
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
+
7
+ **Status:** 🚧 Pre-alpha β€” implemented; the assembler behind `skein dev` and `skein up`.
8
+
9
+ ## What it does
10
+
11
+ `buildRuntime()` assembles a [`ProtocolDeps`](../agent-protocol) from a `langgraph.json` plus a chosen
12
+ store/queue driver, and hands it to any framework adapter through the injectable `{ deps }` seam.
13
+ This is the one place a production driver combination is selected β€” so `skein dev` and `skein up` run
14
+ the **same** engine against either the zero-setup in-memory drivers or production-shaped
15
+ Postgres + Redis. The engine itself stays driver-agnostic.
7
16
 
8
17
  ```ts
9
18
  import { buildRuntime } from "@skein-js/runtime";
19
+ import { createExpressServer } from "@skein-js/express";
10
20
 
11
21
  const runtime = await buildRuntime({
12
22
  configPath: "/abs/path/to/langgraph.json",
@@ -15,18 +25,51 @@ const runtime = await buildRuntime({
15
25
  });
16
26
 
17
27
  const server = await createExpressServer({ deps: runtime.deps, cors: runtime.cors });
18
- // ... on shutdown:
28
+ await server.listen(2024);
29
+ // …on shutdown:
19
30
  await runtime.dispose();
20
31
  ```
21
32
 
22
- - **`store: "postgres"`** connects `PostgresSkeinStore` (from `DATABASE_URL`), runs its
23
- migrations, and uses `PostgresSaver` as the LangGraph checkpointer.
24
- - **`queue: "redis"`** uses the BullMQ run queue + Redis Streams/pub-sub event bus (`REDIS_URL`).
25
- - **`store: "memory"` + `queue: "memory"`** delegates to `@skein-js/express`'s reloadable
26
- in-memory runtime, so `skein dev`'s hot-reload and cross-restart state persistence still work.
33
+ `store` and `queue` are **required** (no defaults β€” the CLI supplies its own flag defaults). The
34
+ driver branches:
35
+
36
+ - **`store: "postgres"`** connects `PostgresSkeinStore` (from `DATABASE_URL`), runs its migrations,
37
+ and uses `PostgresSaver` as the LangGraph checkpointer.
38
+ - **`queue: "redis"`** uses the BullMQ run queue + Redis Streams/pub-sub event bus (from `REDIS_URL`).
39
+ - **`store: "memory"` + `queue: "memory"`** delegates to [`@skein-js/express`](../server-express)'s
40
+ reloadable in-memory runtime, so `skein dev`'s hot-reload and cross-restart state persistence work.
27
41
 
28
- Graph hot-reload (`reloadGraphs()`) works in every mode; `snapshotState`/`hydrateState` are
29
- present only in all-memory mode (durable stores keep their own state).
42
+ A missing `DATABASE_URL` / `REDIS_URL` throws `RuntimeConfigError`; if assembly fails part-way, any
43
+ resources already created are disposed before rethrowing, so a failed build leaks nothing.
44
+
45
+ Graph hot-reload (`reloadGraphs()`) works in every mode; `snapshotState`/`hydrateState` are present
46
+ **only** in all-memory mode (durable stores keep their own state).
47
+
48
+ > `createExpressServer` is imported from [`@skein-js/express`](../server-express), not from here.
49
+ > The shipped `examples/` call `createExpressServer({ config })` directly (the config-path form,
50
+ > which uses the in-memory runtime under the hood); `buildRuntime` is the path the CLI uses to add
51
+ > Postgres/Redis.
52
+
53
+ ## Install
54
+
55
+ ```bash
56
+ pnpm add @skein-js/runtime
57
+ ```
58
+
59
+ Peer dependencies: `@langchain/langgraph` and `@langchain/langgraph-checkpoint-postgres`. Loading
60
+ TypeScript graphs/embedders requires passing an `importModule` (the CLI injects a vite loader).
61
+
62
+ ## API
63
+
64
+ - **`buildRuntime(options): Promise<SkeinRuntime>`** β€” `options`:
65
+ `{ configPath, store, queue, importModule? }`.
66
+ - **`interface SkeinRuntime`** β€” `{ deps, cors?, reloadGraphs(), dispose(), snapshotState?(), hydrateState?() }`
67
+ (the last two only in all-memory mode).
68
+ - **`type StoreDriver`** = `"memory" | "postgres"` Β· **`type QueueDriver`** = `"memory" | "redis"`.
69
+ - **`class RuntimeConfigError`** β€” thrown when a driver's env var or `store.index.embed` can't be
70
+ resolved.
71
+ - **`resolveEmbed(embed, { configDir, importModule? })`** β€” resolves a `langgraph.json`
72
+ `store.index.embed` to an `EmbedFunction` (see below); exported for reuse/testing.
30
73
 
31
74
  ## Semantic search (`store.index.embed`)
32
75
 
@@ -42,5 +85,14 @@ LangGraph CLI documents:
42
85
  `(texts: string[]) => number[][]` (the shape LangGraph documents) or a LangChain `Embeddings`
43
86
  instance. Resolved through the same `path:export` loader used for graphs β€” no extra dependency.
44
87
 
45
- `store.index.dims` is required whenever `embed` is set. Without a `store.index`, Postgres search
46
- falls back to naive text matching (identical to the memory driver).
88
+ `store.index.dims` is required whenever `embed` is set. Without a `store.index`, Postgres search falls
89
+ back to naive text matching (identical to the memory driver).
90
+
91
+ ## Learn more
92
+
93
+ - [Storage](../../docs/storage.md) Β· [Runs & Redis](../../docs/runs-and-redis.md) Β· [LangGraph CLI compatibility](../../docs/langgraph-cli-compat.md)
94
+ - [skein-js overview](../../docs/index.md) Β· [Reuse-first architecture](../../docs/reuse.md)
95
+
96
+ ## License
97
+
98
+ [Apache-2.0](../../LICENSE)
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@skein-js/runtime",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Assembles skein-js ProtocolDeps from langgraph.json + selected drivers (memory/Postgres/Redis).",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Maina Wycliffe <wmmaina7@gmail.com>",
7
- "homepage": "https://github.com/mainawycliffe/skein/tree/main/packages/runtime#readme",
7
+ "homepage": "https://github.com/mainawycliffe/skein-js/tree/main/packages/runtime#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/runtime"
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
  "agent-protocol",
19
20
  "runtime",
@@ -41,12 +42,12 @@
41
42
  },
42
43
  "dependencies": {
43
44
  "cors": "^2.8.5",
44
- "@skein-js/agent-protocol": "0.1.0",
45
- "@skein-js/express": "0.1.0",
46
- "@skein-js/redis": "0.1.0",
47
- "@skein-js/storage-memory": "0.1.0",
48
- "@skein-js/storage-postgres": "0.1.0",
49
- "@skein-js/config": "0.1.0"
45
+ "@skein-js/agent-protocol": "0.2.0",
46
+ "@skein-js/config": "0.2.0",
47
+ "@skein-js/express": "0.2.0",
48
+ "@skein-js/redis": "0.2.0",
49
+ "@skein-js/storage-memory": "0.2.0",
50
+ "@skein-js/storage-postgres": "0.2.0"
50
51
  },
51
52
  "peerDependencies": {
52
53
  "@langchain/langgraph": "^1.4.0",
@@ -57,7 +58,7 @@
57
58
  "@langchain/langgraph": "^1.4.0",
58
59
  "@langchain/langgraph-checkpoint-postgres": "^1.0.4",
59
60
  "@types/cors": "^2.8.17",
60
- "@skein-js/test-support": "0.0.0"
61
+ "@skein-js/test-support": "0.2.0"
61
62
  },
62
63
  "publishConfig": {
63
64
  "access": "public"