@windyroad/risk-scorer 0.19.3 → 0.19.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.
|
@@ -16,15 +16,26 @@ const riskAgentRoles = new Set([
|
|
|
16
16
|
"wr-risk-scorer:inbound-report",
|
|
17
17
|
]);
|
|
18
18
|
|
|
19
|
-
function
|
|
20
|
-
if (
|
|
19
|
+
function parsedResponse(value) {
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
const text = value
|
|
22
|
+
.filter((item) => item && typeof item === "object" && typeof item.text === "string")
|
|
23
|
+
.map((item) => item.text)
|
|
24
|
+
.join("\n");
|
|
25
|
+
return parsedResponse(text);
|
|
26
|
+
}
|
|
27
|
+
if (typeof value === "object" && value) return value;
|
|
21
28
|
try {
|
|
22
|
-
return JSON.parse(
|
|
29
|
+
return parsedResponse(JSON.parse(value));
|
|
23
30
|
} catch {
|
|
24
31
|
return {};
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
|
|
35
|
+
function response(input) {
|
|
36
|
+
return parsedResponse(input.tool_response);
|
|
37
|
+
}
|
|
38
|
+
|
|
28
39
|
function riskDir(sessionId) {
|
|
29
40
|
return join(process.env.TMPDIR || "/tmp", `claude-risk-${sessionId}`);
|
|
30
41
|
}
|
|
@@ -418,13 +429,13 @@ if (!/^[A-Za-z0-9-]+$/.test(input.session_id || "")) {
|
|
|
418
429
|
process.exit(0);
|
|
419
430
|
}
|
|
420
431
|
|
|
421
|
-
if (["collaborationspawn_agent", "spawn_agent", "multi_agent_v1__spawn_agent"].includes(input.tool_name)) {
|
|
432
|
+
if (["collaboration.spawn_agent", "collaborationspawn_agent", "spawn_agent", "multi_agent_v1__spawn_agent"].includes(input.tool_name)) {
|
|
422
433
|
rememberSpawn(input);
|
|
423
434
|
}
|
|
424
|
-
if (["collaborationinterrupt_agent", "interrupt_agent", "close_agent", "multi_agent_v1__close_agent"].includes(input.tool_name)) {
|
|
435
|
+
if (["collaboration.interrupt_agent", "collaborationinterrupt_agent", "interrupt_agent", "close_agent", "multi_agent_v1__close_agent"].includes(input.tool_name)) {
|
|
425
436
|
markClose(input);
|
|
426
437
|
}
|
|
427
|
-
if (["collaborationwait_agent", "wait_agent", "multi_agent_v1__wait_agent"].includes(input.tool_name)) {
|
|
438
|
+
if (["collaboration.wait_agent", "collaborationwait_agent", "wait_agent", "multi_agent_v1__wait_agent"].includes(input.tool_name)) {
|
|
428
439
|
markWait(input);
|
|
429
440
|
}
|
|
430
441
|
if (input.hook_event_name === "SubagentStop") {
|
package/hooks/hooks.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
{ "matcher": "Bash|Edit|Write|ExitPlanMode|EnterPlanMode", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh pre-tool" }] }
|
|
11
11
|
],
|
|
12
12
|
"PostToolUse": [
|
|
13
|
-
{ "matcher": "Agent|Bash|Edit|Skill|Write|collaborationspawn_agent|collaborationwait_agent|collaborationinterrupt_agent|spawn_agent|wait_agent|interrupt_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__wait_agent|multi_agent_v1__close_agent", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh post-tool" }] }
|
|
13
|
+
{ "matcher": "Agent|Bash|Edit|Skill|Write|collaboration\\.spawn_agent|collaboration\\.wait_agent|collaboration\\.interrupt_agent|collaborationspawn_agent|collaborationwait_agent|collaborationinterrupt_agent|spawn_agent|wait_agent|interrupt_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__wait_agent|multi_agent_v1__close_agent", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh post-tool" }] }
|
|
14
14
|
],
|
|
15
15
|
"SubagentStop": [
|
|
16
16
|
{ "matcher": "^wr-risk-scorer:", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh subagent-stop" }] }
|
|
@@ -85,7 +85,7 @@ if messages:
|
|
|
85
85
|
run_hook risk-score-mark.sh
|
|
86
86
|
run_hook risk-slide-marker.sh
|
|
87
87
|
;;
|
|
88
|
-
collaborationspawn_agent|collaborationwait_agent|collaborationinterrupt_agent|spawn_agent|wait_agent|interrupt_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__wait_agent|multi_agent_v1__close_agent)
|
|
88
|
+
collaboration.spawn_agent|collaboration.wait_agent|collaboration.interrupt_agent|collaborationspawn_agent|collaborationwait_agent|collaborationinterrupt_agent|spawn_agent|wait_agent|interrupt_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__wait_agent|multi_agent_v1__close_agent)
|
|
89
89
|
printf '%s' "$INPUT" | node "$SCRIPT_DIR/codex-agent-completion.mjs"
|
|
90
90
|
;;
|
|
91
91
|
Bash)
|
package/package.json
CHANGED