@steadwing/openalerts 0.2.3 → 0.2.5

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 CHANGED
@@ -7,8 +7,10 @@
7
7
 
8
8
  <p align="center">
9
9
  <a href="https://www.npmjs.com/package/@steadwing/openalerts"><img src="https://img.shields.io/npm/v/@steadwing/openalerts?style=flat&color=blue" alt="npm"></a>
10
+ <a href="https://www.npmjs.com/package/@steadwing/openalerts"><img src="https://img.shields.io/npm/dt/@steadwing/openalerts?style=flat&color=blue" alt="npm"></a>
10
11
  <a href="https://github.com/steadwing/openalerts/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green" alt="License"></a>
11
12
  <a href="https://github.com/steadwing/openalerts/stargazers"><img src="https://img.shields.io/github/stars/steadwing/openalerts?style=flat" alt="GitHub stars"></a>
13
+ <a href="https://discord.gg/4rUP86tSXn"><img src="https://img.shields.io/badge/discord-join-5865F2?style=flat" alt="Discord"></a>
12
14
  </p>
13
15
 
14
16
  <p align="center">
@@ -28,6 +30,7 @@ OpenAlerts watches your agent in real-time and alerts you the moment something g
28
30
  ## Quickstart
29
31
 
30
32
  > Currently supports OpenClaw. More framework adapters coming soon.
33
+ > This project is under revamp for the next few hours
31
34
 
32
35
  ### 1. Install
33
36
 
@@ -43,17 +46,17 @@ Otherwise, set it explicitly in `openclaw.json`:
43
46
 
44
47
  ```jsonc
45
48
  {
46
- "plugins": {
47
- "entries": {
48
- "openalerts": {
49
- "enabled": true,
50
- "config": {
51
- "alertChannel": "telegram", // telegram | discord | slack | whatsapp | signal
52
- "alertTo": "YOUR_CHAT_ID"
53
- }
54
- }
55
- }
56
- }
49
+ "plugins": {
50
+ "entries": {
51
+ "openalerts": {
52
+ "enabled": true,
53
+ "config": {
54
+ "alertChannel": "telegram", // telegram | discord | slack | whatsapp | signal
55
+ "alertTo": "YOUR_CHAT_ID",
56
+ },
57
+ },
58
+ },
59
+ },
57
60
  }
58
61
  ```
59
62
 
@@ -65,11 +68,14 @@ Otherwise, set it explicitly in `openclaw.json`:
65
68
  openclaw gateway stop && openclaw gateway run
66
69
  ```
67
70
 
68
-
69
71
  Send `/health` to your bot. You should get a live status report back — zero LLM tokens consumed.
70
72
 
71
73
  That's it. OpenAlerts is now watching your agent.
72
74
 
75
+ ## Demo
76
+
77
+ https://github.com/user-attachments/assets/0b6ed26e-1eb0-47b2-ae4f-947516f024b4
78
+
73
79
  ## Dashboard
74
80
 
75
81
  A real-time web dashboard is embedded in the gateway at:
@@ -78,26 +84,30 @@ A real-time web dashboard is embedded in the gateway at:
78
84
  http://127.0.0.1:18789/openalerts
79
85
  ```
80
86
 
81
- - **Activity** — Live event timeline with session flows, tool calls, LLM usage
87
+ - **Activity** — Step-by-step execution timeline with tool calls, LLM usage, costs
88
+ - **Sessions** — Active sessions with cost/token aggregation
89
+ - **Execs** — Shell command executions with output capture
82
90
  - **System Logs** — Filtered, structured logs with search
83
91
  - **Health** — Rule status, alert history, system stats
92
+ - **Debug** — State snapshot for troubleshooting
84
93
 
85
94
  ## Alert Rules
86
95
 
87
- Eight rules run against every event in real-time. All thresholds and cooldowns are configurable.
96
+ Ten rules run against every event in real-time. All thresholds and cooldowns are configurable.
88
97
 
89
- | Rule | Watches for | Severity | Threshold (default) |
90
- |---|---|---|---|
91
- | `llm-errors` | LLM/agent failures in 1 min window | ERROR | `1` error |
92
- | `infra-errors` | Infrastructure errors in 1 min window | ERROR | `1` error |
93
- | `gateway-down` | No heartbeat received | CRITICAL | `30000` ms (30s) |
94
- | `session-stuck` | Session idle too long | WARN | `120000` ms (2 min) |
95
- | `high-error-rate` | Message failure rate over last 20 | ERROR | `50`% |
96
- | `queue-depth` | Queued items piling up | WARN | `10` items |
97
- | `tool-errors` | Tool failures in 1 min window | WARN | `1` error |
98
- | `heartbeat-fail` | Consecutive heartbeat failures | ERROR | `3` failures |
98
+ | Rule | Watches for | Severity | Threshold (default) |
99
+ | ----------------- | ------------------------------------- | -------- | ------------------- |
100
+ | `llm-errors` | LLM/agent failures in 1 min window | ERROR | `1` error |
101
+ | `infra-errors` | Infrastructure errors in 1 min window | ERROR | `1` error |
102
+ | `gateway-down` | No heartbeat received | CRITICAL | `30000` ms (30s) |
103
+ | `session-stuck` | Session idle too long | WARN | `120000` ms (2 min) |
104
+ | `high-error-rate` | Message failure rate over last 20 | ERROR | `50`% |
105
+ | `queue-depth` | Queued items piling up | WARN | `10` items |
106
+ | `tool-errors` | Tool failures in 1 min window | WARN | `1` error |
107
+ | `heartbeat-fail` | Consecutive heartbeat failures | ERROR | `3` failures |
99
108
 
100
109
  Every rule also accepts:
110
+
101
111
  - **`enabled`** — `false` to disable the rule (default: `true`)
102
112
  - **`cooldownMinutes`** — minutes before the same rule can fire again (default: `15`)
103
113
 
@@ -105,21 +115,21 @@ To tune rules, add a `rules` object in your plugin config:
105
115
 
106
116
  ```jsonc
107
117
  {
108
- "plugins": {
109
- "entries": {
110
- "openalerts": {
111
- "config": {
112
- "cooldownMinutes": 10,
113
- "rules": {
114
- "llm-errors": { "threshold": 5 },
115
- "infra-errors": { "cooldownMinutes": 30 },
116
- "high-error-rate": { "enabled": false },
117
- "gateway-down": { "threshold": 60000 }
118
- }
119
- }
120
- }
121
- }
122
- }
118
+ "plugins": {
119
+ "entries": {
120
+ "openalerts": {
121
+ "config": {
122
+ "cooldownMinutes": 10,
123
+ "rules": {
124
+ "llm-errors": { "threshold": 5 },
125
+ "infra-errors": { "cooldownMinutes": 30 },
126
+ "high-error-rate": { "enabled": false },
127
+ "gateway-down": { "threshold": 60000 },
128
+ },
129
+ },
130
+ },
131
+ },
132
+ },
123
133
  }
124
134
  ```
125
135
 
@@ -131,15 +141,15 @@ OpenAlerts can optionally use your configured LLM to enrich alerts with a human-
131
141
 
132
142
  ```jsonc
133
143
  {
134
- "plugins": {
135
- "entries": {
136
- "openalerts": {
137
- "config": {
138
- "llmEnriched": true
139
- }
140
- }
141
- }
142
- }
144
+ "plugins": {
145
+ "entries": {
146
+ "openalerts": {
147
+ "config": {
148
+ "llmEnriched": true,
149
+ },
150
+ },
151
+ },
152
+ },
143
153
  }
144
154
  ```
145
155
 
@@ -161,11 +171,11 @@ Action: Update your API key in ~/.openclaw/.env with a valid key from platform.o
161
171
 
162
172
  Zero-token chat commands available in any connected channel:
163
173
 
164
- | Command | What it does |
165
- |---|---|
166
- | `/health` | System health snapshot — uptime, active alerts, stats |
167
- | `/alerts` | Recent alert history with severity and timestamps |
168
- | `/dashboard` | Returns the dashboard URL |
174
+ | Command | What it does |
175
+ | ------------ | ----------------------------------------------------- |
176
+ | `/health` | System health snapshot — uptime, active alerts, stats |
177
+ | `/alerts` | Recent alert history with severity and timestamps |
178
+ | `/dashboard` | Returns the dashboard URL |
169
179
 
170
180
  ## Roadmap
171
181
 
@@ -0,0 +1,50 @@
1
+ import { type MonitorSession, type MonitorAction, type MonitorExecEvent, type MonitorExecProcess, type MonitorExecProcessStatus, type CollectionStats, type CostUsageSummary } from "./types.js";
2
+ export declare class CollectionManager {
3
+ private sessions;
4
+ private actions;
5
+ private execs;
6
+ private runSessionMap;
7
+ private parentActionHistory;
8
+ private onSessionChange?;
9
+ private onActionChange?;
10
+ private onExecChange?;
11
+ constructor();
12
+ setCallbacks(callbacks: {
13
+ onSessionChange?: (session: MonitorSession) => void;
14
+ onActionChange?: (action: MonitorAction) => void;
15
+ onExecChange?: (exec: MonitorExecProcess) => void;
16
+ }): void;
17
+ private trackParentAction;
18
+ private inferSpawnedBy;
19
+ private resolveSessionKey;
20
+ private backfillExecSessionKey;
21
+ private createPlaceholderExec;
22
+ upsertSession(session: Partial<MonitorSession>): void;
23
+ updateSessionStatus(key: string, status: MonitorSession["status"]): void;
24
+ addAction(action: MonitorAction): void;
25
+ addExecEvent(event: MonitorExecEvent): void;
26
+ getSessions(): MonitorSession[];
27
+ /**
28
+ * Returns only recently-active sessions for the dashboard.
29
+ * Filters out stale idle sessions loaded from filesystem that are older than windowMs.
30
+ * Active/thinking sessions are always included regardless of age.
31
+ */
32
+ getActiveSessions(windowMs?: number): MonitorSession[];
33
+ getActions(opts?: {
34
+ sessionKey?: string;
35
+ limit?: number;
36
+ }): MonitorAction[];
37
+ getExecs(opts?: {
38
+ status?: MonitorExecProcessStatus;
39
+ sessionKey?: string;
40
+ }): MonitorExecProcess[];
41
+ getExec(id: string): MonitorExecProcess | undefined;
42
+ getStats(): CollectionStats;
43
+ updateSessionCost(sessionKey: string, costUsd: number, inputTokens?: number, outputTokens?: number): void;
44
+ syncAggregatedCosts(summary: CostUsageSummary): void;
45
+ clear(): void;
46
+ hydrate(sessions: MonitorSession[], actions: MonitorAction[], execEvents?: MonitorExecEvent[]): void;
47
+ exportSessions(): MonitorSession[];
48
+ exportActions(): MonitorAction[];
49
+ exportExecEvents(): MonitorExecEvent[];
50
+ }