htmlgraph 0.26.25__py3-none-any.whl → 0.27.1__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 +23 -1
- htmlgraph/__init__.pyi +123 -0
- htmlgraph/agent_registry.py +2 -1
- htmlgraph/analytics/cli.py +3 -3
- htmlgraph/analytics/cost_analyzer.py +5 -1
- htmlgraph/analytics/cost_monitor.py +664 -0
- htmlgraph/analytics/cross_session.py +13 -9
- htmlgraph/analytics/dependency.py +10 -6
- htmlgraph/analytics/strategic/__init__.py +80 -0
- htmlgraph/analytics/strategic/cost_optimizer.py +611 -0
- htmlgraph/analytics/strategic/pattern_detector.py +876 -0
- htmlgraph/analytics/strategic/preference_manager.py +709 -0
- htmlgraph/analytics/strategic/suggestion_engine.py +747 -0
- htmlgraph/analytics/work_type.py +15 -11
- htmlgraph/analytics_index.py +2 -1
- htmlgraph/api/cost_alerts_websocket.py +416 -0
- htmlgraph/api/main.py +167 -62
- htmlgraph/api/websocket.py +538 -0
- htmlgraph/attribute_index.py +2 -1
- htmlgraph/builders/base.py +2 -1
- htmlgraph/builders/bug.py +2 -1
- htmlgraph/builders/chore.py +2 -1
- htmlgraph/builders/epic.py +2 -1
- htmlgraph/builders/feature.py +2 -1
- htmlgraph/builders/insight.py +2 -1
- htmlgraph/builders/metric.py +2 -1
- htmlgraph/builders/pattern.py +2 -1
- htmlgraph/builders/phase.py +2 -1
- htmlgraph/builders/spike.py +2 -1
- htmlgraph/builders/track.py +2 -1
- htmlgraph/cli/analytics.py +2 -1
- htmlgraph/cli/base.py +2 -1
- htmlgraph/cli/core.py +2 -1
- htmlgraph/cli/main.py +2 -1
- htmlgraph/cli/models.py +2 -1
- htmlgraph/cli/templates/cost_dashboard.py +2 -1
- htmlgraph/cli/work/__init__.py +2 -1
- htmlgraph/cli/work/browse.py +2 -1
- htmlgraph/cli/work/features.py +2 -1
- htmlgraph/cli/work/orchestration.py +2 -1
- htmlgraph/cli/work/report.py +2 -1
- htmlgraph/cli/work/sessions.py +2 -1
- htmlgraph/cli/work/snapshot.py +2 -1
- htmlgraph/cli/work/tracks.py +2 -1
- htmlgraph/collections/base.py +10 -5
- htmlgraph/collections/bug.py +2 -1
- htmlgraph/collections/chore.py +2 -1
- htmlgraph/collections/epic.py +2 -1
- htmlgraph/collections/feature.py +2 -1
- htmlgraph/collections/insight.py +2 -1
- htmlgraph/collections/metric.py +2 -1
- htmlgraph/collections/pattern.py +2 -1
- htmlgraph/collections/phase.py +2 -1
- htmlgraph/collections/session.py +12 -7
- htmlgraph/collections/spike.py +6 -1
- htmlgraph/collections/task_delegation.py +7 -2
- htmlgraph/collections/todo.py +2 -1
- htmlgraph/collections/traces.py +15 -10
- htmlgraph/config/cost_models.json +56 -0
- htmlgraph/context_analytics.py +2 -1
- htmlgraph/db/schema.py +67 -6
- htmlgraph/dependency_models.py +2 -1
- htmlgraph/edge_index.py +2 -1
- htmlgraph/event_log.py +83 -64
- htmlgraph/event_migration.py +2 -1
- htmlgraph/file_watcher.py +12 -8
- htmlgraph/find_api.py +2 -1
- htmlgraph/git_events.py +6 -2
- htmlgraph/hooks/cigs_pretool_enforcer.py +5 -1
- htmlgraph/hooks/drift_handler.py +3 -3
- htmlgraph/hooks/event_tracker.py +40 -61
- htmlgraph/hooks/installer.py +5 -1
- htmlgraph/hooks/orchestrator.py +4 -0
- htmlgraph/hooks/orchestrator_reflector.py +4 -0
- htmlgraph/hooks/post_tool_use_failure.py +7 -3
- htmlgraph/hooks/posttooluse.py +4 -0
- htmlgraph/hooks/prompt_analyzer.py +5 -5
- htmlgraph/hooks/session_handler.py +2 -1
- htmlgraph/hooks/session_summary.py +6 -2
- htmlgraph/hooks/validator.py +8 -4
- htmlgraph/ids.py +2 -1
- htmlgraph/learning.py +2 -1
- htmlgraph/mcp_server.py +2 -1
- htmlgraph/operations/analytics.py +2 -1
- htmlgraph/operations/bootstrap.py +2 -1
- htmlgraph/operations/events.py +2 -1
- htmlgraph/operations/fastapi_server.py +2 -1
- htmlgraph/operations/hooks.py +2 -1
- htmlgraph/operations/initialization.py +2 -1
- htmlgraph/operations/server.py +2 -1
- htmlgraph/orchestration/claude_launcher.py +23 -20
- htmlgraph/orchestration/command_builder.py +2 -1
- htmlgraph/orchestration/headless_spawner.py +6 -2
- htmlgraph/orchestration/model_selection.py +7 -3
- htmlgraph/orchestration/plugin_manager.py +24 -19
- htmlgraph/orchestration/spawners/claude.py +5 -2
- htmlgraph/orchestration/spawners/codex.py +12 -19
- htmlgraph/orchestration/spawners/copilot.py +13 -18
- htmlgraph/orchestration/spawners/gemini.py +12 -19
- htmlgraph/orchestration/subprocess_runner.py +6 -3
- htmlgraph/orchestration/task_coordination.py +16 -8
- htmlgraph/orchestrator.py +2 -1
- htmlgraph/parallel.py +2 -1
- htmlgraph/query_builder.py +2 -1
- htmlgraph/reflection.py +2 -1
- htmlgraph/refs.py +2 -1
- htmlgraph/repo_hash.py +2 -1
- htmlgraph/repositories/__init__.py +292 -0
- htmlgraph/repositories/analytics_repository.py +455 -0
- htmlgraph/repositories/analytics_repository_standard.py +628 -0
- htmlgraph/repositories/feature_repository.py +581 -0
- htmlgraph/repositories/feature_repository_htmlfile.py +668 -0
- htmlgraph/repositories/feature_repository_memory.py +607 -0
- htmlgraph/repositories/feature_repository_sqlite.py +858 -0
- htmlgraph/repositories/filter_service.py +620 -0
- htmlgraph/repositories/filter_service_standard.py +445 -0
- htmlgraph/repositories/shared_cache.py +621 -0
- htmlgraph/repositories/shared_cache_memory.py +395 -0
- htmlgraph/repositories/track_repository.py +552 -0
- htmlgraph/repositories/track_repository_htmlfile.py +619 -0
- htmlgraph/repositories/track_repository_memory.py +508 -0
- htmlgraph/repositories/track_repository_sqlite.py +711 -0
- htmlgraph/sdk/__init__.py +398 -0
- htmlgraph/sdk/__init__.pyi +14 -0
- htmlgraph/sdk/analytics/__init__.py +19 -0
- htmlgraph/sdk/analytics/engine.py +155 -0
- htmlgraph/sdk/analytics/helpers.py +178 -0
- htmlgraph/sdk/analytics/registry.py +109 -0
- htmlgraph/sdk/base.py +484 -0
- htmlgraph/sdk/constants.py +216 -0
- htmlgraph/sdk/core.pyi +308 -0
- htmlgraph/sdk/discovery.py +120 -0
- htmlgraph/sdk/help/__init__.py +12 -0
- htmlgraph/sdk/help/mixin.py +699 -0
- htmlgraph/sdk/mixins/__init__.py +15 -0
- htmlgraph/sdk/mixins/attribution.py +113 -0
- htmlgraph/sdk/mixins/mixin.py +410 -0
- htmlgraph/sdk/operations/__init__.py +12 -0
- htmlgraph/sdk/operations/mixin.py +427 -0
- htmlgraph/sdk/orchestration/__init__.py +17 -0
- htmlgraph/sdk/orchestration/coordinator.py +203 -0
- htmlgraph/sdk/orchestration/spawner.py +204 -0
- htmlgraph/sdk/planning/__init__.py +19 -0
- htmlgraph/sdk/planning/bottlenecks.py +93 -0
- htmlgraph/sdk/planning/mixin.py +211 -0
- htmlgraph/sdk/planning/parallel.py +186 -0
- htmlgraph/sdk/planning/queue.py +210 -0
- htmlgraph/sdk/planning/recommendations.py +87 -0
- htmlgraph/sdk/planning/smart_planning.py +319 -0
- htmlgraph/sdk/session/__init__.py +19 -0
- htmlgraph/sdk/session/continuity.py +57 -0
- htmlgraph/sdk/session/handoff.py +110 -0
- htmlgraph/sdk/session/info.py +309 -0
- htmlgraph/sdk/session/manager.py +103 -0
- htmlgraph/sdk/strategic/__init__.py +26 -0
- htmlgraph/sdk/strategic/mixin.py +563 -0
- htmlgraph/server.py +21 -17
- htmlgraph/session_warning.py +2 -1
- htmlgraph/sessions/handoff.py +4 -3
- htmlgraph/system_prompts.py +2 -1
- htmlgraph/track_builder.py +2 -1
- htmlgraph/transcript.py +2 -1
- htmlgraph/watch.py +2 -1
- htmlgraph/work_type_utils.py +2 -1
- {htmlgraph-0.26.25.dist-info → htmlgraph-0.27.1.dist-info}/METADATA +1 -1
- htmlgraph-0.27.1.dist-info/RECORD +332 -0
- htmlgraph/sdk.py +0 -3500
- htmlgraph-0.26.25.dist-info/RECORD +0 -274
- {htmlgraph-0.26.25.data → htmlgraph-0.27.1.data}/data/htmlgraph/dashboard.html +0 -0
- {htmlgraph-0.26.25.data → htmlgraph-0.27.1.data}/data/htmlgraph/styles.css +0 -0
- {htmlgraph-0.26.25.data → htmlgraph-0.27.1.data}/data/htmlgraph/templates/AGENTS.md.template +0 -0
- {htmlgraph-0.26.25.data → htmlgraph-0.27.1.data}/data/htmlgraph/templates/CLAUDE.md.template +0 -0
- {htmlgraph-0.26.25.data → htmlgraph-0.27.1.data}/data/htmlgraph/templates/GEMINI.md.template +0 -0
- {htmlgraph-0.26.25.dist-info → htmlgraph-0.27.1.dist-info}/WHEEL +0 -0
- {htmlgraph-0.26.25.dist-info → htmlgraph-0.27.1.dist-info}/entry_points.txt +0 -0
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
1
7
|
"""
|
|
2
8
|
Cross-session analytics using Git commits as the continuity spine.
|
|
3
9
|
|
|
@@ -38,8 +44,6 @@ Example:
|
|
|
38
44
|
authors = cross.work_by_author(since_commit="abc123")
|
|
39
45
|
"""
|
|
40
46
|
|
|
41
|
-
from __future__ import annotations
|
|
42
|
-
|
|
43
47
|
import subprocess
|
|
44
48
|
from collections import defaultdict
|
|
45
49
|
from dataclasses import dataclass
|
|
@@ -147,8 +151,8 @@ class CrossSessionAnalytics:
|
|
|
147
151
|
... from_commit="HEAD~10",
|
|
148
152
|
... to_commit="HEAD"
|
|
149
153
|
... )
|
|
150
|
-
>>>
|
|
151
|
-
>>>
|
|
154
|
+
>>> logger.info(f"Total events: {report.total_events}")
|
|
155
|
+
>>> logger.info(f"Features: {', '.join(report.features)}")
|
|
152
156
|
"""
|
|
153
157
|
# Get commit list from Git
|
|
154
158
|
commits = self._get_commits_in_range(from_commit, to_commit)
|
|
@@ -273,7 +277,7 @@ class CrossSessionAnalytics:
|
|
|
273
277
|
|
|
274
278
|
Example:
|
|
275
279
|
>>> sessions = cross.sessions_for_feature("feature-auth")
|
|
276
|
-
>>>
|
|
280
|
+
>>> logger.info(f"Feature worked on in {len(sessions)} sessions")
|
|
277
281
|
"""
|
|
278
282
|
sessions = set()
|
|
279
283
|
|
|
@@ -320,8 +324,8 @@ class CrossSessionAnalytics:
|
|
|
320
324
|
|
|
321
325
|
Example:
|
|
322
326
|
>>> report = cross.feature_cross_session_report("feature-auth")
|
|
323
|
-
>>>
|
|
324
|
-
>>>
|
|
327
|
+
>>> logger.info(f"Implemented across {len(report.sessions)} sessions")
|
|
328
|
+
>>> logger.info(f"Duration: {report.duration_hours:.1f} hours")
|
|
325
329
|
"""
|
|
326
330
|
sessions = set()
|
|
327
331
|
commits = set()
|
|
@@ -395,7 +399,7 @@ class CrossSessionAnalytics:
|
|
|
395
399
|
Example:
|
|
396
400
|
>>> authors = cross.work_by_author(since_commit="v1.0.0")
|
|
397
401
|
>>> for email, stats in authors.items():
|
|
398
|
-
...
|
|
402
|
+
... logger.info(f"{email}: {stats['event_count']} events")
|
|
399
403
|
"""
|
|
400
404
|
authors: dict[str, dict[str, Any]] = defaultdict(
|
|
401
405
|
lambda: {
|
|
@@ -476,7 +480,7 @@ class CrossSessionAnalytics:
|
|
|
476
480
|
|
|
477
481
|
Example:
|
|
478
482
|
>>> commits = cross.commits_for_session("session-abc")
|
|
479
|
-
>>>
|
|
483
|
+
>>> logger.info(f"Session produced {len(commits)} commits")
|
|
480
484
|
"""
|
|
481
485
|
commits = set()
|
|
482
486
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
1
7
|
"""
|
|
2
8
|
Dependency-aware analytics for HtmlGraph.
|
|
3
9
|
|
|
@@ -9,8 +15,6 @@ Provides advanced graph analysis for project management:
|
|
|
9
15
|
- Work prioritization
|
|
10
16
|
"""
|
|
11
17
|
|
|
12
|
-
from __future__ import annotations
|
|
13
|
-
|
|
14
18
|
from collections import deque
|
|
15
19
|
from typing import TYPE_CHECKING
|
|
16
20
|
|
|
@@ -55,12 +59,12 @@ class DependencyAnalytics:
|
|
|
55
59
|
# Find bottlenecks (cached internally for performance)
|
|
56
60
|
bottlenecks = dep.find_bottlenecks(top_n=5)
|
|
57
61
|
for bn in bottlenecks:
|
|
58
|
-
|
|
62
|
+
logger.info(f"{bn.title} blocks {bn.transitive_blocking} features")
|
|
59
63
|
|
|
60
64
|
# Get work recommendations (reuses cached data)
|
|
61
65
|
recs = dep.recommend_next_tasks(agent_count=3)
|
|
62
66
|
for rec in recs.recommendations:
|
|
63
|
-
|
|
67
|
+
logger.info(f"Work on: {rec.title} (unlocks {len(rec.unlocks)} features)")
|
|
64
68
|
|
|
65
69
|
# After making graph changes, invalidate cache
|
|
66
70
|
sdk.features.update(feature_id, status="done")
|
|
@@ -201,7 +205,7 @@ class DependencyAnalytics:
|
|
|
201
205
|
|
|
202
206
|
Example:
|
|
203
207
|
report = dep.find_parallelizable_work(status="todo")
|
|
204
|
-
|
|
208
|
+
logger.info(f"Can work on {report.max_parallelism} features in parallel")
|
|
205
209
|
"""
|
|
206
210
|
# Get dependency levels (topological layers)
|
|
207
211
|
levels = self.dependency_levels(status_filter=[status])
|
|
@@ -456,7 +460,7 @@ class DependencyAnalytics:
|
|
|
456
460
|
Example:
|
|
457
461
|
recs = dep.recommend_next_tasks(agent_count=3)
|
|
458
462
|
for rec in recs.recommendations:
|
|
459
|
-
|
|
463
|
+
logger.info(f"Work on: {rec.title}")
|
|
460
464
|
"""
|
|
461
465
|
# Get all nodes with target status
|
|
462
466
|
candidates = [n for n in self.graph.nodes.values() if n.status == status]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Strategic Analytics - Phase 3: Pattern Detection & Smart Suggestions
|
|
3
|
+
|
|
4
|
+
This module provides intelligent pattern detection and suggestion systems
|
|
5
|
+
that learn from user delegation patterns and make smart suggestions.
|
|
6
|
+
|
|
7
|
+
Key Components:
|
|
8
|
+
1. PatternDetector - Detects tool sequences, delegation chains, error patterns
|
|
9
|
+
2. SuggestionEngine - Generates context-aware suggestions with ranking
|
|
10
|
+
3. PreferenceManager - Learns user preferences from feedback
|
|
11
|
+
4. CostOptimizer - Suggests token budgets, parallelization, model selection
|
|
12
|
+
|
|
13
|
+
Usage:
|
|
14
|
+
from htmlgraph.analytics.strategic import (
|
|
15
|
+
PatternDetector,
|
|
16
|
+
SuggestionEngine,
|
|
17
|
+
PreferenceManager,
|
|
18
|
+
CostOptimizer,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Detect patterns from event history
|
|
22
|
+
detector = PatternDetector(db_path)
|
|
23
|
+
patterns = detector.detect_all_patterns()
|
|
24
|
+
|
|
25
|
+
# Get suggestions for current context
|
|
26
|
+
engine = SuggestionEngine(db_path)
|
|
27
|
+
suggestions = engine.suggest(context)
|
|
28
|
+
|
|
29
|
+
# Learn from feedback
|
|
30
|
+
manager = PreferenceManager(db_path)
|
|
31
|
+
manager.record_feedback(suggestion_id, accepted=True)
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
from htmlgraph.analytics.strategic.cost_optimizer import (
|
|
35
|
+
CostOptimizer,
|
|
36
|
+
ModelRecommendation,
|
|
37
|
+
ParallelizationStrategy,
|
|
38
|
+
TokenBudget,
|
|
39
|
+
)
|
|
40
|
+
from htmlgraph.analytics.strategic.pattern_detector import (
|
|
41
|
+
DelegationChain,
|
|
42
|
+
ErrorPattern,
|
|
43
|
+
Pattern,
|
|
44
|
+
PatternDetector,
|
|
45
|
+
PatternType,
|
|
46
|
+
ToolSequencePattern,
|
|
47
|
+
)
|
|
48
|
+
from htmlgraph.analytics.strategic.preference_manager import (
|
|
49
|
+
Feedback,
|
|
50
|
+
PreferenceManager,
|
|
51
|
+
UserPreferences,
|
|
52
|
+
)
|
|
53
|
+
from htmlgraph.analytics.strategic.suggestion_engine import (
|
|
54
|
+
Suggestion,
|
|
55
|
+
SuggestionEngine,
|
|
56
|
+
SuggestionType,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
__all__ = [
|
|
60
|
+
# Pattern Detection
|
|
61
|
+
"PatternDetector",
|
|
62
|
+
"Pattern",
|
|
63
|
+
"PatternType",
|
|
64
|
+
"ToolSequencePattern",
|
|
65
|
+
"DelegationChain",
|
|
66
|
+
"ErrorPattern",
|
|
67
|
+
# Suggestion Engine
|
|
68
|
+
"SuggestionEngine",
|
|
69
|
+
"Suggestion",
|
|
70
|
+
"SuggestionType",
|
|
71
|
+
# Preference Manager
|
|
72
|
+
"PreferenceManager",
|
|
73
|
+
"UserPreferences",
|
|
74
|
+
"Feedback",
|
|
75
|
+
# Cost Optimizer
|
|
76
|
+
"CostOptimizer",
|
|
77
|
+
"TokenBudget",
|
|
78
|
+
"ParallelizationStrategy",
|
|
79
|
+
"ModelRecommendation",
|
|
80
|
+
]
|