@windyroad/risk-scorer 0.18.4 → 0.18.5

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.
@@ -310,5 +310,5 @@
310
310
  }
311
311
  },
312
312
  "name": "wr-risk-scorer",
313
- "version": "0.18.4"
313
+ "version": "0.18.5"
314
314
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wr-risk-scorer",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "description": "Pipeline risk scoring, commit/push gates, and secret leak detection",
5
5
  "author": {
6
6
  "name": "Windy Road Technology",
@@ -47,9 +47,7 @@ function rememberSpawn(input) {
47
47
  writeFileSync(statePath(input, target), role, "utf8");
48
48
  }
49
49
 
50
- function markCompletion(input) {
51
- const target = input.tool_input?.target;
52
- const output = response(input).previous_status?.completed;
50
+ function markTarget(input, target, output) {
53
51
  if (typeof target !== "string" || typeof output !== "string" || !output) return;
54
52
 
55
53
  const state = statePath(input, target);
@@ -72,6 +70,18 @@ function markCompletion(input) {
72
70
  if (result.status === 0) rmSync(state, { force: true });
73
71
  }
74
72
 
73
+ function markClose(input) {
74
+ markTarget(input, input.tool_input?.target, response(input).previous_status?.completed);
75
+ }
76
+
77
+ function markWait(input) {
78
+ const statuses = response(input).status;
79
+ if (!statuses || typeof statuses !== "object") return;
80
+ for (const [target, status] of Object.entries(statuses)) {
81
+ markTarget(input, target, status?.completed);
82
+ }
83
+ }
84
+
75
85
  let body = "";
76
86
  process.stdin.setEncoding("utf8");
77
87
  for await (const chunk of process.stdin) body += chunk;
@@ -89,5 +99,8 @@ if (["collaborationspawn_agent", "spawn_agent", "multi_agent_v1__spawn_agent"].i
89
99
  rememberSpawn(input);
90
100
  }
91
101
  if (["collaborationinterrupt_agent", "close_agent", "multi_agent_v1__close_agent"].includes(input.tool_name)) {
92
- markCompletion(input);
102
+ markClose(input);
103
+ }
104
+ if (["collaborationwait_agent", "wait_agent", "multi_agent_v1__wait_agent"].includes(input.tool_name)) {
105
+ markWait(input);
93
106
  }
package/hooks/hooks.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "hooks": {
3
3
  "SessionStart": [
4
- { "matcher": "startup", "hooks": [
5
- { "type": "command", "command": "node ${CLAUDE_PLUGIN_ROOT}/scripts/codex-agents.mjs --session-start" },
6
- { "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-scaffold-nudge.sh" }
7
- ] }
4
+ { "matcher": "startup", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh session-start" }] }
8
5
  ],
9
6
  "UserPromptSubmit": [
10
7
  { "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh user-prompt" }] }
@@ -13,7 +10,7 @@
13
10
  { "matcher": "Bash|Edit|Write|ExitPlanMode|EnterPlanMode", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/risk-scorer-dispatch.sh pre-tool" }] }
14
11
  ],
15
12
  "PostToolUse": [
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" }] }
13
+ { "matcher": "Agent|Bash|Edit|Skill|Write|collaborationspawn_agent|collaborationwait_agent|collaborationinterrupt_agent|spawn_agent|wait_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" }] }
17
14
  ]
18
15
  }
19
16
  }
@@ -21,6 +21,31 @@ tool_name() {
21
21
  }
22
22
 
23
23
  case "$EVENT" in
24
+ session-start)
25
+ if ! AGENT_OUTPUT="$(printf '%s' "$INPUT" | node "$SCRIPT_DIR/../scripts/codex-agents.mjs" --session-start 2>/dev/null)"; then
26
+ AGENT_OUTPUT='{"systemMessage":"wr-risk-scorer: Codex agent repair failed; reinstall the plugin."}'
27
+ fi
28
+ if ! NUDGE_OUTPUT="$(printf '%s' "$INPUT" | "$SCRIPT_DIR/risk-scorer-scaffold-nudge.sh" 2>/dev/null)"; then
29
+ NUDGE_OUTPUT=""
30
+ fi
31
+ if [ -n "${CODEX_THREAD_ID:-}" ]; then
32
+ AGENT_OUTPUT="$AGENT_OUTPUT" NUDGE_OUTPUT="$NUDGE_OUTPUT" python3 -c '
33
+ import json, os
34
+ messages = []
35
+ for name in ("AGENT_OUTPUT", "NUDGE_OUTPUT"):
36
+ try:
37
+ message = json.loads(os.environ[name]).get("systemMessage", "")
38
+ except (json.JSONDecodeError, AttributeError):
39
+ message = ""
40
+ if message:
41
+ messages.append(message)
42
+ if messages:
43
+ print(json.dumps({"systemMessage": "\n".join(messages)}))
44
+ '
45
+ else
46
+ [ -z "$NUDGE_OUTPUT" ] || printf '%s\n' "$NUDGE_OUTPUT"
47
+ fi
48
+ ;;
24
49
  user-prompt)
25
50
  run_hook risk-score.sh
26
51
  run_hook staleness-check.sh
@@ -52,7 +77,7 @@ case "$EVENT" in
52
77
  run_hook risk-score-mark.sh
53
78
  run_hook risk-slide-marker.sh
54
79
  ;;
55
- collaborationspawn_agent|collaborationinterrupt_agent|spawn_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__close_agent)
80
+ collaborationspawn_agent|collaborationwait_agent|collaborationinterrupt_agent|spawn_agent|wait_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__wait_agent|multi_agent_v1__close_agent)
56
81
  printf '%s' "$INPUT" | node "$SCRIPT_DIR/codex-agent-completion.mjs"
57
82
  ;;
58
83
  Bash)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/risk-scorer",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "description": "Pipeline risk scoring, commit/push gates, and secret leak detection",
5
5
  "scripts": {
6
6
  "prepack": "node scripts/sync-codex-skills.mjs --pack",