htmlgraph 0.20.1__py3-none-any.whl → 0.20.2__py3-none-any.whl

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.
htmlgraph/__init__.py CHANGED
@@ -84,7 +84,7 @@ from htmlgraph.types import (
84
84
  )
85
85
  from htmlgraph.work_type_utils import infer_work_type, infer_work_type_from_id
86
86
 
87
- __version__ = "0.20.1"
87
+ __version__ = "0.20.2"
88
88
  __all__ = [
89
89
  # Exceptions
90
90
  "HtmlGraphError",
@@ -37,27 +37,48 @@ def run(hook_input: dict[str, Any]) -> dict[str, Any]:
37
37
  Standard hook response: {"continue": True}
38
38
  """
39
39
  try:
40
+ # DEBUG: Log raw hook input to understand structure
41
+ debug_log = Path(".htmlgraph/hook-debug.jsonl")
42
+ debug_log.parent.mkdir(parents=True, exist_ok=True)
43
+ with open(debug_log, "a") as f:
44
+ f.write(
45
+ json.dumps(
46
+ {
47
+ "raw_input": hook_input,
48
+ "keys": list(hook_input.keys()),
49
+ "ts": datetime.now().isoformat(),
50
+ }
51
+ )
52
+ + "\n"
53
+ )
54
+
40
55
  # Extract error information from PostToolUse hook format
41
- tool_name = hook_input.get("name", "unknown")
56
+ # Official PostToolUse uses: tool_name, tool_response
57
+ # Custom hooks may use: name, result
58
+ tool_name = hook_input.get("tool_name") or hook_input.get("name", "unknown")
42
59
  session_id = hook_input.get("session_id", "unknown")
43
60
 
44
61
  # Error message can be in different places depending on tool
45
62
  error_msg = "No error message"
46
63
 
47
- # Check result field first (Bash, Read, etc.)
48
- result = hook_input.get("result", {})
64
+ # Check tool_response field first (official PostToolUse format)
65
+ # Then check result field (custom hook format)
66
+ result = hook_input.get("tool_response") or hook_input.get("result", {})
49
67
  if isinstance(result, dict):
50
68
  if "error" in result:
51
69
  error_msg = result["error"]
52
70
  elif "message" in result:
53
71
  error_msg = result["message"]
72
+ elif isinstance(result, str):
73
+ # Sometimes the error is directly in the result as a string
74
+ error_msg = result
54
75
 
55
76
  # Fallback: check top-level error field
56
77
  if error_msg == "No error message" and "error" in hook_input:
57
78
  error_msg = hook_input["error"]
58
79
 
59
80
  # Last resort: stringify the result if it contains error indicators
60
- if error_msg == "No error message":
81
+ if error_msg == "No error message" and result:
61
82
  result_str = str(result).lower()
62
83
  if any(
63
84
  indicator in result_str
@@ -119,6 +119,8 @@ async def run_error_tracking(hook_input: dict[str, Any]) -> dict[str, Any]:
119
119
  """
120
120
  Track errors to .htmlgraph/errors.jsonl and auto-create debug spikes.
121
121
 
122
+ Only tracks ACTUAL errors, not responses containing the word "error".
123
+
122
124
  Args:
123
125
  hook_input: Hook input with tool execution details
124
126
 
@@ -128,23 +130,26 @@ async def run_error_tracking(hook_input: dict[str, Any]) -> dict[str, Any]:
128
130
  try:
129
131
  loop = asyncio.get_event_loop()
130
132
 
131
- # Check if this is an error (check for error field or non-zero exit code)
133
+ # Check if this is an ACTUAL error
132
134
  has_error = False
133
- tool_response = hook_input.get("result", {}) or hook_input.get(
134
- "tool_response", {}
135
- )
135
+ tool_response = hook_input.get("tool_response") or hook_input.get("result", {})
136
+
137
+ if isinstance(tool_response, dict):
138
+ # Bash: non-empty stderr indicates error
139
+ stderr = tool_response.get("stderr", "")
140
+ if stderr and isinstance(stderr, str) and stderr.strip():
141
+ has_error = True
136
142
 
137
- # Check for explicit error field
138
- if "error" in tool_response or hook_input.get("error"):
139
- has_error = True
143
+ # Explicit error field with content
144
+ error_field = tool_response.get("error")
145
+ if error_field and str(error_field).strip():
146
+ has_error = True
140
147
 
141
- # Check for error indicators in response text
142
- response_text = str(tool_response).lower()
143
- error_indicators = ["error", "failed", "exception", "traceback", "errno"]
144
- if any(indicator in response_text for indicator in error_indicators):
145
- has_error = True
148
+ # success=false flag
149
+ if tool_response.get("success") is False:
150
+ has_error = True
146
151
 
147
- # Only track if there's an error
152
+ # Only track if there's an actual error
148
153
  if has_error:
149
154
  return await loop.run_in_executor(
150
155
  None,
@@ -162,6 +167,9 @@ async def suggest_debugging_resources(hook_input: dict[str, Any]) -> dict[str, A
162
167
  """
163
168
  Suggest debugging resources based on tool results.
164
169
 
170
+ Only triggers on ACTUAL errors, not on responses that happen to contain
171
+ the word "error" in their content.
172
+
165
173
  Args:
166
174
  hook_input: Hook input with tool execution details
167
175
 
@@ -176,11 +184,24 @@ async def suggest_debugging_resources(hook_input: dict[str, Any]) -> dict[str, A
176
184
 
177
185
  suggestions = []
178
186
 
179
- # Check for error indicators in response
180
- response_text = str(tool_response).lower()
181
- error_indicators = ["error", "failed", "exception", "traceback", "errno"]
187
+ # Check for ACTUAL errors (not just text containing "error")
188
+ has_actual_error = False
189
+
190
+ if isinstance(tool_response, dict):
191
+ # Bash: non-empty stderr indicates error
192
+ stderr = tool_response.get("stderr", "")
193
+ if stderr and isinstance(stderr, str) and stderr.strip():
194
+ has_actual_error = True
195
+
196
+ # Explicit error field
197
+ if tool_response.get("error"):
198
+ has_actual_error = True
199
+
200
+ # success=false flag
201
+ if tool_response.get("success") is False:
202
+ has_actual_error = True
182
203
 
183
- if any(indicator in response_text for indicator in error_indicators):
204
+ if has_actual_error:
184
205
  suggestions.append("⚠️ Error detected in tool response")
185
206
  suggestions.append("Debugging resources:")
186
207
  suggestions.append(" 📚 DEBUGGING.md - Systematic debugging guide")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: htmlgraph
3
- Version: 0.20.1
3
+ Version: 0.20.2
4
4
  Summary: HTML is All You Need - Graph database on web standards
5
5
  Project-URL: Homepage, https://github.com/Shakes-tzd/htmlgraph
6
6
  Project-URL: Documentation, https://github.com/Shakes-tzd/htmlgraph#readme
@@ -1,4 +1,4 @@
1
- htmlgraph/__init__.py,sha256=cU2kYZgK1N8DgbQjgZkvH3Ovco-6fAfw0WlTyZSJc1U,4979
1
+ htmlgraph/__init__.py,sha256=ir7qWjOnE7Sc50jVVHFNjiIkxAMkh77WXPpBP58aR_o,4979
2
2
  htmlgraph/agent_detection.py,sha256=PAYo7rU3N_y1cGRd7Dwjh5Wgu-QZ7ENblX_yOzU-gJ0,2749
3
3
  htmlgraph/agent_registry.py,sha256=Usa_35by7p5gtpvHO7K3AcGimnorw-FzgPVa3cWTQ58,9448
4
4
  htmlgraph/agents.py,sha256=Yvu6x1nOfrW2WhRTAHiCuSpvqoVJXx1Mkzd59kwEczw,33466
@@ -92,8 +92,8 @@ htmlgraph/hooks/orchestrator_reflector.py,sha256=j3kZge33m42CEUVYiufiz7mf7Qm4Dim
92
92
  htmlgraph/hooks/post-checkout.sh,sha256=Hsr5hqD54jisGbtqf7-Z-G_b6XNGcee_CZRYaKYzWzU,615
93
93
  htmlgraph/hooks/post-commit.sh,sha256=if65jNGZnEWsZPq_iYDNYunrZ1cmjPUEUbh6_4vfpOE,511
94
94
  htmlgraph/hooks/post-merge.sh,sha256=gq-EeFLhDUVp-J2jyWMBVFcB0pdmH54Wu1SW_Gn-s2I,541
95
- htmlgraph/hooks/post_tool_use_failure.py,sha256=S7dj4yb8z_-3AiAn511K9tAPatkCzw89-5lzLHnLB8E,7454
96
- htmlgraph/hooks/posttooluse.py,sha256=A3s9PfxbBouOHUPZywyPYflfXOqo3XE0Pu7jVHriq6M,10612
95
+ htmlgraph/hooks/post_tool_use_failure.py,sha256=DHkJtuAOg5KSLfFZ1O-kePwaqmtNkbGQSEn4NplzvD8,8381
96
+ htmlgraph/hooks/posttooluse.py,sha256=imrRl29qsywRQW0-ruBbJq-FGYKCkvgbjSvis3U5j50,11261
97
97
  htmlgraph/hooks/pre-commit.sh,sha256=gTpbnHIBFxpAl7-REhXoS0NI4Pmlqo9pQEMEngTAU_A,3865
98
98
  htmlgraph/hooks/pre-push.sh,sha256=rNnkG8YmDtyk7OuJHOcbOYQR3MYFneaG6_w2X-Hl8Hs,660
99
99
  htmlgraph/hooks/pretooluse.py,sha256=Q6wtU_IBIjCd22j7MvZrdd959TdAHx8OovIOnqkwCm0,9606
@@ -107,12 +107,12 @@ htmlgraph/services/claiming.py,sha256=HcrltEJKN72mxuD7fGuXWeh1U0vwhjMvhZcFc02Eiy
107
107
  htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
108
108
  htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
109
109
  htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
110
- htmlgraph-0.20.1.data/data/htmlgraph/dashboard.html,sha256=rkZYjSnPbUuAm35QMpCNWemenYqQTdkkumCX2hhe8Dc,173537
111
- htmlgraph-0.20.1.data/data/htmlgraph/styles.css,sha256=oDUSC8jG-V-hKojOBO9J88hxAeY2wJrBYTq0uCwX_Y4,7135
112
- htmlgraph-0.20.1.data/data/htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
113
- htmlgraph-0.20.1.data/data/htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
114
- htmlgraph-0.20.1.data/data/htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
115
- htmlgraph-0.20.1.dist-info/METADATA,sha256=qPnSbEmxUVxjR6thqIYCZ9VOEi60yFV2x6At4OWK07A,7645
116
- htmlgraph-0.20.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
117
- htmlgraph-0.20.1.dist-info/entry_points.txt,sha256=EaUbjA_bbDwEO_XDLEGMeK8aQP-ZnHiUTkLshyKDyB8,98
118
- htmlgraph-0.20.1.dist-info/RECORD,,
110
+ htmlgraph-0.20.2.data/data/htmlgraph/dashboard.html,sha256=rkZYjSnPbUuAm35QMpCNWemenYqQTdkkumCX2hhe8Dc,173537
111
+ htmlgraph-0.20.2.data/data/htmlgraph/styles.css,sha256=oDUSC8jG-V-hKojOBO9J88hxAeY2wJrBYTq0uCwX_Y4,7135
112
+ htmlgraph-0.20.2.data/data/htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
113
+ htmlgraph-0.20.2.data/data/htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
114
+ htmlgraph-0.20.2.data/data/htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
115
+ htmlgraph-0.20.2.dist-info/METADATA,sha256=13RsfZ3io-sOjZUN1Z7anK1janvvOrfwWF-ETj6ouOM,7645
116
+ htmlgraph-0.20.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
117
+ htmlgraph-0.20.2.dist-info/entry_points.txt,sha256=EaUbjA_bbDwEO_XDLEGMeK8aQP-ZnHiUTkLshyKDyB8,98
118
+ htmlgraph-0.20.2.dist-info/RECORD,,