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,936 @@
1
+ """10xGraph CLI entry point and lightweight command registry."""
2
+
3
+ import importlib
4
+ import os
5
+ import sys
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ import typer
10
+
11
+ from tenxgraph_api.cli.capabilities import (
12
+ ColorMode,
13
+ OutputFormat,
14
+ ProgressMode,
15
+ cli_env_name,
16
+ truthy_env,
17
+ )
18
+ from tenxgraph_api.cli.constants import (
19
+ CLI_VERSION,
20
+ DEFAULT_CONFIG_FILE,
21
+ DEFAULT_HOST,
22
+ DEFAULT_PORT,
23
+ )
24
+ from tenxgraph_api.cli.context import CLIContext
25
+ from tenxgraph_api.cli.core.output import OutputFormatter
26
+ from tenxgraph_api.cli.exceptions import CLIError, DependencyError
27
+ from tenxgraph_api.cli.logger import setup_cli_logging
28
+
29
+
30
+ def _lazy_command(module_name: str, class_name: str) -> type:
31
+ """Create a compatibility-preserving lazy command adapter.
32
+
33
+ Only the selected command's implementation and heavy dependencies are imported.
34
+ Keeping these class-shaped adapters also preserves the public monkeypatch surface
35
+ used by downstream tests and integrations.
36
+ """
37
+
38
+ class LazyCommand:
39
+ def __init__(self, output: OutputFormatter | None = None) -> None:
40
+ self.output = output
41
+
42
+ def execute(self, *args: Any, **kwargs: Any) -> int:
43
+ try:
44
+ module = importlib.import_module(module_name)
45
+ except ImportError as exc:
46
+ feature = class_name.removesuffix("Command").lower()
47
+ raise DependencyError(
48
+ f"The {feature} command could not load its required dependencies: {exc}",
49
+ hints=(
50
+ "Run `10xgraph audit` to inspect installed package compatibility.",
51
+ "Upgrade with `python -m pip install --upgrade " '"10xgraph>=0.9,<2"`.',
52
+ ),
53
+ ) from exc
54
+ implementation = getattr(module, class_name)
55
+ return implementation(self.output).execute(*args, **kwargs)
56
+
57
+ LazyCommand.__name__ = class_name
58
+ LazyCommand.__qualname__ = class_name
59
+ return LazyCommand
60
+
61
+
62
+ APICommand = _lazy_command("tenxgraph_api.cli.commands.api", "APICommand")
63
+ AuditCommand = _lazy_command("tenxgraph_api.cli.commands.audit", "AuditCommand")
64
+ BuildCommand = _lazy_command("tenxgraph_api.cli.commands.build", "BuildCommand")
65
+ ConfigCommand = _lazy_command("tenxgraph_api.cli.commands.config", "ConfigCommand")
66
+ DemoCommand = _lazy_command("tenxgraph_api.cli.commands.demo", "DemoCommand")
67
+ EvalCommand = _lazy_command("tenxgraph_api.cli.commands.eval", "EvalCommand")
68
+ InitCommand = _lazy_command("tenxgraph_api.cli.commands.init", "InitCommand")
69
+ SkillsCommand = _lazy_command("tenxgraph_api.cli.commands.skills", "SkillsCommand")
70
+ TestCommand = _lazy_command("tenxgraph_api.cli.commands.test", "TestCommand")
71
+ VersionCommand = _lazy_command("tenxgraph_api.cli.commands.version", "VersionCommand")
72
+
73
+ # Create the main Typer app
74
+ app = typer.Typer(
75
+ name="10xgraph",
76
+ help="Build, run, test, and evaluate production-ready 10xGraph agents.",
77
+ epilog=(
78
+ "Examples:\n"
79
+ " 10xgraph init\n"
80
+ " 10xgraph dev\n"
81
+ " 10xgraph test --coverage\n"
82
+ " 10xgraph eval --parallel"
83
+ ),
84
+ context_settings={"help_option_names": ["-h", "--help"]},
85
+ no_args_is_help=True,
86
+ rich_markup_mode="rich",
87
+ pretty_exceptions_enable=False,
88
+ )
89
+
90
+ # Initialize global output formatter
91
+ output = OutputFormatter()
92
+
93
+
94
+ @app.callback(invoke_without_command=True)
95
+ def root( # noqa: PLR0913
96
+ ctx: typer.Context,
97
+ output_format: OutputFormat | None = typer.Option(
98
+ None,
99
+ "--format",
100
+ help="Output format: human, plain, json, or jsonl.",
101
+ rich_help_panel="Global output",
102
+ ),
103
+ json_output: bool = typer.Option(
104
+ False,
105
+ "--json",
106
+ help="Emit versioned JSON output; shorthand for --format json.",
107
+ rich_help_panel="Global output",
108
+ ),
109
+ color: ColorMode | None = typer.Option(
110
+ None,
111
+ "--color",
112
+ help="Color policy: auto, always, or never.",
113
+ rich_help_panel="Global output",
114
+ ),
115
+ no_color: bool = typer.Option(
116
+ False,
117
+ "--no-color",
118
+ help="Disable ANSI color; shorthand for --color never.",
119
+ rich_help_panel="Global output",
120
+ ),
121
+ progress: ProgressMode | None = typer.Option(
122
+ None,
123
+ "--progress",
124
+ help="Progress mode: auto, tty, plain, json, or quiet.",
125
+ rich_help_panel="Global output",
126
+ ),
127
+ animation: bool | None = typer.Option(
128
+ None,
129
+ "--animation/--no-animation",
130
+ help="Enable or disable decorative command animation.",
131
+ rich_help_panel="Global output",
132
+ ),
133
+ fullscreen: bool | None = typer.Option(
134
+ None,
135
+ "--fullscreen/--no-fullscreen",
136
+ help=(
137
+ "Run the command on a dedicated full-screen surface with pinned "
138
+ "header and footer, and play the branded intro. Off by default: output "
139
+ "goes to your normal scrollback. Also TENXGRAPH_FULLSCREEN=1."
140
+ ),
141
+ rich_help_panel="Global output",
142
+ ),
143
+ cwd: Path | None = typer.Option(
144
+ None,
145
+ "--cwd",
146
+ exists=True,
147
+ file_okay=False,
148
+ dir_okay=True,
149
+ resolve_path=True,
150
+ help="Run as if 10xGraph was started in this directory.",
151
+ rich_help_panel="Global context",
152
+ ),
153
+ verbose: int = typer.Option(
154
+ 0,
155
+ "--verbose",
156
+ "-v",
157
+ count=True,
158
+ help="Increase diagnostic verbosity; repeat for more detail.",
159
+ rich_help_panel="Diagnostics",
160
+ ),
161
+ quiet: bool = typer.Option(
162
+ False,
163
+ "--quiet",
164
+ "-q",
165
+ help="Suppress informational, progress, and success output.",
166
+ rich_help_panel="Global output",
167
+ ),
168
+ debug: bool = typer.Option(
169
+ False,
170
+ "--debug",
171
+ help="Enable debug diagnostics.",
172
+ rich_help_panel="Diagnostics",
173
+ ),
174
+ yes: bool = typer.Option(
175
+ False,
176
+ "--yes",
177
+ "-y",
178
+ help="Accept recommended defaults for supported workflows.",
179
+ rich_help_panel="Global context",
180
+ ),
181
+ non_interactive: bool = typer.Option(
182
+ False,
183
+ "--non-interactive",
184
+ help="Never prompt for input.",
185
+ rich_help_panel="Global context",
186
+ ),
187
+ version_flag: bool = typer.Option(
188
+ False,
189
+ "--version",
190
+ "-V",
191
+ is_eager=True,
192
+ help="Show the CLI version and exit.",
193
+ rich_help_panel="Global options",
194
+ ),
195
+ ) -> None:
196
+ """Resolve invocation-wide terminal, logging, and working-directory policy."""
197
+ if cwd is not None:
198
+ os.chdir(cwd)
199
+
200
+ if json_output and output_format not in {None, OutputFormat.JSON}:
201
+ raise typer.BadParameter("--json cannot be combined with a different --format.")
202
+ if no_color and color not in {None, ColorMode.NEVER}:
203
+ raise typer.BadParameter("--no-color cannot be combined with a different --color.")
204
+ if animation is not None and progress is not None:
205
+ expected = ProgressMode.TTY if animation else ProgressMode.PLAIN
206
+ if progress != expected:
207
+ raise typer.BadParameter(
208
+ "--animation/--no-animation conflicts with the selected --progress mode."
209
+ )
210
+ resolved_format = OutputFormat.JSON if json_output else output_format or OutputFormat.HUMAN
211
+ resolved_color = ColorMode.NEVER if no_color else color or ColorMode.AUTO
212
+ if animation is not None:
213
+ resolved_progress = ProgressMode.TTY if animation else ProgressMode.PLAIN
214
+ else:
215
+ resolved_progress = progress or ProgressMode.AUTO
216
+
217
+ output.configure(
218
+ output_format=resolved_format,
219
+ color_mode=resolved_color,
220
+ progress_mode=resolved_progress,
221
+ quiet=quiet,
222
+ )
223
+ setup_cli_logging(verbose=verbose > 0 or debug, quiet=quiet)
224
+ ctx.obj = CLIContext.create(
225
+ capabilities=output.capabilities,
226
+ cwd=Path.cwd(),
227
+ verbosity=verbose,
228
+ quiet=quiet,
229
+ debug=debug,
230
+ yes=yes,
231
+ non_interactive=non_interactive,
232
+ )
233
+ # Output goes to the user's normal scrollback by default, the way gh, uv or cargo
234
+ # behave: nothing to dismiss, nothing lost on exit. The full-screen frame (pinned
235
+ # chrome plus the intro) is opt-in with --fullscreen or TENXGRAPH_FULLSCREEN=1;
236
+ # TENXGRAPH_NO_FULLSCREEN=1 still forces it off. The screen is claimed lazily, by the
237
+ # first command that renders a header.
238
+ if fullscreen is None:
239
+ fullscreen = truthy_env(cli_env_name("FULLSCREEN")) and not truthy_env(
240
+ cli_env_name("NO_FULLSCREEN")
241
+ )
242
+ output.request_fullscreen(fullscreen)
243
+ ctx.call_on_close(output.end_fullscreen_session)
244
+
245
+ if version_flag:
246
+ typer.echo(CLI_VERSION)
247
+ raise typer.Exit()
248
+
249
+
250
+ def _configure_command(*, verbose: bool, quiet: bool) -> None:
251
+ """Apply legacy per-command flags without overriding root output choices."""
252
+ setup_cli_logging(verbose=verbose, quiet=quiet)
253
+ if quiet:
254
+ output.configure(quiet=True)
255
+
256
+
257
+ def handle_exception(e: Exception) -> int:
258
+ """Handle exceptions consistently across all commands.
259
+
260
+ Args:
261
+ e: Exception that occurred
262
+
263
+ Returns:
264
+ Appropriate exit code
265
+ """
266
+ if isinstance(e, CLIError):
267
+ output.error(f"Error [{e.code}]: {e.message}", emoji=False)
268
+ for hint in e.hints:
269
+ output.info(f"Try: {hint}", emoji=False)
270
+ if e.docs_url:
271
+ output.info(f"Docs: {e.docs_url}", emoji=False)
272
+ return e.exit_code
273
+
274
+ output.error(f"Error [AF-INTERNAL-001]: Unexpected error: {e}", emoji=False)
275
+ return 1
276
+
277
+
278
+ @app.command()
279
+ def api(
280
+ config: str = typer.Option(
281
+ DEFAULT_CONFIG_FILE,
282
+ "--config",
283
+ "-c",
284
+ help="Path to config file",
285
+ ),
286
+ host: str = typer.Option(
287
+ DEFAULT_HOST,
288
+ "--host",
289
+ "-H",
290
+ help="Host to run the API on (default: 127.0.0.1, localhost only; "
291
+ "use 0.0.0.0 to bind all interfaces)",
292
+ ),
293
+ port: int = typer.Option(
294
+ DEFAULT_PORT,
295
+ "--port",
296
+ "-p",
297
+ help="Port to run the API on",
298
+ ),
299
+ reload: bool = typer.Option(
300
+ True,
301
+ "--reload/--no-reload",
302
+ help="Enable auto-reload for development",
303
+ ),
304
+ verbose: bool = typer.Option(
305
+ False,
306
+ "--verbose",
307
+ "-v",
308
+ help="Enable verbose logging",
309
+ ),
310
+ quiet: bool = typer.Option(
311
+ False,
312
+ "--quiet",
313
+ "-q",
314
+ help="Suppress all output except errors",
315
+ ),
316
+ ) -> None:
317
+ """Start the 10xGraph API server."""
318
+ # Setup logging
319
+ _configure_command(verbose=verbose, quiet=quiet)
320
+
321
+ try:
322
+ command = APICommand(output)
323
+ exit_code = command.execute(
324
+ config=config,
325
+ host=host,
326
+ port=port,
327
+ reload=reload,
328
+ )
329
+ sys.exit(exit_code)
330
+ except Exception as e:
331
+ sys.exit(handle_exception(e))
332
+
333
+
334
+ @app.command()
335
+ def play(
336
+ config: str = typer.Option(
337
+ DEFAULT_CONFIG_FILE,
338
+ "--config",
339
+ "-c",
340
+ help="Path to config file",
341
+ ),
342
+ host: str = typer.Option(
343
+ DEFAULT_HOST,
344
+ "--host",
345
+ "-H",
346
+ help=(
347
+ "Host to run the API on for the local playground session "
348
+ "(use 127.0.0.1 for localhost only)"
349
+ ),
350
+ ),
351
+ port: int = typer.Option(
352
+ DEFAULT_PORT,
353
+ "--port",
354
+ "-p",
355
+ help="Port to run the API on",
356
+ ),
357
+ reload: bool = typer.Option(
358
+ True,
359
+ "--reload/--no-reload",
360
+ help="Enable auto-reload for development",
361
+ ),
362
+ verbose: bool = typer.Option(
363
+ False,
364
+ "--verbose",
365
+ "-v",
366
+ help="Enable verbose logging",
367
+ ),
368
+ quiet: bool = typer.Option(
369
+ False,
370
+ "--quiet",
371
+ "-q",
372
+ help="Suppress all output except errors",
373
+ ),
374
+ ) -> None:
375
+ """Start the API server and open the hosted playground."""
376
+ _configure_command(verbose=verbose, quiet=quiet)
377
+
378
+ try:
379
+ command = APICommand(output)
380
+ exit_code = command.execute(
381
+ config=config,
382
+ host=host,
383
+ port=port,
384
+ reload=reload,
385
+ open_playground=True,
386
+ )
387
+ sys.exit(exit_code)
388
+ except Exception as e:
389
+ sys.exit(handle_exception(e))
390
+
391
+
392
+ @app.command()
393
+ def dev(
394
+ config: str = typer.Option(
395
+ DEFAULT_CONFIG_FILE,
396
+ "--config",
397
+ "-c",
398
+ help="Path to the project configuration file.",
399
+ ),
400
+ host: str = typer.Option(
401
+ DEFAULT_HOST,
402
+ "--host",
403
+ "-H",
404
+ help="Host interface for the local development server.",
405
+ ),
406
+ port: int = typer.Option(
407
+ DEFAULT_PORT,
408
+ "--port",
409
+ "-p",
410
+ help="Port for the local development server.",
411
+ ),
412
+ reload: bool = typer.Option(
413
+ True,
414
+ "--reload/--no-reload",
415
+ help="Reload the server when project files change.",
416
+ ),
417
+ open_playground: bool = typer.Option(
418
+ True,
419
+ "--open/--no-open",
420
+ help="Open the hosted playground when the API is ready.",
421
+ ),
422
+ verbose: bool = typer.Option(False, "--verbose", "-v", help="Enable verbose logging."),
423
+ quiet: bool = typer.Option(
424
+ False,
425
+ "--quiet",
426
+ "-q",
427
+ help="Suppress all output except errors.",
428
+ ),
429
+ ) -> None:
430
+ """Start the local 10xGraph development server."""
431
+ _configure_command(verbose=verbose, quiet=quiet)
432
+
433
+ try:
434
+ command = APICommand(output)
435
+ exit_code = command.execute(
436
+ config=config,
437
+ host=host,
438
+ port=port,
439
+ reload=reload,
440
+ open_playground=open_playground,
441
+ )
442
+ sys.exit(exit_code)
443
+ except Exception as e:
444
+ sys.exit(handle_exception(e))
445
+
446
+
447
+ @app.command(
448
+ epilog=(
449
+ "Examples:\n"
450
+ " 10xgraph audit\n"
451
+ " 10xgraph audit --config custom.json\n"
452
+ " 10xgraph --format json audit\n"
453
+ " 10xgraph --no-animation audit"
454
+ ),
455
+ )
456
+ def audit(
457
+ config: str = typer.Option(
458
+ DEFAULT_CONFIG_FILE,
459
+ "--config",
460
+ "-c",
461
+ help="Project configuration file to validate (default: 10xgraph.json).",
462
+ ),
463
+ verbose: bool = typer.Option(False, "--verbose", "-v", help="Enable verbose logging."),
464
+ quiet: bool = typer.Option(
465
+ False,
466
+ "--quiet",
467
+ "-q",
468
+ help="Suppress all output except errors.",
469
+ ),
470
+ ) -> None:
471
+ """Audit package compatibility and the current project environment.
472
+
473
+ Runs six read-only checks and prints them as a table: the Python
474
+ interpreter, the installed CLI and core packages, whether the core exposes
475
+ the evaluation API this CLI expects, whether `10xgraph.json` declares a
476
+ valid `agent` key and remote-tool schemas, and whether the default port is free.
477
+
478
+ Nothing is written or changed, so it is safe to run anywhere. Exits 1 if
479
+ any check fails and 0 otherwise, which makes it usable as a CI gate;
480
+ warnings (no project config, port already bound) are reported without
481
+ failing the run.
482
+ """
483
+ _configure_command(verbose=verbose, quiet=quiet)
484
+ try:
485
+ sys.exit(AuditCommand(output).execute(config=config))
486
+ except Exception as e:
487
+ sys.exit(handle_exception(e))
488
+
489
+
490
+ @app.command(rich_help_panel="Diagnostics")
491
+ def demo(
492
+ style: str = typer.Option(
493
+ "all",
494
+ "--style",
495
+ help="Animation theme: all, typing, network, init, build, or eval.",
496
+ ),
497
+ ) -> None:
498
+ """Preview 10xGraph terminal animations without changing project state."""
499
+ try:
500
+ sys.exit(DemoCommand(output).execute(style=style))
501
+ except Exception as e:
502
+ sys.exit(handle_exception(e))
503
+
504
+
505
+ @app.command()
506
+ def version(
507
+ verbose: bool = typer.Option(
508
+ False,
509
+ "--verbose",
510
+ "-v",
511
+ help="Enable verbose logging",
512
+ ),
513
+ quiet: bool = typer.Option(
514
+ False,
515
+ "--quiet",
516
+ "-q",
517
+ help="Suppress all output except errors",
518
+ ),
519
+ ) -> None:
520
+ """Show the CLI version."""
521
+ # Setup logging
522
+ _configure_command(verbose=verbose, quiet=quiet)
523
+
524
+ try:
525
+ command = VersionCommand(output)
526
+ exit_code = command.execute()
527
+ sys.exit(exit_code)
528
+ except Exception as e:
529
+ sys.exit(handle_exception(e))
530
+
531
+
532
+ @app.command(rich_help_panel="Manage")
533
+ def config(
534
+ config_file: str = typer.Option(
535
+ DEFAULT_CONFIG_FILE,
536
+ "--config",
537
+ "-c",
538
+ help="Config file to edit. It is created on first save if missing.",
539
+ ),
540
+ port: int = typer.Option(
541
+ 0,
542
+ "--port",
543
+ "-p",
544
+ help="Port for the local editor (default: any free port).",
545
+ ),
546
+ open_browser: bool = typer.Option(
547
+ True,
548
+ "--open/--no-open",
549
+ help="Open the editor in your default browser.",
550
+ ),
551
+ ) -> None:
552
+ """Edit, validate, and save 10xgraph.json in a browser UI."""
553
+ try:
554
+ command = ConfigCommand(output)
555
+ exit_code = command.execute(config=config_file, port=port, open_browser=open_browser)
556
+ sys.exit(exit_code)
557
+ except Exception as e:
558
+ sys.exit(handle_exception(e))
559
+
560
+
561
+ @app.command()
562
+ def init( # noqa: PLR0913
563
+ ctx: typer.Context,
564
+ path: str = typer.Option(
565
+ ".",
566
+ "--path",
567
+ "-p",
568
+ help="Directory to initialize the agent project in",
569
+ ),
570
+ force: bool = typer.Option(
571
+ False,
572
+ "--force",
573
+ "-f",
574
+ help="Overwrite existing files if they exist",
575
+ ),
576
+ name: str | None = typer.Option(
577
+ None,
578
+ "--name",
579
+ help="Agent name; required only when a default cannot be inferred.",
580
+ ),
581
+ template: str | None = typer.Option(
582
+ None,
583
+ "--template",
584
+ help="Project template: quick-start or production.",
585
+ ),
586
+ auth: str | None = typer.Option(
587
+ None,
588
+ "--auth",
589
+ help="Production authentication: none, jwt, or custom.",
590
+ ),
591
+ rate_limit: str | None = typer.Option(
592
+ None,
593
+ "--rate-limit",
594
+ help="Rate limiting: none, memory, or redis.",
595
+ ),
596
+ yes: bool = typer.Option(
597
+ False,
598
+ "--yes",
599
+ "-y",
600
+ help="Accept recommended defaults and do not prompt.",
601
+ ),
602
+ non_interactive: bool = typer.Option(
603
+ False,
604
+ "--non-interactive",
605
+ help="Fail instead of prompting; suitable for CI and coding agents.",
606
+ ),
607
+ dry_run: bool = typer.Option(
608
+ False,
609
+ "--dry-run",
610
+ help="Preview the scaffold without writing files.",
611
+ ),
612
+ verbose: bool = typer.Option(
613
+ False,
614
+ "--verbose",
615
+ "-v",
616
+ help="Enable verbose logging",
617
+ ),
618
+ quiet: bool = typer.Option(
619
+ False,
620
+ "--quiet",
621
+ "-q",
622
+ help="Suppress all output except errors",
623
+ ),
624
+ ) -> None:
625
+ """Interactively initialize a new agent project."""
626
+ _configure_command(verbose=verbose, quiet=quiet)
627
+ runtime = ctx.find_root().obj
628
+ if isinstance(runtime, CLIContext):
629
+ yes = yes or runtime.yes
630
+ non_interactive = non_interactive or runtime.non_interactive
631
+
632
+ try:
633
+ command = InitCommand(output)
634
+ exit_code = command.execute(
635
+ path=path,
636
+ force=force,
637
+ agent_name=name,
638
+ template=template,
639
+ auth=auth,
640
+ rate_limit=rate_limit,
641
+ yes=yes,
642
+ non_interactive=non_interactive,
643
+ dry_run=dry_run,
644
+ )
645
+ sys.exit(exit_code)
646
+ except Exception as e:
647
+ sys.exit(handle_exception(e))
648
+
649
+
650
+ @app.command()
651
+ def build(
652
+ output_file: str = typer.Option(
653
+ "Dockerfile",
654
+ "--output",
655
+ "-o",
656
+ help="Output Dockerfile path",
657
+ ),
658
+ force: bool = typer.Option(
659
+ False,
660
+ "--force",
661
+ "-f",
662
+ help="Overwrite existing Dockerfile",
663
+ ),
664
+ python_version: str = typer.Option(
665
+ "3.13",
666
+ "--python-version",
667
+ help="Python version to use",
668
+ ),
669
+ port: int = typer.Option(
670
+ DEFAULT_PORT,
671
+ "--port",
672
+ "-p",
673
+ help="Port to expose in the container",
674
+ ),
675
+ docker_compose: bool = typer.Option(
676
+ False,
677
+ "--docker-compose/--no-docker-compose",
678
+ help="Also generate docker-compose.yml and omit CMD in Dockerfile",
679
+ ),
680
+ k8s: bool = typer.Option(
681
+ False,
682
+ "--k8s/--no-k8s",
683
+ help=(
684
+ "Also generate k8s.yaml (Deployment + Service) with a termination grace "
685
+ "period long enough that a rolling deploy does not kill in-flight agent runs"
686
+ ),
687
+ ),
688
+ service_name: str = typer.Option(
689
+ "10xgraph-api",
690
+ "--service-name",
691
+ help="Service name to use in docker-compose.yml / k8s.yaml (if generated)",
692
+ ),
693
+ verbose: bool = typer.Option(
694
+ False,
695
+ "--verbose",
696
+ "-v",
697
+ help="Enable verbose logging",
698
+ ),
699
+ quiet: bool = typer.Option(
700
+ False,
701
+ "--quiet",
702
+ "-q",
703
+ help="Suppress all output except errors",
704
+ ),
705
+ ) -> None:
706
+ """Generate a Dockerfile for the 10xGraph API application."""
707
+ # Setup logging
708
+ _configure_command(verbose=verbose, quiet=quiet)
709
+
710
+ try:
711
+ command = BuildCommand(output)
712
+ exit_code = command.execute(
713
+ output_file=output_file,
714
+ force=force,
715
+ python_version=python_version,
716
+ port=port,
717
+ docker_compose=docker_compose,
718
+ k8s=k8s,
719
+ service_name=service_name,
720
+ )
721
+ sys.exit(exit_code)
722
+ except Exception as e:
723
+ sys.exit(handle_exception(e))
724
+
725
+
726
+ @app.command()
727
+ def skills(
728
+ agent: str | None = typer.Option(
729
+ None,
730
+ "--agent",
731
+ "-a",
732
+ help="Target agent: codex, claude, github, or menu number 1, 2, 3",
733
+ ),
734
+ path: str = typer.Option(
735
+ ".",
736
+ "--path",
737
+ "-p",
738
+ help="Project directory where the skills should be installed",
739
+ ),
740
+ force: bool = typer.Option(
741
+ False,
742
+ "--force",
743
+ "-f",
744
+ help="Overwrite the existing installed 10xGraph skill directory",
745
+ ),
746
+ all_agents: bool = typer.Option(
747
+ False,
748
+ "--all",
749
+ help="Install skills for every supported agent",
750
+ ),
751
+ list_agents: bool = typer.Option(
752
+ False,
753
+ "--list",
754
+ "-l",
755
+ help="List supported agents and exit",
756
+ ),
757
+ validate: list[str] | None = typer.Option(
758
+ None,
759
+ "--validate",
760
+ help=(
761
+ "Validate a skill directory, or a folder of skill directories, against the "
762
+ "Agent Skills specification and exit. Repeatable."
763
+ ),
764
+ ),
765
+ verbose: bool = typer.Option(
766
+ False,
767
+ "--verbose",
768
+ "-v",
769
+ help="Enable verbose logging",
770
+ ),
771
+ quiet: bool = typer.Option(
772
+ False,
773
+ "--quiet",
774
+ "-q",
775
+ help="Suppress all output except errors",
776
+ ),
777
+ ) -> None:
778
+ """Install bundled 10xGraph skills for Codex, Claude, or GitHub, or validate skills."""
779
+ _configure_command(verbose=verbose, quiet=quiet)
780
+
781
+ try:
782
+ command = SkillsCommand(output)
783
+ exit_code = command.execute(
784
+ agent=agent,
785
+ path=path,
786
+ force=force,
787
+ all_agents=all_agents,
788
+ list_agents=list_agents,
789
+ validate_paths=validate,
790
+ )
791
+ sys.exit(exit_code)
792
+ except Exception as e:
793
+ sys.exit(handle_exception(e))
794
+
795
+
796
+ @app.command(
797
+ context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
798
+ )
799
+ def test(
800
+ ctx: typer.Context,
801
+ path: str | None = typer.Argument(
802
+ None, help="Path to tests directory or file (omit to let pytest auto-discover)"
803
+ ),
804
+ coverage: bool = typer.Option(False, "--coverage", "-C", help="Run with coverage"),
805
+ html: bool = typer.Option(
806
+ False, "--html", help="Open HTML coverage report after run (requires --coverage)"
807
+ ),
808
+ keyword: str | None = typer.Option(None, "-k", help="Only run tests matching this expression"),
809
+ verbose: bool = typer.Option(False, "--verbose", "-v", help="Enable verbose output"),
810
+ quiet: bool = typer.Option(False, "--quiet", "-q", help="Suppress all output except errors"),
811
+ ) -> None:
812
+ """Run project tests with pytest.
813
+
814
+ Any arguments after -- are forwarded verbatim to pytest.
815
+ """
816
+ _configure_command(verbose=verbose, quiet=quiet)
817
+
818
+ try:
819
+ command = TestCommand(output)
820
+ exit_code = command.execute(
821
+ path=path,
822
+ coverage=coverage,
823
+ html=html,
824
+ keyword=keyword,
825
+ verbose=verbose,
826
+ quiet=quiet,
827
+ extra_args=tuple(ctx.args),
828
+ )
829
+ sys.exit(exit_code)
830
+ except Exception as e:
831
+ sys.exit(handle_exception(e))
832
+
833
+
834
+ @app.command(name="eval")
835
+ def eval_cmd(
836
+ target: str | None = typer.Argument(
837
+ None,
838
+ help="File or directory to evaluate (default: evals/ from 10xgraph.json or cwd)",
839
+ ),
840
+ output_dir: str = typer.Option(
841
+ "eval_reports",
842
+ "--output",
843
+ "-o",
844
+ help="Directory for generated report files",
845
+ ),
846
+ no_report: bool = typer.Option(
847
+ False,
848
+ "--no-report",
849
+ help="Skip file report generation (console summary only)",
850
+ ),
851
+ threshold: float | None = typer.Option(
852
+ None,
853
+ "--threshold",
854
+ "-t",
855
+ help="Fail if overall pass rate is below this value (0.0-1.0)",
856
+ ),
857
+ open_report: bool = typer.Option(
858
+ False,
859
+ "--open",
860
+ help="Open the HTML report in the default browser after the run",
861
+ ),
862
+ parallel: bool = typer.Option(
863
+ False,
864
+ "--parallel",
865
+ "-p",
866
+ help="Collect all cases from all files into a flat pool and run them concurrently",
867
+ ),
868
+ max_concurrency: int = typer.Option(
869
+ 4,
870
+ "--max-concurrency",
871
+ "-c",
872
+ help="Max cases running concurrently when --parallel is set (global semaphore)",
873
+ ),
874
+ verbose: bool = typer.Option(False, "--verbose", "-v", help="Enable verbose output"),
875
+ quiet: bool = typer.Option(False, "--quiet", "-q", help="Suppress all output except errors"),
876
+ ) -> None:
877
+ """Run agent evaluations.
878
+
879
+ Discovers *_eval.py / eval_*.py files in the target directory (default: evals/).
880
+ Collects all cases from all files into a flat pool, then runs them under a single
881
+ event loop throttled by --max-concurrency. Always generates HTML + JSON reports
882
+ in eval_reports/ unless --no-report is set.
883
+
884
+ Each eval file must expose one of:
885
+ get_eval_set() + get_eval_config() # CLI loads agent from 10xgraph.json
886
+ EVAL_CONFIG + get_eval_set() # same, config as a constant
887
+ any function returning EvalSet # auto-discovered, pytest-style
888
+ """
889
+ _configure_command(verbose=verbose, quiet=quiet)
890
+
891
+ try:
892
+ command = EvalCommand(output)
893
+ exit_code = command.execute(
894
+ target=target,
895
+ output_dir=output_dir,
896
+ no_report=no_report,
897
+ threshold=threshold,
898
+ open_report=open_report,
899
+ parallel=parallel,
900
+ max_concurrency=max_concurrency,
901
+ verbose=verbose,
902
+ quiet=quiet,
903
+ )
904
+ sys.exit(exit_code)
905
+ except Exception as e:
906
+ sys.exit(handle_exception(e))
907
+
908
+
909
+ def main() -> None:
910
+ """Main CLI entry point."""
911
+ try:
912
+ app()
913
+ except KeyboardInterrupt:
914
+ output.warning("\nOperation cancelled by user")
915
+ sys.exit(130)
916
+ except Exception as e:
917
+ sys.exit(handle_exception(e))
918
+ finally:
919
+ # Last line of defence. A full-screen session leaves the terminal on an
920
+ # alternate buffer with a restricted scrolling region; if any path skips
921
+ # the normal teardown, the user's shell inherits both. Closing here is
922
+ # idempotent, so the usual context callback still owns the happy path.
923
+ output.end_fullscreen_session()
924
+
925
+
926
+ def legacy_main() -> None:
927
+ """Entry point for the deprecated ``agentflow`` command; removed in 2.0."""
928
+ sys.stderr.write(
929
+ "The 'agentflow' command is deprecated and will be removed in 2.0; "
930
+ "use '10xgraph' instead.\n"
931
+ )
932
+ main()
933
+
934
+
935
+ if __name__ == "__main__":
936
+ main()