htmlgraph 0.26.15__py3-none-any.whl → 0.26.17__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
@@ -95,7 +95,7 @@ from htmlgraph.types import (
95
95
  )
96
96
  from htmlgraph.work_type_utils import infer_work_type, infer_work_type_from_id
97
97
 
98
- __version__ = "0.26.15"
98
+ __version__ = "0.26.17"
99
99
  __all__ = [
100
100
  # Exceptions
101
101
  "HtmlGraphError",
@@ -738,6 +738,7 @@ def track_event(hook_type: str, hook_input: dict[str, Any]) -> dict[str, Any]:
738
738
  # lose the parent_event_id linkage.
739
739
  subagent_type = None
740
740
  parent_session_id = None
741
+ task_event_id_from_db = None # Will be set by Method 1 if found
741
742
  hook_session_id = hook_input.get("session_id") or hook_input.get("sessionId")
742
743
 
743
744
  if db and db.connection and hook_session_id:
@@ -762,9 +763,38 @@ def track_event(hook_type: str, hook_input: dict[str, Any]) -> dict[str, Any]:
762
763
  else:
763
764
  subagent_type = "general-purpose" # Default if format unexpected
764
765
 
766
+ # CRITICAL FIX: When Method 1 succeeds, also find the task_delegation event!
767
+ # This ensures parent_activity_id will use the task event, not fall back to UserQuery
768
+ try:
769
+ cursor.execute(
770
+ """
771
+ SELECT event_id
772
+ FROM agent_events
773
+ WHERE event_type = 'task_delegation'
774
+ AND subagent_type = ?
775
+ AND status = 'started'
776
+ AND session_id = ?
777
+ ORDER BY timestamp DESC
778
+ LIMIT 1
779
+ """,
780
+ (subagent_type, parent_session_id),
781
+ )
782
+ task_row = cursor.fetchone()
783
+ if task_row:
784
+ task_event_id_from_db = task_row[0]
785
+ print(
786
+ f"DEBUG Method 1: Found task_delegation={task_event_id_from_db} for subagent {subagent_type}",
787
+ file=sys.stderr,
788
+ )
789
+ except Exception as e:
790
+ print(
791
+ f"DEBUG: Error finding task_delegation for Method 1: {e}",
792
+ file=sys.stderr,
793
+ )
794
+
765
795
  print(
766
796
  f"DEBUG subagent persistence: Found current session as subagent in sessions table: "
767
- f"type={subagent_type}, parent_session={parent_session_id}",
797
+ f"type={subagent_type}, parent_session={parent_session_id}, task_event={task_event_id_from_db}",
768
798
  file=sys.stderr,
769
799
  )
770
800
  except Exception as e:
@@ -784,6 +814,9 @@ def track_event(hook_type: str, hook_input: dict[str, Any]) -> dict[str, Any]:
784
814
  # NOTE: Claude Code passes the SAME session_id to parent and subagent, so we CAN'T use
785
815
  # session_id to distinguish them. Instead, look for the most recent task_delegation event
786
816
  # and if found with status='started', we ARE the subagent.
817
+ #
818
+ # CRITICAL FIX: The actual PARENT session is hook_session_id (what Claude Code passes),
819
+ # NOT the session_id from the task_delegation event (which is the same as current).
787
820
  task_event_id_from_db = None # Track this for later use as parent_event_id
788
821
  if not subagent_type and db and db.connection:
789
822
  try:
@@ -806,7 +839,10 @@ def track_event(hook_type: str, hook_input: dict[str, Any]) -> dict[str, Any]:
806
839
  # If we found an active task_delegation, we're running as a subagent
807
840
  # (Claude Code uses the same session_id for both parent and subagent)
808
841
  subagent_type = detected_subagent_type or "general-purpose"
809
- parent_session_id = parent_sess
842
+ # IMPORTANT: Use the hook_session_id as parent, not parent_sess!
843
+ # The parent_sess from task_delegation is the same as current session
844
+ # (Claude Code reuses session_id). The actual parent is hook_session_id.
845
+ parent_session_id = hook_session_id
810
846
  task_event_id_from_db = (
811
847
  task_event_id # Store for later use as parent_event_id
812
848
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: htmlgraph
3
- Version: 0.26.15
3
+ Version: 0.26.17
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=lbwP3tJgZg5ZD8OljSA3yJcTwB8HUqxD199BKoiMNB8,5718
1
+ htmlgraph/__init__.py,sha256=8NssRZ_s0HFZ69J27yuvYBZshbmq3uHoUSsTyvdO4Kw,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
@@ -192,7 +192,7 @@ htmlgraph/hooks/cigs_pretool_enforcer.py,sha256=Lyp4DDaw_sVHEcW-kzdegldyfXjvVD25
192
192
  htmlgraph/hooks/concurrent_sessions.py,sha256=qOiwDfynphVG0-2pVBakEzOwMORU8ebN1gMjcN4S0z0,6476
193
193
  htmlgraph/hooks/context.py,sha256=tJ4dIL8uTFHyqyuuMc-ETDuOikeD5cN3Mdjmfg6W0HE,13108
194
194
  htmlgraph/hooks/drift_handler.py,sha256=QckL5U5ooku51kI6mppGLsXzaKVt1Yx5uNu-iXZrgSk,17602
195
- htmlgraph/hooks/event_tracker.py,sha256=en7voeFYRiixOpJn-h99fMH6fEitj2DiJJ6tIrYvGBc,46344
195
+ htmlgraph/hooks/event_tracker.py,sha256=tSlgrWA9KEQVJDGy_hF6DfRdKaedrqHs9m7Xir_VOUs,48231
196
196
  htmlgraph/hooks/git_commands.py,sha256=NPzthfzGJ_bkDi7soehHOxI9FLL-6BL8Tie9Byb_zf4,4803
197
197
  htmlgraph/hooks/hooks-config.example.json,sha256=tXpk-U-FZzGOoNJK2uiDMbIHCYEHA794J-El0fBwkqg,197
198
198
  htmlgraph/hooks/installer.py,sha256=nOctCFDEV7BEh7ZzxNY-apu1KZG0SHPMq74UPIOChqY,11756
@@ -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.15.data/data/htmlgraph/dashboard.html,sha256=MUT6SaYnazoyDcvHz5hN1omYswyIoUfeoZLf2M_iblo,251268
256
- htmlgraph-0.26.15.data/data/htmlgraph/styles.css,sha256=oDUSC8jG-V-hKojOBO9J88hxAeY2wJrBYTq0uCwX_Y4,7135
257
- htmlgraph-0.26.15.data/data/htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
258
- htmlgraph-0.26.15.data/data/htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
259
- htmlgraph-0.26.15.data/data/htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
260
- htmlgraph-0.26.15.dist-info/METADATA,sha256=_nK1I_FlE2APgcbSLEQNm59-GzD3H-TCA90lEMXTYN0,10237
261
- htmlgraph-0.26.15.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
262
- htmlgraph-0.26.15.dist-info/entry_points.txt,sha256=Wmdo5cx8pt6NoMsssVE2mZH1CZLSUsrg_3iSWatiyn0,103
263
- htmlgraph-0.26.15.dist-info/RECORD,,
255
+ htmlgraph-0.26.17.data/data/htmlgraph/dashboard.html,sha256=MUT6SaYnazoyDcvHz5hN1omYswyIoUfeoZLf2M_iblo,251268
256
+ htmlgraph-0.26.17.data/data/htmlgraph/styles.css,sha256=oDUSC8jG-V-hKojOBO9J88hxAeY2wJrBYTq0uCwX_Y4,7135
257
+ htmlgraph-0.26.17.data/data/htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
258
+ htmlgraph-0.26.17.data/data/htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
259
+ htmlgraph-0.26.17.data/data/htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
260
+ htmlgraph-0.26.17.dist-info/METADATA,sha256=DQseSEEJx0CyN8Y-3NcndcjbkwFLX6yGPbr5TEMWep8,10237
261
+ htmlgraph-0.26.17.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
262
+ htmlgraph-0.26.17.dist-info/entry_points.txt,sha256=Wmdo5cx8pt6NoMsssVE2mZH1CZLSUsrg_3iSWatiyn0,103
263
+ htmlgraph-0.26.17.dist-info/RECORD,,