@steadwing/openalerts 0.2.4 → 0.2.6
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 +198 -137
- package/dist/channels/console.d.ts +6 -0
- package/dist/channels/console.d.ts.map +1 -0
- package/dist/channels/console.js +10 -0
- package/dist/channels/console.js.map +1 -0
- package/dist/channels/telegram.d.ts +12 -0
- package/dist/channels/telegram.d.ts.map +1 -0
- package/dist/channels/telegram.js +28 -0
- package/dist/channels/telegram.js.map +1 -0
- package/dist/channels/webhook.d.ts +8 -0
- package/dist/channels/webhook.d.ts.map +1 -0
- package/dist/channels/webhook.js +15 -0
- package/dist/channels/webhook.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +234 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +51 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +86 -0
- package/dist/config.js.map +1 -0
- package/dist/core/alert-channel.d.ts +3 -10
- package/dist/core/alert-channel.d.ts.map +1 -0
- package/dist/core/alert-channel.js +9 -30
- package/dist/core/alert-channel.js.map +1 -0
- package/dist/core/bounded-map.d.ts +1 -0
- package/dist/core/bounded-map.d.ts.map +1 -0
- package/dist/core/bounded-map.js +1 -0
- package/dist/core/bounded-map.js.map +1 -0
- package/dist/core/engine.d.ts +6 -18
- package/dist/core/engine.d.ts.map +1 -0
- package/dist/core/engine.js +49 -98
- package/dist/core/engine.js.map +1 -0
- package/dist/core/evaluator.d.ts +1 -0
- package/dist/core/evaluator.d.ts.map +1 -0
- package/dist/core/evaluator.js +1 -0
- package/dist/core/evaluator.js.map +1 -0
- package/dist/core/event-bus.d.ts +1 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +1 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/formatter.d.ts +1 -0
- package/dist/core/formatter.d.ts.map +1 -0
- package/dist/core/formatter.js +1 -0
- package/dist/core/formatter.js.map +1 -0
- package/dist/core/rules.d.ts +1 -0
- package/dist/core/rules.d.ts.map +1 -0
- package/dist/core/rules.js +98 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/store.d.ts +6 -9
- package/dist/core/store.d.ts.map +1 -0
- package/dist/core/store.js +43 -96
- package/dist/core/store.js.map +1 -0
- package/dist/core/types.d.ts +2 -1
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +1 -0
- package/dist/core/types.js.map +1 -0
- package/dist/db/index.d.ts +6 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +31 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/queries.d.ts +157 -0
- package/dist/db/queries.d.ts.map +1 -0
- package/dist/db/queries.js +221 -0
- package/dist/db/queries.js.map +1 -0
- package/dist/db/schema.d.ts +5 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +177 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/readers/openclaw.d.ts +11 -0
- package/dist/readers/openclaw.d.ts.map +1 -0
- package/dist/readers/openclaw.js +267 -0
- package/dist/readers/openclaw.js.map +1 -0
- package/dist/server/dashboard.d.ts +2 -0
- package/dist/server/dashboard.d.ts.map +1 -0
- package/dist/server/dashboard.js +765 -0
- package/dist/server/dashboard.js.map +1 -0
- package/dist/server/index.d.ts +10 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +28 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/routes.d.ts +6 -0
- package/dist/server/routes.d.ts.map +1 -0
- package/dist/server/routes.js +146 -0
- package/dist/server/routes.js.map +1 -0
- package/dist/server/sse.d.ts +21 -0
- package/dist/server/sse.d.ts.map +1 -0
- package/dist/server/sse.js +53 -0
- package/dist/server/sse.js.map +1 -0
- package/dist/watchers/files.d.ts +19 -0
- package/dist/watchers/files.d.ts.map +1 -0
- package/dist/watchers/files.js +105 -0
- package/dist/watchers/files.js.map +1 -0
- package/dist/watchers/gateway-adapter.d.ts +18 -0
- package/dist/watchers/gateway-adapter.d.ts.map +1 -0
- package/dist/watchers/gateway-adapter.js +273 -0
- package/dist/watchers/gateway-adapter.js.map +1 -0
- package/dist/watchers/gateway.d.ts +27 -0
- package/dist/watchers/gateway.d.ts.map +1 -0
- package/dist/watchers/gateway.js +131 -0
- package/dist/watchers/gateway.js.map +1 -0
- package/package.json +29 -43
- package/LICENSE +0 -201
- package/dist/core/index.d.ts +0 -12
- package/dist/core/index.js +0 -23
- package/dist/core/llm-enrichment.d.ts +0 -21
- package/dist/core/llm-enrichment.js +0 -180
- package/dist/core/platform.d.ts +0 -17
- package/dist/core/platform.js +0 -93
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -213
- package/dist/plugin/adapter.d.ts +0 -150
- package/dist/plugin/adapter.js +0 -530
- package/dist/plugin/commands.d.ts +0 -18
- package/dist/plugin/commands.js +0 -103
- package/dist/plugin/dashboard-html.d.ts +0 -7
- package/dist/plugin/dashboard-html.js +0 -938
- package/dist/plugin/dashboard-routes.d.ts +0 -7
- package/dist/plugin/dashboard-routes.js +0 -336
- package/dist/plugin/gateway-client.d.ts +0 -39
- package/dist/plugin/gateway-client.js +0 -193
- package/dist/plugin/log-bridge.d.ts +0 -22
- package/dist/plugin/log-bridge.js +0 -363
- package/openclaw.plugin.json +0 -57
package/dist/index.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { OpenAlertsEngine } from "./core/index.js";
|
|
2
|
-
import { onDiagnosticEvent, registerLogTransport } from "openclaw/plugin-sdk";
|
|
3
|
-
import { createLogBridge } from "./plugin/log-bridge.js";
|
|
4
|
-
import { OpenClawAlertChannel, createOpenClawEnricher, parseConfig, resolveAlertTarget, translateOpenClawEvent, translateToolCallHook, translateAgentStartHook, translateAgentEndHook, translateSessionStartHook, translateSessionEndHook, translateMessageSentHook, translateMessageReceivedHook, translateBeforeToolCallHook, translateBeforeCompactionHook, translateAfterCompactionHook, translateMessageSendingHook, translateToolResultPersistHook, translateGatewayStartHook, translateGatewayStopHook, } from "./plugin/adapter.js";
|
|
5
|
-
import { bindEngine, createMonitorCommands } from "./plugin/commands.js";
|
|
6
|
-
import { createDashboardHandler, closeDashboardConnections, } from "./plugin/dashboard-routes.js";
|
|
7
|
-
const PLUGIN_ID = "openalerts";
|
|
8
|
-
const LOG_PREFIX = "openalerts";
|
|
9
|
-
let engine = null;
|
|
10
|
-
let unsubDiagnostic = null;
|
|
11
|
-
let unsubLogTransport = null;
|
|
12
|
-
let logBridgeCleanup = null;
|
|
13
|
-
function createMonitorService(api) {
|
|
14
|
-
return {
|
|
15
|
-
id: PLUGIN_ID,
|
|
16
|
-
async start(ctx) {
|
|
17
|
-
const logger = ctx.logger;
|
|
18
|
-
const config = parseConfig(api.pluginConfig);
|
|
19
|
-
// Resolve alert target + create OpenClaw alert channel
|
|
20
|
-
const target = await resolveAlertTarget(api, config);
|
|
21
|
-
const channels = target ? [new OpenClawAlertChannel(api, target)] : [];
|
|
22
|
-
// Create LLM enricher if enabled (default: false)
|
|
23
|
-
const enricher = config.llmEnriched === true
|
|
24
|
-
? createOpenClawEnricher(api, logger)
|
|
25
|
-
: null;
|
|
26
|
-
// Create and start the universal engine
|
|
27
|
-
engine = new OpenAlertsEngine({
|
|
28
|
-
stateDir: ctx.stateDir,
|
|
29
|
-
config,
|
|
30
|
-
channels,
|
|
31
|
-
logger,
|
|
32
|
-
logPrefix: LOG_PREFIX,
|
|
33
|
-
diagnosisHint: 'Run "openclaw doctor" to diagnose.',
|
|
34
|
-
enricher: enricher ?? undefined,
|
|
35
|
-
});
|
|
36
|
-
engine.start();
|
|
37
|
-
// Wire commands to engine
|
|
38
|
-
bindEngine(engine, api);
|
|
39
|
-
// ── Bridge 1: Diagnostic events → engine ──────────────────────────────
|
|
40
|
-
// Covers: webhook.*, message.*, session.stuck, session.state,
|
|
41
|
-
// model.usage, queue.lane.*, diagnostic.heartbeat, run.attempt
|
|
42
|
-
unsubDiagnostic = onDiagnosticEvent((event) => {
|
|
43
|
-
const translated = translateOpenClawEvent(event);
|
|
44
|
-
if (translated) {
|
|
45
|
-
engine.ingest(translated);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
// ── Bridge 2: Log transport → engine (fills gaps from non-firing hooks) ─
|
|
49
|
-
// Parses structured log records to synthesize tool.call, session.start/end,
|
|
50
|
-
// and run duration events that hooks don't provide in long-polling mode.
|
|
51
|
-
const logBridge = createLogBridge(engine);
|
|
52
|
-
unsubLogTransport = registerLogTransport(logBridge.transport);
|
|
53
|
-
logBridgeCleanup = logBridge.cleanup;
|
|
54
|
-
// ── Bridge 3: Plugin hooks → engine ───────────────────────────────────
|
|
55
|
-
// Covers: tool calls, agent lifecycle, session lifecycle, gateway, messages
|
|
56
|
-
// These events are NOT emitted as diagnostic events — they come through
|
|
57
|
-
// the plugin hook system (api.on).
|
|
58
|
-
const apiOn = api.on?.bind(api);
|
|
59
|
-
if (apiOn) {
|
|
60
|
-
// Tool execution tracking
|
|
61
|
-
apiOn("after_tool_call", (data, hookCtx) => {
|
|
62
|
-
if (!engine)
|
|
63
|
-
return;
|
|
64
|
-
engine.ingest(translateToolCallHook(data, {
|
|
65
|
-
sessionId: hookCtx.sessionId,
|
|
66
|
-
agentId: hookCtx.agentId,
|
|
67
|
-
}));
|
|
68
|
-
});
|
|
69
|
-
// Agent lifecycle
|
|
70
|
-
apiOn("before_agent_start", (data, hookCtx) => {
|
|
71
|
-
if (!engine)
|
|
72
|
-
return;
|
|
73
|
-
engine.ingest(translateAgentStartHook(data, {
|
|
74
|
-
sessionId: hookCtx.sessionId,
|
|
75
|
-
agentId: hookCtx.agentId,
|
|
76
|
-
}));
|
|
77
|
-
});
|
|
78
|
-
apiOn("agent_end", (data, hookCtx) => {
|
|
79
|
-
if (!engine)
|
|
80
|
-
return;
|
|
81
|
-
engine.ingest(translateAgentEndHook(data, {
|
|
82
|
-
sessionId: hookCtx.sessionId,
|
|
83
|
-
agentId: hookCtx.agentId,
|
|
84
|
-
}));
|
|
85
|
-
});
|
|
86
|
-
// Session lifecycle
|
|
87
|
-
apiOn("session_start", (data) => {
|
|
88
|
-
if (!engine)
|
|
89
|
-
return;
|
|
90
|
-
engine.ingest(translateSessionStartHook(data));
|
|
91
|
-
});
|
|
92
|
-
apiOn("session_end", (data) => {
|
|
93
|
-
if (!engine)
|
|
94
|
-
return;
|
|
95
|
-
engine.ingest(translateSessionEndHook(data));
|
|
96
|
-
});
|
|
97
|
-
// Message delivery tracking (all messages — success and failure)
|
|
98
|
-
apiOn("message_sent", (data, hookCtx) => {
|
|
99
|
-
if (!engine)
|
|
100
|
-
return;
|
|
101
|
-
const d = data;
|
|
102
|
-
engine.ingest(translateMessageSentHook(d, {
|
|
103
|
-
channel: hookCtx.channel,
|
|
104
|
-
sessionId: hookCtx.sessionId,
|
|
105
|
-
}));
|
|
106
|
-
});
|
|
107
|
-
// Inbound message tracking (fires reliably in all modes)
|
|
108
|
-
apiOn("message_received", (data, hookCtx) => {
|
|
109
|
-
if (!engine)
|
|
110
|
-
return;
|
|
111
|
-
engine.ingest(translateMessageReceivedHook(data, {
|
|
112
|
-
channelId: hookCtx.channelId,
|
|
113
|
-
accountId: hookCtx.accountId,
|
|
114
|
-
}));
|
|
115
|
-
});
|
|
116
|
-
// Tool start tracking (fires reliably — complements log-bridge tool end)
|
|
117
|
-
apiOn("before_tool_call", (data, hookCtx) => {
|
|
118
|
-
if (!engine)
|
|
119
|
-
return;
|
|
120
|
-
engine.ingest(translateBeforeToolCallHook(data, {
|
|
121
|
-
sessionId: hookCtx.sessionId,
|
|
122
|
-
agentId: hookCtx.agentId,
|
|
123
|
-
}));
|
|
124
|
-
});
|
|
125
|
-
// Tool result persistence tracking
|
|
126
|
-
apiOn("tool_result_persist", (data, hookCtx) => {
|
|
127
|
-
if (!engine)
|
|
128
|
-
return;
|
|
129
|
-
engine.ingest(translateToolResultPersistHook(data, {
|
|
130
|
-
sessionKey: hookCtx.sessionKey,
|
|
131
|
-
agentId: hookCtx.agentId,
|
|
132
|
-
toolName: hookCtx.toolName,
|
|
133
|
-
}));
|
|
134
|
-
});
|
|
135
|
-
// Compaction lifecycle (before + after)
|
|
136
|
-
apiOn("before_compaction", (data, hookCtx) => {
|
|
137
|
-
if (!engine)
|
|
138
|
-
return;
|
|
139
|
-
engine.ingest(translateBeforeCompactionHook(data, {
|
|
140
|
-
sessionKey: hookCtx.sessionKey,
|
|
141
|
-
agentId: hookCtx.agentId,
|
|
142
|
-
}));
|
|
143
|
-
});
|
|
144
|
-
apiOn("after_compaction", (data, hookCtx) => {
|
|
145
|
-
if (!engine)
|
|
146
|
-
return;
|
|
147
|
-
engine.ingest(translateAfterCompactionHook(data, {
|
|
148
|
-
sessionKey: hookCtx.sessionKey,
|
|
149
|
-
agentId: hookCtx.agentId,
|
|
150
|
-
}));
|
|
151
|
-
});
|
|
152
|
-
// Pre-send message tracking (fires before message_sent)
|
|
153
|
-
apiOn("message_sending", (data, hookCtx) => {
|
|
154
|
-
if (!engine)
|
|
155
|
-
return;
|
|
156
|
-
engine.ingest(translateMessageSendingHook(data, {
|
|
157
|
-
channelId: hookCtx.channelId,
|
|
158
|
-
accountId: hookCtx.accountId,
|
|
159
|
-
}));
|
|
160
|
-
});
|
|
161
|
-
// Gateway lifecycle
|
|
162
|
-
apiOn("gateway_start", (data) => {
|
|
163
|
-
if (!engine)
|
|
164
|
-
return;
|
|
165
|
-
engine.ingest(translateGatewayStartHook(data));
|
|
166
|
-
});
|
|
167
|
-
apiOn("gateway_stop", (data) => {
|
|
168
|
-
if (!engine)
|
|
169
|
-
return;
|
|
170
|
-
engine.ingest(translateGatewayStopHook(data));
|
|
171
|
-
});
|
|
172
|
-
logger.info(`${LOG_PREFIX}: subscribed to 13 plugin hooks (100% coverage: tool, agent, session, gateway, message, compaction)`);
|
|
173
|
-
}
|
|
174
|
-
const targetDesc = target
|
|
175
|
-
? `alerting to ${target.channel}:${target.to}`
|
|
176
|
-
: "log-only (no alert channel detected)";
|
|
177
|
-
logger.info(`${LOG_PREFIX}: started, ${targetDesc}, log-bridge active, 8 rules active`);
|
|
178
|
-
},
|
|
179
|
-
stop() {
|
|
180
|
-
closeDashboardConnections();
|
|
181
|
-
if (unsubLogTransport) {
|
|
182
|
-
unsubLogTransport();
|
|
183
|
-
unsubLogTransport = null;
|
|
184
|
-
}
|
|
185
|
-
if (logBridgeCleanup) {
|
|
186
|
-
logBridgeCleanup();
|
|
187
|
-
logBridgeCleanup = null;
|
|
188
|
-
}
|
|
189
|
-
if (unsubDiagnostic) {
|
|
190
|
-
unsubDiagnostic();
|
|
191
|
-
unsubDiagnostic = null;
|
|
192
|
-
}
|
|
193
|
-
if (engine) {
|
|
194
|
-
engine.stop();
|
|
195
|
-
engine = null;
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
const plugin = {
|
|
201
|
-
id: PLUGIN_ID,
|
|
202
|
-
name: "OpenAlerts",
|
|
203
|
-
description: "Alerting & monitoring — texts you when your bot is sick",
|
|
204
|
-
register(api) {
|
|
205
|
-
api.registerService(createMonitorService(api));
|
|
206
|
-
for (const cmd of createMonitorCommands(api)) {
|
|
207
|
-
api.registerCommand(cmd);
|
|
208
|
-
}
|
|
209
|
-
// Register dashboard HTTP routes under /openalerts*
|
|
210
|
-
api.registerHttpHandler(createDashboardHandler(() => engine));
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
export default plugin;
|
package/dist/plugin/adapter.d.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type { AlertChannel, AlertEnricher, AlertEvent, AlertTarget, MonitorConfig, OpenAlertsEvent } from "../core/index.js";
|
|
2
|
-
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
3
|
-
/**
|
|
4
|
-
* Translate an OpenClaw diagnostic event into a universal OpenAlertsEvent.
|
|
5
|
-
* Returns null for unmapped event types.
|
|
6
|
-
*/
|
|
7
|
-
export declare function translateOpenClawEvent(event: {
|
|
8
|
-
type: string;
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
}): OpenAlertsEvent | null;
|
|
11
|
-
/** Translate after_tool_call hook data into OpenAlertsEvent. */
|
|
12
|
-
export declare function translateToolCallHook(data: {
|
|
13
|
-
toolName: string;
|
|
14
|
-
params: Record<string, unknown>;
|
|
15
|
-
result?: unknown;
|
|
16
|
-
error?: string;
|
|
17
|
-
durationMs?: number;
|
|
18
|
-
}, context: {
|
|
19
|
-
sessionId?: string;
|
|
20
|
-
agentId?: string;
|
|
21
|
-
}): OpenAlertsEvent;
|
|
22
|
-
/** Translate before_agent_start hook data into OpenAlertsEvent. */
|
|
23
|
-
export declare function translateAgentStartHook(data: {
|
|
24
|
-
prompt: string;
|
|
25
|
-
messages?: unknown[];
|
|
26
|
-
}, context: {
|
|
27
|
-
sessionId?: string;
|
|
28
|
-
agentId?: string;
|
|
29
|
-
}): OpenAlertsEvent;
|
|
30
|
-
/** Translate agent_end hook data into OpenAlertsEvent. */
|
|
31
|
-
export declare function translateAgentEndHook(data: {
|
|
32
|
-
messages: unknown[];
|
|
33
|
-
success: boolean;
|
|
34
|
-
error?: string;
|
|
35
|
-
durationMs?: number;
|
|
36
|
-
}, context: {
|
|
37
|
-
sessionId?: string;
|
|
38
|
-
agentId?: string;
|
|
39
|
-
}): OpenAlertsEvent;
|
|
40
|
-
/** Translate session_start hook data into OpenAlertsEvent. */
|
|
41
|
-
export declare function translateSessionStartHook(data: {
|
|
42
|
-
sessionId: string;
|
|
43
|
-
resumedFrom?: string;
|
|
44
|
-
}): OpenAlertsEvent;
|
|
45
|
-
/** Translate session_end hook data into OpenAlertsEvent. */
|
|
46
|
-
export declare function translateSessionEndHook(data: {
|
|
47
|
-
sessionId: string;
|
|
48
|
-
messageCount: number;
|
|
49
|
-
durationMs?: number;
|
|
50
|
-
}): OpenAlertsEvent;
|
|
51
|
-
/** Translate message_sent hook data into OpenAlertsEvent (delivery tracking). */
|
|
52
|
-
export declare function translateMessageSentHook(data: {
|
|
53
|
-
to: string;
|
|
54
|
-
content: string;
|
|
55
|
-
success: boolean;
|
|
56
|
-
error?: string;
|
|
57
|
-
}, context: {
|
|
58
|
-
channel?: string;
|
|
59
|
-
sessionId?: string;
|
|
60
|
-
}): OpenAlertsEvent;
|
|
61
|
-
/** Translate gateway_start hook data into OpenAlertsEvent. */
|
|
62
|
-
export declare function translateGatewayStartHook(data: {
|
|
63
|
-
port: number;
|
|
64
|
-
}): OpenAlertsEvent;
|
|
65
|
-
/** Translate gateway_stop hook data into OpenAlertsEvent. */
|
|
66
|
-
export declare function translateGatewayStopHook(data: {
|
|
67
|
-
reason?: string;
|
|
68
|
-
}): OpenAlertsEvent;
|
|
69
|
-
/** Translate message_received hook data into OpenAlertsEvent (inbound tracking). */
|
|
70
|
-
export declare function translateMessageReceivedHook(data: {
|
|
71
|
-
from: string;
|
|
72
|
-
content: string;
|
|
73
|
-
timestamp?: number;
|
|
74
|
-
metadata?: Record<string, unknown>;
|
|
75
|
-
}, context: {
|
|
76
|
-
channelId?: string;
|
|
77
|
-
accountId?: string;
|
|
78
|
-
}): OpenAlertsEvent;
|
|
79
|
-
/** Translate before_tool_call hook data into OpenAlertsEvent (tool start tracking). */
|
|
80
|
-
export declare function translateBeforeToolCallHook(data: {
|
|
81
|
-
toolName: string;
|
|
82
|
-
params: Record<string, unknown>;
|
|
83
|
-
}, context: {
|
|
84
|
-
sessionId?: string;
|
|
85
|
-
agentId?: string;
|
|
86
|
-
}): OpenAlertsEvent;
|
|
87
|
-
/** Translate before_compaction hook data into OpenAlertsEvent. */
|
|
88
|
-
export declare function translateBeforeCompactionHook(data: {
|
|
89
|
-
messageCount: number;
|
|
90
|
-
tokenCount?: number;
|
|
91
|
-
}, context: {
|
|
92
|
-
sessionKey?: string;
|
|
93
|
-
agentId?: string;
|
|
94
|
-
}): OpenAlertsEvent;
|
|
95
|
-
/** Translate after_compaction hook data into OpenAlertsEvent. */
|
|
96
|
-
export declare function translateAfterCompactionHook(data: {
|
|
97
|
-
messageCount: number;
|
|
98
|
-
tokenCount?: number;
|
|
99
|
-
compactedCount: number;
|
|
100
|
-
}, context: {
|
|
101
|
-
sessionKey?: string;
|
|
102
|
-
agentId?: string;
|
|
103
|
-
}): OpenAlertsEvent;
|
|
104
|
-
/** Translate message_sending hook data into OpenAlertsEvent (pre-send tracking). */
|
|
105
|
-
export declare function translateMessageSendingHook(data: {
|
|
106
|
-
to: string;
|
|
107
|
-
content: string;
|
|
108
|
-
metadata?: Record<string, unknown>;
|
|
109
|
-
}, context: {
|
|
110
|
-
channelId?: string;
|
|
111
|
-
accountId?: string;
|
|
112
|
-
}): OpenAlertsEvent;
|
|
113
|
-
/** Translate tool_result_persist hook data into OpenAlertsEvent. */
|
|
114
|
-
export declare function translateToolResultPersistHook(data: {
|
|
115
|
-
toolName?: string;
|
|
116
|
-
toolCallId?: string;
|
|
117
|
-
isSynthetic?: boolean;
|
|
118
|
-
}, context: {
|
|
119
|
-
sessionKey?: string;
|
|
120
|
-
agentId?: string;
|
|
121
|
-
toolName?: string;
|
|
122
|
-
}): OpenAlertsEvent;
|
|
123
|
-
/**
|
|
124
|
-
* AlertChannel that sends through OpenClaw's runtime channel API.
|
|
125
|
-
* Bridges the universal AlertChannel interface to OpenClaw's messaging system.
|
|
126
|
-
*/
|
|
127
|
-
export declare class OpenClawAlertChannel implements AlertChannel {
|
|
128
|
-
readonly name: string;
|
|
129
|
-
private api;
|
|
130
|
-
private target;
|
|
131
|
-
private warnedMissing;
|
|
132
|
-
constructor(api: OpenClawPluginApi, target: AlertTarget);
|
|
133
|
-
send(alert: AlertEvent, formatted: string): Promise<void>;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Resolve the alert target from plugin config or by auto-detecting from OpenClaw config.
|
|
137
|
-
*/
|
|
138
|
-
export declare function resolveAlertTarget(api: OpenClawPluginApi, pluginConfig: MonitorConfig): Promise<AlertTarget | null>;
|
|
139
|
-
export declare function parseConfig(raw: Record<string, unknown> | undefined): MonitorConfig;
|
|
140
|
-
/**
|
|
141
|
-
* Create an AlertEnricher from the OpenClaw plugin API.
|
|
142
|
-
* Reads the model from api.config.agents.defaults.model.primary (e.g. "openai/gpt-5-nano")
|
|
143
|
-
* and resolves the API key from process.env.
|
|
144
|
-
* Returns null if no model is configured or enricher can't be created.
|
|
145
|
-
*/
|
|
146
|
-
export declare function createOpenClawEnricher(api: OpenClawPluginApi, logger?: {
|
|
147
|
-
info: (msg: string) => void;
|
|
148
|
-
warn: (msg: string) => void;
|
|
149
|
-
error: (msg: string) => void;
|
|
150
|
-
}): AlertEnricher | null;
|