@chat-adapter/state-ioredis 4.29.0 → 4.31.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 +38 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -1
- package/package.json +15 -5
package/README.md
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
# @chat-adapter/state-ioredis
|
|
2
2
|
|
|
3
|
+
> npm package: [`@chat-adapter/state-ioredis`](https://www.npmjs.com/package/@chat-adapter/state-ioredis)
|
|
4
|
+
|
|
3
5
|
[](https://www.npmjs.com/package/@chat-adapter/state-ioredis)
|
|
4
6
|
[](https://www.npmjs.com/package/@chat-adapter/state-ioredis)
|
|
5
7
|
|
|
6
8
|
Alternative Redis state adapter for [Chat SDK](https://chat-sdk.dev) using [ioredis](https://www.npmjs.com/package/ioredis). Use this if you already have ioredis in your project or need Redis Cluster/Sentinel support.
|
|
7
9
|
|
|
10
|
+
Documentation: [chat-sdk.dev/adapters/official/ioredis](https://chat-sdk.dev/adapters/official/ioredis) · Guides: [vercel.com/kb/chat-sdk](https://vercel.com/kb/chat-sdk)
|
|
11
|
+
|
|
8
12
|
## Installation
|
|
9
13
|
|
|
10
14
|
```bash
|
|
11
15
|
pnpm add @chat-adapter/state-ioredis
|
|
12
16
|
```
|
|
13
17
|
|
|
18
|
+
## Scaffold with the CLI
|
|
19
|
+
|
|
20
|
+
To scaffold a new Slack bot that uses ioredis for state:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx create-chat-sdk@latest my-bot --adapter slack ioredis
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Visit the [adapters directory](https://chat-sdk.dev/adapters) to see other available official and vendor-official adapters.
|
|
27
|
+
|
|
14
28
|
## Usage
|
|
15
29
|
|
|
16
30
|
```typescript
|
|
17
31
|
import { Chat } from "chat";
|
|
18
|
-
import {
|
|
32
|
+
import { createIoRedisState } from "@chat-adapter/state-ioredis";
|
|
19
33
|
|
|
20
34
|
const bot = new Chat({
|
|
21
35
|
userName: "mybot",
|
|
22
36
|
adapters: { /* ... */ },
|
|
23
|
-
state:
|
|
37
|
+
state: createIoRedisState({
|
|
24
38
|
url: process.env.REDIS_URL!,
|
|
25
39
|
}),
|
|
26
40
|
});
|
|
@@ -33,7 +47,7 @@ import Redis from "ioredis";
|
|
|
33
47
|
|
|
34
48
|
const client = new Redis("redis://localhost:6379");
|
|
35
49
|
|
|
36
|
-
const state =
|
|
50
|
+
const state = createIoRedisState({ client });
|
|
37
51
|
```
|
|
38
52
|
|
|
39
53
|
## Configuration
|
|
@@ -43,6 +57,7 @@ const state = createIORedisState({ client });
|
|
|
43
57
|
| `url` | Yes* | Redis connection URL |
|
|
44
58
|
| `client` | No | Existing `ioredis` client instance |
|
|
45
59
|
| `keyPrefix` | No | Prefix for all keys (default: `"chat-sdk"`) |
|
|
60
|
+
| `logger` | No | Logger for error reporting (default: console logger) |
|
|
46
61
|
|
|
47
62
|
*Either `url` or `client` is required.
|
|
48
63
|
|
|
@@ -82,6 +97,26 @@ const state = createIORedisState({ client });
|
|
|
82
97
|
| Redis Sentinel support | Yes |
|
|
83
98
|
| Key prefix namespacing | Yes |
|
|
84
99
|
|
|
100
|
+
## AI Coding Agents
|
|
101
|
+
|
|
102
|
+
If you use an AI coding agent such as OpenAI Codex, Claude Code, or Cursor, install the Chat SDK skill so it knows the SDK APIs, adapter patterns, and project conventions before writing code.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx skills add vercel/chat
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The skill references bundled documentation in `node_modules/chat/docs`, plus adapter guides and starter templates in the published package.
|
|
109
|
+
|
|
110
|
+
You can also install the [Vercel Plugin](https://vercel.com/docs/agent-resources/vercel-plugin) for a broader agent toolkit — it includes the Chat SDK skill alongside specialist agents, agent slash commands, and more:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx plugins add vercel/vercel-plugin
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The plugin is optional; the skill alone is enough to build with Chat SDK.
|
|
117
|
+
|
|
118
|
+
For agent-readable documentation, see [chat-sdk.dev/llms.txt](https://chat-sdk.dev/llms.txt) (page index) or [chat-sdk.dev/llms-full.txt](https://chat-sdk.dev/llms-full.txt) (full text).
|
|
119
|
+
|
|
85
120
|
## License
|
|
86
121
|
|
|
87
122
|
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StateAdapter, Logger, Lock, QueueEntry } from 'chat';
|
|
2
2
|
import Redis from 'ioredis';
|
|
3
3
|
|
|
4
4
|
interface IoRedisStateAdapterUrlOptions {
|
|
5
5
|
/** Key prefix for all Redis keys (default: "chat-sdk") */
|
|
6
6
|
keyPrefix?: string;
|
|
7
|
-
/** Logger instance for error reporting */
|
|
8
|
-
logger
|
|
7
|
+
/** Logger instance for error reporting (default: console logger) */
|
|
8
|
+
logger?: Logger;
|
|
9
9
|
/** Redis connection URL (e.g., redis://localhost:6379) */
|
|
10
10
|
url: string;
|
|
11
11
|
}
|
|
@@ -14,8 +14,8 @@ interface IoRedisStateAdapterClientOptions {
|
|
|
14
14
|
client: Redis;
|
|
15
15
|
/** Key prefix for all Redis keys (default: "chat-sdk") */
|
|
16
16
|
keyPrefix?: string;
|
|
17
|
-
/** Logger instance for error reporting */
|
|
18
|
-
logger
|
|
17
|
+
/** Logger instance for error reporting (default: console logger) */
|
|
18
|
+
logger?: Logger;
|
|
19
19
|
}
|
|
20
20
|
type IoRedisStateAdapterOptions = IoRedisStateAdapterUrlOptions | IoRedisStateAdapterClientOptions;
|
|
21
21
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
import { ConsoleLogger } from "chat";
|
|
2
3
|
import Redis from "ioredis";
|
|
3
4
|
var IoRedisStateAdapter = class {
|
|
4
5
|
client;
|
|
@@ -16,7 +17,7 @@ var IoRedisStateAdapter = class {
|
|
|
16
17
|
this.ownsClient = true;
|
|
17
18
|
}
|
|
18
19
|
this.keyPrefix = options.keyPrefix || "chat-sdk";
|
|
19
|
-
this.logger = options.logger;
|
|
20
|
+
this.logger = options.logger ?? new ConsoleLogger("info").child("ioredis");
|
|
20
21
|
this.client.on("error", (err) => {
|
|
21
22
|
this.logger.error("ioredis client error", { error: err });
|
|
22
23
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chat-adapter/state-ioredis",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "ioredis state adapter for
|
|
3
|
+
"version": "4.31.0",
|
|
4
|
+
"description": "ioredis state adapter for Chat SDK — production state with Redis Cluster and Sentinel support via ioredis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20"
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"ioredis": "^5.4.1",
|
|
23
|
-
"chat": "4.
|
|
23
|
+
"chat": "4.31.0"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
27
|
"url": "git+https://github.com/vercel/chat.git",
|
|
28
28
|
"directory": "packages/state-ioredis"
|
|
29
29
|
},
|
|
30
|
-
"homepage": "https://
|
|
30
|
+
"homepage": "https://chat-sdk.dev/adapters/official/ioredis",
|
|
31
31
|
"bugs": {
|
|
32
32
|
"url": "https://github.com/vercel/chat/issues"
|
|
33
33
|
},
|
|
@@ -42,10 +42,20 @@
|
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"chat",
|
|
45
|
+
"chat-sdk",
|
|
45
46
|
"state",
|
|
47
|
+
"state-adapter",
|
|
46
48
|
"ioredis",
|
|
47
49
|
"redis",
|
|
48
|
-
"
|
|
50
|
+
"redis-cluster",
|
|
51
|
+
"sentinel",
|
|
52
|
+
"subscriptions",
|
|
53
|
+
"distributed-lock",
|
|
54
|
+
"cache",
|
|
55
|
+
"queues",
|
|
56
|
+
"production",
|
|
57
|
+
"typescript",
|
|
58
|
+
"vercel"
|
|
49
59
|
],
|
|
50
60
|
"license": "MIT",
|
|
51
61
|
"scripts": {
|