@kb-labs/core-state-daemon 1.2.0 → 1.4.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 +29 -3
- package/dist/bin.cjs +91590 -266
- package/dist/bin.cjs.map +1 -1
- package/dist/index.d.ts +26 -0
- package/dist/index.js +248 -139
- package/dist/index.js.map +1 -1
- package/package.json +12 -7
package/README.md
CHANGED
|
@@ -8,12 +8,12 @@ State Daemon provides a lightweight HTTP server that maintains persistent state
|
|
|
8
8
|
|
|
9
9
|
### Features
|
|
10
10
|
|
|
11
|
-
- **
|
|
11
|
+
- **Fastify-based HTTP server**: Uniform service foundation across KB Labs
|
|
12
12
|
- **In-memory storage**: Fast key-value operations (~1ms)
|
|
13
13
|
- **Automatic TTL cleanup**: Background cleanup every 30s
|
|
14
14
|
- **HTTP REST API**: Simple GET/PUT/DELETE endpoints
|
|
15
15
|
- **Namespace isolation**: Per-plugin namespaces with statistics
|
|
16
|
-
- **
|
|
16
|
+
- **Observability contract**: `/health`, `/stats`, `/metrics`, `/observability/describe`, `/observability/health`
|
|
17
17
|
- **Graceful shutdown**: SIGTERM/SIGINT handling
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
@@ -58,7 +58,9 @@ await server.start();
|
|
|
58
58
|
console.log('State daemon running on localhost:7777');
|
|
59
59
|
|
|
60
60
|
// Graceful shutdown
|
|
61
|
-
process.on('SIGTERM', () =>
|
|
61
|
+
process.on('SIGTERM', () => {
|
|
62
|
+
void server.stop();
|
|
63
|
+
});
|
|
62
64
|
```
|
|
63
65
|
|
|
64
66
|
## HTTP API
|
|
@@ -106,6 +108,30 @@ GET /stats
|
|
|
106
108
|
|
|
107
109
|
**Response:** Same as health stats.
|
|
108
110
|
|
|
111
|
+
### Metrics Snapshot
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
GET /metrics
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Prometheus-compatible snapshot with canonical process and service metric families.
|
|
118
|
+
|
|
119
|
+
### Observability Describe
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
GET /observability/describe
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Returns the versioned KB Labs observability contract descriptor for the service.
|
|
126
|
+
|
|
127
|
+
### Observability Health
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
GET /observability/health
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Returns structured runtime diagnostics including checks, resource snapshot, top operations, and service state.
|
|
134
|
+
|
|
109
135
|
### Get Value
|
|
110
136
|
|
|
111
137
|
```bash
|