htmlgraph 0.25.0__py3-none-any.whl → 0.26.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/.htmlgraph/.session-warning-state.json +6 -0
- htmlgraph/.htmlgraph/agents.json +72 -0
- htmlgraph/.htmlgraph/htmlgraph.db +0 -0
- htmlgraph/__init__.py +1 -1
- htmlgraph/api/main.py +252 -47
- htmlgraph/api/templates/dashboard.html +11 -0
- htmlgraph/api/templates/partials/activity-feed.html +517 -8
- htmlgraph/cli.py +1 -1
- htmlgraph/config.py +173 -96
- htmlgraph/dashboard.html +632 -7237
- htmlgraph/db/schema.py +258 -9
- htmlgraph/hooks/.htmlgraph/.session-warning-state.json +6 -0
- htmlgraph/hooks/.htmlgraph/agents.json +72 -0
- htmlgraph/hooks/.htmlgraph/index.sqlite +0 -0
- htmlgraph/hooks/cigs_pretool_enforcer.py +2 -2
- htmlgraph/hooks/concurrent_sessions.py +208 -0
- htmlgraph/hooks/context.py +88 -10
- htmlgraph/hooks/drift_handler.py +24 -20
- htmlgraph/hooks/event_tracker.py +264 -189
- htmlgraph/hooks/orchestrator.py +6 -4
- htmlgraph/hooks/orchestrator_reflector.py +4 -4
- htmlgraph/hooks/pretooluse.py +63 -36
- htmlgraph/hooks/prompt_analyzer.py +14 -25
- htmlgraph/hooks/session_handler.py +123 -69
- htmlgraph/hooks/state_manager.py +7 -4
- htmlgraph/hooks/subagent_stop.py +3 -2
- htmlgraph/hooks/validator.py +15 -11
- htmlgraph/operations/fastapi_server.py +2 -2
- htmlgraph/orchestration/headless_spawner.py +489 -16
- htmlgraph/orchestration/live_events.py +377 -0
- htmlgraph/server.py +100 -203
- htmlgraph-0.26.2.data/data/htmlgraph/dashboard.html +812 -0
- {htmlgraph-0.25.0.dist-info → htmlgraph-0.26.2.dist-info}/METADATA +1 -1
- {htmlgraph-0.25.0.dist-info → htmlgraph-0.26.2.dist-info}/RECORD +40 -32
- htmlgraph-0.25.0.data/data/htmlgraph/dashboard.html +0 -7417
- {htmlgraph-0.25.0.data → htmlgraph-0.26.2.data}/data/htmlgraph/styles.css +0 -0
- {htmlgraph-0.25.0.data → htmlgraph-0.26.2.data}/data/htmlgraph/templates/AGENTS.md.template +0 -0
- {htmlgraph-0.25.0.data → htmlgraph-0.26.2.data}/data/htmlgraph/templates/CLAUDE.md.template +0 -0
- {htmlgraph-0.25.0.data → htmlgraph-0.26.2.data}/data/htmlgraph/templates/GEMINI.md.template +0 -0
- {htmlgraph-0.25.0.dist-info → htmlgraph-0.26.2.dist-info}/WHEEL +0 -0
- {htmlgraph-0.25.0.dist-info → htmlgraph-0.26.2.dist-info}/entry_points.txt +0 -0
htmlgraph/hooks/validator.py
CHANGED
|
@@ -79,7 +79,7 @@ def load_tool_history() -> list[dict]:
|
|
|
79
79
|
data = json.loads(TOOL_HISTORY_FILE.read_text())
|
|
80
80
|
|
|
81
81
|
# Handle both formats: {"history": [...]} and [...] (legacy)
|
|
82
|
-
if isinstance(data, dict):
|
|
82
|
+
if isinstance(data, dict): # type: ignore[arg-type]
|
|
83
83
|
data = data.get("history", [])
|
|
84
84
|
|
|
85
85
|
# Filter to last hour only
|
|
@@ -149,7 +149,7 @@ def detect_optimal_pattern(tool: str, history: list[dict]) -> str | None:
|
|
|
149
149
|
return OPTIMAL_PATTERNS.get(pair)
|
|
150
150
|
|
|
151
151
|
|
|
152
|
-
def get_pattern_guidance(tool: str, history: list[dict]) -> dict:
|
|
152
|
+
def get_pattern_guidance(tool: str, history: list[dict]) -> dict[str, Any]:
|
|
153
153
|
"""Get guidance based on tool patterns."""
|
|
154
154
|
# Check for anti-patterns first
|
|
155
155
|
anti_pattern = detect_anti_pattern(tool, history)
|
|
@@ -192,7 +192,7 @@ def get_session_health_hint(history: list[dict]) -> str | None:
|
|
|
192
192
|
return None
|
|
193
193
|
|
|
194
194
|
|
|
195
|
-
def load_validation_config() -> dict:
|
|
195
|
+
def load_validation_config() -> dict[str, Any]:
|
|
196
196
|
"""Load validation config with defaults."""
|
|
197
197
|
config_path = (
|
|
198
198
|
Path(__file__).parent.parent.parent.parent.parent
|
|
@@ -218,7 +218,9 @@ def load_validation_config() -> dict:
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
|
|
221
|
-
def is_always_allowed(
|
|
221
|
+
def is_always_allowed(
|
|
222
|
+
tool: str, params: dict[str, Any], config: dict[str, Any]
|
|
223
|
+
) -> bool:
|
|
222
224
|
"""Check if tool is always allowed (read-only operations)."""
|
|
223
225
|
# Always-allow tools
|
|
224
226
|
if tool in config.get("always_allow", {}).get("tools", []):
|
|
@@ -234,7 +236,7 @@ def is_always_allowed(tool: str, params: dict, config: dict) -> bool:
|
|
|
234
236
|
return False
|
|
235
237
|
|
|
236
238
|
|
|
237
|
-
def is_direct_htmlgraph_write(tool: str, params: dict) -> tuple[bool, str]:
|
|
239
|
+
def is_direct_htmlgraph_write(tool: str, params: dict[str, Any]) -> tuple[bool, str]:
|
|
238
240
|
"""Check if attempting direct write to .htmlgraph/ (always denied)."""
|
|
239
241
|
if tool not in ["Write", "Edit", "Delete", "NotebookEdit"]:
|
|
240
242
|
return False, ""
|
|
@@ -246,7 +248,7 @@ def is_direct_htmlgraph_write(tool: str, params: dict) -> tuple[bool, str]:
|
|
|
246
248
|
return False, ""
|
|
247
249
|
|
|
248
250
|
|
|
249
|
-
def is_sdk_command(tool: str, params: dict, config: dict) -> bool:
|
|
251
|
+
def is_sdk_command(tool: str, params: dict[str, Any], config: dict[str, Any]) -> bool:
|
|
250
252
|
"""Check if Bash command is an SDK command."""
|
|
251
253
|
if tool != "Bash":
|
|
252
254
|
return False
|
|
@@ -259,7 +261,9 @@ def is_sdk_command(tool: str, params: dict, config: dict) -> bool:
|
|
|
259
261
|
return False
|
|
260
262
|
|
|
261
263
|
|
|
262
|
-
def is_code_operation(
|
|
264
|
+
def is_code_operation(
|
|
265
|
+
tool: str, params: dict[str, Any], config: dict[str, Any]
|
|
266
|
+
) -> bool:
|
|
263
267
|
"""Check if operation modifies code."""
|
|
264
268
|
# Direct file operations
|
|
265
269
|
if tool in config.get("code_operations", {}).get("tools", []):
|
|
@@ -288,7 +292,7 @@ def get_active_work_item() -> dict | None:
|
|
|
288
292
|
return None
|
|
289
293
|
|
|
290
294
|
|
|
291
|
-
def check_orchestrator_violation(tool: str, params: dict) -> dict | None:
|
|
295
|
+
def check_orchestrator_violation(tool: str, params: dict[str, Any]) -> dict | None:
|
|
292
296
|
"""
|
|
293
297
|
Check if operation violates orchestrator mode rules.
|
|
294
298
|
|
|
@@ -363,8 +367,8 @@ def check_orchestrator_violation(tool: str, params: dict) -> dict | None:
|
|
|
363
367
|
|
|
364
368
|
|
|
365
369
|
def validate_tool_call(
|
|
366
|
-
tool: str, params: dict, config: dict, history: list[dict]
|
|
367
|
-
) -> dict:
|
|
370
|
+
tool: str, params: dict[str, Any], config: dict[str, Any], history: list[dict]
|
|
371
|
+
) -> dict[str, Any]:
|
|
368
372
|
"""
|
|
369
373
|
Validate tool call and return GUIDANCE with active learning.
|
|
370
374
|
|
|
@@ -375,7 +379,7 @@ def validate_tool_call(
|
|
|
375
379
|
history: Tool usage history (from load_tool_history())
|
|
376
380
|
|
|
377
381
|
Returns:
|
|
378
|
-
dict: {"decision": "allow" | "block", "guidance": "...", "suggestion": "...", ...}
|
|
382
|
+
dict[str, Any]: {"decision": "allow" | "block", "guidance": "...", "suggestion": "...", ...}
|
|
379
383
|
All operations are ALLOWED unless blocked for safety reasons.
|
|
380
384
|
|
|
381
385
|
Example:
|
|
@@ -79,12 +79,12 @@ def start_fastapi_server(
|
|
|
79
79
|
if db_path is None:
|
|
80
80
|
# Check for project-local database first
|
|
81
81
|
project_dir = _resolve_project_dir()
|
|
82
|
-
project_db = Path(project_dir) / ".htmlgraph" / "
|
|
82
|
+
project_db = Path(project_dir) / ".htmlgraph" / "htmlgraph.db"
|
|
83
83
|
if project_db.exists():
|
|
84
84
|
db_path = str(project_db) # Use project-local database
|
|
85
85
|
else:
|
|
86
86
|
db_path = str(
|
|
87
|
-
Path.home() / ".htmlgraph" / "
|
|
87
|
+
Path.home() / ".htmlgraph" / "htmlgraph.db"
|
|
88
88
|
) # Fall back to home
|
|
89
89
|
|
|
90
90
|
# Ensure database exists
|