@skein-js/redis 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 +47 -18
  2. 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
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
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
- a run can be redelivered, delivery is **at-least-once** β€” the run worker makes this safe by
17
- skipping any run already terminal in the store.
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("redis://localhost:6379");
26
- const bus = new RedisRunEventBus("redis://localhost:6379");
27
- // Injected into the agent-protocol runtime as `deps.queue` / `deps.bus`.
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
- ## Reuse
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
- This package is the run **queue + pub/sub** β€” the piece LangGraph OSS does not provide. For
33
- Redis-backed _checkpointing_ (a different concern), use `@langchain/langgraph-checkpoint-redis`.
53
+ ## API
34
54
 
35
- ## Install
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
- ```bash
38
- pnpm add @skein-js/redis
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
- - [skein-js overview](../../docs/index.md)
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)
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.0",
3
+ "version": "0.2.0",
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.0"
46
+ "@skein-js/core": "0.2.0"
46
47
  },
47
48
  "devDependencies": {
48
- "@skein-js/test-support": "0.0.0"
49
+ "@skein-js/test-support": "0.2.0"
49
50
  },
50
51
  "publishConfig": {
51
52
  "access": "public"