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
htmlgraph/builders/track.py
CHANGED
htmlgraph/cli/analytics.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""HtmlGraph CLI - Analytics and reporting commands.
|
|
2
4
|
|
|
3
5
|
Commands for analytics and reporting:
|
|
@@ -7,7 +9,6 @@ Commands for analytics and reporting:
|
|
|
7
9
|
- sync-docs: Documentation synchronization
|
|
8
10
|
"""
|
|
9
11
|
|
|
10
|
-
from __future__ import annotations
|
|
11
12
|
|
|
12
13
|
import argparse
|
|
13
14
|
import json
|
htmlgraph/cli/base.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""Base classes and utilities for CLI commands.
|
|
2
4
|
|
|
3
5
|
Provides:
|
|
@@ -10,7 +12,6 @@ Provides:
|
|
|
10
12
|
- save_traceback: Save full tracebacks to log files instead of console
|
|
11
13
|
"""
|
|
12
14
|
|
|
13
|
-
from __future__ import annotations
|
|
14
15
|
|
|
15
16
|
import argparse
|
|
16
17
|
import json
|
htmlgraph/cli/core.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""HtmlGraph CLI - Infrastructure commands.
|
|
2
4
|
|
|
3
5
|
Commands for core infrastructure operations:
|
|
@@ -11,7 +13,6 @@ Commands for core infrastructure operations:
|
|
|
11
13
|
- Other utilities
|
|
12
14
|
"""
|
|
13
15
|
|
|
14
|
-
from __future__ import annotations
|
|
15
16
|
|
|
16
17
|
import argparse
|
|
17
18
|
import sys
|
htmlgraph/cli/main.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""HtmlGraph CLI - Main entry point.
|
|
2
4
|
|
|
3
5
|
Entry point with argument parsing and command routing.
|
|
4
6
|
Keeps main() thin by delegating to command modules.
|
|
5
7
|
"""
|
|
6
8
|
|
|
7
|
-
from __future__ import annotations
|
|
8
9
|
|
|
9
10
|
import argparse
|
|
10
11
|
import sys
|
htmlgraph/cli/models.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""HtmlGraph CLI - Pydantic models for command filters and configuration.
|
|
2
4
|
|
|
3
5
|
This module provides type-safe models for validating command inputs:
|
|
@@ -5,7 +7,6 @@ This module provides type-safe models for validating command inputs:
|
|
|
5
7
|
- Configuration models for infrastructure commands (init, serve)
|
|
6
8
|
"""
|
|
7
9
|
|
|
8
|
-
from __future__ import annotations
|
|
9
10
|
|
|
10
11
|
from datetime import datetime
|
|
11
12
|
from typing import Literal
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""HTML template for cost dashboard.
|
|
2
4
|
|
|
3
5
|
This module generates a beautiful, interactive HTML dashboard for cost analysis.
|
|
4
6
|
Separated from main CLI code for maintainability and testability.
|
|
5
7
|
"""
|
|
6
8
|
|
|
7
|
-
from __future__ import annotations
|
|
8
9
|
|
|
9
10
|
from datetime import datetime
|
|
10
11
|
from typing import TYPE_CHECKING, Any
|
htmlgraph/cli/work/__init__.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""HtmlGraph CLI - Work management commands.
|
|
2
4
|
|
|
3
5
|
Commands for managing work items:
|
|
@@ -9,7 +11,6 @@ Commands for managing work items:
|
|
|
9
11
|
- Other work-related operations
|
|
10
12
|
"""
|
|
11
13
|
|
|
12
|
-
from __future__ import annotations
|
|
13
14
|
|
|
14
15
|
from typing import TYPE_CHECKING
|
|
15
16
|
|
htmlgraph/cli/work/browse.py
CHANGED
htmlgraph/cli/work/features.py
CHANGED
htmlgraph/cli/work/report.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""HtmlGraph CLI - Session report commands.
|
|
2
4
|
|
|
3
5
|
Commands for generating "What Did Claude Do?" reports:
|
|
@@ -7,7 +9,6 @@ THE killer feature that differentiates HtmlGraph - complete observability
|
|
|
7
9
|
of AI agent activities with cost attribution and tool usage analysis.
|
|
8
10
|
"""
|
|
9
11
|
|
|
10
|
-
from __future__ import annotations
|
|
11
12
|
|
|
12
13
|
import argparse
|
|
13
14
|
import sqlite3
|
htmlgraph/cli/work/sessions.py
CHANGED
htmlgraph/cli/work/snapshot.py
CHANGED
htmlgraph/cli/work/tracks.py
CHANGED
htmlgraph/collections/base.py
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
1
7
|
"""
|
|
2
8
|
Base collection class for managing nodes.
|
|
3
9
|
|
|
@@ -5,7 +11,6 @@ Provides common collection functionality for all node types
|
|
|
5
11
|
with lazy-loading, filtering, and batch operations.
|
|
6
12
|
"""
|
|
7
13
|
|
|
8
|
-
from __future__ import annotations
|
|
9
14
|
|
|
10
15
|
from collections.abc import Callable, Iterator
|
|
11
16
|
from contextlib import contextmanager
|
|
@@ -227,7 +232,7 @@ class BaseCollection(Generic[CollectionT]):
|
|
|
227
232
|
Example:
|
|
228
233
|
>>> feature = sdk.features.get("feat-abc123")
|
|
229
234
|
>>> ref = sdk.features.get_ref(feature.id)
|
|
230
|
-
>>>
|
|
235
|
+
>>> logger.info("%s", ref) # "@f1"
|
|
231
236
|
"""
|
|
232
237
|
if self._ref_manager:
|
|
233
238
|
result = self._ref_manager.get_ref(node_id)
|
|
@@ -466,7 +471,7 @@ class BaseCollection(Generic[CollectionT]):
|
|
|
466
471
|
|
|
467
472
|
Example:
|
|
468
473
|
>>> count = sdk.features.batch_delete(["feat-001", "feat-002", "feat-003"])
|
|
469
|
-
>>>
|
|
474
|
+
>>> logger.info(f"Deleted {count} features")
|
|
470
475
|
"""
|
|
471
476
|
graph = self._ensure_graph()
|
|
472
477
|
return cast(int, graph.batch_delete(node_ids))
|
|
@@ -540,9 +545,9 @@ class BaseCollection(Generic[CollectionT]):
|
|
|
540
545
|
|
|
541
546
|
Example:
|
|
542
547
|
>>> result = sdk.features.mark_done(["feat-001", "feat-002"])
|
|
543
|
-
>>>
|
|
548
|
+
>>> logger.info(f"Completed {result['success_count']} of {len(node_ids)}")
|
|
544
549
|
>>> if result['failed_ids']:
|
|
545
|
-
...
|
|
550
|
+
... logger.info(f"Failed: {result['failed_ids']}")
|
|
546
551
|
"""
|
|
547
552
|
graph = self._ensure_graph()
|
|
548
553
|
results: dict[str, Any] = {"success_count": 0, "failed_ids": [], "warnings": []}
|
htmlgraph/collections/bug.py
CHANGED
htmlgraph/collections/chore.py
CHANGED
htmlgraph/collections/epic.py
CHANGED
htmlgraph/collections/feature.py
CHANGED
htmlgraph/collections/insight.py
CHANGED
htmlgraph/collections/metric.py
CHANGED
htmlgraph/collections/pattern.py
CHANGED
htmlgraph/collections/phase.py
CHANGED
htmlgraph/collections/session.py
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
1
7
|
"""
|
|
2
8
|
SessionCollection - Session state and management interface.
|
|
3
9
|
|
|
@@ -13,7 +19,6 @@ Integration with SessionStart hook:
|
|
|
13
19
|
sdk.sessions.setup_environment_variables(state)
|
|
14
20
|
"""
|
|
15
21
|
|
|
16
|
-
from __future__ import annotations
|
|
17
22
|
|
|
18
23
|
from typing import TYPE_CHECKING
|
|
19
24
|
|
|
@@ -82,9 +87,9 @@ class SessionCollection(BaseCollection):
|
|
|
82
87
|
Example:
|
|
83
88
|
>>> sdk = SDK()
|
|
84
89
|
>>> state = sdk.sessions.get_current_state()
|
|
85
|
-
>>>
|
|
86
|
-
>>>
|
|
87
|
-
>>>
|
|
90
|
+
>>> logger.info(f"Session: {state['session_id']}")
|
|
91
|
+
>>> logger.info(f"Post-compact: {state['is_post_compact']}")
|
|
92
|
+
>>> logger.info(f"Delegation enabled: {state['delegation_enabled']}")
|
|
88
93
|
"""
|
|
89
94
|
return self._state_manager.get_current_state()
|
|
90
95
|
|
|
@@ -116,8 +121,8 @@ class SessionCollection(BaseCollection):
|
|
|
116
121
|
>>> sdk = SDK()
|
|
117
122
|
>>> state = sdk.sessions.get_current_state()
|
|
118
123
|
>>> env_vars = sdk.sessions.setup_environment_variables(state)
|
|
119
|
-
>>>
|
|
120
|
-
>>>
|
|
124
|
+
>>> logger.info(f"CLAUDE_SESSION_ID: {env_vars['CLAUDE_SESSION_ID']}")
|
|
125
|
+
>>> logger.info(f"CLAUDE_DELEGATION_ENABLED: {env_vars['CLAUDE_DELEGATION_ENABLED']}")
|
|
121
126
|
"""
|
|
122
127
|
return self._state_manager.setup_environment_variables(
|
|
123
128
|
session_state=session_state, auto_detect_compact=auto_detect_compact
|
|
@@ -168,7 +173,7 @@ class SessionCollection(BaseCollection):
|
|
|
168
173
|
Example:
|
|
169
174
|
>>> sdk = SDK()
|
|
170
175
|
>>> if sdk.sessions.detect_compact_automatically():
|
|
171
|
-
...
|
|
176
|
+
... logger.info("This is a post-compact session")
|
|
172
177
|
"""
|
|
173
178
|
return self._state_manager.detect_compact_automatically()
|
|
174
179
|
|
htmlgraph/collections/spike.py
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
1
7
|
"""
|
|
2
8
|
Spike collection for managing investigation and research spikes.
|
|
3
9
|
|
|
4
10
|
Extends BaseCollection with spike-specific builder support.
|
|
5
11
|
"""
|
|
6
12
|
|
|
7
|
-
from __future__ import annotations
|
|
8
13
|
|
|
9
14
|
from datetime import datetime
|
|
10
15
|
from typing import TYPE_CHECKING
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
1
7
|
"""
|
|
2
8
|
Task delegation collection for tracking spawned agent work.
|
|
3
9
|
|
|
@@ -12,7 +18,6 @@ Captures observability data for Task() calls:
|
|
|
12
18
|
This data proves multi-agent orchestration works and enables dashboard attribution.
|
|
13
19
|
"""
|
|
14
20
|
|
|
15
|
-
from __future__ import annotations
|
|
16
21
|
|
|
17
22
|
from datetime import datetime
|
|
18
23
|
from typing import TYPE_CHECKING, Any
|
|
@@ -41,7 +46,7 @@ class TaskDelegationCollection(BaseCollection["TaskDelegationCollection"]):
|
|
|
41
46
|
>>> sdk = SDK(agent="orchestrator")
|
|
42
47
|
>>> delegations = sdk.task_delegations.where(agent_type="codex-spawner")
|
|
43
48
|
>>> for d in delegations:
|
|
44
|
-
...
|
|
49
|
+
... logger.info(f"{d.agent_type}: {d.task_description} ({d.duration_seconds}s)")
|
|
45
50
|
>>>
|
|
46
51
|
>>> # Get all delegations for a specific agent
|
|
47
52
|
>>> gemini_work = sdk.task_delegations.where(agent_type="gemini-spawner")
|
htmlgraph/collections/todo.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""
|
|
2
4
|
Todo collection for managing persistent todo items.
|
|
3
5
|
|
|
@@ -8,7 +10,6 @@ Unlike other collections, TodoCollection provides:
|
|
|
8
10
|
- Bulk sync from TodoWrite format
|
|
9
11
|
"""
|
|
10
12
|
|
|
11
|
-
from __future__ import annotations
|
|
12
13
|
|
|
13
14
|
from datetime import datetime
|
|
14
15
|
from typing import TYPE_CHECKING, Any
|
htmlgraph/collections/traces.py
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
1
7
|
"""
|
|
2
8
|
Tool Execution Traces Collection
|
|
3
9
|
|
|
@@ -11,21 +17,20 @@ Example:
|
|
|
11
17
|
>>> # Get traces for current session
|
|
12
18
|
>>> traces = sdk.traces.get_traces(session_id="sess-abc123")
|
|
13
19
|
>>> for trace in traces:
|
|
14
|
-
...
|
|
20
|
+
... logger.info(f"{trace.tool_name}: {trace.duration_ms}ms")
|
|
15
21
|
>>>
|
|
16
22
|
>>> # Find slow tool calls
|
|
17
23
|
>>> slow = sdk.traces.get_slow_traces(threshold_ms=1000)
|
|
18
24
|
>>>
|
|
19
25
|
>>> # Get hierarchical view (parent-child relationships)
|
|
20
26
|
>>> tree = sdk.traces.get_trace_tree(trace_id="trace-xyz")
|
|
21
|
-
>>>
|
|
22
|
-
>>>
|
|
27
|
+
>>> logger.info(f"Root: {tree.root.tool_name}")
|
|
28
|
+
>>> logger.info(f"Children: {len(tree.children)}")
|
|
23
29
|
>>>
|
|
24
30
|
>>> # Get error traces for debugging
|
|
25
31
|
>>> errors = sdk.traces.get_error_traces(session_id="sess-abc123")
|
|
26
32
|
"""
|
|
27
33
|
|
|
28
|
-
from __future__ import annotations
|
|
29
34
|
|
|
30
35
|
from dataclasses import dataclass
|
|
31
36
|
from datetime import datetime, timezone
|
|
@@ -245,7 +250,7 @@ class TraceCollection:
|
|
|
245
250
|
|
|
246
251
|
return None
|
|
247
252
|
except Exception as e:
|
|
248
|
-
|
|
253
|
+
logger.info(f"Error getting trace {tool_use_id}: {e}")
|
|
249
254
|
return None
|
|
250
255
|
|
|
251
256
|
def get_traces(
|
|
@@ -302,7 +307,7 @@ class TraceCollection:
|
|
|
302
307
|
rows = cursor.fetchall()
|
|
303
308
|
return [self._row_to_trace(row) for row in rows]
|
|
304
309
|
except Exception as e:
|
|
305
|
-
|
|
310
|
+
logger.info(f"Error getting traces for session {session_id}: {e}")
|
|
306
311
|
return []
|
|
307
312
|
|
|
308
313
|
def get_traces_by_tool(self, tool_name: str, limit: int = 100) -> list[TraceRecord]:
|
|
@@ -337,7 +342,7 @@ class TraceCollection:
|
|
|
337
342
|
rows = cursor.fetchall()
|
|
338
343
|
return [self._row_to_trace(row) for row in rows]
|
|
339
344
|
except Exception as e:
|
|
340
|
-
|
|
345
|
+
logger.info(f"Error getting traces for tool {tool_name}: {e}")
|
|
341
346
|
return []
|
|
342
347
|
|
|
343
348
|
def get_trace_tree(self, trace_id: str) -> TraceTree | None:
|
|
@@ -403,7 +408,7 @@ class TraceCollection:
|
|
|
403
408
|
|
|
404
409
|
return build_tree(root)
|
|
405
410
|
except Exception as e:
|
|
406
|
-
|
|
411
|
+
logger.info(f"Error getting trace tree for {trace_id}: {e}")
|
|
407
412
|
return None
|
|
408
413
|
|
|
409
414
|
def get_slow_traces(self, threshold_ms: int, limit: int = 100) -> list[TraceRecord]:
|
|
@@ -440,7 +445,7 @@ class TraceCollection:
|
|
|
440
445
|
rows = cursor.fetchall()
|
|
441
446
|
return [self._row_to_trace(row) for row in rows]
|
|
442
447
|
except Exception as e:
|
|
443
|
-
|
|
448
|
+
logger.info(f"Error getting slow traces: {e}")
|
|
444
449
|
return []
|
|
445
450
|
|
|
446
451
|
def get_error_traces(self, session_id: str, limit: int = 100) -> list[TraceRecord]:
|
|
@@ -478,5 +483,5 @@ class TraceCollection:
|
|
|
478
483
|
rows = cursor.fetchall()
|
|
479
484
|
return [self._row_to_trace(row) for row in rows]
|
|
480
485
|
except Exception as e:
|
|
481
|
-
|
|
486
|
+
logger.info(f"Error getting error traces: {e}")
|
|
482
487
|
return []
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Model pricing configuration for cost tracking",
|
|
3
|
+
"last_updated": "2026-01-16",
|
|
4
|
+
"models": {
|
|
5
|
+
"claude-haiku-4-5-20251001": {
|
|
6
|
+
"name": "Claude Haiku",
|
|
7
|
+
"display_name": "Haiku 4.5",
|
|
8
|
+
"input_cost_per_mtok": 0.80,
|
|
9
|
+
"output_cost_per_mtok": 4.00,
|
|
10
|
+
"description": "Fast, efficient model for routine tasks"
|
|
11
|
+
},
|
|
12
|
+
"claude-sonnet-4-20250514": {
|
|
13
|
+
"name": "Claude Sonnet",
|
|
14
|
+
"display_name": "Sonnet 4",
|
|
15
|
+
"input_cost_per_mtok": 3.00,
|
|
16
|
+
"output_cost_per_mtok": 15.00,
|
|
17
|
+
"description": "Balanced model for most tasks"
|
|
18
|
+
},
|
|
19
|
+
"claude-opus-4-1-20250805": {
|
|
20
|
+
"name": "Claude Opus",
|
|
21
|
+
"display_name": "Opus 4.1",
|
|
22
|
+
"input_cost_per_mtok": 15.00,
|
|
23
|
+
"output_cost_per_mtok": 75.00,
|
|
24
|
+
"description": "Most capable model for complex reasoning"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"gemini_models": {
|
|
28
|
+
"gemini-2.0-flash": {
|
|
29
|
+
"name": "Gemini 2.0 Flash",
|
|
30
|
+
"input_cost_per_mtok": 0.075,
|
|
31
|
+
"output_cost_per_mtok": 0.30,
|
|
32
|
+
"description": "Fast multimodal model"
|
|
33
|
+
},
|
|
34
|
+
"gemini-2.0-pro": {
|
|
35
|
+
"name": "Gemini 2.0 Pro",
|
|
36
|
+
"input_cost_per_mtok": 1.50,
|
|
37
|
+
"output_cost_per_mtok": 6.00,
|
|
38
|
+
"description": "Advanced reasoning model"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"defaults": {
|
|
42
|
+
"input_cost_per_mtok": 2.00,
|
|
43
|
+
"output_cost_per_mtok": 10.00
|
|
44
|
+
},
|
|
45
|
+
"alert_thresholds": {
|
|
46
|
+
"budget_warning_percent": 80,
|
|
47
|
+
"budget_critical_percent": 95,
|
|
48
|
+
"model_overage_multiplier": 1.5,
|
|
49
|
+
"trajectory_overage_multiplier": 1.3
|
|
50
|
+
},
|
|
51
|
+
"tracking": {
|
|
52
|
+
"accuracy_target_percent": 5,
|
|
53
|
+
"cost_calculation_method": "token_based",
|
|
54
|
+
"rounding_precision": 4
|
|
55
|
+
}
|
|
56
|
+
}
|
htmlgraph/context_analytics.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
"""
|
|
2
4
|
Context Analytics for HtmlGraph
|
|
3
5
|
|
|
@@ -7,7 +9,6 @@ Provides hierarchical context usage tracking and analytics:
|
|
|
7
9
|
Enables drill-down analysis of where context was consumed.
|
|
8
10
|
"""
|
|
9
11
|
|
|
10
|
-
from __future__ import annotations
|
|
11
12
|
|
|
12
13
|
from dataclasses import dataclass, field
|
|
13
14
|
from typing import TYPE_CHECKING, Any
|