@aethrekh/pi-cs 0.1.7 → 0.1.8-alpha.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/extensions/integrity-guard.js +12 -2
- package/package.json +1 -1
- package/pi-cs.meta.json +2 -2
- package/pi-package.yaml +1 -1
|
@@ -101,12 +101,22 @@ Just let me know!`;
|
|
|
101
101
|
}
|
|
102
102
|
// ─── Pi Extension Factory ──────────────────────────────────────────────────
|
|
103
103
|
function default_1(pi) {
|
|
104
|
+
// Guard against sendUserMessage re-triggering this handler — warning text
|
|
105
|
+
// contains words like "graded" that would otherwise match medium-risk patterns.
|
|
106
|
+
let handlingWarning = false;
|
|
104
107
|
pi.on("input", async (event) => {
|
|
105
|
-
|
|
108
|
+
if (handlingWarning)
|
|
109
|
+
return { action: "continue" };
|
|
110
|
+
const skillMatch = event.text.match(/^\/skill:(\w+)\s*/);
|
|
106
111
|
const skillName = skillMatch?.[1] ?? "";
|
|
107
|
-
|
|
112
|
+
// Strip /skill:name prefix so it doesn't trigger keyword patterns
|
|
113
|
+
// e.g. "/skill:homework explain X" should not match \bhomework\b
|
|
114
|
+
const userRequest = skillMatch ? event.text.slice(skillMatch[0].length) : event.text;
|
|
115
|
+
const result = checkIntegrityRisk(userRequest, skillName);
|
|
108
116
|
if (result.warning) {
|
|
117
|
+
handlingWarning = true;
|
|
109
118
|
pi.sendUserMessage(result.warning);
|
|
119
|
+
handlingWarning = false;
|
|
110
120
|
return result.risk === "high"
|
|
111
121
|
? { action: "handled" }
|
|
112
122
|
: { action: "continue" };
|
package/package.json
CHANGED
package/pi-cs.meta.json
CHANGED
package/pi-package.yaml
CHANGED