@davidorex/pi-behavior-monitors 0.1.3 → 0.1.4
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/CHANGELOG.md +16 -0
- package/index.ts +52 -2
- package/package.json +1 -1
- package/skills/pi-behavior-monitors/SKILL.md +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## v0.1.4
|
|
6
|
+
|
|
7
|
+
[compare changes](https://github.com/davidorex/pi-behavior-monitors/compare/v0.1.3...v0.1.4)
|
|
8
|
+
|
|
9
|
+
### 🚀 Enhancements
|
|
10
|
+
|
|
11
|
+
- Add ui.select menus to /monitors command for TUI discoverability ([4391ca3](https://github.com/davidorex/pi-behavior-monitors/commit/4391ca3))
|
|
12
|
+
|
|
13
|
+
### 📖 Documentation
|
|
14
|
+
|
|
15
|
+
- Update SKILL.md with buffered steer delivery and TUI autocomplete ([94aee6e](https://github.com/davidorex/pi-behavior-monitors/commit/94aee6e))
|
|
16
|
+
|
|
17
|
+
### ❤️ Contributors
|
|
18
|
+
|
|
19
|
+
- David Ryan <davidryan@gmail.com>
|
|
20
|
+
|
|
5
21
|
## v0.1.3
|
|
6
22
|
|
|
7
23
|
[compare changes](https://github.com/davidorex/pi-behavior-monitors/compare/v0.1.2...v0.1.3)
|
package/index.ts
CHANGED
|
@@ -1141,7 +1141,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1141
1141
|
const items = [
|
|
1142
1142
|
{ value: "on", label: "on", description: "Enable all monitoring" },
|
|
1143
1143
|
{ value: "off", label: "off", description: "Pause all monitoring" },
|
|
1144
|
-
...Array.from(monitorNames).map((n) => ({ value: n, label: n, description: monitorsByName.get(n)?.description ?? "" })),
|
|
1144
|
+
...Array.from(monitorNames).map((n) => ({ value: n, label: n, description: `${monitorsByName.get(n)?.description ?? ""} → rules|patterns|dismiss|reset` })),
|
|
1145
1145
|
];
|
|
1146
1146
|
return items.filter((i) => i.value.startsWith(last));
|
|
1147
1147
|
}
|
|
@@ -1173,7 +1173,57 @@ export default function (pi: ExtensionAPI) {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
|
|
1175
1175
|
if (cmd.type === "list") {
|
|
1176
|
-
|
|
1176
|
+
if (!ctx.hasUI) {
|
|
1177
|
+
handleList(monitors, ctx, monitorsEnabled);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
const options = [
|
|
1181
|
+
`on — Enable all monitoring`,
|
|
1182
|
+
`off — Pause all monitoring`,
|
|
1183
|
+
...monitors.map((m) => {
|
|
1184
|
+
const state = m.dismissed ? "dismissed" : m.whileCount > 0 ? `engaged (${m.whileCount}/${m.ceiling})` : "idle";
|
|
1185
|
+
return `${m.name} — ${m.description} [${state}]`;
|
|
1186
|
+
}),
|
|
1187
|
+
];
|
|
1188
|
+
const selected = await ctx.ui.select("Monitors", options);
|
|
1189
|
+
if (!selected) return;
|
|
1190
|
+
const selectedName = selected.split(" ")[0];
|
|
1191
|
+
if (selectedName === "on") {
|
|
1192
|
+
monitorsEnabled = true;
|
|
1193
|
+
updateStatus();
|
|
1194
|
+
ctx.ui.notify("Monitors enabled", "info");
|
|
1195
|
+
} else if (selectedName === "off") {
|
|
1196
|
+
monitorsEnabled = false;
|
|
1197
|
+
updateStatus();
|
|
1198
|
+
ctx.ui.notify("All monitors paused for this session", "info");
|
|
1199
|
+
} else {
|
|
1200
|
+
const monitor = monitorsByName.get(selectedName);
|
|
1201
|
+
if (!monitor) return;
|
|
1202
|
+
const verbOptions = [
|
|
1203
|
+
`inspect — Show monitor state and config`,
|
|
1204
|
+
`rules — List and manage rules`,
|
|
1205
|
+
`patterns — List known patterns`,
|
|
1206
|
+
`dismiss — Silence for this session`,
|
|
1207
|
+
`reset — Reset state and un-dismiss`,
|
|
1208
|
+
];
|
|
1209
|
+
const verb = await ctx.ui.select(`[${monitor.name}]`, verbOptions);
|
|
1210
|
+
if (!verb) return;
|
|
1211
|
+
const verbName = verb.split(" ")[0];
|
|
1212
|
+
if (verbName === "inspect") handleInspect(monitor, ctx);
|
|
1213
|
+
else if (verbName === "rules") handleRulesList(monitor, ctx);
|
|
1214
|
+
else if (verbName === "patterns") handlePatternsList(monitor, ctx);
|
|
1215
|
+
else if (verbName === "dismiss") {
|
|
1216
|
+
monitor.dismissed = true;
|
|
1217
|
+
monitor.whileCount = 0;
|
|
1218
|
+
updateStatus();
|
|
1219
|
+
ctx.ui.notify(`[${monitor.name}] Dismissed for this session`, "info");
|
|
1220
|
+
} else if (verbName === "reset") {
|
|
1221
|
+
monitor.dismissed = false;
|
|
1222
|
+
monitor.whileCount = 0;
|
|
1223
|
+
updateStatus();
|
|
1224
|
+
ctx.ui.notify(`[${monitor.name}] Reset`, "info");
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1177
1227
|
return;
|
|
1178
1228
|
}
|
|
1179
1229
|
|
package/package.json
CHANGED
|
@@ -270,6 +270,13 @@ the session. A `CLEAN` verdict resets the consecutive steer counter.
|
|
|
270
270
|
a turn, and monitor B has `"excludes": ["A"]`, monitor B skips that turn. Exclusion tracking
|
|
271
271
|
resets at `turn_start`.
|
|
272
272
|
|
|
273
|
+
**Buffered steer delivery**: Monitors on `message_end` or `turn_end` buffer their steer
|
|
274
|
+
messages and deliver them at `agent_end`. This is because pi's async event queue processes
|
|
275
|
+
extension handlers after the agent loop has already checked for steering messages. The
|
|
276
|
+
buffer is drained at `agent_end` — only the first buffered steer fires per agent run; the
|
|
277
|
+
corrected response re-triggers monitors naturally for any remaining issues. Monitors on
|
|
278
|
+
`agent_end` or `command` events deliver steers immediately (they already run post-loop).
|
|
279
|
+
|
|
273
280
|
**Abort**: Classification calls are aborted when the agent ends (via `agent_end` event).
|
|
274
281
|
Aborted classifications produce no verdict and no action.
|
|
275
282
|
|
|
@@ -280,7 +287,9 @@ the `id` field of array entries.
|
|
|
280
287
|
</runtime_behavior>
|
|
281
288
|
|
|
282
289
|
<commands>
|
|
283
|
-
All monitor management is through the `/monitors` command
|
|
290
|
+
All monitor management is through the `/monitors` command. Subcommands are
|
|
291
|
+
discoverable via pi's TUI autocomplete — typing `/monitors ` shows available
|
|
292
|
+
monitor names and global commands; selecting a monitor shows its verbs.
|
|
284
293
|
|
|
285
294
|
| Command | Description |
|
|
286
295
|
|---------|-------------|
|