@skein-js/redis 0.1.0 → 0.2.1
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 +48 -19
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,48 +1,77 @@
|
|
|
1
1
|
# @skein-js/redis
|
|
2
2
|
|
|
3
|
-
> Redis job queue and cross-instance pub/sub streaming for skein-js.
|
|
3
|
+
> Redis job queue (BullMQ) and cross-instance pub/sub streaming for skein-js.
|
|
4
4
|
|
|
5
|
-
Part of **[skein-js](
|
|
5
|
+
Part of **[skein-js](../../README.md)** — 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
7
|
**Status:** 🚧 Pre-alpha — implemented (BullMQ queue + Redis Streams/pub-sub bus); integration tests need Docker.
|
|
8
8
|
|
|
9
|
+
> **Directory vs. name.** This package publishes as **`@skein-js/redis`** but lives on disk at
|
|
10
|
+
> `packages/runtime-redis`.
|
|
11
|
+
|
|
9
12
|
## What it does
|
|
10
13
|
|
|
11
|
-
Two `@skein-js/core` drivers for horizontal scaling
|
|
14
|
+
Two [`@skein-js/core`](../core) drivers for **horizontal scaling** — the piece LangGraph OSS does not
|
|
15
|
+
provide:
|
|
12
16
|
|
|
13
17
|
- **`RedisRunQueue`** — a durable background-run job queue on **[BullMQ](https://docs.bullmq.io)**.
|
|
14
18
|
Multiple worker instances share one queue; BullMQ provides retries, backoff, concurrency, and
|
|
15
|
-
lease-based crash recovery (a stalled job whose worker died is moved back to the queue). Because
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
lease-based crash recovery (a stalled job whose worker died is moved back to the queue). Because a
|
|
20
|
+
run can be redelivered, delivery is **at-least-once** — the run worker makes this safe by skipping
|
|
21
|
+
any run already terminal in the store.
|
|
18
22
|
- **`RedisRunEventBus`** — cross-instance SSE fan-out. Each run's frames go to a Redis Stream
|
|
19
23
|
(durable replay for late joiners / reconnects via `afterSeq`) **and** a pub/sub channel (live
|
|
20
24
|
tail), so a client connected to instance B can join a run executing on instance A.
|
|
21
25
|
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @skein-js/redis
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`ioredis` and `bullmq` are **bundled dependencies** — you do not install them separately. No peer
|
|
33
|
+
dependencies. Needs a reachable Redis; the URL is passed to each constructor.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
Construct with a Redis URL — there is no migration step:
|
|
38
|
+
|
|
22
39
|
```ts
|
|
23
40
|
import { RedisRunQueue, RedisRunEventBus } from "@skein-js/redis";
|
|
24
41
|
|
|
25
|
-
const queue = new RedisRunQueue(
|
|
26
|
-
const bus = new RedisRunEventBus(
|
|
27
|
-
// Injected into the
|
|
42
|
+
const queue = new RedisRunQueue(process.env.REDIS_URL!);
|
|
43
|
+
const bus = new RedisRunEventBus(process.env.REDIS_URL!);
|
|
44
|
+
// Injected into the engine as deps.queue / deps.bus.
|
|
45
|
+
// …on shutdown, release the connections:
|
|
46
|
+
await queue.dispose();
|
|
47
|
+
await bus.dispose();
|
|
28
48
|
```
|
|
29
49
|
|
|
30
|
-
|
|
50
|
+
You normally get these via `skein dev --queue redis` / `skein up` and
|
|
51
|
+
[`@skein-js/runtime`](../runtime), which reads `REDIS_URL` and constructs them for you.
|
|
31
52
|
|
|
32
|
-
|
|
33
|
-
Redis-backed _checkpointing_ (a different concern), use `@langchain/langgraph-checkpoint-redis`.
|
|
53
|
+
## API
|
|
34
54
|
|
|
35
|
-
|
|
55
|
+
- **`class RedisRunQueue implements RunQueue`** — `new RedisRunQueue(url, options?)`.
|
|
56
|
+
`enqueue(run)` · `consume(process, options?)` → `RunConsumer` · `dispose()`.
|
|
57
|
+
**`RedisRunQueueOptions`** = `{ queueName?, attempts? }` (`queueName` default `"skein-runs"`, must
|
|
58
|
+
not contain `:`; `attempts` default `1`).
|
|
59
|
+
- **`class RedisRunEventBus implements RunEventBus`** — `new RedisRunEventBus(url, options?)`.
|
|
60
|
+
`publish(runId, frame)` · `close(runId)` · `subscribe(runId, afterSeq = 0)` · `dispose()`.
|
|
61
|
+
**`RedisRunEventBusOptions`** = `{ keyPrefix?, streamTtlSeconds?, closedMarkerTtlSeconds?, closedCheckIntervalMs? }`
|
|
62
|
+
(defaults `"skein"`, `3600`, `86400`, `1000`).
|
|
36
63
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
64
|
+
> `close(runId)` ends one run's stream; `dispose()` tears down the whole driver's connections.
|
|
65
|
+
|
|
66
|
+
## Reuse
|
|
67
|
+
|
|
68
|
+
This package is the run **queue + pub/sub** — not a checkpointer. For Redis-backed _checkpointing_
|
|
69
|
+
(a different concern), use `@langchain/langgraph-checkpoint-redis`.
|
|
40
70
|
|
|
41
71
|
## Learn more
|
|
42
72
|
|
|
43
|
-
- [
|
|
44
|
-
- [Reuse-first architecture](../../docs/reuse.md)
|
|
45
|
-
- [Roadmap](../../docs/roadmap.md)
|
|
73
|
+
- [Runs & Redis](../../docs/runs-and-redis.md) · [Streaming (SSE)](../../docs/streaming.md)
|
|
74
|
+
- [skein-js overview](../../docs/index.md) · [Reuse-first architecture](../../docs/reuse.md) · [Root README](../../README.md)
|
|
46
75
|
|
|
47
76
|
## License
|
|
48
77
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skein-js/redis",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Redis job queue and cross-instance pub/sub streaming 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/runtime-redis#readme",
|
|
7
|
+
"homepage": "https://github.com/mainawycliffe/skein-js/tree/main/packages/runtime-redis#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-redis"
|
|
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
|
"redis",
|
|
@@ -42,10 +43,10 @@
|
|
|
42
43
|
"dependencies": {
|
|
43
44
|
"ioredis": ">=5.4.0",
|
|
44
45
|
"bullmq": ">=5.0.0",
|
|
45
|
-
"@skein-js/core": "0.1
|
|
46
|
+
"@skein-js/core": "0.2.1"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@skein-js/test-support": "0.
|
|
49
|
+
"@skein-js/test-support": "0.2.1"
|
|
49
50
|
},
|
|
50
51
|
"publishConfig": {
|
|
51
52
|
"access": "public"
|