htmlgraph 0.26.21__py3-none-any.whl → 0.26.22__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 +1 -1
- htmlgraph/hooks/subagent_stop.py +65 -6
- {htmlgraph-0.26.21.dist-info → htmlgraph-0.26.22.dist-info}/METADATA +1 -1
- {htmlgraph-0.26.21.dist-info → htmlgraph-0.26.22.dist-info}/RECORD +11 -11
- {htmlgraph-0.26.21.data → htmlgraph-0.26.22.data}/data/htmlgraph/dashboard.html +0 -0
- {htmlgraph-0.26.21.data → htmlgraph-0.26.22.data}/data/htmlgraph/styles.css +0 -0
- {htmlgraph-0.26.21.data → htmlgraph-0.26.22.data}/data/htmlgraph/templates/AGENTS.md.template +0 -0
- {htmlgraph-0.26.21.data → htmlgraph-0.26.22.data}/data/htmlgraph/templates/CLAUDE.md.template +0 -0
- {htmlgraph-0.26.21.data → htmlgraph-0.26.22.data}/data/htmlgraph/templates/GEMINI.md.template +0 -0
- {htmlgraph-0.26.21.dist-info → htmlgraph-0.26.22.dist-info}/WHEEL +0 -0
- {htmlgraph-0.26.21.dist-info → htmlgraph-0.26.22.dist-info}/entry_points.txt +0 -0
htmlgraph/__init__.py
CHANGED
htmlgraph/hooks/subagent_stop.py
CHANGED
|
@@ -204,6 +204,52 @@ def get_parent_event_start_time(db_path: str, parent_event_id: str) -> str | Non
|
|
|
204
204
|
return None
|
|
205
205
|
|
|
206
206
|
|
|
207
|
+
def get_parent_event_from_db(db_path: str) -> str | None:
|
|
208
|
+
"""
|
|
209
|
+
Query database for the most recent task_delegation event.
|
|
210
|
+
|
|
211
|
+
Used when HTMLGRAPH_PARENT_EVENT environment variable is not available
|
|
212
|
+
(due to inter-process communication limitations).
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
db_path: Path to SQLite database
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
Parent event ID (evt-XXXXX) or None if not found
|
|
219
|
+
"""
|
|
220
|
+
try:
|
|
221
|
+
conn = sqlite3.connect(db_path)
|
|
222
|
+
cursor = conn.cursor()
|
|
223
|
+
|
|
224
|
+
# Query for the most recent task_delegation with status='started'
|
|
225
|
+
# This is the task that spawned the current subagent
|
|
226
|
+
query = """
|
|
227
|
+
SELECT event_id FROM agent_events
|
|
228
|
+
WHERE event_type = 'task_delegation'
|
|
229
|
+
AND status = 'started'
|
|
230
|
+
ORDER BY timestamp DESC
|
|
231
|
+
LIMIT 1
|
|
232
|
+
"""
|
|
233
|
+
|
|
234
|
+
cursor.execute(query)
|
|
235
|
+
result = cursor.fetchone()
|
|
236
|
+
conn.close()
|
|
237
|
+
|
|
238
|
+
if result:
|
|
239
|
+
parent_event_id: str = result[0]
|
|
240
|
+
logger.debug(
|
|
241
|
+
f"Found parent task_delegation from database: {parent_event_id}"
|
|
242
|
+
)
|
|
243
|
+
return parent_event_id
|
|
244
|
+
|
|
245
|
+
logger.debug("No active task_delegation found in database")
|
|
246
|
+
return None
|
|
247
|
+
|
|
248
|
+
except Exception as e:
|
|
249
|
+
logger.warning(f"Error querying for parent event: {e}")
|
|
250
|
+
return None
|
|
251
|
+
|
|
252
|
+
|
|
207
253
|
def handle_subagent_stop(hook_input: dict[str, Any]) -> dict[str, Any]:
|
|
208
254
|
"""
|
|
209
255
|
Handle SubagentStop hook event.
|
|
@@ -222,14 +268,13 @@ def handle_subagent_stop(hook_input: dict[str, Any]) -> dict[str, Any]:
|
|
|
222
268
|
Returns:
|
|
223
269
|
Response: {"continue": True} with optional context
|
|
224
270
|
"""
|
|
225
|
-
#
|
|
271
|
+
# Try to get parent event ID from environment (set by PreToolUse hook)
|
|
226
272
|
parent_event_id = get_parent_event_id()
|
|
227
273
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
# Get project directory and database path
|
|
274
|
+
# If not available in environment, query database
|
|
275
|
+
# (environment variables may not be inherited across subagent process boundary)
|
|
276
|
+
# Get project directory and database path (reuse for both env and db lookup)
|
|
277
|
+
db_path = None
|
|
233
278
|
try:
|
|
234
279
|
from htmlgraph.config import get_database_path
|
|
235
280
|
|
|
@@ -244,6 +289,20 @@ def handle_subagent_stop(hook_input: dict[str, Any]) -> dict[str, Any]:
|
|
|
244
289
|
logger.warning(f"Error resolving database path: {e}")
|
|
245
290
|
return {"continue": True}
|
|
246
291
|
|
|
292
|
+
# If parent event ID not in environment, query database
|
|
293
|
+
if not parent_event_id:
|
|
294
|
+
logger.debug("Parent event ID not in environment, querying database...")
|
|
295
|
+
try:
|
|
296
|
+
parent_event_id = get_parent_event_from_db(db_path)
|
|
297
|
+
except Exception as e:
|
|
298
|
+
logger.debug(f"Could not query database for parent event: {e}")
|
|
299
|
+
|
|
300
|
+
if not parent_event_id:
|
|
301
|
+
logger.debug(
|
|
302
|
+
"No parent event ID found (env or db), skipping subagent stop tracking"
|
|
303
|
+
)
|
|
304
|
+
return {"continue": True}
|
|
305
|
+
|
|
247
306
|
# Get parent event start time
|
|
248
307
|
parent_start_time = get_parent_event_start_time(db_path, parent_event_id)
|
|
249
308
|
if not parent_start_time:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: htmlgraph
|
|
3
|
-
Version: 0.26.
|
|
3
|
+
Version: 0.26.22
|
|
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=
|
|
1
|
+
htmlgraph/__init__.py,sha256=H-A0C-BAFe6wcx8Xx5ZPkPTWahjn09_8TttAyDthOs4,5718
|
|
2
2
|
htmlgraph/agent_detection.py,sha256=wEmrDv4hssPX2OkEnJZBHPbalxcaloiJF_hOOow_5WE,3511
|
|
3
3
|
htmlgraph/agent_registry.py,sha256=Usa_35by7p5gtpvHO7K3AcGimnorw-FzgPVa3cWTQ58,9448
|
|
4
4
|
htmlgraph/agents.py,sha256=Yvu6x1nOfrW2WhRTAHiCuSpvqoVJXx1Mkzd59kwEczw,33466
|
|
@@ -212,7 +212,7 @@ htmlgraph/hooks/session_handler.py,sha256=Kft-rpSOnAYXPUzvujhWhy8TeWzzjTw0Rz_O-y
|
|
|
212
212
|
htmlgraph/hooks/session_summary.py,sha256=t-7VZP4BcQQS3213xZBO9ZZvuMcT3K64ZUymZTx1FCY,13055
|
|
213
213
|
htmlgraph/hooks/state_manager.py,sha256=ni86zHChSqzlr2CnDoTDwJ9a_zbNqRlPIdQkhLIUEKQ,17645
|
|
214
214
|
htmlgraph/hooks/subagent_detection.py,sha256=SQBksApkGniCnsf8_l3TNoH9l9Kvc50ruKGc3y3wtN0,5737
|
|
215
|
-
htmlgraph/hooks/subagent_stop.py,sha256
|
|
215
|
+
htmlgraph/hooks/subagent_stop.py,sha256=Gk2ppJaJnnsIRU1MYF5FjcTjAXo4DtrpxVgueEwp_ac,11031
|
|
216
216
|
htmlgraph/hooks/task_enforcer.py,sha256=eXaQaNibUu1ty78t9M46h0Hhw2M1Fi1lnqCpUdsBZ9Y,7927
|
|
217
217
|
htmlgraph/hooks/task_validator.py,sha256=GwEoqL2lptPWQqckkfl0N-Auc7TtHiyRlOf6p7HcoIo,5438
|
|
218
218
|
htmlgraph/hooks/validator.py,sha256=QO1NLdiFB7Uli6XZP_CRYHDGR1r4ujbr282b1d_cDk0,21437
|
|
@@ -252,12 +252,12 @@ htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4be
|
|
|
252
252
|
htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
|
|
253
253
|
htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
|
|
254
254
|
htmlgraph/templates/orchestration-view.html,sha256=DlS7LlcjH0oO_KYILjuF1X42t8QhKLH4F85rkO54alY,10472
|
|
255
|
-
htmlgraph-0.26.
|
|
256
|
-
htmlgraph-0.26.
|
|
257
|
-
htmlgraph-0.26.
|
|
258
|
-
htmlgraph-0.26.
|
|
259
|
-
htmlgraph-0.26.
|
|
260
|
-
htmlgraph-0.26.
|
|
261
|
-
htmlgraph-0.26.
|
|
262
|
-
htmlgraph-0.26.
|
|
263
|
-
htmlgraph-0.26.
|
|
255
|
+
htmlgraph-0.26.22.data/data/htmlgraph/dashboard.html,sha256=MUT6SaYnazoyDcvHz5hN1omYswyIoUfeoZLf2M_iblo,251268
|
|
256
|
+
htmlgraph-0.26.22.data/data/htmlgraph/styles.css,sha256=oDUSC8jG-V-hKojOBO9J88hxAeY2wJrBYTq0uCwX_Y4,7135
|
|
257
|
+
htmlgraph-0.26.22.data/data/htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
|
|
258
|
+
htmlgraph-0.26.22.data/data/htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
|
|
259
|
+
htmlgraph-0.26.22.data/data/htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
|
|
260
|
+
htmlgraph-0.26.22.dist-info/METADATA,sha256=mlyJYCJYPLq4KjSQ3PSqH_p580455T_UV_xg6BD2t0Y,10237
|
|
261
|
+
htmlgraph-0.26.22.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
262
|
+
htmlgraph-0.26.22.dist-info/entry_points.txt,sha256=Wmdo5cx8pt6NoMsssVE2mZH1CZLSUsrg_3iSWatiyn0,103
|
|
263
|
+
htmlgraph-0.26.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{htmlgraph-0.26.21.data → htmlgraph-0.26.22.data}/data/htmlgraph/templates/AGENTS.md.template
RENAMED
|
File without changes
|
{htmlgraph-0.26.21.data → htmlgraph-0.26.22.data}/data/htmlgraph/templates/CLAUDE.md.template
RENAMED
|
File without changes
|
{htmlgraph-0.26.21.data → htmlgraph-0.26.22.data}/data/htmlgraph/templates/GEMINI.md.template
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|