PraisonAI 3.0.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.
- praisonai/__init__.py +54 -0
- praisonai/__main__.py +15 -0
- praisonai/acp/__init__.py +54 -0
- praisonai/acp/config.py +159 -0
- praisonai/acp/server.py +587 -0
- praisonai/acp/session.py +219 -0
- praisonai/adapters/__init__.py +50 -0
- praisonai/adapters/readers.py +395 -0
- praisonai/adapters/rerankers.py +315 -0
- praisonai/adapters/retrievers.py +394 -0
- praisonai/adapters/vector_stores.py +409 -0
- praisonai/agent_scheduler.py +337 -0
- praisonai/agents_generator.py +903 -0
- praisonai/api/call.py +292 -0
- praisonai/auto.py +1197 -0
- praisonai/capabilities/__init__.py +275 -0
- praisonai/capabilities/a2a.py +140 -0
- praisonai/capabilities/assistants.py +283 -0
- praisonai/capabilities/audio.py +320 -0
- praisonai/capabilities/batches.py +469 -0
- praisonai/capabilities/completions.py +336 -0
- praisonai/capabilities/container_files.py +155 -0
- praisonai/capabilities/containers.py +93 -0
- praisonai/capabilities/embeddings.py +158 -0
- praisonai/capabilities/files.py +467 -0
- praisonai/capabilities/fine_tuning.py +293 -0
- praisonai/capabilities/guardrails.py +182 -0
- praisonai/capabilities/images.py +330 -0
- praisonai/capabilities/mcp.py +190 -0
- praisonai/capabilities/messages.py +270 -0
- praisonai/capabilities/moderations.py +154 -0
- praisonai/capabilities/ocr.py +217 -0
- praisonai/capabilities/passthrough.py +204 -0
- praisonai/capabilities/rag.py +207 -0
- praisonai/capabilities/realtime.py +160 -0
- praisonai/capabilities/rerank.py +165 -0
- praisonai/capabilities/responses.py +266 -0
- praisonai/capabilities/search.py +109 -0
- praisonai/capabilities/skills.py +133 -0
- praisonai/capabilities/vector_store_files.py +334 -0
- praisonai/capabilities/vector_stores.py +304 -0
- praisonai/capabilities/videos.py +141 -0
- praisonai/chainlit_ui.py +304 -0
- praisonai/chat/__init__.py +106 -0
- praisonai/chat/app.py +125 -0
- praisonai/cli/__init__.py +26 -0
- praisonai/cli/app.py +213 -0
- praisonai/cli/commands/__init__.py +75 -0
- praisonai/cli/commands/acp.py +70 -0
- praisonai/cli/commands/completion.py +333 -0
- praisonai/cli/commands/config.py +166 -0
- praisonai/cli/commands/debug.py +142 -0
- praisonai/cli/commands/diag.py +55 -0
- praisonai/cli/commands/doctor.py +166 -0
- praisonai/cli/commands/environment.py +179 -0
- praisonai/cli/commands/lsp.py +112 -0
- praisonai/cli/commands/mcp.py +210 -0
- praisonai/cli/commands/profile.py +457 -0
- praisonai/cli/commands/run.py +228 -0
- praisonai/cli/commands/schedule.py +150 -0
- praisonai/cli/commands/serve.py +97 -0
- praisonai/cli/commands/session.py +212 -0
- praisonai/cli/commands/traces.py +145 -0
- praisonai/cli/commands/version.py +101 -0
- praisonai/cli/configuration/__init__.py +18 -0
- praisonai/cli/configuration/loader.py +353 -0
- praisonai/cli/configuration/paths.py +114 -0
- praisonai/cli/configuration/schema.py +164 -0
- praisonai/cli/features/__init__.py +268 -0
- praisonai/cli/features/acp.py +236 -0
- praisonai/cli/features/action_orchestrator.py +546 -0
- praisonai/cli/features/agent_scheduler.py +773 -0
- praisonai/cli/features/agent_tools.py +474 -0
- praisonai/cli/features/agents.py +375 -0
- praisonai/cli/features/at_mentions.py +471 -0
- praisonai/cli/features/auto_memory.py +182 -0
- praisonai/cli/features/autonomy_mode.py +490 -0
- praisonai/cli/features/background.py +356 -0
- praisonai/cli/features/base.py +168 -0
- praisonai/cli/features/capabilities.py +1326 -0
- praisonai/cli/features/checkpoints.py +338 -0
- praisonai/cli/features/code_intelligence.py +652 -0
- praisonai/cli/features/compaction.py +294 -0
- praisonai/cli/features/compare.py +534 -0
- praisonai/cli/features/cost_tracker.py +514 -0
- praisonai/cli/features/debug.py +810 -0
- praisonai/cli/features/deploy.py +517 -0
- praisonai/cli/features/diag.py +289 -0
- praisonai/cli/features/doctor/__init__.py +63 -0
- praisonai/cli/features/doctor/checks/__init__.py +24 -0
- praisonai/cli/features/doctor/checks/acp_checks.py +240 -0
- praisonai/cli/features/doctor/checks/config_checks.py +366 -0
- praisonai/cli/features/doctor/checks/db_checks.py +366 -0
- praisonai/cli/features/doctor/checks/env_checks.py +543 -0
- praisonai/cli/features/doctor/checks/lsp_checks.py +199 -0
- praisonai/cli/features/doctor/checks/mcp_checks.py +349 -0
- praisonai/cli/features/doctor/checks/memory_checks.py +268 -0
- praisonai/cli/features/doctor/checks/network_checks.py +251 -0
- praisonai/cli/features/doctor/checks/obs_checks.py +328 -0
- praisonai/cli/features/doctor/checks/performance_checks.py +235 -0
- praisonai/cli/features/doctor/checks/permissions_checks.py +259 -0
- praisonai/cli/features/doctor/checks/selftest_checks.py +322 -0
- praisonai/cli/features/doctor/checks/serve_checks.py +426 -0
- praisonai/cli/features/doctor/checks/skills_checks.py +231 -0
- praisonai/cli/features/doctor/checks/tools_checks.py +371 -0
- praisonai/cli/features/doctor/engine.py +266 -0
- praisonai/cli/features/doctor/formatters.py +310 -0
- praisonai/cli/features/doctor/handler.py +397 -0
- praisonai/cli/features/doctor/models.py +264 -0
- praisonai/cli/features/doctor/registry.py +239 -0
- praisonai/cli/features/endpoints.py +1019 -0
- praisonai/cli/features/eval.py +560 -0
- praisonai/cli/features/external_agents.py +231 -0
- praisonai/cli/features/fast_context.py +410 -0
- praisonai/cli/features/flow_display.py +566 -0
- praisonai/cli/features/git_integration.py +651 -0
- praisonai/cli/features/guardrail.py +171 -0
- praisonai/cli/features/handoff.py +185 -0
- praisonai/cli/features/hooks.py +583 -0
- praisonai/cli/features/image.py +384 -0
- praisonai/cli/features/interactive_runtime.py +585 -0
- praisonai/cli/features/interactive_tools.py +380 -0
- praisonai/cli/features/interactive_tui.py +603 -0
- praisonai/cli/features/jobs.py +632 -0
- praisonai/cli/features/knowledge.py +531 -0
- praisonai/cli/features/lite.py +244 -0
- praisonai/cli/features/lsp_cli.py +225 -0
- praisonai/cli/features/mcp.py +169 -0
- praisonai/cli/features/message_queue.py +587 -0
- praisonai/cli/features/metrics.py +211 -0
- praisonai/cli/features/n8n.py +673 -0
- praisonai/cli/features/observability.py +293 -0
- praisonai/cli/features/ollama.py +361 -0
- praisonai/cli/features/output_style.py +273 -0
- praisonai/cli/features/package.py +631 -0
- praisonai/cli/features/performance.py +308 -0
- praisonai/cli/features/persistence.py +636 -0
- praisonai/cli/features/profile.py +226 -0
- praisonai/cli/features/profiler/__init__.py +81 -0
- praisonai/cli/features/profiler/core.py +558 -0
- praisonai/cli/features/profiler/optimizations.py +652 -0
- praisonai/cli/features/profiler/suite.py +386 -0
- praisonai/cli/features/profiling.py +350 -0
- praisonai/cli/features/queue/__init__.py +73 -0
- praisonai/cli/features/queue/manager.py +395 -0
- praisonai/cli/features/queue/models.py +286 -0
- praisonai/cli/features/queue/persistence.py +564 -0
- praisonai/cli/features/queue/scheduler.py +484 -0
- praisonai/cli/features/queue/worker.py +372 -0
- praisonai/cli/features/recipe.py +1723 -0
- praisonai/cli/features/recipes.py +449 -0
- praisonai/cli/features/registry.py +229 -0
- praisonai/cli/features/repo_map.py +860 -0
- praisonai/cli/features/router.py +466 -0
- praisonai/cli/features/sandbox_executor.py +515 -0
- praisonai/cli/features/serve.py +829 -0
- praisonai/cli/features/session.py +222 -0
- praisonai/cli/features/skills.py +856 -0
- praisonai/cli/features/slash_commands.py +650 -0
- praisonai/cli/features/telemetry.py +179 -0
- praisonai/cli/features/templates.py +1384 -0
- praisonai/cli/features/thinking.py +305 -0
- praisonai/cli/features/todo.py +334 -0
- praisonai/cli/features/tools.py +680 -0
- praisonai/cli/features/tui/__init__.py +83 -0
- praisonai/cli/features/tui/app.py +580 -0
- praisonai/cli/features/tui/cli.py +566 -0
- praisonai/cli/features/tui/debug.py +511 -0
- praisonai/cli/features/tui/events.py +99 -0
- praisonai/cli/features/tui/mock_provider.py +328 -0
- praisonai/cli/features/tui/orchestrator.py +652 -0
- praisonai/cli/features/tui/screens/__init__.py +50 -0
- praisonai/cli/features/tui/screens/main.py +245 -0
- praisonai/cli/features/tui/screens/queue.py +174 -0
- praisonai/cli/features/tui/screens/session.py +124 -0
- praisonai/cli/features/tui/screens/settings.py +148 -0
- praisonai/cli/features/tui/widgets/__init__.py +56 -0
- praisonai/cli/features/tui/widgets/chat.py +261 -0
- praisonai/cli/features/tui/widgets/composer.py +224 -0
- praisonai/cli/features/tui/widgets/queue_panel.py +200 -0
- praisonai/cli/features/tui/widgets/status.py +167 -0
- praisonai/cli/features/tui/widgets/tool_panel.py +248 -0
- praisonai/cli/features/workflow.py +720 -0
- praisonai/cli/legacy.py +236 -0
- praisonai/cli/main.py +5559 -0
- praisonai/cli/schedule_cli.py +54 -0
- praisonai/cli/state/__init__.py +31 -0
- praisonai/cli/state/identifiers.py +161 -0
- praisonai/cli/state/sessions.py +313 -0
- praisonai/code/__init__.py +93 -0
- praisonai/code/agent_tools.py +344 -0
- praisonai/code/diff/__init__.py +21 -0
- praisonai/code/diff/diff_strategy.py +432 -0
- praisonai/code/tools/__init__.py +27 -0
- praisonai/code/tools/apply_diff.py +221 -0
- praisonai/code/tools/execute_command.py +275 -0
- praisonai/code/tools/list_files.py +274 -0
- praisonai/code/tools/read_file.py +206 -0
- praisonai/code/tools/search_replace.py +248 -0
- praisonai/code/tools/write_file.py +217 -0
- praisonai/code/utils/__init__.py +46 -0
- praisonai/code/utils/file_utils.py +307 -0
- praisonai/code/utils/ignore_utils.py +308 -0
- praisonai/code/utils/text_utils.py +276 -0
- praisonai/db/__init__.py +64 -0
- praisonai/db/adapter.py +531 -0
- praisonai/deploy/__init__.py +62 -0
- praisonai/deploy/api.py +231 -0
- praisonai/deploy/docker.py +454 -0
- praisonai/deploy/doctor.py +367 -0
- praisonai/deploy/main.py +327 -0
- praisonai/deploy/models.py +179 -0
- praisonai/deploy/providers/__init__.py +33 -0
- praisonai/deploy/providers/aws.py +331 -0
- praisonai/deploy/providers/azure.py +358 -0
- praisonai/deploy/providers/base.py +101 -0
- praisonai/deploy/providers/gcp.py +314 -0
- praisonai/deploy/schema.py +208 -0
- praisonai/deploy.py +185 -0
- praisonai/endpoints/__init__.py +53 -0
- praisonai/endpoints/a2u_server.py +410 -0
- praisonai/endpoints/discovery.py +165 -0
- praisonai/endpoints/providers/__init__.py +28 -0
- praisonai/endpoints/providers/a2a.py +253 -0
- praisonai/endpoints/providers/a2u.py +208 -0
- praisonai/endpoints/providers/agents_api.py +171 -0
- praisonai/endpoints/providers/base.py +231 -0
- praisonai/endpoints/providers/mcp.py +263 -0
- praisonai/endpoints/providers/recipe.py +206 -0
- praisonai/endpoints/providers/tools_mcp.py +150 -0
- praisonai/endpoints/registry.py +131 -0
- praisonai/endpoints/server.py +161 -0
- praisonai/inbuilt_tools/__init__.py +24 -0
- praisonai/inbuilt_tools/autogen_tools.py +117 -0
- praisonai/inc/__init__.py +2 -0
- praisonai/inc/config.py +96 -0
- praisonai/inc/models.py +155 -0
- praisonai/integrations/__init__.py +56 -0
- praisonai/integrations/base.py +303 -0
- praisonai/integrations/claude_code.py +270 -0
- praisonai/integrations/codex_cli.py +255 -0
- praisonai/integrations/cursor_cli.py +195 -0
- praisonai/integrations/gemini_cli.py +222 -0
- praisonai/jobs/__init__.py +67 -0
- praisonai/jobs/executor.py +425 -0
- praisonai/jobs/models.py +230 -0
- praisonai/jobs/router.py +314 -0
- praisonai/jobs/server.py +186 -0
- praisonai/jobs/store.py +203 -0
- praisonai/llm/__init__.py +66 -0
- praisonai/llm/registry.py +382 -0
- praisonai/mcp_server/__init__.py +152 -0
- praisonai/mcp_server/adapters/__init__.py +74 -0
- praisonai/mcp_server/adapters/agents.py +128 -0
- praisonai/mcp_server/adapters/capabilities.py +168 -0
- praisonai/mcp_server/adapters/cli_tools.py +568 -0
- praisonai/mcp_server/adapters/extended_capabilities.py +462 -0
- praisonai/mcp_server/adapters/knowledge.py +93 -0
- praisonai/mcp_server/adapters/memory.py +104 -0
- praisonai/mcp_server/adapters/prompts.py +306 -0
- praisonai/mcp_server/adapters/resources.py +124 -0
- praisonai/mcp_server/adapters/tools_bridge.py +280 -0
- praisonai/mcp_server/auth/__init__.py +48 -0
- praisonai/mcp_server/auth/api_key.py +291 -0
- praisonai/mcp_server/auth/oauth.py +460 -0
- praisonai/mcp_server/auth/oidc.py +289 -0
- praisonai/mcp_server/auth/scopes.py +260 -0
- praisonai/mcp_server/cli.py +852 -0
- praisonai/mcp_server/elicitation.py +445 -0
- praisonai/mcp_server/icons.py +302 -0
- praisonai/mcp_server/recipe_adapter.py +573 -0
- praisonai/mcp_server/recipe_cli.py +824 -0
- praisonai/mcp_server/registry.py +703 -0
- praisonai/mcp_server/sampling.py +422 -0
- praisonai/mcp_server/server.py +490 -0
- praisonai/mcp_server/tasks.py +443 -0
- praisonai/mcp_server/transports/__init__.py +18 -0
- praisonai/mcp_server/transports/http_stream.py +376 -0
- praisonai/mcp_server/transports/stdio.py +132 -0
- praisonai/persistence/__init__.py +84 -0
- praisonai/persistence/config.py +238 -0
- praisonai/persistence/conversation/__init__.py +25 -0
- praisonai/persistence/conversation/async_mysql.py +427 -0
- praisonai/persistence/conversation/async_postgres.py +410 -0
- praisonai/persistence/conversation/async_sqlite.py +371 -0
- praisonai/persistence/conversation/base.py +151 -0
- praisonai/persistence/conversation/json_store.py +250 -0
- praisonai/persistence/conversation/mysql.py +387 -0
- praisonai/persistence/conversation/postgres.py +401 -0
- praisonai/persistence/conversation/singlestore.py +240 -0
- praisonai/persistence/conversation/sqlite.py +341 -0
- praisonai/persistence/conversation/supabase.py +203 -0
- praisonai/persistence/conversation/surrealdb.py +287 -0
- praisonai/persistence/factory.py +301 -0
- praisonai/persistence/hooks/__init__.py +18 -0
- praisonai/persistence/hooks/agent_hooks.py +297 -0
- praisonai/persistence/knowledge/__init__.py +26 -0
- praisonai/persistence/knowledge/base.py +144 -0
- praisonai/persistence/knowledge/cassandra.py +232 -0
- praisonai/persistence/knowledge/chroma.py +295 -0
- praisonai/persistence/knowledge/clickhouse.py +242 -0
- praisonai/persistence/knowledge/cosmosdb_vector.py +438 -0
- praisonai/persistence/knowledge/couchbase.py +286 -0
- praisonai/persistence/knowledge/lancedb.py +216 -0
- praisonai/persistence/knowledge/langchain_adapter.py +291 -0
- praisonai/persistence/knowledge/lightrag_adapter.py +212 -0
- praisonai/persistence/knowledge/llamaindex_adapter.py +256 -0
- praisonai/persistence/knowledge/milvus.py +277 -0
- praisonai/persistence/knowledge/mongodb_vector.py +306 -0
- praisonai/persistence/knowledge/pgvector.py +335 -0
- praisonai/persistence/knowledge/pinecone.py +253 -0
- praisonai/persistence/knowledge/qdrant.py +301 -0
- praisonai/persistence/knowledge/redis_vector.py +291 -0
- praisonai/persistence/knowledge/singlestore_vector.py +299 -0
- praisonai/persistence/knowledge/surrealdb_vector.py +309 -0
- praisonai/persistence/knowledge/upstash_vector.py +266 -0
- praisonai/persistence/knowledge/weaviate.py +223 -0
- praisonai/persistence/migrations/__init__.py +10 -0
- praisonai/persistence/migrations/manager.py +251 -0
- praisonai/persistence/orchestrator.py +406 -0
- praisonai/persistence/state/__init__.py +21 -0
- praisonai/persistence/state/async_mongodb.py +200 -0
- praisonai/persistence/state/base.py +107 -0
- praisonai/persistence/state/dynamodb.py +226 -0
- praisonai/persistence/state/firestore.py +175 -0
- praisonai/persistence/state/gcs.py +155 -0
- praisonai/persistence/state/memory.py +245 -0
- praisonai/persistence/state/mongodb.py +158 -0
- praisonai/persistence/state/redis.py +190 -0
- praisonai/persistence/state/upstash.py +144 -0
- praisonai/persistence/tests/__init__.py +3 -0
- praisonai/persistence/tests/test_all_backends.py +633 -0
- praisonai/profiler.py +1214 -0
- praisonai/recipe/__init__.py +134 -0
- praisonai/recipe/bridge.py +278 -0
- praisonai/recipe/core.py +893 -0
- praisonai/recipe/exceptions.py +54 -0
- praisonai/recipe/history.py +402 -0
- praisonai/recipe/models.py +266 -0
- praisonai/recipe/operations.py +440 -0
- praisonai/recipe/policy.py +422 -0
- praisonai/recipe/registry.py +849 -0
- praisonai/recipe/runtime.py +214 -0
- praisonai/recipe/security.py +711 -0
- praisonai/recipe/serve.py +859 -0
- praisonai/recipe/server.py +613 -0
- praisonai/scheduler/__init__.py +45 -0
- praisonai/scheduler/agent_scheduler.py +552 -0
- praisonai/scheduler/base.py +124 -0
- praisonai/scheduler/daemon_manager.py +225 -0
- praisonai/scheduler/state_manager.py +155 -0
- praisonai/scheduler/yaml_loader.py +193 -0
- praisonai/scheduler.py +194 -0
- praisonai/setup/__init__.py +1 -0
- praisonai/setup/build.py +21 -0
- praisonai/setup/post_install.py +23 -0
- praisonai/setup/setup_conda_env.py +25 -0
- praisonai/setup.py +16 -0
- praisonai/templates/__init__.py +116 -0
- praisonai/templates/cache.py +364 -0
- praisonai/templates/dependency_checker.py +358 -0
- praisonai/templates/discovery.py +391 -0
- praisonai/templates/loader.py +564 -0
- praisonai/templates/registry.py +511 -0
- praisonai/templates/resolver.py +206 -0
- praisonai/templates/security.py +327 -0
- praisonai/templates/tool_override.py +498 -0
- praisonai/templates/tools_doctor.py +256 -0
- praisonai/test.py +105 -0
- praisonai/train.py +562 -0
- praisonai/train_vision.py +306 -0
- praisonai/ui/agents.py +824 -0
- praisonai/ui/callbacks.py +57 -0
- praisonai/ui/chainlit_compat.py +246 -0
- praisonai/ui/chat.py +532 -0
- praisonai/ui/code.py +717 -0
- praisonai/ui/colab.py +474 -0
- praisonai/ui/colab_chainlit.py +81 -0
- praisonai/ui/components/aicoder.py +284 -0
- praisonai/ui/context.py +283 -0
- praisonai/ui/database_config.py +56 -0
- praisonai/ui/db.py +294 -0
- praisonai/ui/realtime.py +488 -0
- praisonai/ui/realtimeclient/__init__.py +756 -0
- praisonai/ui/realtimeclient/tools.py +242 -0
- praisonai/ui/sql_alchemy.py +710 -0
- praisonai/upload_vision.py +140 -0
- praisonai/version.py +1 -0
- praisonai-3.0.0.dist-info/METADATA +3493 -0
- praisonai-3.0.0.dist-info/RECORD +393 -0
- praisonai-3.0.0.dist-info/WHEEL +5 -0
- praisonai-3.0.0.dist-info/entry_points.txt +4 -0
- praisonai-3.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Diag command group for PraisonAI CLI.
|
|
3
|
+
|
|
4
|
+
Wraps existing diagnostics functionality from features/diag.py.
|
|
5
|
+
Provides diagnostic export for bug reports.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
import typer
|
|
11
|
+
|
|
12
|
+
from ..output.console import get_output_controller
|
|
13
|
+
|
|
14
|
+
app = typer.Typer(help="Diagnostics export")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@app.command("export")
|
|
18
|
+
def diag_export(
|
|
19
|
+
output_path: Optional[str] = typer.Option(None, "--output", "-o", help="Output path"),
|
|
20
|
+
workspace: str = typer.Option(".", "--workspace", "-w", help="Workspace root directory"),
|
|
21
|
+
include_logs: bool = typer.Option(True, "--include-logs/--no-logs", help="Include log files"),
|
|
22
|
+
include_config: bool = typer.Option(True, "--include-config/--no-config", help="Include configuration"),
|
|
23
|
+
include_trace: bool = typer.Option(True, "--include-trace/--no-trace", help="Include recent traces"),
|
|
24
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
25
|
+
):
|
|
26
|
+
"""Export diagnostic bundle for bug reports."""
|
|
27
|
+
args = ["export", "--workspace", workspace]
|
|
28
|
+
|
|
29
|
+
if output_path:
|
|
30
|
+
args.extend(["--output", output_path])
|
|
31
|
+
if not include_logs:
|
|
32
|
+
args.append("--no-logs")
|
|
33
|
+
if not include_config:
|
|
34
|
+
args.append("--no-config")
|
|
35
|
+
if not include_trace:
|
|
36
|
+
args.append("--no-trace")
|
|
37
|
+
if json_output:
|
|
38
|
+
args.append("--json")
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
from ..features.diag import run_diag_command
|
|
42
|
+
exit_code = run_diag_command(args)
|
|
43
|
+
raise typer.Exit(exit_code)
|
|
44
|
+
except ImportError as e:
|
|
45
|
+
output = get_output_controller()
|
|
46
|
+
output.print_error(f"Diag module not available: {e}")
|
|
47
|
+
raise typer.Exit(4)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@app.callback(invoke_without_command=True)
|
|
51
|
+
def diag_callback(ctx: typer.Context):
|
|
52
|
+
"""Show diag help or run export."""
|
|
53
|
+
if ctx.invoked_subcommand is None:
|
|
54
|
+
# Default to export
|
|
55
|
+
diag_export()
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Doctor command group for PraisonAI CLI.
|
|
3
|
+
|
|
4
|
+
Wraps existing doctor functionality from features/doctor/.
|
|
5
|
+
Provides health checks and diagnostics.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
import typer
|
|
11
|
+
|
|
12
|
+
from ..output.console import get_output_controller
|
|
13
|
+
|
|
14
|
+
app = typer.Typer(help="Health checks and diagnostics")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _run_doctor(args: list) -> int:
|
|
18
|
+
"""Run doctor command with args."""
|
|
19
|
+
try:
|
|
20
|
+
from ..features.doctor.handler import DoctorHandler
|
|
21
|
+
handler = DoctorHandler()
|
|
22
|
+
# DoctorHandler uses execute(action, action_args) pattern
|
|
23
|
+
action = args[0] if args else None
|
|
24
|
+
action_args = args[1:] if len(args) > 1 else []
|
|
25
|
+
return handler.execute(action, action_args)
|
|
26
|
+
except ImportError as e:
|
|
27
|
+
output = get_output_controller()
|
|
28
|
+
output.print_error(f"Doctor module not available: {e}")
|
|
29
|
+
return 4
|
|
30
|
+
except Exception as e:
|
|
31
|
+
output = get_output_controller()
|
|
32
|
+
output.print_error(f"Doctor error: {e}")
|
|
33
|
+
return 1
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@app.command("env")
|
|
37
|
+
def doctor_env(
|
|
38
|
+
deep: bool = typer.Option(False, "--deep", help="Enable deeper probes"),
|
|
39
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
40
|
+
timeout: float = typer.Option(10.0, "--timeout", help="Per-check timeout"),
|
|
41
|
+
):
|
|
42
|
+
"""Check environment variables and API keys."""
|
|
43
|
+
args = ["env"]
|
|
44
|
+
if deep:
|
|
45
|
+
args.append("--deep")
|
|
46
|
+
if json_output:
|
|
47
|
+
args.append("--json")
|
|
48
|
+
args.extend(["--timeout", str(timeout)])
|
|
49
|
+
raise typer.Exit(_run_doctor(args))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@app.command("config")
|
|
53
|
+
def doctor_config(
|
|
54
|
+
deep: bool = typer.Option(False, "--deep", help="Enable deeper probes"),
|
|
55
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
56
|
+
):
|
|
57
|
+
"""Check configuration files."""
|
|
58
|
+
args = ["config"]
|
|
59
|
+
if deep:
|
|
60
|
+
args.append("--deep")
|
|
61
|
+
if json_output:
|
|
62
|
+
args.append("--json")
|
|
63
|
+
raise typer.Exit(_run_doctor(args))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@app.command("tools")
|
|
67
|
+
def doctor_tools(
|
|
68
|
+
deep: bool = typer.Option(False, "--deep", help="Enable deeper probes"),
|
|
69
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
70
|
+
):
|
|
71
|
+
"""Check tools availability."""
|
|
72
|
+
args = ["tools"]
|
|
73
|
+
if deep:
|
|
74
|
+
args.append("--deep")
|
|
75
|
+
if json_output:
|
|
76
|
+
args.append("--json")
|
|
77
|
+
raise typer.Exit(_run_doctor(args))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@app.command("db")
|
|
81
|
+
def doctor_db(
|
|
82
|
+
deep: bool = typer.Option(False, "--deep", help="Enable deeper probes"),
|
|
83
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
84
|
+
):
|
|
85
|
+
"""Check database connections."""
|
|
86
|
+
args = ["db"]
|
|
87
|
+
if deep:
|
|
88
|
+
args.append("--deep")
|
|
89
|
+
if json_output:
|
|
90
|
+
args.append("--json")
|
|
91
|
+
raise typer.Exit(_run_doctor(args))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@app.command("mcp")
|
|
95
|
+
def doctor_mcp(
|
|
96
|
+
deep: bool = typer.Option(False, "--deep", help="Enable deeper probes"),
|
|
97
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
98
|
+
):
|
|
99
|
+
"""Check MCP servers."""
|
|
100
|
+
args = ["mcp"]
|
|
101
|
+
if deep:
|
|
102
|
+
args.append("--deep")
|
|
103
|
+
if json_output:
|
|
104
|
+
args.append("--json")
|
|
105
|
+
raise typer.Exit(_run_doctor(args))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@app.command("network")
|
|
109
|
+
def doctor_network(
|
|
110
|
+
deep: bool = typer.Option(False, "--deep", help="Enable deeper probes"),
|
|
111
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
112
|
+
):
|
|
113
|
+
"""Check network connectivity."""
|
|
114
|
+
args = ["network"]
|
|
115
|
+
if deep:
|
|
116
|
+
args.append("--deep")
|
|
117
|
+
if json_output:
|
|
118
|
+
args.append("--json")
|
|
119
|
+
raise typer.Exit(_run_doctor(args))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@app.command("performance")
|
|
123
|
+
def doctor_performance(
|
|
124
|
+
deep: bool = typer.Option(False, "--deep", help="Enable deeper probes"),
|
|
125
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
126
|
+
):
|
|
127
|
+
"""Check performance metrics."""
|
|
128
|
+
args = ["performance"]
|
|
129
|
+
if deep:
|
|
130
|
+
args.append("--deep")
|
|
131
|
+
if json_output:
|
|
132
|
+
args.append("--json")
|
|
133
|
+
raise typer.Exit(_run_doctor(args))
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@app.command("selftest")
|
|
137
|
+
def doctor_selftest(
|
|
138
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
139
|
+
):
|
|
140
|
+
"""Run self-test."""
|
|
141
|
+
args = ["selftest"]
|
|
142
|
+
if json_output:
|
|
143
|
+
args.append("--json")
|
|
144
|
+
raise typer.Exit(_run_doctor(args))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@app.callback(invoke_without_command=True)
|
|
148
|
+
def doctor_callback(
|
|
149
|
+
ctx: typer.Context,
|
|
150
|
+
deep: bool = typer.Option(False, "--deep", help="Enable deeper probes"),
|
|
151
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
152
|
+
strict: bool = typer.Option(False, "--strict", help="Treat warnings as failures"),
|
|
153
|
+
quiet: bool = typer.Option(False, "--quiet", "-q", help="Minimal output"),
|
|
154
|
+
):
|
|
155
|
+
"""Run all fast health checks."""
|
|
156
|
+
if ctx.invoked_subcommand is None:
|
|
157
|
+
args = []
|
|
158
|
+
if deep:
|
|
159
|
+
args.append("--deep")
|
|
160
|
+
if json_output:
|
|
161
|
+
args.append("--json")
|
|
162
|
+
if strict:
|
|
163
|
+
args.append("--strict")
|
|
164
|
+
if quiet:
|
|
165
|
+
args.append("--quiet")
|
|
166
|
+
raise typer.Exit(_run_doctor(args))
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Environment command group for PraisonAI CLI.
|
|
3
|
+
|
|
4
|
+
Provides environment management and diagnostics:
|
|
5
|
+
- env view: Show environment variables
|
|
6
|
+
- env check: Validate API keys
|
|
7
|
+
- env doctor: Run diagnostics (alias for doctor command)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
from typing import Optional
|
|
12
|
+
|
|
13
|
+
import typer
|
|
14
|
+
|
|
15
|
+
from ..output.console import get_output_controller
|
|
16
|
+
|
|
17
|
+
app = typer.Typer(help="Environment and diagnostics")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Known API key patterns
|
|
21
|
+
API_KEY_PATTERNS = {
|
|
22
|
+
"OPENAI_API_KEY": {"prefix": "sk-", "min_length": 20},
|
|
23
|
+
"ANTHROPIC_API_KEY": {"prefix": "sk-ant-", "min_length": 20},
|
|
24
|
+
"GOOGLE_API_KEY": {"prefix": "AI", "min_length": 20},
|
|
25
|
+
"GEMINI_API_KEY": {"prefix": "AI", "min_length": 20},
|
|
26
|
+
"TAVILY_API_KEY": {"prefix": "tvly-", "min_length": 20},
|
|
27
|
+
"GROQ_API_KEY": {"prefix": "gsk_", "min_length": 20},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _redact_key(value: str, show_chars: int = 4) -> str:
|
|
32
|
+
"""Redact an API key for display."""
|
|
33
|
+
if len(value) <= show_chars * 2:
|
|
34
|
+
return "*" * len(value)
|
|
35
|
+
return value[:show_chars] + "*" * (len(value) - show_chars * 2) + value[-show_chars:]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _validate_key(name: str, value: str) -> tuple[bool, str]:
|
|
39
|
+
"""Validate an API key format."""
|
|
40
|
+
if name not in API_KEY_PATTERNS:
|
|
41
|
+
return True, "Unknown key type"
|
|
42
|
+
|
|
43
|
+
pattern = API_KEY_PATTERNS[name]
|
|
44
|
+
|
|
45
|
+
if len(value) < pattern["min_length"]:
|
|
46
|
+
return False, f"Too short (expected >= {pattern['min_length']} chars)"
|
|
47
|
+
|
|
48
|
+
if pattern.get("prefix") and not value.startswith(pattern["prefix"]):
|
|
49
|
+
return False, f"Invalid prefix (expected {pattern['prefix']}...)"
|
|
50
|
+
|
|
51
|
+
return True, "Valid format"
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@app.command("view")
|
|
55
|
+
def env_view(
|
|
56
|
+
show_values: bool = typer.Option(
|
|
57
|
+
False,
|
|
58
|
+
"--show-values",
|
|
59
|
+
help="Show actual values (redacted by default)",
|
|
60
|
+
),
|
|
61
|
+
filter_prefix: Optional[str] = typer.Option(
|
|
62
|
+
None,
|
|
63
|
+
"--filter",
|
|
64
|
+
"-f",
|
|
65
|
+
help="Filter by prefix (e.g., OPENAI, PRAISONAI)",
|
|
66
|
+
),
|
|
67
|
+
):
|
|
68
|
+
"""Show relevant environment variables."""
|
|
69
|
+
output = get_output_controller()
|
|
70
|
+
|
|
71
|
+
# Relevant prefixes
|
|
72
|
+
prefixes = ["OPENAI", "ANTHROPIC", "GOOGLE", "GEMINI", "TAVILY", "GROQ",
|
|
73
|
+
"PRAISONAI", "MODEL", "LLM", "OLLAMA", "AZURE"]
|
|
74
|
+
|
|
75
|
+
if filter_prefix:
|
|
76
|
+
prefixes = [filter_prefix.upper()]
|
|
77
|
+
|
|
78
|
+
env_vars = {}
|
|
79
|
+
for key, value in os.environ.items():
|
|
80
|
+
for prefix in prefixes:
|
|
81
|
+
if key.upper().startswith(prefix):
|
|
82
|
+
if show_values:
|
|
83
|
+
if "KEY" in key.upper() or "SECRET" in key.upper() or "TOKEN" in key.upper():
|
|
84
|
+
env_vars[key] = _redact_key(value)
|
|
85
|
+
else:
|
|
86
|
+
env_vars[key] = value
|
|
87
|
+
else:
|
|
88
|
+
env_vars[key] = "***" if value else "(empty)"
|
|
89
|
+
break
|
|
90
|
+
|
|
91
|
+
if output.is_json_mode:
|
|
92
|
+
output.print_json({"environment": env_vars})
|
|
93
|
+
return
|
|
94
|
+
|
|
95
|
+
if not env_vars:
|
|
96
|
+
output.print_info("No relevant environment variables found")
|
|
97
|
+
return
|
|
98
|
+
|
|
99
|
+
headers = ["Variable", "Value"]
|
|
100
|
+
rows = [[k, v] for k, v in sorted(env_vars.items())]
|
|
101
|
+
output.print_table(headers, rows, title="Environment Variables")
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@app.command("check")
|
|
105
|
+
def env_check():
|
|
106
|
+
"""Validate API keys and configuration."""
|
|
107
|
+
output = get_output_controller()
|
|
108
|
+
|
|
109
|
+
results = []
|
|
110
|
+
all_valid = True
|
|
111
|
+
|
|
112
|
+
for key_name, pattern in API_KEY_PATTERNS.items():
|
|
113
|
+
value = os.environ.get(key_name)
|
|
114
|
+
|
|
115
|
+
if value:
|
|
116
|
+
valid, message = _validate_key(key_name, value)
|
|
117
|
+
results.append({
|
|
118
|
+
"key": key_name,
|
|
119
|
+
"present": True,
|
|
120
|
+
"valid": valid,
|
|
121
|
+
"message": message,
|
|
122
|
+
})
|
|
123
|
+
if not valid:
|
|
124
|
+
all_valid = False
|
|
125
|
+
else:
|
|
126
|
+
results.append({
|
|
127
|
+
"key": key_name,
|
|
128
|
+
"present": False,
|
|
129
|
+
"valid": False,
|
|
130
|
+
"message": "Not set",
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
if output.is_json_mode:
|
|
134
|
+
output.print_json({"checks": results, "all_valid": all_valid})
|
|
135
|
+
return
|
|
136
|
+
|
|
137
|
+
headers = ["Key", "Status", "Message"]
|
|
138
|
+
rows = []
|
|
139
|
+
for r in results:
|
|
140
|
+
if r["present"]:
|
|
141
|
+
status = "✅" if r["valid"] else "⚠️"
|
|
142
|
+
else:
|
|
143
|
+
status = "❌"
|
|
144
|
+
rows.append([r["key"], status, r["message"]])
|
|
145
|
+
|
|
146
|
+
output.print_table(headers, rows, title="API Key Validation")
|
|
147
|
+
|
|
148
|
+
if not all_valid:
|
|
149
|
+
output.print_warning("Some API keys are missing or invalid")
|
|
150
|
+
raise typer.Exit(3) # Exit code 3 = missing config/env
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@app.command("doctor")
|
|
154
|
+
def env_doctor(
|
|
155
|
+
deep: bool = typer.Option(
|
|
156
|
+
False,
|
|
157
|
+
"--deep",
|
|
158
|
+
help="Run deep checks (network, DB connections)",
|
|
159
|
+
),
|
|
160
|
+
):
|
|
161
|
+
"""Run environment diagnostics (alias for 'praisonai doctor env')."""
|
|
162
|
+
output = get_output_controller()
|
|
163
|
+
|
|
164
|
+
# Delegate to doctor command
|
|
165
|
+
try:
|
|
166
|
+
from ..features.doctor.handler import DoctorHandler
|
|
167
|
+
handler = DoctorHandler()
|
|
168
|
+
|
|
169
|
+
# Run env checks
|
|
170
|
+
if output.is_json_mode:
|
|
171
|
+
# Run and get JSON output
|
|
172
|
+
result = handler.handle(["env", "--json"] if not deep else ["env", "--json", "--deep"])
|
|
173
|
+
else:
|
|
174
|
+
result = handler.handle(["env"] if not deep else ["env", "--deep"])
|
|
175
|
+
|
|
176
|
+
raise typer.Exit(result)
|
|
177
|
+
except ImportError:
|
|
178
|
+
# Fallback to basic env check
|
|
179
|
+
env_check()
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""
|
|
2
|
+
LSP command group for PraisonAI CLI.
|
|
3
|
+
|
|
4
|
+
Wraps existing LSP functionality from features/lsp_cli.py.
|
|
5
|
+
Provides LSP service lifecycle management.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
import typer
|
|
11
|
+
|
|
12
|
+
from ..output.console import get_output_controller
|
|
13
|
+
|
|
14
|
+
app = typer.Typer(help="LSP service lifecycle management")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@app.command("start")
|
|
18
|
+
def lsp_start(
|
|
19
|
+
workspace: str = typer.Option(".", "--workspace", "-w", help="Workspace root directory"),
|
|
20
|
+
language: Optional[str] = typer.Option(None, "--language", "-l", help="Language to start"),
|
|
21
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
22
|
+
):
|
|
23
|
+
"""Start LSP server(s)."""
|
|
24
|
+
args = ["start", "--workspace", workspace]
|
|
25
|
+
if language:
|
|
26
|
+
args.extend(["--language", language])
|
|
27
|
+
if json_output:
|
|
28
|
+
args.append("--json")
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
from ..features.lsp_cli import run_lsp_command
|
|
32
|
+
exit_code = run_lsp_command(args)
|
|
33
|
+
raise typer.Exit(exit_code)
|
|
34
|
+
except ImportError as e:
|
|
35
|
+
output = get_output_controller()
|
|
36
|
+
output.print_error(f"LSP module not available: {e}")
|
|
37
|
+
raise typer.Exit(4)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@app.command("stop")
|
|
41
|
+
def lsp_stop(
|
|
42
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
43
|
+
):
|
|
44
|
+
"""Stop LSP server(s)."""
|
|
45
|
+
args = ["stop"]
|
|
46
|
+
if json_output:
|
|
47
|
+
args.append("--json")
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
from ..features.lsp_cli import run_lsp_command
|
|
51
|
+
exit_code = run_lsp_command(args)
|
|
52
|
+
raise typer.Exit(exit_code)
|
|
53
|
+
except ImportError as e:
|
|
54
|
+
output = get_output_controller()
|
|
55
|
+
output.print_error(f"LSP module not available: {e}")
|
|
56
|
+
raise typer.Exit(4)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@app.command("status")
|
|
60
|
+
def lsp_status(
|
|
61
|
+
workspace: str = typer.Option(".", "--workspace", "-w", help="Workspace root directory"),
|
|
62
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
63
|
+
):
|
|
64
|
+
"""Show LSP status."""
|
|
65
|
+
args = ["status", "--workspace", workspace]
|
|
66
|
+
if json_output:
|
|
67
|
+
args.append("--json")
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
from ..features.lsp_cli import run_lsp_command
|
|
71
|
+
exit_code = run_lsp_command(args)
|
|
72
|
+
raise typer.Exit(exit_code)
|
|
73
|
+
except ImportError as e:
|
|
74
|
+
output = get_output_controller()
|
|
75
|
+
output.print_error(f"LSP module not available: {e}")
|
|
76
|
+
raise typer.Exit(4)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@app.command("logs")
|
|
80
|
+
def lsp_logs(
|
|
81
|
+
tail: int = typer.Option(50, "--tail", "-n", help="Number of lines to show"),
|
|
82
|
+
json_output: bool = typer.Option(False, "--json", help="Output JSON"),
|
|
83
|
+
):
|
|
84
|
+
"""Show recent LSP logs."""
|
|
85
|
+
args = ["logs", "--tail", str(tail)]
|
|
86
|
+
if json_output:
|
|
87
|
+
args.append("--json")
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
from ..features.lsp_cli import run_lsp_command
|
|
91
|
+
exit_code = run_lsp_command(args)
|
|
92
|
+
raise typer.Exit(exit_code)
|
|
93
|
+
except ImportError as e:
|
|
94
|
+
output = get_output_controller()
|
|
95
|
+
output.print_error(f"LSP module not available: {e}")
|
|
96
|
+
raise typer.Exit(4)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@app.callback(invoke_without_command=True)
|
|
100
|
+
def lsp_callback(ctx: typer.Context):
|
|
101
|
+
"""Show LSP help."""
|
|
102
|
+
if ctx.invoked_subcommand is None:
|
|
103
|
+
output = get_output_controller()
|
|
104
|
+
output.print_panel(
|
|
105
|
+
"LSP service lifecycle management.\n\n"
|
|
106
|
+
"Commands:\n"
|
|
107
|
+
" start Start LSP server(s)\n"
|
|
108
|
+
" stop Stop LSP server(s)\n"
|
|
109
|
+
" status Show LSP status\n"
|
|
110
|
+
" logs Show recent logs",
|
|
111
|
+
title="LSP Commands"
|
|
112
|
+
)
|