openclaw-triage-gate 1.0.1 → 1.0.2
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/package.json +1 -1
- package/src/index.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-triage-gate",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A lightweight triage gate for OpenClaw group chats. Uses a cheap model to decide if the bot should respond before the expensive main model runs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,10 @@ import { definePluginEntry, type OpenClawPluginApi } from "openclaw/plugin-sdk/p
|
|
|
13
13
|
import { evaluateMessage } from "./triage.js";
|
|
14
14
|
import { type TriageGateConfig } from "./config.js";
|
|
15
15
|
|
|
16
|
+
// Guard against multiple registrations. OpenClaw calls register() for each
|
|
17
|
+
// agent context, but we only need one before_dispatch hook globally.
|
|
18
|
+
let registered = false;
|
|
19
|
+
|
|
16
20
|
export default definePluginEntry({
|
|
17
21
|
id: "openclaw-triage-gate",
|
|
18
22
|
name: "Triage Gate",
|
|
@@ -20,6 +24,9 @@ export default definePluginEntry({
|
|
|
20
24
|
"Uses a cheap model to decide if the bot should respond in group chats, saving 75-90% of group chat token costs.",
|
|
21
25
|
|
|
22
26
|
register(api: OpenClawPluginApi) {
|
|
27
|
+
if (registered) return;
|
|
28
|
+
registered = true;
|
|
29
|
+
|
|
23
30
|
const config = (api.pluginConfig ?? {}) as TriageGateConfig;
|
|
24
31
|
const logDecisions = config.logDecisions !== false; // default: true
|
|
25
32
|
|