htmlgraph 0.26.9__py3-none-any.whl → 0.26.11__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.9"
98
+ __version__ = "0.26.11"
99
99
  __all__ = [
100
100
  # Exceptions
101
101
  "HtmlGraphError",
@@ -770,6 +770,10 @@ def track_event(hook_type: str, hook_input: dict[str, Any]) -> dict[str, Any]:
770
770
  # Method 3: Database detection of active task_delegation events
771
771
  # CRITICAL: When Task() subprocess is launched, environment variables don't propagate
772
772
  # So we must query the database for active task_delegation events to detect subagent context
773
+ # NOTE: Claude Code passes the SAME session_id to parent and subagent, so we CAN'T use
774
+ # session_id to distinguish them. Instead, look for the most recent task_delegation event
775
+ # and if found with status='started', we ARE the subagent.
776
+ task_event_id_from_db = None # Track this for later use as parent_event_id
773
777
  if not subagent_type and db and db.connection:
774
778
  try:
775
779
  cursor = db.connection.cursor()
@@ -788,17 +792,19 @@ def track_event(hook_type: str, hook_input: dict[str, Any]) -> dict[str, Any]:
788
792
  row = cursor.fetchone()
789
793
  if row:
790
794
  task_event_id, detected_subagent_type, parent_sess = row
791
- # Only treat as subagent if we're in a DIFFERENT session
792
- # (same session = we're the orchestrator running Task())
793
- if hook_session_id and hook_session_id != parent_sess:
794
- subagent_type = detected_subagent_type or "general-purpose"
795
- parent_session_id = parent_sess
796
- print(
797
- f"DEBUG subagent detection (database): Detected active task_delegation "
798
- f"type={subagent_type}, parent_session={parent_session_id}, "
799
- f"parent_event={task_event_id}",
800
- file=sys.stderr,
801
- )
795
+ # If we found an active task_delegation, we're running as a subagent
796
+ # (Claude Code uses the same session_id for both parent and subagent)
797
+ subagent_type = detected_subagent_type or "general-purpose"
798
+ parent_session_id = parent_sess
799
+ task_event_id_from_db = (
800
+ task_event_id # Store for later use as parent_event_id
801
+ )
802
+ print(
803
+ f"DEBUG subagent detection (database): Detected active task_delegation "
804
+ f"type={subagent_type}, parent_session={parent_session_id}, "
805
+ f"parent_event={task_event_id}",
806
+ file=sys.stderr,
807
+ )
802
808
  except Exception as e:
803
809
  print(
804
810
  f"DEBUG: Error detecting subagent from database: {e}",
@@ -1037,6 +1043,10 @@ def track_event(hook_type: str, hook_input: dict[str, Any]) -> dict[str, Any]:
1037
1043
  )
1038
1044
  if env_parent:
1039
1045
  parent_activity_id = env_parent
1046
+ # If we detected a Task delegation event via database detection (Method 3),
1047
+ # use that as the parent for all tool calls within the subagent
1048
+ elif task_event_id_from_db:
1049
+ parent_activity_id = task_event_id_from_db
1040
1050
  # Query database for most recent UserQuery event as parent
1041
1051
  # Database is the single source of truth for parent-child linking
1042
1052
  elif db:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: htmlgraph
3
- Version: 0.26.9
3
+ Version: 0.26.11
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=mZ6F5k0z-ycUNJBv49V5hypqSF0-MRSu-MzvBhz0u0Q,5717
1
+ htmlgraph/__init__.py,sha256=HsIT0c_YqDUgtAszBUKQ-_xrig5vkyQQSujdRfTWKvg,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
@@ -189,7 +189,7 @@ htmlgraph/hooks/cigs_pretool_enforcer.py,sha256=Lyp4DDaw_sVHEcW-kzdegldyfXjvVD25
189
189
  htmlgraph/hooks/concurrent_sessions.py,sha256=qOiwDfynphVG0-2pVBakEzOwMORU8ebN1gMjcN4S0z0,6476
190
190
  htmlgraph/hooks/context.py,sha256=tJ4dIL8uTFHyqyuuMc-ETDuOikeD5cN3Mdjmfg6W0HE,13108
191
191
  htmlgraph/hooks/drift_handler.py,sha256=QckL5U5ooku51kI6mppGLsXzaKVt1Yx5uNu-iXZrgSk,17602
192
- htmlgraph/hooks/event_tracker.py,sha256=zoCyTol3833Kji_v079t9i7kIB6PvsGqUJ6hZsr-x6o,45283
192
+ htmlgraph/hooks/event_tracker.py,sha256=A58ByxOR4xX014pbUuGtfkN8KS22zkb9ajkTzNmp6mw,45916
193
193
  htmlgraph/hooks/git_commands.py,sha256=NPzthfzGJ_bkDi7soehHOxI9FLL-6BL8Tie9Byb_zf4,4803
194
194
  htmlgraph/hooks/hooks-config.example.json,sha256=tXpk-U-FZzGOoNJK2uiDMbIHCYEHA794J-El0fBwkqg,197
195
195
  htmlgraph/hooks/installer.py,sha256=nOctCFDEV7BEh7ZzxNY-apu1KZG0SHPMq74UPIOChqY,11756
@@ -249,12 +249,12 @@ htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4be
249
249
  htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
250
250
  htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
251
251
  htmlgraph/templates/orchestration-view.html,sha256=DlS7LlcjH0oO_KYILjuF1X42t8QhKLH4F85rkO54alY,10472
252
- htmlgraph-0.26.9.data/data/htmlgraph/dashboard.html,sha256=MUT6SaYnazoyDcvHz5hN1omYswyIoUfeoZLf2M_iblo,251268
253
- htmlgraph-0.26.9.data/data/htmlgraph/styles.css,sha256=oDUSC8jG-V-hKojOBO9J88hxAeY2wJrBYTq0uCwX_Y4,7135
254
- htmlgraph-0.26.9.data/data/htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
255
- htmlgraph-0.26.9.data/data/htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
256
- htmlgraph-0.26.9.data/data/htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
257
- htmlgraph-0.26.9.dist-info/METADATA,sha256=8XXIUBNfu_ztwt_BiWbrjxiCiB3VJ_1tVY5Bj0EvwBY,10236
258
- htmlgraph-0.26.9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
259
- htmlgraph-0.26.9.dist-info/entry_points.txt,sha256=Wmdo5cx8pt6NoMsssVE2mZH1CZLSUsrg_3iSWatiyn0,103
260
- htmlgraph-0.26.9.dist-info/RECORD,,
252
+ htmlgraph-0.26.11.data/data/htmlgraph/dashboard.html,sha256=MUT6SaYnazoyDcvHz5hN1omYswyIoUfeoZLf2M_iblo,251268
253
+ htmlgraph-0.26.11.data/data/htmlgraph/styles.css,sha256=oDUSC8jG-V-hKojOBO9J88hxAeY2wJrBYTq0uCwX_Y4,7135
254
+ htmlgraph-0.26.11.data/data/htmlgraph/templates/AGENTS.md.template,sha256=f96h7V6ygwj-v-fanVI48eYMxR6t_se4bet1H4ZsDpI,7642
255
+ htmlgraph-0.26.11.data/data/htmlgraph/templates/CLAUDE.md.template,sha256=h1kG2hTX2XYig2KszsHBfzrwa_4Cfcq2Pj4SwqzeDlM,1984
256
+ htmlgraph-0.26.11.data/data/htmlgraph/templates/GEMINI.md.template,sha256=gAGzE53Avki87BM_otqy5HdcYCoLsHgqaKjVzNzPMX8,1622
257
+ htmlgraph-0.26.11.dist-info/METADATA,sha256=MVSOjRN-DY1bw42RuoiFLeZghjYcwmYCPAcKK0TehlA,10237
258
+ htmlgraph-0.26.11.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
259
+ htmlgraph-0.26.11.dist-info/entry_points.txt,sha256=Wmdo5cx8pt6NoMsssVE2mZH1CZLSUsrg_3iSWatiyn0,103
260
+ htmlgraph-0.26.11.dist-info/RECORD,,