Skip to content

Commit a3675e2

Browse files
fix(examples): fix tsconfig, port validation, and README lint
- Change module from ESNext to NodeNext in tsconfig - Add VALKEY_PORT validation (integer, 1-65535 range) - Add text language identifier to fenced code block (MD040) Signed-off-by: Riley Des <riley.desserre@improving.com>
1 parent c68b0e1 commit a3675e2

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

examples/with-valkey-store/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ This example demonstrates how to use **Valkey** as a distributed backing store f
4747

4848
## Structure
4949

50-
```
50+
```text
5151
examples/with-valkey-store
5252
├── src/
5353
│ ├── agents/assistant.ts # Example agent definition

examples/with-valkey-store/src/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@ const logger = createPinoLogger({
1515
});
1616

1717
const host = process.env.VALKEY_HOST ?? "localhost";
18-
const port = Number(process.env.VALKEY_PORT ?? 6379);
18+
const rawPort = process.env.VALKEY_PORT;
19+
const port = rawPort !== undefined ? Number(rawPort) : 6379;
20+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
21+
throw new Error(`Invalid VALKEY_PORT "${rawPort}": must be an integer between 1 and 65535`);
22+
}
1923

24+
/**
25+
* Bootstraps a VoltAgent instance backed by Valkey for both A2A task
26+
* persistence and resumable streaming. Connects to the Valkey server
27+
* specified by `VALKEY_HOST` / `VALKEY_PORT` environment variables
28+
* (defaulting to `localhost:6379`), then starts an HTTP server on port 3141.
29+
*/
2030
async function main() {
2131
const valkeyClient = await GlideClient.createClient({
2232
addresses: [{ host, port }],

examples/with-valkey-store/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compilerOptions": {
44
"rootDir": "src",
55
"outDir": "dist",
6-
"module": "ESNext",
6+
"module": "NodeNext",
77
"moduleResolution": "NodeNext",
88
"target": "ES2022",
99
"types": ["node"],

0 commit comments

Comments
 (0)