@windyroad/risk-scorer 0.18.0 → 0.18.1
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.
|
@@ -32,11 +32,18 @@ function statePath(input, target) {
|
|
|
32
32
|
return join(riskDir(input.session_id), `codex-agent-${Buffer.from(target).toString("base64url")}`);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
function spawnTarget(input) {
|
|
36
|
+
const result = response(input);
|
|
37
|
+
return result.agent_id ?? result.task_name;
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
function rememberSpawn(input) {
|
|
36
41
|
const role = input.tool_input?.agent_type;
|
|
37
|
-
const target =
|
|
38
|
-
if (
|
|
42
|
+
const target = spawnTarget(input);
|
|
43
|
+
if (typeof target !== "string" || !target) return;
|
|
39
44
|
mkdirSync(riskDir(input.session_id), { recursive: true });
|
|
45
|
+
rmSync(statePath(input, target), { force: true });
|
|
46
|
+
if (!riskAgentRoles.has(role)) return;
|
|
40
47
|
writeFileSync(statePath(input, target), role, "utf8");
|
|
41
48
|
}
|
|
42
49
|
|
|
@@ -78,5 +85,9 @@ try {
|
|
|
78
85
|
|
|
79
86
|
if (!/^[A-Za-z0-9-]+$/.test(input.session_id || "")) process.exit(0);
|
|
80
87
|
|
|
81
|
-
if (
|
|
82
|
-
|
|
88
|
+
if (["collaborationspawn_agent", "spawn_agent", "multi_agent_v1__spawn_agent"].includes(input.tool_name)) {
|
|
89
|
+
rememberSpawn(input);
|
|
90
|
+
}
|
|
91
|
+
if (["collaborationinterrupt_agent", "close_agent", "multi_agent_v1__close_agent"].includes(input.tool_name)) {
|
|
92
|
+
markCompletion(input);
|
|
93
|
+
}
|
package/hooks/hooks.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{ "matcher": "Bash|Edit|Write|ExitPlanMode|EnterPlanMode", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh pre-tool" }] }
|
|
14
14
|
],
|
|
15
15
|
"PostToolUse": [
|
|
16
|
-
{ "matcher": "Agent|Bash|Edit|Skill|Write|collaborationspawn_agent|collaborationinterrupt_agent", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh post-tool" }] }
|
|
16
|
+
{ "matcher": "Agent|Bash|Edit|Skill|Write|collaborationspawn_agent|collaborationinterrupt_agent|spawn_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__close_agent", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh post-tool" }] }
|
|
17
17
|
]
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -52,7 +52,7 @@ case "$EVENT" in
|
|
|
52
52
|
run_hook risk-score-mark.sh
|
|
53
53
|
run_hook risk-slide-marker.sh
|
|
54
54
|
;;
|
|
55
|
-
collaborationspawn_agent|collaborationinterrupt_agent)
|
|
55
|
+
collaborationspawn_agent|collaborationinterrupt_agent|spawn_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__close_agent)
|
|
56
56
|
printf '%s' "$INPUT" | node "$SCRIPT_DIR/codex-agent-completion.mjs"
|
|
57
57
|
;;
|
|
58
58
|
Bash)
|
package/package.json
CHANGED