@memstack/server 0.6.4 → 0.7.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 +33 -5
  2. package/package.json +13 -6
package/README.md CHANGED
@@ -1,23 +1,32 @@
1
1
  # @memstack/server
2
2
 
3
- REST API server for MemStack — self-hostable agent memory. Run anywhere Bun runs.
3
+ REST API server for MemStack — self-hostable agent memory. Runs on Node.js 18+ or Bun.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
8
  npm install @memstack/server
9
9
  # or via Docker:
10
- docker pull ghcr.io/isiomac/memstack-server:v0.5.0
10
+ docker pull ghcr.io/isiomac/memstack-server:0.6.4
11
11
  ```
12
12
 
13
13
  ## Quick Start
14
14
 
15
15
  ```bash
16
+ # Node.js
17
+ npx @memstack/server
18
+ # or, if installed as a dependency:
19
+ node node_modules/@memstack/server/dist/serve.js
20
+
21
+ # Bun
16
22
  bun run node_modules/@memstack/server/dist/index.js
17
- # or via Docker:
18
- docker run -p 3000:3000 -e MEMSTACK_STORAGE=memory -e OPENAI_API_KEY=sk-... ghcr.io/isiomac/memstack-server:v0.5.0
23
+
24
+ # Docker
25
+ docker run -p 3000:3000 -e MEMSTACK_STORAGE=memory -e OPENAI_API_KEY=sk-... ghcr.io/isiomac/memstack-server:0.6.4
19
26
  ```
20
27
 
28
+ Under Node, `dist/serve.js` starts the server explicitly via [`@hono/node-server`](https://github.com/honojs/node-server). Under Bun, `dist/index.js`'s default export (`{ port, fetch }`) is auto-started by the Bun runtime — no extra wiring needed. Both entry points serve the same Hono app, so behavior is identical either way.
29
+
21
30
  ## Configuration
22
31
 
23
32
  All via environment variables.
@@ -62,6 +71,25 @@ All via environment variables.
62
71
  | `POST` | `/v1/prune/dry-run` | Preview prune |
63
72
  | `GET` | `/v1/stats/:actorId` | Memory diagnostics |
64
73
  | `GET` | `/health` | Health check |
74
+ | `GET` | `/openapi.json` | OpenAPI 3.1 spec, generated from the request-validation schemas below |
75
+
76
+ ## Request validation
77
+
78
+ Every `POST` body is validated against a [zod](https://zod.dev) schema before it reaches MemStack. Invalid requests get a `400` with details instead of a generic `500`:
79
+
80
+ ```bash
81
+ curl -X POST http://localhost:3000/v1/memories \
82
+ -H "Content-Type: application/json" \
83
+ -d '{"actorId":"agent-1","importance":5}'
84
+ # 400 { "error": "Validation failed", "issues": [
85
+ # { "path": ["content"], "message": "Required" },
86
+ # { "path": ["importance"], "message": "Number must be less than or equal to 1" }
87
+ # ]}
88
+ ```
89
+
90
+ `GET /openapi.json` serves the generated OpenAPI 3.1 document — paste it into [Swagger UI](https://swagger.io/tools/swagger-ui/), [Redoc](https://redocly.com/redoc), or Postman, or run it through an OpenAPI code generator to get a typed client in any language. The request-body schemas in the spec come from the same zod schemas that validate incoming requests, so they can't drift apart.
91
+
92
+ Note: `POST /v1/prune` and `/v1/prune/dry-run` support every `PruneStrategy` type except `"custom"` — a custom prune strategy is a JavaScript predicate function, which can't be expressed in JSON. Use the `@memstack/core` library directly for custom prune logic.
65
93
 
66
94
  ## Usage Examples
67
95
 
@@ -95,7 +123,7 @@ docker run -p 3000:3000 \
95
123
  -e MEMSTACK_STORAGE=postgres \
96
124
  -e DATABASE_URL=postgresql://... \
97
125
  -e OPENAI_API_KEY=sk-... \
98
- ghcr.io/isiomac/memstack-server:v0.5.0
126
+ ghcr.io/isiomac/memstack-server:0.6.4
99
127
  ```
100
128
 
101
129
  ## License
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@memstack/server",
3
- "version": "0.6.4",
3
+ "version": "0.7.0",
4
4
  "description": "REST API server for MemStack — self-hostable agent memory",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
+ "bin": {
8
+ "memstack-server": "dist/serve.js"
9
+ },
7
10
  "exports": {
8
11
  ".": {
9
12
  "types": "./dist/index.d.ts",
@@ -26,14 +29,18 @@
26
29
  },
27
30
  "homepage": "https://github.com/isiomaC/memstack",
28
31
  "dependencies": {
32
+ "@hono/node-server": "^1.13.0",
29
33
  "hono": "^4.0.0",
30
- "@memstack/core": "0.6.4"
34
+ "zod": "^3.23.8",
35
+ "zod-to-json-schema": "^3.25.2",
36
+ "@memstack/config-env": "0.7.0",
37
+ "@memstack/core": "0.7.0"
31
38
  },
32
39
  "devDependencies": {
40
+ "@types/node": "^22.0.0",
33
41
  "tsup": "^8.0.0",
34
42
  "typescript": "^5.7.0",
35
- "vitest": "^1.0.0",
36
- "@types/node": "^22.0.0"
43
+ "vitest": "^1.0.0"
37
44
  },
38
45
  "keywords": [
39
46
  "api",
@@ -44,8 +51,8 @@
44
51
  ],
45
52
  "license": "MIT",
46
53
  "scripts": {
47
- "build": "tsup src/index.ts --format esm --clean",
48
- "dev": "tsup src/index.ts --format esm --watch",
54
+ "build": "tsup src/index.ts src/serve.ts --format esm --dts --clean",
55
+ "dev": "tsup src/index.ts src/serve.ts --format esm --dts --watch",
49
56
  "check": "tsc --noEmit",
50
57
  "test": "vitest run"
51
58
  }