10xgraph-api 0.7.0__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.
Files changed (203) hide show
  1. 10xgraph_api-0.7.0.dist-info/METADATA +618 -0
  2. 10xgraph_api-0.7.0.dist-info/RECORD +203 -0
  3. 10xgraph_api-0.7.0.dist-info/WHEEL +5 -0
  4. 10xgraph_api-0.7.0.dist-info/entry_points.txt +3 -0
  5. 10xgraph_api-0.7.0.dist-info/licenses/LICENSE +21 -0
  6. 10xgraph_api-0.7.0.dist-info/top_level.txt +2 -0
  7. agentflow_cli/__init__.py +69 -0
  8. tenxgraph_api/__init__.py +23 -0
  9. tenxgraph_api/cli/__init__.py +6 -0
  10. tenxgraph_api/cli/capabilities.py +127 -0
  11. tenxgraph_api/cli/commands/__init__.py +49 -0
  12. tenxgraph_api/cli/commands/api.py +262 -0
  13. tenxgraph_api/cli/commands/audit.py +213 -0
  14. tenxgraph_api/cli/commands/build.py +305 -0
  15. tenxgraph_api/cli/commands/config.py +71 -0
  16. tenxgraph_api/cli/commands/demo.py +93 -0
  17. tenxgraph_api/cli/commands/eval.py +909 -0
  18. tenxgraph_api/cli/commands/init.py +531 -0
  19. tenxgraph_api/cli/commands/skills.py +532 -0
  20. tenxgraph_api/cli/commands/test.py +113 -0
  21. tenxgraph_api/cli/commands/version.py +47 -0
  22. tenxgraph_api/cli/config_editor/__init__.py +15 -0
  23. tenxgraph_api/cli/config_editor/schema.py +566 -0
  24. tenxgraph_api/cli/config_editor/server.py +240 -0
  25. tenxgraph_api/cli/config_editor/static/app.css +2 -0
  26. tenxgraph_api/cli/config_editor/static/app.js +3 -0
  27. tenxgraph_api/cli/config_editor/static/favicon.svg +11 -0
  28. tenxgraph_api/cli/config_editor/static/index.html +20 -0
  29. tenxgraph_api/cli/config_editor/store.py +120 -0
  30. tenxgraph_api/cli/config_editor/validation.py +377 -0
  31. tenxgraph_api/cli/constants.py +112 -0
  32. tenxgraph_api/cli/context.py +46 -0
  33. tenxgraph_api/cli/core/__init__.py +0 -0
  34. tenxgraph_api/cli/core/animations.py +550 -0
  35. tenxgraph_api/cli/core/config.py +279 -0
  36. tenxgraph_api/cli/core/output.py +625 -0
  37. tenxgraph_api/cli/core/prompts.py +220 -0
  38. tenxgraph_api/cli/core/screen.py +287 -0
  39. tenxgraph_api/cli/core/steps.py +621 -0
  40. tenxgraph_api/cli/core/theme.py +242 -0
  41. tenxgraph_api/cli/core/validation.py +251 -0
  42. tenxgraph_api/cli/exceptions.py +129 -0
  43. tenxgraph_api/cli/logger.py +84 -0
  44. tenxgraph_api/cli/main.py +936 -0
  45. tenxgraph_api/cli/templates/__init__.py +0 -0
  46. tenxgraph_api/cli/templates/defaults.py +844 -0
  47. tenxgraph_api/cli/templates/dev/.env.example +1 -0
  48. tenxgraph_api/cli/templates/dev/10xgraph.json +16 -0
  49. tenxgraph_api/cli/templates/dev/graph/__init__.py +0 -0
  50. tenxgraph_api/cli/templates/dev/graph/agent.py +63 -0
  51. tenxgraph_api/cli/templates/prod/.env.example +75 -0
  52. tenxgraph_api/cli/templates/prod/.pre-commit-config.yaml +50 -0
  53. tenxgraph_api/cli/templates/prod/.python-version +1 -0
  54. tenxgraph_api/cli/templates/prod/10xgraph.json +42 -0
  55. tenxgraph_api/cli/templates/prod/auth/__init__.py +0 -0
  56. tenxgraph_api/cli/templates/prod/auth/agent_auth.py +46 -0
  57. tenxgraph_api/cli/templates/prod/evals/__init__.py +0 -0
  58. tenxgraph_api/cli/templates/prod/evals/user_simulator_eval.py +76 -0
  59. tenxgraph_api/cli/templates/prod/evals/weather_agents_eval.py +53 -0
  60. tenxgraph_api/cli/templates/prod/graph/__init__.py +0 -0
  61. tenxgraph_api/cli/templates/prod/graph/agent.py +50 -0
  62. tenxgraph_api/cli/templates/prod/graph/state.py +5 -0
  63. tenxgraph_api/cli/templates/prod/graph/thread_name_generator.py +7 -0
  64. tenxgraph_api/cli/templates/prod/graph/tools/__init__.py +0 -0
  65. tenxgraph_api/cli/templates/prod/graph/tools/weather_tool.py +43 -0
  66. tenxgraph_api/cli/templates/prod/graph/validators/__init__.py +0 -0
  67. tenxgraph_api/cli/templates/prod/graph/validators/lifecyle.py +107 -0
  68. tenxgraph_api/cli/templates/prod/graph/validators/manager.py +9 -0
  69. tenxgraph_api/cli/templates/prod/graph/validators/validators.py +21 -0
  70. tenxgraph_api/cli/templates/prod/pyproject.toml +79 -0
  71. tenxgraph_api/cli/templates/prod/tests/__init__.py +0 -0
  72. tenxgraph_api/cli/templates/prod/tests/conftest.py +6 -0
  73. tenxgraph_api/cli/templates/prod/tests/test_agent_eval.py +78 -0
  74. tenxgraph_api/cli/templates/prod/tests/test_catalog_tools.py +47 -0
  75. tenxgraph_api/cli/templates/prod/tests/test_graph_nodes.py +57 -0
  76. tenxgraph_api/cli/templates/skills/10xgraph/SKILL.md +92 -0
  77. tenxgraph_api/cli/templates/skills/10xgraph/references/agents-and-tools.md +389 -0
  78. tenxgraph_api/cli/templates/skills/10xgraph/references/api-client.md +61 -0
  79. tenxgraph_api/cli/templates/skills/10xgraph/references/api-configuration.md +75 -0
  80. tenxgraph_api/cli/templates/skills/10xgraph/references/api-settings-and-middleware.md +89 -0
  81. tenxgraph_api/cli/templates/skills/10xgraph/references/architecture.md +91 -0
  82. tenxgraph_api/cli/templates/skills/10xgraph/references/auth-and-authorization.md +149 -0
  83. tenxgraph_api/cli/templates/skills/10xgraph/references/callbacks-and-command.md +283 -0
  84. tenxgraph_api/cli/templates/skills/10xgraph/references/checkpointing-and-threads.md +63 -0
  85. tenxgraph_api/cli/templates/skills/10xgraph/references/cli-commands.md +73 -0
  86. tenxgraph_api/cli/templates/skills/10xgraph/references/client-auth-and-errors.md +94 -0
  87. tenxgraph_api/cli/templates/skills/10xgraph/references/client-messages-invoke-stream.md +115 -0
  88. tenxgraph_api/cli/templates/skills/10xgraph/references/client-threads-memory-files.md +80 -0
  89. tenxgraph_api/cli/templates/skills/10xgraph/references/context-id-background.md +80 -0
  90. tenxgraph_api/cli/templates/skills/10xgraph/references/dependency-injection.md +58 -0
  91. tenxgraph_api/cli/templates/skills/10xgraph/references/evaluation.md +500 -0
  92. tenxgraph_api/cli/templates/skills/10xgraph/references/id-and-thread-name-generators.md +69 -0
  93. tenxgraph_api/cli/templates/skills/10xgraph/references/media-and-files.md +66 -0
  94. tenxgraph_api/cli/templates/skills/10xgraph/references/memory-and-store.md +70 -0
  95. tenxgraph_api/cli/templates/skills/10xgraph/references/prebuilt-agents-and-tools.md +394 -0
  96. tenxgraph_api/cli/templates/skills/10xgraph/references/production-runtime.md +56 -0
  97. tenxgraph_api/cli/templates/skills/10xgraph/references/providers-and-adapters.md +89 -0
  98. tenxgraph_api/cli/templates/skills/10xgraph/references/publishers-and-runtime-protocols.md +84 -0
  99. tenxgraph_api/cli/templates/skills/10xgraph/references/rate-limiting.md +194 -0
  100. tenxgraph_api/cli/templates/skills/10xgraph/references/realtime.md +172 -0
  101. tenxgraph_api/cli/templates/skills/10xgraph/references/remote-tools.md +55 -0
  102. tenxgraph_api/cli/templates/skills/10xgraph/references/rest-api-and-errors.md +97 -0
  103. tenxgraph_api/cli/templates/skills/10xgraph/references/security-and-validators.md +86 -0
  104. tenxgraph_api/cli/templates/skills/10xgraph/references/state-and-messages.md +68 -0
  105. tenxgraph_api/cli/templates/skills/10xgraph/references/state-graph.md +232 -0
  106. tenxgraph_api/cli/templates/skills/10xgraph/references/stream-emitter.md +144 -0
  107. tenxgraph_api/cli/templates/skills/10xgraph/references/streaming.md +53 -0
  108. tenxgraph_api/cli/templates/skills/10xgraph/references/testing-and-evaluation.md +64 -0
  109. tenxgraph_api/cli/templates/skills/10xgraph/references/unit-testing.md +202 -0
  110. tenxgraph_api/cli/templates/skills/copilot/10xgraph.instructions.md +108 -0
  111. tenxgraph_api/py.typed +0 -0
  112. tenxgraph_api/src/__init__.py +0 -0
  113. tenxgraph_api/src/app/__init__.py +13 -0
  114. tenxgraph_api/src/app/core/__init__.py +15 -0
  115. tenxgraph_api/src/app/core/auth/__init__.py +0 -0
  116. tenxgraph_api/src/app/core/auth/auth_backend.py +38 -0
  117. tenxgraph_api/src/app/core/auth/authorization.py +379 -0
  118. tenxgraph_api/src/app/core/auth/base_auth.py +27 -0
  119. tenxgraph_api/src/app/core/auth/jwt_auth.py +122 -0
  120. tenxgraph_api/src/app/core/auth/ownership_resolver.py +170 -0
  121. tenxgraph_api/src/app/core/auth/permissions.py +354 -0
  122. tenxgraph_api/src/app/core/auth/request_config.py +130 -0
  123. tenxgraph_api/src/app/core/auth/route_guard.py +105 -0
  124. tenxgraph_api/src/app/core/config/__init__.py +0 -0
  125. tenxgraph_api/src/app/core/config/graph_config.py +532 -0
  126. tenxgraph_api/src/app/core/config/media_settings.py +72 -0
  127. tenxgraph_api/src/app/core/config/sentry_config.py +60 -0
  128. tenxgraph_api/src/app/core/config/settings.py +202 -0
  129. tenxgraph_api/src/app/core/config/setup_logs.py +65 -0
  130. tenxgraph_api/src/app/core/config/setup_middleware.py +483 -0
  131. tenxgraph_api/src/app/core/config/worker_middleware.py +99 -0
  132. tenxgraph_api/src/app/core/exceptions/__init__.py +17 -0
  133. tenxgraph_api/src/app/core/exceptions/general_exception.py +58 -0
  134. tenxgraph_api/src/app/core/exceptions/handle_errors.py +363 -0
  135. tenxgraph_api/src/app/core/exceptions/resources_exceptions.py +72 -0
  136. tenxgraph_api/src/app/core/exceptions/user_exception.py +58 -0
  137. tenxgraph_api/src/app/core/middleware/__init__.py +25 -0
  138. tenxgraph_api/src/app/core/middleware/rate_limit/__init__.py +15 -0
  139. tenxgraph_api/src/app/core/middleware/rate_limit/base.py +27 -0
  140. tenxgraph_api/src/app/core/middleware/rate_limit/factory.py +98 -0
  141. tenxgraph_api/src/app/core/middleware/rate_limit/keying.py +133 -0
  142. tenxgraph_api/src/app/core/middleware/rate_limit/memory.py +98 -0
  143. tenxgraph_api/src/app/core/middleware/rate_limit/middleware.py +90 -0
  144. tenxgraph_api/src/app/core/middleware/rate_limit/redis.py +115 -0
  145. tenxgraph_api/src/app/core/middleware/request_limits.py +154 -0
  146. tenxgraph_api/src/app/core/middleware/security_headers.py +239 -0
  147. tenxgraph_api/src/app/core/utils/__init__.py +14 -0
  148. tenxgraph_api/src/app/core/utils/log_sanitizer.py +216 -0
  149. tenxgraph_api/src/app/loader.py +516 -0
  150. tenxgraph_api/src/app/main.py +180 -0
  151. tenxgraph_api/src/app/routers/__init__.py +4 -0
  152. tenxgraph_api/src/app/routers/ag_ui/__init__.py +10 -0
  153. tenxgraph_api/src/app/routers/ag_ui/converter.py +195 -0
  154. tenxgraph_api/src/app/routers/ag_ui/event_mapper.py +353 -0
  155. tenxgraph_api/src/app/routers/ag_ui/router.py +90 -0
  156. tenxgraph_api/src/app/routers/ag_ui/service.py +193 -0
  157. tenxgraph_api/src/app/routers/checkpointer/__init__.py +1 -0
  158. tenxgraph_api/src/app/routers/checkpointer/router.py +482 -0
  159. tenxgraph_api/src/app/routers/checkpointer/schemas/__init__.py +1 -0
  160. tenxgraph_api/src/app/routers/checkpointer/schemas/checkpointer_schemas.py +121 -0
  161. tenxgraph_api/src/app/routers/checkpointer/services/__init__.py +1 -0
  162. tenxgraph_api/src/app/routers/checkpointer/services/checkpointer_service.py +300 -0
  163. tenxgraph_api/src/app/routers/evals/__init__.py +6 -0
  164. tenxgraph_api/src/app/routers/evals/router.py +38 -0
  165. tenxgraph_api/src/app/routers/evals/services/__init__.py +1 -0
  166. tenxgraph_api/src/app/routers/evals/services/eval_report_service.py +354 -0
  167. tenxgraph_api/src/app/routers/graph/__init__.py +6 -0
  168. tenxgraph_api/src/app/routers/graph/realtime_guard.py +161 -0
  169. tenxgraph_api/src/app/routers/graph/router.py +821 -0
  170. tenxgraph_api/src/app/routers/graph/schemas/__init__.py +1 -0
  171. tenxgraph_api/src/app/routers/graph/schemas/graph_schemas.py +386 -0
  172. tenxgraph_api/src/app/routers/graph/services/__init__.py +1 -0
  173. tenxgraph_api/src/app/routers/graph/services/graph_service.py +1219 -0
  174. tenxgraph_api/src/app/routers/graph/services/multimodal_preprocessor.py +164 -0
  175. tenxgraph_api/src/app/routers/media/__init__.py +506 -0
  176. tenxgraph_api/src/app/routers/media/router.py +242 -0
  177. tenxgraph_api/src/app/routers/media/schemas.py +39 -0
  178. tenxgraph_api/src/app/routers/ping/__init__.py +4 -0
  179. tenxgraph_api/src/app/routers/ping/router.py +28 -0
  180. tenxgraph_api/src/app/routers/setup_router.py +60 -0
  181. tenxgraph_api/src/app/routers/store/__init__.py +4 -0
  182. tenxgraph_api/src/app/routers/store/router.py +200 -0
  183. tenxgraph_api/src/app/routers/store/schemas/__init__.py +28 -0
  184. tenxgraph_api/src/app/routers/store/schemas/store_schemas.py +200 -0
  185. tenxgraph_api/src/app/routers/store/services/__init__.py +4 -0
  186. tenxgraph_api/src/app/routers/store/services/store_service.py +203 -0
  187. tenxgraph_api/src/app/tasks/__init__.py +0 -0
  188. tenxgraph_api/src/app/tasks/user_tasks.py +38 -0
  189. tenxgraph_api/src/app/utils/__init__.py +12 -0
  190. tenxgraph_api/src/app/utils/callable_helper.py +26 -0
  191. tenxgraph_api/src/app/utils/media/__init__.py +15 -0
  192. tenxgraph_api/src/app/utils/media/extractor.py +172 -0
  193. tenxgraph_api/src/app/utils/media/pipeline.py +83 -0
  194. tenxgraph_api/src/app/utils/parse_output.py +17 -0
  195. tenxgraph_api/src/app/utils/response_helper.py +129 -0
  196. tenxgraph_api/src/app/utils/schemas/__init__.py +11 -0
  197. tenxgraph_api/src/app/utils/schemas/output_schemas.py +28 -0
  198. tenxgraph_api/src/app/utils/schemas/user_schemas.py +13 -0
  199. tenxgraph_api/src/app/utils/snowflake_id_generator.py +90 -0
  200. tenxgraph_api/src/app/utils/swagger_helper.py +160 -0
  201. tenxgraph_api/src/app/utils/telemetry_store.py +123 -0
  202. tenxgraph_api/src/app/utils/thread_name_generator.py +304 -0
  203. tenxgraph_api/src/app/worker.py +91 -0
@@ -0,0 +1,279 @@
1
+ """Configuration management for the 10xGraph CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ from tenxgraph_api.cli.constants import (
10
+ CONFIG_FILENAMES,
11
+ DEFAULT_CONFIG_FILE,
12
+ LEGACY_CONFIG_FILE,
13
+ PROJECT_ROOT,
14
+ )
15
+ from tenxgraph_api.cli.exceptions import ConfigurationError
16
+
17
+
18
+ def config_names(config_path: str) -> tuple[str, ...]:
19
+ """Names to try for ``config_path``, in priority order.
20
+
21
+ The default ``10xgraph.json`` falls back to the pre-rename ``agentflow.json``;
22
+ any other name is used as given.
23
+ """
24
+ if config_path == DEFAULT_CONFIG_FILE:
25
+ return (DEFAULT_CONFIG_FILE, LEGACY_CONFIG_FILE)
26
+ return (config_path,)
27
+
28
+
29
+ def resolve_default_config(config: str, directory: Path | None = None) -> Path:
30
+ """Resolve ``config`` against ``directory`` (default: cwd), honoring the legacy name.
31
+
32
+ Returns the first existing candidate, or the preferred name when none exists so
33
+ callers can report or create it.
34
+ """
35
+ base = directory or Path.cwd()
36
+ candidates = [base / name for name in config_names(config)]
37
+ return next((path for path in candidates if path.exists()), candidates[0])
38
+
39
+
40
+ class ConfigManager:
41
+ """Manages configuration discovery and validation."""
42
+
43
+ def __init__(self, config_path: str | None = None) -> None:
44
+ """Initialize the config manager.
45
+
46
+ Args:
47
+ config_path: Optional path to config file
48
+ """
49
+ self.config_path = config_path
50
+ self._config_data: dict[str, Any] | None = None
51
+
52
+ def find_config_file(self, config_path: str) -> Path:
53
+ """Find the config file in various locations.
54
+
55
+ Args:
56
+ config_path: Path to config file (can be relative or absolute)
57
+
58
+ Returns:
59
+ Path to the found config file
60
+
61
+ Raises:
62
+ ConfigurationError: If config file is not found
63
+ """
64
+ config_path_obj = Path(config_path)
65
+
66
+ # If absolute path is provided, use it directly
67
+ if config_path_obj.is_absolute():
68
+ if not config_path_obj.exists():
69
+ raise ConfigurationError(
70
+ f"Config file not found at {config_path}",
71
+ config_path=str(config_path_obj),
72
+ )
73
+ return config_path_obj
74
+
75
+ # Search the working directory and its parents first so commands invoked
76
+ # from a nested package still resolve the nearest 10xGraph project. Within
77
+ # each directory 10xgraph.json wins over the legacy agentflow.json.
78
+ names = config_names(config_path)
79
+ search_dirs = [*self._working_tree(), Path(__file__).parent.parent, PROJECT_ROOT]
80
+ search_locations = [directory / name for directory in search_dirs for name in names]
81
+
82
+ for location in search_locations:
83
+ if location.exists():
84
+ return location
85
+
86
+ # If still not found, try package data locations
87
+ package_locations = [PROJECT_ROOT / "tenxgraph_api" / name for name in names]
88
+
89
+ for location in package_locations:
90
+ if location.exists():
91
+ return location
92
+
93
+ # Generate helpful error message
94
+ searched_paths = search_locations + package_locations
95
+ error_msg = f"Config file '{config_path}' not found in any of these locations:"
96
+ for path in searched_paths:
97
+ error_msg += f"\n - {path}"
98
+
99
+ raise ConfigurationError(error_msg, config_path=config_path)
100
+
101
+ def auto_discover_config(self) -> Path | None:
102
+ """Automatically discover config file using common names.
103
+
104
+ Returns:
105
+ Path to discovered config file or None if not found
106
+ """
107
+ search_dirs = [*self._working_tree(), PROJECT_ROOT]
108
+
109
+ for search_dir in search_dirs:
110
+ for config_name in CONFIG_FILENAMES:
111
+ config_path = search_dir / config_name
112
+ if config_path.exists():
113
+ return config_path
114
+
115
+ return None
116
+
117
+ @staticmethod
118
+ def _working_tree() -> tuple[Path, ...]:
119
+ """Return cwd followed by its ancestors, nearest first."""
120
+ cwd = Path.cwd().resolve()
121
+ return (cwd, *cwd.parents)
122
+
123
+ def load_config(self, config_path: str | None = None) -> dict[str, Any]:
124
+ """Load configuration from file.
125
+
126
+ Args:
127
+ config_path: Optional path to config file
128
+
129
+ Returns:
130
+ Configuration dictionary
131
+
132
+ Raises:
133
+ ConfigurationError: If config loading fails
134
+ """
135
+ if config_path:
136
+ actual_path = self.find_config_file(config_path)
137
+ elif self.config_path:
138
+ actual_path = self.find_config_file(self.config_path)
139
+ else:
140
+ discovered_path = self.auto_discover_config()
141
+ if not discovered_path:
142
+ raise ConfigurationError(
143
+ "No configuration file found. Please provide a config file path "
144
+ "or create one of: " + ", ".join(CONFIG_FILENAMES)
145
+ )
146
+ actual_path = discovered_path
147
+
148
+ try:
149
+ with actual_path.open("r", encoding="utf-8") as f:
150
+ self._config_data = json.load(f)
151
+ except json.JSONDecodeError as e:
152
+ raise ConfigurationError(
153
+ f"Invalid JSON in config file: {e}",
154
+ config_path=str(actual_path),
155
+ ) from e
156
+ except OSError as e:
157
+ raise ConfigurationError(
158
+ f"Failed to read config file: {e}",
159
+ config_path=str(actual_path),
160
+ ) from e
161
+
162
+ # Ensure config data was loaded
163
+ if self._config_data is None:
164
+ raise ConfigurationError(
165
+ "Failed to load configuration data",
166
+ config_path=str(actual_path),
167
+ )
168
+
169
+ # Validate configuration
170
+ self._validate_config(self._config_data)
171
+
172
+ # Store the resolved path for future use
173
+ self.config_path = str(actual_path)
174
+
175
+ return self._config_data
176
+
177
+ def _validate_config(self, config_data: dict[str, Any]) -> None:
178
+ """Validate configuration data.
179
+
180
+ Args:
181
+ config_data: Configuration to validate
182
+
183
+ Raises:
184
+ ConfigurationError: If validation fails
185
+ """
186
+ required_fields = ["agent"]
187
+
188
+ for field in required_fields:
189
+ if field not in config_data:
190
+ raise ConfigurationError(
191
+ f"Missing required field '{field}' in configuration",
192
+ config_path=self.config_path,
193
+ )
194
+
195
+ # Validate agent field
196
+ agent = config_data["agent"]
197
+ if not isinstance(agent, str):
198
+ raise ConfigurationError(
199
+ "Field 'agent' must be a string",
200
+ config_path=self.config_path,
201
+ )
202
+
203
+ def get_config(self) -> dict[str, Any]:
204
+ """Get loaded configuration data.
205
+
206
+ Returns:
207
+ Configuration dictionary
208
+
209
+ Raises:
210
+ ConfigurationError: If no config is loaded
211
+ """
212
+ if self._config_data is None:
213
+ raise ConfigurationError("No configuration loaded. Call load_config() first.")
214
+ return self._config_data
215
+
216
+ def get_config_value(self, key: str, default: Any = None) -> Any:
217
+ """Get a specific configuration value.
218
+
219
+ Args:
220
+ key: Configuration key (supports dot notation)
221
+ default: Default value if key not found
222
+
223
+ Returns:
224
+ Configuration value or default
225
+ """
226
+ if self._config_data is None:
227
+ return default
228
+
229
+ # Support dot notation for nested keys
230
+ keys = key.split(".")
231
+ value = self._config_data
232
+
233
+ for k in keys:
234
+ if isinstance(value, dict) and k in value:
235
+ value = value[k]
236
+ else:
237
+ return default
238
+
239
+ return value
240
+
241
+ def get_test_config(self) -> dict[str, Any]:
242
+ """Return the optional 'test' section from 10xgraph.json.
243
+
244
+ Returns a dict with keys: path, coverage, coverage_threshold.
245
+ All fields are optional; callers should use .get() with their own defaults.
246
+ """
247
+ raw = self.get_config_value("test", default={})
248
+ if not isinstance(raw, dict):
249
+ return {}
250
+ return raw
251
+
252
+ def get_evaluation_config(self) -> dict[str, Any]:
253
+ """Return the optional 'evaluation' section from 10xgraph.json.
254
+
255
+ Returns a dict with keys: directory, output_dir, threshold, timestamp_files.
256
+ All fields are optional; callers should use .get() with their own defaults.
257
+ """
258
+ raw = self.get_config_value("evaluation", default={})
259
+ if not isinstance(raw, dict):
260
+ return {}
261
+ return raw
262
+
263
+ def resolve_env_file(self) -> Path | None:
264
+ """Resolve environment file path from configuration.
265
+
266
+ Returns:
267
+ Path to environment file or None if not configured
268
+ """
269
+ env_file = self.get_config_value("env")
270
+ if not env_file:
271
+ return None
272
+
273
+ # If relative path, resolve relative to config file location
274
+ env_path = Path(env_file)
275
+ if not env_path.is_absolute() and self.config_path:
276
+ config_dir = Path(self.config_path).parent
277
+ env_path = config_dir / env_file
278
+
279
+ return env_path if env_path.exists() else None